text: (function(){"use strict";var a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z,_0,_1,_2,_3,_4,_5,_6,_7,_8,_9,_,$,ba,bb,bc,bd,be,bf,bg,bh,bi,bj,bk,bl,bm,bn,bo,bp,bq,br,bs,bt,bu,bv,bw,bx,by,bz,bA,bB,bC,bD,bE,bF,bG,bH;a=self;b=a.WebSharper=a.WebSharper||{};c=b.JavaScript=b.JavaScript||{};d=c.JS=c.JS||{};e=a.Error;f=c.NonStandardPromiseRejectionException=c.NonStandardPromiseRejectionException||{};g=c.Promise=c.Promise||{};h=c.Pervasives=c.Pervasives||{};i=b.Json=b.Json||{};j=b.Obj=b.Obj||{};k=b.Remoting=b.Remoting||{};l=k.XhrProvider=k.XhrProvider||{};m=k.AjaxRemotingProvider=k.AjaxRemotingProvider||{};n=a.StartupCode$WebSharper_Main$Remoting=a.StartupCode$WebSharper_Main$Remoting||{};o=b.HtmlContentExtensions=b.HtmlContentExtensions||{};p=o.SingleNode=o.SingleNode||{};q=b.Activator=b.Activator||{};r=a.StartupCode$WebSharper_Main$Html=a.StartupCode$WebSharper_Main$Html||{};s=b.Collections=b.Collections||{};t=s.EqualityComparer=s.EqualityComparer||{};u=b.Comparers=b.Comparers||{};v=u.EquatableEqualityComparer=u.EquatableEqualityComparer||{};w=u.BaseEqualityComparer=u.BaseEqualityComparer||{};x=s.Comparer=s.Comparer||{};y=u.ComparableComparer=u.ComparableComparer||{};z=u.BaseComparer=u.BaseComparer||{};A=b.Operators=b.Operators||{};B=b.Nullable=b.Nullable||{};C=b.Utils=b.Utils||{};D=b.Concurrency=b.Concurrency||{};E=D.CT=D.CT||{};F=D.AsyncBody=D.AsyncBody||{};G=D.Scheduler=D.Scheduler||{};H=a.StartupCode$WebSharper_Main$Concurrency=a.StartupCode$WebSharper_Main$Concurrency||{};I=b.Enumerator=b.Enumerator||{};J=I.T=I.T||{};K=c.Optional=c.Optional||{};L=b.Arrays=b.Arrays||{};M=b.Seq=b.Seq||{};N=b.List=b.List||{};O=b.Arrays2D=b.Arrays2D||{};P=b.CancellationTokenSource=b.CancellationTokenSource||{};Q=b.Char=b.Char||{};R=b.Util=b.Util||{};S=b.DateUtil=b.DateUtil||{};T=b.DateTimeOffset=b.DateTimeOffset||{};U=b.Delegate=b.Delegate||{};V=s.DictionaryUtil=s.DictionaryUtil||{};W=s.KeyCollection=s.KeyCollection||{};X=s.ValueCollection=s.ValueCollection||{};Y=s.Dictionary=s.Dictionary||{};Z=b.Exception=b.Exception||{};_0=b.MatchFailureException=b.MatchFailureException||{};_1=b.IndexOutOfRangeException=b.IndexOutOfRangeException||{};_2=b.OperationCanceledException=b.OperationCanceledException||{};_3=b.ArgumentException=b.ArgumentException||{};_4=b.ArgumentOutOfRangeException=b.ArgumentOutOfRangeException||{};_5=b.ArgumentNullException=b.ArgumentNullException||{};_6=b.InvalidOperationException=b.InvalidOperationException||{};_7=b.AggregateException=b.AggregateException||{};_8=b.TimeoutException=b.TimeoutException||{};_9=b.FormatException=b.FormatException||{};_=b.OverflowException=b.OverflowException||{};$=b.TaskCanceledException=b.TaskCanceledException||{};ba=a.System=a.System||{};bb=ba.Guid=ba.Guid||{};bc=s.HashSetUtil=s.HashSetUtil||{};bd=s.HashSet=s.HashSet||{};be=b.LazyExtensionsProxy=b.LazyExtensionsProxy||{};bf=be.LazyRecord=be.LazyRecord||{};bg=b.Lazy=b.Lazy||{};bh=N.T=N.T||{};bi=b.Slice=b.Slice||{};bj=b.Option=b.Option||{};bk=b.Queue=b.Queue||{};bl=b.Random=b.Random||{};bm=b.Ref=b.Ref||{};bn=b.Result=b.Result||{};bo=b.Control=b.Control||{};bp=b.Stack=b.Stack||{};bq=b.Strings=b.Strings||{};br=b.Task=b.Task||{};bs=b.Task1=b.Task1||{};bt=b.TaskCompletionSource=b.TaskCompletionSource||{};bu=b.Unchecked=b.Unchecked||{};bv=a.Microsoft=a.Microsoft||{};bw=bv.FSharp=bv.FSharp||{};bx=bw.Core=bw.Core||{};by=bx.FSharpValueOption=bx.FSharpValueOption||{};bz=b.Numeric=b.Numeric||{};bA=a.IntelliFactory;bB=bA&&bA.Runtime;bC=a.Promise;bD=a.JSON;bE=a.String;bF=a.Date;bG=a.console;bH=a.Math;d.GetFieldValues=function(bI){var bJ,bK;bJ=[];for(var bL in bI)bJ.push(bI[bL]);return bJ;};d.GetFieldNames=function(bI){var bJ,bK;bJ=[];for(var bL in bI)bJ.push(bL);return bJ;};d.GetFields=function(bI){var bJ,bK;bJ=[];for(var bL in bI)bJ.push([bL,bI[bL]]);return bJ;};f=c.NonStandardPromiseRejectionException=bB.Class({get_Reason:function(){return this.reason;}},e,f);f.New=bB.Ctor(function(bI){this.message="Promise rejected";a.Object.setPrototypeOf(this,f.prototype);this.reason=bI;},f);g.For=function(bI,bJ){var bK;function bL(){return bK.MoveNext()?bJ(bK.Current()).then(function(){return bL();}):bC.resolve(null);}bK=I.Get(bI);return new bC(function(bM){bL();bM();})["finally"](function(){return bK.Dispose();});};g.AsTask=function(bI){var bJ;bJ=new bt.New();bI.then(function(bK){return bJ.SetResult(bK);},function(bK){return bJ.SetException$1(g.unwrapExn(bK));});return bJ.get_Task();};g.AsAsync=function(bI){return D.FromContinuations(function(bJ,bK){bI.then(bJ,function(bL){return bK(g.unwrapExn(bL));});});};g.OfTask=function(bI){return new bC(function(bJ,bK){bI.ContinueWith$1(function(bL){return bL.get_IsCanceled()?bK(new $.New()):bL.get_IsFaulted()?bK(bL.get_Exception()):bJ(bL.get_Result());},D.noneCT());});};g.OfAsync=function(bI){return new bC(function(bJ,bK){D.StartWithContinuations(bI,bJ,function(bL){bK(bL);},function(bL){bK(bL);},null);});};g.unwrapExn=function(bI){return bI instanceof e?bI:new f.New(bI);};h.GetJS=function(bI,bJ){var bK,bL;bK=bI;bL=I.Get(bJ);try{while(bL.MoveNext())bK=bK[bL.Current()];}finally{if(typeof bL=="object"&&"Dispose"in bL)bL.Dispose();}return bK;};h.NewFromSeq=function(bI){var bJ,bK,bL;bJ={};bK=I.Get(bI);try{while(bK.MoveNext()){bL=bK.Current();bJ[bL[0]]=bL[1];}}finally{if(typeof bK=="object"&&"Dispose"in bK)bK.Dispose();}return bJ;};i.Activate=function(bI){var bJ,bL,bM,bN,bO,bP,bQ;function bK(bR){var bS,bT,bU,bV,bW;if(bu.Equals(bR,null))return bR;else if(typeof bR=="object"){if(bR instanceof a.Array)return i.shallowMap(bK,bR);else{bS=i.shallowMap(bK,bR.$V);bT=bR.$T;if(bT===void 0)return bS;else{bU=L.get(bL,bT);if(bU===1)return N.ofArray(bS);else if(bU===2)return self.WebSharper.Decimal.CreateDecimalBits(bS);else{bV=new(L.get(bL,bT))();for(var bX in bS)if(function(bY){bV[bY]=bS[bY];return false;}(bX))break;return bV;}}}}else return bR;}bL=bI?bI.$TYPES:void 0;if(bL===void 0)bJ=bI;else{for(bM=0,bN=L.length(bL)-1;bM<=bN;bM++){bQ=L.get(bL,bM);switch(!bu.Equals(bQ,null)&&bQ.length===3?L.get(bQ,0)==="WebSharper"?L.get(bQ,1)==="List"?L.get(bQ,2)==="T"?0:(bP=bQ,2):(bP=bQ,2):(bP=bQ,2):!bu.Equals(bQ,null)&&bQ.length===2?L.get(bQ,0)==="WebSharper"?L.get(bQ,1)==="Decimal"?1:(bP=bQ,2):(bP=bQ,2):(bP=bQ,2)){case 0:bO=1;break;case 1:bO=2;break;case 2:bO=i.lookup(bP);break;}L.set(bL,bM,bO);}bJ=bI.$DATA;}return bK(bJ);};i.shallowMap=function(bI,bJ){var bK,bL;if(bJ instanceof a.Array)return L.map(bI,bJ);else if(typeof bJ=="object"){bK={};for(var bM in bJ)if(function(bN){bK[bN]=bI(bJ[bN]);return false;}(bM))break;return bK;}else return bJ;};i.lookup=function(bI){var bJ,bK,bL,bM,bN;bL=L.length(bI);bJ=self;bK=0;while(bK<bL){bM=L.get(bI,bK);bN=bJ[bM];!bu.Equals(typeof bN,void 0)?(bJ=bN,bK=bK+1):A.FailWith("Invalid server reply. Failed to find type: "+bM);}return bJ;};j=b.Obj=bB.Class({Equals:function(bI){return this===bI;},GetHashCode:function(){return -1;}},null,j);j.New=bB.Ctor(function(){},j);l=k.XhrProvider=bB.Class({Sync:function(bI,bJ,bK){var bL;bL=[null];k.ajax(false,bI,bJ,bK,function(bM){bL[0]=bM;},function(bM){throw bM;},function(){k.ajax(false,bI,bJ,bK,function(bM){bL[0]=bM;},function(bM){throw bM;},void 0);});return bL[0];},Async:function(bI,bJ,bK,bL,bM){k.ajax(true,bI,bJ,bK,bL,bM,function(){k.ajax(true,bI,bJ,bK,bL,bM,void 0);});}},j,l);l.New=bB.Ctor(function(){j.New.call(this);},l);m=k.AjaxRemotingProvider=bB.Class({get_EndPoint:function(){return k.EndPoint();},AsyncBase:function(bI,bJ){var bK,bL;bK=this;bL=null;return D.Delay(function(){var bM,bN;bM=k.makeHeaders(bI);bN=k.makePayload(bJ);return D.Bind(D.GetCT(),function(bO){return D.FromContinuations(function(bP,bQ,bR){var bS,bT,bU;function bV(bW){return bS[0]?(bS[0]=false,bR(new _2.New(bO))):null;}bS=[true];bT=D.Register(bO,function(){bV();});bU=bK.get_EndPoint();return k.AjaxProvider().Async(bU,bM,bN,function(bW){if(bS[0]){bS[0]=false;bT.Dispose();bP(i.Activate(bD.parse(bW)));}},function(bW){if(bS[0]){bS[0]=false;bT.Dispose();bQ(bW);}});});});});},Send:function(bI,bJ){D.Start(this.AsyncBase(bI,bJ),null);},Task:function(bI,bJ){return D.StartAsTask(this.AsyncBase(bI,bJ),null);},Async:function(bI,bJ){return this.AsyncBase(bI,bJ);},Sync:function(bI,bJ){var bK,bL,bM;return i.Activate(bD.parse((bK=this.get_EndPoint(),(bL=k.makeHeaders(bI),(bM=k.makePayload(bJ),k.AjaxProvider().Sync(bK,bL,bM))))));}},j,m);m.New=bB.Ctor(function(){j.New.call(this);},m);k.ajax=function(bI,bJ,bK,bL,bM,bN,bO){var bP,bQ,bR;bP=new a.XMLHttpRequest();bQ=a.document.cookie.replace(new a.RegExp("(?:(?:^|.*;)\\s*csrftoken\\s*\\=\\s*([^;]*).*$)|^.*$"),"$1");bP.open("POST",bJ,bI);if(bI==true)bP.withCredentials=true;for(var bT in bK)bP.setRequestHeader(bT,bK[bT]);if(bQ)bP.setRequestHeader("x-csrftoken",bQ);function bS(){var bU;if(bP.status==200)bM(bP.responseText);else if(bO&&bP.status==403&&bP.responseText=="CSRF")bO();else{bU="Response status is not 200: ";bN(new e(bU+bP.status));}}if("onload"in bP)bP.onload=bP.onerror=bP.onabort=bS;else bP.onreadystatechange=function(){if(bP.readyState==4)bS();};bP.send(bL);};k.makePayload=function(bI){return bD.stringify(bI);};k.makeHeaders=function(bI){return{"content-type":"application/json","x-websharper-rpc":bI};};k.AjaxProvider=function(){n.$cctor();return n.AjaxProvider;};k.set_AjaxProvider=function(bI){n.$cctor();n.AjaxProvider=bI;};k.UseHttps=function(){try{return!bq.StartsWith(self.location.href,"https://")&&(k.set_EndPoint(bq.Replace(self.location.href,"http://","https://")),true);}catch(bI){return false;}};k.EndPoint=function(){n.$cctor();return n.EndPoint;};k.set_EndPoint=function(bI){n.$cctor();n.EndPoint=bI;};n.$cctor=function(){n.$cctor=a.ignore;n.EndPoint="?";n.AjaxProvider=new l.New();};p=o.SingleNode=bB.Class({ReplaceInDom:function(bI){this.node.parentNode.replaceChild(this.node,bI);}},j,p);p.New=bB.Ctor(function(bI){j.New.call(this);this.node=bI;},p);q.Activate=function(){var bI;if(self.document){bI=self.document.getElementById("websharper-data");bI?q.onReady(function(){var bJ,bK;function bL(bO,bP){if(typeof bP=="object"&&"$init"in bP)bP.$preinit(bO);}function bM(bO,bP){if(typeof bP=="object"&&"Body"in bP)bP.Body().ReplaceInDom(self.document.getElementById(bO));else if(typeof bP=="object"&&"$init"in bP)bP.$init(bO);}function bN(bO,bP){if(typeof bP=="object"&&"$init"in bP)bP.$postinit(bO);}bJ=i.Activate(bD.parse(bI.getAttribute("content")));q.set_Instances(bJ);bK=d.GetFields(bJ);L.iter(function(bO){return bL(bO[0],bO[1]);},bK);L.iter(function(bO){return bM(bO[0],bO[1]);},bK);L.iter(function(bO){return bN(bO[0],bO[1]);},bK);}):void 0;}};q.onReady=function(bI){var bJ;function bK(){if(!bJ){bJ=true;bI();self.document.removeEventListener("DOMContentLoaded",bK,false);self.removeEventListener("load",bK,false);}}bJ=false;self.document.readyState==="complete"?bK():(self.document.addEventListener("DOMContentLoaded",bK,false),self.addEventListener("load",bK,false));};q.Instances=function(){r.$cctor();return r.Instances;};q.set_Instances=function(bI){r.$cctor();r.Instances=bI;};q.META_ID=function(){r.$cctor();return r.META_ID;};r.$cctor=function(){r.$cctor=a.ignore;r.META_ID="websharper-data";r.Instances=null;};t=s.EqualityComparer=bB.Class({CGetHashCode0:function(bI){return this.GetHashCode$1(bI);},CEquals0:function(bI,bJ){return this.Equals$1(bI,bJ);},CGetHashCode:function(bI){return this.GetHashCode$1(bI);},CEquals:function(bI,bJ){return this.Equals$1(bI,bJ);}},j,t);t.New=bB.Ctor(function(){j.New.call(this);},t);v=u.EquatableEqualityComparer=bB.Class({GetHashCode$1:function(bI){return bu.Hash(bI);},Equals$1:function(bI,bJ){return bI.EEquals(bJ);}},t,v);v.New=bB.Ctor(function(){t.New.call(this);},v);w=u.BaseEqualityComparer=bB.Class({GetHashCode$1:function(bI){return bu.Hash(bI);},Equals$1:function(bI,bJ){return bu.Equals(bI,bJ);}},t,w);w.New=bB.Ctor(function(){t.New.call(this);},w);x=s.Comparer=bB.Class({Compare0:function(bI,bJ){return this.Compare$1(bI,bJ);},Compare:function(bI,bJ){return this.Compare$1(bI,bJ);}},j,x);x.New=bB.Ctor(function(){j.New.call(this);},x);y=u.ComparableComparer=bB.Class({Compare$1:function(bI,bJ){return bI.CompareTo(bJ);}},x,y);y.New=bB.Ctor(function(){x.New.call(this);},y);z=u.BaseComparer=bB.Class({Compare$1:function(bI,bJ){return bu.Compare(bI,bJ);}},x,z);z.New=bB.Ctor(function(){x.New.call(this);},z);A.charRange=function(bI,bJ){var bK,bL;bK=bI.charCodeAt();bL=1+bJ.charCodeAt()-bK;return bL<=0?[]:M.init(bL,function(bM){return bE.fromCharCode(bM+bK);});};B.op=function(bI,bJ,bK){return bI==null||bJ==null?null:bK(bI,bJ);};B.opL=function(bI,bJ,bK){return bI==null?null:bK(bI,bJ);};B.opR=function(bI,bJ,bK){return bJ==null?null:bK(bI,bJ);};B.cmp=function(bI,bJ,bK){return bI==null||bJ==null?false:bK(bI,bJ);};B.cmpE=function(bI,bJ,bK){return bI==null?bJ==null:bJ==null?false:bK(bI,bJ);};B.cmpL=function(bI,bJ,bK){return bI==null?false:bK(bI,bJ);};B.cmpR=function(bI,bJ,bK){return bJ==null?false:bK(bI,bJ);};B.conv=function(bI,bJ){return bI==null?null:bJ(bI);};C.prettyPrint=function(bI){var bJ,bK;function bL(bM,bN){return bM+" = "+C.prettyPrint(bN);}return bI===null?"null":(bJ=typeof bI,bJ=="string"?"\""+bI+"\"":bJ=="object"?bI instanceof a.Array?"[|"+bq.concat("; ",L.map(C.prettyPrint,bI))+"|]":(bK=bE(bI),bK==="[object Object]"?"{"+bq.concat("; ",L.map(function(bM){return bL(bM[0],bM[1]);},d.GetFields(bI)))+"}":bK):bE(bI));};C.printArray2D=function(bI,bJ){return bJ===null?"null":"[["+bq.concat("][",M.delay(function(){var bK;bK=bJ.length?bJ[0].length:0;return M.map(function(bL){return bq.concat("; ",M.delay(function(){return M.map(function(bM){return bI(L.get2D(bJ,bL,bM));},A.range(0,bK-1));}));},A.range(0,bJ.length-1));}))+"]]";};C.printArray=function(bI,bJ){return bJ===null?"null":"[|"+bq.concat("; ",L.map(bI,bJ))+"|]";};C.printList=function(bI,bJ){return"["+bq.concat("; ",M.map(bI,bJ))+"]";};C.padNumLeft=function(bI,bJ){var bK;bK=L.get(bI,0);return bK===" "||bK==="+"||bK==="-"?bK+bq.PadLeftWith(bI.substr(1),bJ-1,"0"):bq.PadLeftWith(bI,bJ,"0");};C.spaceForPos=function(bI,bJ){return 0<=bI?" "+bJ:bJ;};C.plusForPos=function(bI,bJ){return 0<=bI?"+"+bJ:bJ;};C.toSafe=function(bI){return bI==null?"":bI;};E.New=function(bI,bJ){return{c:bI,r:bJ};};F.New=function(bI,bJ){return{k:bI,ct:bJ};};G=D.Scheduler=bB.Class({tick:function(){var bI,bJ,bK;bJ=this;bK=bF.now();bI=true;while(bI)if(this.robin.length===0){this.idle=true;bI=false;}else{(this.robin.shift())();bF.now()-bK>40?(a.setTimeout(function(){bJ.tick();},0),bI=false):void 0;}},Fork:function(bI){var bJ;bJ=this;this.robin.push(bI);this.idle?(this.idle=false,a.setTimeout(function(){bJ.tick();},0)):void 0;}},j,G);G.New=bB.Ctor(function(){j.New.call(this);this.idle=true;this.robin=[];},G);D.For=function(bI,bJ){return D.Using(I.Get(bI),function(bK){return D.While(function(){return bK.MoveNext();},D.Delay(function(){return bJ(bK.Current());}));});};D.While=function(bI,bJ){return bI()?D.Bind(bJ,function(){return D.While(bI,bJ);}):D.Return();};D.Using=function(bI,bJ){return D.TryFinally(bJ(bI),function(){bI.Dispose();});};D.TryCancelled=function(bI,bJ){return function(bK){bI(F.New(function(bL){if(bL.$==2){bJ(bL.$0);bK.k(bL);}else bK.k(bL);},bK.ct));};};D.OnCancel=function(bI){return function(bJ){bJ.k({$:0,$0:D.Register(bJ.ct,bI)});};};D.StartChildAsTask=function(bI){return function(bJ){(D.StartChild(bI,null))(F.New(function(bK){if(bK.$==0)bJ.k({$:0,$0:D.StartImmediateAsTask(bK.$0,{$:1,$0:bJ.ct})});},bJ.ct));};};D.StartChild=function(bI,bJ){return function(bK){var bL,bM,bN,bO;bL=[true];bM=[null];bN=[];bO=bJ!=null&&bJ.$==1?{$:1,$0:a.setTimeout(function(){var bP;bL[0]=false;bP={$:1,$0:new _8.New()};while(bN.length>0)(bN.shift())(bP);},bJ.$0)}:null;D.scheduler().Fork(function(){if(!bK.ct.c)bI(F.New(function(bP){if(bL[0]){bM[0]={$:1,$0:bP};bO!=null&&bO.$==1?a.clearTimeout(bO.$0):void 0;while(bN.length>0)(bN.shift())(bP);}},bK.ct));});bK.k({$:0,$0:function(bP){var bQ;if(bL[0]){bQ=bM[0];bQ==null?bN.push(bP.k):bP.k(bQ.$0);}else bP.k({$:1,$0:new _8.New()});}});};};D.Parallel=function(bI){var bJ;bJ=L.ofSeq(bI);return L.length(bJ)===0?D.Return([]):function(bK){var bL,bM,bN;function bO(bP,bQ){var bR,bS;bS=bM[0];switch(bS===0?0:bS===1?bQ.$==0?1:(bR=[bS,bQ],3):bQ.$==0?2:(bR=[bS,bQ],3)){case 0:return null;case 1:L.set(bN,bP,bQ.$0);bM[0]=0;return bK.k({$:0,$0:bN});case 2:L.set(bN,bP,bQ.$0);{bM[0]=bS-1;return;}break;case 3:bM[0]=0;return bK.k(bR[1]);}}bL=bJ.length;bM=[bL];bN=new a.Array(bL);L.iteri(function(bP,bQ){return D.scheduler().Fork(function(){bQ(F.New(function(bR){return bO(bP,bR);},bK.ct));});},bJ);};};D.Sleep=function(bI){return function(bJ){var bK,bL;bK=void 0;bL=void 0;bK=a.setTimeout(function(){bL.Dispose();D.scheduler().Fork(function(){bJ.k({$:0,$0:null});});},bI);bL=D.Register(bJ.ct,function(){a.clearTimeout(bK);D.scheduler().Fork(function(){D.cancel(bJ);});});};};D.StartImmediateAsTask=function(bI,bJ){var bK;bK=new bt.New();D.StartWithContinuations(bI,function(bL){bK.SetResult(bL);},function(bL){bK.SetException$1(bL);},function(){bK.SetCanceled();},bJ);return bK.get_Task();};D.StartAsTask=function(bI,bJ){var bK;bK=new bt.New();D.scheduler().Fork(function(){D.StartWithContinuations(bI,function(bL){bK.SetResult(bL);},function(bL){bK.SetException$1(bL);},function(){bK.SetCanceled();},bJ);});return bK.get_Task();};D.AwaitTask1=function(bI){return D.FromContinuations(function(bJ,bK,bL){bI.get_Status()===0?bI.Start():void 0;bI.ContinueWith$1(function(bM){return bM.get_IsCanceled()?bL(new _2.New(D.noneCT())):bM.get_IsFaulted()?bK(bM.get_Exception()):bJ(bM.get_Result());},D.noneCT());});};D.AwaitTask=function(bI){return D.FromContinuations(function(bJ,bK,bL){bI.get_Status()===0?bI.Start():void 0;bI.ContinueWith$1(function(bM){return bM.get_IsCanceled()?bL(new _2.New(D.noneCT())):bM.get_IsFaulted()?bK(bM.get_Exception()):bJ();},D.noneCT());});};D.AwaitEvent=function(bI,bJ){return function(bK){var bL,bM;bL=void 0;bM=void 0;bL=bI.Subscribe(R.observer(function(bN){bL.Dispose();bM.Dispose();D.scheduler().Fork(function(){bK.k({$:0,$0:bN});});}));bM=D.Register(bK.ct,function(){if(bJ!=null&&bJ.$==1)bJ.$0();else{bL.Dispose();D.scheduler().Fork(function(){D.cancel(bK);});}});};};D.StartImmediate=function(bI,bJ){var bK,bL;bK=(bL=(D.defCTS())[0],bJ==null?bL:bJ.$0);!bK.c?bI(F.New(function(bM){if(bM.$==1)D.UncaughtAsyncError(bM.$0);},bK)):void 0;};D.Start=function(bI,bJ){var bK,bL;bK=(bL=(D.defCTS())[0],bJ==null?bL:bJ.$0);D.scheduler().Fork(function(){if(!bK.c)bI(F.New(function(bM){if(bM.$==1)D.UncaughtAsyncError(bM.$0);},bK));});};D.UncaughtAsyncError=function(bI){bG.log("WebSharper: Uncaught asynchronous exception",bI);};D.StartWithContinuations=function(bI,bJ,bK,bL,bM){var bN,bO;bN=(bO=(D.defCTS())[0],bM==null?bO:bM.$0);!bN.c?bI(F.New(function(bP){if(bP.$==1)bK(bP.$0);else if(bP.$==2)bL(bP.$0);else bJ(bP.$0);},bN)):void 0;};D.FromContinuations=function(bI){return function(bJ){var bK;function bL(bM){if(bK[0])A.FailWith("A continuation provided by Async.FromContinuations was invoked multiple times");else{bK[0]=true;D.scheduler().Fork(bM);}}bK=[false];bI(function(bM){bL(function(){bJ.k({$:0,$0:bM});});},function(bM){bL(function(){bJ.k({$:1,$0:bM});});},function(bM){bL(function(){bJ.k({$:2,$0:bM});});});};};D.GetCT=function(){H.$cctor();return H.GetCT;};D.Catch=function(bI){return function(bJ){try{bI(F.New(function(bK){if(bK.$==0)bJ.k({$:0,$0:{$:0,$0:bK.$0}});else if(bK.$==1)bJ.k({$:0,$0:{$:1,$0:bK.$0}});else bJ.k(bK);},bJ.ct));}catch(bK){bJ.k({$:0,$0:{$:1,$0:bK}});}};};D.TryWith=function(bI,bJ){return function(bK){bI(F.New(function(bL){if(bL.$==0)bK.k({$:0,$0:bL.$0});else if(bL.$==1)try{(bJ(bL.$0))(bK);}catch(bM){bK.k(bL);}else bK.k(bL);},bK.ct));};};D.TryFinally=function(bI,bJ){return function(bK){bI(F.New(function(bL){try{bJ();bK.k(bL);}catch(bM){bK.k({$:1,$0:bM});}},bK.ct));};};D.Delay=function(bI){return function(bJ){try{(bI(null))(bJ);}catch(bK){bJ.k({$:1,$0:bK});}};};D.Combine=function(bI,bJ){return D.Bind(bI,function(){return bJ;});};D.Bind=function(bI,bJ){return D.checkCancel(function(bK){bI(F.New(function(bL){var bM;if(bL.$==0){bM=bL.$0;D.scheduler().Fork(function(){try{(bJ(bM))(bK);}catch(bN){bK.k({$:1,$0:bN});}});}else D.scheduler().Fork(function(){bK.k(bL);});},bK.ct));});};D.Zero=function(){H.$cctor();return H.Zero;};D.Return=function(bI){return function(bJ){bJ.k({$:0,$0:bI});};};D.checkCancel=function(bI){return function(bJ){if(bJ.ct.c)D.cancel(bJ);else bI(bJ);};};D.cancel=function(bI){bI.k({$:2,$0:new _2.New(bI.ct)});};D.defCTS=function(){H.$cctor();return H.defCTS;};D.scheduler=function(){H.$cctor();return H.scheduler;};D.Register=function(bI,bJ){var bK;return bI===D.noneCT()?{Dispose:function(){return null;}}:(bK=bI.r.push(bJ)-1,{Dispose:function(){return L.set(bI.r,bK,a.ignore);}});};D.noneCT=function(){H.$cctor();return H.noneCT;};H.$cctor=function(){H.$cctor=a.ignore;H.noneCT=E.New(false,[]);H.scheduler=new G.New();H.defCTS=[new P.New()];H.Zero=D.Return();H.GetCT=function(bI){bI.k({$:0,$0:bI.ct});};};J=I.T=bB.Class({Dispose:function(){if(this.d)this.d(this);},Current:function(){return this.c;},Current0:function(){return this.c;},MoveNext:function(){return this.n(this);}},j,J);J.New=bB.Ctor(function(bI,bJ,bK,bL){j.New.call(this);this.s=bI;this.c=bJ;this.n=bK;this.d=bL;},J);I.Get0=function(bI){return bI instanceof a.Array?I.ArrayEnumerator(bI):bu.Equals(typeof bI,"string")?I.StringEnumerator(bI):"GetEnumerator0"in bI?bI.GetEnumerator0():bI.GetEnumerator();};I.Get=function(bI){return bI instanceof a.Array?I.ArrayEnumerator(bI):bu.Equals(typeof bI,"string")?I.StringEnumerator(bI):bI.GetEnumerator();};I.StringEnumerator=function(bI){return new J.New(0,null,function(bJ){var bK;bK=bJ.s;return bK<bI.length&&(bJ.c=bI[bK],bJ.s=bK+1,true);},void 0);};I.ArrayEnumerator=function(bI){return new J.New(0,null,function(bJ){var bK;bK=bJ.s;return bK<L.length(bI)&&(bJ.c=L.get(bI,bK),bJ.s=bK+1,true);},void 0);};K.Undefined={$:0};L.splitInto=function(bI,bJ){var bK,bL,bM,bN,bO,bP,bQ,bR,bS;if(bI<=0)A.FailWith("Count must be positive");bL=L.length(bJ);if(bL===0)return[];else{bM=bu.Compare(bI,bL)===-1?bI:bL;bN=L.create(bM,null);bO=bL/bM>>0;bK=0;for(bP=0,bQ=bL%bM-1;bP<=bQ;bP++){bN[bP]=L.sub(bJ,bK,bO+1);bK=bK+bO+1;}for(bR=bL%bM,bS=bM-1;bR<=bS;bR++){bN[bR]=L.sub(bJ,bK,bO);bK=bK+bO;}return bN;}};L.contains=function(bI,bJ){var bK,bL,bM,bN;bK=true;bL=0;bN=L.length(bJ);while(bK&&bL<bN)if(bu.Equals(bJ[bL],bI))bK=false;else bL=bL+1;return!bK;};L.tryFindBack=function(bI,bJ){var bK,bL,bM;bK=null;bL=bJ.length-1;while(bL>=0&&bK==null){bM=bJ[bL];bI(bM)?bK={$:1,$0:bM}:void 0;bL=bL-1;}return bK;};L.tryFindIndexBack=function(bI,bJ){var bK,bL;bK=null;bL=bJ.length-1;while(bL>=0&&bK==null){bI(L.get(bJ,bL))?bK={$:1,$0:bL}:void 0;bL=bL-1;}return bK;};L.mapFold=function(bI,bJ,bK){var bL,bM,bN,bO,bP;bM=new a.Array(bK.length);bL=bJ;for(bN=0,bO=bK.length-1;bN<=bO;bN++){bP=bI(bL,bK[bN]);bM[bN]=bP[0];bL=bP[1];}return[bM,bL];};L.mapFoldBack=function(bI,bJ,bK){var bL,bM,bN,bO,bP,bQ,bR,bS;bN=new a.Array(bJ.length);bL=bK;bO=bJ.length;for(bP=1,bQ=bO;bP<=bQ;bP++){bR=bO-bP;bS=bI(bJ[bR],bL);bN[bR]=bS[0];bL=bS[1];}return[bN,bL];};L.mapInPlace=function(bI,bJ){var bK,bL;for(bK=0,bL=bJ.length-1;bK<=bL;bK++)bJ[bK]=bI(bJ[bK]);};L.mapiInPlace=function(bI,bJ){var bK,bL;for(bK=0,bL=bJ.length-1;bK<=bL;bK++)bJ[bK]=bI(bK,bJ[bK]);return bJ;};L.sortInPlaceByDescending=function(bI,bJ){L.mapInPlace(function(bK){return bK[0];},L.mapiInPlace(function(bK,bL){return[bL,[bI(bL),bK]];},bJ).sort(function(bK,bL){return-bu.Compare(bK[1],bL[1]);}));};M.tryHead=function(bI){var bJ;bJ=I.Get(bI);try{return bJ.MoveNext()?{$:1,$0:bJ.Current()}:null;}finally{if(typeof bJ=="object"&&"Dispose"in bJ)bJ.Dispose();}};M.tryItem=function(bI,bJ){var bK,bL,bM;if(bI<0)return null;else{bK=0;bL=I.Get(bJ);try{bM=true;while(bM&&bK<=bI)if(bL.MoveNext())bK=bK+1;else bM=false;return bM?{$:1,$0:bL.Current()}:null;}finally{if(typeof bL=="object"&&"Dispose"in bL)bL.Dispose();}}};M.tryLast=function(bI){var bJ,bK;bJ=I.Get(bI);try{if(bJ.MoveNext()){while(bJ.MoveNext());bK={$:1,$0:bJ.Current()};}else bK=null;return bK;}finally{if(typeof bJ=="object"&&"Dispose"in bJ)bJ.Dispose();}};M.chunkBySize=function(bI,bJ){bI<=0?A.FailWith("Chunk size must be positive"):void 0;return{GetEnumerator:function(){var bK;bK=I.Get(bJ);return new J.New(true,null,function(bL){var bM;if(bL.s&&bK.MoveNext()){bM=[bK.Current()];while(bL.s&&L.length(bM)<bI)if(bK.MoveNext())bM.push(bK.Current());else bL.s=false;bL.c=bM;return true;}else return false;},function(){bK.Dispose();});}};};L.countBy=function(bI,bJ){var bK,bL,bM,bN,bO;bK=new Y.New$5();bL=[];for(bM=0,bN=L.length(bJ)-1;bM<=bN;bM++){bO=bI(bJ[bM]);bK.ContainsKey(bO)?bK.set_Item(bO,bK.get_Item(bO)+1):(bL.push(bO),bK.Add(bO,1));}L.mapInPlace(function(bP){return[bP,bK.get_Item(bP)];},bL);return bL;};M.except=function(bI,bJ){return{GetEnumerator:function(){var bK,bL;bK=I.Get(bJ);bL=new bd.New$2(bI);return new J.New(null,null,function(bM){var bN,bO;if(bK.MoveNext()){bN=bK.Current();bO=bL.Add(bN);while(!bO&&bK.MoveNext()){bN=bK.Current();bO=bL.Add(bN);}return bO&&(bM.c=bN,true);}else return false;},function(){bK.Dispose();});}};};N.skip=function(bI,bJ){var bK,bL,bM;bK=bJ;for(bL=1,bM=bI;bL<=bM;bL++)if(bK.$==0)A.FailWith("Input list too short.");else bK=bK.$1;return bK;};L.groupBy=function(bI,bJ){var bK,bL,bM,bN,bO,bP;bK=new Y.New$5();bL=[];for(bM=0,bN=L.length(bJ)-1;bM<=bN;bM++){bO=bJ[bM];bP=bI(bO);bK.ContainsKey(bP)?bK.get_Item(bP).push(bO):(bL.push(bP),bK.Add(bP,[bO]));}L.mapInPlace(function(bQ){return[bQ,bK.get_Item(bQ)];},bL);return bL;};M.insufficient=function(){return A.FailWith("The input sequence has an insufficient number of elements.");};M.last=function(bI){var bJ,bK;bJ=I.Get(bI);try{if(!bJ.MoveNext())bK=M.insufficient();else{while(bJ.MoveNext());bK=bJ.Current();}return bK;}finally{if(typeof bJ=="object"&&"Dispose"in bJ)bJ.Dispose();}};M.contains=function(bI,bJ){var bK,bL;bK=I.Get(bJ);try{bL=false;while(!bL&&bK.MoveNext())bL=bu.Equals(bK.Current(),bI);return bL;}finally{if(typeof bK=="object"&&"Dispose"in bK)bK.Dispose();}};N.skipWhile=function(bI,bJ){var bK;bK=bJ;while(!(bK.$==0)&&bI(N.head(bK)))bK=N.tail(bK);return bK;};M.nonNegative=function(){return A.FailWith("The input must be non-negative.");};L.transposeArray=function(bI){var bJ,bK,bL,bM,bN,bO,bP,bQ,bR;bJ=L.length(bI);if(bJ===0)return[];else{bK=L.length(L.get(bI,0));for(bL=1,bM=bJ-1;bL<=bM;bL++)if(bK!==L.length(L.get(bI,bL)))A.FailWith("The arrays have different lengths.");bN=new a.Array(bK);for(bO=0,bP=bK-1;bO<=bP;bO++){bN[bO]=new a.Array(bJ);for(bQ=0,bR=bJ-1;bQ<=bR;bQ++)bN[bO][bQ]=L.get(L.get(bI,bQ),bO);}return bN;}};L.checkBounds=function(bI,bJ){if(bJ<0||bJ>=bI.length)A.FailWith("Index was outside the bounds of the array.");};L.checkBounds2D=function(bI,bJ,bK){if(bJ<0||bK<0||bJ>=bI.length||bK>=(bI.length?bI[0].length:0))throw new _1.New();};L.checkRange=function(bI,bJ,bK){if(bK<0||bJ<0||bI.length<bJ+bK)A.FailWith("Index was outside the bounds of the array.");};L.set=function(bI,bJ,bK){L.checkBounds(bI,bJ);bI[bJ]=bK;};L.get=function(bI,bJ){L.checkBounds(bI,bJ);return bI[bJ];};L.sub=function(bI,bJ,bK){L.checkRange(bI,bJ,bK);return bI.slice(bJ,bJ+bK);};L.setSub=function(bI,bJ,bK,bL){var bM,bN;for(bM=0,bN=bK-1;bM<=bN;bM++)L.set(bI,bJ+bM,L.get(bL,bM));};L.get2D=function(bI,bJ,bK){L.checkBounds2D(bI,bJ,bK);return bI[bJ][bK];};L.set2D=function(bI,bJ,bK,bL){L.checkBounds2D(bI,bJ,bK);bI[bJ][bK]=bL;};L.zeroCreate2D=function(bI,bJ){var bK;bK=L.init(bI,function(){return L.create(bJ,null);});bK.dims=2;return bK;};L.sub2D=function(bI,bJ,bK,bL,bM){var bN,bO,bP,bQ,bR,bS,bT;bN=bL<0?0:bL;bO=bM<0?0:bM;bP=L.zeroCreate2D(bN,bO);for(bQ=0,bR=bN-1;bQ<=bR;bQ++){for(bS=0,bT=bO-1;bS<=bT;bS++)L.set2D(bP,bQ,bS,L.get2D(bI,bJ+bQ,bK+bS));}return bP;};L.setSub2D=function(bI,bJ,bK,bL,bM,bN){var bO,bP,bQ,bR;for(bO=0,bP=bL-1;bO<=bP;bO++){for(bQ=0,bR=bM-1;bQ<=bR;bQ++)L.set2D(bI,bJ+bO,bK+bQ,L.get2D(bN,bO,bQ));}};L.length=function(bI){return bI.dims===2?bI.length*bI.length:bI.length;};b.checkThis=function(bI){return bu.Equals(bI,null)?A.InvalidOp("The initialization of an object or value resulted in an object or value being accessed recursively before it was fully initialized."):bI;};L.binarySearch=function(bI,bJ,bK,bL){var bM,bN,bO,bP;bM=bK;bN=bL-1;if(bK<0)throw new _4.New("index","Non-negative number required.");else null;if(bL>L.length(bI))throw new _3.New$2("Offset and length were out of bounds for the array or count is greater than the number of elements from index to the end of the source collection.");else null;if(bL<bK)throw new _4.New("length","Non-negative number required.");else null;while(true)if(bM>bN)return~bM;else{bO=(bM+bN)/2>>0;bP=bJ(L.get(bI,bO));if(bM===bN)return bP===0?bM:bP>0?~(bM+1):~bM;else if(bP<=0)bN=bO;else bM=bO+1;}};L.binarySearchComparer=function(bI){return bI.CompareTo0?function(bJ){return bI.CompareTo0(bJ);}:function(bJ){if(bJ.CompareTo0)return-bJ.CompareTo0(bI);else throw new _6.New$2("Failed to compare two elements in the array.",new _3.New$2("At least one object must implement IComparable."));};};L.sortInternal=function(bI,bJ,bK,bL,bM){function bN(bP,bQ){var bR,bS,bT,bU;bS=bI[bQ];bR=bP-1;for(bT=bP,bU=bQ-1;bT<=bU;bT++)if(bL(bI[bT],bS)<0){bR=bR+1;bM(bR,bT);}bL(bI[bQ],bI[bR+1])<0?bM(bR+1,bQ):void 0;return bR+1;}function bO(bP,bQ){var bR;return bP<bQ?(bR=bN(bP,bQ),(bO(bP,bR-1),bO(bR+1,bQ))):null;}bO(bJ,bJ+bK-1);};L.sortSub=function(bI,bJ,bK,bL){L.sortInternal(bI,bJ,bK,bL,function(bM,bN){var bO;bO=bI[bM];bI[bM]=bI[bN];bI[bN]=bO;});};L.sortByKeys=function(bI,bJ,bK,bL,bM){L.sortInternal(bI,bK,bL,bM,function(bN,bO){var bP,bQ;bP=bI[bN];bI[bN]=bI[bO];bI[bO]=bP;bQ=bJ[bN];bJ[bN]=bJ[bO];bJ[bO]=bQ;});};L.clear=function(bI,bJ,bK){var bL,bM;if(bI==null)throw new _5.New$1("array");else void 0;if(bJ<0||bK<0||bJ+bK>L.length(bI))throw new _1.New();else void 0;for(bL=bJ,bM=bJ+bK-1;bL<=bM;bL++)bI[bL]=typeof bI[bL]=="number"?0:null;};L.constrainedCopy=function(bI,bJ,bK,bL,bM){if(bI===bK&&bL<=bJ+bM)L.blit(L.init(bM,function(bN){return L.get(bI,bJ+bN);}),0,bK,bL,bM);else L.blit(bI,bJ,bK,bL,bM);};L.findIndexBound=function(bI,bJ,bK,bL){var bM,bN;bM=bJ+bK;bN=bJ;if(bI==null)throw new _5.New$1("array");else null;if(bL==null)throw new _5.New$1("match");else null;if(bJ<0)throw new _4.New("startIndex","Index was out of range. Must be non-negative and less than the size of the collection.");else null;if(bK<0||bJ+bK>L.length(bI))throw new _4.New("count","Count must be positive and count must refer to a location within the string/array/collection.");else null;while(true)if(bN===bM)return -1;else if(bL(L.get(bI,bN)))return bN;else bN=bN+1;};L.findLastIndexBound=function(bI,bJ,bK,bL){var bM;bM=bJ+bK-1;if(bI==null)throw new _5.New$1("array");else null;if(bL==null)throw new _5.New$1("match");else null;if(bJ<0)throw new _4.New("startIndex","Index was out of range. Must be non-negative and less than the size of the collection.");else null;if(bK<0||bJ+bK>L.length(bI))throw new _4.New("count","Count must be positive and count must refer to a location within the string/array/collection.");else null;while(true)if(bM<bJ)return -1;else if(bL(L.get(bI,bM)))return bM;else bM=bM-1;};L.reverse=function(bI,bJ,bK){var bL;bL=L.sub(bI,bJ,bK).slice().reverse();L.blit(bL,0,bI,bJ,L.length(bL));};L.sum=function(bI){var bJ,bK;bJ=0;bK=0;for(;bK<bI.length;bK++)bJ+=bI[bK];return bJ;};L.sumBy=function(bI,bJ){var bK,bL;bK=0;bL=0;for(;bL<bJ.length;bL++)bK+=bI(bJ[bL]);return bK;};L.allPairs=function(bI,bJ){var bK,bL,bM,bN,bO,bP,bQ;bK=bI.length;bL=bJ.length;bM=new a.Array(bK*bL);for(bN=0,bO=bK-1;bN<=bO;bN++){for(bP=0,bQ=bL-1;bP<=bQ;bP++)bM[bN*bL+bP]=[bI[bN],bJ[bP]];}return bM;};L.average=function(bI){return a.Number(L.sum(bI))/bI.length;};L.averageBy=function(bI,bJ){return a.Number(L.sumBy(bI,bJ))/bJ.length;};L.blit=function(bI,bJ,bK,bL,bM){var bN,bO;L.checkRange(bI,bJ,bM);L.checkRange(bK,bL,bM);for(bN=0,bO=bM-1;bN<=bO;bN++)bK[bL+bN]=bI[bJ+bN];};L.choose=function(bI,bJ){var bK,bL,bM,bN;bK=[];for(bL=0,bM=bJ.length-1;bL<=bM;bL++){bN=bI(bJ[bL]);bN==null?void 0:bK.push(bN.$0);}return bK;};L.collect=function(bI,bJ){return a.Array.prototype.concat.apply([],L.map(bI,bJ));};L.concat=function(bI){return a.Array.prototype.concat.apply([],L.ofSeq(bI));};L.create=function(bI,bJ){var bK,bL,bM;bK=new a.Array(bI);for(bL=0,bM=bI-1;bL<=bM;bL++)bK[bL]=bJ;return bK;};L.exists=function(bI,bJ){var bK,bL,bM,bN;bK=false;bL=0;bN=L.length(bJ);while(!bK&&bL<bN)if(bI(bJ[bL]))bK=true;else bL=bL+1;return bK;};L.exists2=function(bI,bJ,bK){var bL,bM,bN,bO;L.checkLength(bJ,bK);bL=false;bM=0;bO=L.length(bJ);while(!bL&&bM<bO)if(bI(bJ[bM],bK[bM]))bL=true;else bM=bM+1;return bL;};L.fill=function(bI,bJ,bK,bL){var bM,bN;L.checkRange(bI,bJ,bK);for(bM=bJ,bN=bJ+bK-1;bM<=bN;bM++)bI[bM]=bL;};L.filter=function(bI,bJ){var bK,bL,bM;bK=[];for(bL=0,bM=bJ.length-1;bL<=bM;bL++)if(bI(bJ[bL]))bK.push(bJ[bL]);return bK;};L.find=function(bI,bJ){var bK;bK=L.tryFind(bI,bJ);return bK==null?A.FailWith("KeyNotFoundException"):bK.$0;};L.findIndex=function(bI,bJ){var bK;bK=L.tryFindIndex(bI,bJ);return bK==null?A.FailWith("KeyNotFoundException"):bK.$0;};L.fold=function(bI,bJ,bK){var bL,bM,bN;bL=bJ;for(bM=0,bN=bK.length-1;bM<=bN;bM++)bL=bI(bL,bK[bM]);return bL;};L.fold2=function(bI,bJ,bK,bL){var bM,bN,bO;L.checkLength(bK,bL);bM=bJ;for(bN=0,bO=bK.length-1;bN<=bO;bN++)bM=bI(bM,bK[bN],bL[bN]);return bM;};L.foldBack=function(bI,bJ,bK){var bL,bM,bN,bO,bP;bL=bK;bN=bJ.length;for(bO=1,bP=bN;bO<=bP;bO++)bL=bI(bJ[bN-bO],bL);return bL;};L.foldBack2=function(bI,bJ,bK,bL){var bM,bN,bO,bP,bQ;L.checkLength(bJ,bK);bO=bJ.length;bN=bL;for(bP=1,bQ=bO;bP<=bQ;bP++)bN=bI(bJ[bO-bP],bK[bO-bP],bN);return bN;};L.forall=function(bI,bJ){var bK,bL,bM,bN;bK=true;bL=0;bN=L.length(bJ);while(bK&&bL<bN)if(bI(bJ[bL]))bL=bL+1;else bK=false;return bK;};L.forall2=function(bI,bJ,bK){var bL,bM,bN,bO;L.checkLength(bJ,bK);bL=true;bM=0;bO=L.length(bJ);while(bL&&bM<bO)if(bI(bJ[bM],bK[bM]))bM=bM+1;else bL=false;return bL;};L.init=function(bI,bJ){var bK,bL,bM;bI<0?A.FailWith("Negative size given."):null;bK=new a.Array(bI);for(bL=0,bM=bI-1;bL<=bM;bL++)bK[bL]=bJ(bL);return bK;};L.iter=function(bI,bJ){var bK,bL;for(bK=0,bL=bJ.length-1;bK<=bL;bK++)bI(bJ[bK]);};L.iter2=function(bI,bJ,bK){var bL,bM;L.checkLength(bJ,bK);for(bL=0,bM=bJ.length-1;bL<=bM;bL++)bI(bJ[bL],bK[bL]);};L.iteri=function(bI,bJ){var bK,bL;for(bK=0,bL=bJ.length-1;bK<=bL;bK++)bI(bK,bJ[bK]);};L.iteri2=function(bI,bJ,bK){var bL,bM;L.checkLength(bJ,bK);for(bL=0,bM=bJ.length-1;bL<=bM;bL++)bI(bL,bJ[bL],bK[bL]);};L.map=function(bI,bJ){var bK,bL,bM;bK=new a.Array(bJ.length);for(bL=0,bM=bJ.length-1;bL<=bM;bL++)bK[bL]=bI(bJ[bL]);return bK;};L.map2=function(bI,bJ,bK){var bL,bM,bN;L.checkLength(bJ,bK);bL=new a.Array(bK.length);for(bM=0,bN=bK.length-1;bM<=bN;bM++)bL[bM]=bI(bJ[bM],bK[bM]);return bL;};L.mapi=function(bI,bJ){var bK,bL,bM;bK=new a.Array(bJ.length);for(bL=0,bM=bJ.length-1;bL<=bM;bL++)bK[bL]=bI(bL,bJ[bL]);return bK;};L.mapi2=function(bI,bJ,bK){var bL,bM,bN;L.checkLength(bJ,bK);bL=new a.Array(bJ.length);for(bM=0,bN=bJ.length-1;bM<=bN;bM++)bL[bM]=bI(bM,bJ[bM],bK[bM]);return bL;};L.max=function(bI){var bJ,bK,bL,bM;L.nonEmpty(bI);bJ=bI[0];for(bK=1,bL=bI.length-1;bK<=bL;bK++){bM=bI[bK];bu.Compare(bM,bJ)===1?bJ=bM:void 0;}return bJ;};L.maxBy=function(bI,bJ){var bK,bL,bM,bN,bO,bP;L.nonEmpty(bJ);bK=bJ[0];bL=bI(bK);for(bM=1,bN=bJ.length-1;bM<=bN;bM++){bO=bJ[bM];bP=bI(bO);bu.Compare(bP,bL)===1?(bK=bO,bL=bP):void 0;}return bK;};L.min=function(bI){var bJ,bK,bL,bM;L.nonEmpty(bI);bJ=bI[0];for(bK=1,bL=bI.length-1;bK<=bL;bK++){bM=bI[bK];bu.Compare(bM,bJ)===-1?bJ=bM:void 0;}return bJ;};L.minBy=function(bI,bJ){var bK,bL,bM,bN,bO,bP;L.nonEmpty(bJ);bK=bJ[0];bL=bI(bK);for(bM=1,bN=bJ.length-1;bM<=bN;bM++){bO=bJ[bM];bP=bI(bO);bu.Compare(bP,bL)===-1?(bK=bO,bL=bP):void 0;}return bK;};L.ofList=function(bI){var bJ,bK;bK=[];bJ=bI;while(!(bJ.$==0)){bK.push(N.head(bJ));bJ=N.tail(bJ);}return bK;};L.ofSeq=function(bI){var bJ,bK;if(bI instanceof a.Array)return bI.slice();else if(bI instanceof bh)return L.ofList(bI);else{bJ=[];bK=I.Get(bI);try{while(bK.MoveNext())bJ.push(bK.Current());return bJ;}finally{if(typeof bK=="object"&&"Dispose"in bK)bK.Dispose();}}};L.partition=function(bI,bJ){var bK,bL,bM,bN;bK=[];bL=[];for(bM=0,bN=bJ.length-1;bM<=bN;bM++)if(bI(bJ[bM]))bK.push(bJ[bM]);else bL.push(bJ[bM]);return[bK,bL];};L.permute=function(bI,bJ){var bK,bL,bM;bK=new a.Array(bJ.length);for(bL=0,bM=bJ.length-1;bL<=bM;bL++)bK[bI(bL)]=bJ[bL];return bK;};L.pick=function(bI,bJ){var bK;bK=L.tryPick(bI,bJ);return bK==null?A.FailWith("KeyNotFoundException"):bK.$0;};L.reduce=function(bI,bJ){var bK,bL,bM;L.nonEmpty(bJ);bK=bJ[0];for(bL=1,bM=bJ.length-1;bL<=bM;bL++)bK=bI(bK,bJ[bL]);return bK;};L.reduceBack=function(bI,bJ){var bK,bL,bM,bN,bO;L.nonEmpty(bJ);bM=bJ.length;bL=bJ[bM-1];for(bN=2,bO=bM;bN<=bO;bN++)bL=bI(bJ[bM-bN],bL);return bL;};L.scan=function(bI,bJ,bK){var bL,bM,bN;bL=new a.Array(1+bK.length);bL[0]=bJ;for(bM=0,bN=bK.length-1;bM<=bN;bM++)bL[bM+1]=bI(bL[bM],bK[bM]);return bL;};L.scanBack=function(bI,bJ,bK){var bL,bM,bN,bO;bL=bJ.length;bM=new a.Array(1+bL);bM[bL]=bK;for(bN=0,bO=bL-1;bN<=bO;bN++)bM[bL-bN-1]=bI(bJ[bL-bN-1],bM[bL-bN]);return bM;};L.sort=function(bI){return L.map(function(bJ){return bJ[0];},L.mapi(function(bJ,bK){return[bK,bJ];},bI).sort(bu.Compare));};L.sortBy=function(bI,bJ){return L.map(function(bK){return bK[0];},L.mapi(function(bK,bL){return[bL,[bI(bL),bK]];},bJ).sort(function(bK,bL){return bu.Compare(bK[1],bL[1]);}));};L.sortInPlace=function(bI){L.mapInPlace(function(bJ){return bJ[0];},L.mapiInPlace(function(bJ,bK){return[bK,bJ];},bI).sort(bu.Compare));};L.sortInPlaceBy=function(bI,bJ){L.mapInPlace(function(bK){return bK[0];},L.mapiInPlace(function(bK,bL){return[bL,[bI(bL),bK]];},bJ).sort(function(bK,bL){return bu.Compare(bK[1],bL[1]);}));};L.sortInPlaceWith=function(bI,bJ){bJ.sort(bI);};L.sortWith=function(bI,bJ){return bJ.slice().sort(bI);};L.sortByDescending=function(bI,bJ){return L.map(function(bK){return bK[0];},L.mapi(function(bK,bL){return[bL,[bI(bL),bK]];},bJ).sort(function(bK,bL){return-bu.Compare(bK[1],bL[1]);}));};L.sortDescending=function(bI){return L.map(function(bJ){return bJ[0];},L.mapi(function(bJ,bK){return[bK,bJ];},bI).sort(function(bJ,bK){return-bu.Compare(bJ,bK);}));};L.transpose=function(bI){return bI instanceof a.Array?L.transposeArray(bI):L.transposeArray(L.ofSeq(bI));};L.tryFind=function(bI,bJ){var bK,bL;bK=null;bL=0;while(bL<bJ.length&&bK==null){bI(bJ[bL])?bK={$:1,$0:bJ[bL]}:void 0;bL=bL+1;}return bK;};L.tryFindIndex=function(bI,bJ){var bK,bL;bK=null;bL=0;while(bL<bJ.length&&bK==null){bI(bJ[bL])?bK={$:1,$0:bL}:void 0;bL=bL+1;}return bK;};L.tryHead=function(bI){return bI.length===0?null:{$:1,$0:bI[0]};};L.tryItem=function(bI,bJ){return bJ.length<=bI||bI<0?null:{$:1,$0:bJ[bI]};};L.tryLast=function(bI){var bJ;bJ=bI.length;return bJ===0?null:{$:1,$0:bI[bJ-1]};};L.tryPick=function(bI,bJ){var bK,bL,bM;bK=null;bL=0;while(bL<bJ.length&&bK==null){bM=bI(bJ[bL]);bM!=null&&bM.$==1?bK=bM:void 0;bL=bL+1;}return bK;};L.unzip=function(bI){var bJ,bK,bL,bM,bN;bJ=[];bK=[];for(bL=0,bM=bI.length-1;bL<=bM;bL++){bN=bI[bL];bJ.push(bN[0]);bK.push(bN[1]);}return[bJ,bK];};L.unzip3=function(bI){var bJ,bK,bL,bM,bN,bO;bJ=[];bK=[];bL=[];for(bM=0,bN=bI.length-1;bM<=bN;bM++){bO=bI[bM];bJ.push(bO[0]);bK.push(bO[1]);bL.push(bO[2]);}return[bJ,bK,bL];};L.zip=function(bI,bJ){var bK,bL,bM;L.checkLength(bI,bJ);bK=L.create(bI.length,null);for(bL=0,bM=bI.length-1;bL<=bM;bL++)bK[bL]=[bI[bL],bJ[bL]];return bK;};L.zip3=function(bI,bJ,bK){var bL,bM,bN;L.checkLength(bI,bJ);L.checkLength(bJ,bK);bL=L.create(bI.length,null);for(bM=0,bN=bI.length-1;bM<=bN;bM++)bL[bM]=[bI[bM],bJ[bM],bK[bM]];return bL;};L.chunkBySize=function(bI,bJ){return L.ofSeq(M.chunkBySize(bI,bJ));};L.compareWith=function(bI,bJ,bK){return M.compareWith(bI,bJ,bK);};L.distinct=function(bI){return L.ofSeq(M.distinct(bI));};L.distinctBy=function(bI,bJ){return L.ofSeq(M.distinctBy(bI,bJ));};L.except=function(bI,bJ){return L.ofSeq(M.except(bI,bJ));};L.findBack=function(bI,bJ){var bK;bK=L.tryFindBack(bI,bJ);return bK==null?A.FailWith("KeyNotFoundException"):bK.$0;};L.findIndexBack=function(bI,bJ){var bK;bK=L.tryFindIndexBack(bI,bJ);return bK==null?A.FailWith("KeyNotFoundException"):bK.$0;};L.head=function(bI){L.nonEmpty(bI);return bI[0];};L.last=function(bI){L.nonEmpty(bI);return bI[bI.length-1];};L.map3=function(bI,bJ,bK,bL){var bM,bN,bO;L.checkLength(bJ,bK);L.checkLength(bJ,bL);bM=new a.Array(bL.length);for(bN=0,bO=bL.length-1;bN<=bO;bN++)bM[bN]=bI(bJ[bN],bK[bN],bL[bN]);return bM;};L.pairwise=function(bI){return L.ofSeq(M.pairwise(bI));};L.replicate=function(bI,bJ){return L.create(bI,bJ);};L.indexed=function(bI){return L.mapi(function(bJ,bK){return[bJ,bK];},bI);};L.skip=function(bI,bJ){return bI<0?M.nonNegative():bI>bJ.length?M.insufficient():bJ.slice(bI);};L.skipWhile=function(bI,bJ){var bK,bL;bL=bJ.length;bK=0;while(bK<bL&&bI(bJ[bK]))bK=bK+1;return bJ.slice(bK);};L.tail=function(bI){return L.skip(1,bI);};L.take=function(bI,bJ){return bI<0?M.nonNegative():bI>bJ.length?M.insufficient():bJ.slice(0,bI);};L.takeWhile=function(bI,bJ){var bK,bL;bL=bJ.length;bK=0;while(bK<bL&&bI(bJ[bK]))bK=bK+1;return bJ.slice(0,bK);};L.exactlyOne=function(bI){return bI.length===1?bI[0]:A.FailWith("The input does not have precisely one element.");};L.unfold=function(bI,bJ){return L.ofSeq(M.unfold(bI,bJ));};L.windowed=function(bI,bJ){return L.ofSeq(M.windowed(bI,bJ));};L.splitAt=function(bI,bJ){return[L.take(bI,bJ),L.skip(bI,bJ)];};L.nonEmpty=function(bI){if(bI.length===0)A.FailWith("The input array was empty.");};L.checkLength=function(bI,bJ){if(bI.length!==bJ.length)A.FailWith("The arrays have different lengths.");};O.init=function(bI,bJ,bK){var bL,bM,bN,bO,bP;bL=L.zeroCreate2D(bI,bJ);for(bM=0,bN=bI-1;bM<=bN;bM++){for(bO=0,bP=bJ-1;bO<=bP;bO++)L.set2D(bL,bM,bO,bK(bM,bO));}return bL;};O.iter=function(bI,bJ){var bK,bL,bM,bN,bO,bP;bK=bJ.length;bL=bJ.length?bJ[0].length:0;for(bM=0,bN=bK-1;bM<=bN;bM++){for(bO=0,bP=bL-1;bO<=bP;bO++)bI(L.get2D(bJ,bM,bO));}};O.iteri=function(bI,bJ){var bK,bL,bM,bN,bO,bP;bK=bJ.length;bL=bJ.length?bJ[0].length:0;for(bM=0,bN=bK-1;bM<=bN;bM++){for(bO=0,bP=bL-1;bO<=bP;bO++)bI(bM,bO,L.get2D(bJ,bM,bO));}};O.map=function(bI,bJ){return O.init(bJ.length,bJ.length?bJ[0].length:0,function(bK,bL){return bI(L.get2D(bJ,bK,bL));});};O.mapi=function(bI,bJ){return O.init(bJ.length,bJ.length?bJ[0].length:0,function(bK,bL){return bI(bK,bL,L.get2D(bJ,bK,bL));});};O.copy=function(bI){return O.init(bI.length,bI.length?bI[0].length:0,function(bJ,bK){return L.get2D(bI,bJ,bK);});};P=b.CancellationTokenSource=bB.Class({CancelAfter:function(bI){var bJ,bK;bJ=this;!this.c?(bK=this.pending,bK==null?void 0:a.clearTimeout(bK.$0),this.pending={$:1,$0:a.setTimeout(function(){bJ.Cancel$1();},bI)}):void 0;},Cancel:function(bI){if(!bI)this.Cancel$1();else if(!this.c){this.c=true;L.iter(function(bJ){bJ();},this.r);}},Cancel$1:function(){var bI;if(!this.c){this.c=true;bI=L.choose(function(bJ){try{bJ();return null;}catch(bK){return{$:1,$0:bK};}},this.r);if(L.length(bI)>0)throw new _7.New$3(bI);else void 0;}}},j,P);P.CreateLinkedTokenSource=function(bI,bJ){return P.CreateLinkedTokenSource$1([bI,bJ]);};P.CreateLinkedTokenSource$1=function(bI){var bJ;bJ=new P.New();L.iter(function(bK){function bL(bM){return bJ.Cancel$1();}D.Register(bK,function(){bL();});},bI);return bJ;};P.New=bB.Ctor(function(){j.New.call(this);this.c=false;this.pending=null;this.r=[];this.init=1;},P);Q.IsWhiteSpace=function(bI){return bI.match(new a.RegExp("\\s"))!==null;};Q.Parse=function(bI){return bI.length===1?bI:A.FailWith("String must be exactly one character long.");};Q.IsUpper=function(bI){return bI>="A"&&bI<="Z";};Q.IsLower=function(bI){return bI>="a"&&bI<="z";};Q.IsLetterOrDigit=function(bI){return Q.IsLetter(bI)||Q.IsDigit(bI);};Q.IsLetter=function(bI){return bI>="A"&&bI<="Z"||bI>="a"&&bI<="z";};Q.IsDigit=function(bI){return bI>="0"&&bI<="9";};Q.IsControl=function(bI){return bI>="\u0000"&&bI<="\u001f"||bI>="\u0080"&&bI<="\u009f";};Q.GetNumericValue=function(bI){return bI>="0"&&bI<="9"?bI.charCodeAt()-"0".charCodeAt():-1;};R.observer=function(bI){return{OnCompleted:function(){return null;},OnError:function(){return null;},OnNext:bI};};S.LongTime=function(bI){return(new bF(bI)).toLocaleTimeString({},{hour:"2-digit",minute:"2-digit",second:"2-digit",hour12:false});};S.ShortTime=function(bI){return(new bF(bI)).toLocaleTimeString({},{hour:"2-digit",minute:"2-digit",hour12:false});};S.LongDate=function(bI){return(new bF(bI)).toLocaleDateString({},{year:"numeric",month:"long",day:"numeric",weekday:"long"});};S.Parse=function(bI){var bJ;bJ=S.TryParse(bI);return bJ!=null&&bJ.$==1?bJ.$0:A.FailWith("Failed to parse date string.");};S.TryParse=function(bI){var bJ;bJ=bF.parse(bI);return a.isNaN(bJ)?null:{$:1,$0:bJ};};S.AddMonths=function(bI,bJ){var bK;bK=new bF(bI);return(new bF(bK.getFullYear(),bK.getMonth()+bJ,bK.getDate(),bK.getHours(),bK.getMinutes(),bK.getSeconds(),bK.getMilliseconds())).getTime();};S.AddYears=function(bI,bJ){var bK;bK=new bF(bI);return(new bF(bK.getFullYear()+bJ,bK.getMonth(),bK.getDate(),bK.getHours(),bK.getMinutes(),bK.getSeconds(),bK.getMilliseconds())).getTime();};S.TimePortion=function(bI){var bJ;bJ=new bF(bI);return(((24*0+bJ.getHours())*60+bJ.getMinutes())*60+bJ.getSeconds())*1000+bJ.getMilliseconds();};S.DatePortion=function(bI){var bJ;bJ=new bF(bI);return(new bF(bJ.getFullYear(),bJ.getMonth(),bJ.getDate())).getTime();};T.get_Now=function(){var bI;bI=new bF();return{d:bI.getTime(),o:-bI.getTimezoneOffset()};};T.get_DateTime=function(bI){return bI.d;};U.InvocationList=function(bI){return bI.$Invokes||[bI];};U.RemoveAll=function(bI,bJ){var bK;bK=U.InvocationList(bI);L.length(U.InvocationList(bJ))>1?A.FailWith("TODO: Remove multicast delegates"):void 0;return bB.CreateDelegate(L.filter(function(bL){return!bu.Equals(bL,bJ);},bK));};U.Remove=function(bI,bJ){var bK,bL,bM,bN,bO,bP,bQ;bM=U.InvocationList(bI);if(L.length(U.InvocationList(bJ))>1)A.FailWith("TODO: Remove multicast delegates");bN=[];bL=false;for(bO=L.length(bM)-1,bP=0;bO>=bP;bO--){bQ=L.get(bM,bO);!bL&&bB.DelegateEqual(bQ,bJ)?bL=true:bN.unshift(bQ);}return bB.CreateDelegate(bN);};U.DelegateTarget=function(bI){var bJ;return!bI?null:"$Target"in bI?bI.$Target:"$Invokes"in bI?(bJ=bI.$Invokes,(L.get(bJ,L.length(bJ)-1))[1]):null;};V.getHashCode=function(bI,bJ){return bI.CGetHashCode(bJ);};V.equals=function(bI){return function(bJ,bK){return bI.CEquals(bJ,bK);};};V.alreadyAdded=function(){return A.FailWith("An item with the same key has already been added.");};V.notPresent=function(){return A.FailWith("The given key was not present in the dictionary.");};W=s.KeyCollection=bB.Class({GetEnumerator$1:function(){return I.Get(M.map(function(bI){return bI.K;},this.d));},get_Count:function(){return this.d.count;},GetEnumerator0:function(){return this.GetEnumerator$1();},GetEnumerator:function(){return this.GetEnumerator$1();}},j,W);W.New=bB.Ctor(function(bI){j.New.call(this);this.d=bI;},W);X=s.ValueCollection=bB.Class({GetEnumerator$1:function(){return I.Get(M.map(function(bI){return bI.V;},this.d));},get_Count:function(){return this.d.count;},GetEnumerator0:function(){return this.GetEnumerator$1();},GetEnumerator:function(){return this.GetEnumerator$1();}},j,X);X.New=bB.Ctor(function(bI){j.New.call(this);this.d=bI;},X);Y=s.Dictionary=bB.Class({remove:function(bI){var bJ,bK,bL,bM;bJ=this;bK=this.hash(bI);bL=this.data[bK];return bL==null?false:(bM=L.filter(function(bN){return!bJ.equals.apply(null,[(A.KeyValue(bN))[0],bI]);},bL),L.length(bM)<bL.length&&(this.count=this.count-1,this.data[bK]=bM,true));},add:function(bI,bJ){var bK,bL,bM;bK=this;bL=this.hash(bI);bM=this.data[bL];bM==null?(this.count=this.count+1,this.data[bL]=new a.Array({K:bI,V:bJ})):(L.exists(function(bN){return bK.equals.apply(null,[(A.KeyValue(bN))[0],bI]);},bM)?V.alreadyAdded():void 0,this.count=this.count+1,bM.push({K:bI,V:bJ}));},set:function(bI,bJ){var bK,bL,bM,bN;bK=this;bL=this.hash(bI);bM=this.data[bL];bM==null?(this.count=this.count+1,this.data[bL]=new a.Array({K:bI,V:bJ})):(bN=L.tryFindIndex(function(bO){return bK.equals.apply(null,[(A.KeyValue(bO))[0],bI]);},bM),bN==null?(this.count=this.count+1,bM.push({K:bI,V:bJ})):bM[bN.$0]={K:bI,V:bJ});},get:function(bI){var bJ,bK;bJ=this;bK=this.data[this.hash(bI)];return bK==null?V.notPresent():L.pick(function(bL){var bM;bM=A.KeyValue(bL);return bJ.equals.apply(null,[bM[0],bI])?{$:1,$0:bM[1]}:null;},bK);},get_Keys:function(){return new W.New(this);},get_Values:function(){return new X.New(this);},TryGetValue:function(bI,bJ){var bK,bL,bM;bK=this;bL=this.data[this.hash(bI)];return bL==null?false:(bM=L.tryPick(function(bN){var bO;bO=A.KeyValue(bN);return bK.equals.apply(null,[bO[0],bI])?{$:1,$0:bO[1]}:null;},bL),bM!=null&&bM.$==1&&(bJ.set(bM.$0),true));},Remove:function(bI){return this.remove(bI);},GetEnumerator$1:function(){return I.Get0(this);},set_Item:function(bI,bJ){this.set(bI,bJ);},get_Item:function(bI){return this.get(bI);},ContainsKey:function(bI){var bJ,bK;bJ=this;bK=this.data[this.hash(bI)];return bK==null?false:L.exists(function(bL){return bJ.equals.apply(null,[(A.KeyValue(bL))[0],bI]);},bK);},Clear:function(){this.data=[];this.count=0;},Add:function(bI,bJ){this.add(bI,bJ);},GetEnumerator:function(){return I.Get0(this);},GetEnumerator0:function(){return I.Get0(L.concat(d.GetFieldValues(this.data)));}},j,Y);Y.New=bB.Ctor(function(bI,bJ){Y.New$6.call(this,bI,V.equals(bJ),function(bK){return V.getHashCode(bJ,bK);});},Y);Y.New$1=bB.Ctor(function(bI){Y.New$6.call(this,bI,bu.Equals,bu.Hash);},Y);Y.New$2=bB.Ctor(function(bI,bJ){Y.New$3.call(this,bJ);},Y);Y.New$3=bB.Ctor(function(bI){Y.New$6.call(this,[],V.equals(bI),function(bJ){return V.getHashCode(bI,bJ);});},Y);Y.New$4=bB.Ctor(function(bI){Y.New$5.call(this);},Y);Y.New$5=bB.Ctor(function(){Y.New$6.call(this,[],bu.Equals,bu.Hash);},Y);Y.New$6=bB.Ctor(function(bI,bJ,bK){var bL,bM;j.New.call(this);this.equals=bJ;this.hash=bK;this.count=0;this.data=[];bL=I.Get(bI);try{while(bL.MoveNext()){bM=bL.Current();this.set(bM.K,bM.V);}}finally{if(typeof bL=="object"&&"Dispose"in bL)bL.Dispose();}},Y);Z.withInner=function(bI,bJ){var bK;bK=new e(bI);bK.inner=bJ;return bK;};_0=b.MatchFailureException=bB.Class({},e,_0);_0.New=bB.Ctor(function(bI,bJ,bK){this.message=bI+" at "+bE(bJ)+":"+bE(bK);a.Object.setPrototypeOf(this,_0.prototype);},_0);_1=b.IndexOutOfRangeException=bB.Class({},e,_1);_1.New=bB.Ctor(function(){_1.New$1.call(this,"Index was outside the bounds of the array.");},_1);_1.New$1=bB.Ctor(function(bI){this.message=bI;a.Object.setPrototypeOf(this,_1.prototype);},_1);_2=b.OperationCanceledException=bB.Class({},e,_2);_2.New=bB.Ctor(function(bI){_2.New$1.call(this,"The operation was canceled.",null,bI);},_2);_2.New$1=bB.Ctor(function(bI,bJ,bK){this.message=bI;this.inner=bJ;a.Object.setPrototypeOf(this,_2.prototype);this.ct=bK;},_2);_3=b.ArgumentException=bB.Class({},e,_3);_3.New=bB.Ctor(function(bI,bJ){_3.New$2.call(this,bJ+"\nParameter name: "+bI);},_3);_3.New$1=bB.Ctor(function(){_3.New$2.call(this,"Value does not fall within the expected range.");},_3);_3.New$2=bB.Ctor(function(bI){this.message=bI;a.Object.setPrototypeOf(this,_3.prototype);},_3);_4=b.ArgumentOutOfRangeException=bB.Class({},e,_4);_4.New=bB.Ctor(function(bI,bJ){this.message=bJ+"\nParameter name: "+bI;a.Object.setPrototypeOf(this,_4.prototype);},_4);_4.New$1=bB.Ctor(function(bI){_4.New.call(this,bI,"Specified argument was out of the range of valid values.");},_4);_4.New$2=bB.Ctor(function(){this.message="Specified argument was out of the range of valid values.";a.Object.setPrototypeOf(this,_4.prototype);},_4);_5=b.ArgumentNullException=bB.Class({},e,_5);_5.New=bB.Ctor(function(bI,bJ){this.message=bJ+"\nParameter name: "+bI;a.Object.setPrototypeOf(this,_5.prototype);},_5);_5.New$1=bB.Ctor(function(bI){_5.New.call(this,bI,"Value cannot be null.");},_5);_5.New$2=bB.Ctor(function(){this.message="Value cannot be null.";a.Object.setPrototypeOf(this,_5.prototype);},_5);_6=b.InvalidOperationException=bB.Class({},e,_6);_6.New=bB.Ctor(function(bI){_6.New$2.call(this,bI,null);},_6);_6.New$1=bB.Ctor(function(){_6.New.call(this,"Operation is not valid due to the current state of the object.");},_6);_6.New$2=bB.Ctor(function(bI,bJ){this.message=bI;this.inner=bJ;a.Object.setPrototypeOf(this,_6.prototype);},_6);_7=b.AggregateException=bB.Class({},e,_7);_7.New=bB.Ctor(function(bI,bJ){_7.New$4.call(this,bI,[bJ]);},_7);_7.New$1=bB.Ctor(function(bI,bJ){_7.New$4.call(this,bI,L.ofSeq(bJ));},_7);_7.New$2=bB.Ctor(function(bI){_7.New$4.call(this,"One or more errors occurred.",L.ofSeq(bI));},_7);_7.New$3=bB.Ctor(function(bI){_7.New$4.call(this,"One or more errors occurred.",bI);},_7);_7.New$4=bB.Ctor(function(bI,bJ){this.message=bI;a.Object.setPrototypeOf(this,_7.prototype);this.innerExceptions=bJ;},_7);_8=b.TimeoutException=bB.Class({},e,_8);_8.New=bB.Ctor(function(){_8.New$1.call(this,"The operation has timed out.");},_8);_8.New$1=bB.Ctor(function(bI){this.message=bI;a.Object.setPrototypeOf(this,_8.prototype);},_8);_9=b.FormatException=bB.Class({},e,_9);_9.New=bB.Ctor(function(){_9.New$1.call(this,"One of the identified items was in an invalid format.");},_9);_9.New$1=bB.Ctor(function(bI){this.message=bI;a.Object.setPrototypeOf(this,_9.prototype);},_9);_=b.OverflowException=bB.Class({},e,_);_.New=bB.Ctor(function(){_.New$1.call(this,"Arithmetic operation resulted in an overflow.");},_);_.New$1=bB.Ctor(function(bI){this.message=bI;a.Object.setPrototypeOf(this,_.prototype);},_);$=b.TaskCanceledException=bB.Class({},e,$);$.New=bB.Ctor(function(){$.New$1.call(this,"A task was canceled.");},$);$.New$1=bB.Ctor(function(bI){this.message=bI;a.Object.setPrototypeOf(this,$.prototype);},$);L.create2D=function(bI){var bJ;bJ=L.ofSeq(M.map(L.ofSeq,bI));bJ.dims=2;return bJ;};bb.NewGuid=function(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(new a.RegExp("[xy]","g"),function(bI){var bJ,bK;bJ=bH.random()*16|0;bK=bI=="x"?bJ:bJ&3|8;return bK.toString(16);});};bb.TryParseExact=function(bI,bJ,bK){try{bK.set(bb.ParseExact(bI,bJ));return true;}catch(bL){return false;}};bb.TryParse=function(bI,bJ){try{bJ.set(bb.Parse(bI));return true;}catch(bK){return false;}};bb.ParseExact=function(bI,bJ){var bK,bL,bM,bO,bP,bQ,bR,bS,bT,bU,bV,bW,bX;function bN(bY){var bZ,b0,b1,b2;for(bZ=0,b0=35;bZ<=b0;bZ++){bZ===8||(bZ===13||(bZ===18||bZ===23))?bY[bZ]!=="-"?bb.ShapeError():void 0:(b2=bY[bZ],!("0"<=b2&&b2<="9"||"a"<=b2&&b2<="f")?bb.ShapeError():void 0);}return bY;}bO=bJ.toUpperCase();if(bO==="N"){bP=bq.Trim(bI).toLowerCase();if(bP.length!==32)bb.ShapeError();for(bQ=0,bR=31;bQ<=bR;bQ++){bS=bP[bQ];!("0"<=bS&&bS<="9"||"a"<=bS&&bS<="f")?bb.ShapeError():void 0;}return bq.Substring(bP,0,8)+"-"+bq.Substring(bP,8,4)+"-"+bq.Substring(bP,12,4)+"-"+bq.Substring(bP,16,4)+"-"+bP.substring(20);}else if(bO==="D"){bK=bq.Trim(bI).toLowerCase();bK.length!==36?bb.ShapeError():void 0;return bN(bK);}else if(bO==="B"){bL=bq.Trim(bI).toLowerCase();bL.length!==38||bL[0]!=="{"||bL[17]!=="}"?bb.ShapeError():void 0;return bN(bq.Substring(bL,1,36));}else if(bO==="P"){bM=bq.Trim(bI).toLowerCase();bM.length!==38||bM[0]!=="("||bM[17]!==")"?bb.ShapeError():void 0;return bN(bq.Substring(bM,1,36));}else if(bO==="X"){bT=bq.Trim(bI).toLowerCase();if(bT.length!==68)bb.ShapeError();for(bU=0,bV=67;bU<=bV;bU++){switch(bU){case 26:case 0:if(bT[bU]!=="{")bb.ShapeError();break;case 62:case 57:case 52:case 47:case 42:case 37:case 32:case 27:case 19:case 12:case 1:if(bT[bU]!=="0")bb.ShapeError();break;case 63:case 58:case 53:case 48:case 43:case 38:case 33:case 28:case 20:case 13:case 2:if(bT[bU]!=="x")bb.ShapeError();break;case 61:case 56:case 51:case 46:case 41:case 36:case 31:case 25:case 18:case 11:if(bT[bU]!==",")bb.ShapeError();break;case 67:case 66:if(bT[bU]!=="{")bb.ShapeError();break;default:bX=bT[bU];!("0"<=bX&&bX<="9"||"a"<=bX&&bX<="f")?bb.ShapeError():void 0;break;}}return bq.Substring(bT,3,8)+"-"+bq.Substring(bT,14,4)+"-"+bq.Substring(bT,21,4)+"-"+bq.Substring(bT,29,2)+bq.Substring(bT,34,2)+"-"+bq.Substring(bT,39,2)+bq.Substring(bT,44,2)+bq.Substring(bT,49,2)+bq.Substring(bT,54,2)+bq.Substring(bT,59,2)+bq.Substring(bT,64,2);}else return bb.FormatError();};bb.Parse=function(bI){var bJ,bK,bL;try{return bb.ParseExact(bI,"D");}catch(bM){try{bJ=bb.ParseExact(bI,"B");}catch(bN){try{bK=bb.ParseExact(bI,"P");}catch(bO){try{bL=bb.ParseExact(bI,"N");}catch(bP){bL=bb.ParseExact(bI,"X");}bK=bL;}bJ=bK;}return bJ;}};bb.ToString=function(bI,bJ){var bK;bK=bJ.toUpperCase();return bK==="N"?bq.Replace(bI,"-",""):bK==="D"?bI:bK==="B"?"{"+bI+"}":bK==="P"?"("+bI+")":bK==="X"?"{0x"+bq.Substring(bI,0,8)+",0x"+bq.Substring(bI,9,4)+",0x"+bq.Substring(bI,14,4)+",{0x"+bq.Substring(bI,19,2)+",0x"+bq.Substring(bI,21,2)+",0x"+bq.Substring(bI,24,2)+",0x"+bq.Substring(bI,26,2)+",0x"+bq.Substring(bI,28,2)+",0x"+bq.Substring(bI,30,2)+",0x"+bq.Substring(bI,32,2)+",0x"+bq.Substring(bI,34,2)+"}}":bb.FormatError();};bb.ParseError=function(){throw new _9.New$1("Unrecognized Guid format.");};bb.ShapeError=function(){throw new _9.New$1("Guid should contain 32 digits with 4 dashes (xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx).");};bb.HexaError=function(){throw new _9.New$1("Hexadecimal Guid printing not implemented by WebSharper.");};bb.FormatError=function(){throw new _9.New$1("Format String can be only \"D\", \"d\", \"N\", \"n\", \"P\", \"p\", \"B\", \"b\", \"X\" or \"x\".");};bc.concat=function(bI){var bJ,bK;bJ=[];for(var bL in bI)bJ.push.apply(bJ,bI[bL]);return bJ;};bd=s.HashSet=bB.Class({add:function(bI){var bJ,bK;bJ=this.hash(bI);bK=this.data[bJ];return bK==null?(this.data[bJ]=[bI],this.count=this.count+1,true):this.arrContains(bI,bK)?false:(bK.push(bI),this.count=this.count+1,true);},arrRemove:function(bI,bJ){var bK,bL,bM,bN;bK=true;bL=0;bN=bJ.length;while(bK&&bL<bN)if(this.equals.apply(null,[bJ[bL],bI])){bJ.splice.apply(bJ,[bL,1]);bK=false;}else bL=bL+1;return!bK;},arrContains:function(bI,bJ){var bK,bL,bM,bN;bK=true;bL=0;bN=bJ.length;while(bK&&bL<bN)if(this.equals.apply(null,[bJ[bL],bI]))bK=false;else bL=bL+1;return!bK;},UnionWith:function(bI){var bJ;bJ=I.Get(bI);try{while(bJ.MoveNext())this.Add(bJ.Current());}finally{if(typeof bJ=="object"&&"Dispose"in bJ)bJ.Dispose();}},SymmetricExceptWith:function(bI){var bJ,bK;bJ=I.Get(bI);try{while(bJ.MoveNext()){bK=bJ.Current();this.Contains(bK)?this.Remove(bK):this.Add(bK);}}finally{if(typeof bJ=="object"&&"Dispose"in bJ)bJ.Dispose();}},SetEquals:function(bI){var bJ;bJ=new bd.New$4(bI,this.equals,this.hash);return this.get_Count()===bJ.get_Count()&&this.IsSupersetOf(bJ);},RemoveWhere:function(bI){var bJ,bK,bL,bM,bN;bK=bc.concat(this.data);bJ=0;for(bL=0,bM=bK.length-1;bL<=bM;bL++){bN=bK[bL];bI(bN)?this.Remove(bN)?bJ=bJ+1:void 0:void 0;}return bJ;},Remove:function(bI){var bJ;bJ=this.data[this.hash(bI)];return bJ==null?false:this.arrRemove(bI,bJ)&&(this.count=this.count-1,true);},Overlaps:function(bI){var bJ;bJ=this;return M.exists(function(bK){return bJ.Contains(bK);},bI);},IsSupersetOf:function(bI){var bJ;bJ=this;return M.forall(function(bK){return bJ.Contains(bK);},bI);},IsSubsetOf:function(bI){var bJ;bJ=new bd.New$4(bI,this.equals,this.hash);return L.forall(function(bK){return bJ.Contains(bK);},bc.concat(this.data));},IsProperSupersetOf:function(bI){var bJ;bJ=L.ofSeq(bI);return this.count>L.length(bJ)&&this.IsSupersetOf(bJ);},IsProperSubsetOf:function(bI){var bJ;bJ=L.ofSeq(bI);return this.count<L.length(bJ)&&this.IsSubsetOf(bJ);},IntersectWith:function(bI){var bJ,bK,bL,bM,bN;bJ=new bd.New$4(bI,this.equals,this.hash);bK=bc.concat(this.data);for(bL=0,bM=bK.length-1;bL<=bM;bL++){bN=bK[bL];!bJ.Contains(bN)?this.Remove(bN):void 0;}},ExceptWith:function(bI){var bJ;bJ=I.Get(bI);try{while(bJ.MoveNext())this.Remove(bJ.Current());}finally{if(typeof bJ=="object"&&"Dispose"in bJ)bJ.Dispose();}},get_Count:function(){return this.count;},CopyTo:function(bI){var bJ,bK,bL,bM;bJ=0;bK=bc.concat(this.data);for(bL=0,bM=bK.length-1;bL<=bM;bL++)L.set(bI,bL,bK[bL]);},Contains:function(bI){var bJ;bJ=this.data[this.hash(bI)];return bJ==null?false:this.arrContains(bI,bJ);},Clear:function(){this.data=[];this.count=0;},Add:function(bI){return this.add(bI);},GetEnumerator:function(){return I.Get(bc.concat(this.data));},GetEnumerator0:function(){return I.Get(bc.concat(this.data));}},j,bd);bd.New=bB.Ctor(function(bI,bJ){bd.New$4.call(this,bI,V.equals(bJ),function(bK){return V.getHashCode(bJ,bK);});},bd);bd.New$1=bB.Ctor(function(bI){bd.New$4.call(this,[],V.equals(bI),function(bJ){return V.getHashCode(bI,bJ);});},bd);bd.New$2=bB.Ctor(function(bI){bd.New$4.call(this,bI,bu.Equals,bu.Hash);},bd);bd.New$3=bB.Ctor(function(){bd.New$4.call(this,[],bu.Equals,bu.Hash);},bd);bd.New$4=bB.Ctor(function(bI,bJ,bK){var bL;j.New.call(this);this.equals=bJ;this.hash=bK;this.data=[];this.count=0;bL=I.Get(bI);try{while(bL.MoveNext())this.add(bL.Current());}finally{if(typeof bL=="object"&&"Dispose"in bL)bL.Dispose();}},bd);bf.New=function(bI,bJ,bK){return{c:bI,v:bJ,f:bK};};bg.Force=function(bI){return bI.f();};bg.CreateFromValue=function(bI){return bf.New(true,bI,bg.cachedLazy);};bg.Create=function(bI){return bf.New(false,bI,bg.forceLazy);};bg.forceLazy=function(){var bI;bI=this.v();this.c=true;this.v=bI;this.f=bg.cachedLazy;return bI;};bg.cachedLazy=function(){return this.v;};bh=N.T=bB.Class({GetSlice:function(bI,bJ){var bK;return bI!=null&&bI.$==1?bJ!=null&&bJ.$==1?(bK=bI.$0,N.ofSeq(M.take(bJ.$0-bK+1,N.skip(bK,this)))):N.skip(bI.$0,this):bJ!=null&&bJ.$==1?N.ofSeq(M.take(bJ.$0+1,this)):this;},get_Item:function(bI){return M.nth(bI,this);},get_Length:function(){return N.length(this);},GetEnumerator:function(){return new J.New(this,null,function(bI){var bJ;bJ=bI.s;return bJ.$==0?false:(bI.c=bJ.$0,bI.s=bJ.$1,true);},void 0);},GetEnumerator0:function(){return I.Get(this);}},null,bh);bh.Empty=new bh({$:0});N.allPairs=function(bI,bJ){return N.ofArray(L.allPairs(L.ofList(bI),L.ofList(bJ)));};N.append=function(bI,bJ){var bK,bL,bM,bN,bO;if(bI.$==0)return bJ;else if(bJ.$==0)return bI;else{bN=new bh({$:1});bK=bN;bL=bI;bM=true;while(bM){bK.$0=bL.$0;bL=bL.$1;bL.$==0?bM=false:bK=(bO=new bh({$:1}),bK.$1=bO,bO);}bK.$1=bJ;return bN;}};N.choose=function(bI,bJ){return N.ofSeq(M.choose(bI,bJ));};N.collect=function(bI,bJ){return N.ofSeq(M.collect(bI,bJ));};N.concat=function(bI){return N.ofSeq(M.concat(bI));};N.exists=function(bI,bJ){var bK,bL;bK=false;bL=bJ;while(!bK&&bL.$==1){bK=bI(bL.$0);bL=bL.$1;}return bK;};N.exists2=function(bI,bJ,bK){var bL,bM,bN;bL=false;bM=bJ;bN=bK;while(!bL&&bM.$==1&&bN.$==1){bL=bI(bM.$0,bN.$0);bM=bM.$1;bN=bN.$1;}!bL&&(bM.$==1||bN.$==1)?N.badLengths():void 0;return bL;};N.filter=function(bI,bJ){return N.ofSeq(M.filter(bI,bJ));};N.fold2=function(bI,bJ,bK,bL){return L.fold2(bI,bJ,L.ofList(bK),L.ofList(bL));};N.foldBack=function(bI,bJ,bK){return L.foldBack(bI,L.ofList(bJ),bK);};N.foldBack2=function(bI,bJ,bK,bL){return L.foldBack2(bI,L.ofList(bJ),L.ofList(bK),bL);};N.forAll=function(bI,bJ){var bK,bL;bK=true;bL=bJ;while(bK&&bL.$==1){bK=bI(bL.$0);bL=bL.$1;}return bK;};N.forall2=function(bI,bJ,bK){var bL,bM,bN;bL=true;bM=bJ;bN=bK;while(bL&&bM.$==1&&bN.$==1){bL=bI(bM.$0,bN.$0);bM=bM.$1;bN=bN.$1;}bL&&(bM.$==1||bN.$==1)?N.badLengths():void 0;return bL;};N.head=function(bI){return bI.$==1?bI.$0:N.listEmpty();};N.init=function(bI,bJ){return N.ofArray(L.init(bI,bJ));};N.iter=function(bI,bJ){var bK;bK=bJ;while(bK.$==1){bI(N.head(bK));bK=N.tail(bK);}};N.iter2=function(bI,bJ,bK){var bL,bM;bL=bJ;bM=bK;while(bL.$==1){bM.$==0?N.badLengths():void 0;bI(N.head(bL),N.head(bM));bL=N.tail(bL);bM=N.tail(bM);}bM.$==1?N.badLengths():void 0;};N.iteri=function(bI,bJ){var bK,bL;bK=bJ;bL=0;while(bK.$==1){bI(bL,N.head(bK));bK=N.tail(bK);bL=bL+1;}};N.iteri2=function(bI,bJ,bK){var bL,bM,bN;bL=bJ;bM=bK;bN=0;while(bL.$==1){bM.$==0?N.badLengths():void 0;bI(bN,N.head(bL),N.head(bM));bL=N.tail(bL);bM=N.tail(bM);bN=bN+1;}bM.$==1?N.badLengths():void 0;};N.length=function(bI){var bJ,bK;bJ=bI;bK=0;while(bJ.$==1){bJ=N.tail(bJ);bK=bK+1;}return bK;};N.map=function(bI,bJ){var bK,bL,bM,bN,bO;if(bJ.$==0)return bJ;else{bN=new bh({$:1});bK=bN;bL=bJ;bM=true;while(bM){bK.$0=bI(bL.$0);bL=bL.$1;bL.$==0?bM=false:bK=(bO=new bh({$:1}),bK.$1=bO,bO);}bK.$1=bh.Empty;return bN;}};N.map2=function(bI,bJ,bK){var bL,bM,bN,bO,bP,bQ;bL=bJ.$==1&&bK.$==1;if(!bL)return bJ.$==1||bK.$==1?N.badLengths():bJ;else{bP=new bh({$:1});bM=bP;bN=bJ;bO=bK;while(bL){bM.$0=bI(bN.$0,bO.$0);bN=bN.$1;bO=bO.$1;bN.$==1&&bO.$==1?bM=(bQ=new bh({$:1}),bM.$1=bQ,bQ):bL=false;}if(bN.$==1||bO.$==1)N.badLengths();bM.$1=bh.Empty;return bP;}};N.map3=function(bI,bJ,bK,bL){var bM,bN,bO,bP,bQ,bR,bS;bM=bJ.$==1&&bK.$==1&&bL.$==1;if(!bM)return bJ.$==1||bK.$==1||bL.$==1?N.badLengths():bJ;else{bR=new bh({$:1});bN=bR;bO=bJ;bP=bK;bQ=bL;while(bM){bN.$0=bI(bO.$0,bP.$0,bQ.$0);bO=bO.$1;bP=bP.$1;bQ=bQ.$1;bO.$==1&&bP.$==1&&bQ.$==1?bN=(bS=new bh({$:1}),bN.$1=bS,bS):bM=false;}if(bO.$==1||bP.$==1||bQ.$==1)N.badLengths();bN.$1=bh.Empty;return bR;}};N.mapi=function(bI,bJ){var bK,bL,bM,bN,bO,bP;if(bJ.$==0)return bJ;else{bO=new bh({$:1});bK=bO;bL=bJ;bM=0;bN=true;while(bN){bK.$0=bI(bM,bL.$0);bL=bL.$1;bL.$==0?bN=false:(bK=(bP=new bh({$:1}),bK.$1=bP,bP),bM=bM+1);}bK.$1=bh.Empty;return bO;}};N.mapi2=function(bI,bJ,bK){var bL,bM,bN,bO,bP,bQ,bR;bL=bJ.$==1&&bK.$==1;if(!bL)return bJ.$==1||bK.$==1?N.badLengths():bJ;else{bQ=new bh({$:1});bM=bQ;bN=bJ;bO=bK;bP=0;while(bL){bM.$0=bI(bP,bN.$0,bO.$0);bN=bN.$1;bO=bO.$1;bN.$==1&&bO.$==1?(bM=(bR=new bh({$:1}),bM.$1=bR,bR),bP=bP+1):bL=false;}if(bN.$==1||bO.$==1)N.badLengths();bM.$1=bh.Empty;return bQ;}};N.max=function(bI){var bJ,bK,bL;N.nonEmpty(bI);bJ=bI.$0;bK=bI.$1;while(bK.$==1){bL=bK.$0;bu.Compare(bL,bJ)===1?bJ=bL:void 0;bK=bK.$1;}return bJ;};N.maxBy=function(bI,bJ){var bK,bL,bM,bN,bO;N.nonEmpty(bJ);bK=bJ.$0;bL=bI(bK);bM=bJ.$1;while(bM.$==1){bN=bM.$0;bO=bI(bN);bu.Compare(bO,bL)===1?(bK=bN,bL=bO):void 0;bM=bM.$1;}return bK;};N.min=function(bI){var bJ,bK,bL;N.nonEmpty(bI);bJ=bI.$0;bK=bI.$1;while(bK.$==1){bL=bK.$0;bu.Compare(bL,bJ)===-1?bJ=bL:void 0;bK=bK.$1;}return bJ;};N.minBy=function(bI,bJ){var bK,bL,bM,bN,bO;N.nonEmpty(bJ);bK=bJ.$0;bL=bI(bK);bM=bJ.$1;while(bM.$==1){bN=bM.$0;bO=bI(bN);bu.Compare(bO,bL)===-1?(bK=bN,bL=bO):void 0;bM=bM.$1;}return bK;};N.ofArray=function(bI){var bJ,bK,bL;bJ=bh.Empty;for(bK=L.length(bI)-1,bL=0;bK>=bL;bK--)bJ=new bh({$:1,$0:L.get(bI,bK),$1:bJ});return bJ;};N.ofSeq=function(bI){var bJ,bK,bL,bM,bN,bO;if(bI instanceof bh)return bI;else if(bI instanceof a.Array)return N.ofArray(bI);else{bJ=I.Get(bI);try{bL=bJ.MoveNext();if(!bL)bK=bh.Empty;else{bN=new bh({$:1});bM=bN;while(bL){bM.$0=bJ.Current();bJ.MoveNext()?bM=(bO=new bh({$:1}),bM.$1=bO,bO):bL=false;}bM.$1=bh.Empty;bK=bN;}return bK;}finally{if(typeof bJ=="object"&&"Dispose"in bJ)bJ.Dispose();}}};N.partition=function(bI,bJ){var bK;bK=L.partition(bI,L.ofList(bJ));return[N.ofArray(bK[0]),N.ofArray(bK[1])];};N.permute=function(bI,bJ){return N.ofArray(L.permute(bI,L.ofList(bJ)));};N.reduce=function(bI,bJ){var bK,bL;N.nonEmpty(bJ);bK=bJ.$0;bL=bJ.$1;while(bL.$==1){bK=bI(bK,bL.$0);bL=bL.$1;}return bK;};N.reduceBack=function(bI,bJ){return L.reduceBack(bI,L.ofList(bJ));};N.replicate=function(bI,bJ){return N.ofArray(L.create(bI,bJ));};N.rev=function(bI){var bJ,bK;bJ=bh.Empty;bK=bI;while(bK.$==1){bJ=new bh({$:1,$0:bK.$0,$1:bJ});bK=bK.$1;}return bJ;};N.scan=function(bI,bJ,bK){return N.ofSeq(M.scan(bI,bJ,bK));};N.scanBack=function(bI,bJ,bK){return N.ofArray(L.scanBack(bI,L.ofList(bJ),bK));};N.sort=function(bI){var bJ;bJ=L.ofList(bI);L.sortInPlace(bJ);return N.ofArray(bJ);};N.sortBy=function(bI,bJ){var bK;bK=L.ofList(bJ);L.sortInPlaceBy(bI,bK);return N.ofArray(bK);};N.sortByDescending=function(bI,bJ){var bK;bK=L.ofList(bJ);L.sortInPlaceByDescending(bI,bK);return N.ofArray(bK);};N.sortDescending=function(bI){var bJ;bJ=L.ofList(bI);L.sortInPlaceByDescending(a.id,bJ);return N.ofArray(bJ);};N.sortWith=function(bI,bJ){var bK;bK=L.ofList(bJ);L.sortInPlaceWith(bI,bK);return N.ofArray(bK);};N.tail=function(bI){return bI.$==1?bI.$1:N.listEmpty();};N.transpose=function(bI){return N.ofSeq(M.map(N.ofArray,L.transposeArray(L.ofSeq(M.map(L.ofList,bI)))));};N.unzip=function(bI){var bJ,bK,bL,bM;bJ=[];bK=[];bL=I.Get(bI);try{while(bL.MoveNext()){bM=bL.Current();bJ.push(bM[0]);bK.push(bM[1]);}}finally{if(typeof bL=="object"&&"Dispose"in bL)bL.Dispose();}return[N.ofArray(bJ.slice(0)),N.ofArray(bK.slice(0))];};N.unzip3=function(bI){var bJ,bK,bL,bM,bN;bJ=[];bK=[];bL=[];bM=I.Get(bI);try{while(bM.MoveNext()){bN=bM.Current();bJ.push(bN[0]);bK.push(bN[1]);bL.push(bN[2]);}}finally{if(typeof bM=="object"&&"Dispose"in bM)bM.Dispose();}return[N.ofArray(bJ.slice(0)),N.ofArray(bK.slice(0)),N.ofArray(bL.slice(0))];};N.zip=function(bI,bJ){return N.map2(function(bK,bL){return[bK,bL];},bI,bJ);};N.zip3=function(bI,bJ,bK){return N.map3(function(bL,bM,bN){return[bL,bM,bN];},bI,bJ,bK);};N.chunkBySize=function(bI,bJ){return N.map(N.ofArray,N.ofSeq(M.chunkBySize(bI,bJ)));};N.compareWith=function(bI,bJ,bK){return M.compareWith(bI,bJ,bK);};N.countBy=function(bI,bJ){return N.ofArray(L.countBy(bI,L.ofList(bJ)));};N.distinct=function(bI){return N.ofSeq(M.distinct(bI));};N.distinctBy=function(bI,bJ){return N.ofSeq(M.distinctBy(bI,bJ));};N.splitInto=function(bI,bJ){return N.map(N.ofArray,N.ofArray(L.splitInto(bI,L.ofList(bJ))));};N.except=function(bI,bJ){return N.ofSeq(M.except(bI,bJ));};N.tryFindBack=function(bI,bJ){return L.tryFindBack(bI,L.ofList(bJ));};N.findBack=function(bI,bJ){var bK;bK=N.tryFindBack(bI,bJ);return bK==null?A.FailWith("KeyNotFoundException"):bK.$0;};N.findIndexBack=function(bI,bJ){var bK;bK=L.tryFindIndexBack(bI,L.ofList(bJ));return bK==null?A.FailWith("KeyNotFoundException"):bK.$0;};N.groupBy=function(bI,bJ){var bK;function bL(bM,bN){return[bM,N.ofArray(bN)];}bK=L.groupBy(bI,L.ofList(bJ));L.mapInPlace(function(bM){return bL(bM[0],bM[1]);},bK);return N.ofArray(bK);};N.last=function(bI){var bJ,bK;N.nonEmpty(bI);bJ=bI;bK=bJ.$1;while(bK.$==1){bJ=bK;bK=bJ.$1;}return bJ.$0;};N.contains=function(bI,bJ){var bK,bL;bK=false;bL=bJ;while(!bK&&bL.$==1){bK=bu.Equals(bI,bL.$0);bL=bL.$1;}return bK;};N.mapFold=function(bI,bJ,bK){var bL;bL=L.mapFold(bI,bJ,L.ofList(bK));return[N.ofArray(bL[0]),bL[1]];};N.mapFoldBack=function(bI,bJ,bK){var bL;bL=L.mapFoldBack(bI,L.ofList(bJ),bK);return[N.ofArray(bL[0]),bL[1]];};N.pairwise=function(bI){return N.ofSeq(M.pairwise(bI));};N.indexed=function(bI){return N.mapi(function(bJ,bK){return[bJ,bK];},bI);};N.tryHead=function(bI){return bI.$==0?null:{$:1,$0:bI.$0};};N.exactlyOne=function(bI){var bJ;return bI.$==1&&(bI.$1.$==0&&(bJ=bI.$0,true))?bJ:A.FailWith("The input does not have precisely one element.");};N.unfold=function(bI,bJ){return N.ofSeq(M.unfold(bI,bJ));};N.windowed=function(bI,bJ){return N.ofSeq(M.map(N.ofArray,M.windowed(bI,bJ)));};N.splitAt=function(bI,bJ){return[N.ofSeq(M.take(bI,bJ)),N.skip(bI,bJ)];};N.nonEmpty=function(bI){if(bI.$==0)N.listEmpty();};N.listEmpty=function(){return A.FailWith("The input list was empty.");};N.badLengths=function(){return A.FailWith("The lists have different lengths.");};B.getOrValue=function(bI,bJ){return bI===null?bJ:bI;};B.get=function(bI){return bI===null?A.FailWith("Nullable object must have a value."):bI;};A.range=function(bI,bJ){var bK;bK=1+bJ-bI;return bK<=0?[]:M.init(bK,function(bL){return bL+bI;});};A.step=function(bI,bJ,bK){var bL;bL=A.Sign(bJ);return M.takeWhile(function(bM){return bL*(bK-bM)>=0;},M.initInfinite(function(bM){return bI+bM*bJ;}));};A.KeyValue=function(bI){return[bI.K,bI.V];};A.Truncate=function(bI){return bI<0?bH.ceil(bI):bH.floor(bI);};A.Sign=function(bI){return bI===0?0:bI<0?-1:1;};A.Pown=function(bI,bJ){function bK(bL){var bM;return bL===1?bI:bL%2===0?(bM=bK(bL/2>>0),bM*bM):bI*bK(bL-1);}return bK(bJ);};A.toInt=function(bI){var bJ;bJ=A.toUInt(bI);return bJ>=2147483648?bJ-4294967296:bJ;};A.toUInt=function(bI){return(bI<0?bH.ceil(bI):bH.floor(bI))>>>0;};A.InvalidArg=function(bI,bJ){throw new _3.New(bI,bJ);};A.InvalidOp=function(bI){throw new _6.New(bI);};A.FailWith=function(bI){throw new e(bI);};bi.string=function(bI,bJ,bK){return bJ==null?bK!=null&&bK.$==1?bI.slice(0,bK.$0+1):"":bK==null?bI.slice(bJ.$0):bI.slice(bJ.$0,bK.$0+1);};bi.array=function(bI,bJ,bK){return bJ==null?bK!=null&&bK.$==1?bI.slice(0,bK.$0+1):[]:bK==null?bI.slice(bJ.$0):bI.slice(bJ.$0,bK.$0+1);};bi.setArray=function(bI,bJ,bK,bL){var bM;bM=bJ!=null&&bJ.$==1?bJ.$0:0;L.setSub(bI,bM,(bK!=null&&bK.$==1?bK.$0:bI.length-1)-bM+1,bL);};bi.array2D=function(bI,bJ,bK,bL,bM){var bN,bO;bN=bJ!=null&&bJ.$==1?bJ.$0:0;bO=bL!=null&&bL.$==1?bL.$0:0;return L.sub2D(bI,bN,bO,(bK!=null&&bK.$==1?bK.$0:bI.length-1)-bN+1,(bM!=null&&bM.$==1?bM.$0:(bI.length?bI[0].length:0)-1)-bO+1);};bi.array2Dfix1=function(bI,bJ,bK,bL){var bM,bN,bO,bP,bQ,bR;bM=bK!=null&&bK.$==1?bK.$0:0;bN=bL!=null&&bL.$==1?bL.$0:(bI.length?bI[0].length:0)-1;bO=bN-bM+1;bP=new a.Array(bO);for(bQ=0,bR=bO-1;bQ<=bR;bQ++)L.set(bP,bQ,L.get2D(bI,bJ,bM+bQ));return bP;};bi.array2Dfix2=function(bI,bJ,bK,bL){var bM,bN,bO,bP,bQ,bR;bM=bJ!=null&&bJ.$==1?bJ.$0:0;bN=bK!=null&&bK.$==1?bK.$0:bI.length-1;bO=bN-bM+1;bP=new a.Array(bO);for(bQ=0,bR=bO-1;bQ<=bR;bQ++)L.set(bP,bQ,L.get2D(bI,bM+bQ,bL));return bP;};bi.setArray2Dfix1=function(bI,bJ,bK,bL,bM){var bN,bO,bP,bQ;bN=bK!=null&&bK.$==1?bK.$0:0;bO=bL!=null&&bL.$==1?bL.$0:(bI.length?bI[0].length:0)-1;for(bP=0,bQ=bO-bN+1-1;bP<=bQ;bP++)L.set2D(bI,bJ,bN+bP,L.get(bM,bP));};bi.setArray2Dfix2=function(bI,bJ,bK,bL,bM){var bN,bO,bP,bQ;bN=bJ!=null&&bJ.$==1?bJ.$0:0;bO=bK!=null&&bK.$==1?bK.$0:bI.length-1;for(bP=0,bQ=bO-bN+1-1;bP<=bQ;bP++)L.set2D(bI,bN+bP,bL,L.get(bM,bP));};bi.setArray2D=function(bI,bJ,bK,bL,bM,bN){var bO,bP;bO=bJ!=null&&bJ.$==1?bJ.$0:0;bP=bL!=null&&bL.$==1?bL.$0:0;L.setSub2D(bI,bO,bP,(bK!=null&&bK.$==1?bK.$0:bI.length-1)-bO+1,(bM!=null&&bM.$==1?bM.$0:(bI.length?bI[0].length:0)-1)-bP+1,bN);};bj.filter=function(bI,bJ){var bK;return bJ!=null&&bJ.$==1&&(bI(bJ.$0)&&(bK=bJ.$0,true))?bJ:null;};bj.fold=function(bI,bJ,bK){return bK==null?bJ:bI(bJ,bK.$0);};bj.foldBack=function(bI,bJ,bK){return bJ==null?bK:bI(bJ.$0,bK);};bj.ofNullable=function(bI){return bI==null?null:{$:1,$0:B.get(bI)};};bj.ofObj=function(bI){return bI==null?null:{$:1,$0:bI};};bj.toArray=function(bI){return bI==null?[]:[bI.$0];};bj.toList=function(bI){return bI==null?bh.Empty:N.ofArray([bI.$0]);};bj.toNullable=function(bI){return bI!=null&&bI.$==1?bI.$0:null;};bj.toObj=function(bI){return bI==null?null:bI.$0;};bk.CopyTo=function(bI,bJ,bK){L.blit(bI,0,bJ,bK,L.length(bI));};bk.Contains=function(bI,bJ){return M.exists(function(bK){return bu.Equals(bJ,bK);},bI);};bk.Clear=function(bI){bI.splice(0,L.length(bI));};bl=b.Random=bB.Class({NextBytes:function(bI){var bJ,bK;for(bJ=0,bK=L.length(bI)-1;bJ<=bK;bJ++)L.set(bI,bJ,bH.floor(bH.random()*256));},Next:function(bI,bJ){return bI>bJ?A.FailWith("'minValue' cannot be greater than maxValue."):bI+bH.floor(bH.random()*(bJ-bI));},Next$1:function(bI){return bI<0?A.FailWith("'maxValue' must be greater than zero."):bH.floor(bH.random()*bI);},Next$2:function(){return bH.floor(bH.random()*2147483648);}},j,bl);bl.New=bB.Ctor(function(){j.New.call(this);},bl);bm.New=function(bI){return[bI];};bn.MapError=function(bI,bJ){return bJ.$==1?{$:1,$0:bI(bJ.$0)}:{$:0,$0:bJ.$0};};bn.Map=function(bI,bJ){return bJ.$==1?{$:1,$0:bJ.$0}:{$:0,$0:bI(bJ.$0)};};bn.Bind=function(bI,bJ){return bJ.$==1?{$:1,$0:bJ.$0}:bI(bJ.$0);};M.enumFinally=function(bI,bJ){return{GetEnumerator:function(){var bK;try{bK=I.Get(bI);}catch(bL){bJ();throw bL;}return new J.New(null,null,function(bM){return bK.MoveNext()&&(bM.c=bK.Current(),true);},function(){bK.Dispose();bJ();});}};};M.enumUsing=function(bI,bJ){return{GetEnumerator:function(){var bK;try{bK=I.Get(bJ(bI));}catch(bL){bI.Dispose();throw bL;}return new J.New(null,null,function(bM){return bK.MoveNext()&&(bM.c=bK.Current(),true);},function(){bK.Dispose();bI.Dispose();});}};};M.enumWhile=function(bI,bJ){return{GetEnumerator:function(){return new J.New(null,null,function(bK){var bL;while(true){bL=bK.s;if(bu.Equals(bL,null)){if(bI()){bK.s=I.Get(bJ);bK=bK;}else return false;}else if(bL.MoveNext()){bK.c=bL.Current();return true;}else{bL.Dispose();bK.s=null;bK=bK;}}},function(bK){var bL;bL=bK.s;!bu.Equals(bL,null)?bL.Dispose():void 0;});}};};bo.createEvent=function(bI,bJ,bK){var bL;bL={AddHandler:bI,RemoveHandler:bJ,Subscribe:function(bM){var bN;bN=bK(function(){return function(bO){return bM.OnNext(bO);};});bI(bN);return{Dispose:function(){return bJ(bN);}};}};j.New.call(bL);return bL;};M.allPairs=function(bI,bJ){var bK;bK=M.cache(bJ);return M.collect(function(bL){return M.map(function(bM){return[bL,bM];},bK);},bI);};M.append=function(bI,bJ){return{GetEnumerator:function(){var bK,bL;bK=I.Get(bI);bL=[true];return new J.New(bK,null,function(bM){var bN;return bM.s.MoveNext()?(bM.c=bM.s.Current(),true):(bN=bM.s,!bu.Equals(bN,null)?bN.Dispose():void 0,bM.s=null,bL[0]&&(bL[0]=false,bM.s=I.Get(bJ),bM.s.MoveNext()?(bM.c=bM.s.Current(),true):(bM.s.Dispose(),bM.s=null,false)));},function(bM){var bN;bN=bM.s;!bu.Equals(bN,null)?bN.Dispose():void 0;});}};};M.average=function(bI){var bJ,bK;bJ=M.fold(function(bL,bM){return(function(bN){var bO,bP;bO=bN[0];bP=bN[1];return function(bQ){return[bO+1,bP+bQ];};}(bL))(bM);},[0,0],bI);bK=bJ[0];return bK===0?M.seqEmpty():bJ[1]/bK;};M.averageBy=function(bI,bJ){var bK,bL;bK=M.fold(function(bM,bN){return(function(bO){var bP,bQ;bP=bO[0];bQ=bO[1];return function(bR){return[bP+1,bQ+bI(bR)];};}(bM))(bN);},[0,0],bJ);bL=bK[0];return bL===0?M.seqEmpty():bK[1]/bL;};M.cache=function(bI){var bJ,bK;bJ=[];bK=[I.Get(bI)];return{GetEnumerator:function(){return new J.New(0,null,function(bL){var bM;return bL.s<bJ.length?(bL.c=bJ[bL.s],bL.s=bL.s+1,true):(bM=bK[0],bu.Equals(bM,null)?false:bM.MoveNext()?(bL.s=bL.s+1,bL.c=bM.Current(),bJ.push(bL.c),true):(bM.Dispose(),bK[0]=null,false));},void 0);}};};M.choose=function(bI,bJ){return M.collect(function(bK){var bL;bL=bI(bK);return bL==null?bh.Empty:N.ofArray([bL.$0]);},bJ);};M.collect=function(bI,bJ){return M.concat(M.map(bI,bJ));};M.compareWith=function(bI,bJ,bK){var bL,bM,bN,bO,bP;bL=I.Get(bJ);try{bN=I.Get(bK);try{bO=0;bP=true;while(bP&&bO===0)if(bL.MoveNext())bO=bN.MoveNext()?bI(bL.Current(),bN.Current()):1;else if(bN.MoveNext())bO=-1;else bP=false;bM=bO;}finally{if(typeof bN=="object"&&"Dispose"in bN)bN.Dispose();}return bM;}finally{if(typeof bL=="object"&&"Dispose"in bL)bL.Dispose();}};M.concat=function(bI){return{GetEnumerator:function(){var bJ;bJ=I.Get(bI);return new J.New(null,null,function(bK){var bL;while(true){bL=bK.s;if(bu.Equals(bL,null)){if(bJ.MoveNext()){bK.s=I.Get(bJ.Current());bK=bK;}else{bJ.Dispose();return false;}}else if(bL.MoveNext()){bK.c=bL.Current();return true;}else{bK.Dispose();bK.s=null;bK=bK;}}},function(bK){var bL;bL=bK.s;!bu.Equals(bL,null)?bL.Dispose():void 0;!bu.Equals(bJ,null)?bJ.Dispose():void 0;});}};};M.countBy=function(bI,bJ){return M.delay(function(){return L.countBy(bI,L.ofSeq(bJ));});};M.delay=function(bI){return{GetEnumerator:function(){return I.Get(bI());}};};M.distinct=function(bI){return M.distinctBy(a.id,bI);};M.distinctBy=function(bI,bJ){return{GetEnumerator:function(){var bK,bL;bK=I.Get(bJ);bL=new bd.New$3();return new J.New(null,null,function(bM){var bN,bO;if(bK.MoveNext()){bN=bK.Current();bO=bL.Add(bI(bN));while(!bO&&bK.MoveNext()){bN=bK.Current();bO=bL.Add(bI(bN));}return bO&&(bM.c=bN,true);}else return false;},function(){bK.Dispose();});}};};M.splitInto=function(bI,bJ){bI<=0?A.FailWith("Count must be positive"):void 0;return M.delay(function(){return L.splitInto(bI,L.ofSeq(bJ));});};M.exactlyOne=function(bI){var bJ,bK;bJ=I.Get(bI);try{return bJ.MoveNext()?(bK=bJ.Current(),bJ.MoveNext()?A.InvalidOp("Sequence contains more than one element"):bK):A.InvalidOp("Sequence contains no elements");}finally{if(typeof bJ=="object"&&"Dispose"in bJ)bJ.Dispose();}};M.exists=function(bI,bJ){var bK,bL;bK=I.Get(bJ);try{bL=false;while(!bL&&bK.MoveNext())bL=bI(bK.Current());return bL;}finally{if(typeof bK=="object"&&"Dispose"in bK)bK.Dispose();}};M.exists2=function(bI,bJ,bK){var bL,bM,bN,bO;bL=I.Get(bJ);try{bN=I.Get(bK);try{bO=false;while(!bO&&bL.MoveNext()&&bN.MoveNext())bO=bI(bL.Current(),bN.Current());bM=bO;}finally{if(typeof bN=="object"&&"Dispose"in bN)bN.Dispose();}return bM;}finally{if(typeof bL=="object"&&"Dispose"in bL)bL.Dispose();}};M.filter=function(bI,bJ){return{GetEnumerator:function(){var bK;bK=I.Get(bJ);return new J.New(null,null,function(bL){var bM,bN,bO;bM=bK.MoveNext();bN=bK.Current();bO=false;while(bM)if(bI(bN)){bL.c=bN;bO=true;bM=false;}else if(bK.MoveNext())bN=bK.Current();else bM=false;return bO;},function(){bK.Dispose();});}};};M.find=function(bI,bJ){var bK;bK=M.tryFind(bI,bJ);return bK==null?A.FailWith("KeyNotFoundException"):bK.$0;};M.findIndex=function(bI,bJ){var bK;bK=M.tryFindIndex(bI,bJ);return bK==null?A.FailWith("KeyNotFoundException"):bK.$0;};M.fold=function(bI,bJ,bK){var bL,bM;bL=bJ;bM=I.Get(bK);try{while(bM.MoveNext())bL=bI(bL,bM.Current());return bL;}finally{if(typeof bM=="object"&&"Dispose"in bM)bM.Dispose();}};M.forall=function(bI,bJ){return!M.exists(function(bK){return!bI(bK);},bJ);};M.forall2=function(bI,bJ,bK){return!M.exists2(function(bL,bM){return!bI(bL,bM);},bJ,bK);};M.groupBy=function(bI,bJ){return M.delay(function(){return L.groupBy(bI,L.ofSeq(bJ));});};M.head=function(bI){var bJ;bJ=I.Get(bI);try{return bJ.MoveNext()?bJ.Current():M.insufficient();}finally{if(typeof bJ=="object"&&"Dispose"in bJ)bJ.Dispose();}};M.init=function(bI,bJ){return M.take(bI,M.initInfinite(bJ));};M.initInfinite=function(bI){return{GetEnumerator:function(){return new J.New(0,null,function(bJ){bJ.c=bI(bJ.s);bJ.s=bJ.s+1;return true;},void 0);}};};M.isEmpty=function(bI){var bJ;bJ=I.Get(bI);try{return!bJ.MoveNext();}finally{if(typeof bJ=="object"&&"Dispose"in bJ)bJ.Dispose();}};M.iter=function(bI,bJ){var bK;bK=I.Get(bJ);try{while(bK.MoveNext())bI(bK.Current());}finally{if(typeof bK=="object"&&"Dispose"in bK)bK.Dispose();}};M.iter2=function(bI,bJ,bK){var bL,bM,bN;bL=I.Get(bJ);try{bN=I.Get(bK);try{while(bL.MoveNext()&&bN.MoveNext())bI(bL.Current(),bN.Current());bM=void 0;}finally{if(typeof bN=="object"&&"Dispose"in bN)bN.Dispose();}bM;}finally{if(typeof bL=="object"&&"Dispose"in bL)bL.Dispose();}};M.iteri=function(bI,bJ){var bK,bL;bK=0;bL=I.Get(bJ);try{while(bL.MoveNext()){bI(bK,bL.Current());bK=bK+1;}}finally{if(typeof bL=="object"&&"Dispose"in bL)bL.Dispose();}};M.length=function(bI){var bJ,bK;bJ=0;bK=I.Get(bI);try{while(bK.MoveNext())bJ=bJ+1;return bJ;}finally{if(typeof bK=="object"&&"Dispose"in bK)bK.Dispose();}};M.map=function(bI,bJ){return{GetEnumerator:function(){var bK;bK=I.Get(bJ);return new J.New(null,null,function(bL){return bK.MoveNext()&&(bL.c=bI(bK.Current()),true);},function(){bK.Dispose();});}};};M.mapi=function(bI,bJ){return M.map2(bI,M.initInfinite(a.id),bJ);};M.map2=function(bI,bJ,bK){return{GetEnumerator:function(){var bL,bM;bL=I.Get(bJ);bM=I.Get(bK);return new J.New(null,null,function(bN){return bL.MoveNext()&&bM.MoveNext()&&(bN.c=bI(bL.Current(),bM.Current()),true);},function(){bL.Dispose();bM.Dispose();});}};};M.maxBy=function(bI,bJ){var bK,bL,bM,bN,bO;bK=I.Get(bJ);try{if(!bK.MoveNext())M.seqEmpty();bL=bK.Current();bM=bI(bL);while(bK.MoveNext()){bN=bK.Current();bO=bI(bN);bu.Compare(bO,bM)===1?(bL=bN,bM=bO):void 0;}return bL;}finally{if(typeof bK=="object"&&"Dispose"in bK)bK.Dispose();}};M.minBy=function(bI,bJ){var bK,bL,bM,bN,bO;bK=I.Get(bJ);try{if(!bK.MoveNext())M.seqEmpty();bL=bK.Current();bM=bI(bL);while(bK.MoveNext()){bN=bK.Current();bO=bI(bN);bu.Compare(bO,bM)===-1?(bL=bN,bM=bO):void 0;}return bL;}finally{if(typeof bK=="object"&&"Dispose"in bK)bK.Dispose();}};M.max=function(bI){var bJ,bK,bL;bJ=I.Get(bI);try{if(!bJ.MoveNext())M.seqEmpty();bK=bJ.Current();while(bJ.MoveNext()){bL=bJ.Current();bu.Compare(bL,bK)===1?bK=bL:void 0;}return bK;}finally{if(typeof bJ=="object"&&"Dispose"in bJ)bJ.Dispose();}};M.min=function(bI){var bJ,bK,bL;bJ=I.Get(bI);try{if(!bJ.MoveNext())M.seqEmpty();bK=bJ.Current();while(bJ.MoveNext()){bL=bJ.Current();bu.Compare(bL,bK)===-1?bK=bL:void 0;}return bK;}finally{if(typeof bJ=="object"&&"Dispose"in bJ)bJ.Dispose();}};M.nth=function(bI,bJ){var bK,bL;if(bI<0)A.FailWith("negative index requested");bK=-1;bL=I.Get(bJ);try{while(bK<bI){!bL.MoveNext()?M.insufficient():void 0;bK=bK+1;}return bL.Current();}finally{if(typeof bL=="object"&&"Dispose"in bL)bL.Dispose();}};M.pairwise=function(bI){return M.map(function(bJ){return[L.get(bJ,0),L.get(bJ,1)];},M.windowed(2,bI));};M.pick=function(bI,bJ){var bK;bK=M.tryPick(bI,bJ);return bK==null?A.FailWith("KeyNotFoundException"):bK.$0;};M.readOnly=function(bI){return{GetEnumerator:function(){return I.Get(bI);}};};M.reduce=function(bI,bJ){var bK,bL;bK=I.Get(bJ);try{if(!bK.MoveNext())M.seqEmpty();bL=bK.Current();while(bK.MoveNext())bL=bI(bL,bK.Current());return bL;}finally{if(typeof bK=="object"&&"Dispose"in bK)bK.Dispose();}};M.scan=function(bI,bJ,bK){return{GetEnumerator:function(){var bL;bL=I.Get(bK);return new J.New(false,null,function(bM){return bM.s?bL.MoveNext()&&(bM.c=bI(bM.c,bL.Current()),true):(bM.c=bJ,bM.s=true,true);},function(){bL.Dispose();});}};};M.skip=function(bI,bJ){return{GetEnumerator:function(){var bK;bK=I.Get(bJ);return new J.New(true,null,function(bL){var bM,bN;if(bL.s){for(bM=1,bN=bI;bM<=bN;bM++)if(!bK.MoveNext())M.insufficient();bL.s=false;}else null;return bK.MoveNext()&&(bL.c=bK.Current(),true);},function(){bK.Dispose();});}};};M.skipWhile=function(bI,bJ){return{GetEnumerator:function(){var bK;bK=I.Get(bJ);return new J.New(true,null,function(bL){var bM,bN;if(bL.s){bM=true;bN=false;while(bM)if(bK.MoveNext()){if(!bI(bK.Current()))bM=false;}else{bM=false;bN=true;}bL.s=false;return bN?false:(bL.c=bK.Current(),true);}else return bK.MoveNext()&&(bL.c=bK.Current(),true);},function(){bK.Dispose();});}};};M.sort=function(bI){return M.sortBy(a.id,bI);};M.sortBy=function(bI,bJ){return M.delay(function(){var bK;bK=L.ofSeq(bJ);L.sortInPlaceBy(bI,bK);return bK;});};M.sortByDescending=function(bI,bJ){return M.delay(function(){var bK;bK=L.ofSeq(bJ);L.sortInPlaceByDescending(bI,bK);return bK;});};M.sortDescending=function(bI){return M.sortByDescending(a.id,bI);};M.sum=function(bI){return M.fold(function(bJ,bK){return bJ+bK;},0,bI);};M.sumBy=function(bI,bJ){return M.fold(function(bK,bL){return bK+bI(bL);},0,bJ);};M.take=function(bI,bJ){bI<0?M.nonNegative():void 0;return{GetEnumerator:function(){var bK;bK=[I.Get(bJ)];return new J.New(0,null,function(bL){var bM;bL.s=bL.s+1;return bL.s>bI?false:(bM=bK[0],bu.Equals(bM,null)?M.insufficient():bM.MoveNext()?(bL.c=bM.Current(),bL.s===bI?(bM.Dispose(),bK[0]=null):void 0,true):(bM.Dispose(),bK[0]=null,M.insufficient()));},function(){var bL;bL=bK[0];!bu.Equals(bL,null)?bL.Dispose():void 0;});}};};M.takeWhile=function(bI,bJ){return M.delay(function(){return M.enumUsing(I.Get(bJ),function(bK){return M.enumWhile(function(){return bK.MoveNext()&&bI(bK.Current());},M.delay(function(){return[bK.Current()];}));});});};M.transpose=function(bI){return M.delay(function(){return L.transposeArray(L.ofSeq(M.map(L.ofSeq,bI)));});};M.truncate=function(bI,bJ){return M.delay(function(){return M.enumUsing(I.Get(bJ),function(bK){var bL;bL=[0];return M.enumWhile(function(){return bK.MoveNext()&&bL[0]<bI;},M.delay(function(){bL[0]++;return[bK.Current()];}));});});};M.tryFind=function(bI,bJ){var bK,bL,bM;bK=I.Get(bJ);try{bL=null;while(bL==null&&bK.MoveNext()){bM=bK.Current();bI(bM)?bL={$:1,$0:bM}:void 0;}return bL;}finally{if(typeof bK=="object"&&"Dispose"in bK)bK.Dispose();}};M.findBack=function(bI,bJ){var bK;bK=L.tryFindBack(bI,L.ofSeq(bJ));return bK==null?A.FailWith("KeyNotFoundException"):bK.$0;};M.tryFindIndex=function(bI,bJ){var bK,bL,bM;bK=I.Get(bJ);try{bL=true;bM=0;while(bL&&bK.MoveNext())if(bI(bK.Current()))bL=false;else bM=bM+1;return bL?null:{$:1,$0:bM};}finally{if(typeof bK=="object"&&"Dispose"in bK)bK.Dispose();}};M.findIndexBack=function(bI,bJ){var bK;bK=L.tryFindIndexBack(bI,L.ofSeq(bJ));return bK==null?A.FailWith("KeyNotFoundException"):bK.$0;};M.tryPick=function(bI,bJ){var bK,bL;bK=I.Get(bJ);try{bL=null;while(bu.Equals(bL,null)&&bK.MoveNext())bL=bI(bK.Current());return bL;}finally{if(typeof bK=="object"&&"Dispose"in bK)bK.Dispose();}};M.unfold=function(bI,bJ){return{GetEnumerator:function(){return new J.New(bJ,null,function(bK){var bL;bL=bI(bK.s);return bL==null?false:(bK.c=bL.$0[0],bK.s=bL.$0[1],true);},void 0);}};};M.windowed=function(bI,bJ){bI<=0?A.FailWith("The input must be positive."):void 0;return M.delay(function(){return M.enumUsing(I.Get(bJ),function(bK){var bL;bL=[];return M.append(M.enumWhile(function(){return bL.length<bI&&bK.MoveNext();},M.delay(function(){bL.push(bK.Current());return[];})),M.delay(function(){return bL.length===bI?M.append([bL.slice(0)],M.delay(function(){return M.enumWhile(function(){return bK.MoveNext();},M.delay(function(){bL.shift();bL.push(bK.Current());return[bL.slice(0)];}));})):[];}));});});};M.zip=function(bI,bJ){return M.map2(function(bK,bL){return[bK,bL];},bI,bJ);};M.map3=function(bI,bJ,bK,bL){return{GetEnumerator:function(){var bM,bN,bO;bM=I.Get(bJ);bN=I.Get(bK);bO=I.Get(bL);return new J.New(null,null,function(bP){return bM.MoveNext()&&bN.MoveNext()&&bO.MoveNext()&&(bP.c=bI(bM.Current(),bN.Current(),bO.Current()),true);},function(){bM.Dispose();bN.Dispose();bO.Dispose();});}};};M.zip3=function(bI,bJ,bK){return M.map3(function(bL,bM,bN){return[bL,bM,bN];},bI,bJ,bK);};M.fold2=function(bI,bJ,bK,bL){return L.fold2(bI,bJ,L.ofSeq(bK),L.ofSeq(bL));};M.foldBack=function(bI,bJ,bK){return L.foldBack(bI,L.ofSeq(bJ),bK);};M.foldBack2=function(bI,bJ,bK,bL){return L.foldBack2(bI,L.ofSeq(bJ),L.ofSeq(bK),bL);};M.iteri2=function(bI,bJ,bK){var bL,bM,bN,bO;bL=0;bM=I.Get(bJ);try{bO=I.Get(bK);try{while(bM.MoveNext()&&bO.MoveNext()){bI(bL,bM.Current(),bO.Current());bL=bL+1;}bN=void 0;}finally{if(typeof bO=="object"&&"Dispose"in bO)bO.Dispose();}bN;}finally{if(typeof bM=="object"&&"Dispose"in bM)bM.Dispose();}};M.mapi2=function(bI,bJ,bK){return M.map3(bI,M.initInfinite(a.id),bJ,bK);};M.mapFold=function(bI,bJ,bK){return L.mapFold(bI,bJ,L.ofSeq(bK));};M.mapFoldBack=function(bI,bJ,bK){return L.mapFoldBack(bI,L.ofSeq(bJ),bK);};M.permute=function(bI,bJ){return M.delay(function(){return L.permute(bI,L.ofSeq(bJ));});};M.reduceBack=function(bI,bJ){return L.reduceBack(bI,L.ofSeq(bJ));};M.replicate=function(bI,bJ){bI<0?M.nonNegative():void 0;return M.delay(function(){return M.map(function(){return bJ;},A.range(0,bI-1));});};M.rev=function(bI){return M.delay(function(){return L.ofSeq(bI).slice().reverse();});};M.scanBack=function(bI,bJ,bK){return M.delay(function(){return L.scanBack(bI,L.ofSeq(bJ),bK);});};M.indexed=function(bI){return M.mapi(function(bJ,bK){return[bJ,bK];},bI);};M.sortWith=function(bI,bJ){return M.delay(function(){var bK;bK=L.ofSeq(bJ);L.sortInPlaceWith(bI,bK);return bK;});};M.tail=function(bI){return M.skip(1,bI);};M.seqEmpty=function(){return A.FailWith("The input sequence was empty.");};bp.CopyTo=function(bI,bJ,bK){L.blit(bJ,0,bJ,bK,L.length(bI));};bp.Contains=function(bI,bJ){return M.exists(function(bK){return bu.Equals(bJ,bK);},bI);};bp.Clear=function(bI){bI.splice(0,L.length(bI));};bq.RegexEscape=function(bI){return bI.replace(new a.RegExp("[-\\/\\\\^$*+?.()|[\\]{}]","g"),"\\$&");};bq.SplitWith=function(bI,bJ){return bI.split(bJ);};bq.Join=function(bI,bJ){return bJ.join(bI);};bq.TrimEndWS=function(bI){return bI.replace(new a.RegExp("\\s+$"),"");};bq.TrimStartWS=function(bI){return bI.replace(new a.RegExp("^\\s+"),"");};bq.Trim=function(bI){return bI.replace(new a.RegExp("^\\s+"),"").replace(new a.RegExp("\\s+$"),"");};bq.StartsWith=function(bI,bJ){return bI.substring(0,bJ.length)==bJ;};bq.Substring=function(bI,bJ,bK){return bI.substr(bJ,bK);};bq.ReplaceOnce=function(bI,bJ,bK){return bI.replace(bJ,bK);};bq.Remove=function(bI,bJ,bK){return bI.substring(0,bJ)+bI.substring(bJ+bK);};bq.PadRightWith=function(bI,bJ,bK){return bJ>bI.length?bI+a.Array(bJ-bI.length+1).join(bK):bI;};bq.PadLeftWith=function(bI,bJ,bK){return bJ>bI.length?a.Array(bJ-bI.length+1).join(bK)+bI:bI;};bq.LastIndexOf=function(bI,bJ,bK){return bI.lastIndexOf(bJ,bK);};bq.IsNullOrWhiteSpace=function(bI){return bI==null||(new a.RegExp("^\\s*$")).test(bI);};bq.IsNullOrEmpty=function(bI){return bI==null||bI=="";};bq.Insert=function(bI,bJ,bK){return bI.substring(0,bJ-1)+bK+bI.substring(bJ);};bq.IndexOf=function(bI,bJ,bK){return bI.indexOf(bJ,bK);};bq.EndsWith=function(bI,bJ){return bI.substring(bI.length-bJ.length)==bJ;};bq.collect=function(bI,bJ){return L.init(bJ.length,function(bK){return bI(bJ[bK]);}).join("");};bq.concat=function(bI,bJ){return L.ofSeq(bJ).join(bI);};bq.exists=function(bI,bJ){return M.exists(bI,bq.protect(bJ));};bq.forall=function(bI,bJ){return M.forall(bI,bq.protect(bJ));};bq.init=function(bI,bJ){return L.init(bI,bJ).join("");};bq.iter=function(bI,bJ){M.iter(bI,bq.protect(bJ));};bq.iteri=function(bI,bJ){M.iteri(bI,bq.protect(bJ));};bq.length=function(bI){return bq.protect(bI).length;};bq.map=function(bI,bJ){return bq.collect(bI,bq.protect(bJ));};bq.mapi=function(bI,bJ){return L.ofSeq(M.mapi(bI,bJ)).join("");};bq.replicate=function(bI,bJ){return L.create(bI,bJ).join("");};bq.protect=function(bI){return bI===null?"":bI;};bq.SFormat=function(bI,bJ){return bI.replace(new a.RegExp("{(0|[1-9]\\d*)(?:,(-?[1-9]\\d*|0))?(?::(.*?))?}","g"),function(bK,bL,bM){var bN,bO,bP;bN=bE(L.get(bJ,+bL));return!bu.Equals(bM,void 0)?(bO=+bM,(bP=bH.abs(bO),bP>bN.length?bO>0?bq.PadLeft(bN,bP):bq.PadRight(bN,bP):bN)):bN;});};bq.Filter=function(bI,bJ){return L.ofSeq(M.choose(function(bK){return bI(bK)?{$:1,$0:bK}:null;},bJ)).join("");};bq.SplitStrings=function(bI,bJ,bK){return bq.Split(bI,new a.RegExp(bq.concat("|",L.map(bq.RegexEscape,bJ))),bK);};bq.SplitChars=function(bI,bJ,bK){return bq.Split(bI,new a.RegExp("["+bq.RegexEscape(bJ.join(""))+"]"),bK);};bq.Split=function(bI,bJ,bK){return bK===1?L.filter(function(bL){return bL!=="";},bq.SplitWith(bI,bJ)):bq.SplitWith(bI,bJ);};bq.TrimEnd=function(bI,bJ){var bK,bL;if(bu.Equals(bJ,null)||bJ.length==0)return bq.TrimEndWS(bI);else{bK=bI.length-1;bL=true;while(bK>=0&&bL)(function(){var bM;bM=bI[bK];return L.exists(function(bN){return bM===bN;},bJ)?void(bK=bK-1):void(bL=false);}());return bq.Substring(bI,0,bK+1);}};bq.TrimStart=function(bI,bJ){var bK,bL;if(bu.Equals(bJ,null)||bJ.length==0)return bq.TrimStartWS(bI);else{bK=0;bL=true;while(bK<bI.length&&bL)(function(){var bM;bM=bI[bK];return L.exists(function(bN){return bM===bN;},bJ)?void(bK=bK+1):void(bL=false);}());return bI.substring(bK);}};bq.ToCharArrayRange=function(bI,bJ,bK){return L.init(bK,function(bL){return bI[bJ+bL];});};bq.ToCharArray=function(bI){return L.init(bI.length,function(bJ){return bI[bJ];});};bq.ReplaceChar=function(bI,bJ,bK){return bq.Replace(bI,bJ,bK);};bq.Replace=function(bI,bJ,bK){function bL(bM){var bN,bO,bP;bN=bM.indexOf(bJ);return bN!==-1?(bO=bq.ReplaceOnce(bM,bJ,bK),(bP=bN+bK.length,bq.Substring(bO,0,bN+bK.length)+bL(bO.substring(bP)))):bM;}return bL(bI);};bq.PadRight=function(bI,bJ){return bq.PadRightWith(bI,bJ," ");};bq.PadLeft=function(bI,bJ){return bq.PadLeftWith(bI,bJ," ");};bq.CopyTo=function(bI,bJ,bK,bL,bM){L.blit(bq.ToCharArray(bI),bJ,bK,bL,bM);};bq.Compare=function(bI,bJ){return bu.Compare(bI,bJ);};br=b.Task=bB.Class({Start:function(){var bI;bI=this;this.status===0?(this.status=2,D.scheduler().Fork(function(){var bJ;bI.status=3;try{bI.Execute();bI.status=5;}catch(bK){bK instanceof _2&&(bu.Equals(bK.ct,bI.token)&&(bJ=bK,true))?(bG.log("Task cancellation caught:",bJ),bI.exc=new _7.New$3([bJ]),bI.status=6):(bG.log("Task error caught:",bK),bI.exc=new _7.New$3([bK]),bI.status=7);}bI.RunContinuations();})):A.InvalidOp("Task not in initial state");},StartContinuation:function(){var bI;bI=this;this.status===1?(this.status=2,D.scheduler().Fork(function(){if(bI.status===2){bI.status=3;try{bI.Execute();bI.status=5;}catch(bJ){bI.exc=new _7.New$3([bJ]);bI.status=7;}bI.RunContinuations();}})):void 0;},ContinueWith:function(bI,bJ){var bK,bL;bK=this;bL=new bs.New$4(function(){return bI(bK);},bJ,1,null,void 0);this.get_IsCompleted()?bL.StartContinuation():this.continuations.push(bL);return bL;},ContinueWith$1:function(bI,bJ){var bK,bL;bK=this;bL=new br.New$4(function(){return bI(bK);},bJ,1,null);this.get_IsCompleted()?bL.StartContinuation():this.continuations.push(bL);return bL;},RunContinuations:function(){var bI,bJ,bK;bI=this.continuations;for(bJ=0,bK=bI.length-1;bJ<=bK;bJ++)L.get(bI,bJ).StartContinuation();},OnCompleted:function(bI){if(this.get_IsCompleted())bI();else{this.get_Status()===0?this.Start():void 0;this.ContinueWith$1(function(){return bI();},D.noneCT());}},get_Status:function(){return this.status;},get_IsFaulted:function(){return this.status===7;},get_IsCompleted:function(){return this.status===5||this.status===7||this.status===6;},get_IsCanceled:function(){return this.status===6;},get_Exception:function(){return this.exc;},Execute:function(){this.action();}},j,br);br.Yield=function(){return new br.New$3(function(){return null;});};br.WhenAll=function(bI){var bJ,bK,bL,bM,bN,bO;bJ=L.length(bI);bK=[0];bL=new a.Array(bJ);bM=new bt.New();for(bN=0,bO=bJ-1;bN<=bO;bN++)(function(bP){L.get(bI,bN).ContinueWith$1(function(bQ){return bQ.get_IsFaulted()?void bM.TrySetException$1(bQ.get_Exception()):bQ.get_IsCanceled()?void bM.TrySetCanceled$1():(bK[0]++,bL[bP]=bQ.get_Result(),bK[0]===bJ?bM.SetResult(bL):null);},D.noneCT());}(bN));return bM.get_Task();};br.WhenAll$1=function(bI){var bJ,bK,bL,bM,bN;bJ=L.length(bI);bK=[0];bL=new bt.New();for(bM=0,bN=bJ-1;bM<=bN;bM++)L.get(bI,bM).ContinueWith$1(function(bO){return bO.get_IsFaulted()?void bL.TrySetException$1(bO.get_Exception()):bO.get_IsCanceled()?void bL.TrySetCanceled$1():(bK[0]++,bK[0]===bJ?void bL.TrySetResult():null);},D.noneCT());return bL.get_Task();};br.WhenAny=function(bI){var bJ,bK,bL;bJ=new bt.New();for(bK=0,bL=bI.length-1;bK<=bL;bK++)L.get(bI,bK).ContinueWith(function(bM){bJ.TrySetResult(bM);},D.noneCT());return bJ.get_Task();};br.WhenAny$1=function(bI){var bJ,bK,bL;bJ=new bt.New();for(bK=0,bL=bI.length-1;bK<=bL;bK++)L.get(bI,bK).ContinueWith$1(function(bM){bJ.TrySetResult(bM);},D.noneCT());return bJ.get_Task();};br.Delay=function(bI,bJ){return D.StartAsTask(D.Sleep(bI),{$:1,$0:bJ});};br.Delay$1=function(bI){return D.StartAsTask(D.Sleep(bI),null);};br.Run=function(bI,bJ){var bK;bK=bI();return bJ.c?br.FromCanceled(bJ):(bK.get_Status()===0?bK.Start():void 0,bK);};br.Run$1=function(bI,bJ){var bK;bK=new bs.New$4(bI,bJ,0,null,void 0);bK.Start();return bK;};br.Run$2=function(bI,bJ){var bK;bK=bI();return bJ.c?br.FromCanceled$1(bJ):(bK.get_Status()===0?bK.Start():void 0,bK);};br.Run$3=function(bI,bJ){var bK;bK=new br.New$4(bI,bJ,0,null);bK.Start();return bK;};br.FromResult=function(bI){return new bs.New$4(null,D.noneCT(),5,null,bI);};br.FromException=function(bI){return new bs.New$4(null,D.noneCT(),7,new _7.New$3([bI]),null);};br.FromException$1=function(bI){return new br.New$4(null,D.noneCT(),7,new _7.New$3([bI]));};br.FromCanceled=function(bI){return new bs.New$4(null,bI,6,new _7.New$3([new $.New()]),null);};br.FromCanceled$1=function(bI){return new br.New$4(null,bI,6,new _7.New$3([new $.New()]));};br.New=bB.Ctor(function(bI,bJ,bK){br.New$4.call(this,function(){return bI(bJ);},bK,0,null);},br);br.New$1=bB.Ctor(function(bI,bJ){br.New$4.call(this,function(){return bI(bJ);},D.noneCT(),0,null);},br);br.New$2=bB.Ctor(function(bI,bJ){br.New$4.call(this,bI,bJ,0,null);},br);br.New$3=bB.Ctor(function(bI){br.New$4.call(this,bI,D.noneCT(),0,null);},br);br.New$4=bB.Ctor(function(bI,bJ,bK,bL){j.New.call(this);this.action=bI;this.token=bJ;this.status=bK;this.continuations=[];this.exc=bL;},br);bs=b.Task1=bB.Class({Execute:function(){this.result=this.func();},get_Result:function(){var bI;switch(this.get_Status()){case 5:return this.result;case 7:case 6:throw this.get_Exception();default:return A.InvalidOp("Task has not been completed, has no Result");}}},br,bs);bs.New=bB.Ctor(function(bI,bJ,bK){bs.New$4.call(this,function(){return bI(bJ);},bK,0,null,void 0);},bs);bs.New$1=bB.Ctor(function(bI,bJ){bs.New$4.call(this,function(){return bI(bJ);},D.noneCT(),0,null,void 0);},bs);bs.New$2=bB.Ctor(function(bI,bJ){bs.New$4.call(this,bI,bJ,0,null,void 0);},bs);bs.New$3=bB.Ctor(function(bI){bs.New$4.call(this,bI,D.noneCT(),0,null,void 0);},bs);bs.New$4=bB.Ctor(function(bI,bJ,bK,bL,bM){br.New$4.call(this,null,bJ,bK,bL);this.func=bI;this.result=bM;},bs);bt=b.TaskCompletionSource=bB.Class({TrySetResult:function(bI){return!this.task.get_IsCompleted()&&(this.task.status=5,this.task.result=bI,this.task.RunContinuations(),true);},TrySetException:function(bI){return this.TrySetException$1(new _7.New$2(bI));},TrySetException$1:function(bI){return!this.task.get_IsCompleted()&&(this.task.status=7,this.task.exc=new _7.New$3([bI]),this.task.RunContinuations(),true);},TrySetCanceled:function(bI){return!this.task.get_IsCompleted()&&(this.task.status=6,this.task.token=bI,this.task.RunContinuations(),true);},TrySetCanceled$1:function(){return!this.task.get_IsCompleted()&&(this.task.status=6,this.task.RunContinuations(),true);},SetResult:function(bI){this.task.get_IsCompleted()?A.FailWith("Task already completed."):void 0;this.task.status=5;this.task.result=bI;this.task.RunContinuations();},SetException:function(bI){this.SetException$1(new _7.New$2(bI));},SetException$1:function(bI){this.task.get_IsCompleted()?A.FailWith("Task already completed."):void 0;this.task.status=7;this.task.exc=new _7.New$3([bI]);this.task.RunContinuations();},SetCanceled:function(){this.task.get_IsCompleted()?A.FailWith("Task already completed."):void 0;this.task.status=6;this.task.RunContinuations();},get_Task:function(){return this.task;}},j,bt);bt.New=bB.Ctor(function(){j.New.call(this);this.task=new bs.New$4(null,D.noneCT(),1,null,void 0);},bt);bu.Hash=function(bI){var bJ;bJ=typeof bI;return bJ=="function"?0:bJ=="boolean"?bI?1:0:bJ=="number"?bI:bJ=="string"?bu.hashString(bI):bJ=="object"?bI==null?0:bI instanceof a.Array?bu.hashArray(bI):bu.hashObject(bI):0;};bu.hashObject=function(bI){var bJ,bK;if("GetHashCode"in bI)return bI.GetHashCode();else{bJ=[0];for(var bL in bI)if(function(bM){bJ[0]=bu.hashMix(bu.hashMix(bJ[0],bu.hashString(bM)),bu.Hash(bI[bM]));return false;}(bL))break;return bJ[0];}};bu.hashString=function(bI){var bJ,bK,bL;if(bI===null)return 0;else{bJ=5381;for(bK=0,bL=bI.length-1;bK<=bL;bK++)bJ=bu.hashMix(bJ,bI[bK].charCodeAt());return bJ;}};bu.hashArray=function(bI){var bJ,bK,bL;bJ=-34948909;for(bK=0,bL=L.length(bI)-1;bK<=bL;bK++)bJ=bu.hashMix(bJ,bu.Hash(L.get(bI,bK)));return bJ;};bu.hashMix=function(bI,bJ){return(bI<<5)+bI+bJ;};bu.Equals=function(bI,bJ){var bK,bL,bM,bN;if(bI===bJ)return true;else{bK=typeof bI;if(bK=="object"){if(bI===null||bI===void 0||bJ===null||bJ===void 0)return false;else if("Equals"in bI)return bI.Equals(bJ);else if(bI instanceof a.Array&&bJ instanceof a.Array)return bu.arrayEquals(bI,bJ);else if(bI instanceof bF&&bJ instanceof bF)return bu.dateEquals(bI,bJ);else{bL=[true];for(var bO in bI)if(function(bP){bL[0]=!bI.hasOwnProperty(bP)||bJ.hasOwnProperty(bP)&&bu.Equals(bI[bP],bJ[bP]);return!bL[0];}(bO))break;if(bL[0]){for(var bP in bJ)if(function(bQ){bL[0]=!bJ.hasOwnProperty(bQ)||bI.hasOwnProperty(bQ);return!bL[0];}(bP))break;}return bL[0];}}else return bK=="function"&&("$Func"in bI?bI.$Func===bJ.$Func&&bI.$Target===bJ.$Target:"$Invokes"in bI&&"$Invokes"in bJ&&bu.arrayEquals(bI.$Invokes,bJ.$Invokes));}};bu.dateEquals=function(bI,bJ){return bI.getTime()===bJ.getTime();};bu.arrayEquals=function(bI,bJ){var bK,bL;if(L.length(bI)===L.length(bJ)){bK=true;bL=0;while(bK&&bL<L.length(bI)){!bu.Equals(L.get(bI,bL),L.get(bJ,bL))?bK=false:void 0;bL=bL+1;}return bK;}else return false;};bu.Compare=function(bI,bJ){var bK,bL,bM,bN,bO,bP;if(bI===bJ)return 0;else{bL=typeof bI;switch(bL=="function"?1:bL=="boolean"?2:bL=="number"?2:bL=="string"?2:bL=="object"?3:0){case 0:return typeof bJ=="undefined"?0:-1;case 1:return A.FailWith("Cannot compare function values.");case 2:return bI<bJ?-1:1;case 3:if(bI===null)bM=-1;else if(bJ===null)bM=1;else if("CompareTo"in bI)bM=bI.CompareTo(bJ);else if("CompareTo0"in bI)bM=bI.CompareTo0(bJ);else if(bI instanceof a.Array&&bJ instanceof a.Array)bM=bu.compareArrays(bI,bJ);else if(bI instanceof bF&&bJ instanceof bF)bM=bu.compareDates(bI,bJ);else{bN=[0];for(var bQ in bI)if(function(bR){return!bI.hasOwnProperty(bR)?false:!bJ.hasOwnProperty(bR)?(bN[0]=1,true):(bN[0]=bu.Compare(bI[bR],bJ[bR]),bN[0]!==0);}(bQ))break;if(bN[0]===0){for(var bR in bJ)if(function(bS){return!bJ.hasOwnProperty(bS)?false:!bI.hasOwnProperty(bS)&&(bN[0]=-1,true);}(bR))break;}bM=bN[0];}return bM;}}};bu.compareDates=function(bI,bJ){return bu.Compare(bI.getTime(),bJ.getTime());};bu.compareArrays=function(bI,bJ){var bK,bL;if(L.length(bI)<L.length(bJ))return -1;else if(L.length(bI)>L.length(bJ))return 1;else{bK=0;bL=0;while(bK===0&&bL<L.length(bI)){bK=bu.Compare(L.get(bI,bL),L.get(bJ,bL));bL=bL+1;}return bK;}};by=bx.FSharpValueOption=bB.Class({get_Value:function(){return this.$==1?this.$0:A.InvalidOp("ValueOption.Value");}},null,by);by.ValueNone=new by({$:0});by.get_Test=function(){return(new by({$:1,$0:2})).get_Value();};bz.TryParseBool=function(bI,bJ){var bK;bK=bI.toLowerCase();return bK==="true"?(bJ.set(true),true):bK==="false"&&(bJ.set(false),true);};bz.ParseBool=function(bI){var bJ;bJ=bI.toLowerCase();if(bJ==="true")return true;else if(bJ==="false")return false;else throw new _9.New$1("String was not recognized as a valid Boolean.");};bz.TryParse=function(bI,bJ,bK,bL){var bM,bN;bM=+bI;bN=bM===bM-bM%1&&bM>=bJ&&bM<=bK;bN?bL.set(bM):void 0;return bN;};bz.Parse=function(bI,bJ,bK,bL){var bM;bM=+bI;if(bM!==bM-bM%1)throw new _9.New$1("Input string was not in a correct format.");else if(bM<bJ||bM>bK)throw new _.New$1(bL);else return bM;};bz.ParseByte=function(bI){return bz.Parse(bI,0,255,"Value was either too large or too small for an unsigned byte.");};bz.TryParseByte=function(bI,bJ){return bz.TryParse(bI,0,255,bJ);};bz.ParseSByte=function(bI){return bz.Parse(bI,-128,127,"Value was either too large or too small for a signed byte.");};bz.TryParseSByte=function(bI,bJ){return bz.TryParse(bI,-128,127,bJ);};bz.ParseInt16=function(bI){return bz.Parse(bI,-32768,32767,"Value was either too large or too small for an Int16.");};bz.TryParseInt16=function(bI,bJ){return bz.TryParse(bI,-32768,32767,bJ);};bz.ParseInt32=function(bI){return bz.Parse(bI,-2147483648,2147483647,"Value was either too large or too small for an Int32.");};bz.TryParseInt32=function(bI,bJ){return bz.TryParse(bI,-2147483648,2147483647,bJ);};bz.ParseUInt16=function(bI){return bz.Parse(bI,0,65535,"Value was either too large or too small for an UInt16.");};bz.TryParseUInt16=function(bI,bJ){return bz.TryParse(bI,0,65535,bJ);};bz.ParseUInt32=function(bI){return bz.Parse(bI,0,4294967295,"Value was either too large or too small for an UInt32.");};bz.TryParseUInt32=function(bI,bJ){return bz.TryParse(bI,0,4294967295,bJ);};bz.ParseInt64=function(bI){return bz.Parse(bI,-9223372036854775808,9223372036854775807,"Value was either too large or too small for an Int64.");};bz.TryParseInt64=function(bI,bJ){return bz.TryParse(bI,-9223372036854775808,9223372036854775807,bJ);};bz.ParseUInt64=function(bI){return bz.Parse(bI,0,18446744073709551615,"Value was either too large or too small for an UInt64.");};bz.TryParseUInt64=function(bI,bJ){return bz.TryParse(bI,0,18446744073709551615,bJ);};}());
  