@alexanderzobnin/monaco-kusto
Version:
CSL, KQL plugin for the Monaco Editor
1 lines • 1.33 MB
JavaScript
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.monaco=t():e.monaco=t()}(self,function(){return function(e){var t={};function n(s){if(t[s])return t[s].exports;var i=t[s]={i:s,l:!1,exports:{}};return e[s].call(i.exports,i,i.exports,n),i.l=!0,i.exports}return n.m=e,n.c=t,n.d=function(e,t,s){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:s})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var s=Object.create(null);if(n.r(s),Object.defineProperty(s,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var i in e)n.d(s,i,function(t){return e[t]}.bind(null,i));return s},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=15)}({0:function(e,t){e.exports={import:function(){throw new Error("System.import cannot be used indirectly")}}},15:function(e,t,n){(function(e){Bridge.assembly("Kusto.JavaScript.Client",function(t,n){"use strict";e=n.System,Bridge.define("Kusto.Charting.AnomalyDataHelper2",{statics:{fields:{c_timestampColumnName:null,c_valueColumnName:null,c_seriesColumnName:null},props:{AnomalySerieSuffix:null},ctors:{init:function(){this.c_timestampColumnName="Timestamp",this.c_valueColumnName="Value",this.c_seriesColumnName="Series",this.AnomalySerieSuffix="(anomaly)"}},methods:{EnchanceDataWithAnomalyDataFromService:function(n,s){if(null==n)return s;var i=(Kusto.Charting.AnomalyDataHelper2.DataItemsToDataTableLiteral(s)||"")+(e.String.format("| summarize dt = makelist({0}, 100000), y=makelist({1}, 100000) by {2}\r\n| extend (anomalies, scores, baseline)=series_decompose_anomalies(y)\r\n| project dt, y, anomalies, Series\r\n| mvexpand dt to typeof(datetime), y to typeof(double), anomalies to typeof(double) limit 1000000\r\n| where anomalies != 0\r\n| project dt, anomaly_value = (anomalies * anomalies)*y, Series",Kusto.Charting.AnomalyDataHelper2.c_timestampColumnName,Kusto.Charting.AnomalyDataHelper2.c_valueColumnName,Kusto.Charting.AnomalyDataHelper2.c_seriesColumnName)||""),a=e.Linq.Enumerable.from(n.Kusto$Charting$IKustoClientContext$ExecuteQuery(Kusto.Charting.AnomalyDataHelper2.AnomalyInputOutputRecord,i)).ToArray();return null!=a&&e.Linq.Enumerable.from(a).any()&&s.AddRange(e.Linq.Enumerable.from(a).select(t.$.Kusto.Charting.AnomalyDataHelper2.f1)),s},DataItemsToDataTableLiteral:function(t){var n,s=new e.Text.StringBuilder;s.append("datatable"),s.appendLine(e.String.format("({0}:datetime,{1}:double,{2}:string)",Kusto.Charting.AnomalyDataHelper2.c_timestampColumnName,Kusto.Charting.AnomalyDataHelper2.c_valueColumnName,Kusto.Charting.AnomalyDataHelper2.c_seriesColumnName)),s.append("["),n=Bridge.getEnumerator(t,Kusto.Charting.DataItem);try{for(;n.moveNext();){var i=n.Current;s.append("datetime("),s.append(e.DateTime.format(i.ArgumentDateTime)),s.append("),"),s.append(e.Double.format(i.ValueData)),s.append(",'"),s.append(i.SeriesName),s.appendLine("',")}}finally{Bridge.is(n,e.IDisposable)&&n.System$IDisposable$Dispose()}return s.appendLine("]"),s.toString()},EnchanceDataWithAnomalyDataFromColumns:function(n,s){var i,a,r=new(e.Collections.Generic.List$1(Kusto.Charting.DataItem).ctor),o=new(e.Collections.Generic.HashSet$1(e.String).$ctor1)(s),l=e.Linq.Enumerable.from(n).where(function(e){return!o.contains(e.ValueName)}).select(t.$.Kusto.Charting.AnomalyDataHelper2.f2).firstOrDefault(null,null);if(e.String.isNullOrEmpty(l))return n;r.AddRange(e.Linq.Enumerable.from(n).where(function(e){return!o.contains(e.ValueName)}));var u=e.Linq.Enumerable.from(n).where(function(t){return e.String.equals(t.ValueName,l)}).ToArray(Kusto.Charting.DataItem);i=Bridge.getEnumerator(s);try{for(;i.moveNext();){var d={v:i.Current},m=e.Linq.Enumerable.from(n).where(function(t,n){return function(t){return e.String.equals(t.ValueName,n.v)}}(0,d)).ToArray(Kusto.Charting.DataItem);if(u.length!==m.length)return n;for(var c=0;c<u.length;c=c+1|0){var p=u[e.Array.index(c,u)],S=m[e.Array.index(c,m)];if(0!==S.ValueData){var g=((a=new Kusto.Charting.DataItem).ArgumentDateTime=S.ArgumentDateTime,a.ArgumentData=S.ArgumentData,a.SeriesName=(S.SeriesName||"")+(Kusto.Charting.AnomalyDataHelper2.AnomalySerieSuffix||""),a.ValueData=p.ValueData,a.PrefferredChartKind=Kusto.Charting.ChartKind.Point,a);r.add(g)}}}}finally{Bridge.is(i,e.IDisposable)&&i.System$IDisposable$Dispose()}return r}}}}),Bridge.ns("Kusto.Charting.AnomalyDataHelper2",t.$),Bridge.apply(t.$.Kusto.Charting.AnomalyDataHelper2,{f1:function(t){var n;return(n=new Kusto.Charting.DataItem).ArgumentDateTime=t.Timestamp,n.ArgumentData=e.DateTime.format(t.Timestamp,"o"),n.SeriesName=(t.Series||"")+(Kusto.Charting.AnomalyDataHelper2.AnomalySerieSuffix||""),n.ValueData=t.Value,n.PrefferredChartKind=Kusto.Charting.ChartKind.Point,n},f2:function(e){return e.ValueName}}),Bridge.define("Kusto.Charting.AnomalyDataHelper2.AnomalyInputOutputRecord",{$kind:"nested class",fields:{Timestamp:null,Value:0,Series:null},ctors:{init:function(){this.Timestamp=e.DateTime.getDefaultValue()}}}),Bridge.define("Kusto.Charting.ArgumentColumnType",{$kind:"enum",statics:{fields:{None:0,Numeric:2,DateTime:4,TimeSpan:8,String:16,Object:32,DateTimeOrTimeSpan:12,StringOrDateTimeOrTimeSpan:28,NumericOrDateTimeOrTimeSpan:14,StringOrObject:48,All:62}},$flags:!0}),Bridge.define("Kusto.Charting.ArgumentRestrictions",{$kind:"enum",statics:{fields:{None:0,MustHave:1,NotIncludedInSeries:2}},$flags:!0}),Bridge.define("Kusto.Charting.ChartKind",{$kind:"enum",statics:{fields:{Unspecified:0,Line:1,Point:2,Bar:3}}}),Bridge.define("Kusto.Charting.ChartLimitsPolicy",{props:{MaxPointsPerChartError:0,MaxPointsPerChartWarning:0,MaxSeriesPerChartError:0,MaxSeriesPerChartWarning:0,MaxDatetimePeriodError:null},ctors:{init:function(){this.MaxDatetimePeriodError=new e.TimeSpan},ctor:function(e,t,n,s,i){this.$initialize(),this.MaxPointsPerChartError=e,this.MaxPointsPerChartWarning=t,this.MaxSeriesPerChartError=n,this.MaxSeriesPerChartWarning=s,this.MaxDatetimePeriodError=i}}}),Bridge.define("Kusto.Charting.DataChartsHelper",{statics:{fields:{c_minFractionOfIntervalsToDetectDistribution:0,c_minElementsAmountToFillGapsWithNans:0,c_decimalRoundingPrecision:0,c_doubleAcceptableApproximation:0,c_defaultArgumentDatetime:null,c_defaultArgumentNumeric:0},ctors:{init:function(){this.c_defaultArgumentDatetime=e.DateTime.getDefaultValue(),this.c_minFractionOfIntervalsToDetectDistribution=.8,this.c_minElementsAmountToFillGapsWithNans=4,this.c_decimalRoundingPrecision=8,this.c_doubleAcceptableApproximation=1e-8,this.c_defaultArgumentDatetime=Bridge.getDefaultValue(e.DateTime),this.c_defaultArgumentNumeric=Number.NaN}},methods:{GetData:function(t,n,s,i,a,r,o){void 0===n&&(n=16),void 0===s&&(s=0),void 0===i&&(i=null),void 0===a&&(a=!1),void 0===r&&(r=null),void 0===o&&(o=null);var l=new(e.Collections.Generic.List$1(Kusto.Charting.DataItem).ctor),u=t.Kusto$Charting$IChartingDataSource$GetSchema();if(null==u||0===e.Linq.Enumerable.from(u).count())return l;null==i&&(i=new(e.Collections.Generic.List$1(e.String).ctor)),null==o&&(o=new(e.Collections.Generic.List$1(e.String).ctor));var d=new(e.Collections.Generic.Dictionary$2(e.String,e.Double)),m=new(e.Collections.Generic.Dictionary$2(e.String,e.Double)),c={v:-1},p=new(e.Collections.Generic.List$1(e.Int32).ctor),S=new(e.Collections.Generic.List$1(e.Int32).ctor),g={v:!1};Kusto.Charting.DataChartsHelper.ResolvePredefinedColumnsIndexes(t,i,p,o,S,r,c,n,g);var h=!1;if(g.v||(h=Kusto.Charting.DataChartsHelper.DetectChartDimensionsUsingColumnTypes(u,n,s,c,p,S),g.v=!h),g.v&&(h=Kusto.Charting.DataChartsHelper.DetectChartDimensionsUsingData(u,t,i,n,s,c,p,S)),!h)return l;for(var I=0;I<t.Kusto$Charting$IChartingDataSource$RowsCount;I=I+1|0)g.v?Kusto.Charting.DataChartsHelper.ResolveDataSeriesFromDataRow(l,t,d,m,I,n,s,a,c.v,p,S):Kusto.Charting.DataChartsHelper.ResolveDataItemsFromDataRow(l,t,d,m,I,n,s,a,c.v,p,S);return l},IsNumericType:function(t,n){return void 0===n&&(n=!0),null!=t&&(Bridge.referenceEquals(t,e.TimeSpan)||Bridge.referenceEquals(t,e.DateTime)?n:!!(Bridge.referenceEquals(t,e.Byte)||Bridge.referenceEquals(t,e.Decimal)||Bridge.referenceEquals(t,e.Double)||Bridge.referenceEquals(t,e.Int16)||Bridge.referenceEquals(t,e.Int32)||Bridge.referenceEquals(t,e.Int64)||Bridge.referenceEquals(t,e.SByte)||Bridge.referenceEquals(t,e.UInt16)||Bridge.referenceEquals(t,e.UInt32)||Bridge.referenceEquals(t,e.UInt64))||!!(Bridge.referenceEquals(t,e.Object)&&Bridge.Reflection.isGenericType(t)&&Bridge.referenceEquals(Bridge.Reflection.getGenericTypeDefinition(t),e.Nullable$1))&&Kusto.Charting.DataChartsHelper.IsNumericType(e.Nullable.getUnderlyingType(t),n))},GetAllArgumentColumns:function(t,n){void 0===n&&(n=null);var s=new(e.Collections.Generic.List$1(e.String).ctor),i=t.Kusto$Charting$IChartingDataSource$GetSchema(),a=e.Linq.Enumerable.from(t.Kusto$Charting$IChartingDataSource$GetSchema()).count(),r=null!=n&&e.Linq.Enumerable.from(n).any();if(1<a)for(var o=0;o<a;o=o+1|0){var l=e.Linq.Enumerable.from(i).elementAt(o).Item1;r&&e.Linq.Enumerable.from(n).contains(l)||s.add(l)}return s},GetFirstStringColumnName:function(t,n){void 0===n&&(n=0);for(var s=t.Kusto$Charting$IChartingDataSource$GetSchema(),i=e.Linq.Enumerable.from(t.Kusto$Charting$IChartingDataSource$GetSchema()).count(),a=0;a<i;a=a+1|0)if(e.Linq.Enumerable.from(s).elementAt(a).Item2===Kusto.Charting.ArgumentColumnType.String){if(0===n)return e.Linq.Enumerable.from(s).elementAt(a).Item1;n=n-1|0}return null},FillGapsWithNaNs:function(n,s){var i;if(null==n||!e.Linq.Enumerable.from(n).any()||n.Count<Kusto.Charting.DataChartsHelper.c_minElementsAmountToFillGapsWithNans)return n;var a=e.Linq.Enumerable.from(n).groupBy(t.$.Kusto.Charting.DataChartsHelper.f1),r=new(e.Collections.Generic.List$1(Kusto.Charting.DataItem).$ctor2)(n.Count);i=Bridge.getEnumerator(a);try{for(;i.moveNext();){var o=i.Current,l=Kusto.Charting.DataChartsHelper.FillGapsWithNaNs$1(o.select(t.$.Kusto.Charting.DataChartsHelper.f2),s);r.AddRange(l)}}finally{Bridge.is(i,e.IDisposable)&&i.System$IDisposable$Dispose()}return r},FillGapsWithNaNs$1:function(n,s){var i,a;if(e.Linq.Enumerable.from(n).count()<Kusto.Charting.DataChartsHelper.c_minElementsAmountToFillGapsWithNans)return n;switch(s){case Kusto.Charting.ArgumentColumnType.DateTime:n=e.Linq.Enumerable.from(n).orderBy(t.$.Kusto.Charting.DataChartsHelper.f3),a=e.Linq.Enumerable.from(n).select(t.$.Kusto.Charting.DataChartsHelper.f4).ToArray(e.Double);break;case Kusto.Charting.ArgumentColumnType.Numeric:n=e.Linq.Enumerable.from(n).orderBy(t.$.Kusto.Charting.DataChartsHelper.f5),a=e.Linq.Enumerable.from(n).select(t.$.Kusto.Charting.DataChartsHelper.f5).ToArray(e.Double);break;default:return n}if(null==a||!e.Linq.Enumerable.from(a).any())return n;var r=Kusto.Charting.DataChartsHelper.SelectSuccessivePairs(a),o=Kusto.Charting.DataChartsHelper.GetTopGroupByCount(r,s),l=o.Item1;if(null==o||e.Convert.toDouble(Bridge.box(o.Item2,e.Int32))/e.Linq.Enumerable.from(r).count()<Kusto.Charting.DataChartsHelper.c_minFractionOfIntervalsToDetectDistribution)return n;var u=new(e.Collections.Generic.List$1(Kusto.Charting.DataItem).$ctor2)(e.Linq.Enumerable.from(n).count()),d=null;i=Bridge.getEnumerator(n,Kusto.Charting.DataItem);try{for(;i.moveNext();){var m=i.Current;if(null!=d){var c=Kusto.Charting.DataChartsHelper.GetDistance(d,m,s);if(c-l>Kusto.Charting.DataChartsHelper.c_doubleAcceptableApproximation){var p=0;try{p=e.Convert.toInt32(Bridge.box(Bridge.Math.round(c/l,0,6),e.Double,e.Double.format,e.Double.getHashCode))}catch(s){return s=e.Exception.create(s),n}if(c-p*l>Kusto.Charting.DataChartsHelper.c_doubleAcceptableApproximation)return n;for(var S=1;S<p;S=S+1|0){var g=d.Clone();switch(g.ValueData=Number.NaN,s){case Kusto.Charting.ArgumentColumnType.Numeric:g.ArgumentNumeric+=l*S,g.ArgumentData=e.Double.format(g.ArgumentNumeric);break;case Kusto.Charting.ArgumentColumnType.DateTime:g.ArgumentDateTime=e.DateTime.addTicks(g.ArgumentDateTime,e.Convert.toInt64(Bridge.box(l,e.Double,e.Double.format,e.Double.getHashCode)).mul(e.Int64(S))),g.ArgumentData=e.DateTime.format(g.ArgumentDateTime)}u.add(g)}}u.add(m),d=m}else u.add(m),d=m}}finally{Bridge.is(i,e.IDisposable)&&i.System$IDisposable$Dispose()}return u},ResolveArgumentType:function(n){if(null==n||!e.Linq.Enumerable.from(n).any())return Kusto.Charting.ArgumentColumnType.None;if(e.Linq.Enumerable.from(n).all(t.$.Kusto.Charting.DataChartsHelper.f6))return Kusto.Charting.ArgumentColumnType.DateTime;if(e.Linq.Enumerable.from(n).any(t.$.Kusto.Charting.DataChartsHelper.f7))return Kusto.Charting.ArgumentColumnType.Numeric;var s={};return e.Linq.Enumerable.from(n).all(function(t){return e.TimeSpan.tryParse(t.ArgumentData,null,s)})?Kusto.Charting.ArgumentColumnType.TimeSpan:Kusto.Charting.ArgumentColumnType.String},ValidateData:function(n,s,i,a){var r;if(a.v="",null==n||!e.Linq.Enumerable.from(n).any())return a.v="Data was not provided",Kusto.Charting.ValidationStatus.PolicyViolationError;if(e.Linq.Enumerable.from(n).where(t.$.Kusto.Charting.DataChartsHelper.f8).any())return a.v="Data includes non-finite values",Kusto.Charting.ValidationStatus.PolicyViolationError;if(s===Kusto.Charting.ArgumentColumnType.DateTime&&e.TimeSpan.neq(i.MaxDatetimePeriodError,Bridge.getDefaultValue(e.TimeSpan))){var o=e.DateTime.getMaxValue(),l=e.DateTime.getMinValue();r=Bridge.getEnumerator(n,Kusto.Charting.DataItem);try{for(;r.moveNext();){var u=r.Current;e.DateTime.lt(l,u.ArgumentDateTime)&&(l=u.ArgumentDateTime),e.DateTime.gt(o,u.ArgumentDateTime)&&(o=u.ArgumentDateTime)}}finally{Bridge.is(r,e.IDisposable)&&r.System$IDisposable$Dispose()}if(e.DateTime.gt(o,l)||e.TimeSpan.gt(e.DateTime.subdd(l,o),i.MaxDatetimePeriodError))return a.v="Input time range is too wide to fit into chart",Kusto.Charting.ValidationStatus.PolicyViolationError}var d=e.Linq.Enumerable.from(n).select(t.$.Kusto.Charting.DataChartsHelper.f1).distinct().count(),m=e.Linq.Enumerable.from(n).count();return d>i.MaxSeriesPerChartError?(a.v="Too many series\n"+(e.String.format("Provided data contains {0} series which exceeds allowed amount for the chart: {1}",Bridge.box(d,e.Int32),Bridge.box(i.MaxSeriesPerChartError,e.Int32))||""),Kusto.Charting.ValidationStatus.PolicyViolationError):m>i.MaxPointsPerChartError?(a.v="Too many points\n"+(e.String.format("Provided data contains {0} points which exceeds allowed amount for the chart: {1}",Bridge.box(m,e.Int32),Bridge.box(i.MaxPointsPerChartError,e.Int32))||""),Kusto.Charting.ValidationStatus.PolicyViolationError):d>i.MaxSeriesPerChartWarning||m>i.MaxPointsPerChartWarning?(a.v="Too many series or data points\nChart can perform badly when large amount of data is used.\n"+(e.String.format("You are about to plot {0} series with {1} points.",Bridge.box(d,e.Int32),Bridge.box(m,e.Int32))||""),Kusto.Charting.ValidationStatus.PolicyViolationWarning):Kusto.Charting.ValidationStatus.Valid},ResolveJsonArrayType:function(t){var n;try{n=Newtonsoft.Json.JsonConvert.DeserializeObject(t,e.Array.type(e.String))}catch(t){return t=e.Exception.create(t),Kusto.Charting.ArgumentColumnType.None}return null==n||0===e.Linq.Enumerable.from(n).count()?Kusto.Charting.ArgumentColumnType.None:Kusto.Charting.DataChartsHelper.ArrayIsDouble(n)?Kusto.Charting.ArgumentColumnType.Numeric:Kusto.Charting.DataChartsHelper.ArrayIsTimespan(n)?Kusto.Charting.ArgumentColumnType.TimeSpan:Kusto.Charting.DataChartsHelper.ArrayIsDatetime(n)?Kusto.Charting.ArgumentColumnType.DateTime:Kusto.Charting.ArgumentColumnType.String},SelectSuccessivePairs:function(t){var n;if(null==t||e.Linq.Enumerable.from(t).count()<=1)return null;var s=e.Array.init(e.Linq.Enumerable.from(t).count()-1|0,0,e.Double),i=!0,a=Bridge.getDefaultValue(e.Double),r=0;n=Bridge.getEnumerator(t);try{for(;n.moveNext();){var o=n.Current;i?(i=!1,a=o):(s[e.Array.index(r,s)]=Math.abs(o-a),r=r+1|0,a=o)}}finally{Bridge.is(n,e.IDisposable)&&n.System$IDisposable$Dispose()}return s},GetTopGroupByCount:function(n,s){var i,a=e.Linq.Enumerable.from(n).orderBy(t.$.Kusto.Charting.DataChartsHelper.f2),r=new(e.Collections.Generic.List$1(e.Double).$ctor2)(e.Linq.Enumerable.from(n).count()),o=0,l=0,u=null;i=Bridge.getEnumerator(a);try{for(;i.moveNext();){var d=i.Current;e.Nullable.hasValue(u)?(d-e.Nullable.getValue(u)>Kusto.Charting.DataChartsHelper.c_doubleAcceptableApproximation&&(e.Linq.Enumerable.from(r).count()>o&&(o=e.Linq.Enumerable.from(r).count(),l=Bridge.Math.round(e.Linq.Enumerable.from(r).average(),Kusto.Charting.DataChartsHelper.c_decimalRoundingPrecision,6)),r.clear()),r.add(d),u=d):(u=d,r.add(d))}}finally{Bridge.is(i,e.IDisposable)&&i.System$IDisposable$Dispose()}return{Item1:l,Item2:o}},GetDistance:function(t,n,s){if(null==t||null==n)return-1;var i=-1;switch(s){case Kusto.Charting.ArgumentColumnType.DateTime:i=e.Int64.toNumber(e.DateTime.getTicks(n.ArgumentDateTime).sub(e.DateTime.getTicks(t.ArgumentDateTime)));break;case Kusto.Charting.ArgumentColumnType.Numeric:i=n.ArgumentNumeric-t.ArgumentNumeric}return Bridge.Math.round(Math.abs(i),Kusto.Charting.DataChartsHelper.c_decimalRoundingPrecision,6)},ResolvePredefinedColumnsIndexes:function(t,n,s,i,a,r,o,l,u){for(var d=null,m=t.Kusto$Charting$IChartingDataSource$GetSchema(),c=0;c<e.Linq.Enumerable.from(m).count();c=c+1|0){var p=e.Linq.Enumerable.from(m).elementAt(c),S=p.Item1;if(e.Linq.Enumerable.from(n).any()&&e.Linq.Enumerable.from(n).contains(S))s.add(c);else{var g=e.Linq.Enumerable.from(i).any()&&e.Linq.Enumerable.from(i).contains(S),h=!e.String.isNullOrWhiteSpace(r)&&Bridge.referenceEquals(r,S);if(g||h){var I=p.Item2,K=!1;if(e.Enum.hasFlag(Kusto.Charting.ArgumentColumnType.StringOrObject,Bridge.box(I,Kusto.Charting.ArgumentColumnType,e.Enum.toStringFn(Kusto.Charting.ArgumentColumnType)))){var f=Bridge.toString(t.Kusto$Charting$IChartingDataSource$GetValue(0,c)),T=Kusto.Charting.DataChartsHelper.ResolveJsonArrayType(f);T!==Kusto.Charting.ArgumentColumnType.None&&(I=T,K=!0)}if(e.Nullable.hasValue(d)){if(e.Nullable.getValue(d)!==K)throw new Kusto.Charting.SeriesCreationException("Y-Axes and X-Axis both should be defined as scalars or as series")}else d=K;if(h){if(!e.Enum.hasFlag(l,Bridge.box(I,Kusto.Charting.ArgumentColumnType,e.Enum.toStringFn(Kusto.Charting.ArgumentColumnType))))throw new Kusto.Charting.SeriesCreationException(e.String.format("Type of column {0}, provided as X-Axis, does not match required by chart type",[S]));o.v=c}else if(g){if(!e.Enum.hasFlag(Kusto.Charting.ArgumentColumnType.NumericOrDateTimeOrTimeSpan,Bridge.box(I,Kusto.Charting.ArgumentColumnType,e.Enum.toStringFn(Kusto.Charting.ArgumentColumnType))))throw new Kusto.Charting.SeriesCreationException(e.String.format("Column {0}, provided as Y-Axis, sould be one of types: Numeric, DateTime, Timespan",[S]));a.add(c)}}}}if(u.v=!!e.Nullable.hasValue(d)&&e.Nullable.getValue(d),!e.Linq.Enumerable.from(a).any()&&e.Linq.Enumerable.from(i).any())throw new Kusto.Charting.SeriesCreationException("Any of columns defined as Y-Axes were not found in data, not of an appropriate type or used as argument or series");if(!e.String.isNullOrWhiteSpace(r)&&o.v<0)throw new Kusto.Charting.SeriesCreationException(e.String.format("Column {0}, provided as X-Axis, was not found in data",[r]));if(e.Linq.Enumerable.from(n).any()&&!e.Linq.Enumerable.from(s).any())throw new Kusto.Charting.SeriesCreationException("Any of columns, provided as Series, were not found in data")},ResolveDataSeriesFromDataRow:function(t,n,s,i,a,r,o,l,u,d,m){var c,p,S,g=n.Kusto$Charting$IChartingDataSource$GetSchema(),h="";if(e.Linq.Enumerable.from(d).any()){var I=new e.Text.StringBuilder;c=Bridge.getEnumerator(d);try{for(;c.moveNext();){var K=c.Current,f=e.Linq.Enumerable.from(g).elementAt(K);0<I.getLength()&&I.append(", "),I.appendFormat("{0}:{1}",f.Item1,Bridge.toString(n.Kusto$Charting$IChartingDataSource$GetValue(a,K)))}}finally{Bridge.is(c,e.IDisposable)&&c.System$IDisposable$Dispose()}h=I.toString()}for(var T=n.Kusto$Charting$IChartingDataSource$GetValue(a,u),y=Kusto.Charting.DataChartsHelper.ResolveJsonArrayType(Bridge.toString(T)),C=0;C<e.Linq.Enumerable.from(g).count();C=C+1|0)if(!(C===u||e.Linq.Enumerable.from(m).any()&&!e.Linq.Enumerable.from(m).contains(C)||d.contains(C))){var R=e.Linq.Enumerable.from(g).elementAt(C),x=n.Kusto$Charting$IChartingDataSource$GetValue(a,C);if(e.Enum.hasFlag(Kusto.Charting.ArgumentColumnType.StringOrObject,Bridge.box(R.Item2,Kusto.Charting.ArgumentColumnType,e.Enum.toStringFn(Kusto.Charting.ArgumentColumnType)))){var D=null!=(p=Bridge.as(x,e.String))?p:Bridge.toString(x),b=Kusto.Charting.DataChartsHelper.ResolveJsonArrayType(D);if(b===Kusto.Charting.ArgumentColumnType.None)continue;if(e.Enum.hasFlag(Kusto.Charting.ArgumentColumnType.NumericOrDateTimeOrTimeSpan,Bridge.box(b,Kusto.Charting.ArgumentColumnType,e.Enum.toStringFn(Kusto.Charting.ArgumentColumnType)))){var w=Kusto.Charting.DataChartsHelper.ParseJsonArrayAsDouble(D,!0);if(null==w||0===e.Linq.Enumerable.from(D).count())continue;for(var v=e.String.isNullOrEmpty(h)?R.Item1:(h||"")+":"+(R.Item1||""),P=0,A=Kusto.Charting.DataChartsHelper.GetArgumentDateTimeArray(T,y,u,e.Linq.Enumerable.from(w).count()),_=Kusto.Charting.DataChartsHelper.GetArgumentNumericArray(T,y,u,e.Linq.Enumerable.from(w).count()),E=Kusto.Charting.DataChartsHelper.GetArgumentStringArray(T,y,u,e.Linq.Enumerable.from(w).count()),O=0;O<e.Linq.Enumerable.from(w).count();O=O+1|0){var k="";e.Enum.hasFlag(Kusto.Charting.ArgumentColumnType.DateTimeOrTimeSpan,Bridge.box(r,Kusto.Charting.ArgumentColumnType,e.Enum.toStringFn(Kusto.Charting.ArgumentColumnType)))&&e.Enum.hasFlag(Kusto.Charting.ArgumentColumnType.DateTimeOrTimeSpan,Bridge.box(y,Kusto.Charting.ArgumentColumnType,e.Enum.toStringFn(Kusto.Charting.ArgumentColumnType)))?k=e.DateTime.format(A[e.Array.index(O,A)]):e.Enum.hasFlag(r,Bridge.box(Kusto.Charting.ArgumentColumnType.Numeric,Kusto.Charting.ArgumentColumnType,e.Enum.toStringFn(Kusto.Charting.ArgumentColumnType)))&&y===Kusto.Charting.ArgumentColumnType.Numeric?k=e.Double.format(_[e.Array.index(O,_)]):e.Enum.hasFlag(r,Bridge.box(Kusto.Charting.ArgumentColumnType.String,Kusto.Charting.ArgumentColumnType,e.Enum.toStringFn(Kusto.Charting.ArgumentColumnType)))&&(k=E[e.Array.index(O,E)],e.String.isNullOrEmpty(k)&&(k=Bridge.as(T,e.String)));var N=((S=new Kusto.Charting.DataItem).ArgumentData=k,S.ArgumentDateTime=A[e.Array.index(O,A)],S.ArgumentNumeric=_[e.Array.index(O,_)],S.ValueData=l?w[e.Array.index(O,w)]+P:w[e.Array.index(O,w)],S.ValueName=R.Item1,S.SeriesName=v,S);e.String.isNullOrEmpty(N.ArgumentData)&&(N.ArgumentData="<empty>"),t.add(N),P=N.ValueData}}}}},GetArgumentStringArray:function(t,n,s,i){if(!e.Enum.hasFlag(n,Bridge.box(Kusto.Charting.ArgumentColumnType.String,Kusto.Charting.ArgumentColumnType,e.Enum.toStringFn(Kusto.Charting.ArgumentColumnType)))||s<0)return e.Array.init(i,null,e.String);var a=Kusto.Charting.DataChartsHelper.ParseJsonArrayAsString(Bridge.toString(t));return null==a?e.Array.init(i,null,e.String):a},GetArgumentNumericArray:function(t,n,s,i){if(n!==Kusto.Charting.ArgumentColumnType.Numeric||s<0)return e.Linq.Enumerable.repeat(Kusto.Charting.DataChartsHelper.c_defaultArgumentNumeric,i).ToArray(e.Double);var a=Kusto.Charting.DataChartsHelper.ParseJsonArrayAsDouble(Bridge.toString(t));return null==a?e.Linq.Enumerable.repeat(Kusto.Charting.DataChartsHelper.c_defaultArgumentNumeric,i).ToArray(e.Double):a},GetArgumentDateTimeArray:function(t,n,s,i){if(!e.Enum.hasFlag(Kusto.Charting.ArgumentColumnType.DateTimeOrTimeSpan,Bridge.box(n,Kusto.Charting.ArgumentColumnType,e.Enum.toStringFn(Kusto.Charting.ArgumentColumnType)))||s<0)return e.Linq.Enumerable.repeat(Kusto.Charting.DataChartsHelper.c_defaultArgumentDatetime,i).ToArray(e.DateTime);var a=Kusto.Charting.DataChartsHelper.ParseJsonArrayAsDateTime(Bridge.toString(t));return null==a?e.Linq.Enumerable.repeat(Kusto.Charting.DataChartsHelper.c_defaultArgumentDatetime,i).ToArray(e.DateTime):a},ResolveDataItemsFromDataRow:function(t,n,s,i,a,r,o,l,u,d,m){var c,p,S=n.Kusto$Charting$IChartingDataSource$GetSchema(),g="";if(e.Linq.Enumerable.from(d).any()){var h=new e.Text.StringBuilder;c=Bridge.getEnumerator(d);try{for(;c.moveNext();){var I=c.Current,K=e.Linq.Enumerable.from(S).elementAt(I);0<h.getLength()&&h.append(", "),h.appendFormat("{0}:{1}",K.Item1,Bridge.toString(n.Kusto$Charting$IChartingDataSource$GetValue(a,I)))}}finally{Bridge.is(c,e.IDisposable)&&c.System$IDisposable$Dispose()}g=h.toString()}for(var f=n.Kusto$Charting$IChartingDataSource$GetValue(a,u),T=null==f?r:e.Linq.Enumerable.from(S).elementAt(u).Item2,y=0;y<e.Linq.Enumerable.from(S).count();y=y+1|0)if(!(y===u||e.Linq.Enumerable.from(m).any()&&!e.Linq.Enumerable.from(m).contains(y)||d.contains(y))){var C=e.Linq.Enumerable.from(S).elementAt(y);if(e.Enum.hasFlag(Kusto.Charting.ArgumentColumnType.NumericOrDateTimeOrTimeSpan,Bridge.box(C.Item2,Kusto.Charting.ArgumentColumnType,e.Enum.toStringFn(Kusto.Charting.ArgumentColumnType)))){var R=n.Kusto$Charting$IChartingDataSource$GetValue(a,y),x=Kusto.Charting.DataChartsHelper.TryConvertToDouble(R,C.Item2);if(null==x)continue;var D=e.Nullable.getValue(x),b=e.String.isNullOrEmpty(g)?C.Item1:(g||"")+":"+(C.Item1||""),w={},v=Kusto.Charting.DataChartsHelper.GetArgumentDateTime(f,T),P=Kusto.Charting.DataChartsHelper.GetArgumentNumeric(f,T,u,b,i),A=((p=new Kusto.Charting.DataItem).ArgumentData=0<=u?Bridge.toString(f):"",p.ArgumentDateTime=v,p.ArgumentNumeric=P,p.ValueData=l&&s.tryGetValue(b,w)?D+w.v:D,p.ValueName=C.Item1,p.SeriesName=b,p);e.String.isNullOrEmpty(A.ArgumentData)&&(A.ArgumentData="<empty>"),t.add(A),s.set(A.SeriesName,A.ValueData)}}},GetArgumentDateTime:function(t,n){return e.Enum.hasFlag(n,Bridge.box(Kusto.Charting.ArgumentColumnType.DateTime,Kusto.Charting.ArgumentColumnType,e.Enum.toStringFn(Kusto.Charting.ArgumentColumnType)))||e.Enum.hasFlag(n,Bridge.box(Kusto.Charting.ArgumentColumnType.TimeSpan,Kusto.Charting.ArgumentColumnType,e.Enum.toStringFn(Kusto.Charting.ArgumentColumnType)))?Bridge.is(t,e.DateTime)?e.Nullable.getValue(Bridge.cast(Bridge.unbox(t),e.DateTime)):Bridge.is(t,e.TimeSpan)?e.DateTime.create$2(e.Nullable.getValue(Bridge.cast(Bridge.unbox(t),e.TimeSpan)).getTicks()):Kusto.Charting.DataChartsHelper.c_defaultArgumentDatetime:Kusto.Charting.DataChartsHelper.c_defaultArgumentDatetime},GetArgumentNumeric:function(t,n,s,i,a){return!e.Enum.hasFlag(n,Bridge.box(Kusto.Charting.ArgumentColumnType.Numeric,Kusto.Charting.ArgumentColumnType,e.Enum.toStringFn(Kusto.Charting.ArgumentColumnType)))||Kusto.Charting.DataChartsHelper.CheckIfDBNull(t)?Kusto.Charting.DataChartsHelper.c_defaultArgumentNumeric:s<0?(a.containsKey(i)||a.set(i,0),a.set(i,a.get(i)+1),a.get(i)):Kusto.Charting.DataChartsHelper.ConvertToDouble(t,n)},ConvertToDouble:function(t,n){var s=Kusto.Charting.DataChartsHelper.c_defaultArgumentNumeric;if(n===Kusto.Charting.ArgumentColumnType.DateTime)s=Kusto.Charting.DataChartsHelper.DateTimeToTotalSeconds(e.Nullable.getValue(Bridge.cast(Bridge.unbox(t),e.DateTime)));else if(n===Kusto.Charting.ArgumentColumnType.TimeSpan)s=Kusto.Charting.DataChartsHelper.TimeSpanToTotalSeconds(e.Nullable.getValue(Bridge.cast(Bridge.unbox(t),e.TimeSpan)));else try{s=e.Convert.toDouble(t)}catch(t){t=e.Exception.create(t),s=Kusto.Charting.DataChartsHelper.c_defaultArgumentNumeric}return s},TryConvertToDouble:function(e,t){return null==e||Kusto.Charting.DataChartsHelper.CheckIfDBNull(e)?Kusto.Charting.DataChartsHelper.c_defaultArgumentNumeric:Kusto.Charting.DataChartsHelper.ConvertToDouble(e,t)},DetectChartDimensionsUsingData:function(t,n,s,i,a,r,o,l){var u,d=e.Array.init(e.Linq.Enumerable.from(t).count(),0,Kusto.Charting.ArgumentColumnType);if(0===n.Kusto$Charting$IChartingDataSource$RowsCount)return!1;for(var m=-1,c=0;c<e.Linq.Enumerable.from(t).count();c=c+1|0){var p=e.Linq.Enumerable.from(t).elementAt(c);if(d[e.Array.index(c,d)]=p.Item2,null==l||!l.contains(c)){var S=n.Kusto$Charting$IChartingDataSource$GetValue(0,c);if(p.Item2===Kusto.Charting.ArgumentColumnType.String||p.Item2===Kusto.Charting.ArgumentColumnType.Object){var g=null!=(u=Bridge.as(S,e.String))?u:Bridge.toString(S),h=Kusto.Charting.DataChartsHelper.ResolveJsonArrayType(g);if(h===Kusto.Charting.ArgumentColumnType.None){(null==s||!e.Linq.Enumerable.from(s).any())&&r.v<0&&o.add(c);continue}d[e.Array.index(c,d)]=h,e.Enum.hasFlag(i,Bridge.box(h,Kusto.Charting.ArgumentColumnType,e.Enum.toStringFn(Kusto.Charting.ArgumentColumnType)))&&r.v<0?r.v=c:h===Kusto.Charting.ArgumentColumnType.Numeric&&m<0&&(m=c)}}}return Kusto.Charting.DataChartsHelper.CompleteChartDimentionsDetection(t,i,a,r,o,m,d,l)},DetectChartDimensionsUsingColumnTypes:function(n,s,i,a,r,o){for(var l=-1,u=0;u<e.Linq.Enumerable.from(n).count();u=u+1|0)if(!(null!=o&&o.contains(u)||null!=r&&r.contains(u))){var d=e.Linq.Enumerable.from(n).elementAt(u);if(e.Enum.hasFlag(s,Bridge.box(d.Item2,Kusto.Charting.ArgumentColumnType,e.Enum.toStringFn(Kusto.Charting.ArgumentColumnType)))&&a.v<0)a.v=u;else if(d.Item2===Kusto.Charting.ArgumentColumnType.Numeric){l=u;break}}var m=e.Linq.Enumerable.from(n).select(t.$.Kusto.Charting.DataChartsHelper.f9).ToArray(Kusto.Charting.ArgumentColumnType);return Kusto.Charting.DataChartsHelper.CompleteChartDimentionsDetection(n,s,i,a,r,l,m,o)},CompleteChartDimentionsDetection:function(t,n,s,i,a,r,o,l){if(0<=i.v&&e.Linq.Enumerable.from(a).any())return!0;if(i.v<0&&r<0&&e.Enum.hasFlag(n,Bridge.box(Kusto.Charting.ArgumentColumnType.Numeric,Kusto.Charting.ArgumentColumnType,e.Enum.toStringFn(Kusto.Charting.ArgumentColumnType))))return!1;if(i.v<0){if(e.Enum.hasFlag(Kusto.Charting.ArgumentColumnType.DateTimeOrTimeSpan,Bridge.box(n,Kusto.Charting.ArgumentColumnType,e.Enum.toStringFn(Kusto.Charting.ArgumentColumnType))))return!1;e.Enum.hasFlag(n,Bridge.box(Kusto.Charting.ArgumentColumnType.Numeric,Kusto.Charting.ArgumentColumnType,e.Enum.toStringFn(Kusto.Charting.ArgumentColumnType)))?1<e.Linq.Enumerable.from(t).count()&&(i.v=r):e.Enum.hasFlag(s,Bridge.box(Kusto.Charting.ArgumentRestrictions.NotIncludedInSeries,Kusto.Charting.ArgumentRestrictions,e.Enum.toStringFn(Kusto.Charting.ArgumentRestrictions)))?i.v=Kusto.Charting.DataChartsHelper.GoBackwardsAndFindColumnNotInList(r,a,l):i.v=r-1|0}if(i.v<0&&e.Enum.hasFlag(s,Bridge.box(Kusto.Charting.ArgumentRestrictions.MustHave,Kusto.Charting.ArgumentRestrictions,e.Enum.toStringFn(Kusto.Charting.ArgumentRestrictions)))&&(i.v=0),!e.Linq.Enumerable.from(a).any()&&0<=i.v){var u=i.v;o[e.Array.index(i.v,o)]!==Kusto.Charting.ArgumentColumnType.String?u=Kusto.Charting.DataChartsHelper.GetFirstStringColumnIndex(o):e.Enum.hasFlag(s,Bridge.box(Kusto.Charting.ArgumentRestrictions.NotIncludedInSeries,Kusto.Charting.ArgumentRestrictions,e.Enum.toStringFn(Kusto.Charting.ArgumentRestrictions)))&&(u=i.v-1|0),0<=u&&!l.contains(u)&&a.add(u)}return!0},GoBackwardsAndFindColumnNotInList:function(e,t,n){for(var s=e-1|0;0<=s;s=s-1|0){var i=null==t||!t.contains(s),a=null==n||!n.contains(s);if(i&&a)return s}return-1},GetFirstStringColumnIndex:function(t){for(var n=0;n<e.Linq.Enumerable.from(t).count();n=n+1|0)if(e.Linq.Enumerable.from(t).elementAt(n)===Kusto.Charting.ArgumentColumnType.String)return n;return-1},TimeSpanToTotalSeconds:function(e){return e.getTotalSeconds()},DateTimeToTotalSeconds:function(t){return e.TimeSpan.fromTicks(e.DateTime.getTicks(t)).getTotalSeconds()},ParseJsonArrayAsDateTime:function(t){if(e.String.isNullOrWhiteSpace(t)||!e.String.startsWith(t.trim(),"["))return null;try{return Newtonsoft.Json.JsonConvert.DeserializeObject(t,e.Array.type(e.DateTime))}catch(t){t=e.Exception.create(t)}return null},ParseJsonArrayAsDouble:function(t,n){if(void 0===n&&(n=!1),e.String.isNullOrWhiteSpace(t)||!e.String.startsWith(t.trim(),"["))return null;var s,i;try{i=Newtonsoft.Json.JsonConvert.DeserializeObject(t,e.Array.type(e.String)),s=e.Array.init(e.Linq.Enumerable.from(i).count(),0,e.Double)}catch(t){return t=e.Exception.create(t),null}for(var a=Kusto.Charting.ArgumentColumnType.None,r={},o=0;o<e.Linq.Enumerable.from(i).count();o=o+1|0){var l=i[e.Array.index(o,i)];if(null!=l){if(!e.Enum.hasFlag(Kusto.Charting.ArgumentColumnType.Numeric,Bridge.box(a,Kusto.Charting.ArgumentColumnType,e.Enum.toStringFn(Kusto.Charting.ArgumentColumnType)))||!e.Double.tryParse(l,null,r)){if(n){var u={};if(e.Enum.hasFlag(Kusto.Charting.ArgumentColumnType.TimeSpan,Bridge.box(a,Kusto.Charting.ArgumentColumnType,e.Enum.toStringFn(Kusto.Charting.ArgumentColumnType)))&&e.TimeSpan.tryParse(l,null,u)){a===Kusto.Charting.ArgumentColumnType.None&&(a=Kusto.Charting.ArgumentColumnType.TimeSpan),s[e.Array.index(o,s)]=u.v.getTotalSeconds();continue}var d={};if(e.Enum.hasFlag(Kusto.Charting.ArgumentColumnType.DateTime,Bridge.box(a,Kusto.Charting.ArgumentColumnType,e.Enum.toStringFn(Kusto.Charting.ArgumentColumnType)))&&e.DateTime.tryParse(l,null,d)){a===Kusto.Charting.ArgumentColumnType.None&&(a=Kusto.Charting.ArgumentColumnType.DateTime),s[e.Array.index(o,s)]=e.TimeSpan.fromTicks(e.DateTime.getTicks(d.v)).getTotalSeconds();continue}}return null}a===Kusto.Charting.ArgumentColumnType.None&&(a=Kusto.Charting.ArgumentColumnType.Numeric),s[e.Array.index(o,s)]=r.v}else s[e.Array.index(o,s)]=Number.NaN}return a!==Kusto.Charting.ArgumentColumnType.None?s:null},ParseJsonArrayAsString:function(t){if(e.String.isNullOrWhiteSpace(t)||!e.String.startsWith(t.trim(),"["))return null;try{return Newtonsoft.Json.JsonConvert.DeserializeObject(t,e.Array.type(e.String))}catch(t){t=e.Exception.create(t)}return null},ArrayIsTimespan:function(t){var n,s=!1,i={};n=Bridge.getEnumerator(t);try{for(;n.moveNext();){var a=n.Current;if(null!=a){if(!e.TimeSpan.tryParse(a,null,i))return!1;s=!0}}}finally{Bridge.is(n,e.IDisposable)&&n.System$IDisposable$Dispose()}return s},ArrayIsDatetime:function(t){var n,s=!1,i={};n=Bridge.getEnumerator(t);try{for(;n.moveNext();){var a=n.Current;if(null!=a){if(!e.DateTime.tryParse(a,null,i))return!1;s=!0}}}finally{Bridge.is(n,e.IDisposable)&&n.System$IDisposable$Dispose()}return s},ArrayIsDouble:function(t){var n,s=!1,i={};n=Bridge.getEnumerator(t);try{for(;n.moveNext();){var a=n.Current;if(null!=a){if(!e.Double.tryParse(a,null,i))return!1;s=!0}}}finally{Bridge.is(n,e.IDisposable)&&n.System$IDisposable$Dispose()}return s},CheckIfDBNull:function(e){return null!=e&&Bridge.referenceEquals(Bridge.toString(e),"")}}}}),Bridge.ns("Kusto.Charting.DataChartsHelper",t.$),Bridge.apply(t.$.Kusto.Charting.DataChartsHelper,{f1:function(e){return e.SeriesName},f2:function(e){return e},f3:function(t){return e.DateTime.getTicks(t.ArgumentDateTime)},f4:function(t){return e.Convert.toDouble(e.DateTime.getTicks(t.ArgumentDateTime))},f5:function(e){return e.ArgumentNumeric},f6:function(e){return!Bridge.equals(e.ArgumentDateTime,Kusto.Charting.DataChartsHelper.c_defaultArgumentDatetime)},f7:function(e){return!isNaN(e.ArgumentNumeric)},f8:function(e){return Math.abs(e.ValueData)===Number.POSITIVE_INFINITY},f9:function(e){return e.Item2}}),Bridge.define("Kusto.Charting.DataItem",{props:{SeriesName:null,ArgumentData:null,ValueData:0,ValueName:null,ArgumentDateTime:null,ArgumentNumeric:0,SecondaryAxisYName:null,PrefferredChartKind:0},ctors:{init:function(){this.ArgumentDateTime=e.DateTime.getDefaultValue()}},methods:{Clone:function(){var e;return(e=new Kusto.Charting.DataItem).SeriesName=this.SeriesName,e.ArgumentData=this.ArgumentData,e.ValueData=this.ValueData,e.ValueName=this.ValueName,e.ArgumentDateTime=this.ArgumentDateTime,e.ArgumentNumeric=this.ArgumentNumeric,e.SecondaryAxisYName=this.SecondaryAxisYName,e.PrefferredChartKind=this.PrefferredChartKind,e}}}),Bridge.define("Kusto.Charting.ExtendedDouble",{statics:{methods:{IsFinite:function(e){return!(Math.abs(e)===Number.POSITIVE_INFINITY||isNaN(e))}}}}),Bridge.define("Kusto.Charting.IChartingDataSource",{$kind:"interface"}),Bridge.define("Kusto.Charting.IKustoClientContext",{$kind:"interface"}),Bridge.define("Kusto.Charting.SeriesCreationException",{inherits:[e.Exception],ctors:{ctor:function(t){this.$initialize(),e.Exception.ctor.call(this,t)}}}),Bridge.define("Kusto.Charting.ValidationStatus",{$kind:"enum",statics:{fields:{Valid:0,PolicyViolationError:1,PolicyViolationWarning:2}}}),Bridge.define("Kusto.Cloud.Platform.Text.StringLiteral",{statics:{methods:{ParseStringLiteral:function(t){var n={};if(Kusto.Cloud.Platform.Text.StringLiteral.TryParseStringLiteral(t,n))return n.v;throw new e.ArgumentException.$ctor1(e.String.format("Malformed string literal: '{0}'",[t]))},TryParseStringLiteral:function(t,n){if(n.v=t,e.String.isNullOrWhiteSpace(n.v))return!1;if(104!==n.v.charCodeAt(0)&&72!==n.v.charCodeAt(0)||(n.v=n.v.substr(1)),e.String.startsWith(n.v,'"')){if(2<=n.v.length&&e.String.endsWith(n.v,'"'))return n.v=n.v.substr(1,n.v.length-2|0),!!Kusto.Cloud.Platform.Utils.ExtendedRegex.TryUnescape(n.v,n)}else if(e.String.startsWith(n.v,"'")){if(2<=n.v.length&&e.String.endsWith(n.v,"'"))return n.v=n.v.substr(1,n.v.length-2|0),!!Kusto.Cloud.Platform.Utils.ExtendedRegex.TryUnescape(n.v,n)}else if(e.String.startsWith(n.v,'@"')){if(3<=n.v.length&&e.String.endsWith(n.v,'"')){var s=n.v.substr(2,n.v.length-3|0);return n.v=e.String.replaceAll(s,'""','"'),!0}}else if(e.String.startsWith(n.v,"@'")&&3<=n.v.length&&e.String.endsWith(n.v,"'")){var i=n.v.substr(2,n.v.length-3|0);return n.v=e.String.replaceAll(i,"''","'"),!0}return!1},IsStringLiteral:function(t){if(e.String.isNullOrWhiteSpace(t))return!1;var n=t.charCodeAt(0);return 34===n||39===n||64===n},Equals:function(t,n){return null==t&&null==n||null!=t&&null!=n&&e.String.equals(t,n,4)},TrimSingleQuotes:function(t){return e.String.isNullOrWhiteSpace(t)||e.String.startsWith(t,"'")&&e.String.endsWith(t,"'")&&2<=t.length&&(t=t.substr(1,t.length-2|0)),t},TrimBrackets:function(t){return e.String.startsWith(t,"[")&&e.String.endsWith(t,"]")&&2<=t.length&&(t=t.substr(1,t.length-2|0)),t},InitArray:function(t,n,s){if(null!=n)for(var i=0;i<n.length;i=i+1|0)n[e.Array.index(i,n)]=s}}}}),Bridge.define("Kusto.Cloud.Platform.Utils.BitTwiddling",{statics:{methods:{CountBits:function(e){for(var t=0;0!==e;)e&=e-1|0,t=t+1|0;return t},CountBits$1:function(t){for(var n=0;t.ne(e.Int64(0));)t=t.and(t.sub(e.Int64(1))),n=n+1|0;return n}}}}),Bridge.define("Kusto.Cloud.Platform.Utils.ChopOptions",{$kind:"enum",statics:{fields:{ChopFromBeginning:1,ChopFromEnd:2,ChopFromMiddle:4,ThreeDotsCharacterNotSupported:8}}}),Bridge.define("Kusto.Cloud.Platform.Utils.ExtendedEnumerable",{statics:{methods:{SafeShallowClone:function(t,n){return null==n?null:new(e.Collections.Generic.List$1(t).$ctor1)(n)},IndexOf:function(t,n,s){var i;if(Bridge.staticEquals(s,null))return-1;if(null==n)return-1;var a=0;i=Bridge.getEnumerator(n,t);try{for(;i.moveNext();){if(s(i.Current))return a;a=a+1|0}}finally{Bridge.is(i,e.IDisposable)&&i.System$IDisposable$Dispose()}return-1},SafeConcat:function(t,n,s){return null==n?s:null==s?n:e.Linq.Enumerable.from(n).concat(s)},SafeUnion:function(t,n,s){return null==n&&null==s?null:null==n?e.Linq.Enumerable.from(s).distinct():null==s?e.Linq.Enumerable.from(n).distinct():e.Linq.Enumerable.from(n).union(s)},SafeFastNullIfEmpty:function(e,t){return null==t||Kusto.Cloud.Platform.Utils.ExtendedEnumerable.SafeFastNone(t)?null:t},SafeEmptyIEnumerableIfNull:function(t,n){return n||e.Linq.Enumerable.empty()},SafeFastAny$4:function(t,n){if(null==n)return!1;var s=Bridge.as(n,e.Collections.Generic.ICollection$1(t));if(null!=s)return 0!==e.Array.getCount(s,t);var i=Bridge.as(n,e.Collections.ICollection);return null!=i?0!==e.Array.getCount(i):e.Linq.Enumerable.from(n).any()},SafeFastAny$3:function(t,n){return null!=n&&0<e.Array.getCount(n,t)},SafeFastAny$6:function(e,t){return null!=t&&0<t.Count},SafeFastAny$2:function(e,t){return null!=t&&0<t.Count},SafeFastAny$7:function(e,t,n){return null!=n&&0<n.count},SafeFastAny$1:function(e,t){return null!=t&&0<t.length},SafeFastAny:function(t){var n;if(null==t)return!1;var s=Bridge.as(t,e.Collections.ICollection);if(null!=s)return 0!==e.Array.getCount(s);var i=Bridge.getEnumerator(t);n=Bridge.as(i,e.IDisposable);try{if(i.System$Collections$IEnumerator$moveNext())return!0}finally{Bridge.hasValue(n)&&n.System$IDisposable$Dispose()}return!1},SafeFastAny$5:function(t,n,s){return!Kusto.Cloud.Platform.Utils.ExtendedEnumerable.SafeFastNone$1(t,n)&&e.Linq.Enumerable.from(n).any(s)},SafeFastContains:function(t,n,s,i){return void 0===i&&(i=null),!Kusto.Cloud.Platform.Utils.ExtendedEnumerable.SafeFastNone$1(t,n)&&e.Linq.Enumerable.from(n).contains(s,i)},SafeFastNone$1:function(e,t){return!Kusto.Cloud.Platform.Utils.ExtendedEnumerable.SafeFastAny$4(e,t)},SafeFastNone:function(e){return!Kusto.Cloud.Platform.Utils.ExtendedEnumerable.SafeFastAny(e)},None$1:function(t,n,s){return!e.Linq.Enumerable.from(n).any(s)},None:function(e,t){return Kusto.Cloud.Platform.Utils.ExtendedEnumerable.SafeFastNone$1(e,t)},DistinctBy:function(n,s,i,a){return e.Linq.Enumerable.from(i).groupBy(a).select(t.$.Kusto.Cloud.Platform.Utils.ExtendedEnumerable.f1)},Intersect:function(t,n){if(Kusto.Cloud.Platform.Utils.ExtendedEnumerable.SafeFastNone$1(Bridge.global.System.Collections.Generic.IEnumerable$1(t),n))return null;var s=Bridge.getEnumerator(n,e.Collections.Generic.IEnumerable$1(t));if(s.System$Collections$IEnumerator$moveNext()){for(var i=new(e.Collections.Generic.HashSet$1(t).$ctor1)(s[Bridge.geti(s,"System$Collections$Generic$IEnumerator$1$System$Collections$Generic$IEnumerable$1$"+Bridge.getTypeAlias(t)+"$Current$1","System$Collections$Generic$IEnumerator$1$Current$1")]);s.System$Collections$IEnumerator$moveNext();)i.intersectWith(s[Bridge.geti(s,"System$Collections$Generic$IEnumerator$1$System$Collections$Generic$IEnumerable$1$"+Bridge.getTypeAlias(t)+"$Current$1","System$Collections$Generic$IEnumerator$1$Current$1")]);return i}return null},IntersectWith:function(t,n,s){if(Kusto.Cloud.Platform.Utils.ExtendedEnumerable.SafeFastNone$1(t,n))return s;if(Kusto.Cloud.Platform.Utils.ExtendedEnumerable.SafeFastNone$1(t,s))return n;var i=new(e.Collections.Generic.HashSet$1(t).$ctor1)(n);return i.intersectWith(s),i}}}}),Bridge.ns("Kusto.Cloud.Platform.Utils.ExtendedEnumerable",t.$),Bridge.apply(t.$.Kusto.Cloud.Platform.Utils.ExtendedEnumerable,{f1:function(e){return e.first()}}),Bridge.define("Kusto.Cloud.Platform.Utils.ExtendedRegex",{statics:{methods:{TryUnescape:function(t,n){n.v="";try{return n.v=e.Text.RegularExpressions.Regex.unescape(t),!0}catch(t){if(t=e.Exception.create(t),Bridge.is(t,e.ArgumentException))return!1;throw t}},TryTransformWildCardPatternToRegex:function(t){try{var n=e.String.trim(t,[91,93]),s=e.String.replaceAll(n,"*",".*");return new e.Text.RegularExpressions.Regex.ctor(s,0)}catch(t){return t=e.Exception.create(t),null}},IsWildCardPattern:function(t){return 0<=e.String.indexOf(t,String.fromCharCode(42))}}}}),Bridge.define("Kusto.Cloud.Platform.Utils.ExtendedString",{statics:{fields:{c_newlineAsStringArray:null,c_postfix:null,c_wrap:null,c_nullGuids:null,SafeToString:null,EmptyArray:null},ctors:{init:function(){this.c_newlineAsStringArray=e.Array.init(["\n"],e.String),this.c_postfix="...",this.c_wrap=" ",this.c_nullGuids=e.Array.init([e.Guid.Empty.toString(),"{"+(e.Guid.Empty.toString()||"")+"}"],e.String),this.SafeToString=t.$.Kusto.Cloud.Platform.Utils.ExtendedString.f1,this.EmptyArray=e.Array.init(0,null,e.String)}},methods:{SafeGetHashCode:function(e){return null==e?20080512:Bridge.getHashCode(e)},GuidSafeFastGetHashCode:function(e){return null==e||e.length<26?Kusto.Cloud.Platform.Utils.ExtendedString.SafeGetHashCode(e):(e.charCodeAt(1)^e.charCodeAt(9)<<8|e.charCodeAt(10))^(e.charCodeAt(16)<<16|e.charCodeAt(17))^(e.charCodeAt(24)<<24|e.charCodeAt(25))},SafeFormat:function(t,n){if(void 0===n&&(n=[]),null==t)return"[format:null]";if(null==n||0===n.length)return e.String.format.apply(e.String,[t].concat(n));for(var s=e.Array.init(n.length,null,e.String),i=0;i<n.length;i=i+1|0){var a,r=n[e.Array.index(i,n)];if(null==r)a="[null]";else{var o=Bridge.toString(r);a=null==o?"[ToStringNull]":0===o.length?"[ToStringEmpty]":e.String.isNullOrWhiteSpace(o)?"[ToStringWhitespace]":o}s[e.Array.index(i,s)]=a}return e.String.format.apply(e.String,[t].concat(s))},FormatWithCurrentCulture:function(t,n){return void 0===n&&(n=[]),Kusto.Cloud.Platform.Utils.ExtendedString.FormatWith(t,e.Globalization.CultureInfo.getCurrentCulture(),n)},FormatWithInvariantCulture:function(t,n){return void 0===n&&(n=[]),Kusto.Cloud.Platform.Utils.ExtendedString.FormatWith(t,e.Globalization.CultureInfo.invariantCulture,n)},FormatWith:function(t,n,s){return void 0===s&&(s=[]),e.String.formatProvider.apply(e.String,[n,t].concat(s))},SafeIsNullGuid:function(t){return e.String.isNullOrWhiteSpace(t)||Bridge.referenceEquals(t,Kusto.Cloud.Platform.Utils.ExtendedString.c_nullGuids[e.Array.index(0,Kusto.Cloud.Platform.Utils.ExtendedString.c_nullGuids)])||Bridge.referenceEquals(t,Kusto.Cloud.Platform.Utils.ExtendedString.c_nullGuids[e.Array.index(1,Kusto.Cloud.Platform.Utils.ExtendedString.c_nullGuids)])},SafeFastTrim:function(t){return e.String.isNullOrEmpty(t)?t:t.trim()},TrimStart$1:function(t,n){return e.String.startsWith(t,n)?t.substr(n.length,t.length-n.length|0):t},TrimStart:function(t,n,s){if(e.String.isNullOrEmpty(t))return t;if(s)return t.charCodeAt(0)===n?t.substr(1):t;if(t.charCodeAt(0)!==n)return t;for(var i=0;i<t.length&&t.charCodeAt(i)===n;)i=i+1|0;return i===t.length?"":t.substr(i)},TrimEnd:function(t,n){return e.String.endsWith(t,n)?t.substr(0,t.length-n.length|0):t},TrimBalancedSquareBrackets:function(t){return null!=t&&e.String.startsWith(t,"[")&&e.String.endsWith(t,"]")&&(t=t.substr(1,t.length-2|0)),t},TrimBalancedRoundBrackets:function(e){return Kusto.Cloud.Platform.Utils.ExtendedString.TrimBalanced(e,"(",")")},TrimBalanced:function(t,n,s){return null!=t&&e.String.startsWith(t,n)&&e.String.endsWith(t,s)&&(t=t.substr(n.length,t.length-(n.length+s.length|0)|0)),t},TrimBalancedSingleAndDoubleQuotes:function(t){if(e.String.isNullOrEmpty(t))return t;for(var n=0,s=t.length-1|0;n<s;)if(34!==t.charCodeAt(n)||34!==t.charCodeAt(s)){if(39!==t.charCodeAt(n)||39!==t.charCodeAt(s))break;n=n+1|0,s=s-1|0}else n=n+1|0,s=s-1|0;return s<n?"":t.substr(n,1+(s-n|0)|0)},SafeCountCharacterUpTo:function(t,n,s){if(null==t)return e.Int64(-1);for(var i=0,a=0;a<t.length&&(t.charCodeAt(a)===n&&(i=i+1|0),!e.Int64(i).equals(s));a=a+1|0);return e.Int64(i)},FindFirstNonWhitespaceCharacter:function(t,n){if(void 0===n&&(n=0),null==t)return-1;for(;;){if(n>=t.length)return-1;if(!e.Char.isWhiteSpace(String.fromCharCode(t.charCodeAt(n))))return n;n=n+1|0}},FirstFirstUnequalCharacter:function(e,t){if(Bridge.referenceEquals(e,t))return-1;if(null==e||null==t||0===e.length||0===t.length)return 0;for(var n=0;n<e.length&&n<t.length;n=n+1|0)if(e.charCodeAt(n)!==t.charCodeAt(n))return n;return n},CountNonOverlappingSubstrings$1:function(t,n,s){if(void 0===s&&(s=4),e.String.isNullOrEmpty(t)||e.String.isNullOrEmpty(n))return 0;for(var i=0,a=0;a<t.length;){if((a=e.String.indexOf(t,n,a,t.length,s))<0)return i;i=i+1|0,a=a+n.length|0}return i},CountNonOverlappingSubstrings:function(t,n){if(e.String.isNullOrEmpty(t))return 0;for(var s=0,i=0;i<t.length;){if((i=e.String.indexOf(t,String.fromCharCode(n),i))<0)return s;s=s+1|0,i=i+1|0}return s},SafeStartsWith:function(t,n){return!e.String.isNullOrEmpty(t)&&t.charCodeAt(0)===n},SafeGetTail:function(e,t){return null==e?null:t<=0?"":t>=e.length?e:e.substr(e.length-t|0)},SafeIndexOf$1:function(t,n,s,i){return e.String.isNullOrEmpty(t)||e.String.isNullOrEmpty(n)||s>t.length?-1:e.String.indexOf(t,n,s,t.length,i)},SafeIndexOf:function(t,n,s,i,a){return e.String.isNullOrEmpty(t)||e.String.isNullOrEmpty(n)||(s+n.length|0)>t.length?-1:e.String.indexOf(t,n,s,i,a)},SplitFirst:function(t,n){if(null==t||e.String.isNullOrEmpty(n))return null;var s=e.String.indexOf(t,n,0,t.length,4);return s<0?t:t.substr(0,s)},Rotate:function(t){return e.String.isNullOrEmpty(t)||t.length<2?t:(t.substr(1,t.length-1|0)||"")+(t.substr(0,1)||"")}}}}),Bridge.ns("Kusto.Cloud.Platform.Utils.ExtendedString",t.$),Bridge.apply(t.$.Kusto.Cloud.Platform.Utils.ExtendedString,{f1:function(e){var t;return null!=e?null!=(t=Bridge.toString(e))?t:"[ToStringNull]":"[null]"}}),Bridge.define("Kusto.Data.Common.CslQueryParser",{statics:{methods:{PrettifyQuery:function(t,n){var s=(new Kusto.Data.IntelliSense.CslCommandParser).Parse(null,t,Kusto.Data.IntelliSense.ParseMode.CommandTokensOnly);if(1!==e.Linq.Enumerable.from(s).count())return t;var i=e.Linq.Enumerable.from(s).first().FormatAsString("\n",7);return e.String.isNullOrEmpty(i)&&(i=t),e.String.isNullOrEmpty(n)||(i=(i||"")+(n||"")),i}}}}),Bridge.define("Kusto.Data.Common.CslSyntaxGenerator",{statics:{fields:{s_keywords:null},ctors:{init:function(){this.s_keywords=t.$.Kusto.Data.Common.CslSyntaxGenerator.f1(new(e.Collections.Generic.HashSet$1(e.String).ctor))}},methods:{NormalizeDatabaseName:function(t){return Kusto.Data.Common.CslSyntaxGenerator.IsIdentifier(t)&&!Kusto.Data.Common.CslSyntaxGenerator.IsKeyword(t)?t:e.String.startsWith(t,"[")?t:e.String.contains(t,"'")?'["'+(t||"")+'"]':"['"+(t||"")+"']"},NormalizeFunctionName:function(t,n){return void 0===n&&(n=!1),n||!Kusto.Data.Common.CslSyntaxGenerator.IsIdentifier(t)||Kusto.Data.Common.CslSyntaxGenerator.IsKeyword(t)?e.String.startsWith(t,"[")?t:e.String.contains(t,"'")?'["'+(t||"")+'"]':"['"+(t||"")+"']":t},NormalizeTableName:function(t,n){return void 0===n&&(n=!1),n||!Kusto.Data.Common.CslSyntaxGenerator.IsIdentifier(t)||Kusto.Data.Common.CslSyntaxGenerator.IsKeyword(t)?e.String.startsWith(t,"[")?t:e.String.contains(t,"'")?'["'+(t||"")+'"]':"['"+(t||"")+"']":t},NormalizeColumnName:function(t,n){return void 0===n&&(n=!1),n||!Kusto.Data.Common.CslSyntaxGenerator.IsIdentifier(t)||Kusto.Data.Common.CslSyntaxGenerator.IsKeyword(t)?e.String.startsWith(t,"[")?t:e.String.contains(t,"'"