UNPKG

131 kBJavaScriptView Raw
1"use strict";function _interopDefault(e){return e&&"object"==typeof e&&"default"in e?e.default:e}Object.defineProperty(exports,"__esModule",{value:!0});var util=require("@hpcc-js/util"),xmldom=require("xmldom"),fetch$1=_interopDefault(require("node-fetch")),safeBuffer=require("safe-buffer"),cp=require("child_process"),fs=require("fs"),os=require("os"),path=require("path"),tmp=require("tmp"),PKG_NAME="@hpcc-js/comms",PKG_VERSION="2.17.0",BUILD_VERSION="2.20.0",extendStatics=function(e,t){return(extendStatics=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,t)};function __extends(e,t){function n(){this.constructor=e}extendStatics(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}var __assign=function(){return(__assign=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e}).apply(this,arguments)};function __awaiter(e,t,n,r){return new(n||(n=Promise))(function(o,i){function u(e){try{a(r.next(e))}catch(e){i(e)}}function s(e){try{a(r.throw(e))}catch(e){i(e)}}function a(e){e.done?o(e.value):new n(function(t){t(e.value)}).then(u,s)}a((r=r.apply(e,t||[])).next())})}function __generator(e,t){var n,r,o,i,u={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function s(i){return function(s){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;u;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return u.label++,{value:i[1],done:!1};case 5:u.label++,r=i[1],i=[0];continue;case 7:i=u.ops.pop(),u.trys.pop();continue;default:if(!(o=(o=u.trys).length>0&&o[o.length-1])&&(6===i[0]||2===i[0])){u=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){u.label=i[1];break}if(6===i[0]&&u.label<o[1]){u.label=o[1],o=i;break}if(o&&u.label<o[2]){u.label=o[2],u.ops.push(i);break}o[2]&&u.ops.pop(),u.trys.pop();continue}i=t.call(e,u)}catch(e){i=[6,e],r=0}finally{n=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,s])}}}function __spreadArrays(){for(var e=0,t=0,n=arguments.length;t<n;t++)e+=arguments[t].length;var r=Array(e),o=0;for(t=0;t<n;t++)for(var i=arguments[t],u=0,s=i.length;u<s;u++,o++)r[o]=i[u];return r}var logger=util.scopedLogger("comms/connection.ts");function instanceOfIOptions(e){return"baseUrl"in e}var DefaultOptions={type:"post",baseUrl:"",userID:"",password:"",rejectUnauthorized:!0,timeoutSecs:60};function instanceOfIConnection(e){return"function"==typeof e.opts&&"function"==typeof e.send&&"function"==typeof e.clone}function encode(e,t){return void 0===t||!0===t?encodeURIComponent(e):""+e}function serializeRequest(e,t,n){if(void 0===t&&(t=!0),void 0===n&&(n=""),n&&(n+="."),"object"!=typeof e)return encode(e,t);var r=[],o=function(o){if(e.hasOwnProperty(o))if(e[o]instanceof Array){var i=!1;e[o].forEach(function(e,u){"object"==typeof e?(i=!0,r.push(serializeRequest(e,t,n+encode(o+"."+u,t)))):r.push(n+encode(o+"_i"+u,t)+"="+serializeRequest(e,t))}),i&&r.push(n+encode(o+".itemcount",t)+"="+e[o].length)}else"object"==typeof e[o]?e[o]&&e[o].Item instanceof Array?(r.push(serializeRequest(e[o].Item,t,n+encode(o,t))),r.push(n+encode(o+".itemcount",t)+"="+e[o].Item.length)):r.push(serializeRequest(e[o],t,n+encode(o,t))):void 0!==e[o]?r.push(n+encode(o,t)+"="+encode(e[o],t)):r.push(n+encode(o,t))};for(var i in e)o(i);return r.join("&")}function deserializeResponse(e){return JSON.parse(e)}function jsonp(e,t,n,r,o){return void 0===n&&(n={}),void 0===r&&(r="json"),o&&console.warn("Header attributes ignored for JSONP connections"),new Promise(function(o,i){var u=1e3*e.timeoutSecs,s="jsonp_callback_"+Math.round(999999*Math.random());window[s]=function(e){u=0,l(),o("json"===r&&"string"==typeof e?deserializeResponse(e):e)};var a=document.createElement("script"),c=util.join(e.baseUrl,t);c+=c.indexOf("?")>=0?"&":"?",a.src=c+"jsonp="+s+"&"+serializeRequest(n,e.encodeRequest),document.body.appendChild(a);var p=setInterval(function(){u<=0?clearInterval(p):(u-=5e3)<=0?(clearInterval(p),logger.error("Request timeout: "+a.src),l(),i(Error("Request timeout: "+a.src))):logger.debug("Request pending ("+u/1e3+" sec): "+a.src)},5e3);function l(){delete window[s],document.body.removeChild(a)}})}function authHeader(e){return e.userID?{Authorization:"Basic "+btoa(e.userID+":"+e.password)}:{}}var _omitMap={};function doFetch(e,t,n,r,o){function i(e){if(e.ok)return"json"===o?e.json():e.text();throw new Error(e.statusText)}return r=__assign(__assign({},authHeader(e)),r),n=__assign(__assign({credentials:_omitMap[e.baseUrl]?"omit":"include"},n),{headers:r}),!1===e.rejectUnauthorized&&fetch.__agent&&0===e.baseUrl.indexOf("https:")&&(n.agent=fetch.__agent),util.promiseTimeout(1e3*e.timeoutSecs,fetch(util.join(e.baseUrl,t),n).then(i).catch(function(r){return n.credentials=_omitMap[e.baseUrl]?"include":"omit",fetch(util.join(e.baseUrl,t),n).then(i).then(function(t){return _omitMap[e.baseUrl]=!_omitMap[e.baseUrl],t})}))}function post(e,t,n,r,o){return void 0===r&&(r="json"),doFetch(e,t,{method:"post",body:serializeRequest(n,e.encodeRequest)},__assign({"Content-Type":"application/x-www-form-urlencoded"},o),r)}function get(e,t,n,r,o){return void 0===r&&(r="json"),doFetch(e,t+"?"+serializeRequest(n,e.encodeRequest),{method:"get"},__assign({},o),r)}function send(e,t,n,r,o){var i;switch(void 0===r&&(r="json"),e.type){case"jsonp":i=jsonp(e,t,n,r,o);break;case"get":i=get(e,t,n,r,o);break;case"post":default:i=post(e,t,n,r,o)}return i}var hookedSend=send;function hookSend(e){var t=hookedSend;return e&&(hookedSend=e),t}var Connection=function(){function e(e){this.opts(e)}return Object.defineProperty(e.prototype,"baseUrl",{get:function(){return this._opts.baseUrl},enumerable:!1,configurable:!0}),e.prototype.opts=function(e){return 0===arguments.length?this._opts:(this._opts=__assign(__assign({},DefaultOptions),e),this)},e.prototype.send=function(e,t,n,r){return void 0===n&&(n="json"),this._opts.hookSend?this._opts.hookSend(this._opts,e,t,n,hookedSend,r):hookedSend(this._opts,e,t,n,r)},e.prototype.clone=function(){return new e(this.opts())},e}();function setTransportFactory(e){var t=exports.createConnection;return exports.createConnection=e,t}function isArray(e){return"[object Array]"===Object.prototype.toString.call(e)}exports.createConnection=function(e){return new Connection(e)};var ESPExceptions=function(e){function t(t,n,r){var o=e.call(this,"ESPException: "+r.Source)||this;return o.isESPExceptions=!0,o.action=t,o.request=n,o.Source=r.Source,o.Exception=r.Exception,r.Exception.length&&(o.message=r.Exception[0].Code+": "+r.Exception[0].Message),o}return __extends(t,e),t}(Error);function isConnection(e){return void 0!==e.send}var ESPConnection=function(){function e(e,t,n){this._connection=isConnection(e)?e:exports.createConnection(e),this._service=t,this._version=n}return Object.defineProperty(e.prototype,"baseUrl",{get:function(){return this._connection.opts().baseUrl},enumerable:!1,configurable:!0}),e.prototype.service=function(e){return void 0===e?this._service:(this._service=e,this)},e.prototype.version=function(e){return void 0===e?this._version:(this._version=e,this)},e.prototype.toESPStringArray=function(e,t){if(isArray(e[t])){for(var n=0;n<e[t].length;++n)e[t+"_i"+n]=e[t][n];delete e[t]}return e},e.prototype.opts=function(e){return void 0===e?this._connection.opts():(this._connection.opts(e),this)},e.prototype.send=function(e,t,n,r){void 0===t&&(t={}),void 0===n&&(n="json"),void 0===r&&(r=!1);var o,i=__assign(__assign({},t),{ver_:this._version});r&&(i.upload_=!0);var u="json";switch(n){case"text":o=util.join(this._service,e),u="text";break;case"xsd":o=util.join(this._service,e+".xsd"),u="text";break;case"json2":o=util.join(this._service,e+"/json"),n="json";var s=e.split("/");e=s.pop();break;default:o=util.join(this._service,e+".json")}return this._connection.send(o,i,u).then(function(t){if("json"===n){var r=void 0;if(t&&t.Exceptions)throw new ESPExceptions(e,i,t.Exceptions);if(t&&(r=t[("WUCDebug"===e?"WUDebug":e)+"Response"]),!r)throw new ESPExceptions(e,i,{Source:"ESPConnection.send",Exception:[{Code:0,Message:"Missing Response"}]});return r}return t}).catch(function(t){if(t.isESPExceptions)throw t;throw new ESPExceptions(e,i,{Source:"ESPConnection.send",Exception:[{Code:0,Message:t.message}]})})},e.prototype.clone=function(){return new e(this._connection.clone(),this._service,this._version)},e}(),Service=function(){function e(e,t,n){this._connection=new ESPConnection(e,t,n)}return Object.defineProperty(e.prototype,"baseUrl",{get:function(){return this._connection.opts().baseUrl},enumerable:!1,configurable:!0}),e}(),AccountService=function(){function e(e){this._connection=new ESPConnection(e,"Ws_Account","1.03")}return e.prototype.connectionOptions=function(){return this._connection.opts()},e.prototype.VerifyUser=function(e){return this._connection.send("VerifyUser",e)},e}(),DFUService=function(e){function t(t){return e.call(this,t,"WsDfu","1.5")||this}return __extends(t,e),t.prototype.DFUQuery=function(e){return this._connection.send("DFUQuery",e)},t.prototype.DFUInfo=function(e){return this._connection.send("DFUInfo",e)},t}(Service);function jsonToIField(e,t){var n=typeof t;switch(n){case"boolean":case"number":case"string":return{id:e,type:n};case"object":if(t.Row instanceof Array&&(t=t.Row),t instanceof Array)return{id:e,type:"dataset",children:jsonToIFieldArr(t[0])};if(t instanceof Object){if(t.Item&&t.Item instanceof Array&&1===t.Item.length){var r=typeof t.Item[0];if("string"===r||"number"===r)return{id:e,type:"set",fieldType:r};throw new Error("Unknown field type")}return{id:e,type:"object",fields:jsonToIFieldObj(t)}}default:throw new Error("Unknown field type")}}function jsonToIFieldArr(e){e.Row&&e.Row instanceof Array&&(e=e.Row[0]);var t=[];for(var n in e)t.push(jsonToIField(n,e[n]));return t}function jsonToIFieldObj(e){var t={};for(var n in e)t[n]=jsonToIField(n,e[n]);return t}var EclService=function(e){function t(t){return e.call(this,t,"WsEcl","0")||this}return __extends(t,e),t.prototype.opts=function(){return this._connection.opts()},t.prototype.requestJson=function(e,t){return this._connection.send("example/request/query/"+e+"/"+t+"/json",{},"text").then(function(e){var t=JSON.parse(e);for(var n in t)return t[n];return{}}).then(jsonToIFieldArr)},t.prototype.responseJson=function(e,t){return this._connection.send("example/response/query/"+e+"/"+t+"/json",{},"text").then(function(e){var t=JSON.parse(e);for(var n in t)return t[n].Results;return{}}).then(function(e){var t={};for(var n in e)t[n]=jsonToIFieldArr(e[n]);return t})},t.prototype.submit=function(e,t,n){var r="submit/query/"+e+"/"+t;return this._connection.send(r,n,"json2").then(function(e){if(e.Results&&e.Results.Exception)throw new ESPExceptions(r,n,{Source:"wsEcl.submit",Exception:e.Results.Exception});return e.Results})},t}(Service);function ascending(e,t){return e<t?-1:e>t?1:e>=t?0:NaN}function bisector(e){return 1===e.length&&(e=ascendingComparator(e)),{left:function(t,n,r,o){for(null==r&&(r=0),null==o&&(o=t.length);r<o;){var i=r+o>>>1;e(t[i],n)<0?r=i+1:o=i}return r},right:function(t,n,r,o){for(null==r&&(r=0),null==o&&(o=t.length);r<o;){var i=r+o>>>1;e(t[i],n)>0?o=i:r=i+1}return r}}}function ascendingComparator(e){return function(t,n){return ascending(e(t),n)}}var ascendingBisect=bisector(ascending);function number(e){return null===e?NaN:+e}function d3Max(e,t){var n,r,o=e.length,i=-1;if(null==t){for(;++i<o;)if(null!=(n=e[i])&&n>=n)for(r=n;++i<o;)null!=(n=e[i])&&n>r&&(r=n)}else for(;++i<o;)if(null!=(n=t(e[i],i,e))&&n>=n)for(r=n;++i<o;)null!=(n=t(e[i],i,e))&&n>r&&(r=n);return r}function d3Mean(e,t){var n,r=e.length,o=r,i=-1,u=0;if(null==t)for(;++i<r;)isNaN(n=number(e[i]))?--o:u+=n;else for(;++i<r;)isNaN(n=number(t(e[i],i,e)))?--o:u+=n;if(o)return u/o}var MachineService=function(){function e(e){this._connection=new ESPConnection(e,"ws_machine","1.13")}return e.prototype.GetTargetClusterInfo=function(e){return void 0===e&&(e={}),this._connection.send("GetTargetClusterInfo",e)},e.prototype.GetTargetClusterUsage=function(e,t){return void 0===t&&(t=!1),this._connection.send("GetTargetClusterUsage",{TargetClusters:e?{Item:e}:{},BypassCachedResult:t}).then(function(e){return util.exists("TargetClusterUsages.TargetClusterUsage",e)?e.TargetClusterUsages.TargetClusterUsage:[]})},e.prototype.GetTargetClusterUsageEx=function(e,t){return void 0===t&&(t=!1),this.GetTargetClusterUsage(e,t).then(function(e){return e.filter(function(e){return!!e.ComponentUsages}).map(function(e){var t=e.ComponentUsages.ComponentUsage.map(function(e){var t=(e.MachineUsages&&e.MachineUsages.MachineUsage?e.MachineUsages.MachineUsage:[]).map(function(e){var t=e.DiskUsages&&e.DiskUsages.DiskUsage?e.DiskUsages.DiskUsage.map(function(e){return __assign(__assign({},e),{Total:e.InUse+e.Available,PercentUsed:100-e.PercentAvailable})}):[];return{Name:e.Name,NetAddress:e.NetAddress,Description:e.Description,DiskUsages:t,mean:d3Mean(t.filter(function(e){return!isNaN(e.PercentUsed)}),function(e){return e.PercentUsed}),max:d3Max(t.filter(function(e){return!isNaN(e.PercentUsed)}),function(e){return e.PercentUsed})}});return{Type:e.Type,Name:e.Name,Description:e.Description,MachineUsages:t,MachineUsagesDescription:t.reduce(function(e,t){return e+(t.Description||"")},""),mean:d3Mean(t.filter(function(e){return!isNaN(e.mean)}),function(e){return e.mean}),max:d3Max(t.filter(function(e){return!isNaN(e.max)}),function(e){return e.max})}});return{Name:e.Name,Description:e.Description,ComponentUsages:t,ComponentUsagesDescription:t.reduce(function(e,t){return e+(t.MachineUsagesDescription||"")},""),mean:d3Mean(t.filter(function(e){return!isNaN(e.mean)}),function(e){return e.mean}),max:d3Max(t.filter(function(e){return!isNaN(e.max)}),function(e){return e.max})}})})},e}(),SMCService=function(){function e(e){this._connection=new ESPConnection(e,"WsSMC","1.19")}return e.prototype.connectionOptions=function(){return this._connection.opts()},e.prototype.Activity=function(e){return this._connection.send("Activity",e).then(function(e){return __assign({Running:{ActiveWorkunit:[]}},e)})},e}(),StoreService=function(e){function t(t){return e.call(this,t,"WsStore","1")||this}return __extends(t,e),t.prototype.CreateStore=function(e){return this._connection.send("Fetch",e)},t.prototype.Delete=function(e){return this._connection.send("Delete",e).catch(function(e){if(e.isESPExceptions&&e.Exception.some(function(e){return-1===e.Code}))return{Exceptions:void 0,Success:!0};throw e})},t.prototype.DeleteNamespace=function(e){return this._connection.send("DeleteNamespace",e)},t.prototype.Fetch=function(e){return this._connection.send("Fetch",e).catch(function(e){if(e.isESPExceptions&&e.Exception.some(function(e){return-1===e.Code}))return{Exceptions:void 0,Value:void 0};throw e})},t.prototype.FetchAll=function(e){return this._connection.send("FetchAll",e)},t.prototype.FetchKeyMD=function(e){return this._connection.send("FetchKeyMD",e)},t.prototype.ListKeys=function(e){return this._connection.send("ListKeys",e)},t.prototype.ListNamespaces=function(e){return this._connection.send("ListNamespaces",e)},t.prototype.Set=function(e){return this._connection.send("Set",e)},t}(Service),TopologyService=function(e){function t(t){return e.call(this,t,"WsTopology","1.25")||this}return __extends(t,e),t.prototype.connectionOptions=function(){return this._connection.opts()},t.prototype.protocol=function(){return this._connection.opts().baseUrl.split("//")[0]},t.prototype.ip=function(){return this._connection.opts().baseUrl.split("//")[1].split(":")[0]},t.prototype.TpLogicalClusterQuery=function(e){return void 0===e&&(e={}),this._connection.send("TpLogicalClusterQuery",e)},t.prototype.DefaultTpLogicalClusterQuery=function(e){return void 0===e&&(e={}),this.TpLogicalClusterQuery(e).then(function(e){return e.default?e.default:(e.TpLogicalClusters.TpLogicalCluster.some(function(e,r){return 0===r&&(n=e),"hthor"===e.Type&&(t=e,!0)}),t||n);var t,n})},t.prototype.TpServiceQuery=function(e){return this._connection.send("TpServiceQuery",e)},t.prototype.TpTargetClusterQuery=function(e){return this._connection.send("TpTargetClusterQuery",e)},t.prototype.TpListTargetClusters=function(e){return this._connection.send("TpListTargetClusters",e)},t}(Service);function isWUQueryECLWorkunit(e){return void 0!==e.TotalClusterTime}function isWUInfoWorkunit(e){return void 0!==e.StateEx}!function(e){e[e.Unknown=0]="Unknown",e[e.Compiled=1]="Compiled",e[e.Running=2]="Running",e[e.Completed=3]="Completed",e[e.Failed=4]="Failed",e[e.Archived=5]="Archived",e[e.Aborting=6]="Aborting",e[e.Aborted=7]="Aborted",e[e.Blocked=8]="Blocked",e[e.Submitted=9]="Submitted",e[e.Scheduled=10]="Scheduled",e[e.Compiling=11]="Compiling",e[e.Wait=12]="Wait",e[e.UploadingFiled=13]="UploadingFiled",e[e.DebugPaused=14]="DebugPaused",e[e.DebugRunning=15]="DebugRunning",e[e.Paused=16]="Paused",e[e.LAST=17]="LAST",e[e.NotFound=999]="NotFound"}(exports.WUStateID||(exports.WUStateID={})),function(e){!function(e){e[e.Unknown=0]="Unknown",e[e.Compile=1]="Compile",e[e.Check=2]="Check",e[e.Run=3]="Run",e[e.ExecuteExisting=4]="ExecuteExisting",e[e.Pause=5]="Pause",e[e.PauseNow=6]="PauseNow",e[e.Resume=7]="Resume",e[e.Debug=8]="Debug",e[e.__size=9]="__size"}(e.Action||(e.Action={}))}(exports.WUUpdate||(exports.WUUpdate={}));var WorkunitsService=function(e){function t(t){return e.call(this,t,"WsWorkunits","1.68")||this}return __extends(t,e),t.prototype.opts=function(){return this._connection.opts()},t.prototype.connection=function(){return this._connection},t.prototype.WUQuery=function(e){return void 0===e&&(e={}),this._connection.send("WUQuery",e).then(function(e){return util.deepMixin({Workunits:{ECLWorkunit:[]}},e)})},t.prototype.WUInfo=function(e){var t=__assign({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,SuppressResultSchemas:!0},e);return this._connection.send("WUInfo",t)},t.prototype.WUCreate=function(){return this._connection.send("WUCreate")},t.prototype.WUUpdate=function(e){return this._connection.send("WUUpdate",e,"json",!0)},t.prototype.WUSubmit=function(e){return this._connection.send("WUSubmit",e)},t.prototype.WUResubmit=function(e){return this._connection.toESPStringArray(e,"Wuids"),this._connection.send("WUResubmit",e)},t.prototype.WUQueryDetails=function(e){return this._connection.send("WUQueryDetails",e)},t.prototype.WUListQueries=function(e){return this._connection.send("WUListQueries",e)},t.prototype.WUPushEvent=function(e){return this._connection.send("WUPushEvent",e)},t.prototype.WUAction=function(e){return e.ActionType=e.WUActionType,this._connection.send("WUAction",e)},t.prototype.WUGetZAPInfo=function(e){return this._connection.send("WUGetZAPInfo",e)},t.prototype.WUShowScheduled=function(e){return this._connection.send("WUShowScheduled",e)},t.prototype.WUQuerySetAliasAction=function(e){return this._connection.send("WUQuerySetAliasAction",e)},t.prototype.WUQuerySetQueryAction=function(e){return this._connection.send("WUQuerySetQueryAction",e)},t.prototype.WUPublishWorkunit=function(e){return this._connection.send("WUPublishWorkunit",e)},t.prototype.WUGetGraph=function(e){return this._connection.send("WUGetGraph",e)},t.prototype.WUResult=function(e){return this._connection.send("WUResult",e)},t.prototype.WUQueryGetGraph=function(e){return this._connection.send("WUQueryGetGraph",e)},t.prototype.WUFile=function(e){return this._connection.send("WUFile",e,"text")},t.prototype.WUGetStats=function(e){return this._connection.send("WUGetStats",e)},t.prototype.WUDetailsMeta=function(e){return this._WUDetailsMetaPromise||(this._WUDetailsMetaPromise=this._connection.send("WUDetailsMeta",e)),this._WUDetailsMetaPromise},t.prototype.WUDetails=function(e){return this._connection.send("WUDetails",e)},t.prototype.WUCDebug=function(e){return this._connection.send("WUCDebug",e).then(function(e){var t=util.xml2json(e.Result).children();return t.length?t[0]:null})},t}(Service),t0=new Date,t1=new Date;function newInterval(e,t,n,r){function o(t){return e(t=new Date(+t)),t}return o.floor=o,o.ceil=function(n){return e(n=new Date(n-1)),t(n,1),e(n),n},o.round=function(e){var t=o(e),n=o.ceil(e);return e-t<n-e?t:n},o.offset=function(e,n){return t(e=new Date(+e),null==n?1:Math.floor(n)),e},o.range=function(n,r,i){var u=[];if(n=o.ceil(n),i=null==i?1:Math.floor(i),!(n<r&&i>0))return u;do{u.push(new Date(+n))}while(t(n,i),e(n),n<r);return u},o.filter=function(n){return newInterval(function(t){if(t>=t)for(;e(t),!n(t);)t.setTime(t-1)},function(e,r){if(e>=e)for(;--r>=0;)for(;t(e,1),!n(e););})},n&&(o.count=function(t,r){return t0.setTime(+t),t1.setTime(+r),e(t0),e(t1),Math.floor(n(t0,t1))},o.every=function(e){return e=Math.floor(e),isFinite(e)&&e>0?e>1?o.filter(r?function(t){return r(t)%e==0}:function(t){return o.count(0,t)%e==0}):o:null}),o}var millisecond=newInterval(function(){},function(e,t){e.setTime(+e+t)},function(e,t){return t-e});millisecond.every=function(e){return e=Math.floor(e),isFinite(e)&&e>0?e>1?newInterval(function(t){t.setTime(Math.floor(t/e)*e)},function(t,n){t.setTime(+t+n*e)},function(t,n){return(n-t)/e}):millisecond:null};var durationSecond=1e3,durationMinute=6e4,durationHour=36e5,durationDay=864e5,durationWeek=6048e5,second=newInterval(function(e){e.setTime(Math.floor(e/durationSecond)*durationSecond)},function(e,t){e.setTime(+e+t*durationSecond)},function(e,t){return(t-e)/durationSecond},function(e){return e.getUTCSeconds()}),minute=newInterval(function(e){e.setTime(Math.floor(e/durationMinute)*durationMinute)},function(e,t){e.setTime(+e+t*durationMinute)},function(e,t){return(t-e)/durationMinute},function(e){return e.getMinutes()}),hour=newInterval(function(e){var t=e.getTimezoneOffset()*durationMinute%durationHour;t<0&&(t+=durationHour),e.setTime(Math.floor((+e-t)/durationHour)*durationHour+t)},function(e,t){e.setTime(+e+t*durationHour)},function(e,t){return(t-e)/durationHour},function(e){return e.getHours()}),day=newInterval(function(e){e.setHours(0,0,0,0)},function(e,t){e.setDate(e.getDate()+t)},function(e,t){return(t-e-(t.getTimezoneOffset()-e.getTimezoneOffset())*durationMinute)/durationDay},function(e){return e.getDate()-1});function weekday(e){return newInterval(function(t){t.setDate(t.getDate()-(t.getDay()+7-e)%7),t.setHours(0,0,0,0)},function(e,t){e.setDate(e.getDate()+7*t)},function(e,t){return(t-e-(t.getTimezoneOffset()-e.getTimezoneOffset())*durationMinute)/durationWeek})}var sunday=weekday(0),monday=weekday(1),tuesday=weekday(2),wednesday=weekday(3),thursday=weekday(4),friday=weekday(5),saturday=weekday(6),month=newInterval(function(e){e.setDate(1),e.setHours(0,0,0,0)},function(e,t){e.setMonth(e.getMonth()+t)},function(e,t){return t.getMonth()-e.getMonth()+12*(t.getFullYear()-e.getFullYear())},function(e){return e.getMonth()}),year=newInterval(function(e){e.setMonth(0,1),e.setHours(0,0,0,0)},function(e,t){e.setFullYear(e.getFullYear()+t)},function(e,t){return t.getFullYear()-e.getFullYear()},function(e){return e.getFullYear()});year.every=function(e){return isFinite(e=Math.floor(e))&&e>0?newInterval(function(t){t.setFullYear(Math.floor(t.getFullYear()/e)*e),t.setMonth(0,1),t.setHours(0,0,0,0)},function(t,n){t.setFullYear(t.getFullYear()+n*e)}):null};var utcMinute=newInterval(function(e){e.setUTCSeconds(0,0)},function(e,t){e.setTime(+e+t*durationMinute)},function(e,t){return(t-e)/durationMinute},function(e){return e.getUTCMinutes()}),utcHour=newInterval(function(e){e.setUTCMinutes(0,0,0)},function(e,t){e.setTime(+e+t*durationHour)},function(e,t){return(t-e)/durationHour},function(e){return e.getUTCHours()}),utcDay=newInterval(function(e){e.setUTCHours(0,0,0,0)},function(e,t){e.setUTCDate(e.getUTCDate()+t)},function(e,t){return(t-e)/durationDay},function(e){return e.getUTCDate()-1});function utcWeekday(e){return newInterval(function(t){t.setUTCDate(t.getUTCDate()-(t.getUTCDay()+7-e)%7),t.setUTCHours(0,0,0,0)},function(e,t){e.setUTCDate(e.getUTCDate()+7*t)},function(e,t){return(t-e)/durationWeek})}var utcSunday=utcWeekday(0),utcMonday=utcWeekday(1),utcTuesday=utcWeekday(2),utcWednesday=utcWeekday(3),utcThursday=utcWeekday(4),utcFriday=utcWeekday(5),utcSaturday=utcWeekday(6),utcMonth=newInterval(function(e){e.setUTCDate(1),e.setUTCHours(0,0,0,0)},function(e,t){e.setUTCMonth(e.getUTCMonth()+t)},function(e,t){return t.getUTCMonth()-e.getUTCMonth()+12*(t.getUTCFullYear()-e.getUTCFullYear())},function(e){return e.getUTCMonth()}),utcYear=newInterval(function(e){e.setUTCMonth(0,1),e.setUTCHours(0,0,0,0)},function(e,t){e.setUTCFullYear(e.getUTCFullYear()+t)},function(e,t){return t.getUTCFullYear()-e.getUTCFullYear()},function(e){return e.getUTCFullYear()});function localDate(e){if(0<=e.y&&e.y<100){var t=new Date(-1,e.m,e.d,e.H,e.M,e.S,e.L);return t.setFullYear(e.y),t}return new Date(e.y,e.m,e.d,e.H,e.M,e.S,e.L)}function utcDate(e){if(0<=e.y&&e.y<100){var t=new Date(Date.UTC(-1,e.m,e.d,e.H,e.M,e.S,e.L));return t.setUTCFullYear(e.y),t}return new Date(Date.UTC(e.y,e.m,e.d,e.H,e.M,e.S,e.L))}function newYear(e){return{y:e,m:0,d:1,H:0,M:0,S:0,L:0}}function formatLocale(e){var t=e.dateTime,n=e.date,r=e.time,o=e.periods,i=e.days,u=e.shortDays,s=e.months,a=e.shortMonths,c=formatRe(o),p=formatLookup(o),l=formatRe(i),f=formatLookup(i),h=formatRe(u),d=formatLookup(u),g=formatRe(s),y=formatLookup(s),b=formatRe(a),m=formatLookup(a),v={a:function(e){return u[e.getDay()]},A:function(e){return i[e.getDay()]},b:function(e){return a[e.getMonth()]},B:function(e){return s[e.getMonth()]},c:null,d:formatDayOfMonth,e:formatDayOfMonth,f:formatMicroseconds,H:formatHour24,I:formatHour12,j:formatDayOfYear,L:formatMilliseconds,m:formatMonthNumber,M:formatMinutes,p:function(e){return o[+(e.getHours()>=12)]},Q:formatUnixTimestamp,s:formatUnixTimestampSeconds,S:formatSeconds,u:formatWeekdayNumberMonday,U:formatWeekNumberSunday,V:formatWeekNumberISO,w:formatWeekdayNumberSunday,W:formatWeekNumberMonday,x:null,X:null,y:formatYear,Y:formatFullYear,Z:formatZone,"%":formatLiteralPercent},S={a:function(e){return u[e.getUTCDay()]},A:function(e){return i[e.getUTCDay()]},b:function(e){return a[e.getUTCMonth()]},B:function(e){return s[e.getUTCMonth()]},c:null,d:formatUTCDayOfMonth,e:formatUTCDayOfMonth,f:formatUTCMicroseconds,H:formatUTCHour24,I:formatUTCHour12,j:formatUTCDayOfYear,L:formatUTCMilliseconds,m:formatUTCMonthNumber,M:formatUTCMinutes,p:function(e){return o[+(e.getUTCHours()>=12)]},Q:formatUnixTimestamp,s:formatUnixTimestampSeconds,S:formatUTCSeconds,u:formatUTCWeekdayNumberMonday,U:formatUTCWeekNumberSunday,V:formatUTCWeekNumberISO,w:formatUTCWeekdayNumberSunday,W:formatUTCWeekNumberMonday,x:null,X:null,y:formatUTCYear,Y:formatUTCFullYear,Z:formatUTCZone,"%":formatLiteralPercent},C={a:function(e,t,n){var r=h.exec(t.slice(n));return r?(e.w=d[r[0].toLowerCase()],n+r[0].length):-1},A:function(e,t,n){var r=l.exec(t.slice(n));return r?(e.w=f[r[0].toLowerCase()],n+r[0].length):-1},b:function(e,t,n){var r=b.exec(t.slice(n));return r?(e.m=m[r[0].toLowerCase()],n+r[0].length):-1},B:function(e,t,n){var r=g.exec(t.slice(n));return r?(e.m=y[r[0].toLowerCase()],n+r[0].length):-1},c:function(e,n,r){return w(e,t,n,r)},d:parseDayOfMonth,e:parseDayOfMonth,f:parseMicroseconds,H:parseHour24,I:parseHour24,j:parseDayOfYear,L:parseMilliseconds,m:parseMonthNumber,M:parseMinutes,p:function(e,t,n){var r=c.exec(t.slice(n));return r?(e.p=p[r[0].toLowerCase()],n+r[0].length):-1},Q:parseUnixTimestamp,s:parseUnixTimestampSeconds,S:parseSeconds,u:parseWeekdayNumberMonday,U:parseWeekNumberSunday,V:parseWeekNumberISO,w:parseWeekdayNumberSunday,W:parseWeekNumberMonday,x:function(e,t,r){return w(e,n,t,r)},X:function(e,t,n){return w(e,r,t,n)},y:parseYear,Y:parseFullYear,Z:parseZone,"%":parseLiteralPercent};function _(e,t){return function(n){var r,o,i,u=[],s=-1,a=0,c=e.length;for(n instanceof Date||(n=new Date(+n));++s<c;)37===e.charCodeAt(s)&&(u.push(e.slice(a,s)),null!=(o=pads[r=e.charAt(++s)])?r=e.charAt(++s):o="e"===r?" ":"0",(i=t[r])&&(r=i(n,o)),u.push(r),a=s+1);return u.push(e.slice(a,s)),u.join("")}}function P(e,t){return function(n){var r,o,i=newYear(1900);if(w(i,e,n+="",0)!=n.length)return null;if("Q"in i)return new Date(i.Q);if("p"in i&&(i.H=i.H%12+12*i.p),"V"in i){if(i.V<1||i.V>53)return null;"w"in i||(i.w=1),"Z"in i?(o=(r=utcDate(newYear(i.y))).getUTCDay(),r=o>4||0===o?utcMonday.ceil(r):utcMonday(r),r=utcDay.offset(r,7*(i.V-1)),i.y=r.getUTCFullYear(),i.m=r.getUTCMonth(),i.d=r.getUTCDate()+(i.w+6)%7):(o=(r=t(newYear(i.y))).getDay(),r=o>4||0===o?monday.ceil(r):monday(r),r=day.offset(r,7*(i.V-1)),i.y=r.getFullYear(),i.m=r.getMonth(),i.d=r.getDate()+(i.w+6)%7)}else("W"in i||"U"in i)&&("w"in i||(i.w="u"in i?i.u%7:"W"in i?1:0),o="Z"in i?utcDate(newYear(i.y)).getUTCDay():t(newYear(i.y)).getDay(),i.m=0,i.d="W"in i?(i.w+6)%7+7*i.W-(o+5)%7:i.w+7*i.U-(o+6)%7);return"Z"in i?(i.H+=i.Z/100|0,i.M+=i.Z%100,utcDate(i)):t(i)}}function w(e,t,n,r){for(var o,i,u=0,s=t.length,a=n.length;u<s;){if(r>=a)return-1;if(37===(o=t.charCodeAt(u++))){if(o=t.charAt(u++),!(i=C[o in pads?t.charAt(u++):o])||(r=i(e,n,r))<0)return-1}else if(o!=n.charCodeAt(r++))return-1}return r}return v.x=_(n,v),v.X=_(r,v),v.c=_(t,v),S.x=_(n,S),S.X=_(r,S),S.c=_(t,S),{format:function(e){var t=_(e+="",v);return t.toString=function(){return e},t},parse:function(e){var t=P(e+="",localDate);return t.toString=function(){return e},t},utcFormat:function(e){var t=_(e+="",S);return t.toString=function(){return e},t},utcParse:function(e){var t=P(e,utcDate);return t.toString=function(){return e},t}}}utcYear.every=function(e){return isFinite(e=Math.floor(e))&&e>0?newInterval(function(t){t.setUTCFullYear(Math.floor(t.getUTCFullYear()/e)*e),t.setUTCMonth(0,1),t.setUTCHours(0,0,0,0)},function(t,n){t.setUTCFullYear(t.getUTCFullYear()+n*e)}):null};var locale,timeFormat,timeParse,utcFormat,utcParse,pads={"-":"",_:" ",0:"0"},numberRe=/^\s*\d+/,percentRe=/^%/,requoteRe=/[\\^$*+?|[\]().{}]/g;function pad(e,t,n){var r=e<0?"-":"",o=(r?-e:e)+"",i=o.length;return r+(i<n?new Array(n-i+1).join(t)+o:o)}function requote(e){return e.replace(requoteRe,"\\$&")}function formatRe(e){return new RegExp("^(?:"+e.map(requote).join("|")+")","i")}function formatLookup(e){for(var t={},n=-1,r=e.length;++n<r;)t[e[n].toLowerCase()]=n;return t}function parseWeekdayNumberSunday(e,t,n){var r=numberRe.exec(t.slice(n,n+1));return r?(e.w=+r[0],n+r[0].length):-1}function parseWeekdayNumberMonday(e,t,n){var r=numberRe.exec(t.slice(n,n+1));return r?(e.u=+r[0],n+r[0].length):-1}function parseWeekNumberSunday(e,t,n){var r=numberRe.exec(t.slice(n,n+2));return r?(e.U=+r[0],n+r[0].length):-1}function parseWeekNumberISO(e,t,n){var r=numberRe.exec(t.slice(n,n+2));return r?(e.V=+r[0],n+r[0].length):-1}function parseWeekNumberMonday(e,t,n){var r=numberRe.exec(t.slice(n,n+2));return r?(e.W=+r[0],n+r[0].length):-1}function parseFullYear(e,t,n){var r=numberRe.exec(t.slice(n,n+4));return r?(e.y=+r[0],n+r[0].length):-1}function parseYear(e,t,n){var r=numberRe.exec(t.slice(n,n+2));return r?(e.y=+r[0]+(+r[0]>68?1900:2e3),n+r[0].length):-1}function parseZone(e,t,n){var r=/^(Z)|([+-]\d\d)(?::?(\d\d))?/.exec(t.slice(n,n+6));return r?(e.Z=r[1]?0:-(r[2]+(r[3]||"00")),n+r[0].length):-1}function parseMonthNumber(e,t,n){var r=numberRe.exec(t.slice(n,n+2));return r?(e.m=r[0]-1,n+r[0].length):-1}function parseDayOfMonth(e,t,n){var r=numberRe.exec(t.slice(n,n+2));return r?(e.d=+r[0],n+r[0].length):-1}function parseDayOfYear(e,t,n){var r=numberRe.exec(t.slice(n,n+3));return r?(e.m=0,e.d=+r[0],n+r[0].length):-1}function parseHour24(e,t,n){var r=numberRe.exec(t.slice(n,n+2));return r?(e.H=+r[0],n+r[0].length):-1}function parseMinutes(e,t,n){var r=numberRe.exec(t.slice(n,n+2));return r?(e.M=+r[0],n+r[0].length):-1}function parseSeconds(e,t,n){var r=numberRe.exec(t.slice(n,n+2));return r?(e.S=+r[0],n+r[0].length):-1}function parseMilliseconds(e,t,n){var r=numberRe.exec(t.slice(n,n+3));return r?(e.L=+r[0],n+r[0].length):-1}function parseMicroseconds(e,t,n){var r=numberRe.exec(t.slice(n,n+6));return r?(e.L=Math.floor(r[0]/1e3),n+r[0].length):-1}function parseLiteralPercent(e,t,n){var r=percentRe.exec(t.slice(n,n+1));return r?n+r[0].length:-1}function parseUnixTimestamp(e,t,n){var r=numberRe.exec(t.slice(n));return r?(e.Q=+r[0],n+r[0].length):-1}function parseUnixTimestampSeconds(e,t,n){var r=numberRe.exec(t.slice(n));return r?(e.Q=1e3*+r[0],n+r[0].length):-1}function formatDayOfMonth(e,t){return pad(e.getDate(),t,2)}function formatHour24(e,t){return pad(e.getHours(),t,2)}function formatHour12(e,t){return pad(e.getHours()%12||12,t,2)}function formatDayOfYear(e,t){return pad(1+day.count(year(e),e),t,3)}function formatMilliseconds(e,t){return pad(e.getMilliseconds(),t,3)}function formatMicroseconds(e,t){return formatMilliseconds(e,t)+"000"}function formatMonthNumber(e,t){return pad(e.getMonth()+1,t,2)}function formatMinutes(e,t){return pad(e.getMinutes(),t,2)}function formatSeconds(e,t){return pad(e.getSeconds(),t,2)}function formatWeekdayNumberMonday(e){var t=e.getDay();return 0===t?7:t}function formatWeekNumberSunday(e,t){return pad(sunday.count(year(e),e),t,2)}function formatWeekNumberISO(e,t){var n=e.getDay();return e=n>=4||0===n?thursday(e):thursday.ceil(e),pad(thursday.count(year(e),e)+(4===year(e).getDay()),t,2)}function formatWeekdayNumberSunday(e){return e.getDay()}function formatWeekNumberMonday(e,t){return pad(monday.count(year(e),e),t,2)}function formatYear(e,t){return pad(e.getFullYear()%100,t,2)}function formatFullYear(e,t){return pad(e.getFullYear()%1e4,t,4)}function formatZone(e){var t=e.getTimezoneOffset();return(t>0?"-":(t*=-1,"+"))+pad(t/60|0,"0",2)+pad(t%60,"0",2)}function formatUTCDayOfMonth(e,t){return pad(e.getUTCDate(),t,2)}function formatUTCHour24(e,t){return pad(e.getUTCHours(),t,2)}function formatUTCHour12(e,t){return pad(e.getUTCHours()%12||12,t,2)}function formatUTCDayOfYear(e,t){return pad(1+utcDay.count(utcYear(e),e),t,3)}function formatUTCMilliseconds(e,t){return pad(e.getUTCMilliseconds(),t,3)}function formatUTCMicroseconds(e,t){return formatUTCMilliseconds(e,t)+"000"}function formatUTCMonthNumber(e,t){return pad(e.getUTCMonth()+1,t,2)}function formatUTCMinutes(e,t){return pad(e.getUTCMinutes(),t,2)}function formatUTCSeconds(e,t){return pad(e.getUTCSeconds(),t,2)}function formatUTCWeekdayNumberMonday(e){var t=e.getUTCDay();return 0===t?7:t}function formatUTCWeekNumberSunday(e,t){return pad(utcSunday.count(utcYear(e),e),t,2)}function formatUTCWeekNumberISO(e,t){var n=e.getUTCDay();return e=n>=4||0===n?utcThursday(e):utcThursday.ceil(e),pad(utcThursday.count(utcYear(e),e)+(4===utcYear(e).getUTCDay()),t,2)}function formatUTCWeekdayNumberSunday(e){return e.getUTCDay()}function formatUTCWeekNumberMonday(e,t){return pad(utcMonday.count(utcYear(e),e),t,2)}function formatUTCYear(e,t){return pad(e.getUTCFullYear()%100,t,2)}function formatUTCFullYear(e,t){return pad(e.getUTCFullYear()%1e4,t,4)}function formatUTCZone(){return"+0000"}function formatLiteralPercent(){return"%"}function formatUnixTimestamp(e){return+e}function formatUnixTimestampSeconds(e){return Math.floor(+e/1e3)}function defaultLocale(e){return locale=formatLocale(e),timeFormat=locale.format,timeParse=locale.parse,utcFormat=locale.utcFormat,utcParse=locale.utcParse,locale}defaultLocale({dateTime:"%x, %X",date:"%-m/%-d/%Y",time:"%-I:%M:%S %p",periods:["AM","PM"],days:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],shortDays:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],months:["January","February","March","April","May","June","July","August","September","October","November","December"],shortMonths:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"]});var isoSpecifier="%Y-%m-%dT%H:%M:%S.%LZ";function formatIsoNative(e){return e.toISOString()}var formatIso=Date.prototype.toISOString?formatIsoNative:utcFormat(isoSpecifier);function parseIsoNative(e){var t=new Date(e);return isNaN(t)?null:t}var parseIso=+new Date("2000-01-01T00:00:00.000Z")?parseIsoNative:utcParse(isoSpecifier),ECLGraph=function(e){function t(t,n,r){var o=e.call(this)||this;o.wu=t;for(var i=0,u=0,s=r;u<s.length;u++){var a=s[u];if(a.GraphName===n.Name&&!a.HasSubGraphId){i=Math.round(1e3*a.Seconds)/1e3;break}}return o.set(__assign({Time:i},n)),o}return __extends(t,e),Object.defineProperty(t.prototype,"properties",{get:function(){return this.get()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"Name",{get:function(){return this.get("Name")},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"Label",{get:function(){return this.get("Label")},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"Type",{get:function(){return this.get("Type")},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"Complete",{get:function(){return this.get("Complete")},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"WhenStarted",{get:function(){return this.get("WhenStarted")},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"WhenFinished",{get:function(){return this.get("WhenFinished")},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"Time",{get:function(){return this.get("Time")},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"Running",{get:function(){return this.get("Running")},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"RunningId",{get:function(){return this.get("RunningId")},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"Failed",{get:function(){return this.get("Failed")},enumerable:!1,configurable:!0}),t.prototype.fetchScopeGraph=function(e){return e?this.wu.fetchGraphDetails([e],["subgraph"]).then(function(e){return createGraph(e)}):this.wu.fetchGraphDetails([this.Name],["graph"]).then(function(e){return createGraph(e)})},t}(util.StateObject),GraphCache=function(e){function t(){return e.call(this,function(e){return util.Cache.hash([e.Name])})||this}return __extends(t,e),t}(util.Cache);function walkXmlJson(e,t,n){(n=n||[]).push(e),t(e.name,e.$,e.children(),n),e.children().forEach(function(e){walkXmlJson(e,t,n)}),n.pop()}function flattenAtt(e){var t={};return e.forEach(function(e){"att"===e.name&&(t[e.$.name]=e.$.value)}),t}var XGMMLGraph=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return __extends(t,e),t}(util.Graph),XGMMLSubgraph=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return __extends(t,e),t}(util.Subgraph),XGMMLVertex=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return __extends(t,e),t}(util.Vertex),XGMMLEdge=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return __extends(t,e),t}(util.Edge);function createXGMMLGraph(e,t){var n={},r={},o={},i=new XGMMLGraph(function(e){return e._.id}),u=[i.root];return walkXmlJson(t,function(e,t,i,s){var a=u[u.length-1];switch(e){case"graph":break;case"node":if(i.length&&i[0].children().length&&"graph"===i[0].children()[0].name){var c=a.createSubgraph(flattenAtt(i));u.push(c),n[t.id]=c}var p=a.createVertex(flattenAtt(i));r[t.id]=p;break;case"edge":var l=a.createEdge(r[t.source],r[t.target],flattenAtt(i));o[t.id]=l}}),i}var ScopeGraph=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return __extends(t,e),t}(util.Graph),ScopeSubgraph=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return __extends(t,e),t}(util.Subgraph),ScopeVertex=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return __extends(t,e),t}(util.Vertex),ScopeEdge=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return __extends(t,e),t}(util.Edge);function createGraph(e){for(var t,n={},r={},o=0,i=e;o<i.length;o++){switch((l=i[o]).ScopeType){case"graph":t=new ScopeGraph(function(e){return e._.Id},l),n[l.ScopeName]=t.root;break;case"subgraph":t||(t=new ScopeGraph(function(e){return e._.Id},l),n[l.ScopeName]=t.root);for(var u=l.parentScope().split(":"),s=n[l.parentScope()];u.length&&!s;)s=n[u.join(":")],u.pop();if(s){var a=s;n[l.ScopeName]=a.createSubgraph(l)}else console.log("Missing SG:Parent ("+l.Id+"): "+l.parentScope());break;case"activity":var c=n[l.parentScope()];c?c.createVertex(l):console.log("Missing A:Parent ("+l.Id+"): "+l.parentScope());break;case"edge":r[l.ScopeName]=l}}for(var p in r){var l,f=n[(l=r[p]).parentScope()];if(f){var h=f;try{var d=t.vertex(l.attr("IdSource").RawValue),g=t.vertex(l.attr("IdTarget").RawValue);h.createEdge(d,g,l)}catch(e){console.log("Invalid Edge: "+p)}}else console.log("Missing E:Parent ("+l.Id+"): "+l.parentScope())}return t}var Resource=function(e){function t(t,n){var r=e.call(this)||this;r.wu=t;var o=n.split("\\").join("/"),i=o.split("/"),u="res/"+r.wu.Wuid+"/",s="",a="";return 0===o.indexOf(u)&&(s=o.substr(u.length),a=i[i.length-1]),r.set({URL:n,DisplayName:a,DisplayPath:s}),r}return __extends(t,e),Object.defineProperty(t.prototype,"properties",{get:function(){return this.get()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"URL",{get:function(){return this.get("URL")},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"DisplayName",{get:function(){return this.get("DisplayName")},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"DisplayPath",{get:function(){return this.get("DisplayPath")},enumerable:!1,configurable:!0}),t}(util.StateObject),XSDNode=function(){function e(e){this.e=e}return e.prototype.fix=function(){delete this.e},e}(),XSDXMLNode=function(e){function t(t){var n=e.call(this,t)||this;return n.attrs={},n._children=[],n}return __extends(t,e),t.prototype.append=function(e){this._children.push(e),this.type||(this.type="hpcc:childDataset")},t.prototype.fix=function(){var t;this.name=this.e.$.name,this.type=this.e.$.type;for(var n=this._children.length-1;n>=0;--n){var r=this._children[n];"Row"===r.name&&void 0===r.type&&((t=this._children).push.apply(t,r._children),this._children.splice(n,1))}e.prototype.fix.call(this)},t.prototype.children=function(){return this._children},t.prototype.charWidth=function(){var e=-1;switch(this.type){case"xs:boolean":e=5;break;case"xs:integer":case"xs:nonNegativeInteger":case"xs:double":e=8;break;case"xs:string":e=32;break;default:for(var t=this.type.lastIndexOf("_"),n=t>0?t:this.type.length,r=n-1;r>=0&&-1!=="0123456789".indexOf(this.type.charAt(r));--r);r+1<n&&(e=parseInt(this.type.substring(r+1,n),10)),0===this.type.indexOf("data")&&(e*=2)}return e<this.name.length&&(e=this.name.length),e},t}(XSDNode),XSDSimpleType=function(e){function t(t){return e.call(this,t)||this}return __extends(t,e),t.prototype.append=function(e){switch(e.name){case"xs:restriction":this._restricition=e;break;case"xs:maxLength":this._maxLength=e}},t.prototype.fix=function(){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,e.prototype.fix.call(this)},t}(XSDNode),XSDSchema=function(){function e(){this.simpleTypes={}}return e.prototype.fields=function(){return this.root.children()},e}(),XSDParser=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.schema=new XSDSchema,t.simpleTypes={},t.xsdStack=new util.Stack,t}return __extends(t,e),t.prototype.startXMLNode=function(t){switch(e.prototype.startXMLNode.call(this,t),t.name){case"xs:element":var n=new XSDXMLNode(t);this.schema.root?this.xsdStack.depth()&&this.xsdStack.top().append(n):this.schema.root=n,this.xsdStack.push(n);break;case"xs:simpleType":this.simpleType=new XSDSimpleType(t)}},t.prototype.endXMLNode=function(t){switch(t.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":var n=this.xsdStack.top();for(var r in t.$)n.attrs[r]=t.$[r];break;default:this.simpleType&&this.simpleType.append(t)}e.prototype.endXMLNode.call(this,t)},t}(util.SAXStackParser);function parseXSD(e){var t=new XSDParser;return t.parse(e),t.schema}var XSDParser2=function(e){function t(t){var n=e.call(this)||this;return n.schema=new XSDSchema,n.simpleTypes={},n.xsdStack=new util.Stack,n._rootName=t,n}return __extends(t,e),t.prototype.startXMLNode=function(t){switch(e.prototype.startXMLNode.call(this,t),t.name){case"xsd:element":var n=new XSDXMLNode(t);this.schema.root||this._rootName!==t.$.name||(this.schema.root=n),this.xsdStack.depth()&&this.xsdStack.top().append(n),this.xsdStack.push(n);break;case"xsd:simpleType":this.simpleType=new XSDSimpleType(t)}},t.prototype.endXMLNode=function(t){switch(t.name){case"xsd:element":this.xsdStack.pop().fix()}e.prototype.endXMLNode.call(this,t)},t}(XSDParser);function parseXSD2(e,t){var n=new XSDParser2(t);return n.parse(e),n.schema}var _activity,GlobalResultCache=function(e){function t(){return e.call(this,function(e){return e.BaseUrl+"-"+e.Wuid+"-"+e.ResultName})||this}return __extends(t,e),t}(util.Cache),_results=new GlobalResultCache,Result=function(e){function t(t,n,r,o){void 0===o&&(o=[]);var i=e.call(this)||this;return i.connection=t instanceof WorkunitsService?t:new WorkunitsService(t),void 0===r?i.set({LogicalFileName:n}):"string"==typeof r?i.set({Wuid:n,ResultName:r,ResultViews:o}):"number"==typeof r?i.set({Wuid:n,ResultSequence:r,ResultViews:o}):i.set(__assign({Wuid:n,ResultName:r.Name,ResultViews:o},r)),i}return __extends(t,e),Object.defineProperty(t.prototype,"BaseUrl",{get:function(){return this.connection.baseUrl},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"properties",{get:function(){return this.get()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"Wuid",{get:function(){return this.get("Wuid")},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"ResultName",{get:function(){return this.get("ResultName")},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"ResultSequence",{get:function(){return this.get("ResultSequence")},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"LogicalFileName",{get:function(){return this.get("LogicalFileName")},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"Name",{get:function(){return this.get("Name")},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"Sequence",{get:function(){return this.get("Sequence")},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"Value",{get:function(){return this.get("Value")},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"Link",{get:function(){return this.get("Link")},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"FileName",{get:function(){return this.get("FileName")},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"IsSupplied",{get:function(){return this.get("IsSupplied")},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"ShowFileContent",{get:function(){return this.get("ShowFileContent")},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"Total",{get:function(){return this.get("Total")},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"ECLSchemas",{get:function(){return this.get("ECLSchemas")},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"NodeGroup",{get:function(){return this.get("NodeGroup")},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"ResultViews",{get:function(){return this.get("ResultViews")},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"XmlSchema",{get:function(){return this.get("XmlSchema")},enumerable:!1,configurable:!0}),t.attach=function(e,n,r,o){var i=_results.get({BaseUrl:e.baseUrl,Wuid:n,ResultName:r},function(){return new t(e,n,r)});return o&&i.set(o),i},t.prototype.isComplete=function(){return-1!==this.Total},t.prototype.fetchXMLSchema=function(){var e=this;return this.xsdSchema?Promise.resolve(this.xsdSchema):this.WUResult().then(function(t){return util.exists("Result.XmlSchema.xml",t)?(e.xsdSchema=parseXSD(t.Result.XmlSchema.xml),e.xsdSchema):null})},t.prototype.refresh=function(){return __awaiter(this,void 0,void 0,function(){return __generator(this,function(e){switch(e.label){case 0:return[4,this.fetchRows(0,1,!0)];case 1:return e.sent(),[2,this]}})})},t.prototype.fetchRows=function(e,t,n,r){var o=this;return void 0===e&&(e=0),void 0===t&&(t=-1),void 0===n&&(n=!1),void 0===r&&(r={}),this.WUResult(e,t,!n,r).then(function(e){var t=e.Result;return delete e.Result,o.set(__assign({},e)),util.exists("XmlSchema.xml",t)&&(o.xsdSchema=parseXSD(t.XmlSchema.xml)),util.exists("Row",t)?t.Row:o.ResultName&&util.exists(o.ResultName,t)?t[o.ResultName].Row:[]})},t.prototype.rootField=function(){return this.xsdSchema?this.xsdSchema.root:null},t.prototype.fields=function(){return this.xsdSchema?this.xsdSchema.root.children():[]},t.prototype.WUResult=function(e,t,n,r){void 0===e&&(e=0),void 0===t&&(t=1),void 0===n&&(n=!1),void 0===r&&(r={});var o={NamedValue:{itemcount:0}};for(var i in r)o.NamedValue[o.NamedValue.itemcount++]={Name:i,Value:r[i]};var u={FilterBy:o};return this.Wuid&&void 0!==this.ResultName?(u.Wuid=this.Wuid,u.ResultName=this.ResultName):this.Wuid&&void 0!==this.ResultSequence?(u.Wuid=this.Wuid,u.Sequence=this.ResultSequence):this.LogicalFileName&&this.NodeGroup?(u.LogicalName=this.LogicalFileName,u.Cluster=this.NodeGroup):this.LogicalFileName&&(u.LogicalName=this.LogicalFileName),u.Start=e,u.Count=t,u.SuppressXmlSchema=n,this.connection.WUResult(u).then(function(e){return e})},t}(util.StateObject),ResultCache=function(e){function t(){return e.call(this,function(e){return util.Cache.hash([e.Sequence,e.Name,e.FileName])})||this}return __extends(t,e),t}(util.Cache),Attribute=function(e){function t(t,n){var r=e.call(this)||this;return r.scope=t,r.set(n),r}return __extends(t,e),Object.defineProperty(t.prototype,"properties",{get:function(){return this.get()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"Name",{get:function(){return this.get("Name")},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"RawValue",{get:function(){return this.get("RawValue")},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"Formatted",{get:function(){return this.get("Formatted")},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"FormattedEnd",{get:function(){return this.get("FormattedEnd")},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"Measure",{get:function(){return this.get("Measure")},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"Creator",{get:function(){return this.get("Creator")},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"CreatorType",{get:function(){return this.get("CreatorType")},enumerable:!1,configurable:!0}),t}(util.StateObject),BaseScope=function(e){function t(t){var n=e.call(this)||this;return n._attributeMap={},n._children=[],n.update(t),n}return __extends(t,e),Object.defineProperty(t.prototype,"properties",{get:function(){return this.get()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"ScopeName",{get:function(){return this.get("ScopeName")},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"Id",{get:function(){return this.get("Id")},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"ScopeType",{get:function(){return this.get("ScopeType")},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"Properties",{get:function(){return this.get("Properties",{Property:[]})},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"CAttributes",{get:function(){var e=this,t=[],n={start:null,end:null};return this.Properties.Property.forEach(function(r){"ts"===r.Measure&&r.Name.indexOf("Started")>=0?n.start=r:e.ScopeName&&"ts"===r.Measure&&r.Name.indexOf("Finished")>=0?n.end=r:t.push(new Attribute(e,r))}),n.start&&n.end?(n.start.FormattedEnd=n.end.Formatted,t.push(new Attribute(this,n.start))):n.start?t.push(new Attribute(this,n.start)):n.end&&t.push(new Attribute(this,n.end)),t},enumerable:!1,configurable:!0}),t.prototype.update=function(e){var t=this;for(var n in this.set(e),this.CAttributes.forEach(function(e){t._attributeMap[e.Name]=e}),this.Properties.Property=[],this._attributeMap)this._attributeMap.hasOwnProperty(n)&&this.Properties.Property.push(this._attributeMap[n].properties)},t.prototype.parentScope=function(){var e=this.ScopeName.split(":");return e.pop(),e.join(":")},t.prototype.children=function(e){return arguments.length?(this._children=e,this):this._children},t.prototype.walk=function(e){if(e.start(this))return!0;for(var t=0,n=this.children();t<n.length;t++){if(n[t].walk(e))return!0}return e.end(this)},t.prototype.formattedAttrs=function(){var e={};for(var t in this._attributeMap)e[t]=this._attributeMap[t].Formatted||this._attributeMap[t].RawValue;return e},t.prototype.rawAttrs=function(){var e={};for(var t in this._attributeMap)e[t]=this._attributeMap[t].RawValue;return e},t.prototype.hasAttr=function(e){return void 0!==this._attributeMap[e]},t.prototype.attr=function(e){return this._attributeMap[e]||new Attribute(this,{Creator:"",CreatorType:"",Formatted:"",Measure:"",Name:"",RawValue:""})},t.prototype.attrMeasure=function(e){return this._attributeMap[e].Measure},t.prototype.calcTooltip=function(e){var t="",n=[];t=this.Id,n.push('<tr><td class="key">ID:</td><td class="value">'+this.Id+"</td></tr>"),e&&n.push('<tr><td class="key">Parent ID:</td><td class="value">'+e.Id+"</td></tr>"),n.push('<tr><td class="key">Scope:</td><td class="value">'+this.ScopeName+"</td></tr>");var r=this.formattedAttrs();for(var o in r)"Label"===o?t=r[o]:n.push('<tr><td class="key">'+o+'</td><td class="value">'+r[o]+"</td></tr>");return'<div class="eclwatch_WUGraph_Tooltip" style="max-width:480px">\n <h4 align="center">'+t+"</h4>\n <table>\n "+n.join("")+"\n </table>\n </div>"},t}(util.StateObject),Scope=function(e){function t(t,n){var r=e.call(this,n)||this;return r.wu=t,r}return __extends(t,e),t}(BaseScope),SourceFile=function(e){function t(t,n,r){var o=e.call(this)||this;return o.connection=t instanceof WorkunitsService?t:new WorkunitsService(t),o.set(__assign({Wuid:n},r)),o}return __extends(t,e),Object.defineProperty(t.prototype,"properties",{get:function(){return this.get()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"Wuid",{get:function(){return this.get("Wuid")},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"FileCluster",{get:function(){return this.get("FileCluster")},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"Name",{get:function(){return this.get("Name")},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"IsSuperFile",{get:function(){return this.get("IsSuperFile")},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"Subs",{get:function(){return this.get("Subs")},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"Count",{get:function(){return this.get("Count")},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"ECLSourceFiles",{get:function(){return this.get("ECLSourceFiles")},enumerable:!1,configurable:!0}),t}(util.StateObject),Timer=function(e){function t(t,n,r){var o=e.call(this)||this;o.connection=t instanceof WorkunitsService?t:new WorkunitsService(t);var i=util.espTime2Seconds(r.Value);return o.set(__assign({Wuid:n,Seconds:Math.round(1e3*i)/1e3,HasSubGraphId:void 0!==r.SubGraphId},r)),o}return __extends(t,e),Object.defineProperty(t.prototype,"properties",{get:function(){return this.get()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"Wuid",{get:function(){return this.get("Wuid")},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"Name",{get:function(){return this.get("Name")},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"Value",{get:function(){return this.get("Value")},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"Seconds",{get:function(){return this.get("Seconds")},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"GraphName",{get:function(){return this.get("GraphName")},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"SubGraphId",{get:function(){return this.get("SubGraphId")},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"HasSubGraphId",{get:function(){return this.get("HasSubGraphId")},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"count",{get:function(){return this.get("count")},enumerable:!1,configurable:!0}),t}(util.StateObject),formatter=utcFormat("%Y-%m-%dT%H:%M:%S.%LZ"),parser=utcParse("%Y-%m-%dT%H:%M:%S.%LZ"),logger$1=util.scopedLogger("workunit.ts"),WUStateID=exports.WUStateID,WorkunitCache=function(e){function t(){return e.call(this,function(e){return e.BaseUrl+"-"+e.Wuid})||this}return __extends(t,e),t}(util.Cache),_workunits=new WorkunitCache,Workunit=function(e){function t(t,n){var r=e.call(this)||this;return r._debugMode=!1,r._resultCache=new ResultCache,r._graphCache=new GraphCache,r.connection=new WorkunitsService(t),r.topologyConnection=new TopologyService(t),r.clearState(n),r}return __extends(t,e),Object.defineProperty(t.prototype,"BaseUrl",{get:function(){return this.connection.baseUrl},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"properties",{get:function(){return this.get()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"Wuid",{get:function(){return this.get("Wuid")},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"Owner",{get:function(){return this.get("Owner","")},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"Cluster",{get:function(){return this.get("Cluster","")},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"Jobname",{get:function(){return this.get("Jobname","")},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"Description",{get:function(){return this.get("Description","")},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"ActionEx",{get:function(){return this.get("ActionEx","")},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"StateID",{get:function(){return this.get("StateID",exports.WUStateID.Unknown)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"State",{get:function(){return this.get("State")||exports.WUStateID[this.StateID]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"Protected",{get:function(){return this.get("Protected",!1)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"Exceptions",{get:function(){return this.get("Exceptions",{ECLException:[]})},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"ResultViews",{get:function(){return this.get("ResultViews",[])},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"ResultCount",{get:function(){return this.get("ResultCount",0)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"Results",{get:function(){return this.get("Results",{ECLResult:[]})},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"CResults",{get:function(){var e=this;return this.Results.ECLResult.map(function(t){return e._resultCache.get(t,function(){return new Result(e.connection,e.Wuid,t,e.ResultViews)})})},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"SequenceResults",{get:function(){var e={};return this.CResults.forEach(function(t){e[t.Sequence]=t}),e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"Timers",{get:function(){return this.get("Timers",{ECLTimer:[]})},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"CTimers",{get:function(){var e=this;return this.Timers.ECLTimer.map(function(t){return new Timer(e.connection,e.Wuid,t)})},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"GraphCount",{get:function(){return this.get("GraphCount",0)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"Graphs",{get:function(){return this.get("Graphs",{ECLGraph:[]})},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"CGraphs",{get:function(){var e=this;return this.Graphs.ECLGraph.map(function(t){return e._graphCache.get(t,function(){return new ECLGraph(e,t,e.CTimers)})})},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"ThorLogList",{get:function(){return this.get("ThorLogList")},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"ResourceURLCount",{get:function(){return this.get("ResourceURLCount",0)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"ResourceURLs",{get:function(){return this.get("ResourceURLs",{URL:[]})},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"CResourceURLs",{get:function(){var e=this;return this.ResourceURLs.URL.map(function(t){return new Resource(e,t)})},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"TotalClusterTime",{get:function(){return this.get("TotalClusterTime","")},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"DateTimeScheduled",{get:function(){return this.get("DateTimeScheduled")},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"IsPausing",{get:function(){return this.get("IsPausing")},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"ThorLCR",{get:function(){return this.get("ThorLCR")},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"ApplicationValues",{get:function(){return this.get("ApplicationValues",{ApplicationValue:[]})},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"HasArchiveQuery",{get:function(){return this.get("HasArchiveQuery")},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"StateEx",{get:function(){return this.get("StateEx")},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"PriorityClass",{get:function(){return this.get("PriorityClass")},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"PriorityLevel",{get:function(){return this.get("PriorityLevel")},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"Snapshot",{get:function(){return this.get("Snapshot")},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"ResultLimit",{get:function(){return this.get("ResultLimit")},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"EventSchedule",{get:function(){return this.get("EventSchedule")},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"HaveSubGraphTimings",{get:function(){return this.get("HaveSubGraphTimings")},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"Query",{get:function(){return this.get("Query")},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"HelpersCount",{get:function(){return this.get("HelpersCount",0)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"Helpers",{get:function(){return this.get("Helpers",{ECLHelpFile:[]})},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"DebugValues",{get:function(){return this.get("DebugValues")},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"AllowedClusters",{get:function(){return this.get("AllowedClusters")},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"ErrorCount",{get:function(){return this.get("ErrorCount",0)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"WarningCount",{get:function(){return this.get("WarningCount",0)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"InfoCount",{get:function(){return this.get("InfoCount",0)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"AlertCount",{get:function(){return this.get("AlertCount",0)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"SourceFileCount",{get:function(){return this.get("SourceFileCount",0)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"SourceFiles",{get:function(){return this.get("SourceFiles",{ECLSourceFile:[]})},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"CSourceFiles",{get:function(){var e=this;return this.SourceFiles.ECLSourceFile.map(function(t){return new SourceFile(e.connection,e.Wuid,t)})},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"VariableCount",{get:function(){return this.get("VariableCount",0)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"Variables",{get:function(){return this.get("Variables",{ECLResult:[]})},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"TimerCount",{get:function(){return this.get("TimerCount",0)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"HasDebugValue",{get:function(){return this.get("HasDebugValue")},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"ApplicationValueCount",{get:function(){return this.get("ApplicationValueCount",0)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"XmlParams",{get:function(){return this.get("XmlParams")},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"AccessFlag",{get:function(){return this.get("AccessFlag")},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"ClusterFlag",{get:function(){return this.get("ClusterFlag")},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"ResultViewCount",{get:function(){return this.get("ResultViewCount",0)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"DebugValueCount",{get:function(){return this.get("DebugValueCount",0)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"WorkflowCount",{get:function(){return this.get("WorkflowCount",0)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"Archived",{get:function(){return this.get("Archived")},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"RoxieCluster",{get:function(){return this.get("RoxieCluster")},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"DebugState",{get:function(){return this.get("DebugState",{})},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"Queue",{get:function(){return this.get("Queue")},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"Active",{get:function(){return this.get("Active")},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"Action",{get:function(){return this.get("Action")},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"Scope",{get:function(){return this.get("Scope")},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"AbortBy",{get:function(){return this.get("AbortBy")},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"AbortTime",{get:function(){return this.get("AbortTime")},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"Workflows",{get:function(){return this.get("Workflows")},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"TimingData",{get:function(){return this.get("TimingData")},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"HelpersDesc",{get:function(){return this.get("HelpersDesc")},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"GraphsDesc",{get:function(){return this.get("GraphsDesc")},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"SourceFilesDesc",{get:function(){return this.get("GraphsDesc")},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"ResultsDesc",{get:function(){return this.get("GraphsDesc")},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"VariablesDesc",{get:function(){return this.get("GraphsDesc")},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"TimersDesc",{get:function(){return this.get("GraphsDesc")},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"DebugValuesDesc",{get:function(){return this.get("GraphsDesc")},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"ApplicationValuesDesc",{get:function(){return this.get("GraphsDesc")},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"WorkflowsDesc",{get:function(){return this.get("GraphsDesc")},enumerable:!1,configurable:!0}),t.create=function(e){var n=new t(e);return n.connection.WUCreate().then(function(e){return _workunits.set(n),n.set(e.Workunit),n})},t.attach=function(e,n,r){var o=_workunits.get({BaseUrl:e.baseUrl,Wuid:n},function(){return new t(e,n)});return r&&o.set(r),o},t.existsLocal=function(e,t){return _workunits.has({BaseUrl:e,Wuid:t})},t.submit=function(e,n,r){return t.create(e).then(function(e){return e.update({QueryText:r})}).then(function(e){return e.submit(n)})},t.query=function(e,n){return new WorkunitsService(e).WUQuery(n).then(function(n){return n.Workunits.ECLWorkunit.map(function(n){return t.attach(e,n.Wuid,n)})})},t.prototype.clearState=function(e){this.clear({Wuid:e,StateID:WUStateID.Unknown})},t.prototype.update=function(e){var t=this;return this.connection.WUUpdate(__assign(__assign({},e),{Wuid:this.Wuid,StateOrig:this.State,JobnameOrig:this.Jobname,DescriptionOrig:this.Description,ProtectedOrig:this.Protected,ClusterOrig:this.Cluster})).then(function(e){return t.set(e.Workunit),t})},t.prototype.submit=function(e,t,n){var r,o=this;return void 0===t&&(t=exports.WUUpdate.Action.Run),r=void 0!==e?Promise.resolve(e):this.topologyConnection.DefaultTpLogicalClusterQuery().then(function(e){return e.Name}),this._debugMode=!1,t===exports.WUUpdate.Action.Debug&&(t=exports.WUUpdate.Action.Run,this._debugMode=!0),r.then(function(e){return o.connection.WUUpdate({Wuid:o.Wuid,Action:t,ResultLimit:n,DebugValues:{DebugValue:[{Name:"Debug",Value:o._debugMode?"1":""}]}}).then(function(n){return o.set(n.Workunit),o._submitAction=t,o.connection.WUSubmit({Wuid:o.Wuid,Cluster:e})})}).then(function(){return o})},t.prototype.isComplete=function(){switch(this.StateID){case WUStateID.Compiled:return"compile"===this.ActionEx||this._submitAction===exports.WUUpdate.Action.Compile;case WUStateID.Completed:case WUStateID.Failed:case WUStateID.Aborted:case WUStateID.NotFound:return!0}return!1},t.prototype.isFailed=function(){switch(this.StateID){case WUStateID.Aborted:case WUStateID.Failed:return!0}return!1},t.prototype.isDeleted=function(){switch(this.StateID){case WUStateID.NotFound:return!0}return!1},t.prototype.isDebugging=function(){switch(this.StateID){case WUStateID.DebugPaused:case WUStateID.DebugRunning:return!0}return this._debugMode},t.prototype.isRunning=function(){switch(this.StateID){case WUStateID.Compiled:case WUStateID.Running:case WUStateID.Aborting:case WUStateID.Blocked:case WUStateID.DebugPaused:case WUStateID.DebugRunning:return!0}return!1},t.prototype.setToFailed=function(){return this.WUAction("SetToFailed")},t.prototype.pause=function(){return this.WUAction("Pause")},t.prototype.pauseNow=function(){return this.WUAction("PauseNow")},t.prototype.resume=function(){return this.WUAction("Resume")},t.prototype.abort=function(){return this.WUAction("Abort")},t.prototype.delete=function(){return this.WUAction("Delete")},t.prototype.restore=function(){return this.WUAction("Restore")},t.prototype.deschedule=function(){return this.WUAction("Deschedule")},t.prototype.reschedule=function(){return this.WUAction("Reschedule")},t.prototype.resubmit=function(){var e=this;return this.WUResubmit({CloneWorkunit:!1,ResetWorkflow:!1}).then(function(){return e.clearState(e.Wuid),e.refresh().then(function(){return e._monitor(),e})})},t.prototype.clone=function(){var e=this;return this.WUResubmit({CloneWorkunit:!0,ResetWorkflow:!1}).then(function(n){return t.attach(e.connection.connection(),n.WUs.WU[0].WUID).refresh()})},t.prototype.refreshState=function(){return __awaiter(this,void 0,void 0,function(){return __generator(this,function(e){switch(e.label){case 0:return[4,this.WUQuery()];case 1:return e.sent(),[2,this]}})})},t.prototype.refreshInfo=function(){return __awaiter(this,void 0,void 0,function(){return __generator(this,function(e){switch(e.label){case 0:return[4,this.WUInfo()];case 1:return e.sent(),[2,this]}})})},t.prototype.refreshDebug=function(){return __awaiter(this,void 0,void 0,function(){return __generator(this,function(e){switch(e.label){case 0:return[4,this.debugStatus()];case 1:return e.sent(),[2,this]}})})},t.prototype.refresh=function(e){return void 0===e&&(e=!1),__awaiter(this,void 0,void 0,function(){return __generator(this,function(t){switch(t.label){case 0:return e?[4,Promise.all([this.refreshInfo(),this.refreshDebug()])]:[3,2];case 1:return t.sent(),[3,4];case 2:return[4,this.refreshState()];case 3:t.sent(),t.label=4;case 4:return[2,this]}})})},t.prototype.eclExceptions=function(){return this.Exceptions.ECLException},t.prototype.fetchArchive=function(){return this.connection.WUFile({Wuid:this.Wuid,Type:"ArchiveQuery"})},t.prototype.fetchECLExceptions=function(){var e=this;return this.WUInfo({IncludeExceptions:!0}).then(function(){return e.eclExceptions()})},t.prototype.fetchResults=function(){var e=this;return this.WUInfo({IncludeResults:!0}).then(function(){return e.CResults})},t.prototype.fetchGraphs=function(){var e=this;return this.WUInfo({IncludeGraphs:!0}).then(function(){return e.CGraphs})},t.prototype.fetchDetailsMeta=function(e){return void 0===e&&(e={}),this.WUDetailsMeta(e)},t.prototype.fetchDetailsRaw=function(e){return void 0===e&&(e={}),this.WUDetails(e).then(function(e){return e.Scopes.Scope})},t.prototype.fetchDetailsNormalized=function(e){return void 0===e&&(e={}),Promise.all([this.fetchDetailsMeta(),this.fetchDetailsRaw(e)]).then(function(e){for(var t=e[0],n={id:{Measure:"label"},name:{Measure:"label"},type:{Measure:"label"}},r=[],o=0,i=e[1];o<i.length;o++){var u=i[o],s={};if(u&&u.Id&&u.Properties&&u.Properties.Property){for(var a in u.Properties.Property){var c=u.Properties.Property[a];switch("ns"===c.Measure&&(c.Measure="s"),n[c.Name]=__assign({},c),delete n[c.Name].RawValue,delete n[c.Name].Formatted,c.Measure){case"bool":s[c.Name]=!!+c.RawValue;break;case"sz":s[c.Name]=+c.RawValue;break;case"s":s[c.Name]=+c.RawValue/1e9;break;case"ns":s[c.Name]=+c.RawValue;break;case"ts":s[c.Name]=new Date(+c.RawValue/1e3).toISOString();break;case"cnt":s[c.Name]=+c.RawValue;break;case"cpu":case"skw":case"node":case"ppm":case"ip":case"cy":case"en":case"txt":case"id":case"fname":default:s[c.Name]=c.RawValue}}r.push(__assign({id:u.Id,name:u.ScopeName,type:u.ScopeType},s))}}return{meta:t,columns:n,data:r}})},t.prototype.fetchDetails=function(e){var t=this;return void 0===e&&(e={}),this.WUDetails(e).then(function(e){return e.Scopes.Scope.map(function(e){return new Scope(t,e)})})},t.prototype.fetchDetailsHierarchy=function(e){var t=this;return void 0===e&&(e={}),this.WUDetails(e).then(function(e){var n=[],r={};for(var o in e.Scopes.Scope.forEach(function(e){if(r[e.ScopeName])return r[e.ScopeName].update(e),null;var n=new Scope(t,e);return r[n.ScopeName]=n,n}),r)if(r.hasOwnProperty(o)){var i=r[o],u=i.parentScope();u&&r[u]?r[u].children().push(i):n.push(i)}return n})},t.prototype.fetchGraphDetails=function(e,t){return void 0===e&&(e=[]),this.fetchDetails({ScopeFilter:{MaxDepth:999999,Ids:e,ScopeTypes:t},NestedFilter:{Depth:999999,ScopeTypes:["graph","subgraph","activity","edge"]},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}})},t.prototype.fetchScopeGraphs=function(e){return void 0===e&&(e=[]),this.fetchGraphDetails(e,["graph"]).then(function(e){return createGraph(e)})},t.prototype.fetchTimeElapsed=function(){return this.fetchDetails({ScopeFilter:{PropertyFilters:{PropertyFilter:[{Name:"TimeElapsed"}]}}}).then(function(e){var t={};e.forEach(function(e){t[e.ScopeName]=t[e.ScopeName]||{scope:e.ScopeName,start:null,elapsed:null,finish:null},e.CAttributes.forEach(function(n){"TimeElapsed"===n.Name?t[e.ScopeName].elapsed=+n.RawValue:"ts"===n.Measure&&n.Name.indexOf("Started")>=0&&(t[e.ScopeName].start=n.Formatted)})});var n=[];for(var r in t){var o=t[r];if(o.start&&o.elapsed){var i=parser(o.start);i.setMilliseconds(i.getMilliseconds()+o.elapsed/1e6),o.finish=formatter(i),n.push(o)}}return n.sort(function(e,t){return e.start<t.start?-1:e.start>t.start?1:0}),n})},t.prototype._monitor=function(){this.isComplete()?this._monitorTickCount=0:e.prototype._monitor.call(this)},t.prototype._monitorTimeoutDuraction=function(){var t=e.prototype._monitorTimeoutDuraction.call(this);return this._monitorTickCount<=1?1e3:this._monitorTickCount<=3?3e3:this._monitorTickCount<=5?5e3:this._monitorTickCount<=7?1e4:t},t.prototype.on=function(t,n,r){var o=this;if(this.isCallback(n))switch(t){case"completed":e.prototype.on.call(this,"propChanged","StateID",function(e){o.isComplete()&&n([e])});break;case"changed":e.prototype.on.call(this,t,n)}else switch(t){case"changed":e.prototype.on.call(this,t,n,r)}return this._monitor(),this},t.prototype.watchUntilComplete=function(e){var t=this;return new Promise(function(n,r){var o=t.watch(function(r){e&&e(r),t.isComplete()&&(o.release(),n(t))})})},t.prototype.watchUntilRunning=function(e){var t=this;return new Promise(function(n,r){var o=t.watch(function(r){e&&e(r),(t.isComplete()||t.isRunning())&&(o.release(),n(t))})})},t.prototype.WUQuery=function(e){var t=this;return void 0===e&&(e={}),this.connection.WUQuery(__assign(__assign({},e),{Wuid:this.Wuid})).then(function(e){return t.set(e.Workunits.ECLWorkunit[0]),e}).catch(function(e){if(!e.Exception.some(function(e){return 20081===e.Code&&(t.clearState(t.Wuid),t.set("StateID",WUStateID.NotFound),!0)}))throw logger$1.warning("Unexpected exception: "),e;return{}})},t.prototype.WUCreate=function(){var e=this;return this.connection.WUCreate().then(function(t){return e.set(t.Workunit),_workunits.set(e),t})},t.prototype.WUInfo=function(e){var t=this;void 0===e&&(e={});var n=e.IncludeResults||e.IncludeResultsViewNames;return this.connection.WUInfo(__assign(__assign({},e),{Wuid:this.Wuid,IncludeResults:n,IncludeResultsViewNames:n,SuppressResultSchemas:!1})).then(function(e){return t.set(e.Workunit),n&&t.set({ResultViews:e.ResultViews}),e}).catch(function(e){if(!e.Exception.some(function(e){return 20080===e.Code&&(t.clearState(t.Wuid),t.set("StateID",WUStateID.NotFound),!0)}))throw logger$1.warning("Unexpected exception: "),e;return{}})},t.prototype.WUResubmit=function(e){return this.connection.WUResubmit(util.deepMixinT({},e,{Wuids:[this.Wuid]}))},t.prototype.WUDetailsMeta=function(e){return this.connection.WUDetailsMeta(e)},t.prototype.WUDetails=function(e){return this.connection.WUDetails(util.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(function(e){return util.deepMixinT({Scopes:{Scope:[]}},e)})},t.prototype.WUAction=function(e){var t=this;return this.connection.WUAction({Wuids:[this.Wuid],WUActionType:e}).then(function(e){return t.refresh().then(function(){return t._monitor(),e})})},t.prototype.publish=function(e){return this.connection.WUPublishWorkunit({Wuid:this.Wuid,Cluster:this.Cluster,JobName:e||this.Jobname,AllowForeignFiles:!0,Activate:!0,Wait:5e3})},t.prototype.WUCDebug=function(e,t){void 0===t&&(t={});var n="";for(var r in t)t.hasOwnProperty(r)&&(n+=" "+r+"='"+t[r]+"'");return this.connection.WUCDebug({Wuid:this.Wuid,Command:"<debug:"+e+" uid='"+this.Wuid+"'"+n+"/>"}).then(function(e){return e})},t.prototype.debug=function(e,t){return this.isDebugging()?this.WUCDebug(e,t).then(function(t){var n=t.children(e);return n.length?n[0]:new util.XMLNode(e)}).catch(function(t){return logger$1.error(t),Promise.resolve(new util.XMLNode(e))}):Promise.resolve(new util.XMLNode(e))},t.prototype.debugStatus=function(){var e=this;return this.isDebugging()?this.debug("status").then(function(t){var n=__assign(__assign({},e.DebugState),t.$);return e.set({DebugState:n}),t}):Promise.resolve({DebugState:{state:"unknown"}})},t.prototype.debugContinue=function(e){return void 0===e&&(e=""),this.debug("continue",{mode:e})},t.prototype.debugStep=function(e){return this.debug("step",{mode:e})},t.prototype.debugPause=function(){return this.debug("interrupt")},t.prototype.debugQuit=function(){return this.debug("quit")},t.prototype.debugDeleteAllBreakpoints=function(){return this.debug("delete",{idx:0})},t.prototype.debugBreakpointResponseParser=function(e){return e.children().map(function(e){if("break"===e.name)return e.$})},t.prototype.debugBreakpointAdd=function(e,t,n){var r=this;return this.debug("breakpoint",{id:e,mode:t,action:n}).then(function(e){return r.debugBreakpointResponseParser(e)})},t.prototype.debugBreakpointList=function(){var e=this;return this.debug("list").then(function(t){return e.debugBreakpointResponseParser(t)})},t.prototype.debugGraph=function(){var e=this;return this._debugAllGraph&&this.DebugState._prevGraphSequenceNum===this.DebugState.graphSequenceNum?Promise.resolve(this._debugAllGraph):this.debug("graph",{name:"all"}).then(function(t){return e.DebugState._prevGraphSequenceNum=e.DebugState.graphSequenceNum,e._debugAllGraph=createXGMMLGraph(e.Wuid,t),e._debugAllGraph})},t.prototype.debugBreakpointValid=function(e){return this.debugGraph().then(function(t){return breakpointLocations(t,e)})},t.prototype.debugPrint=function(e,t,n){return void 0===t&&(t=0),void 0===n&&(n=10),this.debug("print",{edgeID:e,startRow:t,numRows:n}).then(function(e){return e.children().map(function(e){var t={};return e.children().forEach(function(e){t[e.name]=e.content}),t})})},t}(util.StateObject),ATTR_DEFINITION="definition";function hasECLDefinition(e){return void 0!==e._[ATTR_DEFINITION]}function getECLDefinition(e){var t=/([a-z]:\\(?:[-\w\.\d]+\\)*(?:[-\w\.\d]+)?|(?:\/[\w\.\-]+)+)\((\d*),(\d*)\)/.exec(e._[ATTR_DEFINITION]);if(t){var n=t[1],r=t[2],o=t[3];return n.replace("/./","/"),{id:e._.id,file:n,line:+r,column:+o}}throw new Error("Bad definition: "+e._[ATTR_DEFINITION])}function breakpointLocations(e,t){for(var n=[],r=0,o=e.vertices;r<o.length;r++){var i=o[r];if(hasECLDefinition(i)){var u=getECLDefinition(i);(u&&!t||t===u.file)&&n.push(u)}}return n.sort(function(e,t){return e.line-t.line})}var Activity=function(e){function t(t){var n=e.call(this)||this;return n.lazyRefresh=util.debounce(function(){return __awaiter(n,void 0,void 0,function(){var e;return __generator(this,function(t){switch(t.label){case 0:return[4,this.connection.Activity({})];case 1:return e=t.sent(),this.set(e),[2,this]}})})}),n.connection=t instanceof SMCService?t:new SMCService(t),n.clear({}),n}return __extends(t,e),Object.defineProperty(t.prototype,"properties",{get:function(){return this.get()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"Exceptions",{get:function(){return this.get("Exceptions")},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"Build",{get:function(){return this.get("Build")},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"ThorClusterList",{get:function(){return this.get("ThorClusterList")},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"RoxieClusterList",{get:function(){return this.get("RoxieClusterList")},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"HThorClusterList",{get:function(){return this.get("HThorClusterList")},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"DFUJobs",{get:function(){return this.get("DFUJobs")},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"Running",{get:function(){return this.get("Running",{ActiveWorkunit:[]})},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"BannerContent",{get:function(){return this.get("BannerContent")},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"BannerColor",{get:function(){return this.get("BannerColor")},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"BannerSize",{get:function(){return this.get("BannerSize")},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"BannerScroll",{get:function(){return this.get("BannerScroll")},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"ChatURL",{get:function(){return this.get("ChatURL")},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"ShowBanner",{get:function(){return this.get("ShowBanner")},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"ShowChatURL",{get:function(){return this.get("ShowChatURL")},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"SortBy",{get:function(){return this.get("SortBy")},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"Descending",{get:function(){return this.get("Descending")},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"SuperUser",{get:function(){return this.get("SuperUser")},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"AccessRight",{get:function(){return this.get("AccessRight")},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"ServerJobQueues",{get:function(){return this.get("ServerJobQueues")},enumerable:!1,configurable:!0}),t.attach=function(e,n){return _activity||(_activity=new t(e)),n&&_activity.set(__assign({},n)),_activity},t.prototype.runningWorkunits=function(e){var t=this;return void 0===e&&(e=""),this.Running.ActiveWorkunit.filter(function(t){return""===e||t.ClusterName===e}).map(function(e){return Workunit.attach(t.connection.connectionOptions(),e.Wuid,e)})},t.prototype.refresh=function(){return __awaiter(this,void 0,void 0,function(){return __generator(this,function(e){return[2,this.lazyRefresh()]})})},t}(util.StateObject),LogicalFileCache=function(e){function t(){return e.call(this,function(e){return e.BaseUrl+"-"+e.Cluster+"-"+e.Name})||this}return __extends(t,e),t}(util.Cache),_store=new LogicalFileCache,LogicalFile=function(e){function t(t,n,r){var o=e.call(this)||this;return o.connection=t instanceof DFUService?t:new DFUService(t),o.clear({Cluster:n,Name:r}),o}return __extends(t,e),Object.defineProperty(t.prototype,"BaseUrl",{get:function(){return this.connection.baseUrl},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"Cluster",{get:function(){return this.get("Cluster")},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"Name",{get:function(){return this.get("Name")},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"Filename",{get:function(){return this.get("Filename")},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"Prefix",{get:function(){return this.get("Prefix")},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"NodeGroup",{get:function(){return this.get("NodeGroup")},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"NumParts",{get:function(){return this.get("NumParts")},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"Description",{get:function(){return this.get("Description")},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"Dir",{get:function(){return this.get("Dir")},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"PathMask",{get:function(){return this.get("PathMask")},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"Filesize",{get:function(){return this.get("Filesize")},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"FileSizeInt64",{get:function(){return this.get("FileSizeInt64")},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"RecordSize",{get:function(){return this.get("RecordSize")},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"RecordCount",{get:function(){return this.get("RecordCount")},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"RecordSizeInt64",{get:function(){return this.get("RecordSizeInt64")},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"RecordCountInt64",{get:function(){return this.get("RecordCountInt64")},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"Wuid",{get:function(){return this.get("Wuid")},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"Owner",{get:function(){return this.get("Owner")},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"JobName",{get:function(){return this.get("JobName")},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"Persistent",{get:function(){return this.get("Persistent")},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"Format",{get:function(){return this.get("Format")},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"MaxRecordSize",{get:function(){return this.get("MaxRecordSize")},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"CsvSeparate",{get:function(){return this.get("CsvSeparate")},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"CsvQuote",{get:function(){return this.get("CsvQuote")},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"CsvTerminate",{get:function(){return this.get("CsvTerminate")},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"CsvEscape",{get:function(){return this.get("CsvEscape")},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"Modified",{get:function(){return this.get("Modified")},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"Ecl",{get:function(){return this.get("Ecl")},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"Stat",{get:function(){return this.get("Stat")},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"DFUFilePartsOnClusters",{get:function(){return this.get("DFUFilePartsOnClusters")},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"isSuperfile",{get:function(){return this.get("isSuperfile")},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"ShowFileContent",{get:function(){return this.get("ShowFileContent")},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"subfiles",{get:function(){return this.get("subfiles")},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"Superfiles",{get:function(){return this.get("Superfiles")},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"ProtectList",{get:function(){return this.get("ProtectList")},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"FromRoxieCluster",{get:function(){return this.get("FromRoxieCluster")},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"Graphs",{get:function(){return this.get("Graphs")},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"UserPermission",{get:function(){return this.get("UserPermission")},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"ContentType",{get:function(){return this.get("ContentType")},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"CompressedFileSize",{get:function(){return this.get("CompressedFileSize")},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"PercentCompressed",{get:function(){return this.get("PercentCompressed")},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"IsCompressed",{get:function(){return this.get("IsCompressed")},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"BrowseData",{get:function(){return this.get("BrowseData")},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"jsonInfo",{get:function(){return this.get("jsonInfo")},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"binInfo",{get:function(){return this.get("binInfo")},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"PackageID",{get:function(){return this.get("PackageID")},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"Partition",{get:function(){return this.get("Partition")},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"Blooms",{get:function(){return this.get("Blooms")},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"ExpireDays",{get:function(){return this.get("ExpireDays")},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"KeyType",{get:function(){return this.get("KeyType")},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"properties",{get:function(){return this.get()},enumerable:!1,configurable:!0}),t.attach=function(e,n,r){return _store.get({BaseUrl:e.baseUrl,Cluster:n,Name:r},function(){return new t(e,n,r)})},t.prototype.fetchInfo=function(){var e=this;return this.connection.DFUInfo({Cluster:this.Cluster,Name:this.Name}).then(function(t){return e.set(__assign({Cluster:e.Cluster},t.FileDetail)),t.FileDetail})},t}(util.StateObject),MachineCache=function(e){function t(){return e.call(this,function(e){return e.Address})||this}return __extends(t,e),t}(util.Cache),_machines=new MachineCache,Machine=function(e){function t(t){var n=e.call(this)||this;return n.connection=t instanceof MachineService?t:new MachineService(t),n}return __extends(t,e),Object.defineProperty(t.prototype,"Address",{get:function(){return this.get("Address")},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"ConfigAddress",{get:function(){return this.get("ConfigAddress")},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"Name",{get:function(){return this.get("Name")},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"ProcessType",{get:function(){return this.get("ProcessType")},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"DisplayType",{get:function(){return this.get("DisplayType")},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"Description",{get:function(){return this.get("Description")},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"AgentVersion",{get:function(){return this.get("AgentVersion")},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"Contact",{get:function(){return this.get("Contact")},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"Location",{get:function(){return this.get("Location")},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"UpTime",{get:function(){return this.get("UpTime")},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"ComponentName",{get:function(){return this.get("ComponentName")},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"ComponentPath",{get:function(){return this.get("ComponentPath")},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"RoxieState",{get:function(){return this.get("RoxieState")},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"RoxieStateDetails",{get:function(){return this.get("RoxieStateDetails")},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"OS",{get:function(){return this.get("OS")},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"ProcessNumber",{get:function(){return this.get("ProcessNumber")},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"Processors",{get:function(){return this.get("Processors")},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"Storage",{get:function(){return this.get("Storage")},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"Running",{get:function(){return this.get("Running")},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"PhysicalMemory",{get:function(){return this.get("PhysicalMemory")},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"VirtualMemory",{get:function(){return this.get("VirtualMemory")},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"ComponentInfo",{get:function(){return this.get("ComponentInfo")},enumerable:!1,configurable:!0}),t.attach=function(e,n,r){var o=_machines.get({Address:n},function(){return new t(e)});return r&&o.set(r),o},t}(util.StateObject),QueryCache=function(e){function t(){return e.call(this,function(e){return util.Cache.hash([e.QueryId,e.QuerySet])})||this}return __extends(t,e),t}(util.Cache),_queries=new QueryCache,Query=function(e){function t(t,n,r,o){var i=e.call(this)||this;return i.connection=t instanceof EclService?t:new EclService(t),i.set(__assign({QuerySet:n,QueryId:r},o)),i}return __extends(t,e),Object.defineProperty(t.prototype,"BaseUrl",{get:function(){return this.connection.baseUrl},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"properties",{get:function(){return this.get()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"Exceptions",{get:function(){return this.get("Exceptions")},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"QueryId",{get:function(){return this.get("QueryId")},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"QuerySet",{get:function(){return this.get("QuerySet")},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"QueryName",{get:function(){return this.get("QueryName")},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"Wuid",{get:function(){return this.get("Wuid")},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"Dll",{get:function(){return this.get("Dll")},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"Suspended",{get:function(){return this.get("Suspended")},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"Activated",{get:function(){return this.get("Activated")},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"SuspendedBy",{get:function(){return this.get("SuspendedBy")},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"Clusters",{get:function(){return this.get("Clusters")},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"PublishedBy",{get:function(){return this.get("PublishedBy")},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"Comment",{get:function(){return this.get("Comment")},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"LogicalFiles",{get:function(){return this.get("LogicalFiles")},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"SuperFiles",{get:function(){return this.get("SuperFiles")},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"IsLibrary",{get:function(){return this.get("IsLibrary")},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"Priority",{get:function(){return this.get("Priority")},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"WUSnapShot",{get:function(){return this.get("WUSnapShot")},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"CompileTime",{get:function(){return this.get("CompileTime")},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"LibrariesUsed",{get:function(){return this.get("LibrariesUsed")},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"CountGraphs",{get:function(){return this.get("CountGraphs")},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"ResourceURLCount",{get:function(){return this.get("ResourceURLCount")},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"WsEclAddresses",{get:function(){return this.get("WsEclAddresses")},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"WUGraphs",{get:function(){return this.get("WUGraphs")},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"WUTimers",{get:function(){return this.get("WUTimers")},enumerable:!1,configurable:!0}),t.attach=function(e,n,r){return _queries.get({BaseUrl:e.baseUrl,QuerySet:n,QueryId:r},function(){return new t(e,n,r)})},t.prototype.fetchRequestSchema=function(){return __awaiter(this,void 0,void 0,function(){var e;return __generator(this,function(t){switch(t.label){case 0:return e=this,[4,this.connection.requestJson(this.QuerySet,this.QueryId)];case 1:return e._requestSchema=t.sent(),[2]}})})},t.prototype.fetchResponseSchema=function(){return __awaiter(this,void 0,void 0,function(){var e;return __generator(this,function(t){switch(t.label){case 0:return e=this,[4,this.connection.responseJson(this.QuerySet,this.QueryId)];case 1:return e._responseSchema=t.sent(),[2]}})})},t.prototype.fetchSchema=function(){return __awaiter(this,void 0,void 0,function(){return __generator(this,function(e){switch(e.label){case 0:return[4,Promise.all([this.fetchRequestSchema(),this.fetchResponseSchema()])];case 1:return e.sent(),[2]}})})},t.prototype.submit=function(e){return this.connection.submit(this.QuerySet,this.QueryId,e).then(function(e){for(var t in e)e[t]=e[t].Row;return e})},t.prototype.refresh=function(){return __awaiter(this,void 0,void 0,function(){var e=this;return __generator(this,function(t){return[2,this.fetchSchema().then(function(t){return e})]})})},t.prototype.requestFields=function(){return this._requestSchema?this._requestSchema:[]},t.prototype.responseFields=function(){return this._responseSchema?this._responseSchema:{}},t.prototype.resultNames=function(){var e=[];for(var t in this.responseFields())e.push(t);return e},t.prototype.resultFields=function(e){return this._responseSchema[e]?this._responseSchema[e]:[]},t}(util.StateObject),StoreCache=function(e){function t(){return e.call(this,function(e){return e.BaseUrl+"-"+e.Name+":"+e.UserSpecific+"-"+e.Namespace})||this}return __extends(t,e),t}(util.Cache),_store$1=new StoreCache,ValueChangedMessage=function(e){function t(t,n,r){var o=e.call(this)||this;return o.key=t,o.value=n,o.oldValue=r,o}return __extends(t,e),Object.defineProperty(t.prototype,"canConflate",{get:function(){return!0},enumerable:!1,configurable:!0}),t.prototype.conflate=function(e){return this.key===e.key&&(this.value=e.value,!0)},t.prototype.void=function(){return this.value===this.oldValue},t}(util.Message),Store=function(){function e(e,t,n,r){this._dispatch=new util.Dispatch,this._knownValues={},this.connection=e instanceof StoreService?e:new StoreService(e),this.Name=t,this.UserSpecific=r,this.Namespace=n}return Object.defineProperty(e.prototype,"BaseUrl",{get:function(){return this.connection.baseUrl},enumerable:!1,configurable:!0}),e.attach=function(t,n,r,o){return void 0===n&&(n="HPCCApps"),void 0===o&&(o=!0),_store$1.get({BaseUrl:t.baseUrl,Name:n,UserSpecific:o,Namespace:r},function(){return new e(t,n,r,o)})},e.prototype.create=function(){this.connection.CreateStore({Name:this.Name,UserSpecific:this.UserSpecific,Type:"",Description:""})},e.prototype.set=function(e,t,n){var r=this;return void 0===n&&(n=!0),this.connection.Set({StoreName:this.Name,UserSpecific:this.UserSpecific,Namespace:this.Namespace,Key:e,Value:t}).then(function(o){var i=r._knownValues[e];r._knownValues[e]=t,n&&r._dispatch.post(new ValueChangedMessage(e,t,i))}).catch(function(n){console.error('Store.set("'+e+'", "'+t+'") failed:',n)})},e.prototype.get=function(e,t){var n=this;return void 0===t&&(t=!0),this.connection.Fetch({StoreName:this.Name,UserSpecific:this.UserSpecific,Namespace:this.Namespace,Key:e}).then(function(r){var o=n._knownValues[e];return n._knownValues[e]=r.Value,t&&n._dispatch.post(new ValueChangedMessage(e,r.Value,o)),r.Value}).catch(function(t){console.error("Store.get("+e+") failed:",t)})},e.prototype.getAll=function(e){var t=this;return void 0===e&&(e=!0),this.connection.FetchAll({StoreName:this.Name,UserSpecific:this.UserSpecific,Namespace:this.Namespace}).then(function(n){var r={},o=t._knownValues;if(t._knownValues={},n.Pairs.Pair.forEach(function(n){var i=t._knownValues[n.Key];t._knownValues[n.Key]=n.Value,delete o[n.Key],r[n.Key]=n.Value,e&&t._dispatch.post(new ValueChangedMessage(n.Key,n.Value,i))}),e)for(var i in o)t._dispatch.post(new ValueChangedMessage(i,void 0,o[i]));return r}).catch(function(e){return console.error("Store.getAll failed:",e),{}})},e.prototype.delete=function(e,t){var n=this;return void 0===t&&(t=!0),this.connection.Delete({StoreName:this.Name,UserSpecific:this.UserSpecific,Namespace:this.Namespace,Key:e}).then(function(r){var o=n._knownValues[e];delete n._knownValues[e],t&&n._dispatch.post(new ValueChangedMessage(e,void 0,o))}).catch(function(t){console.error("Store.delete("+e+") failed:",t)})},e.prototype.monitor=function(e){return this._dispatch.attach(e)},e}(),TargetClusterCache=function(e){function t(){return e.call(this,function(e){return e.BaseUrl+"-"+e.Name})||this}return __extends(t,e),t}(util.Cache),_targetCluster=new TargetClusterCache,TargetCluster=function(e){function t(t,n){var r=e.call(this)||this;return t instanceof TopologyService?(r.connection=t,r.machineConnection=new MachineService(t.connectionOptions())):(r.connection=new TopologyService(t),r.machineConnection=new MachineService(t)),r.clear({Name:n}),r}return __extends(t,e),Object.defineProperty(t.prototype,"BaseUrl",{get:function(){return this.connection.baseUrl},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"Name",{get:function(){return this.get("Name")},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"Prefix",{get:function(){return this.get("Prefix")},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"Type",{get:function(){return this.get("Type")},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"IsDefault",{get:function(){return this.get("IsDefault")},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"TpClusters",{get:function(){return this.get("TpClusters")},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"TpEclCCServers",{get:function(){return this.get("TpEclCCServers")},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"TpEclServers",{get:function(){return this.get("TpEclServers")},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"TpEclAgents",{get:function(){return this.get("TpEclAgents")},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"TpEclSchedulers",{get:function(){return this.get("TpEclSchedulers")},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"MachineInfoEx",{get:function(){return this.get("MachineInfoEx",[])},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"CMachineInfoEx",{get:function(){var e=this;return this.MachineInfoEx.map(function(t){return Machine.attach(e.machineConnection,t.Address,t)})},enumerable:!1,configurable:!0}),t.attach=function(e,n,r){var o=_targetCluster.get({BaseUrl:e.baseUrl,Name:n},function(){return new t(e,n)});return r&&o.set(__assign({},r)),o},t.prototype.fetchMachines=function(e){var t=this;return void 0===e&&(e={}),this.machineConnection.GetTargetClusterInfo(__assign({TargetClusters:{Item:[this.Type+":"+this.Name]}},e)).then(function(e){for(var n=[],r=0,o=e.TargetClusterInfoList.TargetClusterInfo;r<o.length;r++)for(var i=0,u=o[r].Processes.MachineInfoEx;i<u.length;i++){var s=u[i];n.push(s)}return t.set("MachineInfoEx",n),t.CMachineInfoEx})},t.prototype.machineStats=function(){for(var e=0,t=0,n=0,r=0,o=this.CMachineInfoEx;r<o.length;r++)for(var i=0,u=o[r].Storage.StorageInfo;i<u.length;i++){var s=u[i];t+=s.Available,n+=s.Total;var a=1-s.Available/s.Total;a>e&&(e=a)}return{maxDisk:e,meanDisk:1-(n?t/n:1)}},t.prototype.fetchUsage=function(){return this.machineConnection.GetTargetClusterUsageEx([this.Name])},t}(util.StateObject);function targetClusters(e){return(e instanceof TopologyService?e:new TopologyService(e)).TpListTargetClusters({}).then(function(t){return t.TargetClusters.TpClusterNameType.map(function(t){return TargetCluster.attach(e,t.Name,t)})})}var _defaultTargetCluster={};function defaultTargetCluster(e){if(!_defaultTargetCluster[e.baseUrl]){var t=void 0;t=e instanceof TopologyService?e:new TopologyService(e),_defaultTargetCluster[e.baseUrl]=t.TpListTargetClusters({}).then(function(t){var n,r,o;t.TargetClusters.TpClusterNameType.forEach(function(e){n||(n=e),r||!0!==e.IsDefault||(r=e),o||"hthor"!==e.Type||(o=e)});var i=r||o||n;return TargetCluster.attach(e,i.Name,i)})}return _defaultTargetCluster[e.baseUrl]}var Topology=function(e){function t(t){var n=e.call(this)||this;return n.connection=t instanceof TopologyService?t:new TopologyService(t),n}return __extends(t,e),Object.defineProperty(t.prototype,"properties",{get:function(){return this.get()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"TargetClusters",{get:function(){return this.get("TargetClusters")},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"CTargetClusters",{get:function(){var e=this;return this.TargetClusters.map(function(t){return TargetCluster.attach(e.connection,t.Name,t)})},enumerable:!1,configurable:!0}),t.prototype.GetESPServiceBaseURL=function(e){var t=this;return void 0===e&&(e=""),this.connection.TpServiceQuery({}).then(function(n){var r=t.connection.protocol(),o=t.connection.ip(),i="https:"===r?"18002":"8002";if(util.exists("ServiceList.TpEspServers.TpEspServer",n))for(var u=0,s=n.ServiceList.TpEspServers.TpEspServer;u<s.length;u++){var a=s[u];if(util.exists("TpBindings.TpBinding",a))for(var c=0,p=a.TpBindings.TpBinding;c<p.length;c++){var l=p[c];l.Service===e&&l.Protocol+":"===r&&(i=l.Port)}}return r+"//"+o+":"+i+"/"})},t.prototype.fetchTargetClusters=function(){var e=this;return this.connection.TpTargetClusterQuery({Type:"ROOT"}).then(function(t){return e.set({TargetClusters:t.TpTargetClusters.TpTargetCluster}),e.CTargetClusters})},t.prototype.refresh=function(){return __awaiter(this,void 0,void 0,function(){return __generator(this,function(e){switch(e.label){case 0:return[4,this.fetchTargetClusters()];case 1:return e.sent(),[2,this]}})})},t.prototype.on=function(t,n,r){if(this.isCallback(n))switch(t){case"changed":e.prototype.on.call(this,t,n)}else switch(t){case"changed":e.prototype.on.call(this,t,n,r)}return this._monitor(),this},t}(util.StateObject),logger$2=util.scopedLogger("clienttools/eclmeta"),Attr=function(){return function(e){this.__attrs=e.$,this.name=e.$.name}}(),Field=function(){function e(e,t){this.__attrs=t.$,this.definition=e,this.name=t.$.name,this.type=t.$.type}return Object.defineProperty(e.prototype,"scope",{get:function(){return this.definition},enumerable:!1,configurable:!0}),e}(),ECLScope=function(){function e(e,t,n,r,o,i,u,s){void 0===o&&(o=1),void 0===i&&(i=0),void 0===u&&(u=0),void 0===s&&(s=Number.MAX_VALUE),this.name=e,this.type=t,this.sourcePath=path.normalize(n),this.line=+o-1,this.start=+i,this.body=+u,this.end=+s,this.definitions=this.parseDefinitions(r)}return Object.defineProperty(e.prototype,"scope",{get:function(){return this},enumerable:!1,configurable:!0}),e.prototype.parseDefinitions=function(e){var t=this;return void 0===e&&(e=[]),e.map(function(e){return new Definition(t.sourcePath,e)})},e.prototype.contains=function(e){return e>=this.start&&e<=this.end},e.prototype.scopeStackAt=function(e){var t=[];return this.contains(e)&&(t.push(this),this.definitions.forEach(function(n){t=n.scopeStackAt(e).concat(t)})),t},e.prototype._resolve=function(e,t){void 0===e&&(e=[]);var n=t.split("."),r=n.shift(),o=util.find(e,function(e){return"string"==typeof e.name&&"string"==typeof r&&e.name.toLowerCase()===r.toLowerCase()});return o&&o.definitions.length&&n.length?this._resolve(o.definitions,n.join(".")):o},e.prototype.resolve=function(e){return this._resolve(this.definitions,e)},e.prototype.suggestions=function(){var e=this;return this.definitions.map(function(t){return{name:t.name,type:e.type}})},e}(),Definition=function(e){function t(t,n){var r=e.call(this,n.$.name,n.$.type,t,n.children("Definition"),n.$.line,n.$.start,n.$.body,n.$.end)||this;return r.__attrs=n.$,r.exported=!!n.$.exported,r.shared=!!n.$.shared,r.fullname=n.$.fullname,r.inherittype=n.$.inherittype,r.attrs=r.parseAttrs(n.children("Attr")),r.fields=r.parseFields(n.children("Field")),r}return __extends(t,e),t.prototype.parseAttrs=function(e){return void 0===e&&(e=[]),e.map(function(e){return new Attr(e)})},t.prototype.parseFields=function(e){var t=this;return void 0===e&&(e=[]),e.map(function(e){return new Field(t,e)})},t.prototype.suggestions=function(){return e.prototype.suggestions.call(this).concat(this.fields.map(function(e){return{name:e.name,type:e.type}}))},t}(ECLScope),Import=function(){return function(e){this.__attrs=e.$,this.name=e.$.name,this.ref=e.$.ref,this.start=e.$.start,this.end=e.$.end,this.line=e.$.line}}(),Source=function(e){function t(t){var n=e.call(this,t.$.name,"source",t.$.sourcePath,t.children("Definition"))||this;n.__attrs=t.$;var r=t.$.name.split(".");r.pop();var o=new util.XMLNode("");return o.appendAttribute("name","$"),o.appendAttribute("ref",r.join(".")),n.imports=__spreadArrays([new Import(o)],n.parseImports(t.children("Import"))),n}return __extends(t,e),t.prototype.parseImports=function(e){return void 0===e&&(e=[]),e.map(function(e){return new Import(e)})},t.prototype.resolve=function(t,n){var r;r||void 0===n||this.scopeStackAt(n).some(function(e){return!!(r=e.resolve(t))});return r||(r=e.prototype.resolve.call(this,t)),r},t}(ECLScope),isHiddenDirectory=function(e){return 0===path.basename(e).indexOf(".")},isDirectory=function(e){return fs.lstatSync(e).isDirectory()&&!isHiddenDirectory(e)},isEcl=function(e){return[".ecl",".ecllib"].indexOf(path.extname(e).toLowerCase())>=0},modAttrs=function(e){return fs.readdirSync(e).map(function(t){return path.join(e,t)}).filter(function(e){return isDirectory(e)||isEcl(e)})},File=function(e){function t(t,n){return e.call(this,t,"file",n,[])||this}return __extends(t,e),t.prototype.suggestions=function(){return[]},t}(ECLScope),Folder=function(e){function t(t,n){return e.call(this,t,"folder",n,[])||this}return __extends(t,e),t.prototype.suggestions=function(){return modAttrs(this.sourcePath).map(function(e){return{name:path.basename(e,".ecl"),type:"folder"}})},t}(ECLScope),Workspace=function(){function e(e,t){this._sourceByID=new util.DictionaryNoCase,this._sourceByPath=new util.Dictionary,this._test=new util.DictionaryNoCase,this._workspacePath=e,this._eclccPath=t}return e.prototype.refresh=function(){this.primeWorkspace(),this.primeClientTools()},e.prototype.primeClientTools=function(){var e=this;return locateClientTools(this._eclccPath,"",this._workspacePath).then(function(t){return e._clientTools=t,t.paths()}).then(function(t){for(var n=0,r=["ECLCC_ECLLIBRARY_PATH","ECLCC_PLUGIN_PATH"];n<r.length;n++){var o=r[n];t[o]&&fs.existsSync(t[o])&&e.walkChildFolders(t[o],t[o])}return e})},e.prototype.primeWorkspace=function(){fs.existsSync(this._workspacePath)&&this.visitFolder(this._workspacePath,this._workspacePath)},e.prototype.walkChildFolders=function(e,t,n){void 0===n&&(n=!1);for(var r=0,o=modAttrs(e);r<o.length;r++){var i=o[r];isDirectory(i)?this.visitFolder(i,t,n):this.visitFile(i,t,n)}},e.prototype.visitFile=function(e,t,n){void 0===n&&(n=!1);var r=path.parse(e),o=path.join(r.dir,r.name),i=path.relative(t,o).split(path.sep).join(".");!n&&this._test.has(i)||this._test.set(i,new File("",e))},e.prototype.visitFolder=function(e,t,n){void 0===n&&(n=!1);var r=path.relative(t,e).split(path.sep).join(".");!n&&this._test.has(r)||(this._test.set(r,new Folder(r,e)),this.walkChildFolders(e,t,n))},e.prototype.buildStack=function(e,t,n){var r=t.split(".");n&&e[e.length-1]===r[0]&&r.shift();var o=__spreadArrays(e,r),i=o.join(".");return{stack:o,qid:i}},e.prototype.walkECLScope=function(e,t){var n=this.buildStack(e,t.name,!0);this._test.set(n.qid,t);for(var r=0,o=t.definitions;r<o.length;r++){var i=o[r];this.walkDefinition(n.stack,i)}},e.prototype.walkField=function(e,t){var n=this.buildStack(e,t.name,!1);this._test.set(n.qid,t)},e.prototype.walkDefinition=function(e,t){var n=this.buildStack(e,t.name,!0);this.walkECLScope(e,t);for(var r=0,o=t.fields;r<o.length;r++){var i=o[r];this.walkField(n.stack,i)}},e.prototype.walkSource=function(e){this.walkECLScope([],e)},e.prototype.parseSources=function(e){void 0===e&&(e=[]);for(var t=0,n=e;t<n.length;t++){var r=n[t];if(r.$.name){var o=new Source(r);if(this._sourceByID.set(o.name,o),this._sourceByPath.set(o.sourcePath,o),o.name){var i=o.name.split(".").length;if(i>1){for(var u=o.sourcePath;i>1;)u=path.dirname(u),--i;this.visitFolder(u,path.dirname(u))}}this.walkSource(o)}}},e.prototype.parseMetaXML=function(e){var t=new MetaParser;return t.parse(e),this.parseSources(t.sources),t.sources.map(function(e){return path.normalize(e.$.sourcePath)})},e.prototype.resolveQualifiedID=function(e,t,n){var r;if(!r&&this._test.has(t)&&(r=this._test.get(t).scope),!r&&this._sourceByPath.has(e)){for(var o=this._sourceByPath.get(e),i=t.split("."),u=0,s=o.imports;u<s.length;u++){var a=s[u];if(a.name.toLowerCase()===i[0].toLowerCase()){a.ref?i[0]=a.ref:i.shift();break}}var c=i.join(".");!r&&this._test.has(c)&&(r=this._test.get(c).scope),r||(c=__spreadArrays(o.name.split("."),i).join("."),this._test.has(c)&&(r=this._test.get(c).scope))}return r},e.prototype.resolvePartialID=function(e,t,n){var r=(t=t.toLowerCase()).split(".");r.pop();var o=1===r.length?r[0]:r.join(".");return this.resolveQualifiedID(e,o,n)},e}(),workspaceCache=new util.Dictionary;function attachWorkspace(e,t){var n=path.normalize(e);if(!workspaceCache.has(n)){var r=new Workspace(n,t);workspaceCache.set(n,r),r.refresh()}return workspaceCache.get(n)}function isQualifiedIDChar(e,t,n){if(t<0)return!1;var r=e.charAt(t);return(n?/[a-zA-Z\d_\.$]/:/[a-zA-Z\d_]/).test(r)}function qualifiedIDBoundary(e,t,n){for(;isQualifiedIDChar(e,t,n);)t+=n?-1:1;return t+(n?1:-1)}var MetaParser=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.sources=[],t}return __extends(t,e),t.prototype.endXMLNode=function(t){switch(t.name){case"Source":this.sources.push(t)}e.prototype.endXMLNode.call(this,t)},t}(util.SAXStackParser),logger$3=util.scopedLogger("clienttools/eclcc"),exeExt="Windows_NT"===os.type()?".exe":"",Version=function(){function e(e){this.prefix="",this.major=0,this.minor=0,this.patch=0,this.postfix="";var t=e.split(" ");if(t.length){var n=/(?:(\w+)_)?(\d+)\.(\d+)\.(\d+)(?:-(.*))?/.exec(t[t.length-1]);n&&(this.prefix=n[1]||"",this.major=+n[2]||0,this.minor=+n[3]||0,this.patch=+n[4]||0,this.postfix=n[5]||"")}}return e.prototype.parse=function(e){},e.prototype.exists=function(){return 0!==this.major||0!==this.minor||0!==this.patch||""!==this.postfix},e.prototype.compare=function(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)},e.prototype.toString=function(){return this.prefix+"_"+this.major+"."+this.minor+"."+this.patch+"-"+this.postfix},e}(),ERROR="error",WARN="warning",Errors=function(){function e(e){this.errWarn=[],this.errOther=[],this._checked=e}return e.prototype.checked=function(){return this._checked},e.prototype.all=function(){return this.errWarn},e.prototype.errors=function(){return this.errWarn.filter(function(e){return e.severity===ERROR})},e.prototype.hasError=function(){return this.errors().length>0},e.prototype.warnings=function(){return this.errWarn.filter(function(e){return e.severity===WARN})},e.prototype.hasWarning=function(){return this.warnings().length>0},e.prototype.info=function(){return this.errWarn.filter(function(e){return[ERROR,WARN].indexOf(e.severity)<0})},e.prototype.hasOther=function(){return this.info().length>0},e.prototype.unknown=function(){return this.errOther},e.prototype.hasUnknown=function(){return this.unknown().length>0},e}(),EclccErrors=function(e){function t(t,n){var r=e.call(this,n)||this;if(t&&t.length)for(var o=0,i=t.split(os.EOL);o<i.length;o++){var u=i[o],s=/([a-zA-Z]:\\(?:[- \w\.\d]+\\)*(?:[- \w\.\d]+)?|(?:\/[\w\.\-]+)+)\((\d*),(\d*)\) ?: ?(error|warning|info) C(\d*) ?: ?(.*)/.exec(u);if(s){var a=s[1],c=s[2],p=s[3],l=s[4],f=+c,h=+p,d=s[5]+": "+s[6];r.errWarn.push({filePath:a,line:f,col:h,msg:d,severity:l})}else if(s=/(error|warning|info): (.*)/i.exec(u)){l=s[1],d=s[2];r.errWarn.push({filePath:"",line:0,col:0,msg:d,severity:l})}else(s=/\d error(s?), \d warning(s?)/.exec(u))||(logger$3.warning('parseECLErrors: Unable to parse "'+u+'"'),r.errOther.push(u))}return r._checked=n,r}return __extends(t,e),t}(Errors),EnvchkErrors=function(e){function t(t,n,r){var o=e.call(this,r)||this,i=fs.readFileSync(t,"utf8");if(i=i.replace("\r\n","\n"),o._lines=i.split("\n"),n&&n.length)for(var u=0,s=n.split(os.EOL);u<s.length;u++){var a=s[u],c=/(Warning|Error) : Path\=(\S*?)(\[\S*\])? Message\=(.*)/.exec(a);if(c){var p=c[1],l=c[2],f=c[3],h=l+" "+(f||"")+": "+c[4],d=o.locate(l),g=d[0],y=d[1];o.errWarn.push({filePath:t,line:g,col:y,msg:h,severity:p})}else c||(logger$3.warning('parseECLErrors: Unable to parse "'+a+'"'),o.errOther.push(a))}return o._checked=r,o}return __extends(t,e),t.prototype.locate=function(e){var t=e.split("/");if(t.length&&""===t[0]&&t.shift(),t.length>0)for(var n=0,r=0,o=this._lines;r<o.length;r++){var i=o[r],u="<"+t[0];if((i.indexOf(u+" ")>=0||i.indexOf(u+">")>=0)&&(console.log(n,u),t.shift(),0===t.length))return[n+1,i.indexOf(u)+1];++n}return[0,0]},t}(Errors);function walkXmlJson$1(e,t,n){for(var r in(n=n||[]).push(e),e)if(e.hasOwnProperty(r)){var o=e[r];t(r,o,n),o instanceof Array?o.forEach(function(e){walkXmlJson$1(e,t,n)}):"object"==typeof o&&walkXmlJson$1(o,t,n)}n.pop()}var allClientToolsCache,LocalWorkunit=function(){function e(e){this.jsonWU=e}return e.prototype.bpGetValidLocations=function(e){var t=[];if(util.exists("W_LOCAL.Graphs",this.jsonWU)){var n="";walkXmlJson$1(this.jsonWU.W_LOCAL.Graphs,function(r,o,i){if("$"===r&&o.id&&(n=o.id),"$"===r&&"definition"===o.name){var u=/([a-z,A-Z]:\\(?:[-\w\.\d]+\\)*(?:[-\w\.\d]+)?|(?:\/[\w\.\-]+)+)\((\d*),(\d*)\)/.exec(o.value);if(u){var s=u[1],a=+u[2],c=+u[3];e===s&&t.push({file:s,line:a,col:c,id:n})}}})}return t},e}(),ClientTools=function(){function e(e,t,n,r,o,i){void 0===n&&(n=[]),void 0===r&&(r=!1),void 0===o&&(o=[]),this._paths={},this.eclccPath=e,this.binPath=path.dirname(this.eclccPath),this.envchkPath=path.join(this.binPath,"envchk"+exeExt),this.cwd=path.normalize(t||this.binPath),this.includeFolders=n,this._legacyMode=r,this._args=o,this._version=i}return e.prototype.clone=function(t,n,r,o){return void 0===r&&(r=!1),void 0===o&&(o=[]),new e(this.eclccPath,t,n,r,o,this._version)},e.prototype.exists=function(e){try{return fs.accessSync(e),!0}catch(e){}return!1},e.prototype.args=function(e){void 0===e&&(e=[]);var t=__spreadArrays(this._args);return this._legacyMode&&t.push("-legacy"),t.concat(this.includeFolders.map(function(e){return"-I"+path.normalize(e)})).concat(e)},e.prototype.version=function(){var e=this;return this._version?Promise.resolve(this._version):this.execFile(this.eclccPath,this.binPath,this.args(["--version"]),"eclcc","Cannot find "+this.eclccPath).then(function(t){return e._version=new Version(t.stdout),e._version})},e.prototype.versionSync=function(){return this._version},e.prototype.paths=function(){var e=this;return this.execFile(this.eclccPath,this.cwd,this.args(["-showpaths"]),"eclcc","Cannot find "+this.eclccPath).then(function(t){if(t&&t.stdout&&t.stdout.length)for(var n=0,r=t.stdout.split(/\r?\n/);n<r.length;n++){var o=r[n].split("=");2===o.length&&(e._paths[o[0]]=o[1])}return e._paths})},e.prototype.loadXMLDoc=function(e,t){return new Promise(function(n,r){var o=fs.readFileSync(e,"ascii"),i=util.xml2json(o);t&&fs.unlink(e,function(e){}),n(i)})},e.prototype.createWU=function(e){var t=this,n=tmp.tmpNameSync({prefix:"eclcc-wu-tmp",postfix:""}),r=["-o"+n,"-wu"].concat([e]);return this.execFile(this.eclccPath,this.cwd,this.args(r),"eclcc","Cannot find "+this.eclccPath).then(function(e){var r=path.normalize(n+".xml");return(t.exists(r)?t.loadXMLDoc(r,!0):Promise.resolve({})).then(function(e){return new LocalWorkunit(e)})})},e.prototype.createArchive=function(e){var t=["-E"].concat([e]);return this.execFile(this.eclccPath,this.cwd,this.args(t),"eclcc","Cannot find "+this.eclccPath).then(function(e){return{content:e.stdout,err:new EclccErrors(e.stderr,[])}})},e.prototype.attachWorkspace=function(){return attachWorkspace(this.cwd)},e.prototype.fetchMeta=function(e){return Promise.all([attachWorkspace(this.cwd),this.execFile(this.eclccPath,this.cwd,this.args(["-M",e]),"eclcc","Cannot find "+this.eclccPath)]).then(function(e){var t=e[0],n=e[1];return n&&n.stdout&&n.stdout.length&&t.parseMetaXML(n.stdout),t})},e.prototype.syntaxCheck=function(e,t){return void 0===t&&(t=["-syntax"]),Promise.all([attachWorkspace(this.cwd),this.execFile(this.eclccPath,this.cwd,this.args(__spreadArrays(t,["-M",e])),"eclcc","Cannot find "+this.eclccPath)]).then(function(e){var t=e[0],n=e[1],r=[];return n&&n.stdout&&n.stdout.length&&(r=t.parseMetaXML(n.stdout)),new EclccErrors(n?n.stderr:"",r)})},e.prototype.envCheck=function(e,t){return void 0===t&&(t=[]),Promise.all([attachWorkspace(this.cwd),this.execFile(this.envchkPath,this.cwd,this.args(__spreadArrays(t,[e])),"envchk","Cannot find "+this.envchkPath)]).then(function(t){t[0];var n=t[1];return new EnvchkErrors(e,n?n.stderr:"",[])})},e.prototype.execFile=function(e,t,n,r,o){return new Promise(function(r,o){logger$3.debug(e+" "+n.join(" "));var i=cp.spawn(e,n,{cwd:t}),u="",s="";i.stdout.on("data",function(e){u+=e.toString()}),i.stderr.on("data",function(e){s+=e.toString()}),i.on("close",function(e,t){r({stdout:u.trim(),stderr:s.trim()})})})},e}();function locateClientToolsInFolder(e,t){if(e){var n=path.join(e,"HPCCSystems");if(fs.existsSync(n)&&fs.statSync(n).isDirectory()){if("Windows_NT"!==os.type()){var r=path.join(n,"bin","eclcc");fs.existsSync(r)&&t.push(new ClientTools(r))}fs.readdirSync(n).forEach(function(e){var r=path.join(n,e,"clienttools","bin","eclcc"+exeExt);if(fs.existsSync(r)){var o=path.basename(e);new Version(o).exists()&&t.push(new ClientTools(r))}})}}}function locateAllClientTools(){if(allClientToolsCache)return allClientToolsCache;var e=[];switch(os.type()){case"Windows_NT":var t=process.env["ProgramFiles(x86)"]||"";t&&locateClientToolsInFolder(t,e);var n=process.env.ProgramFiles||"";n&&locateClientToolsInFolder(n,e),t||n||locateClientToolsInFolder("c:\\Program Files (x86)",e);break;case"Linux":case"Darwin":locateClientToolsInFolder("/opt",e)}return allClientToolsCache=Promise.all(e.map(function(e){return e.version()})).then(function(){return e.sort(function(e,t){return t.versionSync().compare(e.versionSync())}),e})}var eclccPathMsg="";function logEclccPath(e){var t="Using eclccPath setting: "+e;eclccPathMsg!==t&&(logger$3.info(t),eclccPathMsg=t)}function locateClientTools(e,t,n,r,o){return void 0===e&&(e=""),void 0===t&&(t=""),void 0===n&&(n="."),void 0===r&&(r=[]),void 0===o&&(o=!1),e&&fs.existsSync(e)?(logEclccPath(e),Promise.resolve(new ClientTools(e,n,r,o))):locateAllClientTools().then(function(e){if(!e.length)throw new Error("Unable to locate ECL Client Tools.");for(var i,u,s=new Version(t),a=0,c=e;a<c.length;a++){var p=c[a],l=p.versionSync();if(i||(i=p),u||s.major!==l.major||(u=p),s.major===l.major&&s.minor===l.minor)return p.clone(n,r,o)}var f=u||i;return logEclccPath(f.eclccPath),f.clone(n,r,o)})}if(util.root.DOMParser=xmldom.DOMParser,void 0===util.root.fetch){util.root.fetch=fetch$1;var https=require("https");util.root.fetch.__agent=new https.Agent({rejectUnauthorized:!1})}void 0===util.root.btoa&&(util.root.btoa=function(e){return safeBuffer.Buffer.from(e||"","utf8").toString("base64")}),exports.AccountService=AccountService,exports.Activity=Activity,exports.Attr=Attr,exports.Attribute=Attribute,exports.BUILD_VERSION=BUILD_VERSION,exports.BaseScope=BaseScope,exports.ClientTools=ClientTools,exports.Connection=Connection,exports.DFUService=DFUService,exports.Definition=Definition,exports.ECLGraph=ECLGraph,exports.ECLScope=ECLScope,exports.ESPConnection=ESPConnection,exports.ESPExceptions=ESPExceptions,exports.EclService=EclService,exports.EclccErrors=EclccErrors,exports.EnvchkErrors=EnvchkErrors,exports.Errors=Errors,exports.Field=Field,exports.File=File,exports.Folder=Folder,exports.GlobalResultCache=GlobalResultCache,exports.GraphCache=GraphCache,exports.Import=Import,exports.LocalWorkunit=LocalWorkunit,exports.LogicalFile=LogicalFile,exports.LogicalFileCache=LogicalFileCache,exports.Machine=Machine,exports.MachineCache=MachineCache,exports.MachineService=MachineService,exports.PKG_NAME=PKG_NAME,exports.PKG_VERSION=PKG_VERSION,exports.Query=Query,exports.Resource=Resource,exports.Result=Result,exports.ResultCache=ResultCache,exports.SMCService=SMCService,exports.Scope=Scope,exports.ScopeEdge=ScopeEdge,exports.ScopeGraph=ScopeGraph,exports.ScopeSubgraph=ScopeSubgraph,exports.ScopeVertex=ScopeVertex,exports.Service=Service,exports.Source=Source,exports.SourceFile=SourceFile,exports.Store=Store,exports.StoreCache=StoreCache,exports.StoreService=StoreService,exports.TargetCluster=TargetCluster,exports.TargetClusterCache=TargetClusterCache,exports.Timer=Timer,exports.Topology=Topology,exports.TopologyService=TopologyService,exports.ValueChangedMessage=ValueChangedMessage,exports.Version=Version,exports.Workspace=Workspace,exports.Workunit=Workunit,exports.WorkunitCache=WorkunitCache,exports.WorkunitsService=WorkunitsService,exports.XGMMLEdge=XGMMLEdge,exports.XGMMLGraph=XGMMLGraph,exports.XGMMLSubgraph=XGMMLSubgraph,exports.XGMMLVertex=XGMMLVertex,exports.XSDNode=XSDNode,exports.XSDSchema=XSDSchema,exports.XSDSimpleType=XSDSimpleType,exports.XSDXMLNode=XSDXMLNode,exports.attachWorkspace=attachWorkspace,exports.createGraph=createGraph,exports.createXGMMLGraph=createXGMMLGraph,exports.defaultTargetCluster=defaultTargetCluster,exports.deserializeResponse=deserializeResponse,exports.get=get,exports.hookSend=hookSend,exports.instanceOfIConnection=instanceOfIConnection,exports.instanceOfIOptions=instanceOfIOptions,exports.isArray=isArray,exports.isWUInfoWorkunit=isWUInfoWorkunit,exports.isWUQueryECLWorkunit=isWUQueryECLWorkunit,exports.jsonp=jsonp,exports.locateAllClientTools=locateAllClientTools,exports.locateClientTools=locateClientTools,exports.parseXSD=parseXSD,exports.parseXSD2=parseXSD2,exports.post=post,exports.qualifiedIDBoundary=qualifiedIDBoundary,exports.send=send,exports.serializeRequest=serializeRequest,exports.setTransportFactory=setTransportFactory,exports.targetClusters=targetClusters,exports.walkXmlJson=walkXmlJson$1;
2//# sourceMappingURL=index.node.min.js.map
\No newline at end of file