1/**
2 * @version   : 15.6.0 - Bridge.NET
3 * @author    : Object.NET, Inc. http://bridge.net/
4 * @date      : 2016-12-12
5 * @copyright : Copyright 2008-2016 Object.NET, Inc. http://object.net/
6 * @license   : See license.txt and https://github.com/bridgedotnet/Bridge/blob/master/LICENSE.md
7 */
8(function(n){"use strict";var bt={global:n,emptyFn:function(){},identity:function(n){return n},geti:function(n,t,i){return Bridge.hasValue(n[t])?t:i},literal:function(n,t){return t.$getType=function(){return n},t},isPlainObject:function(n){if(typeof n=="object"&&n!==null){if(typeof Object.getPrototypeOf=="function"){var t=Object.getPrototypeOf(n);return t===Object.prototype||t===null}return Object.prototype.toString.call(n)==="[object Object]"}return!1},toPlain:function(n){var i,t,r,u,f;if(!n||Bridge.isPlainObject(n)||typeof n!="object")return n;if(typeof n.toJSON=="function")return n.toJSON();if(Bridge.isArray(n)){for(i=[],t=0;t<n.length;t++)i.push(Bridge.toPlain(n[t]));return i}r={};for(f in n)u=n[f],Bridge.isFunction(u)||(r[f]=u);return r},ref:function(n,t){Bridge.isArray(t)&&(t=System.Array.toIndex(n,t));var i={};return Object.defineProperty(i,"v",{get:function(){return n[t]},set:function(i){n[t]=i}}),i},property:function(n,t,i,r){n[t]=i;var s=t.charAt(0)==="$",f=s?t.slice(1):t,e="get"+f,o="set"+f,u=t.lastIndexOf("$"),h=u>0&&t.length-u-1>0&&!isNaN(parseInt(t.substr(u+1)));h&&(u=t.substring(0,u-1).lastIndexOf("$"));u>0&&u!==t.length-1&&(e=t.substring(0,u)+"get"+t.substr(u+1),o=t.substring(0,u)+"set"+t.substr(u+1));n[e]=function(n,t,i){return i?function(){return t[n]}:function(){return this[n]}}(t,n,r);n[o]=function(n,t,i){return i?function(i){t[n]=i}:function(t){this[n]=t}}(t,n,r)},event:function(n,t,i,r){n[t]=i;var s=t.charAt(0)==="$",f=s?t.slice(1):t,e="add"+f,o="remove"+f,u=t.lastIndexOf("$"),h=u>0&&t.length-u-1>0&&!isNaN(parseInt(t.substr(u+1)));h&&(u=t.substring(0,u-1).lastIndexOf("$"));u>0&&u!==t.length-1&&(e=t.substring(0,u)+"add"+t.substr(u+1),o=t.substring(0,u)+"remove"+t.substr(u+1));n[e]=function(n,t,i){return i?function(i){t[n]=Bridge.fn.combine(t[n],i)}:function(t){this[n]=Bridge.fn.combine(this[n],t)}}(t,n,r);n[o]=function(n,t,i){return i?function(i){t[n]=Bridge.fn.remove(t[n],i)}:function(t){this[n]=Bridge.fn.remove(this[n],t)}}(t,n,r)},createInstance:function(n,t){return n===System.Decimal?System.Decimal.Zero:n===System.Int64?System.Int64.Zero:n===System.UInt64?System.UInt64.Zero:n===System.Double||n===System.Single||n===System.Byte||n===System.SByte||n===System.Int16||n===System.UInt16||n===System.Int32||n===System.UInt32||n===Bridge.Int?0:typeof n.getDefaultValue=="function"?n.getDefaultValue():n===Boolean?!1:n===Date?new Date(0):n===Number?0:n===String?"":n&&n.$literal?n.ctor():t&&t.length>0?Bridge.Reflection.applyConstructor(n,t):new n},clone:function(n){if(Bridge.isArray(n))return System.Array.clone(n);if(Bridge.isString(n))return n;var t;return Bridge.isFunction(n[t="System$ICloneable$clone"])?n[t]():Bridge.is(n,System.ICloneable)?n.clone():null},copy:function(n,t,i,r){typeof i=="string"&&(i=i.split(/[,;\s]+/));for(var u,f=0,e=i?i.length:0;f<e;f++)u=i[f],(r!==!0||n[u]==undefined)&&(n[u]=Bridge.is(t[u],System.ICloneable)?Bridge.clone(t[u]):t[u]);return n},get:function(n){return n&&n.$staticInit!==null&&n.$staticInit(),n},ns:function(n,t){var r=n.split("."),i=0;for(t||(t=Bridge.global),i=0;i<r.length;i++)typeof t[r[i]]=="undefined"&&(t[r[i]]={}),t=t[r[i]];return t},ready:function(n,t){var i=function(){t?n.apply(t):n()};if(typeof Bridge.global.jQuery!="undefined")Bridge.global.jQuery(i);else if(typeof Bridge.global.document=="undefined"||Bridge.global.document.readyState==="complete"||Bridge.global.document.readyState==="loaded")i();else Bridge.on("DOMContentLoaded",Bridge.global.document,i)},on:function(n,t,i,r){var u=function(n){var t=i.apply(r||this,arguments);return t===!1&&(n.stopPropagation(),n.preventDefault()),t},f=function(){var n=i.call(r||t,Bridge.global.event);return n===!1&&(Bridge.global.event.returnValue=!1,Bridge.global.event.cancelBubble=!0),n};t.addEventListener?t.addEventListener(n,u,!1):t.attachEvent("on"+n,f)},addHash:function(n,t,i){if(isNaN(t)&&(t=17),isNaN(i)&&(i=23),Bridge.isArray(n)){for(var r=0;r<n.length;r++)t=t+((t*i|0)+(n[r]==null?0:Bridge.getHashCode(n[r])))|0;return t}return t+((t*i|0)+(n==null?0:Bridge.getHashCode(n)))|0},getHashCode:function(n,t,i){var o,u,f,r,s,e;if(Bridge.isEmpty(n,!0)){if(t)return 0;throw new System.InvalidOperationException("HashCode cannot be calculated for empty value");}if(i!==!1&&n.hasOwnProperty("item1")&&Bridge.isPlainObject(n)&&(i=!0),n.getHashCode&&Bridge.isFunction(n.getHashCode)&&!n.__insideHashCode&&n.getHashCode.length===0)return n.__insideHashCode=!0,o=n.getHashCode(),delete n.__insideHashCode,o;if(Bridge.isBoolean(n))return n?1:0;if(Bridge.isDate(n))return n.valueOf()&4294967295;if(n===Number.POSITIVE_INFINITY)return 2146435072;if(n===Number.NEGATIVE_INFINITY)return 4293918720;if(Bridge.isNumber(n)){if(Math.floor(n)===n)return n;n=n.toExponential()}if(Bridge.isString(n)){for(u=0,f=0;f<n.length;f++)u=(u<<5)-u+n.charCodeAt(f)&4294967295;return u}if(n.$$hashCode)return n.$$hashCode;if(i&&typeof n=="object"){r=0;for(e in n)n.hasOwnProperty(e)&&(s=Bridge.isEmpty(n[e],!0)?0:Bridge.getHashCode(n[e]),r=29*r+s);if(r!==0)return n.$$hashCode=r,r}return n.$$hashCode=Math.random()*4294967296|0,n.$$hashCode},getDefaultValue:function(n){return n.getDefaultValue&&n.getDefaultValue.length===0?n.getDefaultValue():n===Boolean?!1:n===Date?new Date(-864e13):n===Number?0:null},getTypeAlias:function(n){var t=n.$$name||Bridge.getTypeName(n);return t.replace(/[\.\(\)\,]/g,"$")},getTypeName:function(n){return Bridge.Reflection.getTypeFullName(n)},hasValue:function(n){return n!=null},hasValue$1:function(){if(arguments.length===0)return!1;var n=0;for(n;n<arguments.length;n++)if(arguments[n]==null)return!1;return!0},is:function(n,t,i,r){var u,e,o,s,f;if(n==null)return!!r;if(u=n.constructor,t.constructor===Function&&n instanceof t||u===t)return!0;if(e=u.$kind||u.$$inherits,o=t.$kind,e||o){if(s=t.$isInterface,s){if(e)return u.$isArrayEnumerator?System.Array.is(n,t):t.isAssignableFrom?t.isAssignableFrom(u):Bridge.Reflection.getInterfaces(u).indexOf(t)>=0;if(Bridge.isArray(n,u))return System.Array.is(n,t);if(u===String)return System.String.is(n,t)}return i!==!0&&t.$is?t.$is(n):t.$literal&&Bridge.isPlainObject(n)?n.$getType?Bridge.Reflection.isAssignableFrom(t,n.$getType()):!0:!1}if(f=typeof t,f==="boolean")return t;if(f==="string"&&(t=Bridge.unroll(t)),f==="function"&&Bridge.getType(n).prototype instanceof t)return!0;if(i!==!0){if(typeof t.$is=="function")return t.$is(n);if(typeof t.isAssignableFrom=="function")return t.isAssignableFrom(Bridge.getType(n))}return Bridge.isArray(n)?System.Array.is(n,t):f==="object"&&(u===t||n instanceof t)},as:function(n,t,i){return Bridge.is(n,t,!1,i)?n:null},cast:function(n,t,i){if(n==null)return n;var r=Bridge.is(n,t,!1,i)?n:null;if(r===null)throw new System.InvalidCastException("Unable to cast type "+(n?Bridge.getTypeName(n):"'null'")+" to type "+Bridge.getTypeName(t));return r},apply:function(n,t){for(var u=Bridge.getPropertyNames(t,!0),i,r=0;r<u.length;r++)i=u[r],typeof n[i]=="function"&&typeof t[i]!="function"?n[i](t[i]):n[i]=t[i];return n},merge:function(n,t,i,r){var u,o,f,h,c,e,s;if(n instanceof System.Decimal&&Bridge.isNumber(t))return new System.Decimal(t);if(n instanceof System.Int64&&Bridge.isNumber(t))return new System.Int64(t);if(n instanceof System.UInt64&&Bridge.isNumber(t))return new System.UInt64(t);if(n instanceof Boolean||Bridge.isBoolean(n)||n instanceof Number||Bridge.isNumber(n)||n instanceof String||Bridge.isString(n)||n instanceof Function||Bridge.isFunction(n)||n instanceof Date||Bridge.isDate(n)||Bridge.isNumber(n)||n instanceof System.Double||n instanceof System.Single||n instanceof System.Byte||n instanceof System.SByte||n instanceof System.Int16||n instanceof System.UInt16||n instanceof System.Int32||n instanceof System.UInt32||n instanceof Bridge.Int||n instanceof System.Decimal)return t;if(Bridge.isArray(t)&&Bridge.isFunction(n.add||n.push))for(c=Bridge.isArray(n)?n.push:n.add,o=0;o<t.length;o++)e=t[o],Bridge.isArray(e)||(e=[typeof r=="undefined"?e:Bridge.merge(r(),e)]),c.apply(n,e);else for(u in t)f=t[u],typeof n[u]=="function"?u.match(/^\s*get[A-Z]/)?Bridge.merge(n[u](),f):n[u](f):(s="set"+u.charAt(0).toUpperCase()+u.slice(1),typeof n[s]=="function"&&typeof f!="function"?n[s](f):f&&f.constructor===Object&&n[u]?(h=n[u],Bridge.merge(h,f)):n[u]=f);return i&&i.call(n,n),n},getEnumerator:function(n,t,i){if(typeof n=="string"&&(n=System.String.toCharArray(n)),arguments.length===2&&Bridge.isFunction(t)&&(i=t,t=null),t&&n&&n[t])return n[t].call(n);if(!i&&n&&n.getEnumerator)return n.getEnumerator();var r;if(i&&Bridge.isFunction(n[r="System$Collections$Generic$IEnumerable$1$"+Bridge.getTypeAlias(i)+"$getEnumerator"])||Bridge.isFunction(n[r="System$Collections$IEnumerable$getEnumerator"]))return n[r]();if(i&&n&&n.getEnumerator)return n.getEnumerator();if(Object.prototype.toString.call(n)==="[object Array]"||n&&Bridge.isDefined(n.length))return new Bridge.ArrayEnumerator(n,i);throw new System.InvalidOperationException("Cannot create enumerator");},getPropertyNames:function(n,t){var i=[];for(var r in n)(t||typeof n[r]!="function")&&i.push(r);return i},isDefined:function(n,t){return typeof n!="undefined"&&(t?n!==null:!0)},isEmpty:function(n,t){return typeof n=="undefined"||n===null||(t?!1:n==="")||(!t&&Bridge.isArray(n)?n.length===0:!1)},toArray:function(n){var t,r,u,i=[];if(Bridge.isArray(n))for(t=0,u=n.length;t<u;++t)i.push(n[t]);else for(t=Bridge.getEnumerator(n);t.moveNext();)r=t.getCurrent(),i.push(r);return i},toList:function(n,t){return new(System.Collections.Generic.List$1(t||Object))(n)},arrayTypes:[n.Array,n.Uint8Array,n.Int8Array,n.Int16Array,n.Uint16Array,n.Int32Array,n.Uint32Array,n.Float32Array,n.Float64Array,n.Uint8ClampedArray],isArray:function(n,t){var i=t||(n!=null?n.constructor:null);return i?Bridge.arrayTypes.indexOf(i)>=0:!1},isFunction:function(n){return typeof n=="function"},isDate:function(n){return Object.prototype.toString.call(n)==="[object Date]"},isNull:function(n){return n===null||n===undefined},isBoolean:function(n){return typeof n=="boolean"},isNumber:function(n){return typeof n=="number"&&isFinite(n)},isString:function(n){return typeof n=="string"},unroll:function(n){var r=n.split("."),t=Bridge.global[r[0]],i=1;for(i;i<r.length;i++){if(!t)return null;t=t[r[i]]}return t},referenceEquals:function(n,t){return Bridge.hasValue(n)?n===t:!Bridge.hasValue(t)},staticEquals:function(n,t){return Bridge.hasValue(n)?Bridge.hasValue(t)?Bridge.equals(n,t):!1:!Bridge.hasValue(t)},equals:function(n,t){if(n==null&&t==null)return!0;if(n&&Bridge.isFunction(n.equals)&&n.equals.length===1)return n.equals(t);if(t&&Bridge.isFunction(t.equals)&&t.equals.length===1)return t.equals(n);if(Bridge.isDate(n)&&Bridge.isDate(t))return n.valueOf()===t.valueOf();if(Bridge.isNull(n)&&Bridge.isNull(t))return!0;if(Bridge.isNull(n)!==Bridge.isNull(t))return!1;var i=n===t;return!i&&typeof n=="object"&&typeof t=="object"&&n!==null&&t!==null&&n.$kind==="struct"&&t.$kind==="struct"&&n.$$name===t.$$name?Bridge.getHashCode(n)===Bridge.getHashCode(t)&&Bridge.objectEquals(n,t):!i&&n&&t&&n.hasOwnProperty("item1")&&Bridge.isPlainObject(n)&&t.hasOwnProperty("item1")&&Bridge.isPlainObject(t)?Bridge.objectEquals(n,t):i},objectEquals:function(n,t){Bridge.$$leftChain=[];Bridge.$$rightChain=[];var i=Bridge.deepEquals(n,t);return delete Bridge.$$leftChain,delete Bridge.$$rightChain,i},deepEquals:function(n,t){if(typeof n=="object"&&typeof t=="object"){if(n===t)return!0;if(Bridge.$$leftChain.indexOf(n)>-1||Bridge.$$rightChain.indexOf(t)>-1)return!1;for(var i in t)if(t.hasOwnProperty(i)!==n.hasOwnProperty(i)||typeof t[i]!=typeof n[i])return!1;for(i in n){if(t.hasOwnProperty(i)!==n.hasOwnProperty(i)||typeof n[i]!=typeof t[i])return!1;if(n[i]===t[i])continue;else if(typeof n[i]=="object"){if(Bridge.$$leftChain.push(n),Bridge.$$rightChain.push(t),!Bridge.deepEquals(n[i],t[i]))return!1;Bridge.$$leftChain.pop();Bridge.$$rightChain.pop()}else if(!Bridge.equals(n[i],t[i]))return!1}return!0}return Bridge.equals(n,t)},compare:function(n,t,i,r){if(Bridge.isDefined(n,!0)){if(Bridge.isNumber(n)||Bridge.isString(n)||Bridge.isBoolean(n))return Bridge.isString(n)&&!Bridge.hasValue(t)?1:n<t?-1:n>t?1:0;if(Bridge.isDate(n))return Bridge.compare(n.valueOf(),t.valueOf())}else{if(i)return 0;throw new System.NullReferenceException;}var u;if(r&&Bridge.isFunction(n[u="System$IComparable$1$"+Bridge.getTypeAlias(r)+"$compareTo"])||Bridge.isFunction(n[u="System$IComparable$compareTo"]))return n[u](t);if(Bridge.isFunction(n.compareTo))return n.compareTo(t);if(r&&Bridge.isFunction(t[u="System$IComparable$1$"+Bridge.getTypeAlias(r)+"$compareTo"])||Bridge.isFunction(t[u="System$IComparable$compareTo"]))return-t[u](n);if(Bridge.isFunction(t.compareTo))return-t.compareTo(n);if(i)return 0;throw new System.Exception("Cannot compare items");},equalsT:function(n,t,i){if(Bridge.isDefined(n,!0)){if(Bridge.isNumber(n)||Bridge.isString(n)||Bridge.isBoolean(n))return n===t;if(Bridge.isDate(n))return n.valueOf()===t.valueOf()}else throw new System.NullReferenceException;var r;return i&&n!=null&&Bridge.isFunction(n[r="System$IEquatable$1$"+Bridge.getTypeAlias(i)+"$equalsT"])?n[r](t):i&&t!=null&&Bridge.isFunction(t[r="System$IEquatable$1$"+Bridge.getTypeAlias(i)+"$equalsT"])?t[r](n):n.equalsT?n.equalsT(t):t.equalsT(n)},format:function(n,t,i){if(Bridge.isNumber(n))return Bridge.Int.format(n,t,i);if(Bridge.isDate(n))return Bridge.Date.format(n,t,i);var r;return Bridge.isFunction(n[r="System$IFormattable$format"])?n[r](t,i):n.format(t,i)},getType:function(n){if(n==null)throw new System.NullReferenceException("instance is null");if(typeof n=="number")return!isNaN(n)&&isFinite(n)&&Math.floor(n,0)===n?System.Int32:System.Double;if(n.$getType)return n.$getType();try{return n.constructor}catch(t){return Object}},isLower:function(n){var t=String.fromCharCode(n);return t===t.toLowerCase()&&t!==t.toUpperCase()},isUpper:function(n){var t=String.fromCharCode(n);return t!==t.toLowerCase()&&t===t.toUpperCase()},coalesce:function(n,t){return Bridge.hasValue(n)?n:t},fn:{equals:function(n){return this===n?!0:n==null||this.constructor!==n.constructor?!1:this.equals===n.equals&&this.$method===n.$method&&this.$scope===n.$scope},call:function(n,t){var i=Array.prototype.slice.call(arguments,2);return n=n||Bridge.global,n[t].apply(n,i)},makeFn:function(n,t){switch(t){case 0:return function(){return n.apply(this,arguments)};case 1:return function(){return n.apply(this,arguments)};case 2:return function(){return n.apply(this,arguments)};case 3:return function(){return n.apply(this,arguments)};case 4:return function(){return n.apply(this,arguments)};case 5:return function(){return n.apply(this,arguments)};case 6:return function(){return n.apply(this,arguments)};case 7:return function(){return n.apply(this,arguments)};case 8:return function(){return n.apply(this,arguments)};case 9:return function(){return n.apply(this,arguments)};case 10:return function(){return n.apply(this,arguments)};case 11:return function(){return n.apply(this,arguments)};case 12:return function(){return n.apply(this,arguments)};case 13:return function(){return n.apply(this,arguments)};case 14:return function(){return n.apply(this,arguments)};case 15:return function(){return n.apply(this,arguments)};case 16:return function(){return n.apply(this,arguments)};case 17:return function(){return n.apply(this,arguments)};case 18:return function(){return n.apply(this,arguments)};case 19:return function(){return n.apply(this,arguments)};default:return function(){return n.apply(this,arguments)}}},bind:function(n,t,i,r){var f,u;if(t&&t.$method===t&&t.$scope===n)return t;if(n&&n.$$bind)for(f=0;f<n.$$bind.length;f++)if(n.$$bind[f].$method===t)return n.$$bind[f];return u=arguments.length===2?Bridge.fn.makeFn(function(){Bridge.caller.unshift(this);var i=t.apply(n,arguments);return Bridge.caller.shift(this),i},t.length):Bridge.fn.makeFn(function(){var u=i||arguments,f;return r===!0?(u=Array.prototype.slice.call(arguments,0),u=u.concat(i)):typeof r=="number"&&(u=Array.prototype.slice.call(arguments,0),r===0?u.unshift.apply(u,i):r<u.length?u.splice.apply(u,[r,0].concat(i)):u.push.apply(u,i)),Bridge.caller.unshift(this),f=t.apply(n,u),Bridge.caller.shift(this),f},t.length),n&&(n.$$bind=n.$$bind||[],n.$$bind.push(u)),u.$method=t,u.$scope=n,u.equals=Bridge.fn.equals,u},bindScope:function(n,t){var i=Bridge.fn.makeFn(function(){var i=Array.prototype.slice.call(arguments,0),r;return i.unshift.apply(i,[n]),Bridge.caller.unshift(this),r=t.apply(n,i),Bridge.caller.shift(this),r},t.length);return i.$method=t,i.$scope=n,i.equals=Bridge.fn.equals,i},$build:function(n){var t=function(){for(var i=t.$invocationList,r=null,u,n=0;n<i.length;n++)u=i[n],r=u.apply(null,arguments);return r};return(t.$invocationList=n?Array.prototype.slice.call(n,0):[],t.$invocationList.length===0)?null:t},combine:function(n,t){if(!n||!t)return n||t;var i=n.$invocationList?n.$invocationList:[n],r=t.$invocationList?t.$invocationList:[t];return Bridge.fn.$build(i.concat(r))},getInvocationList:function(){},remove:function(n,t){if(!n||!t)return n||null;for(var r=n.$invocationList?n.$invocationList:[n],f=t.$invocationList?t.$invocationList:[t],e=[],o,u,i=r.length-1;i>=0;i--){for(o=!1,u=0;u<f.length;u++)if(r[i]===f[u]||r[i].$method&&r[i].$method===f[u].$method&&r[i].$scope&&r[i].$scope===f[u].$scope){o=!0;break}o||e.push(r[i])}return e.reverse(),Bridge.fn.$build(e)}},sleep:function(n,t){if(Bridge.hasValue(t)&&(n=t.getTotalMilliseconds()),isNaN(n)||n<-1||n>2147483647)throw new System.ArgumentOutOfRangeException("timeout","Number must be either non-negative and less than or equal to Int32.MaxValue or -1");n==-1&&(n=2147483647);for(var i=(new Date).getTime();(new Date).getTime()-i<n;)if((new Date).getTime()-i>2147483647)break},getMetadata:function(n){return n.$getMetadata?n.$getMetadata():n.$metadata}},nt,s,at,o,vt,yt,pt,k,wt,t;n.Bridge=bt;n.Bridge.caller=[];n.System={};n.System.Diagnostics={};n.System.Diagnostics.Contracts={};n.System.Threading={};nt={is:function(n,t){return Bridge.isString(n)?n.constructor===t||n instanceof t?!0:t===System.ICloneable||t===System.Collections.IEnumerable||t===System.Collections.Generic.IEnumerable$1(System.Char)||t===System.IComparable$1(String)||t===System.IEquatable$1(String)?!0:!1:!1},lastIndexOf:function(n,t,i,r){var u=n.lastIndexOf(t,i);return u<i-r+1?-1:u},lastIndexOfAny:function(n,t,i,r){var e=n.length,f,u;if(!e)return-1;for(t=String.fromCharCode.apply(null,t),i=i||e-1,r=r||e,f=i-r+1,f<0&&(f=0),u=i;u>=f;u--)if(t.indexOf(n.charAt(u))>=0)return u;return-1},isNullOrWhiteSpace:function(n){return n?System.Char.isWhiteSpace(n):!0},isNullOrEmpty:function(n){return!n},fromCharCount:function(n,t){if(t>=0)return String(Array(t+1).join(String.fromCharCode(n)));throw new System.ArgumentOutOfRangeException("count","cannot be less than zero");},format:function(n){return System.String._format(System.Globalization.CultureInfo.getCurrentCulture(),n,Array.prototype.slice.call(arguments,1))},formatProvider:function(n,t){return System.String._format(n,t,Array.prototype.slice.call(arguments,2))},_format:function(n,t,i){var u=this,f=i,r=this.decodeBraceSequence;return t.replace(/(\{+)((\d+|[a-zA-Z_$]\w+(?:\.[a-zA-Z_$]\w+|\[\d+\])*)(?:\,(-?\d*))?(?:\:([^\}]*))?)(\}+)|(\{+)|(\}+)/g,function(t,i,e,o,s,h,c,l,a){return l?r(l):a?r(a):i.length%2==0||c.length%2==0?r(i)+e+r(c):r(i,!0)+u.handleElement(n,o,s,h,f)+r(c,!0)})},handleElement:function(n,t,i,r,u){var f;if(t=parseInt(t,10),t>u.length-1)throw new System.FormatException("Input string was not in a correct format.");return f=u[t],f==null&&(f=""),f=r&&Bridge.is(f,System.IFormattable)?Bridge.format(f,r,n):""+f,i&&(i=parseInt(i,10),Bridge.isNumber(i)||(i=null)),System.String.alignString(f.toString(),i)},decodeBraceSequence:function(n,t){return n.substr(0,(n.length+(t?0:1))/2)},alignString:function(n,t,i,r,u){if(!n||!t)return n;if(i||(i=" "),Bridge.isNumber(i)&&(i=String.fromCharCode(i)),r||(r=t<0?1:2),t=Math.abs(t),u&&n.length>t&&(n=n.substring(0,t)),t+1>=n.length)switch(r){case 2:n=Array(t+1-n.length).join(i)+n;break;case 3:var f=t-n.length,e=Math.ceil(f/2),o=f-e;n=Array(o+1).join(i)+n+Array(e+1).join(i);break;case 1:default:n=n+Array(t+1-n.length).join(i)}return n},startsWith:function(n,t){return t.length?t.length>n.length?!1:(t=System.String.escape(t),n.match("^"+t)!==null):!0},endsWith:function(n,t){return t.length?t.length>n.length?!1:(t=System.String.escape(t),n.match(t+"$")!==null):!0},contains:function(n,t){if(t==null)throw new System.ArgumentNullException;return n==null?!1:n.indexOf(t)>-1},indexOfAny:function(n,t){var i,r,e,u,o,f;if(t==null)throw new System.ArgumentNullException;if(n==null||n==="")return-1;if(i=arguments.length>2?arguments[2]:0,i<0)throw new System.ArgumentOutOfRangeException("startIndex","startIndex cannot be less than zero");if(r=arguments.length>3?arguments[3]:n.length-i,r<0)throw new System.ArgumentOutOfRangeException("length","must be non-negative");if(r>n.length-i)throw new System.ArgumentOutOfRangeException("Index and length must refer to a location within the string");for(e=n.substr(i,r),u=0;u<t.length;u++)if(o=String.fromCharCode(t[u]),f=e.indexOf(o),f>-1)return f+i;return-1},indexOf:function(n,t){var i,u,f,r;if(t==null)throw new System.ArgumentNullException;if(n==null||n==="")return-1;if(i=arguments.length>2?arguments[2]:0,i<0||i>n.length)throw new System.ArgumentOutOfRangeException("startIndex","startIndex cannot be less than zero and must refer to a location within the string");if(t==="")return arguments.length>2?i:0;if(u=arguments.length>3?arguments[3]:n.length-i,u<0)throw new System.ArgumentOutOfRangeException("length","must be non-negative");if(u>n.length-i)throw new System.ArgumentOutOfRangeException("Index and length must refer to a location within the string");return(f=n.substr(i,u),r=arguments.length===5&&arguments[4]%2!=0?f.toLocaleUpperCase().indexOf(t.toLocaleUpperCase()):f.indexOf(t),r>-1)?arguments.length===5?System.String.compare(t,f.substr(r,t.length),arguments[4])===0?r+i:-1:r+i:-1},equals:function(){return System.String.compare.apply(this,arguments)===0},compare:function(n,t){if(n==null)return t==null?0:-1;if(t==null)return 1;if(arguments.length>=3)if(Bridge.isBoolean(arguments[2])){if(arguments[2]&&(n=n.toLocaleUpperCase(),t=t.toLocaleUpperCase()),arguments.length===4)return n.localeCompare(t,arguments[3].name)}else switch(arguments[2]){case 1:return n.localeCompare(t,System.Globalization.CultureInfo.getCurrentCulture().name,{sensitivity:"accent"});case 2:return n.localeCompare(t,System.Globalization.CultureInfo.invariantCulture.name);case 3:return n.localeCompare(t,System.Globalization.CultureInfo.invariantCulture.name,{sensitivity:"accent"});case 4:return n===t?0:n>t?1:-1;case 5:return n.toUpperCase()===t.toUpperCase()?0:n.toUpperCase()>t.toUpperCase()?1:-1}return n.localeCompare(t)},toCharArray:function(n,t,i){var u,r;if(t<0||t>n.length||t>n.length-i)throw new System.ArgumentOutOfRangeException("startIndex","startIndex cannot be less than zero and must refer to a location within the string");if(i<0)throw new System.ArgumentOutOfRangeException("length","must be non-negative");for(Bridge.hasValue(t)||(t=0),Bridge.hasValue(i)||(i=n.length),u=[],r=t;r<t+i;r++)u.push(n.charCodeAt(r));return u},escape:function(n){return n.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&")},replaceAll:function(n,t,i){var r=new RegExp(System.String.escape(t),"g");return n.replace(r,i)},insert:function(n,t,i){return n>0?t.substring(0,n)+i+t.substring(n,t.length):i+t},remove:function(n,t,i){if(n==null)throw new System.NullReferenceException;if(t<0)throw new System.ArgumentOutOfRangeException("startIndex","StartIndex cannot be less than zero");if(i!=null){if(i<0)throw new System.ArgumentOutOfRangeException("count","Count cannot be less than zero");if(i>n.length-t)throw new System.ArgumentOutOfRangeException("count","Index and count must refer to a location within the string");}else if(t>=n.length)throw new System.ArgumentOutOfRangeException("startIndex","startIndex must be less than length of string");return i==null||t+i>n.length?n.substr(0,t):n.substr(0,t)+n.substr(t+i)},split:function(n,t,i,r){for(var o=!Bridge.hasValue(t)||t.length===0?new RegExp("\\s","g"):new RegExp(t.map(System.String.escape).join("|"),"g"),f=[],e,u=0;;u=o.lastIndex)if(e=o.exec(n)){if(r!==1||e.index>u){if(f.length===i-1)return f.push(n.substr(u)),f;f.push(n.substring(u,e.index))}}else return(r!==1||u!==n.length)&&f.push(n.substr(u)),f},trimEnd:function(n,t){return n.replace(t?new RegExp("["+System.String.escape(String.fromCharCode.apply(null,t))+"]+$"):/\s*$/,"")},trimStart:function(n,t){return n.replace(t?new RegExp("^["+System.String.escape(String.fromCharCode.apply(null,t))+"]+"):/^\s*/,"")},trim:function(n,t){return System.String.trimStart(System.String.trimEnd(n,t),t)},concat:function(){for(var t,i="",n=0;n<arguments.length;n++)t=arguments[n],i+=t==null?"":t;return i}};System.String=nt;s={nameEquals:function(n,t,i){return i?n.toLowerCase()===t.toLowerCase():n.charAt(0).toLowerCase()+n.slice(1)===t.charAt(0).toLowerCase()+t.slice(1)},checkEnumType:function(n){if(!n)throw new System.ArgumentNullException("enumType");if(n.prototype&&n.$kind!=="enum")throw new System.ArgumentException("","enumType");},toName:function(n){return n},parse:function(n,t,i,r){var o,f,e,v,h,u;if(System.Enum.checkEnumType(n),o={},System.Int32.tryParse(t,o))return o.v;if(f=n,n.prototype&&n.prototype.$flags){var c=t.split(","),l=0,a=!0;for(e=c.length-1;e>=0;e--){v=c[e].trim();h=!1;for(u in f)if(s.nameEquals(u,v,i)){l|=f[u];h=!0;break}if(!h){a=!1;break}}if(a)return l}else for(u in f)if(s.nameEquals(u,t,i))return f[u];if(r!==!0)throw new System.ArgumentException("Invalid Enumeration Value");return null},toString:function(n,t,i){var u,e,f,r;if(n===Number)return t.toString();if(System.Enum.checkEnumType(n),u=n,e=System.Int64.is64Bit(t),(n.prototype&&n.prototype.$flags||i===!0)&&t!==0){f=[];for(r in u)(e&&System.Int64.is64Bit(u[r])?!u[r].and(t).isZero():u[r]&t)&&f.push(s.toName(r));return f.length?f.join(", "):t.toString()}for(r in u)if(e&&System.Int64.is64Bit(u[r])?u[r].eq(t):u[r]===t)return s.toName(r);return t.toString()},getValues:function(n){var r,t,i;System.Enum.checkEnumType(n);r=[];t=n;for(i in t)t.hasOwnProperty(i)&&i.indexOf("$")<0&&typeof t[i]!="function"&&r.push(t[i]);return r},format:function(n,t,i){System.Enum.checkEnumType(n);var r;if(!Bridge.hasValue(t)&&(r="value")||!Bridge.hasValue(i)&&(r="format"))throw new System.ArgumentNullException(r);switch(i){case"G":case"g":return System.Enum.toString(n,t);case"x":case"X":return t.toString(16);case"d":case"D":return t.toString();case"f":case"F":return System.Enum.toString(n,t,!0);default:throw new System.FormatException;}},getNames:function(n){var r,i,t;System.Enum.checkEnumType(n);r=[];i=n;for(t in i)i.hasOwnProperty(t)&&t.indexOf("$")<0&&typeof i[t]!="function"&&r.push(s.toName(t));return r},getName:function(n,t){var r,i;System.Enum.checkEnumType(n);r=n;for(i in r)if(r[i]===t)return i.charAt(0).toUpperCase()+i.slice(1);return null},hasFlag:function(n,t){return!!(n&t)},isDefined:function(n,t){var i,u,r;System.Enum.checkEnumType(n);i=n;u=Bridge.isString(t);for(r in i)if(u?s.nameEquals(r,t,!1):i[r]===t)return!0;return!1},tryParse:function(n,t,i,r){return(i.v=0,i.v=s.parse(n,t,r,!0),i.v==null)?!1:!0}};System.Enum=s;var i=function(n){return n.test(navigator.userAgent.toLowerCase())},tt=Bridge.global.document&&Bridge.global.document.compatMode==="CSS1Compat",v=function(n,t){var i;return n&&(i=t.exec(navigator.userAgent.toLowerCase()))?parseFloat(i[1]):0},r=Bridge.global.document?Bridge.global.document.documentMode:null,p=i(/opera/),kt=p&&i(/version\/10\.5/),it=i(/\bchrome\b/),d=i(/webkit/),c=!it&&i(/safari/),dt=c&&i(/applewebkit\/4/),gt=c&&i(/version\/3/),ni=c&&i(/version\/4/),ti=c&&i(/version\/5\.0/),ii=c&&i(/version\/5/),u=!p&&(i(/msie/)||i(/trident/)),e=u&&(i(/msie 7/)&&r!==8&&r!==9&&r!==10||r===7),h=u&&(i(/msie 8/)&&r!==7&&r!==9&&r!==10||r===8),l=u&&(i(/msie 9/)&&r!==7&&r!==8&&r!==10||r===9),w=u&&(i(/msie 10/)&&r!==7&&r!==8&&r!==9||r===10),rt=u&&(i(/trident\/7\.0/)&&r!==7&&r!==8&&r!==9&&r!==10||r===11),f=u&&i(/msie 6/),y=!d&&!u&&i(/gecko/),b=y&&i(/rv:1\.9/),ri=y&&i(/rv:2\.0/),ui=y&&i(/rv:5\./),fi=y&&i(/rv:10\./),ei=b&&i(/rv:1\.9\.0/),oi=b&&i(/rv:1\.9\.1/),si=b&&i(/rv:1\.9\.2/),ut=i(/windows|win32/),ft=i(/macintosh|mac os x/),et=i(/linux/),hi=v(!0,/\bchrome\/(\d+\.\d+)/),a=v(!0,/\bfirefox\/(\d+\.\d+)/),ci=v(u,/msie (\d+\.\d+)/),li=v(p,/version\/(\d+\.\d+)/),ai=v(c,/version\/(\d+\.\d+)/),vi=v(d,/webkit\/(\d+\.\d+)/),yi=Bridge.global.location?/^https/i.test(Bridge.global.location.protocol):!1,ot=/iPhone/i.test(navigator.platform),st=/iPod/i.test(navigator.platform),g=/iPad/i.test(navigator.userAgent),pi=/Blackberry/i.test(navigator.userAgent),ht=/Android/i.test(navigator.userAgent),ct=ft||ut||et&&!ht,lt=g,wi=!ct&&!lt,bi={isStrict:tt,isIEQuirks:u&&!tt&&(f||e||h||l),isOpera:p,isOpera10_5:kt,isWebKit:d,isChrome:it,isSafari:c,isSafari3:gt,isSafari4:ni,isSafari5:ii,isSafari5_0:ti,isSafari2:dt,isIE:u,isIE6:f,isIE7:e,isIE7m:f||e,isIE7p:u&&!f,isIE8:h,isIE8m:f||e||h,isIE8p:u&&!(f||e),isIE9:l,isIE9m:f||e||h||l,isIE9p:u&&!(f||e||h),isIE10:w,isIE10m:f||e||h||l||w,isIE10p:u&&!(f||e||h||l),isIE11:rt,isIE11m:f||e||h||l||w||rt,isIE11p:u&&!(f||e||h||l||w),isGecko:y,isGecko3:b,isGecko4:ri,isGecko5:ui,isGecko10:fi,isFF3_0:ei,isFF3_5:oi,isFF3_6:si,isFF4:4<=a&&a<5,isFF5:5<=a&&a<6,isFF10:10<=a&&a<11,isLinux:et,isWindows:ut,isMac:ft,chromeVersion:hi,firefoxVersion:a,ieVersion:ci,operaVersion:li,safariVersion:ai,webKitVersion:vi,isSecure:yi,isiPhone:ot,isiPod:st,isiPad:g,isBlackberry:pi,isAndroid:ht,isDesktop:ct,isTablet:lt,isPhone:wi,iOS:ot||g||st,standalone:Bridge.global.navigator?!!Bridge.global.navigator.standalone:!1};Bridge.Browser=bi;at={_initialize:function(){this.$initialized||(this.$initialized=Bridge.emptyFn,this.$staticInit&&this.$staticInit(),this.$initMembers&&this.$initMembers())},initConfig:function(n,t,i,r,u,f){var s,e,o,h;if(i.fields)for(e in i.fields)u[e]=i.fields[e];if(i.properties)for(e in i.properties)Bridge.property(u,e,i.properties[e],r);if(i.events)for(e in i.events)Bridge.event(u,e,i.events[e],r);if(i.alias)for(o=0;o<i.alias.length;o++)h=u[i.alias[o]],h===undefined&&f&&(h=f[i.alias[o]]),u[i.alias[o+1]]=h,o++;i.init&&(s=i.init);(s||n&&!r&&t.$initMembers)&&(u.$initMembers=function(){n&&!r&&t.$initMembers&&t.$initMembers.call(this);s&&s.call(this)})},definei:function(n,t,i){(i===!0||!i)&&t?t.$kind="interface":i?i.$kind="interface":t={$kind:"interface"};var r=Bridge.define(n,t,i);return r.$kind="interface",r.$isInterface=!0,r},define:function(n,t,i,r){var l=!1,c,u,ft,nt,p,w,tt,b,k,d,st,it,rt,ut;if(i===!0?(l=!0,i=t,t=Bridge.global):i||(i=t,t=Bridge.global),Bridge.isFunction(i))return c=function(){var t,r,f,u;return(r=Bridge.Class.getCachedType(c,arguments),r)?r.type:(t=Array.prototype.slice.call(arguments),f=i.apply(null,t),u=Bridge.define(Bridge.Class.genericName(n,t),f,!0,{fn:c,args:t}),Bridge.Class.staticInitAllow||Bridge.Class.$queue.push(u),Bridge.get(u))},c.$cache=[],Bridge.Class.generic(n,t,c,i.length);l||(Bridge.Class.staticInitAllow=!1);i=i||{};var f=i.$inherits||i.inherits,o=i.$statics||i.statics,et=i.$entryPoint,a,h,v=i.$scope||t||Bridge.global,s,ot,g,y,e;if(i.$kind=i.$kind||"class",i.$inherits?delete i.$inherits:delete i.inherits,et&&delete i.$entryPoint,Bridge.isFunction(o)?o=null:i.$statics?delete i.$statics:delete i.statics,ft=i.hasOwnProperty("ctor")&&i.ctor,ft?u=ft:(u=i.$literal?function(n){return n=n||{},n.$getType=function(){return u},n}:function(){this.$initialize();u.$base&&(u.$$inherits&&u.$$inherits.length>0&&u.$$inherits[0].$staticInit&&u.$$inherits[0].$staticInit(),u.$base.ctor.call(this))},i.ctor=u),i.$literal&&(o&&o.getDefaultValue||(u.getDefaultValue=function(){var n={};return n.$getType=function(){return u},n}),u.$literal=!0,delete i.$literal),l||(v=Bridge.Class.set(v,n,u)),r&&r.fn.$cache.push({type:u,args:r.args}),u.$$name=n,u.$kind=i.$kind,r&&l){for(u.$genericTypeDefinition=r.fn,u.$typeArguments=r.args,u.$assembly=r.fn.$assembly||Bridge.$currentAssembly,nt=Bridge.Reflection.getTypeFullName(r.fn),s=0;s<r.args.length;s++)nt+=(s===0?"[":",")+"["+Bridge.Reflection.getTypeQName(r.args[s])+"]";nt+="]";u.$$fullname=nt}else u.$$fullname=u.$$name;if(f&&Bridge.isFunction(f)&&(f=f()),p=[],w=[],f)for(tt=0;tt<f.length;tt++){if(b=f[tt],k=(b.$interfaces||[]).concat(b.$baseInterfaces||[]),k.length>0)for(d=0;d<k.length;d++)w.indexOf(k[d])<0&&w.push(k[d]);b.$kind==="interface"&&p.push(b)}u.$baseInterfaces=w;u.$interfaces=p;u.$allInterfaces=p.concat(w);st=f?f[0].$kind==="interface":!0;st&&(f=null);a=f?f[0].prototype:this.prototype;u.$base=a;h=f?f[0].$$initCtor?new f[0].$$initCtor:new f[0]:{};u.$$initCtor=function(){};u.$$initCtor.prototype=h;u.$$initCtor.prototype.constructor=u;u.$$initCtor.prototype.$$fullname=r&&l?u.$$fullname:u.$$name;o&&(it=o.$config||o.config,it&&!Bridge.isFunction(it)&&(Bridge.Class.initConfig(f,a,it,!0,u),o.$config?delete o.$config:delete o.config));rt=i.$config||i.config;rt&&!Bridge.isFunction(rt)?(Bridge.Class.initConfig(f,a,rt,!1,i,h),i.$config?delete i.$config:delete i.config):f&&a.$initMembers&&(i.$initMembers=function(){a.$initMembers.call(this)});i.$initialize=Bridge.Class._initialize;ut=[];for(e in i)ut.push(e);for(s=0;s<ut.length;s++)e=ut[s],ot=i[e],g=e==="ctor",y=e,Bridge.isFunction(ot)&&(g||e.match("^\\$ctor")!==null)&&(g=!0),g?(u[y]=i[e],u[y].prototype=h,u[y].prototype.constructor=u,h[y]=i[e]):h[y]=i[e];if(h.$$name=n,o)for(e in o)e==="ctor"?u.$ctor=o[e]:u[e]=o[e];for(f||(f=[Object].concat(p)),u.$$inherits=f,s=0;s<f.length;s++)v=f[s],v.$$inheritors||(v.$$inheritors=[]),v.$$inheritors.push(u);return c=function(){Bridge.Class.staticInitAllow&&(u.$staticInit=null,u.$initMembers&&u.$initMembers(),u.$ctor&&u.$ctor())},(et||Bridge.isFunction(h.$main))&&Bridge.Class.$queueEntry.push(u),u.$staticInit=c,l||Bridge.Class.registerType(n,u),Bridge.Reflection&&(u.$getMetadata=Bridge.Reflection.getMetadata),u.$kind==="enum"&&(u.$is=function(n){var t=u.prototype.$utype;return t===System.String?typeof n=="string":t&&t.$is?t.$is(n):typeof n=="number"},u.getDefaultValue=function(){var n=u.prototype.$utype;return n===System.String?null:0}),u.$kind==="interface"&&(u.prototype.$variance&&(u.isAssignableFrom=Bridge.Class.varianceAssignable),u.$isInterface=!0),u},varianceAssignable:function(n){var r=function(n,t){var i;if(t.$genericTypeDefinition===n.$genericTypeDefinition&&t.$typeArguments.length===n.$typeArguments.length){for(i=0;i<n.$typeArguments.length;i++){var f=n.prototype.$variance[i],r=n.$typeArguments[i],u=t.$typeArguments[i];switch(f){case 1:if(!Bridge.Reflection.isAssignableFrom(r,u))return!1;break;case 2:if(!Bridge.Reflection.isAssignableFrom(u,r))return!1;break;default:if(u!==r)return!1}}return!0}return!1},i,t;if(n.$kind==="interface"&&r(this,n))return!0;for(i=Bridge.Reflection.getInterfaces(n),t=0;t<i.length;t++)if(i[t]===this||r(this,i[t]))return!0;return!1},registerType:function(n,t){Bridge.$currentAssembly&&(Bridge.$currentAssembly.$types[n]=t,t.$assembly=Bridge.$currentAssembly)},addExtend:function(n,t){var f,i,r,u;for(Array.prototype.push.apply(n.$$inherits,t),n.$interfaces=n.$interfaces||[],n.$baseInterfaces=n.$baseInterfaces||[],f=0;f<t.length;f++){if(i=t[f],i.$$inheritors||(i.$$inheritors=[]),i.$$inheritors.push(n),r=(i.$interfaces||[]).concat(i.$baseInterfaces||[]),r.length>0)for(u=0;u<r.length;u++)n.$baseInterfaces.indexOf(r[u])<0&&n.$baseInterfaces.push(r[u]);i.$kind==="interface"&&n.$interfaces.push(i)}n.$allInterfaces=n.$interfaces.concat(n.$baseInterfaces)},set:function(n,t,i,r){for(var u=t.split("."),o,h,e,s,f=0;f<u.length-1;f++)typeof n[u[f]]=="undefined"&&(n[u[f]]={}),n=n[u[f]];if(o=u[u.length-1],e=n[o],e){if(e.$$name===t)throw"Class '"+t+"' is already defined";for(h in e)s=e[h],typeof s=="function"&&s.$$name&&function(n,t,i){Object.defineProperty(n,t,{get:function(){return Bridge.Class.staticInitAllow&&(i.$staticInit&&i.$staticInit(),Bridge.Class.defineProperty(n,t,i)),i},set:function(n){i=n},enumerable:!0,configurable:!0})}(i,h,s)}return r!==!0?function(n,t,i){Object.defineProperty(n,t,{get:function(){return Bridge.Class.staticInitAllow&&(i.$staticInit&&i.$staticInit(),Bridge.Class.defineProperty(n,t,i)),i},set:function(n){i=n},enumerable:!0,configurable:!0})}(n,o,i):n[o]=i,n},defineProperty:function(n,t,i){Object.defineProperty(n,t,{value:i,enumerable:!0,configurable:!0})},genericName:function(n,t){for(var r,u=n,i=0;i<t.length;i++)r=t[i],u+="$"+(r.$$name||Bridge.getTypeName(r));return u},getCachedType:function(n,t){for(var e=n.$cache,o=e.length,i,f,r,u=0;u<o;u++)if(i=e[u],i.args.length===t.length){for(f=!0,r=0;r<i.args.length;r++)if(i.args[r]!==t[r]){f=!1;break}if(f)return i}return null},generic:function(n,t,i,r){return i.$$name=n,i.$kind="class",Bridge.Class.set(t,n,i,!0),Bridge.Class.registerType(n,i),i.$typeArgumentCount=r,i.$isGenericTypeDefinition=!0,i.$getMetadata=Bridge.Reflection.getMetadata,i},init:function(n){var r,i,t;for(Bridge.Class.staticInitAllow=!0,r=Bridge.Class.$queue.concat(Bridge.Class.$queueEntry),i=0;i<r.length;i++)t=r[i],t.$staticInit&&t.$staticInit(),t.prototype.$main&&Bridge.ready(t.prototype.$main);Bridge.Class.$queue.length=0;Bridge.Class.$queueEntry.length=0;n&&n()}};Bridge.Class=at;Bridge.Class.$queue=[];Bridge.Class.$queueEntry=[];Bridge.define=Bridge.Class.define;Bridge.definei=Bridge.Class.definei;Bridge.init=Bridge.Class.init;Bridge.assembly=function(n,t,i){i||(i=t,t={});n=n||"Bridge.$Unknown";var r=System.Reflection.Assembly.assemblies[n];r?Bridge.apply(r.res,t||{}):r=new System.Reflection.Assembly(n,t);Bridge.$currentAssembly=r;i&&i.call(Bridge.global,r,Bridge.global);Bridge.init()};Bridge.define("System.Reflection.Assembly",{statics:{assemblies:{}},ctor:function(n,t){this.$initialize();this.name=n;this.res=t||{};this.$types={};this.$={};System.Reflection.Assembly.assemblies[n]=this},toString:function(){return this.name},getManifestResourceNames:function(){return Object.keys(this.res)},getManifestResourceDataAsBase64:function(n,t){return arguments.length===1&&(t=n,n=null),n&&(t=Bridge.Reflection.getTypeNamespace(n)+"."+t),this.res[t]||null},getManifestResourceData:function(n,t){arguments.length===1&&(t=n,n=null);n&&(t=Bridge.Reflection.getTypeNamespace(n)+"."+t);var i=this.res[t];return i?System.Convert.fromBase64String(i):null},getCustomAttributes:function(n){return n&&!Bridge.isBoolean(n)?this.attr.filter(function(t){return Bridge.is(t,n)}):this.attr}});Bridge.$currentAssembly=new System.Reflection.Assembly("mscorlib");Bridge.SystemAssembly=Bridge.$currentAssembly;Bridge.SystemAssembly.$types["System.Reflection.Assembly"]=System.Reflection.Assembly;System.Reflection.Assembly.$assembly=Bridge.SystemAssembly;o=Bridge.$currentAssembly,function(){Bridge.SystemAssembly.version="15.6.0";Bridge.SystemAssembly.compiler="15.6.0"}();Bridge.define("Bridge.Utils.SystemAssemblyVersion");Bridge.Reflection={setMetadata:function(n,t){n.$getMetadata=Bridge.Reflection.getMetadata;n.$metadata=t},initMetaData:function(n,t){var r,i;if(t.m)for(r=0;r<t.m.length;r++)i=t.m[r],i.td=n,i.ad&&(i.ad.td=n),i.r&&(i.r.td=n),i.g&&(i.g.td=n),i.s&&(i.s.td=n);n.$metadata=t;n.$initMetaData=!0},getMetadata:function(){var n,t,i,r;if(!this.$metadata&&this.$genericTypeDefinition&&(this.$metadata=this.$genericTypeDefinition.$factoryMetadata||this.$genericTypeDefinition.$metadata),n=this.$metadata,typeof n=="function")if(this.$isGenericTypeDefinition){for(i=this.$typeArgumentCount,r=new Array(i),t=0;t<i;t++)r[t]=Object;this.$factoryMetadata=this.$metadata;n=this.$metadata.apply(null,r)}else n=this.$typeArguments?this.$metadata.apply(null,this.$typeArguments):this.$metadata();return!this.$initMetaData&&n&&Bridge.Reflection.initMetaData(this,n),n},load:function(n){return System.Reflection.Assembly.assemblies[n]||require(n)},getGenericTypeDefinition:function(n){if(n.$isGenericTypeDefinition)return n;if(!n.$genericTypeDefinition)throw new System.InvalidOperationException("This operation is only valid on generic types.");return n.$genericTypeDefinition},getGenericParameterCount:function(n){return n.$typeArgumentCount||0},getGenericArguments:function(n){return n.$typeArguments||null},isGenericTypeDefinition:function(n){return n.$isGenericTypeDefinition||!1},getBaseType:function(n){var t,i;if(n===Object||n.$kind==="interface"||n.prototype==null)return null;if(Object.getPrototypeOf)return Object.getPrototypeOf(n.prototype).constructor;if(t=n.prototype,Object.prototype.hasOwnProperty.call(t,"constructor"))try{return i=t.constructor,delete t.constructor,t.constructor}finally{t.constructor=i}return t.constructor},getTypeFullName:function(n){var i,t;return n.$$fullname?n.$$fullname:n.$$name?n.$$name:(i=n.constructor===Function?n.toString():n.constructor.toString(),t=/function (.{1,})\(/.exec(i),t&&t.length>1?t[1]:"Object")},_makeQName:function(n,t){return n+(t?", "+t.name:"")},getTypeQName:function(n){return Bridge.Reflection._makeQName(Bridge.Reflection.getTypeFullName(n),n.$assembly)},getTypeName:function(n){var t=Bridge.Reflection.getTypeFullName(n),i=t.indexOf("["),r=t.lastIndexOf(".",i>=0?i:t.length);return r>0?t.substr(r+1):t},getTypeNamespace:function(n){var t=Bridge.Reflection.getTypeFullName(n),u=t.indexOf("["),f=t.lastIndexOf(".",u>=0?u:t.length),i=f>0?t.substr(0,f):"",r;return n.$assembly&&(r=Bridge.Reflection._getAssemblyType(n.$assembly,i),r&&(i=Bridge.Reflection.getTypeNamespace(r))),i},getTypeAssembly:function(n){return System.Array.contains([Date,Number,Boolean,String,Function,Array],n)?Bridge.SystemAssembly:n.$assembly||Bridge.SystemAssembly},_getAssemblyType:function(n,t){var e=!1,u,f,i,r;if(n||(n=Bridge.SystemAssembly,e=!0),n.$types){if(u=n.$types[t]||null,u)return u;if(n.name==="mscorlib")n=Bridge.global;else return null}for(f=t.split("."),i=n,r=0;r<f.length;r++)if(i=i[f[r]],!i)return null;return typeof i!="function"||!e&&i.$assembly&&n.name!==i.$assembly.name?null:i},getAssemblyTypes:function(n){var t=[],i,r;if(n.$types)for(i in n.$types)n.$types.hasOwnProperty(i)&&t.push(n.$types[i]);else r=function(n,i){for(var u in n)n.hasOwnProperty(u)&&r(n[u],u);typeof n=="function"&&Bridge.isUpper(i.charCodeAt(0))&&t.push(n)},r(n,"");return t},createAssemblyInstance:function(n,t){var i=Bridge.Reflection.getType(t,n);return i?Bridge.createInstance(i):null},getInterfaces:function(n){return n.$allInterfaces?n.$allInterfaces:n===Date?[System.IComparable$1(Date),System.IEquatable$1(Date),System.IComparable,System.IFormattable]:n===Number?[System.IComparable$1(Bridge.Int),System.IEquatable$1(Bridge.Int),System.IComparable,System.IFormattable]:n===Boolean?[System.IComparable$1(Boolean),System.IEquatable$1(Boolean),System.IComparable]:n===String?[System.IComparable$1(String),System.IEquatable$1(String),System.IComparable,System.ICloneable,System.Collections.IEnumerable,System.Collections.Generic.IEnumerable$1(System.Char)]:n===Array||System.Array._typedArrays[Bridge.getTypeName(n)]?[System.Collections.IEnumerable,System.Collections.ICollection,System.ICloneable,System.Collections.Generic.IEnumerable$1(Object),System.Collections.Generic.ICollection$1(Object),System.Collections.Generic.IList$1(Object)]:[]},isInstanceOfType:function(n,t){return Bridge.is(n,t)},isAssignableFrom:function(n,t){if(n==null)throw new System.NullReferenceException;if(t==null)return!1;if(n===t||n===Object)return!0;if(Bridge.isFunction(n.isAssignableFrom))return n.isAssignableFrom(t);if(t===Array)return System.Array.is([],n);if(Bridge.Reflection.isInterface(n)&&System.Array.contains(Bridge.Reflection.getInterfaces(t),n))return!0;var r=t.$$inherits,i,u;if(r)for(i=0;i<r.length;i++)if(u=Bridge.Reflection.isAssignableFrom(n,r[i]),u)return!0;return!1},isClass:function(n){return n.$kind==="class"||n===Array||n===Function||n===RegExp||n===String||n===Error||n===Object},isEnum:function(n){return n.$kind==="enum"},isFlags:function(n){return!!(n.prototype&&n.prototype.$flags)},isInterface:function(n){return n.$kind==="interface"},_getType:function(n,t,i){var s=!i;i=i||/[[,\]]/g;var o=i.lastIndex,r=i.exec(n),f,e=[],u;if(r){f=n.substring(o,r.index);switch(r[0]){case"[":if(n[r.index+1]!=="[")return null;for(;;){if(i.exec(n),u=Bridge.Reflection._getType(n,Bridge.SystemAssembly,i),!u)return null;if(e.push(u),r=i.exec(n),r[0]==="]")break;else if(r[0]!==",")return null}if(r=i.exec(n),r&&r[0]===","&&(i.exec(n),!(t=System.Reflection.Assembly.assemblies[(i.lastIndex>0?n.substring(r.index+1,i.lastIndex-1):n.substring(r.index+1)).trim()])))return null;break;case",":if(i.exec(n),!(t=System.Reflection.Assembly.assemblies[(i.lastIndex>0?n.substring(r.index+1,i.lastIndex-1):n.substring(r.index+1)).trim()]))return null}}else f=n.substring(o);return s&&i.lastIndex?null:(u=Bridge.Reflection._getAssemblyType(t,f.trim()),u=e.length?u.apply(null,e):u,u&&u.$staticInit&&u.$staticInit(),u)},getType:function(n,t){return n?Bridge.Reflection._getType(n,t):null},canAcceptNull:function(n){return n.$kind==="struct"||n===System.Decimal||n===System.Int64||n===System.UInt64||n===System.Double||n===System.Single||n===System.Byte||n===System.SByte||n===System.Int16||n===System.UInt16||n===System.Int32||n===System.UInt32||n===Bridge.Int||n===Boolean||n===Date||n===Number?!1:!0},applyConstructor:function(n,t){var a,f,s,h,e,i,r,c,o,u,l;if(!t||t.length===0)return new n;if(n.$$initCtor&&n.$kind!=="anonymous"){if(a=Bridge.getMetadata(n),f=0,a){for(s=Bridge.Reflection.getMembers(n,1,28),e=0;e<s.length;e++)if(i=s[e],i.p&&i.p.length===t.length){for(h=!0,r=0;r<i.p.length;r++)if(c=i.p[r],!Bridge.is(t[r],c)||t[r]==null&&!Bridge.Reflection.canAcceptNull(c)){h=!1;break}h&&(n=n[i.sn],f++)}}else if(Bridge.isFunction(n.ctor)&&n.ctor.length===t.length)n=n.ctor;else for(o="$ctor",u=1;Bridge.isFunction(n[o+u]);)n[o+u].length===t.length&&(n=n[o+u],f++),u++;if(f>1)throw new System.Exception("The ambiguous constructor call");}return l=function(){n.apply(this,t)},l.prototype=n.prototype,new l},getAttributes:function(n,t,i){var f=[],r,o,u,e,s,c,h;if(i&&(c=Bridge.Reflection.getBaseType(n),c))for(u=Bridge.Reflection.getAttributes(c,t,!0),r=0;r<u.length;r++)o=Bridge.getType(u[r]),e=Bridge.getMetadata(o),e&&e.ni||f.push(u[r]);if(s=Bridge.getMetadata(n),s&&s.at)for(r=0;r<s.at.length;r++)if(u=s.at[r],t==null||Bridge.Reflection.isInstanceOfType(u,t)){if(o=Bridge.getType(u),e=Bridge.getMetadata(o),!e||!e.am)for(h=f.length-1;h>=0;h--)Bridge.Reflection.isInstanceOfType(f[h],o)&&f.splice(h,1);f.push(u)}return f},getMembers:function(n,t,i,r,u){var e=[],l,a,o,y,h,c,v,s,f;if(((i&72)==72||(i&6)==4)&&(l=Bridge.Reflection.getBaseType(n),l&&(e=Bridge.Reflection.getMembers(l,t&-2,i&(i&64?255:247)&(i&2?251:255),r,u))),a=function(n){if(t&n.t&&(i&4&&!n.is||i&8&&n.is)&&(!r||n.n===r)){if(u){if((n.p||[]).length!==u.length)return;for(var f=0;f<u.length;f++)if(u[f]!==n.p[f])return}e.push(n)}},o=Bridge.getMetadata(n),o&&o.m)for(y=["g","s","ad","r"],f=0;f<o.m.length;f++)for(h=o.m[f],a(h),c=0;c<4;c++)v=y[c],h[v]&&a(h[v]);if(i&256){while(n){for(s=[],f=0;f<e.length;f++)e[f].td===n&&s.push(e[f]);if(s.length>1)throw new System.Reflection.AmbiguousMatchException("Ambiguous match");else if(s.length===1)return s[0];n=Bridge.Reflection.getBaseType(n)}return null}return e},midel:function(n,t,i){var r,u,f,e;if(n.is&&!!t)throw new System.ArgumentException("Cannot specify target for static method");else if(!n.is&&!t)throw new System.ArgumentException("Must specify target for instance method");if(n.fg)r=function(){return(n.is?n.td:this)[n.fg]};else if(n.fs)r=function(t){(n.is?n.td:this)[n.fs]=t};else{if(r=n.def||(n.is||n.sm?n.td[n.sn]:t[n.sn]),n.tpc){if(!i||i.length!==n.tpc)throw new System.ArgumentException("Wrong number of type arguments");u=r;r=function(){return u.apply(this,i.concat(Array.prototype.slice.call(arguments)))}}else if(i&&i.length)throw new System.ArgumentException("Cannot specify type arguments for non-generic method");n.exp&&(f=r,r=function(){return f.apply(this,Array.prototype.slice.call(arguments,0,arguments.length-1).concat(arguments[arguments.length-1]))});n.sm&&(e=r,r=function(){return e.apply(null,[this].concat(Array.prototype.slice.call(arguments)))})}return Bridge.fn.bind(t,r)},invokeCI:function(n,t){return n.exp&&(t=t.slice(0,t.length-1).concat(t[t.length-1])),n.def?n.def.apply(null,t):n.sm?n.td[n.sn].apply(null,t):Bridge.Reflection.applyConstructor(n.sn?n.td[n.sn]:n.td,t)},fieldAccess:function(n,t){if(n.is&&!!t)throw new System.ArgumentException("Cannot specify target for static field");else if(!n.is&&!t)throw new System.ArgumentException("Must specify target for instance field");if(t=n.is?n.td:t,arguments.length===3)t[n.sn]=arguments[2];else return t[n.sn]}};Bridge.setMetadata=Bridge.Reflection.setMetadata;System.Reflection.ConstructorInfo={$is:function(n){return n!=null&&n.t===1}};System.Reflection.EventInfo={$is:function(n){return n!=null&&n.t===2}};System.Reflection.FieldInfo={$is:function(n){return n!=null&&n.t===4}};System.Reflection.MethodBase={$is:function(n){return n!=null&&(n.t===1||n.t===8)}};System.Reflection.MethodInfo={$is:function(n){return n!=null&&n.t===8}};System.Reflection.PropertyInfo={$is:function(n){return n!=null&&n.t===16}};System.AppDomain={getAssemblies:function(){return Object.keys(System.Reflection.Assembly.assemblies).map(function(n){return System.Reflection.Assembly.assemblies[n]})}};Bridge.define("System.IFormattable",{$kind:"interface",statics:{$is:function(n){return Bridge.isNumber(n)||Bridge.isDate(n)?!0:Bridge.is(n,System.IFormattable,!0)}}});Bridge.define("System.IComparable",{$kind:"interface",statics:{$is:function(n){return Bridge.isNumber(n)||Bridge.isDate(n)||Bridge.isBoolean(n)||Bridge.isString(n)?!0:Bridge.is(n,System.IComparable,!0)}}});Bridge.define("System.IFormatProvider",{$kind:"interface"});Bridge.define("System.ICloneable",{$kind:"interface"});Bridge.define("System.IComparable$1",function(n){return{$kind:"interface",statics:{$is:function(t){return Bridge.isNumber(t)&&n.$number&&n.$is(t)||Bridge.isDate(t)&&n===Date||Bridge.isBoolean(t)&&n===Boolean||Bridge.isString(t)&&n===String?!0:Bridge.is(t,System.IComparable$1(n),!0)}}}});Bridge.define("System.IEquatable$1",function(n){return{$kind:"interface",statics:{$is:function(t){return Bridge.isNumber(t)&&n.$number&&n.$is(t)||Bridge.isDate(t)&&n===Date||Bridge.isBoolean(t)&&n===Boolean||Bridge.isString(t)&&n===String?!0:Bridge.is(t,System.IEquatable$1(n),!0)}}}});Bridge.define("Bridge.IPromise",{$kind:"interface"});Bridge.define("System.IDisposable",{$kind:"interface"});vt={hasValue:Bridge.hasValue,getValue:function(n){if(!Bridge.hasValue(n))throw new System.InvalidOperationException("Nullable instance doesn't have a value.");return n},getValueOrDefault:function(n,t){return Bridge.hasValue(n)?n:t},add:function(n,t){return Bridge.hasValue$1(n,t)?n+t:null},band:function(n,t){return Bridge.hasValue$1(n,t)?n&t:null},bor:function(n,t){return Bridge.hasValue$1(n,t)?n|t:null},and:function(n,t){return n===!0&&t===!0?!0:n===!1||t===!1?!1:null},or:function(n,t){return n===!0||t===!0?!0:n===!1&&t===!1?!1:null},div:function(n,t){return Bridge.hasValue$1(n,t)?n/t:null},eq:function(n,t){return Bridge.hasValue(n)?n===t:!Bridge.hasValue(t)},equals:function(n,t,i){return Bridge.hasValue(n)?i?i(n,t):Bridge.equals(n,t):!Bridge.hasValue(t)},toString:function(n,t){return Bridge.hasValue(n)?t?t(n):n.toString():""},getHashCode:function(n,t){return Bridge.hasValue(n)?t?t(n):Bridge.getHashCode(n):0},xor:function(n,t){return Bridge.hasValue$1(n,t)?n^t:null},gt:function(n,t){return Bridge.hasValue$1(n,t)&&n>t},gte:function(n,t){return Bridge.hasValue$1(n,t)&&n>=t},neq:function(n,t){return Bridge.hasValue(n)?n!==t:Bridge.hasValue(t)},lt:function(n,t){return Bridge.hasValue$1(n,t)&&n<t},lte:function(n,t){return Bridge.hasValue$1(n,t)&&n<=t},mod:function(n,t){return Bridge.hasValue$1(n,t)?n%t:null},mul:function(n,t){return Bridge.hasValue$1(n,t)?n*t:null},sl:function(n,t){return Bridge.hasValue$1(n,t)?n<<t:null},sr:function(n,t){return Bridge.hasValue$1(n,t)?n>>t:null},srr:function(n,t){return Bridge.hasValue$1(n,t)?n>>>t:null},sub:function(n,t){return Bridge.hasValue$1(n,t)?n-t:null},bnot:function(n){return Bridge.hasValue(n)?~n:null},neg:function(n){return Bridge.hasValue(n)?-n:null},not:function(n){return Bridge.hasValue(n)?!n:null},pos:function(n){return Bridge.hasValue(n)?+n:null},lift:function(){for(var n=1;n<arguments.length;n++)if(!Bridge.hasValue(arguments[n]))return null;return arguments[0]==null?null:arguments[0].apply==undefined?arguments[0]:arguments[0].apply(null,Array.prototype.slice.call(arguments,1))},lift1:function(n,t){return Bridge.hasValue(t)?typeof n=="function"?n.apply(null,Array.prototype.slice.call(arguments,1)):t[n].apply(t,Array.prototype.slice.call(arguments,2)):null},lift2:function(n,t,i){return Bridge.hasValue$1(t,i)?typeof n=="function"?n.apply(null,Array.prototype.slice.call(arguments,1)):t[n].apply(t,Array.prototype.slice.call(arguments,2)):null},liftcmp:function(n,t,i){return Bridge.hasValue$1(t,i)?typeof n=="function"?n.apply(null,Array.prototype.slice.call(arguments,1)):t[n].apply(t,Array.prototype.slice.call(arguments,2)):!1},lifteq:function(n,t,i){var r=Bridge.hasValue(t),u=Bridge.hasValue(i);return!r&&!u||r&&u&&(typeof n=="function"?n.apply(null,Array.prototype.slice.call(arguments,1)):t[n].apply(t,Array.prototype.slice.call(arguments,2)))},liftne:function(n,t,i){var r=Bridge.hasValue(t),u=Bridge.hasValue(i);return r!==u||r&&(typeof n=="function"?n.apply(null,Array.prototype.slice.call(arguments,1)):t[n].apply(t,Array.prototype.slice.call(arguments,2)))}};System.Nullable=vt;Bridge.define("System.Nullable$1",function(n){return{$kind:"struct",statics:{getDefaultValue:function(){return null},$is:function(t){return Bridge.is(t,n)}}}});Bridge.define("System.Char",{inherits:[System.IComparable,System.IFormattable],$kind:"struct",statics:{min:0,max:65535,$is:function(n){return typeof n=="number"&&Math.round(n,0)==n&&n>=System.Char.min&&n<=System.Char.max},getDefaultValue:function(){return 0},parse:function(n){if(!Bridge.hasValue(n))throw new System.ArgumentNullException("s");if(n.length!==1)throw new System.FormatException;return n.charCodeAt(0)},tryParse:function(n,t){var i=n&&n.length===1;return t.v=i?n.charCodeAt(0):0,i},format:function(n,t,i){return Bridge.Int.format(n,t,i)},charCodeAt:function(n,t){if(n==null)throw new System.ArgumentNullException;if(n.length!=1)throw new System.FormatException("String must be exactly one character long");return n.charCodeAt(t)},isWhiteSpace:function(n){return!/[^\s\x09-\x0D\x85\xA0]/.test(n)},isDigit:function(n){return n<256?n>=48&&n<=57:new RegExp("[0-90-9٠-٩۰-۹߀-߉०-९০-৯੦-੯૦-૯୦-୯௦-௯౦-౯೦-೯൦-൯๐-๙໐-໙༠-༩၀-၉႐-႙០-៩᠐-᠙᥆-᥏᧐-᧙᪀-᪉᪐-᪙᭐-᭙᮰-᮹᱀-᱉᱐-᱙꘠-꘩꣐-꣙꤀-꤉꧐-꧙꩐-꩙꯰-꯹0-9]").test(String.fromCharCode(n))},isLetter:function(n){return n<256?n>=65&&n<=90||n>=97&&n<=122:new RegExp("[A-Za-za-zµß-öø-ÿāăąćĉċčďđēĕėęěĝğġģĥħĩīĭįıijĵķĸĺļľŀłńņňʼnŋōŏőœŕŗřśŝşšţťŧũūŭůűųŵŷźżž-ƀƃƅƈƌƍƒƕƙ-ƛƞơƣƥƨƪƫƭưƴƶƹƺƽ-ƿdžljnjǎǐǒǔǖǘǚǜǝǟǡǣǥǧǩǫǭǯǰdzǵǹǻǽǿȁȃȅȇȉȋȍȏȑȓȕȗșțȝȟȡȣȥȧȩȫȭȯȱȳ-ȹȼȿɀɂɇɉɋɍɏ-ʓʕ-ʯͱͳͷͻ-ͽΐά-ώϐϑϕ-ϗϙϛϝϟϡϣϥϧϩϫϭϯ-ϳϵϸϻϼа-џѡѣѥѧѩѫѭѯѱѳѵѷѹѻѽѿҁҋҍҏґғҕҗҙқҝҟҡңҥҧҩҫҭүұҳҵҷҹһҽҿӂӄӆӈӊӌӎӏӑӓӕӗәӛӝӟӡӣӥӧөӫӭӯӱӳӵӷӹӻӽӿԁԃԅԇԉԋԍԏԑԓԕԗԙԛԝԟԡԣԥԧա-ևᴀ-ᴫᵫ-ᵷᵹ-ᶚḁḃḅḇḉḋḍḏḑḓḕḗḙḛḝḟḡḣḥḧḩḫḭḯḱḳḵḷḹḻḽḿṁṃṅṇṉṋṍṏṑṓṕṗṙṛṝṟṡṣṥṧṩṫṭṯṱṳṵṷṹṻṽṿẁẃẅẇẉẋẍẏẑẓẕ-ẝẟạảấầẩẫậắằẳẵặẹẻẽếềểễệỉịọỏốồổỗộớờởỡợụủứừửữựỳỵỷỹỻỽỿ-ἇἐ-ἕἠ-ἧἰ-ἷὀ-ὅὐ-ὗὠ-ὧὰ-ώᾀ-ᾇᾐ-ᾗᾠ-ᾧᾰ-ᾴᾶᾷιῂ-ῄῆῇῐ-ΐῖῗῠ-ῧῲ-ῴῶῷℊℎℏℓℯℴℹℼℽⅆ-ⅉⅎↄⰰ-ⱞⱡⱥⱦⱨⱪⱬⱱⱳⱴⱶ-ⱻⲁⲃⲅⲇⲉⲋⲍⲏⲑⲓⲕⲗⲙⲛⲝⲟⲡⲣⲥⲧⲩⲫⲭⲯⲱⲳⲵⲷⲹⲻⲽⲿⳁⳃⳅⳇⳉⳋⳍⳏⳑⳓⳕⳗⳙⳛⳝⳟⳡⳣⳤⳬⳮⳳⴀ-ⴥⴧⴭꙁꙃꙅꙇꙉꙋꙍꙏꙑꙓꙕꙗꙙꙛꙝꙟꙡꙣꙥꙧꙩꙫꙭꚁꚃꚅꚇꚉꚋꚍꚏꚑꚓꚕꚗꜣꜥꜧꜩꜫꜭꜯ-ꜱꜳꜵꜷꜹꜻꜽꜿꝁꝃꝅꝇꝉꝋꝍꝏꝑꝓꝕꝗꝙꝛꝝꝟꝡꝣꝥꝧꝩꝫꝭꝯꝱ-ꝸꝺꝼꝿꞁꞃꞅꞇꞌꞎꞑꞓꞡꞣꞥꞧꞩꟺff-stﬓ-ﬗa-zA-ZÀ-ÖØ-ÞĀĂĄĆĈĊČĎĐĒĔĖĘĚĜĞĠĢĤĦĨĪĬĮİIJĴĶĹĻĽĿŁŃŅŇŊŌŎŐŒŔŖŘŚŜŞŠŢŤŦŨŪŬŮŰŲŴŶŸŹŻŽƁƂƄƆƇƉ-ƋƎ-ƑƓƔƖ-ƘƜƝƟƠƢƤƦƧƩƬƮƯƱ-ƳƵƷƸƼDŽLJNJǍǏǑǓǕǗǙǛǞǠǢǤǦǨǪǬǮDZǴǶ-ǸǺǼǾȀȂȄȆȈȊȌȎȐȒȔȖȘȚȜȞȠȢȤȦȨȪȬȮȰȲȺȻȽȾɁɃ-ɆɈɊɌɎͰͲͶΆΈ-ΊΌΎΏΑ-ΡΣ-ΫϏϒ-ϔϘϚϜϞϠϢϤϦϨϪϬϮϴϷϹϺϽ-ЯѠѢѤѦѨѪѬѮѰѲѴѶѸѺѼѾҀҊҌҎҐҒҔҖҘҚҜҞҠҢҤҦҨҪҬҮҰҲҴҶҸҺҼҾӀӁӃӅӇӉӋӍӐӒӔӖӘӚӜӞӠӢӤӦӨӪӬӮӰӲӴӶӸӺӼӾԀԂԄԆԈԊԌԎԐԒԔԖԘԚԜԞԠԢԤԦԱ-ՖႠ-ჅჇჍḀḂḄḆḈḊḌḎḐḒḔḖḘḚḜḞḠḢḤḦḨḪḬḮḰḲḴḶḸḺḼḾṀṂṄṆṈṊṌṎṐṒṔṖṘṚṜṞṠṢṤṦṨṪṬṮṰṲṴṶṸṺṼṾẀẂẄẆẈẊẌẎẐẒẔẞẠẢẤẦẨẪẬẮẰẲẴẶẸẺẼẾỀỂỄỆỈỊỌỎỐỒỔỖỘỚỜỞỠỢỤỦỨỪỬỮỰỲỴỶỸỺỼỾἈ-ἏἘ-ἝἨ-ἯἸ-ἿὈ-ὍὙὛὝὟὨ-ὯᾸ-ΆῈ-ΉῘ-ΊῨ-ῬῸ-Ώℂℇℋ-ℍℐ-ℒℕℙ-ℝℤΩℨK-ℭℰ-ℳℾℿⅅↃⰀ-ⰮⱠⱢ-ⱤⱧⱩⱫⱭ-ⱰⱲⱵⱾ-ⲀⲂⲄⲆⲈⲊⲌⲎⲐⲒⲔⲖⲘⲚⲜⲞⲠⲢⲤⲦⲨⲪⲬⲮⲰⲲⲴⲶⲸⲺⲼⲾⳀⳂⳄⳆⳈⳊⳌⳎⳐⳒⳔⳖⳘⳚⳜⳞⳠⳢⳫⳭⳲꙀꙂꙄꙆꙈꙊꙌꙎꙐꙒꙔꙖꙘꙚꙜꙞꙠꙢꙤꙦꙨꙪꙬꚀꚂꚄꚆꚈꚊꚌꚎꚐꚒꚔꚖꜢꜤꜦꜨꜪꜬꜮꜲꜴꜶꜸꜺꜼꜾꝀꝂꝄꝆꝈꝊꝌꝎꝐꝒꝔꝖꝘꝚꝜꝞꝠꝢꝤꝦꝨꝪꝬꝮꝹꝻꝽꝾꞀꞂꞄꞆꞋꞍꞐꞒꞠꞢꞤꞦꞨꞪA-ZDžLjNjDzᾈ-ᾏᾘ-ᾟᾨ-ᾯᾼῌῼʰ-ˁˆ-ˑˠ-ˤˬˮʹͺՙـۥۦߴߵߺࠚࠤࠨॱๆໆჼៗᡃᪧᱸ-ᱽᴬ-ᵪᵸᶛ-ᶿⁱⁿₐ-ₜⱼⱽⵯⸯ々〱-〵〻ゝゞー-ヾꀕꓸ-ꓽꘌꙿꜗ-ꜟꝰꞈꟸꟹꧏꩰꫝꫳꫴー゙゚ªºƻǀ-ǃʔא-תװ-ײؠ-ؿف-يٮٯٱ-ۓەۮۯۺ-ۼۿܐܒ-ܯݍ-ޥޱߊ-ߪࠀ-ࠕࡀ-ࡘࢠࢢ-ࢬऄ-हऽॐक़-ॡॲ-ॷॹ-ॿঅ-ঌএঐও-নপ-রলশ-হঽৎড়ঢ়য়-ৡৰৱਅ-ਊਏਐਓ-ਨਪ-ਰਲਲ਼ਵਸ਼ਸਹਖ਼-ੜਫ਼ੲ-ੴઅ-ઍએ-ઑઓ-નપ-રલળવ-હઽૐૠૡଅ-ଌଏଐଓ-ନପ-ରଲଳଵ-ହଽଡ଼ଢ଼ୟ-ୡୱஃஅ-ஊஎ-ஐஒ-கஙசஜஞடணதந-பம-ஹௐఅ-ఌఎ-ఐఒ-నప-ళవ-హఽౘౙౠౡಅ-ಌಎ-ಐಒ-ನಪ-ಳವ-ಹಽೞೠೡೱೲഅ-ഌഎ-ഐഒ-ഺഽൎൠൡൺ-ൿඅ-ඖක-නඳ-රලව-ෆก-ะาำเ-ๅກຂຄງຈຊຍດ-ທນ-ຟມ-ຣລວສຫອ-ະາຳຽເ-ໄໜ-ໟༀཀ-ཇཉ-ཬྈ-ྌက-ဪဿၐ-ၕၚ-ၝၡၥၦၮ-ၰၵ-ႁႎა-ჺჽ-ቈቊ-ቍቐ-ቖቘቚ-ቝበ-ኈኊ-ኍነ-ኰኲ-ኵኸ-ኾዀዂ-ዅወ-ዖዘ-ጐጒ-ጕጘ-ፚᎀ-ᎏᎠ-Ᏼᐁ-ᙬᙯ-ᙿᚁ-ᚚᚠ-ᛪᜀ-ᜌᜎ-ᜑᜠ-ᜱᝀ-ᝑᝠ-ᝬᝮ-ᝰក-ឳៜᠠ-ᡂᡄ-ᡷᢀ-ᢨᢪᢰ-ᣵᤀ-ᤜᥐ-ᥭᥰ-ᥴᦀ-ᦫᧁ-ᧇᨀ-ᨖᨠ-ᩔᬅ-ᬳᭅ-ᭋᮃ-ᮠᮮᮯᮺ-ᯥᰀ-ᰣᱍ-ᱏᱚ-ᱷᳩ-ᳬᳮ-ᳱᳵᳶℵ-ℸⴰ-ⵧⶀ-ⶖⶠ-ⶦⶨ-ⶮⶰ-ⶶⶸ-ⶾⷀ-ⷆⷈ-ⷎⷐ-ⷖⷘ-ⷞ〆〼ぁ-ゖゟァ-ヺヿㄅ-ㄭㄱ-ㆎㆠ-ㆺㇰ-ㇿ㐀-䶵一-鿌ꀀ-ꀔꀖ-ꒌꓐ-ꓷꔀ-ꘋꘐ-ꘟꘪꘫꙮꚠ-ꛥꟻ-ꠁꠃ-ꠅꠇ-ꠊꠌ-ꠢꡀ-ꡳꢂ-ꢳꣲ-ꣷꣻꤊ-ꤥꤰ-ꥆꥠ-ꥼꦄ-ꦲꨀ-ꨨꩀ-ꩂꩄ-ꩋꩠ-ꩯꩱ-ꩶꩺꪀ-ꪯꪱꪵꪶꪹ-ꪽꫀꫂꫛꫜꫠ-ꫪꫲꬁ-ꬆꬉ-ꬎꬑ-ꬖꬠ-ꬦꬨ-ꬮꯀ-ꯢ가-힣ힰ-ퟆퟋ-ퟻ豈-舘並-龎יִײַ-ﬨשׁ-זּטּ-לּמּנּסּףּפּצּ-ﮱﯓ-ﴽﵐ-ﶏﶒ-ﷇﷰ-ﷻﹰ-ﹴﹶ-ﻼヲ-ッア-ンᅠ-하-ᅦᅧ-ᅬᅭ-ᅲᅳ-ᅵ]").test(String.fromCharCode(n))},isHighSurrogate:function(n){return new RegExp("[\uD800-\uDBFF]").test(String.fromCharCode(n))},isLowSurrogate:function(n){return new RegExp("[\uDC00-\uDFFF]").test(String.fromCharCode(n))},isSurrogate:function(n){return new RegExp("[\uD800-\uDFFF]").test(String.fromCharCode(n))},isNull:function(n){return new RegExp("\x00").test(String.fromCharCode(n))},isSymbol:function(n){return n<256?[36,43,60,61,62,94,96,124,126,162,163,164,165,166,167,168,169,172,174,175,176,177,180,182,184,215,247].indexOf(n)!=-1:new RegExp("[₠-⃏⃐-⃿℀-⅏⅐-↏←-⇿∀-⋿⌀-⏿■-◿☀-⛿✀-➿⟀-⟯⟰-⟿⠀-⣿⤀-⥿⦀-⧿⨀-⫿⬀-⯿]").test(String.fromCharCode(n))},isSeparator:function(n){return n<256?n==32||n==160:new RegExp("[\u2028\u2029   ᠎ -    ]").test(String.fromCharCode(n))},isPunctuation:function(n){return n<256?[33,34,35,37,38,39,40,41,42,44,45,46,47,58,59,63,64,91,92,93,95,123,125,161,171,173,183,187,191].indexOf(n)!=-1:new RegExp("[!-#%-*,-/:;?@[-]_{}¡§«¶·»¿;·՚-՟։֊־׀׃׆׳״؉؊،؍؛؞؟٪-٭۔܀-܍߷-߹࠰-࠾࡞।॥॰૰෴๏๚๛༄-༒༔༺-༽྅࿐-࿔࿙࿚၊-၏჻፠-፨᐀᙭᙮᚛᚜᛫-᛭᜵᜶។-៖៘-៚᠀-᠊᥄᥅᨞᨟᪠-᪦᪨-᪭᭚-᭠᯼-᯿᰻-᰿᱾᱿᳀-᳇᳓‐-‧‰-⁃⁅-⁑⁓-⁞⁽⁾₍₎〈〉❨-❵⟅⟆⟦-⟯⦃-⦘⧘-⧛⧼⧽⳹-⳼⳾⳿⵰⸀-⸮⸰-⸻、-〃〈-】〔-〟〰〽゠・꓾꓿꘍-꘏꙳꙾꛲-꛷꡴-꡷꣎꣏꣸-꣺꤮꤯꥟꧁-꧍꧞꧟꩜-꩟꫞꫟꫰꫱꯫﴾﴿︐-︙︰-﹒﹔-﹡﹣﹨﹪﹫!-#%-*,-/:;?@[-]_{}⦅-・-֊־᐀᠆‐-―⸗⸚⸺⸻〜〰゠︱︲﹘﹣-([{༺༼᚛‚„⁅⁽₍〈❨❪❬❮❰❲❴⟅⟦⟨⟪⟬⟮⦃⦅⦇⦉⦋⦍⦏⦑⦓⦕⦗⧘⧚⧼⸢⸤⸦⸨〈《「『【〔〖〘〚〝﴾︗︵︷︹︻︽︿﹁﹃﹇﹙﹛﹝([{⦅「)]}༻༽᚜⁆⁾₎〉❩❫❭❯❱❳❵⟆⟧⟩⟫⟭⟯⦄⦆⦈⦊⦌⦎⦐⦒⦔⦖⦘⧙⧛⧽⸣⸥⸧⸩〉》」』】〕〗〙〛〞〟﴿︘︶︸︺︼︾﹀﹂﹄﹈﹚﹜﹞)]}⦆」«‘‛“‟‹⸂⸄⸉⸌⸜⸠»’”›⸃⸅⸊⸍⸝⸡_‿⁀⁔︳︴﹍-﹏_!-#%-'*,./:;?@\\¡§¶·¿;·՚-՟։׀׃׆׳״؉؊،؍؛؞؟٪-٭۔܀-܍߷-߹࠰-࠾࡞।॥॰૰෴๏๚๛༄-༒༔྅࿐-࿔࿙࿚၊-၏჻፠-፨᙭᙮᛫-᛭᜵᜶។-៖៘-៚᠀-᠅᠇-᠊᥄᥅᨞᨟᪠-᪦᪨-᪭᭚-᭠᯼-᯿᰻-᰿᱾᱿᳀-᳇᳓‖‗†-‧‰-‸※-‾⁁-⁃⁇-⁑⁓⁕-⁞⳹-⳼⳾⳿⵰⸀⸁⸆-⸈⸋⸎-⸖⸘⸙⸛⸞⸟⸪-⸮⸰-⸹、-〃〽・꓾꓿꘍-꘏꙳꙾꛲-꛷꡴-꡷꣎꣏꣸-꣺꤮꤯꥟꧁-꧍꧞꧟꩜-꩟꫞꫟꫰꫱꯫︐-︖︙︰﹅﹆﹉-﹌﹐-﹒﹔-﹗﹟-﹡﹨﹪﹫!-#%-'*,./:;?@\。、・]").test(String.fromCharCode(n))},isNumber:function(n){return n<256?[48,49,50,51,52,53,54,55,56,57,178,179,185,188,189,190].indexOf(n)!=-1:new RegExp("[0-9²³¹¼-¾٠-٩۰-۹߀-߉०-९০-৯৴-৹੦-੯૦-૯୦-୯୲-୷௦-௲౦-౯౸-౾೦-೯൦-൵๐-๙໐-໙༠-༳၀-၉႐-႙፩-፼ᛮ-ᛰ០-៩៰-៹᠐-᠙᥆-᥏᧐-᧚᪀-᪉᪐-᪙᭐-᭙᮰-᮹᱀-᱉᱐-᱙⁰⁴-⁹₀-₉⅐-ↂↅ-↉①-⒛⓪-⓿❶-➓⳽〇〡-〩〸-〺㆒-㆕㈠-㈩㉈-㉏㉑-㉟㊀-㊉㊱-㊿꘠-꘩ꛦ-ꛯ꠰-꠵꣐-꣙꤀-꤉꧐-꧙꩐-꩙꯰-꯹0-90-9٠-٩۰-۹߀-߉०-९০-৯੦-੯૦-૯୦-୯௦-௯౦-౯೦-೯൦-൯๐-๙໐-໙༠-༩၀-၉႐-႙០-៩᠐-᠙᥆-᥏᧐-᧙᪀-᪉᪐-᪙᭐-᭙᮰-᮹᱀-᱉᱐-᱙꘠-꘩꣐-꣙꤀-꤉꧐-꧙꩐-꩙꯰-꯹0-9ᛮ-ᛰⅠ-ↂↅ-ↈ〇〡-〩〸-〺ꛦ-ꛯ²³¹¼-¾৴-৹୲-୷௰-௲౸-౾൰-൵༪-༳፩-፼៰-៹᧚⁰⁴-⁹₀-₉⅐-⅟↉①-⒛⓪-⓿❶-➓⳽㆒-㆕㈠-㈩㉈-㉏㉑-㉟㊀-㊉㊱-㊿꠰-꠵]").test(String.fromCharCode(n))},isControl:function(n){return n<256?n>=0&&n<=31||n>=127&&n<=159:new RegExp("[\x00-\x1f€-Ÿ]").test(String.fromCharCode(n))}}});Bridge.Class.addExtend(System.Char,[System.IComparable$1(System.Char),System.IEquatable$1(System.Char)]);Bridge.define("System.FormattableString",{inherits:[System.IFormattable],statics:{invariant:function(n){return n.toString$1(System.Globalization.CultureInfo.invariantCulture)}},toString:function(){return this.toString$1(System.Globalization.CultureInfo.getCurrentCulture())},System$IFormattable$format:function(n,t){return this.toString$1(t)}});Bridge.define("System.FormattableStringImpl",{inherits:[System.FormattableString],args:null,format:null,ctor:function(n,t){t===void 0&&(t=[]);this.$initialize();System.FormattableString.ctor.call(this);this.format=n;this.args=t},getArgumentCount:function(){return this.args.length},getFormat:function(){return this.format},getArgument:function(n){return this.args[n]},getArguments:function(){return this.args},toString$1:function(n){return System.String.formatProvider.apply(System.String,[n,this.format].concat(this.args))}});Bridge.define("System.Runtime.CompilerServices.FormattableStringFactory",{statics:{create:function(n,t){return t===void 0&&(t=[]),new System.FormattableStringImpl(n,t)}}});Bridge.define("System.Exception",{ctor:function(n,t){this.$initialize();this.message=n?n:"Exception of type '"+Bridge.getTypeName(this)+"' was thrown.";this.innerException=t?t:null;this.errorStack=new Error;this.data=new(System.Collections.Generic.Dictionary$2(Object,Object))},getMessage:function(){return this.message},getInnerException:function(){return this.innerException},getStackTrace:function(){return this.errorStack.stack},getData:function(){return this.data},toString:function(){return this.getMessage()},statics:{create:function(n){return Bridge.is(n,System.Exception)?n:n instanceof TypeError?new System.NullReferenceException(n.message,new Bridge.ErrorException(n)):n instanceof RangeError?new System.ArgumentOutOfRangeException(null,n.message,new Bridge.ErrorException(n)):n instanceof Error?new Bridge.ErrorException(n):new System.Exception(n?n.toString():null)}}});Bridge.define("System.SystemException",{inherits:[System.Exception],ctor:function(n,t){this.$initialize();System.Exception.ctor.call(this,n||"System error.",t)}});Bridge.define("System.OutOfMemoryException",{inherits:[System.SystemException],ctor:function(n,t){this.$initialize();n||(n="Insufficient memory to continue the execution of the program.");System.SystemException.ctor.call(this,n,t)}});Bridge.define("System.IndexOutOfRangeException",{inherits:[System.SystemException],ctor:function(n,t){this.$initialize();n||(n="Index was outside the bounds of the array.");System.SystemException.ctor.call(this,n,t)}});Bridge.define("System.TimeoutException",{inherits:[System.SystemException],ctor:function(n,t){this.$initialize();n||(n="The operation has timed out.");System.SystemException.ctor.call(this,n,t)}});Bridge.define("System.RegexMatchTimeoutException",{inherits:[System.TimeoutException],_regexInput:"",_regexPattern:"",_matchTimeout:null,config:{init:function(){this._matchTimeout=System.TimeSpan.fromTicks(-1)}},ctor:function(){this.$initialize();System.TimeoutException.ctor.call(this)},$ctor1:function(n){this.$initialize();System.TimeoutException.ctor.call(this,n)},$ctor2:function(n,t){this.$initialize();System.TimeoutException.ctor.call(this,n,t)},$ctor3:function(n,t,i){this.$initialize();this._regexInput=n;this._regexPattern=t;this._matchTimeout=i;this.$ctor1("The RegEx engine has timed out while trying to match a pattern to an input string. This can occur for many reasons, including very large inputs or excessive backtracking caused by nested quantifiers, back-references and other factors.")},getPattern:function(){return this._regexPattern},getInput:function(){return this._regexInput},getMatchTimeout:function(){return this._matchTimeout}});Bridge.define("Bridge.ErrorException",{inherits:[System.Exception],ctor:function(n){this.$initialize();System.Exception.ctor.call(this,n.message);this.errorStack=n;this.error=n},getError:function(){return this.error}});Bridge.define("System.ArgumentException",{inherits:[System.Exception],ctor:function(n,t,i){this.$initialize();System.Exception.ctor.call(this,n||"Value does not fall within the expected range.",i);this.paramName=t?t:null},getParamName:function(){return this.paramName}});Bridge.define("System.ArgumentNullException",{inherits:[System.ArgumentException],ctor:function(n,t,i){this.$initialize();t||(t="Value cannot be null.",n&&(t+="\nParameter name: "+n));System.ArgumentException.ctor.call(this,t,n,i)}});Bridge.define("System.ArgumentOutOfRangeException",{inherits:[System.ArgumentException],ctor:function(n,t,i,r){this.$initialize();t||(t="Value is out of range.",n&&(t+="\nParameter name: "+n));System.ArgumentException.ctor.call(this,t,n,i);this.actualValue=r?r:null},getActualValue:function(){return this.actualValue}});Bridge.define("System.Globalization.CultureNotFoundException",{inherits:[System.ArgumentException],ctor:function(n,t,i,r,u){this.$initialize();i||(i="Culture is not supported.",n&&(i+="\nParameter name: "+n),t&&(i+="\n"+t+" is an invalid culture identifier."));System.ArgumentException.ctor.call(this,i,n,r);this.invalidCultureName=t?t:null;this.invalidCultureId=u?u:null},getInvalidCultureName:function(){return this.invalidCultureName},getInvalidCultureId:function(){return this.invalidCultureId}});Bridge.define("System.Collections.Generic.KeyNotFoundException",{inherits:[System.Exception],ctor:function(n,t){this.$initialize();System.Exception.ctor.call(this,n||"Key not found.",t)}});Bridge.define("System.ArithmeticException",{inherits:[System.Exception],ctor:function(n,t){this.$initialize();System.Exception.ctor.call(this,n||"Overflow or underflow in the arithmetic operation.",t)}});Bridge.define("System.DivideByZeroException",{inherits:[System.ArithmeticException],ctor:function(n,t){this.$initialize();System.ArithmeticException.ctor.call(this,n||"Division by 0.",t)}});Bridge.define("System.OverflowException",{inherits:[System.ArithmeticException],ctor:function(n,t){this.$initialize();System.ArithmeticException.ctor.call(this,n||"Arithmetic operation resulted in an overflow.",t)}});Bridge.define("System.FormatException",{inherits:[System.Exception],ctor:function(n,t){this.$initialize();System.Exception.ctor.call(this,n||"Invalid format.",t)}});Bridge.define("System.InvalidCastException",{inherits:[System.Exception],ctor:function(n,t){this.$initialize();System.Exception.ctor.call(this,n||"The cast is not valid.",t)}});Bridge.define("System.InvalidOperationException",{inherits:[System.Exception],ctor:function(n,t){this.$initialize();System.Exception.ctor.call(this,n||"Operation is not valid due to the current state of the object.",t)}});Bridge.define("System.NotImplementedException",{inherits:[System.Exception],ctor:function(n,t){this.$initialize();System.Exception.ctor.call(this,n||"The method or operation is not implemented.",t)}});Bridge.define("System.NotSupportedException",{inherits:[System.Exception],ctor:function(n,t){this.$initialize();System.Exception.ctor.call(this,n||"Specified method is not supported.",t)}});Bridge.define("System.NullReferenceException",{inherits:[System.Exception],ctor:function(n,t){this.$initialize();System.Exception.ctor.call(this,n||"Object is null.",t)}});Bridge.define("System.RankException",{inherits:[System.Exception],ctor:function(n,t){this.$initialize();System.Exception.ctor.call(this,n||"Attempted to operate on an array with the incorrect number of dimensions.",t)}});Bridge.define("Bridge.PromiseException",{inherits:[System.Exception],ctor:function(n,t,i){this.$initialize();this.arguments=System.Array.clone(n);t==null&&(t="Promise exception: [",t+=this.arguments.map(function(n){return n==null?"null":n.toString()}).join(", "),t+="]");System.Exception.ctor.call(this,t,i)},getArguments:function(){return this.arguments}});Bridge.define("System.OperationCanceledException",{inherits:[System.Exception],ctor:function(n,t,i){this.$initialize();System.Exception.ctor.call(this,n||"Operation was canceled.",i);this.cancellationToken=t||System.Threading.CancellationToken.none}});Bridge.define("System.Threading.Tasks.TaskCanceledException",{inherits:[System.OperationCanceledException],ctor:function(n,t,i){this.$initialize();System.OperationCanceledException.ctor.call(this,n||"A task was canceled.",null,i);this.task=t||null}});Bridge.define("System.AggregateException",{inherits:[System.Exception],ctor:function(n,t){this.$initialize();this.innerExceptions=new(System.Collections.ObjectModel.ReadOnlyCollection$1(System.Exception))(Bridge.hasValue(t)?Bridge.toArray(t):[]);System.Exception.ctor.call(this,n||"One or more errors occurred.",this.innerExceptions.items.length?this.innerExceptions.items[0]:null)},handle:function(n){var r,i,t;if(!Bridge.hasValue(n))throw new System.ArgumentNullException("predicate");for(r=this.innerExceptions.getCount(),i=[],t=0;t<r;t++)n(this.innerExceptions.get(t))||i.push(this.innerExceptions.get(t));if(i.length>0)throw new System.AggregateException(this.getMessage(),i);},flatten:function(){var e=new(System.Collections.Generic.List$1(System.Exception)),n=new(System.Collections.Generic.List$1(System.AggregateException)),r,u,t,i,f;for(n.add(this),r=0;n.getCount()>r;)for(u=n.getItem(r++).innerExceptions,t=0;t<u.getCount();t++)(i=u.get(t),Bridge.hasValue(i))&&(f=Bridge.as(i,System.AggregateException),Bridge.hasValue(f)?n.add(f):e.add(i));return new System.AggregateException(this.getMessage(),e)}});Bridge.define("System.Reflection.AmbiguousMatchException",{inherits:[System.Exception],ctor:function(n,t){this.$initialize();System.Exception.ctor.call(this,n||"Ambiguous match.",t)}});Bridge.define("System.Globalization.DateTimeFormatInfo",{inherits:[System.IFormatProvider,System.ICloneable],config:{alias:{getFormat:"System$IFormatProvider$getFormat"}},statics:{$allStandardFormats:{d:"shortDatePattern",D:"longDatePattern",f:"longDatePattern shortTimePattern",F:"longDatePattern longTimePattern",g:"shortDatePattern shortTimePattern",G:"shortDatePattern longTimePattern",m:"monthDayPattern",M:"monthDayPattern",o:"roundtripFormat",O:"roundtripFormat",r:"rfc1123",R:"rfc1123",s:"sortableDateTimePattern",S:"sortableDateTimePattern1",t:"shortTimePattern",T:"longTimePattern",u:"universalSortableDateTimePattern",U:"longDatePattern longTimePattern",y:"yearMonthPattern",Y:"yearMonthPattern"},ctor:function(){this.invariantInfo=Bridge.merge(new System.Globalization.DateTimeFormatInfo,{abbreviatedDayNames:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],abbreviatedMonthGenitiveNames:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec",""],abbreviatedMonthNames:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec",""],amDesignator:"AM",dateSeparator:"/",dayNames:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],firstDayOfWeek:0,fullDateTimePattern:"dddd, dd MMMM yyyy HH:mm:ss",longDatePattern:"dddd, dd MMMM yyyy",longTimePattern:"HH:mm:ss",monthDayPattern:"MMMM dd",monthGenitiveNames:["January","February","March","April","May","June","July","August","September","October","November","December",""],monthNames:["January","February","March","April","May","June","July","August","September","October","November","December",""],pmDesignator:"PM",rfc1123:"ddd, dd MMM yyyy HH':'mm':'ss 'GMT'",shortDatePattern:"MM/dd/yyyy",shortestDayNames:["Su","Mo","Tu","We","Th","Fr","Sa"],shortTimePattern:"HH:mm",sortableDateTimePattern:"yyyy'-'MM'-'dd'T'HH':'mm':'ss",sortableDateTimePattern1:"yyyy'-'MM'-'dd",timeSeparator:":",universalSortableDateTimePattern:"yyyy'-'MM'-'dd HH':'mm':'ss'Z'",yearMonthPattern:"yyyy MMMM",roundtripFormat:"yyyy'-'MM'-'dd'T'HH':'mm':'ss.uzzz"})}},getFormat:function(n){switch(n){case System.Globalization.DateTimeFormatInfo:return this;default:return null}},getAbbreviatedDayName:function(n){if(n<0||n>6)throw new System.ArgumentOutOfRangeException("dayofweek");return this.abbreviatedDayNames[n]},getAbbreviatedMonthName:function(n){if(n<1||n>13)throw new System.ArgumentOutOfRangeException("month");return this.abbreviatedMonthNames[n-1]},getAllDateTimePatterns:function(n,t){var i=System.Globalization.DateTimeFormatInfo.$allStandardFormats,r,e,f,u,o=[];if(n){if(!i[n]){if(t)return null;throw new System.ArgumentException(null,"format");}r={};r[n]=i[n]}else r=i;for(i in r){for(e=r[i].split(" "),f="",u=0;u<e.length;u++)f=(u===0?"":f+" ")+this[e[u]];o.push(f)}return o},getDayName:function(n){if(n<0||n>6)throw new System.ArgumentOutOfRangeException("dayofweek");return this.dayNames[n]},getMonthName:function(n){if(n<1||n>13)throw new System.ArgumentOutOfRangeException("month");return this.monthNames[n-1]},getShortestDayName:function(n){if(n<0||n>6)throw new System.ArgumentOutOfRangeException("dayOfWeek");return this.shortestDayNames[n]},clone:function(){return Bridge.copy(new System.Globalization.DateTimeFormatInfo,this,["abbreviatedDayNames","abbreviatedMonthGenitiveNames","abbreviatedMonthNames","amDesignator","dateSeparator","dayNames","firstDayOfWeek","fullDateTimePattern","longDatePattern","longTimePattern","monthDayPattern","monthGenitiveNames","monthNames","pmDesignator","rfc1123","shortDatePattern","shortestDayNames","shortTimePattern","sortableDateTimePattern","timeSeparator","universalSortableDateTimePattern","yearMonthPattern","roundtripFormat"])}});Bridge.define("System.Globalization.NumberFormatInfo",{inherits:[System.IFormatProvider,System.ICloneable],config:{alias:{getFormat:"System$IFormatProvider$getFormat"}},statics:{ctor:function(){this.numberNegativePatterns=["(n)","-n","- n","n-","n -"];this.currencyNegativePatterns=["($n)","-$n","$-n","$n-","(n$)","-n$","n-$","n$-","-n $","-$ n","n $-","$ n-","$ -n","n- $","($ n)","(n $)"];this.currencyPositivePatterns=["$n","n$","$ n","n $"];this.percentNegativePatterns=["-n %","-n%","-%n","%-n","%n-","n-%","n%-","-% n","n %-","% n-","% -n","n- %"];this.percentPositivePatterns=["n %","n%","%n","% n"];this.invariantInfo=Bridge.merge(new System.Globalization.NumberFormatInfo,{nanSymbol:"NaN",negativeSign:"-",positiveSign:"+",negativeInfinitySymbol:"-Infinity",positiveInfinitySymbol:"Infinity",percentSymbol:"%",percentGroupSizes:[3],percentDecimalDigits:2,percentDecimalSeparator:".",percentGroupSeparator:",",percentPositivePattern:0,percentNegativePattern:0,currencySymbol:"¤",currencyGroupSizes:[3],currencyDecimalDigits:2,currencyDecimalSeparator:".",currencyGroupSeparator:",",currencyNegativePattern:0,currencyPositivePattern:0,numberGroupSizes:[3],numberDecimalDigits:2,numberDecimalSeparator:".",numberGroupSeparator:",",numberNegativePattern:1})}},getFormat:function(n){switch(n){case System.Globalization.NumberFormatInfo:return this;default:return null}},clone:function(){return Bridge.copy(new System.Globalization.NumberFormatInfo,this,["nanSymbol","negativeSign","positiveSign","negativeInfinitySymbol","positiveInfinitySymbol","percentSymbol","percentGroupSizes","percentDecimalDigits","percentDecimalSeparator","percentGroupSeparator","percentPositivePattern","percentNegativePattern","currencySymbol","currencyGroupSizes","currencyDecimalDigits","currencyDecimalSeparator","currencyGroupSeparator","currencyNegativePattern","currencyPositivePattern","numberGroupSizes","numberDecimalDigits","numberDecimalSeparator","numberGroupSeparator","numberNegativePattern"])}});Bridge.define("System.Globalization.CultureInfo",{inherits:[System.IFormatProvider,System.ICloneable],config:{alias:{getFormat:"System$IFormatProvider$getFormat"}},$entryPoint:!0,statics:{ctor:function(){this.cultures=this.cultures||{};this.invariantCulture=Bridge.merge(new System.Globalization.CultureInfo("iv",!0),{englishName:"Invariant Language (Invariant Country)",nativeName:"Invariant Language (Invariant Country)",numberFormat:System.Globalization.NumberFormatInfo.invariantInfo,dateTimeFormat:System.Globalization.DateTimeFormatInfo.invariantInfo});this.setCurrentCulture(System.Globalization.CultureInfo.invariantCulture)},getCurrentCulture:function(){return this.currentCulture},setCurrentCulture:function(n){this.currentCulture=n;System.Globalization.DateTimeFormatInfo.currentInfo=n.dateTimeFormat;System.Globalization.NumberFormatInfo.currentInfo=n.numberFormat},getCultureInfo:function(n){if(!n)throw new System.ArgumentNullException("name");return this.cultures[n]},getCultures:function(){for(var t=Bridge.getPropertyNames(this.cultures),i=[],n=0;n<t.length;n++)i.push(this.cultures[t[n]]);return i}},ctor:function(n,t){if(this.$initialize(),this.name=n,System.Globalization.CultureInfo.cultures||(System.Globalization.CultureInfo.cultures={}),System.Globalization.CultureInfo.cultures[n])Bridge.copy(this,System.Globalization.CultureInfo.cultures[n],["englishName","nativeName","numberFormat","dateTimeFormat"]);else{if(!t)throw new System.Globalization.CultureNotFoundException("name",n);System.Globalization.CultureInfo.cultures[n]=this}},getFormat:function(n){switch(n){case System.Globalization.NumberFormatInfo:return this.numberFormat;case System.Globalization.DateTimeFormatInfo:return this.dateTimeFormat;default:return null}},clone:function(){return new System.Globalization.CultureInfo(this.name)}});Bridge.Math={divRem:function(n,t,i){var r=n%t;return i.v=r,(n-r)/t},round:function(n,t,i){var u=Math.pow(10,t||0),r,f;return(n*=u,r=n>0|-(n<0),n%1==.5*r)?(f=Math.floor(n),(f+(i===4?r>0:f%2*r))/u):Math.round(n)/u},log10:Math.log10||function(n){return Math.log(n)/Math.LN10},logWithBase:function(n,t){return isNaN(n)?n:isNaN(t)?t:t===1?NaN:n!==1&&(t===0||t===Number.POSITIVE_INFINITY)?NaN:Bridge.Math.log10(n)/Bridge.Math.log10(t)},log:function(n){return n===0?Number.NEGATIVE_INFINITY:n<0||isNaN(n)?NaN:n===Number.POSITIVE_INFINITY?Number.POSITIVE_INFINITY:n===Number.NEGATIVE_INFINITY?NaN:Math.log(n)},sinh:Math.sinh||function(n){return(Math.exp(n)-Math.exp(-n))/2},cosh:Math.cosh||function(n){return(Math.exp(n)+Math.exp(-n))/2},tanh:Math.tanh||function(n){if(n===Infinity)return 1;if(n===-Infinity)return-1;var t=Math.exp(2*n);return(t-1)/(t+1)}};yt={trueString:"True",falseString:"False",is:function(n,t){return t===System.IComparable||t===System.IEquatable$1(Boolean)||t===System.IComparable$1(Boolean)?!0:!1},$is:function(n){return typeof n=="boolean"},getDefaultValue:function(){return!1},toString:function(n){return n?System.Boolean.trueString:System.Boolean.falseString},parse:function(n){if(!Bridge.hasValue(n))throw new System.ArgumentNullException("value");var t={v:!1};if(!System.Boolean.tryParse(n,t))throw new System.FormatException("Bad format for Boolean value");return t.v},tryParse:function(n,t){if(t.v=!1,!Bridge.hasValue(n))return!1;if(System.String.equals(System.Boolean.trueString,n,5))return t.v=!0,!0;if(System.String.equals(System.Boolean.falseString,n,5))return t.v=!1,!0;for(var i=0,r=n.length-1;i<n.length;){if(!System.Char.isWhiteSpace(n[i])&&!System.Char.isNull(n.charCodeAt(i)))break;i++}while(r>=i){if(!System.Char.isWhiteSpace(n[r])&&!System.Char.isNull(n.charCodeAt(r)))break;r--}return(n=n.substr(i,r-i+1),System.String.equals(System.Boolean.trueString,n,5))?(t.v=!0,!0):System.String.equals(System.Boolean.falseString,n,5)?(t.v=!1,!0):!1}};System.Boolean=yt,function(){var n=function(n,t,i,r){var u=Bridge.define(n,{inherits:[System.IComparable,System.IFormattable],statics:{$number:!0,min:t,max:i,precision:r,$is:function(n){return typeof n=="number"&&Math.floor(n,0)===n&&n>=t&&n<=i},getDefaultValue:function(){return 0},parse:function(n,r){return Bridge.Int.parseInt(n,t,i,r)},tryParse:function(n,r,u){return Bridge.Int.tryParseInt(n,r,t,i,u)},format:function(n,t,i){return Bridge.Int.format(n,t,i,u)}}});u.$kind="";Bridge.Class.addExtend(u,[System.IComparable$1(u),System.IEquatable$1(u)])};n("System.Byte",0,255,3);n("System.SByte",-128,127,3);n("System.Int16",-32768,32767,5);n("System.UInt16",0,65535,5);n("System.Int32",-2147483648,2147483647,10);n("System.UInt32",0,4294967295,10)}();Bridge.define("Bridge.Int",{inherits:[System.IComparable,System.IFormattable],statics:{$number:!0,$is:function(n){return typeof n=="number"&&isFinite(n)&&Math.floor(n,0)===n},getDefaultValue:function(){return 0},format:function(n,t,i,r){var e=(i||System.Globalization.CultureInfo.getCurrentCulture()).getFormat(System.Globalization.NumberFormatInfo),nt=e.numberDecimalSeparator,rt=e.numberGroupSeparator,f=n instanceof System.Decimal,o=n instanceof System.Int64||n instanceof System.UInt64,tt=f||o?n.isZero()?!1:n.isNegative():n<0,l,u,v,b,g,c,k,d,a;if(!o&&(f?!n.isFinite():!isFinite(n)))return Number.NEGATIVE_INFINITY===n||f&&tt?e.negativeInfinitySymbol:isNaN(n)?e.nanSymbol:e.positiveInfinitySymbol;if(t||(t="G"),l=t.match(/^([a-zA-Z])(\d*)$/),l){b=l[1].toUpperCase();u=parseInt(l[2],10);u=u>15?15:u;switch(b){case"D":return this.defaultFormat(n,isNaN(u)?1:u,0,0,e,!0);case"F":case"N":return isNaN(u)&&(u=e.numberDecimalDigits),this.defaultFormat(n,1,u,u,e,b==="F");case"G":case"E":for(var h=0,s=f||o?o&&n.eq(System.Int64.MinValue)?System.Int64(n.value.toUnsigned()):n.abs():Math.abs(n),y=l[1],it=3,p,w;f||o?s.gte(10):s>=10;)f||o?s=s.div(10):s/=10,h++;while(f||o?s.ne(0)&&s.lt(1):s!==0&&s<1)f||o?s=s.mul(10):s*=10,h--;if(b==="G"){if(g=isNaN(u),g&&(u=f?29:o?n instanceof System.Int64?19:20:r&&r.precision?r.precision:15),h>-5&&h<u||f&&g)return p=0,w=u-(h>0?h+1:1),this.defaultFormat(n,1,p,w,e,!0);y=y==="G"?"E":"e";it=2;p=0;w=(u||15)-1}else p=w=isNaN(u)?6:u;return h>=0?y+=e.positiveSign:(y+=e.negativeSign,h=-h),tt&&(f||o?s=s.mul(-1):s*=-1),this.defaultFormat(s,1,p,w,e)+y+this.defaultFormat(h,it,0,0,e,!0);case"P":return isNaN(u)&&(u=e.percentDecimalDigits),this.defaultFormat(n*100,1,u,u,e,!1,"percent");case"X":for(c=f?n.round().value.toHex().substr(2):o?n.toString(16):Math.round(n).toString(16),l[1]==="X"&&(c=c.toUpperCase()),u-=c.length;u-->0;)c="0"+c;return c;case"C":return isNaN(u)&&(u=e.currencyDecimalDigits),this.defaultFormat(n,1,u,u,e,!1,"currency");case"R":return k=f||o?n.toString():""+n,nt!=="."&&(k=k.replace(".",nt)),k.replace("e","E")}}if(t.indexOf(",.")!==-1||System.String.endsWith(t,",")){for(d=0,a=t.indexOf(",."),a===-1&&(a=t.length-1);a>-1&&t.charAt(a)===",";)d++,a--;f||o?n=n.div(Math.pow(1e3,d)):n/=Math.pow(1e3,d)}return t.indexOf("%")!==-1&&(f||o?n=n.mul(100):n*=100),t.indexOf("‰")!==-1&&(f||o?n=n.mul(1e3):n*=1e3),v=t.split(";"),(f||o?n.lt(0):n<0)&&v.length>1?(f||o?n=n.mul(-1):n*=-1,t=v[1]):t=v[(f||o?n.ne(0):!n)&&v.length>2?2:0],this.customFormat(n,t,e,!t.match(/^[^\.]*[0#],[0#]/))},defaultFormat:function(n,t,i,r,u,f,e){e=e||"number";var h=(u||System.Globalization.CultureInfo.getCurrentCulture()).getFormat(System.Globalization.NumberFormatInfo),o,p,w,ut,v,y,b=h[e+"GroupSizes"],s,k,d,l,a,g,nt,c="",tt=n instanceof System.Decimal,it=n instanceof System.Int64||n instanceof System.UInt64,ft=tt||it?n.isZero()?!1:n.isNegative():n<0,rt=!1;if(ut=Math.pow(10,r),o=tt?n.abs().toDecimalPlaces(r).toFixed():it?n.eq(System.Int64.MinValue)?n.value.toUnsigned().toString():n.abs().toString():""+ +Math.abs(n).toFixed(r),rt=o.split("").every(function(n){return n==="0"||n==="."}),p=o.indexOf("."),p>0&&(s=h[e+"DecimalSeparator"]+o.substr(p+1),o=o.substr(0,p)),o.length<t&&(o=Array(t-o.length+1).join("0")+o),s?(s.length-1<i&&(s+=Array(i-s.length+2).join("0")),r===0?s=null:s.length-1>r&&(s=s.substr(0,r+1))):i>0&&(s=h[e+"DecimalSeparator"]+Array(i+1).join("0")),v=0,y=b[v],o.length<y)c=o,s&&(c+=s);else{for(k=o.length,d=!1,nt=f?"":h[e+"GroupSeparator"];!d;){if(a=y,l=k-a,l<0&&(y+=l,a+=l,l=0,d=!0),!a)break;g=o.substr(l,a);c=c.length?g+nt+c:g;k-=a;v<b.length-1&&(v++,y=b[v])}s&&(c+=s)}return ft&&!rt?(w=System.Globalization.NumberFormatInfo[e+"NegativePatterns"][h[e+"NegativePattern"]],w.replace("-",h.negativeSign).replace("%",h.percentSymbol).replace("$",h.currencySymbol).replace("n",c)):System.Globalization.NumberFormatInfo[e+"PositivePatterns"]?(w=System.Globalization.NumberFormatInfo[e+"PositivePatterns"][h[e+"PositivePattern"]],w.replace("%",h.percentSymbol).replace("$",h.currencySymbol).replace("n",c)):c},customFormat:function(n,t,i,r){var p=0,s=-1,h=-1,w=0,b=-1,a=0,nt=1,u,f,o,v,c,k,tt=!1,it=!1,y,l,e="",d=!1,rt=!1,g=!1,ut=n instanceof System.Decimal,ft=n instanceof System.Int64||n instanceof System.UInt64,et=ut||ft?n.isZero()?!1:n.isNegative():n<0;for(y="number",t.indexOf("%")!==-1?y="percent":t.indexOf("$")!==-1&&(y="currency"),f=0;f<t.length;f++)if(u=t.charAt(f),u==="'"||u==='"'){if(f=t.indexOf(u,f+1),f<0)break}else u==="\\"?f++:((u==="0"||u==="#")&&(w+=a,u==="0"&&(a?b=w:s<0&&(s=p)),p+=!a),a=a||u===".");for(s=s<0?1:p-s,et&&(tt=!0),c=Math.pow(10,w),n=ut?System.Decimal.round(n.abs().mul(c),4).div(c).toString():ft?(n.eq(System.Int64.MinValue)?System.Int64(n.value.toUnsigned()):n.abs()).mul(c).div(c).toString():""+Math.round(Math.abs(n)*c)/c,it=n.split("").every(function(n){return n==="0"||n==="."}),k=n.indexOf("."),h=k<0?n.length:k,f=h-p,l={groupIndex:Math.max(h,s),sep:r?"":i[y+"GroupSeparator"]},h===1&&n.charAt(0)==="0"&&(d=!0),o=0;o<t.length;o++)if(u=t.charAt(o),u==="'"||u==='"'){if(v=t.indexOf(u,o+1),e+=t.substring(o+1,v<0?t.length:v),v<0)break;o=v}else u==="\\"?(e+=t.charAt(o+1),o++):u==="#"||u==="0"?(g=!0,!rt&&d&&u==="#"?f++:(l.buffer=e,f<h?(f>=0?(nt&&this.addGroup(n.substr(0,f),l),this.addGroup(n.charAt(f),l)):f>=h-s&&this.addGroup("0",l),nt=0):(b-->0||f<n.length)&&this.addGroup(f>=n.length?"0":n.charAt(f),l),e=l.buffer,f++)):u==="."?(g||d||(e+=n.substr(0,h),g=!0),(n.length>++f||b>0)&&(rt=!0,e+=i[y+"DecimalSeparator"])):u!==","&&(e+=u);return tt&&!it&&(e="-"+e),e},addGroup:function(n,t){for(var i=t.buffer,f=t.sep,r=t.groupIndex,u=0,e=n.length;u<e;u++)i+=n.charAt(u),f&&r>1&&r--%3==1&&(i+=f);t.buffer=i;t.groupIndex=r},parseFloat:function(n,t){var i={};return Bridge.Int.tryParseFloat(n,t,i,!1),i.v},tryParseFloat:function(n,t,i,r){var l,a,u,v;if(i.v=0,r==null&&(r=!0),n==null){if(r)return!1;throw new System.ArgumentNullException("s");}n=n.trim();var f=(t||System.Globalization.CultureInfo.getCurrentCulture()).getFormat(System.Globalization.NumberFormatInfo),h=f.numberDecimalSeparator,e=f.numberGroupSeparator,o="Input string was not in a correct format.",s=n.indexOf(h),c=e?n.indexOf(e):-1;if(s>-1&&(s<c||c>-1&&s<n.indexOf(e,s)||n.indexOf(h,s+1)>-1)){if(r)return!1;throw new System.FormatException(o);}if(h!=="."&&e!=="."&&n.indexOf(".")>-1){if(r)return!1;throw new System.FormatException(o);}if(c>-1){for(l="",u=0;u<n.length;u++)n[u]!==e&&(l+=n[u]);n=l}if(n===f.negativeInfinitySymbol)return i.v=Number.NEGATIVE_INFINITY,!0;if(n===f.positiveInfinitySymbol)return i.v=Number.POSITIVE_INFINITY,!0;if(n===f.nanSymbol)return i.v=Number.NaN,!0;for(a=0,u=0;u<n.length;u++)if(System.Char.isLetter(n[u].charCodeAt(0)))if(n[u].toLowerCase()==="e"){if(a++,a>1){if(r)return!1;throw new System.FormatException(o);}}else{if(r)return!1;throw new System.FormatException(o);}if(v=parseFloat(n.replace(h,".")),isNaN(v)){if(r)return!1;throw new System.FormatException(o);}return i.v=v,!0},parseInt:function(n,t,i,r){if(r=r||10,n==null)throw new System.ArgumentNullException("str");if(r<=10&&!/^[+-]?[0-9]+$/.test(n)||r==16&&!/^[+-]?[0-9A-F]+$/gi.test(n))throw new System.FormatException("Input string was not in a correct format.");var u=parseInt(n,r);if(isNaN(u))throw new System.FormatException("Input string was not in a correct format.");if(u<t||u>i)throw new System.OverflowException;return u},tryParseInt:function(n,t,i,r,u){return(t.v=0,u=u||10,u<=10&&!/^[+-]?[0-9]+$/.test(n)||u==16&&!/^[+-]?[0-9A-F]+$/gi.test(n))?!1:(t.v=parseInt(n,u),t.v<i||t.v>r)?!1:!0},isInfinite:function(n){return n===Number.POSITIVE_INFINITY||n===Number.NEGATIVE_INFINITY},trunc:function(n){return Bridge.isNumber(n)?n>0?Math.floor(n):Math.ceil(n):Bridge.Int.isInfinite(n)?n:null},div:function(n,t){if(!Bridge.isNumber(n)||!Bridge.isNumber(t))return null;if(t===0)throw new System.DivideByZeroException;return this.trunc(n/t)},mod:function(n,t){if(!Bridge.isNumber(n)||!Bridge.isNumber(t))return null;if(t===0)throw new System.DivideByZeroException;return n%t},check:function(n,t){if(System.Int64.is64Bit(n))return System.Int64.check(n,t);if(n instanceof System.Decimal)return System.Decimal.toInt(n,t);if(Bridge.isNumber(n)&&!t.$is(n))throw new System.OverflowException;return Bridge.Int.isInfinite(n)?t===System.Int64||t===System.UInt64?t.MinValue:t.min:n},sxb:function(n){return Bridge.isNumber(n)?n|(n&128?4294967040:0):Bridge.Int.isInfinite(n)?System.SByte.min:null},sxs:function(n){return Bridge.isNumber(n)?n|(n&32768?4294901760:0):Bridge.Int.isInfinite(n)?System.Int16.min:null},clip8:function(n){return Bridge.isNumber(n)?Bridge.Int.sxb(n&255):Bridge.Int.isInfinite(n)?System.SByte.min:null},clipu8:function(n){return Bridge.isNumber(n)?n&255:Bridge.Int.isInfinite(n)?System.Byte.min:null},clip16:function(n){return Bridge.isNumber(n)?Bridge.Int.sxs(n&65535):Bridge.Int.isInfinite(n)?System.Int16.min:null},clipu16:function(n){return Bridge.isNumber(n)?n&65535:Bridge.Int.isInfinite(n)?System.UInt16.min:null},clip32:function(n){return Bridge.isNumber(n)?n|0:Bridge.Int.isInfinite(n)?System.Int32.min:null},clipu32:function(n){return Bridge.isNumber(n)?n>>>0:Bridge.Int.isInfinite(n)?System.UInt32.min:null},clip64:function(n){return Bridge.isNumber(n)?System.Int64(Bridge.Int.trunc(n)):Bridge.Int.isInfinite(n)?System.Int64.MinValue:null},clipu64:function(n){return Bridge.isNumber(n)?System.UInt64(Bridge.Int.trunc(n)):Bridge.Int.isInfinite(n)?System.UInt64.MinValue:null},sign:function(n){return Bridge.isNumber(n)?n===0?0:n<0?-1:1:null}}});Bridge.Int.$kind="";Bridge.Class.addExtend(Bridge.Int,[System.IComparable$1(Bridge.Int),System.IEquatable$1(Bridge.Int)]);Bridge.define("System.Double",{inherits:[System.IComparable,System.IFormattable],statics:{min:-Number.MAX_VALUE,max:Number.MAX_VALUE,precision:15,$number:!0,$is:function(n){return typeof n=="number"},getDefaultValue:function(){return 0},parse:function(n,t){return Bridge.Int.parseFloat(n,t)},tryParse:function(n,t,i){return Bridge.Int.tryParseFloat(n,t,i)},format:function(n,t,i){return Bridge.Int.format(n,t,i,System.Double)}}});System.Double.$kind="";Bridge.Class.addExtend(System.Double,[System.IComparable$1(System.Double),System.IEquatable$1(System.Double)]);Bridge.define("System.Single",{inherits:[System.IComparable,System.IFormattable],statics:{min:-34028234663852886e22,max:34028234663852886e22,precision:7,$number:!0,$is:System.Double.$is,getDefaultValue:System.Double.getDefaultValue,parse:System.Double.parse,tryParse:System.Double.tryParse,format:function(n,t,i){return Bridge.Int.format(n,t,i,System.Single)}}});System.Single.$kind="";Bridge.Class.addExtend(System.Single,[System.IComparable$1(System.Single),System.IEquatable$1(System.Single)]),function(n){function i(n,t,i){this.low=n|0;this.high=t|0;this.unsigned=!!i}function u(n){return!0===(n&&n.__isLong__)}function h(n,i){var r,u;if(i){if(n>>>=0,(u=0<=n&&256>n)&&(r=p[n]))return r;r=t(n,0>(n|0)?-1:0,!0);u&&(p[n]=r)}else{if(n|=0,(u=-128<=n&&128>n)&&(r=y[n]))return r;r=t(n,0>n?-1:0,!1);u&&(y[n]=r)}return r}function f(n,i){if(isNaN(n)||!isFinite(n))return i?s:e;if(i){if(0>n)return s;if(n>=d)return k}else{if(n<=-g)return r;if(n+1>=g)return b}return 0>n?f(-n,i).neg():t(n%4294967296|0,n/4294967296|0,i)}function t(n,t,r){return new i(n,t,r)}function v(n,t,i){var s,r,u,o,h;if(0===n.length)throw Error("empty string");if("NaN"===n||"Infinity"===n||"+Infinity"===n||"-Infinity"===n)return e;if("number"==typeof t?(i=t,t=!1):t=!!t,i=i||10,2>i||36<i)throw RangeError("radix");if(0<(s=n.indexOf("-")))throw Error("interior hyphen");if(0===s)return v(n.substring(1),t,i).neg();for(s=f(l(i,8)),r=e,u=0;u<n.length;u+=8)o=Math.min(8,n.length-u),h=parseInt(n.substring(u,u+o),i),8>o?(o=f(l(i,o)),r=r.mul(o).add(f(h))):(r=r.mul(s),r=r.add(f(h)));return r.unsigned=t,r}function o(n){return n instanceof i?n:"number"==typeof n?f(n):"string"==typeof n?v(n):t(n.low,n.high,n.unsigned)}var y,p,l,s,c,w,a,b,k,r;n.Bridge.$Long=i;i.__isLong__;Object.defineProperty(i.prototype,"__isLong__",{value:!0,enumerable:!1,configurable:!1});i.isLong=u;y={};p={};i.fromInt=h;i.fromNumber=f;i.fromBits=t;l=Math.pow;i.fromString=v;i.fromValue=o;var d=4294967296*4294967296,g=d/2,nt=h(16777216),e=h(0);i.ZERO=e;s=h(0,!0);i.UZERO=s;c=h(1);i.ONE=c;w=h(1,!0);i.UONE=w;a=h(-1);i.NEG_ONE=a;b=t(-1,2147483647,!1);i.MAX_VALUE=b;k=t(-1,-1,!0);i.MAX_UNSIGNED_VALUE=k;r=t(0,-2147483648,!1);i.MIN_VALUE=r;n=i.prototype;n.toInt=function(){return this.unsigned?this.low>>>0:this.low};n.toNumber=function(){return this.unsigned?4294967296*(this.high>>>0)+(this.low>>>0):4294967296*this.high+(this.low>>>0)};n.toString=function(n){if(n=n||10,2>n||36<n)throw RangeError("radix");if(this.isZero())return"0";if(this.isNegative()){if(this.eq(r)){var t=f(n),u=this.div(t),t=u.mul(t).sub(this);return u.toString(n)+t.toInt().toString(n)}return("undefined"==typeof n||10===n?"-":"")+this.neg().toString(n)}for(var u=f(l(n,6),this.unsigned),t=this,e="";;){var o=t.div(u),i=(t.sub(o.mul(u)).toInt()>>>0).toString(n),t=o;if(t.isZero())return i+e;for(;6>i.length;)i="0"+i;e=""+i+e}};n.getHighBits=function(){return this.high};n.getHighBitsUnsigned=function(){return this.high>>>0};n.getLowBits=function(){return this.low};n.getLowBitsUnsigned=function(){return this.low>>>0};n.getNumBitsAbs=function(){if(this.isNegative())return this.eq(r)?64:this.neg().getNumBitsAbs();for(var t=0!=this.high?this.high:this.low,n=31;0<n&&0==(t&1<<n);n--);return 0!=this.high?n+33:n+1};n.isZero=function(){return 0===this.high&&0===this.low};n.isNegative=function(){return!this.unsigned&&0>this.high};n.isPositive=function(){return this.unsigned||0<=this.high};n.isOdd=function(){return 1==(this.low&1)};n.isEven=function(){return 0==(this.low&1)};n.equals=function(n){return u(n)||(n=o(n)),this.unsigned!==n.unsigned&&1==this.high>>>31&&1==n.high>>>31?!1:this.high===n.high&&this.low===n.low};n.eq=n.equals;n.notEquals=function(n){return!this.eq(n)};n.neq=n.notEquals;n.lessThan=function(n){return 0>this.comp(n)};n.lt=n.lessThan;n.lessThanOrEqual=function(n){return 0>=this.comp(n)};n.lte=n.lessThanOrEqual;n.greaterThan=function(n){return 0<this.comp(n)};n.gt=n.greaterThan;n.greaterThanOrEqual=function(n){return 0<=this.comp(n)};n.gte=n.greaterThanOrEqual;n.compare=function(n){if(u(n)||(n=o(n)),this.eq(n))return 0;var t=this.isNegative(),i=n.isNegative();return t&&!i?-1:!t&&i?1:this.unsigned?n.high>>>0>this.high>>>0||n.high===this.high&&n.low>>>0>this.low>>>0?-1:1:this.sub(n).isNegative()?-1:1};n.comp=n.compare;n.negate=function(){return!this.unsigned&&this.eq(r)?r:this.not().add(c)};n.neg=n.negate;n.add=function(n){u(n)||(n=o(n));var e=this.high>>>16,i=this.high&65535,r=this.low>>>16,s=n.high>>>16,h=n.high&65535,c=n.low>>>16,f;return f=0+((this.low&65535)+(n.low&65535)),n=0+(f>>>16),n+=r+c,r=0+(n>>>16),r+=i+h,i=0+(r>>>16),i=i+(e+s)&65535,t((n&65535)<<16|f&65535,i<<16|r&65535,this.unsigned)};n.subtract=function(n){return u(n)||(n=o(n)),this.add(n.neg())};n.sub=n.subtract;n.multiply=function(n){var h,i,s,v;if(this.isZero()||(u(n)||(n=o(n)),n.isZero()))return e;if(this.eq(r))return n.isOdd()?r:e;if(n.eq(r))return this.isOdd()?r:e;if(this.isNegative())return n.isNegative()?this.neg().mul(n.neg()):this.neg().mul(n).neg();if(n.isNegative())return this.mul(n.neg()).neg();if(this.lt(nt)&&n.lt(nt))return f(this.toNumber()*n.toNumber(),this.unsigned);var w=this.high>>>16,y=this.high&65535,l=this.low>>>16,c=this.low&65535,b=n.high>>>16,p=n.high&65535,a=n.low>>>16;return n=n.low&65535,v=0+c*n,s=0+(v>>>16),s+=l*n,i=0+(s>>>16),s=(s&65535)+c*a,i+=s>>>16,s&=65535,i+=y*n,h=0+(i>>>16),i=(i&65535)+l*a,h+=i>>>16,i&=65535,i+=c*p,h+=i>>>16,i&=65535,h=h+(w*n+y*a+l*p+c*b)&65535,t(s<<16|v&65535,h<<16|i,this.unsigned)};n.mul=n.multiply;n.divide=function(n){var t,i,v;if(u(n)||(n=o(n)),n.isZero())throw Error("division by zero");if(this.isZero())return this.unsigned?s:e;if(this.unsigned)n.unsigned||(n=n.toUnsigned());else{if(this.eq(r))return n.eq(c)||n.eq(a)?r:n.eq(r)?c:(t=this.shr(1).div(n).shl(1),t.eq(e))?n.isNegative()?c:a:(i=this.sub(n.mul(t)),t.add(i.div(n)));if(n.eq(r))return this.unsigned?s:e;if(this.isNegative())return n.isNegative()?this.neg().div(n.neg()):this.neg().div(n).neg();if(n.isNegative())return this.div(n.neg()).neg()}if(this.unsigned){if(n.gt(this))return s;if(n.gt(this.shru(1)))return w;v=s}else v=e;for(i=this;i.gte(n);){t=Math.max(1,Math.floor(i.toNumber()/n.toNumber()));for(var p=Math.ceil(Math.log(t)/Math.LN2),p=48>=p?1:l(2,p-48),h=f(t),y=h.mul(n);y.isNegative()||y.gt(i);)t-=p,h=f(t,this.unsigned),y=h.mul(n);h.isZero()&&(h=c);v=v.add(h);i=i.sub(y)}return v};n.div=n.divide;n.modulo=function(n){return u(n)||(n=o(n)),this.sub(this.div(n).mul(n))};n.mod=n.modulo;n.not=function(){return t(~this.low,~this.high,this.unsigned)};n.and=function(n){return u(n)||(n=o(n)),t(this.low&n.low,this.high&n.high,this.unsigned)};n.or=function(n){return u(n)||(n=o(n)),t(this.low|n.low,this.high|n.high,this.unsigned)};n.xor=function(n){return u(n)||(n=o(n)),t(this.low^n.low,this.high^n.high,this.unsigned)};n.shiftLeft=function(n){return u(n)&&(n=n.toInt()),0==(n&=63)?this:32>n?t(this.low<<n,this.high<<n|this.low>>>32-n,this.unsigned):t(0,this.low<<n-32,this.unsigned)};n.shl=n.shiftLeft;n.shiftRight=function(n){return u(n)&&(n=n.toInt()),0==(n&=63)?this:32>n?t(this.low>>>n|this.high<<32-n,this.high>>n,this.unsigned):t(this.high>>n-32,0<=this.high?0:-1,this.unsigned)};n.shr=n.shiftRight;n.shiftRightUnsigned=function(n){if(u(n)&&(n=n.toInt()),n&=63,0===n)return this;var i=this.high;return 32>n?t(this.low>>>n|i<<32-n,i>>>n,this.unsigned):32===n?t(i,0,this.unsigned):t(i>>>n-32,0,this.unsigned)};n.shru=n.shiftRightUnsigned;n.toSigned=function(){return this.unsigned?t(this.low,this.high,!1):this};n.toUnsigned=function(){return this.unsigned?this:t(this.low,this.high,!0)}}(Bridge.global);System.Int64=function(n){if(this.constructor!==System.Int64)return new System.Int64(n);Bridge.hasValue(n)||(n=0);this.T=System.Int64;this.unsigned=!1;this.value=System.Int64.getValue(n)};System.Int64.$$name="System.Int64";System.Int64.prototype.$$name="System.Int64";System.Int64.$kind="struct";System.Int64.prototype.$kind="struct";System.Int64.$$inherits=[];Bridge.Class.addExtend(System.Int64,[System.IComparable,System.IFormattable,System.IComparable$1(System.Int64),System.IEquatable$1(System.Int64)]);System.Int64.$is=function(n){return n instanceof System.Int64};System.Int64.is64Bit=function(n){return n instanceof System.Int64||n instanceof System.UInt64};System.Int64.getDefaultValue=function(){return System.Int64.Zero};System.Int64.getValue=function(n){return Bridge.hasValue(n)?n instanceof Bridge.$Long?n:n instanceof System.Int64?n.value:n instanceof System.UInt64?n.value.toSigned():Bridge.isArray(n)?new Bridge.$Long(n[0],n[1]):Bridge.isString(n)?Bridge.$Long.fromString(n):Bridge.isNumber(n)?Bridge.$Long.fromNumber(n):n instanceof System.Decimal?Bridge.$Long.fromString(n.toString()):Bridge.$Long.fromValue(n):null};System.Int64.create=function(n){return Bridge.hasValue(n)?n instanceof System.Int64?n:new System.Int64(n):null};System.Int64.lift=function(n){return Bridge.hasValue(n)?System.Int64.create(n):null};System.Int64.toNumber=function(n){return n?n.toNumber():null};System.Int64.prototype.toNumberDivided=function(n){var t=this.div(n),i=this.mod(n),r=i.toNumber()/n;return t.toNumber()+r};System.Int64.prototype.toJSON=function(){return this.toNumber()};System.Int64.prototype.toString=function(n,t){return!n&&!t?this.value.toString():Bridge.isNumber(n)&&!t?this.value.toString(n):Bridge.Int.format(this,n,t)};System.Int64.prototype.format=function(n,t){return Bridge.Int.format(this,n,t)};System.Int64.prototype.isNegative=function(){return this.value.isNegative()};System.Int64.prototype.abs=function(){if(this.T===System.Int64&&this.eq(System.Int64.MinValue))throw new System.OverflowException;return new this.T(this.value.isNegative()?this.value.neg():this.value)};System.Int64.prototype.compareTo=function(n){return this.value.compare(this.T.getValue(n))};System.Int64.prototype.add=function(n,t){var i=this.T.getValue(n),r=new this.T(this.value.add(i));if(t){var u=this.value.isNegative(),f=i.isNegative(),e=r.value.isNegative();if(u&&f&&!e||!u&&!f&&e||this.T===System.UInt64&&r.lt(System.UInt64.max(this,i)))throw new System.OverflowException;}return r};System.Int64.prototype.sub=function(n,t){var i=this.T.getValue(n),r=new this.T(this.value.sub(i));if(t){var u=this.value.isNegative(),f=i.isNegative(),e=r.value.isNegative();if(u&&!f&&!e||!u&&f&&e||this.T===System.UInt64&&this.value.lt(i))throw new System.OverflowException;}return r};System.Int64.prototype.isZero=function(){return this.value.isZero()};System.Int64.prototype.mul=function(n,t){var i=this.T.getValue(n),r=new this.T(this.value.mul(i)),u;if(t){var f=this.sign(),e=i.isZero()?0:i.isNegative()?-1:1,o=r.sign();if(this.T===System.Int64){if(this.eq(System.Int64.MinValue)||this.eq(System.Int64.MaxValue)){if(i.neq(1)&&i.neq(0))throw new System.OverflowException;return r}if(i.eq(Bridge.$Long.MIN_VALUE)||i.eq(Bridge.$Long.MAX_VALUE)){if(this.neq(1)&&this.neq(0))throw new System.OverflowException;return r}if(f===-1&&e===-1&&o!==1||f===1&&e===1&&o!==1||f===-1&&e===1&&o!==-1||f===1&&e===-1&&o!==-1)throw new System.OverflowException;if(u=r.abs(),u.lt(this.abs())||u.lt(System.Int64(i).abs()))throw new System.OverflowException;}else{if(this.eq(System.UInt64.MaxValue)){if(i.neq(1)&&i.neq(0))throw new System.OverflowException;return r}if(i.eq(Bridge.$Long.MAX_UNSIGNED_VALUE)){if(this.neq(1)&&this.neq(0))throw new System.OverflowException;return r}if(u=r.abs(),u.lt(this.abs())||u.lt(System.Int64(i).abs()))throw new System.OverflowException;}}return r};System.Int64.prototype.div=function(n){return new this.T(this.value.div(this.T.getValue(n)))};System.Int64.prototype.mod=function(n){return new this.T(this.value.mod(this.T.getValue(n)))};System.Int64.prototype.neg=function(n){if(n&&this.T===System.Int64&&this.eq(System.Int64.MinValue))throw new System.OverflowException;return new this.T(this.value.neg())};System.Int64.prototype.inc=function(n){return this.add(1,n)};System.Int64.prototype.dec=function(n){return this.sub(1,n)};System.Int64.prototype.sign=function(){return this.value.isZero()?0:this.value.isNegative()?-1:1};System.Int64.prototype.clone=function(){return new this.T(this)};System.Int64.prototype.ne=function(n){return this.value.neq(this.T.getValue(n))};System.Int64.prototype.neq=function(n){return this.value.neq(this.T.getValue(n))};System.Int64.prototype.eq=function(n){return this.value.eq(this.T.getValue(n))};System.Int64.prototype.lt=function(n){return this.value.lt(this.T.getValue(n))};System.Int64.prototype.lte=function(n){return this.value.lte(this.T.getValue(n))};System.Int64.prototype.gt=function(n){return this.value.gt(this.T.getValue(n))};System.Int64.prototype.gte=function(n){return this.value.gte(this.T.getValue(n))};System.Int64.prototype.equals=function(n){return this.value.eq(this.T.getValue(n))};System.Int64.prototype.equalsT=function(n){return this.equals(n)};System.Int64.prototype.getHashCode=function(){var n=this.sign()*397+this.value.high|0;return n*397+this.value.low|0};System.Int64.prototype.toNumber=function(){return this.value.toNumber()};System.Int64.parse=function(n){if(n==null)throw new System.ArgumentNullException("str");if(!/^[+-]?[0-9]+$/.test(n))throw new System.FormatException("Input string was not in a correct format.");var t=new System.Int64(n);if(n!==t.toString())throw new System.OverflowException;return t};System.Int64.tryParse=function(n,t){try{return n==null||!/^[+-]?[0-9]+$/.test(n)?(t.v=System.Int64(Bridge.$Long.ZERO),!1):(t.v=new System.Int64(n),n!==t.v.toString())?(t.v=System.Int64(Bridge.$Long.ZERO),!1):!0}catch(i){return t.v=System.Int64(Bridge.$Long.ZERO),!1}};System.Int64.divRem=function(n,t,i){n=System.Int64(n);t=System.Int64(t);var r=n.mod(t);return i.v=r,n.sub(r).div(t)};System.Int64.min=function(){for(var t=[],i,n=0,r=arguments.length;n<r;n++)t.push(System.Int64.getValue(arguments[n]));for(n=0,i=t[0];++n<t.length;)t[n].lt(i)&&(i=t[n]);return new System.Int64(i)};System.Int64.max=function(){for(var t=[],i,n=0,r=arguments.length;n<r;n++)t.push(System.Int64.getValue(arguments[n]));for(n=0,i=t[0];++n<t.length;)t[n].gt(i)&&(i=t[n]);return new System.Int64(i)};System.Int64.prototype.and=function(n){return new this.T(this.value.and(this.T.getValue(n)))};System.Int64.prototype.not=function(){return new this.T(this.value.not())};System.Int64.prototype.or=function(n){return new this.T(this.value.or(this.T.getValue(n)))};System.Int64.prototype.shl=function(n){return new this.T(this.value.shl(n))};System.Int64.prototype.shr=function(n){return new this.T(this.value.shr(n))};System.Int64.prototype.shru=function(n){return new this.T(this.value.shru(n))};System.Int64.prototype.xor=function(n){return new this.T(this.value.xor(this.T.getValue(n)))};System.Int64.check=function(n,t){if(Bridge.Int.isInfinite(n))return t===System.Int64||t===System.UInt64?t.MinValue:t.min;if(!n)return null;var i,r;if(t===System.Int64){if(n instanceof System.Int64)return n;if(i=n.value.toString(),r=new System.Int64(i),i!==r.value.toString())throw new System.OverflowException;return r}if(t===System.UInt64){if(n instanceof System.UInt64)return n;if(n.value.isNegative())throw new System.OverflowException;if(i=n.value.toString(),r=new System.UInt64(i),i!==r.value.toString())throw new System.OverflowException;return r}return Bridge.Int.check(n.toNumber(),t)};System.Int64.clip8=function(n){return n?Bridge.Int.sxb(n.value.low&255):Bridge.Int.isInfinite(n)?System.SByte.min:null};System.Int64.clipu8=function(n){return n?n.value.low&255:Bridge.Int.isInfinite(n)?System.Byte.min:null};System.Int64.clip16=function(n){return n?Bridge.Int.sxs(n.value.low&65535):Bridge.Int.isInfinite(n)?System.Int16.min:null};System.Int64.clipu16=function(n){return n?n.value.low&65535:Bridge.Int.isInfinite(n)?System.UInt16.min:null};System.Int64.clip32=function(n){return n?n.value.low|0:Bridge.Int.isInfinite(n)?System.Int32.min:null};System.Int64.clipu32=function(n){return n?n.value.low>>>0:Bridge.Int.isInfinite(n)?System.UInt32.min:null};System.Int64.clip64=function(n){return n?new System.Int64(n.value.toSigned()):Bridge.Int.isInfinite(n)?System.Int64.MinValue:null};System.Int64.clipu64=function(n){return n?new System.UInt64(n.value.toUnsigned()):Bridge.Int.isInfinite(n)?System.UInt64.MinValue:null};System.Int64.Zero=System.Int64(Bridge.$Long.ZERO);System.Int64.MinValue=System.Int64(Bridge.$Long.MIN_VALUE);System.Int64.MaxValue=System.Int64(Bridge.$Long.MAX_VALUE);System.Int64.precision=19;System.UInt64=function(n){if(this.constructor!==System.UInt64)return new System.UInt64(n);Bridge.hasValue(n)||(n=0);this.T=System.UInt64;this.unsigned=!0;this.value=System.UInt64.getValue(n,!0)};System.UInt64.$$name="System.UInt64";System.UInt64.prototype.$$name="System.UInt64";System.UInt64.$kind="struct";System.UInt64.prototype.$kind="struct";System.UInt64.$$inherits=[];Bridge.Class.addExtend(System.UInt64,[System.IComparable,System.IFormattable,System.IComparable$1(System.UInt64),System.IEquatable$1(System.UInt64)]);System.UInt64.$is=function(n){return n instanceof System.UInt64};System.UInt64.getDefaultValue=function(){return System.UInt64.Zero};System.UInt64.getValue=function(n){return Bridge.hasValue(n)?n instanceof Bridge.$Long?n:n instanceof System.UInt64?n.value:n instanceof System.Int64?n.value.toUnsigned():Bridge.isArray(n)?new Bridge.$Long(n[0],n[1],!0):Bridge.isString(n)?Bridge.$Long.fromString(n,!0):Bridge.isNumber(n)?Bridge.$Long.fromNumber(n,!0):n instanceof System.Decimal?Bridge.$Long.fromString(n.toString(),!0):Bridge.$Long.fromValue(n):null};System.UInt64.create=function(n){return Bridge.hasValue(n)?n instanceof System.UInt64?n:new System.UInt64(n):null};System.UInt64.lift=function(n){return Bridge.hasValue(n)?System.UInt64.create(n):null};System.UInt64.prototype.toJSON=System.Int64.prototype.toJSON;System.UInt64.prototype.toString=System.Int64.prototype.toString;System.UInt64.prototype.format=System.Int64.prototype.format;System.UInt64.prototype.isNegative=System.Int64.prototype.isNegative;System.UInt64.prototype.abs=System.Int64.prototype.abs;System.UInt64.prototype.compareTo=System.Int64.prototype.compareTo;System.UInt64.prototype.add=System.Int64.prototype.add;System.UInt64.prototype.sub=System.Int64.prototype.sub;System.UInt64.prototype.isZero=System.Int64.prototype.isZero;System.UInt64.prototype.mul=System.Int64.prototype.mul;System.UInt64.prototype.div=System.Int64.prototype.div;System.UInt64.prototype.toNumberDivided=System.Int64.prototype.toNumberDivided;System.UInt64.prototype.mod=System.Int64.prototype.mod;System.UInt64.prototype.neg=System.Int64.prototype.neg;System.UInt64.prototype.inc=System.Int64.prototype.inc;System.UInt64.prototype.dec=System.Int64.prototype.dec;System.UInt64.prototype.sign=System.Int64.prototype.sign;System.UInt64.prototype.clone=System.Int64.prototype.clone;System.UInt64.prototype.ne=System.Int64.prototype.ne;System.UInt64.prototype.neq=System.Int64.prototype.neq;System.UInt64.prototype.eq=System.Int64.prototype.eq;System.UInt64.prototype.lt=System.Int64.prototype.lt;System.UInt64.prototype.lte=System.Int64.prototype.lte;System.UInt64.prototype.gt=System.Int64.prototype.gt;System.UInt64.prototype.gte=System.Int64.prototype.gte;System.UInt64.prototype.equals=System.Int64.prototype.equals;System.UInt64.prototype.equalsT=System.Int64.prototype.equalsT;System.UInt64.prototype.getHashCode=System.Int64.prototype.getHashCode;System.UInt64.prototype.toNumber=System.Int64.prototype.toNumber;System.UInt64.parse=function(n){if(n==null)throw new System.ArgumentNullException("str");if(!/^[+-]?[0-9]+$/.test(n))throw new System.FormatException("Input string was not in a correct format.");var t=new System.UInt64(n);if(t.value.isNegative())throw new System.OverflowException;if(n!==t.toString())throw new System.OverflowException;return t};System.UInt64.tryParse=function(n,t){try{return n==null||!/^[+-]?[0-9]+$/.test(n)?(t.v=System.UInt64(Bridge.$Long.UZERO),!1):(t.v=new System.UInt64(n),t.v.isNegative())?(t.v=System.UInt64(Bridge.$Long.UZERO),!1):n!==t.v.toString()?(t.v=System.UInt64(Bridge.$Long.UZERO),!1):!0}catch(i){return t.v=System.UInt64(Bridge.$Long.UZERO),!1}};System.UInt64.min=function(){for(var t=[],i,n=0,r=arguments.length;n<r;n++)t.push(System.UInt64.getValue(arguments[n]));for(n=0,i=t[0];++n<t.length;)t[n].lt(i)&&(i=t[n]);return new System.UInt64(i)};System.UInt64.max=function(){for(var t=[],i,n=0,r=arguments.length;n<r;n++)t.push(System.UInt64.getValue(arguments[n]));for(n=0,i=t[0];++n<t.length;)t[n].gt(i)&&(i=t[n]);return new System.UInt64(i)};System.UInt64.divRem=function(n,t,i){n=System.UInt64(n);t=System.UInt64(t);var r=n.mod(t);return i.v=r,n.sub(r).div(t)};System.UInt64.prototype.and=System.Int64.prototype.and;System.UInt64.prototype.not=System.Int64.prototype.not;System.UInt64.prototype.or=System.Int64.prototype.or;System.UInt64.prototype.shl=System.Int64.prototype.shl;System.UInt64.prototype.shr=System.Int64.prototype.shr;System.UInt64.prototype.shru=System.Int64.prototype.shru;System.UInt64.prototype.xor=System.Int64.prototype.xor;System.UInt64.Zero=System.UInt64(Bridge.$Long.UZERO);System.UInt64.MinValue=System.UInt64.Zero;System.UInt64.MaxValue=System.UInt64(Bridge.$Long.MAX_UNSIGNED_VALUE);System.UInt64.precision=20;!function(n){function e(n){var u,i,f,o=n.length-1,e="",t=n[0];if(o>0){for(e+=t,u=1;o>u;u++)f=n[u]+"",i=r-f.length,i&&(e+=k(i)),e+=f;t=n[u];f=t+"";i=r-f.length;i&&(e+=k(i))}else if(0===t)return"0";for(;t%10==0;)t/=10;return e+t}function c(n,t,i){if(n!==~~n||t>n||n>i)throw Error(nt+n);}function rt(n,t,i,u){for(var o,s,f,e=n[0];e>=10;e/=10)--t;return--t<0?(t+=r,o=0):(o=Math.ceil((t+1)/r),t%=r),e=h(10,r-t),f=n[o]%e|0,null==u?3>t?(0==t?f=f/100|0:1==t&&(f=f/10|0),s=4>i&&99999==f||i>3&&49999==f||5e4==f||0==f):s=(4>i&&f+1==e||i>3&&f+1==e/2)&&(n[o+1]/e/100|0)==h(10,t-2)-1||(f==e/2||0==f)&&0==(n[o+1]/e/100|0):4>t?(0==t?f=f/1e3|0:1==t?f=f/100|0:2==t&&(f=f/10|0),s=(u||4>i)&&9999==f||!u&&i>3&&4999==f):s=((u||4>i)&&f+1==e||!u&&i>3&&f+1==e/2)&&(n[o+1]/e/1e3|0)==h(10,t-3)-1,s}function w(n,t,i){for(var u,f,r=[0],e=0,s=n.length;s>e;){for(f=r.length;f--;)r[f]*=t;for(r[0]+=o.indexOf(n.charAt(e++)),u=0;u<r.length;u++)r[u]>i-1&&(void 0===r[u+1]&&(r[u+1]=0),r[u+1]+=r[u]/i|0,r[u]%=i)}return r.reverse()}function ri(n,t){var i,u,f=t.d.length,e,r;for(32>f?(i=Math.ceil(f/3),u=Math.pow(4,-i).toString()):(i=16,u="2.3283064365386962890625e-10"),n.precision+=i,t=tt(n,1,t.times(u),new n(1)),e=i;e--;)r=t.times(t),t=r.times(r).minus(r).times(8).plus(1);return n.precision-=i,t}function i(n,t,i,f){var a,c,o,s,p,w,v,e,l,b=n.constructor;n:if(null!=t){if(e=n.d,!e)return n;for(a=1,s=e[0];s>=10;s/=10)a++;if(c=t-a,0>c)c+=r,o=t,v=e[l=0],p=v/h(10,a-o-1)%10|0;else if(l=Math.ceil((c+1)/r),s=e.length,l>=s){if(!f)break n;for(;s++<=l;)e.push(0);v=p=0;a=1;c%=r;o=c-r+1}else{for(v=s=e[l],a=1;s>=10;s/=10)a++;c%=r;o=c-r+a;p=0>o?0:v/h(10,a-o-1)%10|0}if(f=f||0>t||void 0!==e[l+1]||(0>o?v:v%h(10,a-o-1)),w=4>i?(p||f)&&(0==i||i==(n.s<0?3:2)):p>5||5==p&&(4==i||f||6==i&&(c>0?o>0?v/h(10,a-o):0:e[l-1])%10&1||i==(n.s<0?8:7)),1>t||!e[0])return e.length=0,w?(t-=n.e+1,e[0]=h(10,(r-t%r)%r),n.e=-t||0):e[0]=n.e=0,n;if(0==c?(e.length=l,s=1,l--):(e.length=l+1,s=h(10,r-c),e[l]=o>0?(v/h(10,a-o)%h(10,o)|0)*s:0),w)for(;;){if(0==l){for(c=1,o=e[0];o>=10;o/=10)c++;for(o=e[0]+=s,s=1;o>=10;o/=10)s++;c!=s&&(n.e++,e[0]==y&&(e[0]=1));break}if(e[l]+=s,e[l]!=y)break;e[l--]=0;s=1}for(c=e.length;0===e[--c];)e.pop()}return u&&(n.e>b.maxE?(n.d=null,n.e=NaN):n.e<b.minE&&(n.e=0,n.d=[0])),n}function p(n,t,i){if(!n.isFinite())return wt(n);var u,o=n.e,r=e(n.d),f=r.length;return t?(i&&(u=i-f)>0?r=r.charAt(0)+"."+r.slice(1)+k(u):f>1&&(r=r.charAt(0)+"."+r.slice(1)),r=r+(n.e<0?"e":"e+")+n.e):0>o?(r="0."+k(-o-1)+r,i&&(u=i-f)>0&&(r+=k(u))):o>=f?(r+=k(o+1-f),i&&(u=i-o-1)>0&&(r=r+"."+k(u))):((u=o+1)<f&&(r=r.slice(0,u)+"."+r.slice(u)),i&&(u=i-f)>0&&(o+1===f&&(r+="."),r+=k(u))),r}function ut(n,t){for(var i=1,u=n[0];u>=10;u/=10)i++;return i+t*r-1}function ft(n,t,r){if(t>ou)throw u=!0,r&&(n.precision=r),Error(ii);return i(new n(et),t,1,!0)}function a(n,t,r){if(t>lt)throw Error(ii);return i(new n(ot),t,r,!0)}function at(n){var t=n.length-1,i=t*r+1;if(t=n[t]){for(;t%10==0;t/=10)i--;for(t=n[0];t>=10;t/=10)i++}return i}function k(n){for(var t="";n--;)t+="0";return t}function vt(n,t,i,f){var o,e=new n(1),h=Math.ceil(f/r+4);for(u=!1;;){if(i%2&&(e=e.times(t),dt(e.d,h)&&(o=!0)),i=s(i/2),0===i){i=e.d.length-1;o&&0===e.d[i]&&++e.d[i];break}t=t.times(t);dt(t.d,h)}return u=!0,e}function yt(n){return 1&n.d[n.d.length-1]}function pt(n,t,i){for(var r,u=new n(t[0]),f=0;++f<t.length;){if(r=new n(t[f]),!r.s){u=r;break}u[i](r)&&(u=r)}return u}function ht(n,t){var l,v,b,a,o,c,r,y=0,k=0,p=0,s=n.constructor,d=s.rounding,w=s.precision;if(!n.d||!n.d[0]||n.e>17)return new s(n.d?n.d[0]?n.s<0?0:1/0:1:n.s?n.s<0?0:n:NaN);for(null==t?(u=!1,r=w):r=t,c=new s(.03125);n.e>-2;)n=n.times(c),p+=5;for(v=Math.log(h(2,p))/Math.LN10*2+5|0,r+=v,l=a=o=new s(1),s.precision=r;;){if(a=i(a.times(n),r,1),l=l.times(++k),c=o.plus(f(a,l,r,1)),e(c.d).slice(0,r)===e(o.d).slice(0,r)){for(b=p;b--;)o=i(o.times(o),r,1);if(null!=t)return s.precision=w,o;if(!(3>y&&rt(o.d,r-v,d,y)))return i(o,s.precision=w,d,u=!0);s.precision=r+=10;l=a=c=new s(1);k=0;y++}o=c}}function d(n,t){var c,l,b,y,w,it,h,p,o,g,nt,ut=1,k=10,r=n,a=r.d,s=r.constructor,tt=s.rounding,v=s.precision;if(r.s<0||!a||!a[0]||!r.e&&1==a[0]&&1==a.length)return new s(a&&!a[0]?-1/0:1!=r.s?NaN:a?0:r);if(null==t?(u=!1,o=v):o=t,s.precision=o+=k,c=e(a),l=c.charAt(0),!(Math.abs(y=r.e)<15e14))return p=ft(s,o+2,v).times(y+""),r=d(new s(l+"."+c.slice(1)),o-k).plus(p),s.precision=v,null==t?i(r,v,tt,u=!0):r;for(;7>l&&1!=l||1==l&&c.charAt(1)>3;)r=r.times(n),c=e(r.d),l=c.charAt(0),ut++;for(y=r.e,l>1?(r=new s("0."+c),y++):r=new s(l+"."+c.slice(1)),g=r,h=w=r=f(r.minus(1),r.plus(1),o,1),nt=i(r.times(r),o,1),b=3;;){if(w=i(w.times(nt),o,1),p=h.plus(f(w,new s(b),o,1)),e(p.d).slice(0,o)===e(h.d).slice(0,o)){if(h=h.times(2),0!==y&&(h=h.plus(ft(s,o+2,v).times(y+""))),h=f(h,new s(ut),o,1),null!=t)return s.precision=v,h;if(!rt(h.d,o-k,tt,it))return i(h,s.precision=v,tt,u=!0);s.precision=o+=k;p=w=r=f(g.minus(1),g.plus(1),o,1);nt=i(r.times(r),o,1);b=it=1}h=p;b+=2}}function wt(n){return String(n.s*n.s/0)}function bt(n,t){var f,i,e;for((f=t.indexOf("."))>-1&&(t=t.replace(".","")),(i=t.search(/e/i))>0?(0>f&&(f=i),f+=+t.slice(i+1),t=t.substring(0,i)):0>f&&(f=t.length),i=0;48===t.charCodeAt(i);i++);for(e=t.length;48===t.charCodeAt(e-1);--e);if(t=t.slice(i,e)){if(e-=i,n.e=f=f-i-1,n.d=[],i=(f+1)%r,0>f&&(i+=r),e>i){for(i&&n.d.push(+t.slice(0,i)),e-=r;e>i;)n.d.push(+t.slice(i,i+=r));t=t.slice(i);i=r-t.length}else i-=e;for(;i--;)t+="0";n.d.push(+t);u&&(n.e>n.constructor.maxE?(n.d=null,n.e=NaN):n.e<n.constructor.minE&&(n.e=0,n.d=[0]))}else n.e=0,n.d=[0];return n}function ui(n,t){var e,s,a,i,h,c,o,r,l;if("Infinity"===t||"NaN"===t)return+t||(n.s=NaN),n.e=NaN,n.d=null,n;if(ru.test(t))e=16,t=t.toLowerCase();else if(iu.test(t))e=2;else{if(!uu.test(t))throw Error(nt+t);e=8}for(i=t.search(/p/i),i>0?(o=+t.slice(i+1),t=t.substring(2,i)):t=t.slice(2),i=t.indexOf("."),h=i>=0,s=n.constructor,h&&(t=t.replace(".",""),c=t.length,i=c-i,a=vt(s,new s(e),i,2*i)),r=w(t,e,y),l=r.length-1,i=l;0===r[i];--i)r.pop();return 0>i?new s(0*n.s):(n.e=ut(r,l),n.d=r,u=!1,h&&(n=f(n,a,4*c)),o&&(n=n.times(Math.abs(o)<54?Math.pow(2,o):v.pow(2,o))),u=!0,n)}function fi(n,t){var i,u=t.d.length;if(3>u)return tt(n,2,t,t);i=1.4*Math.sqrt(u);i=i>16?16:0|i;t=t.times(Math.pow(5,-i));t=tt(n,2,t,t);for(var r,f=new n(5),e=new n(16),o=new n(20);i--;)r=t.times(t),t=t.times(f.plus(r.times(e.times(r).minus(o))));return t}function tt(n,t,i,e,o){var h,s,c,l,y=1,a=n.precision,v=Math.ceil(a/r);for(u=!1,l=i.times(i),c=new n(e);;){if(s=f(c.times(l),new n(t++*t++),a,1),c=o?e.plus(s):e.minus(s),e=f(s.times(l),new n(t++*t++),a,1),s=c.plus(e),void 0!==s.d[v]){for(h=v;s.d[h]===c.d[h]&&h--;);if(-1==h)break}h=c;c=e;e=s;s=h;y++}return u=!0,s.d.length=v+1,s}function kt(n,t){var r,i=t.s<0,u=a(n,n.precision,1),f=u.times(.5);if(t=t.abs(),t.lte(f))return b=i?4:1,t;if(r=t.divToInt(u),r.isZero())b=i?3:2;else{if(t=t.minus(r.times(u)),t.lte(f))return b=yt(r)?i?2:3:i?4:1,t;b=yt(r)?i?1:4:i?3:2}return t.minus(u).abs()}function ct(n,t,i,r){var a,l,s,d,h,v,u,e,y,b=n.constructor,k=void 0!==i;if(k?(c(i,1,g),void 0===r?r=b.rounding:c(r,0,8)):(i=b.precision,r=b.rounding),n.isFinite()){for(u=p(n),s=u.indexOf("."),k?(a=2,16==t?i=4*i-3:8==t&&(i=3*i-2)):a=t,s>=0&&(u=u.replace(".",""),y=new b(1),y.e=u.length-s,y.d=w(p(y),10,a),y.e=y.d.length),e=w(u,10,a),l=h=e.length;0==e[--h];)e.pop();if(e[0]){if(0>s?l--:(n=new b(n),n.d=e,n.e=l,n=f(n,y,i,r,0,a),e=n.d,l=n.e,v=ni),s=e[i],d=a/2,v=v||void 0!==e[i+1],v=4>r?(void 0!==s||v)&&(0===r||r===(n.s<0?3:2)):s>d||s===d&&(4===r||v||6===r&&1&e[i-1]||r===(n.s<0?8:7)),e.length=i,v)for(;++e[--i]>a-1;)e[i]=0,i||(++l,e.unshift(1));for(h=e.length;!e[h-1];--h);for(s=0,u="";h>s;s++)u+=o.charAt(e[s]);if(k){if(h>1)if(16==t||8==t){for(s=16==t?4:3,--h;h%s;h++)u+="0";for(e=w(u,a,t),h=e.length;!e[h-1];--h);for(s=1,u="1.";h>s;s++)u+=o.charAt(e[s])}else u=u.charAt(0)+"."+u.slice(1);u=u+(0>l?"p":"p+")+l}else if(0>l){for(;++l;)u="0"+u;u="0."+u}else if(++l>h)for(l-=h;l--;)u+="0";else h>l&&(u=u.slice(0,l)+"."+u.slice(l))}else u=k?"0p+0":"0";u=(16==t?"0x":2==t?"0b":8==t?"0o":"")+u}else u=wt(n);return n.s<0?"-"+u:u}function dt(n,t){if(n.length>t)return(n.length=t,!0)}function ei(n){return new this(n).abs()}function oi(n){return new this(n).acos()}function si(n){return new this(n).acosh()}function hi(n,t){return new this(n).plus(t)}function ci(n){return new this(n).asin()}function li(n){return new this(n).asinh()}function ai(n){return new this(n).atan()}function vi(n){return new this(n).atanh()}function yi(n,t){n=new this(n);t=new this(t);var i,u=this.precision,e=this.rounding,r=u+4;return n.s&&t.s?n.d||t.d?!t.d||n.isZero()?(i=t.s<0?a(this,u,e):new this(0),i.s=n.s):!n.d||t.isZero()?(i=a(this,r,1).times(.5),i.s=n.s):t.s<0?(this.precision=r,this.rounding=1,i=this.atan(f(n,t,r,1)),t=a(this,r,1),this.precision=u,this.rounding=e,i=n.s<0?i.minus(t):i.plus(t)):i=this.atan(f(n,t,r,1)):(i=a(this,r,1).times(t.s>0?.25:.75),i.s=n.s):i=new this(NaN),i}function pi(n){return new this(n).cbrt()}function wi(n){return i(n=new this(n),n.e+1,2)}function bi(n){if(!n||"object"!=typeof n)throw Error(st+"Object expected");for(var i,t,u=["precision",1,g,"rounding",0,8,"toExpNeg",-it,0,"toExpPos",0,it,"maxE",0,it,"minE",-it,0,"modulo",0,9],r=0;r<u.length;r+=3)if(void 0!==(t=n[i=u[r]])){if(!(s(t)===t&&t>=u[r+1]&&t<=u[r+2]))throw Error(nt+i+": "+t);this[i]=t}if(n.hasOwnProperty(i="crypto"))if(void 0===(t=n[i]))this[i]=t;else{if(t!==!0&&t!==!1&&0!==t&&1!==t)throw Error(nt+i+": "+t);this[i]=!(!t||!l||!l.getRandomValues&&!l.randomBytes)}return this}function ki(n){return new this(n).cos()}function di(n){return new this(n).cosh()}function gt(n){function i(n){var r,u,f,t=this;if(!(t instanceof i))return new i(n);if(t.constructor=i,n instanceof i)return t.s=n.s,t.e=n.e,void(t.d=(n=n.d)?n.slice():n);if(f=typeof n,"number"===f){if(0===n)return t.s=0>1/n?-1:1,t.e=0,void(t.d=[0]);if(0>n?(n=-n,t.s=-1):t.s=1,n===~~n&&1e7>n){for(r=0,u=n;u>=10;u/=10)r++;return t.e=r,void(t.d=[n])}return 0*n!=0?(n||(t.s=NaN),t.e=NaN,void(t.d=null)):bt(t,n.toString())}if("string"!==f)throw Error(nt+n);return 45===n.charCodeAt(0)?(n=n.slice(1),t.s=-1):t.s=1,fu.test(n)?bt(t,n):ui(t,n)}var r,u,f;if(i.prototype=t,i.ROUND_UP=0,i.ROUND_DOWN=1,i.ROUND_CEIL=2,i.ROUND_FLOOR=3,i.ROUND_HALF_UP=4,i.ROUND_HALF_DOWN=5,i.ROUND_HALF_EVEN=6,i.ROUND_HALF_CEIL=7,i.ROUND_HALF_FLOOR=8,i.EUCLID=9,i.config=bi,i.clone=gt,i.abs=ei,i.acos=oi,i.acosh=si,i.add=hi,i.asin=ci,i.asinh=li,i.atan=ai,i.atanh=vi,i.atan2=yi,i.cbrt=pi,i.ceil=wi,i.cos=ki,i.cosh=di,i.div=gi,i.exp=nr,i.floor=tr,i.fromJSON=ir,i.hypot=rr,i.ln=ur,i.log=fr,i.log10=or,i.log2=er,i.max=sr,i.min=hr,i.mod=cr,i.mul=lr,i.pow=ar,i.random=vr,i.round=yr,i.sign=pr,i.sin=wr,i.sinh=br,i.sqrt=kr,i.sub=dr,i.tan=gr,i.tanh=nu,i.trunc=tu,void 0===n&&(n={}),n)for(f=["precision","rounding","toExpNeg","toExpPos","maxE","minE","modulo","crypto"],r=0;r<f.length;)n.hasOwnProperty(u=f[r++])||(n[u]=this[u]);return i.config(n),i}function gi(n,t){return new this(n).div(t)}function nr(n){return new this(n).exp()}function tr(n){return i(n=new this(n),n.e+1,3)}function ir(n){var i,u,r,t;if("string"!=typeof n||!n)throw Error(nt+n);if(r=n.length,t=o.indexOf(n.charAt(0)),1===r)return new this(t>81?[-1/0,1/0,NaN][t-82]:t>40?-(t-41):t);if(64&t)u=16&t,i=u?(7&t)-3:(15&t)-7,r=1;else{if(2===r)return t=88*t+o.indexOf(n.charAt(1)),new this(t>=2816?-(t-2816)-41:t+41);if(u=32&t,!(31&t))return n=w(n.slice(1),88,10).join(""),new this(u?"-"+n:n);i=15&t;r=i+1;i=1===i?o.indexOf(n.charAt(1)):2===i?88*o.indexOf(n.charAt(1))+o.indexOf(n.charAt(2)):+w(n.slice(1,r),88,10).join("");16&t&&(i=-i)}return n=w(n.slice(r),88,10).join(""),i=i-n.length+1,n=n+"e"+i,new this(u?"-"+n:n)}function rr(){var i,n,t=new this(0);for(u=!1,i=0;i<arguments.length;)if(n=new this(arguments[i++]),n.d)t.d&&(t=t.plus(n.times(n)));else{if(n.s)return u=!0,new this(1/0);t=n}return u=!0,t.sqrt()}function ur(n){return new this(n).ln()}function fr(n,t){return new this(n).log(t)}function er(n){return new this(n).log(2)}function or(n){return new this(n).log(10)}function sr(){return pt(this,arguments,"lt")}function hr(){return pt(this,arguments,"gt")}function cr(n,t){return new this(n).mod(t)}function lr(n,t){return new this(n).mul(t)}function ar(n,t){return new this(n).pow(t)}function vr(n){var e,o,i,f,t=0,s=new this(1),u=[];if(void 0===n?n=this.precision:c(n,1,g),i=Math.ceil(n/r),this.crypto===!1)for(;i>t;)u[t++]=1e7*Math.random()|0;else if(l&&l.getRandomValues)for(e=l.getRandomValues(new Uint32Array(i));i>t;)f=e[t],f>=429e7?e[t]=l.getRandomValues(new Uint32Array(1))[0]:u[t++]=f%1e7;else if(l&&l.randomBytes){for(e=l.randomBytes(i*=4);i>t;)f=e[t]+(e[t+1]<<8)+(e[t+2]<<16)+((127&e[t+3])<<24),f>=214e7?l.randomBytes(4).copy(e,t):(u.push(f%1e7),t+=4);t=i/4}else{if(this.crypto)throw Error(st+"crypto unavailable");for(;i>t;)u[t++]=1e7*Math.random()|0}for(i=u[--t],n%=r,i&&n&&(f=h(10,r-n),u[t]=(i/f|0)*f);0===u[t];t--)u.pop();if(0>t)o=0,u=[0];else{for(o=-1;0===u[0];o-=r)u.shift();for(i=1,f=u[0];f>=10;f/=10)i++;r>i&&(o-=r-i)}return s.e=o,s.d=u,s}function yr(n){return i(n=new this(n),n.e+1,this.rounding)}function pr(n){return n=new this(n),n.d?n.d[0]?n.s:0*n.s:n.s||NaN}function wr(n){return new this(n).sin()}function br(n){return new this(n).sinh()}function kr(n){return new this(n).sqrt()}function dr(n,t){return new this(n).sub(t)}function gr(n){return new this(n).tan()}function nu(n){return new this(n).tanh()}function tu(n){return i(n=new this(n),n.e+1,1)}var ni,ti,b,it=9e15,g=1e9,o="0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ!#$%()*+,-./:;=?@[]^_`{|}~",et="2.3025850929940456840179914546843642076011014886287729760333279009675726096773524802359972050895982983419677840422862486334095254650828067566662873690987816894829072083255546808437998948262331985283935053089653777326288461633662222876982198867465436674744042432743651550489343149393914796194044002221051017141748003688084012647080685567743216228355220114804663715659121373450747856947683463616792101806445070648000277502684916746550586856935673420670581136429224554405758925724208241314695689016758940256776311356919292033376587141660230105703089634572075440370847469940168269282808481184289314848524948644871927809676271275775397027668605952496716674183485704422507197965004714951050492214776567636938662976979522110718264549734772662425709429322582798502585509785265383207606726317164309505995087807523710333101197857547331541421808427543863591778117054309827482385045648019095610299291824318237525357709750539565187697510374970888692180205189339507238539205144634197265287286965110862571492198849978748873771345686209167058",ot="3.1415926535897932384626433832795028841971693993751058209749445923078164062862089986280348253421170679821480865132823066470938446095505822317253594081284811174502841027019385211055596446229489549303819644288109756659334461284756482337867831652712019091456485669234603486104543266482133936072602491412737245870066063155881748815209209628292540917153643678925903600113305305488204665213841469519415116094330572703657595919530921861173819326117931051185480744623799627495673518857527248912279381830119491298336733624406566430860213949463952247371907021798609437027705392171762931767523846748184676694051320005681271452635608277857713427577896091736371787214684409012249534301465495853710507922796892589235420199561121290219608640344181598136297747713099605187072113499999983729780499510597317328160963185950244594553469083026425223082533446850352619311881710100031378387528865875332083814206171776691473035982534904287554687311595628638823537875937519577818577805321712268066130019278766111959092164201989380952572010654858632789",v={precision:20,rounding:4,modulo:1,toExpNeg:-7,toExpPos:21,minE:-it,maxE:it,crypto:void 0},l="undefined"!=typeof crypto?crypto:null,u=!0,st="[DecimalError] ",nt=st+"Invalid argument: ",ii=st+"Precision limit exceeded",s=Math.floor,h=Math.pow,iu=/^0b([01]+(\.[01]*)?|\.[01]+)(p[+-]?\d+)?$/i,ru=/^0x([0-9a-f]+(\.[0-9a-f]*)?|\.[0-9a-f]+)(p[+-]?\d+)?$/i,uu=/^0o([0-7]+(\.[0-7]*)?|\.[0-7]+)(p[+-]?\d+)?$/i,fu=/^(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i,y=1e7,r=7,eu=9007199254740991,ou=et.length-1,lt=ot.length-1,t={},f;if(t.absoluteValue=t.abs=function(){var n=new this.constructor(this);return n.s<0&&(n.s=1),i(n)},t.ceil=function(){return i(new this.constructor(this),this.e+1,2)},t.comparedTo=t.cmp=function(n){var r,h,f,e,o=this,i=o.d,u=(n=new o.constructor(n)).d,t=o.s,s=n.s;if(!i||!u)return t&&s?t!==s?t:i===u?0:!i^0>t?1:-1:NaN;if(!i[0]||!u[0])return i[0]?t:u[0]?-s:0;if(t!==s)return t;if(o.e!==n.e)return o.e>n.e^0>t?1:-1;for(f=i.length,e=u.length,r=0,h=e>f?f:e;h>r;++r)if(i[r]!==u[r])return i[r]>u[r]^0>t?1:-1;return f===e?0:f>e^0>t?1:-1},t.cosine=t.cos=function(){var u,f,t=this,n=t.constructor;return t.d?t.d[0]?(u=n.precision,f=n.rounding,n.precision=u+Math.max(t.e,t.sd())+r,n.rounding=1,t=ri(n,kt(n,t)),n.precision=u,n.rounding=f,i(2==b||3==b?t.neg():t,u,f,!0)):new n(1):new n(NaN)},t.cubeRoot=t.cbrt=function(){var r,w,n,o,v,c,l,h,y,p,t=this,a=t.constructor;if(!t.isFinite()||t.isZero())return new a(t);for(u=!1,c=t.s*Math.pow(t.s*t,1/3),c&&Math.abs(c)!=1/0?o=new a(c.toString()):(n=e(t.d),r=t.e,(c=(r-n.length+1)%3)&&(n+=1==c||-2==c?"0":"00"),c=Math.pow(n,1/3),r=s((r+1)/3)-(r%3==(0>r?-1:2)),c==1/0?n="5e"+r:(n=c.toExponential(),n=n.slice(0,n.indexOf("e")+1)+r),o=new a(n),o.s=t.s),l=(r=a.precision)+3;;)if(h=o,y=h.times(h).times(h),p=y.plus(t),o=f(p.plus(t).times(h),p.plus(y),l+2,1),e(h.d).slice(0,l)===(n=e(o.d)).slice(0,l)){if(n=n.slice(l-3,l+1),"9999"!=n&&(v||"4999"!=n)){+n&&(+n.slice(1)||"5"!=n.charAt(0))||(i(o,r+1,1),w=!o.times(o).times(o).eq(t));break}if(!v&&(i(h,r+1,0),h.times(h).times(h).eq(t))){o=h;break}l+=4;v=1}return u=!0,i(o,r,a.rounding,w)},t.decimalPlaces=t.dp=function(){var n,i=this.d,t=NaN;if(i){if(n=i.length-1,t=(n-s(this.e/r))*r,n=i[n])for(;n%10==0;n/=10)t--;0>t&&(t=0)}return t},t.dividedBy=t.div=function(n){return f(this,new this.constructor(n))},t.dividedToIntegerBy=t.divToInt=function(n){var r=this,t=r.constructor;return i(f(r,new t(n),0,1,1),t.precision,t.rounding)},t.equals=t.eq=function(n){return 0===this.cmp(n)},t.floor=function(){return i(new this.constructor(this),this.e+1,3)},t.greaterThan=t.gt=function(n){return this.cmp(n)>0},t.greaterThanOrEqualTo=t.gte=function(n){var t=this.cmp(n);return 1==t||0===t},t.hyperbolicCosine=t.cosh=function(){var r,u,f,h,e,n=this,t=n.constructor,c=new t(1),o,l,s;if(!n.isFinite())return new t(n.s?1/0:NaN);if(n.isZero())return c;for(f=t.precision,h=t.rounding,t.precision=f+Math.max(n.e,n.sd())+4,t.rounding=1,e=n.d.length,32>e?(r=Math.ceil(e/3),u=Math.pow(4,-r).toString()):(r=16,u="2.3283064365386962890625e-10"),n=tt(t,1,n.times(u),new t(1),!0),l=r,s=new t(8);l--;)o=n.times(n),n=c.minus(o.times(s.minus(o.times(s))));return i(n,t.precision=f,t.rounding=h,!0)},t.hyperbolicSine=t.sinh=function(){var r,u,f,e,n=this,t=n.constructor;if(!n.isFinite()||n.isZero())return new t(n);if(u=t.precision,f=t.rounding,t.precision=u+Math.max(n.e,n.sd())+4,t.rounding=1,e=n.d.length,3>e)n=tt(t,2,n,n,!0);else{r=1.4*Math.sqrt(e);r=r>16?16:0|r;n=n.times(Math.pow(5,-r));n=tt(t,2,n,n,!0);for(var o,s=new t(5),h=new t(16),c=new t(20);r--;)o=n.times(n),n=n.times(s.plus(o.times(h.times(o).plus(c))))}return t.precision=u,t.rounding=f,i(n,u,f,!0)},t.hyperbolicTangent=t.tanh=function(){var i,r,t=this,n=t.constructor;return t.isFinite()?t.isZero()?new n(t):(i=n.precision,r=n.rounding,n.precision=i+7,n.rounding=1,f(t.sinh(),t.cosh(),n.precision=i,n.rounding=r)):new n(t.s)},t.inverseCosine=t.acos=function(){var u,t=this,n=t.constructor,f=t.abs().cmp(1),i=n.precision,r=n.rounding;return-1!==f?0===f?t.isNeg()?a(n,i,r):new n(0):new n(NaN):t.isZero()?a(n,i+4,r).times(.5):(n.precision=i+6,n.rounding=1,t=t.asin(),u=a(n,i+4,r).times(.5),n.precision=i,n.rounding=r,u.minus(t))},t.inverseHyperbolicCosine=t.acosh=function(){var i,r,n=this,t=n.constructor;return n.lte(1)?new t(n.eq(1)?0:NaN):n.isFinite()?(i=t.precision,r=t.rounding,t.precision=i+Math.max(Math.abs(n.e),n.sd())+4,t.rounding=1,u=!1,n=n.times(n).minus(1).sqrt().plus(n),u=!0,t.precision=i,t.rounding=r,n.ln()):new t(n)},t.inverseHyperbolicSine=t.asinh=function(){var i,r,n=this,t=n.constructor;return!n.isFinite()||n.isZero()?new t(n):(i=t.precision,r=t.rounding,t.precision=i+2*Math.max(Math.abs(n.e),n.sd())+6,t.rounding=1,u=!1,n=n.times(n).plus(1).sqrt().plus(n),u=!0,t.precision=i,t.rounding=r,n.ln())},t.inverseHyperbolicTangent=t.atanh=function(){var r,u,o,e,n=this,t=n.constructor;return n.isFinite()?n.e>=0?new t(n.abs().eq(1)?n.s/0:n.isZero()?n:NaN):(r=t.precision,u=t.rounding,e=n.sd(),Math.max(e,r)<2*-n.e-1?i(new t(n),r,u,!0):(t.precision=o=e-n.e,n=f(n.plus(1),new t(1).minus(n),o+r,1),t.precision=r+4,t.rounding=1,n=n.ln(),t.precision=r,t.rounding=u,n.times(.5))):new t(NaN)},t.inverseSine=t.asin=function(){var r,u,i,f,n=this,t=n.constructor;return n.isZero()?new t(n):(u=n.abs().cmp(1),i=t.precision,f=t.rounding,-1!==u?0===u?(r=a(t,i+4,f).times(.5),r.s=n.s,r):new t(NaN):(t.precision=i+6,t.rounding=1,n=n.div(new t(1).minus(n.times(n)).sqrt().plus(1)).atan(),t.precision=i,t.rounding=f,n.times(2)))},t.inverseTangent=t.atan=function(){var e,c,h,l,o,v,t,y,p,n=this,f=n.constructor,s=f.precision,w=f.rounding;if(n.isFinite()){if(n.isZero())return new f(n);if(n.abs().eq(1)&&lt>=s+4)return t=a(f,s+4,w).times(.25),t.s=n.s,t}else{if(!n.s)return new f(NaN);if(lt>=s+4)return t=a(f,s+4,w).times(.5),t.s=n.s,t}for(f.precision=y=s+10,f.rounding=1,h=Math.min(28,y/r+2|0),e=h;e;--e)n=n.div(n.times(n).plus(1).sqrt().plus(1));for(u=!1,c=Math.ceil(y/r),l=1,p=n.times(n),t=new f(n),o=n;-1!==e;)if(o=o.times(p),v=t.minus(o.div(l+=2)),o=o.times(p),t=v.plus(o.div(l+=2)),void 0!==t.d[c])for(e=c;t.d[e]===v.d[e]&&e--;);return h&&(t=t.times(2<<h-1)),u=!0,i(t,f.precision=s,f.rounding=w,!0)},t.isFinite=function(){return!!this.d},t.isInteger=t.isInt=function(){return!!this.d&&s(this.e/r)>this.d.length-2},t.isNaN=function(){return!this.s},t.isNegative=t.isNeg=function(){return this.s<0},t.isPositive=t.isPos=function(){return this.s>0},t.isZero=function(){return!!this.d&&0===this.d[0]},t.lessThan=t.lt=function(n){return this.cmp(n)<0},t.lessThanOrEqualTo=t.lte=function(n){return this.cmp(n)<1},t.logarithm=t.log=function(n){var l,t,a,o,p,v,r,s,c=this,h=c.constructor,y=h.precision,w=h.rounding;if(null==n)n=new h(10),l=!0;else{if(n=new h(n),t=n.d,n.s<0||!t||!t[0]||n.eq(1))return new h(NaN);l=n.eq(10)}if(t=c.d,c.s<0||!t||!t[0]||c.eq(1))return new h(t&&!t[0]?-1/0:1!=c.s?NaN:t?0:1/0);if(l)if(t.length>1)p=!0;else{for(o=t[0];o%10==0;)o/=10;p=1!==o}if(u=!1,r=y+5,v=d(c,r),a=l?ft(h,r+10):d(n,r),s=f(v,a,r,1),rt(s.d,o=y,w))do if(r+=10,v=d(c,r),a=l?ft(h,r+10):d(n,r),s=f(v,a,r,1),!p){+e(s.d).slice(o+1,o+15)+1==1e14&&(s=i(s,y+1,0));break}while(rt(s.d,o+=10,w));return u=!0,i(s,y,w)},t.minus=t.sub=function(n){var l,p,f,w,c,o,k,b,t,d,v,e,h=this,a=h.constructor;if(n=new a(n),!h.d||!n.d)return h.s&&n.s?h.d?n.s=-n.s:n=new a(n.d||h.s!==n.s?h:NaN):n=new a(NaN),n;if(h.s!=n.s)return n.s=-n.s,h.plus(n);if(t=h.d,e=n.d,k=a.precision,b=a.rounding,!t[0]||!e[0]){if(e[0])n.s=-n.s;else{if(!t[0])return new a(3===b?-0:0);n=new a(h)}return u?i(n,k,b):n}if(p=s(n.e/r),d=s(h.e/r),t=t.slice(),c=d-p){for(v=0>c,v?(l=t,c=-c,o=e.length):(l=e,p=d,o=t.length),f=Math.max(Math.ceil(k/r),o)+2,c>f&&(c=f,l.length=1),l.reverse(),f=c;f--;)l.push(0);l.reverse()}else{for(f=t.length,o=e.length,v=o>f,v&&(o=f),f=0;o>f;f++)if(t[f]!=e[f]){v=t[f]<e[f];break}c=0}for(v&&(l=t,t=e,e=l,n.s=-n.s),o=t.length,f=e.length-o;f>0;--f)t[o++]=0;for(f=e.length;f>c;){if(t[--f]<e[f]){for(w=f;w&&0===t[--w];)t[w]=y-1;--t[w];t[f]+=y}t[f]-=e[f]}for(;0===t[--o];)t.pop();for(;0===t[0];t.shift())--p;return t[0]?(n.d=t,n.e=ut(t,p),u?i(n,k,b):n):new a(3===b?-0:0)},t.modulo=t.mod=function(n){var e,t=this,r=t.constructor;return n=new r(n),!t.d||!n.s||n.d&&!n.d[0]?new r(NaN):!n.d||t.d&&!t.d[0]?i(new r(t),r.precision,r.rounding):(u=!1,9==r.modulo?(e=f(t,n.abs(),0,3,1),e.s*=n.s):e=f(t,n,0,r.modulo,1),e=e.times(n),u=!0,t.minus(e))},t.naturalExponential=t.exp=function(){return ht(this)},t.naturalLogarithm=t.ln=function(){return d(this)},t.negated=t.neg=function(){var n=new this.constructor(this);return n.s=-n.s,i(n)},t.plus=t.add=function(n){var v,c,p,f,l,e,w,b,t,h,o=this,a=o.constructor;if(n=new a(n),!o.d||!n.d)return o.s&&n.s?o.d||(n=new a(n.d||o.s===n.s?o:NaN)):n=new a(NaN),n;if(o.s!=n.s)return n.s=-n.s,o.minus(n);if(t=o.d,h=n.d,w=a.precision,b=a.rounding,!t[0]||!h[0])return h[0]||(n=new a(o)),u?i(n,w,b):n;if(l=s(o.e/r),p=s(n.e/r),t=t.slice(),f=l-p){for(0>f?(c=t,f=-f,e=h.length):(c=h,p=l,e=t.length),l=Math.ceil(w/r),e=l>e?l+1:e+1,f>e&&(f=e,c.length=1),c.reverse();f--;)c.push(0);c.reverse()}for(e=t.length,f=h.length,0>e-f&&(f=e,c=h,h=t,t=c),v=0;f;)v=(t[--f]=t[f]+h[f]+v)/y|0,t[f]%=y;for(v&&(t.unshift(v),++p),e=t.length;0==t[--e];)t.pop();return n.d=t,n.e=ut(t,p),u?i(n,w,b):n},t.precision=t.sd=function(n){var t,i=this;if(void 0!==n&&n!==!!n&&1!==n&&0!==n)throw Error(nt+n);return i.d?(t=at(i.d),n&&i.e+1>t&&(t=i.e+1)):t=NaN,t},t.round=function(){var n=this,t=n.constructor;return i(new t(n),n.e+1,t.rounding)},t.sine=t.sin=function(){var u,f,n=this,t=n.constructor;return n.isFinite()?n.isZero()?new t(n):(u=t.precision,f=t.rounding,t.precision=u+Math.max(n.e,n.sd())+r,t.rounding=1,n=fi(t,kt(t,n)),t.precision=u,t.rounding=f,i(b>2?n.neg():n,u,f,!0)):new t(NaN)},t.squareRoot=t.sqrt=function(){var p,n,l,r,y,c,h=this,a=h.d,t=h.e,o=h.s,v=h.constructor;if(1!==o||!a||!a[0])return new v(!o||0>o&&(!a||a[0])?NaN:a?h:1/0);for(u=!1,o=Math.sqrt(+h),0==o||o==1/0?(n=e(a),(n.length+t)%2==0&&(n+="0"),o=Math.sqrt(n),t=s((t+1)/2)-(0>t||t%2),o==1/0?n="1e"+t:(n=o.toExponential(),n=n.slice(0,n.indexOf("e")+1)+t),r=new v(n)):r=new v(o.toString()),l=(t=v.precision)+3;;)if(c=r,r=c.plus(f(h,c,l+2,1)).times(.5),e(c.d).slice(0,l)===(n=e(r.d)).slice(0,l)){if(n=n.slice(l-3,l+1),"9999"!=n&&(y||"4999"!=n)){+n&&(+n.slice(1)||"5"!=n.charAt(0))||(i(r,t+1,1),p=!r.times(r).eq(h));break}if(!y&&(i(c,t+1,0),c.times(c).eq(h))){r=c;break}l+=4;y=1}return u=!0,i(r,t,v.rounding,p)},t.tangent=t.tan=function(){var r,u,n=this,t=n.constructor;return n.isFinite()?n.isZero()?new t(n):(r=t.precision,u=t.rounding,t.precision=r+10,t.rounding=1,n=n.sin(),n.s=1,n=f(n,new t(1).minus(n.times(n)).sqrt(),r+10,0),t.precision=r,t.rounding=u,i(2==b||4==b?n.neg():n,r,u,!0)):new t(NaN)},t.times=t.mul=function(n){var a,b,f,h,t,v,k,c,l,p=this,w=p.constructor,e=p.d,o=(n=new w(n)).d;if(n.s*=p.s,!(e&&e[0]&&o&&o[0]))return new w(!n.s||e&&!e[0]&&!o||o&&!o[0]&&!e?NaN:e&&o?0*n.s:n.s/0);for(b=s(p.e/r)+s(n.e/r),c=e.length,l=o.length,l>c&&(t=e,e=o,o=t,v=c,c=l,l=v),t=[],v=c+l,f=v;f--;)t.push(0);for(f=l;--f>=0;){for(a=0,h=c+f;h>f;)k=t[h]+o[f]*e[h-f-1]+a,t[h--]=k%y|0,a=k/y|0;t[h]=(t[h]+a)%y|0}for(;!t[--v];)t.pop();for(a?++b:t.shift(),f=t.length;!t[--f];)t.pop();return n.d=t,n.e=ut(t,b),u?i(n,w.precision,w.rounding):n},t.toBinary=function(n,t){return ct(this,2,n,t)},t.toDecimalPlaces=t.toDP=function(n,t){var r=this,u=r.constructor;return r=new u(r),void 0===n?r:(c(n,0,g),void 0===t?t=u.rounding:c(t,0,8),i(r,n+r.e+1,t))},t.toExponential=function(n,t){var u,r=this,f=r.constructor;return void 0===n?u=p(r,!0):(c(n,0,g),void 0===t?t=f.rounding:c(t,0,8),r=i(new f(r),n+1,t),u=p(r,!0,n+1)),r.isNeg()&&!r.isZero()?"-"+u:u},t.toFixed=function(n,t){var u,f,r=this,e=r.constructor;return void 0===n?u=p(r):(c(n,0,g),void 0===t?t=e.rounding:c(t,0,8),f=i(new e(r),n+r.e+1,t),u=p(f,!1,n+f.e+1)),r.isNeg()&&!r.isZero()?"-"+u:u},t.toFraction=function(n){var s,a,c,t,y,w,i,v,o,d,b,g,p=this,k=p.d,l=p.constructor;if(!k)return new l(p);if(o=a=new l(1),c=v=new l(0),s=new l(c),y=s.e=at(k)-p.e-1,w=y%r,s.d[0]=h(10,0>w?r+w:w),null==n)n=y>0?s:o;else{if(i=new l(n),!i.isInt()||i.lt(o))throw Error(nt+i);n=i.gt(s)?y>0?s:o:i}for(u=!1,i=new l(e(k)),d=l.precision,l.precision=y=k.length*r*2;b=f(i,s,0,1,1),t=a.plus(b.times(c)),1!=t.cmp(n);)a=c,c=t,t=o,o=v.plus(b.times(t)),v=t,t=s,s=i.minus(b.times(t)),i=t;return t=f(n.minus(a),c,0,1,1),v=v.plus(t.times(o)),a=a.plus(t.times(c)),v.s=o.s=p.s,g=f(o,c,y,1).minus(p).abs().cmp(f(v,a,y,1).minus(p).abs())<1?[o,c]:[v,a],l.precision=d,u=!0,g},t.toHexadecimal=t.toHex=function(n,t){return ct(this,16,n,t)},t.toJSON=function(){var h,n,r,i,c,t,u,l,f=this,s=f.s<0;if(!f.d)return o.charAt(f.s?s?82:83:84);if(n=f.e,1===f.d.length&&4>n&&n>=0&&(t=f.d[0],2857>t))return 41>t?o.charAt(s?t+41:t):(t-=41,s&&(t+=2816),i=t/88|0,o.charAt(i)+o.charAt(t-88*i));if(l=e(f.d),u="",!s&&8>=n&&n>=-7)i=64+n+7;else if(s&&4>=n&&n>=-3)i=80+n+3;else if(l.length===n+1)i=32*s;else if(i=32*s+16*(0>n),n=Math.abs(n),88>n)i+=1,u=o.charAt(n);else if(7744>n)i+=2,t=n/88|0,u=o.charAt(t)+o.charAt(n-88*t);else for(h=w(String(n),10,88),c=h.length,i+=c,r=0;c>r;r++)u+=o.charAt(h[r]);for(u=o.charAt(i)+u,h=w(l,10,88),c=h.length,r=0;c>r;r++)u+=o.charAt(h[r]);return u},t.toNearest=function(n,t){var r=this,e=r.constructor;if(r=new e(r),null==n){if(!r.d)return r;n=new e(1);t=e.rounding}else{if(n=new e(n),void 0!==t&&c(t,0,8),!r.d)return n.s?r:n;if(!n.d)return n.s&&(n.s=r.s),n}return n.d[0]?(u=!1,4>t&&(t=[4,5,7,8][t]),r=f(r,n,0,t,1).times(n),u=!0,i(r)):(n.s=r.s,r=n),r},t.toNumber=function(){return+this},t.toOctal=function(n,t){return ct(this,8,n,t)},t.toPower=t.pow=function(n){var l,a,o,c,v,y,w,t=this,f=t.constructor,p=+(n=new f(n));if(!(t.d&&n.d&&t.d[0]&&n.d[0]))return new f(h(+t,p));if(t=new f(t),t.eq(1))return t;if(o=f.precision,v=f.rounding,n.eq(1))return i(t,o,v);if(l=s(n.e/r),a=n.d.length-1,w=l>=a,y=t.s,w){if((a=0>p?-p:p)<=eu)return c=vt(f,t,a,o),n.s<0?new f(1).div(c):i(c,o,v)}else if(0>y)return new f(NaN);return y=0>y&&1&n.d[Math.max(l,a)]?-1:1,a=h(+t,p),l=0!=a&&isFinite(a)?new f(a+"").e:s(p*(Math.log("0."+e(t.d))/Math.LN10+t.e+1)),l>f.maxE+1||l<f.minE-1?new f(l>0?y/0:0):(u=!1,f.rounding=t.s=1,a=Math.min(12,(l+"").length),c=ht(n.times(d(t,o+a)),o),c=i(c,o+5,1),rt(c.d,o,v)&&(l=o+10,c=i(ht(n.times(d(t,l+a)),l),l+5,1),+e(c.d).slice(o+1,o+15)+1==1e14&&(c=i(c,o+1,0))),c.s=y,u=!0,f.rounding=v,i(c,o,v))},t.toPrecision=function(n,t){var f,r=this,u=r.constructor;return void 0===n?f=p(r,r.e<=u.toExpNeg||r.e>=u.toExpPos):(c(n,1,g),void 0===t?t=u.rounding:c(t,0,8),r=i(new u(r),n,t),f=p(r,n<=r.e||r.e<=u.toExpNeg,n)),r.isNeg()&&!r.isZero()?"-"+f:f},t.toSignificantDigits=t.toSD=function(n,t){var u=this,r=u.constructor;return void 0===n?(n=r.precision,t=r.rounding):(c(n,1,g),void 0===t?t=r.rounding:c(t,0,8)),i(new r(u),n,t)},t.toString=function(){var n=this,t=n.constructor,i=p(n,n.e<=t.toExpNeg||n.e>=t.toExpPos);return n.isNeg()&&!n.isZero()?"-"+i:i},t.truncated=t.trunc=function(){return i(new this.constructor(this),this.e+1,1)},t.valueOf=function(){var n=this,t=n.constructor,i=p(n,n.e<=t.toExpNeg||n.e>=t.toExpPos);return n.isNeg()?"-"+i:i},f=function(){function n(n,t,i){var u,r=0,f=n.length;for(n=n.slice();f--;)u=n[f]*t+r,n[f]=u%i|0,r=u/i|0;return r&&n.unshift(r),n}function t(n,t,i,r){var u,f;if(i!=r)f=i>r?1:-1;else for(u=f=0;i>u;u++)if(n[u]!=t[u]){f=n[u]>t[u]?1:-1;break}return f}function u(n,t,i,r){for(var u=0;i--;)n[i]-=u,u=n[i]<t[i]?1:0,n[i]=u*r+n[i]-t[i];for(;!n[0]&&n.length>1;)n.shift()}return function(f,e,o,h,c,l){var g,et,w,v,it,ot,nt,ft,rt,ut,p,b,ht,tt,vt,ct,st,yt,d,lt,at=f.constructor,pt=f.s==e.s?1:-1,k=f.d,a=e.d;if(!(k&&k[0]&&a&&a[0]))return new at(f.s&&e.s&&(k?!a||k[0]!=a[0]:a)?k&&0==k[0]||!a?0*pt:pt/0:NaN);for(l?(it=1,et=f.e-e.e):(l=y,it=r,et=s(f.e/it)-s(e.e/it)),d=a.length,st=k.length,rt=new at(pt),ut=rt.d=[],w=0;a[w]==(k[w]||0);w++);if(a[w]>(k[w]||0)&&et--,null==o?(tt=o=at.precision,h=at.rounding):tt=c?o+(f.e-e.e)+1:o,0>tt)ut.push(1),ot=!0;else{if(tt=tt/it+2|0,w=0,1==d){for(v=0,a=a[0],tt++;(st>w||v)&&tt--;w++)vt=v*l+(k[w]||0),ut[w]=vt/a|0,v=vt%a|0;ot=v||st>w}else{for(v=l/(a[0]+1)|0,v>1&&(a=n(a,v,l),k=n(k,v,l),d=a.length,st=k.length),ct=d,p=k.slice(0,d),b=p.length;d>b;)p[b++]=0;lt=a.slice();lt.unshift(0);yt=a[0];a[1]>=l/2&&++yt;do v=0,g=t(a,p,d,b),0>g?(ht=p[0],d!=b&&(ht=ht*l+(p[1]||0)),v=ht/yt|0,v>1?(v>=l&&(v=l-1),nt=n(a,v,l),ft=nt.length,b=p.length,g=t(nt,p,ft,b),1==g&&(v--,u(nt,ft>d?lt:a,ft,l))):(0==v&&(g=v=1),nt=a.slice()),ft=nt.length,b>ft&&nt.unshift(0),u(p,nt,b,l),-1==g&&(b=p.length,g=t(a,p,d,b),1>g&&(v++,u(p,b>d?lt:a,b,l))),b=p.length):0===g&&(v++,p=[0]),ut[w++]=v,g&&p[0]?p[b++]=k[ct]||0:(p=[k[ct]],b=1);while((ct++<st||void 0!==p[0])&&tt--);ot=void 0!==p[0]}ut[0]||ut.shift()}if(1==it)rt.e=et,ni=ot;else{for(w=1,v=ut[0];v>=10;v/=10)w++;rt.e=w+et*it-1;i(rt,c?o+rt.e+1:o,h,ot)}return rt}}(),v=gt(v),et=new v(et),ot=new v(ot),Bridge.$Decimal=v,"function"==typeof define&&define.amd)define(function(){return v});else if("undefined"!=typeof module&&module.exports){if(module.exports=v,!l)try{l=require("crypto")}catch(su){}}else n||(n="undefined"!=typeof self&&self&&self.self==self?self:Function("return this")()),ti=n.Decimal,v.noConflict=function(){return n.Decimal=ti,v},n.Decimal=v}(Bridge.global);System.Decimal=function(n,t,i){var r;if(this.constructor!==System.Decimal)return new System.Decimal(n,t,i);if(n==null&&(n=0),typeof n=="string"){if(t=t||System.Globalization.CultureInfo.getCurrentCulture(),r=t&&t.getFormat(System.Globalization.NumberFormatInfo),r&&r.numberDecimalSeparator!=="."&&(n=n.replace(r.numberDecimalSeparator,".")),!/^\s*[+-]?(\d+|\d+.|\d*\.\d+)((e|E)[+-]?\d+)?\s*$/.test(n))throw new System.FormatException;n=n.replace(/\s/g,"")}if(i&&i.precision&&typeof n=="number"){var f=Bridge.Int.trunc(n),e=(f+"").length,u=i.precision-e;u<0&&(u=0);n=n.toFixed(u)}this.value=System.Decimal.getValue(n)};System.Decimal.$$name="System.Decimal";System.Decimal.prototype.$$name="System.Decimal";System.Decimal.$kind="struct";System.Decimal.prototype.$kind="struct";System.Decimal.$$inherits=[];Bridge.Class.addExtend(System.Decimal,[System.IComparable,System.IFormattable,System.IComparable$1(System.Decimal),System.IEquatable$1(System.Decimal)]);System.Decimal.$is=function(n){return n instanceof System.Decimal};System.Decimal.getDefaultValue=function(){return new System.Decimal(0)};System.Decimal.getValue=function(n){return Bridge.hasValue(n)?n instanceof System.Decimal?n.value:n instanceof System.Int64||n instanceof System.UInt64?new Bridge.$Decimal(n.toString()):new Bridge.$Decimal(n):this.getDefaultValue()};System.Decimal.create=function(n){return Bridge.hasValue(n)?n instanceof System.Decimal?n:new System.Decimal(n):null};System.Decimal.lift=function(n){return n==null?null:System.Decimal.create(n)};System.Decimal.prototype.toString=function(n,t){return!n&&!t?this.value.toString():Bridge.Int.format(this,n,t)};System.Decimal.prototype.toFloat=function(){return this.value.toNumber()};System.Decimal.prototype.toJSON=function(){return this.value.toNumber()};System.Decimal.prototype.format=function(n,t){return Bridge.Int.format(this.toFloat(),n,t)};System.Decimal.prototype.decimalPlaces=function(){return this.value.decimalPlaces()};System.Decimal.prototype.dividedToIntegerBy=function(n){return new System.Decimal(this.value.dividedToIntegerBy(System.Decimal.getValue(n)))};System.Decimal.prototype.exponential=function(){return new System.Decimal(this.value.exponential())};System.Decimal.prototype.abs=function(){return new System.Decimal(this.value.abs())};System.Decimal.prototype.floor=function(){return new System.Decimal(this.value.floor())};System.Decimal.prototype.ceil=function(){return new System.Decimal(this.value.ceil())};System.Decimal.prototype.trunc=function(){return new System.Decimal(this.value.trunc())};System.Decimal.round=function(n,t){var i,r;return n=System.Decimal.create(n),i=Bridge.$Decimal.rounding,Bridge.$Decimal.rounding=t,r=new System.Decimal(n.value.round()),Bridge.$Decimal.rounding=i,r};System.Decimal.toDecimalPlaces=function(n,t,i){n=System.Decimal.create(n);return new System.Decimal(n.value.toDecimalPlaces(t,i))};System.Decimal.prototype.compareTo=function(n){return this.value.comparedTo(System.Decimal.getValue(n))};System.Decimal.prototype.add=function(n){return new System.Decimal(this.value.plus(System.Decimal.getValue(n)))};System.Decimal.prototype.sub=function(n){return new System.Decimal(this.value.minus(System.Decimal.getValue(n)))};System.Decimal.prototype.isZero=function(){return this.value.isZero};System.Decimal.prototype.mul=function(n){return new System.Decimal(this.value.times(System.Decimal.getValue(n)))};System.Decimal.prototype.div=function(n){return new System.Decimal(this.value.dividedBy(System.Decimal.getValue(n)))};System.Decimal.prototype.mod=function(n){return new System.Decimal(this.value.modulo(System.Decimal.getValue(n)))};System.Decimal.prototype.neg=function(){return new System.Decimal(this.value.negated())};System.Decimal.prototype.inc=function(){return new System.Decimal(this.value.plus(System.Decimal.getValue(1)))};System.Decimal.prototype.dec=function(){return new System.Decimal(this.value.minus(System.Decimal.getValue(1)))};System.Decimal.prototype.sign=function(){return this.value.isZero()?0:this.value.isNegative()?-1:1};System.Decimal.prototype.clone=function(){return new System.Decimal(this)};System.Decimal.prototype.ne=function(n){return!!this.compareTo(n)};System.Decimal.prototype.lt=function(n){return this.compareTo(n)<0};System.Decimal.prototype.lte=function(n){return this.compareTo(n)<=0};System.Decimal.prototype.gt=function(n){return this.compareTo(n)>0};System.Decimal.prototype.gte=function(n){return this.compareTo(n)>=0};System.Decimal.prototype.equals=function(n){return!this.compareTo(n)};System.Decimal.prototype.equalsT=function(n){return!this.compareTo(n)};System.Decimal.prototype.getHashCode=function(){for(var n=this.sign()*397+this.value.e|0,t=0;t<this.value.d.length;t++)n=n*397+this.value.d[t]|0;return n};System.Decimal.toInt=function(n,t){var i,r,u;if(!n)return null;if(t){if(t===System.Int64){if(i=n.value.trunc().toString(),r=new System.Int64(i),i!==r.value.toString())throw new System.OverflowException;return r}if(t===System.UInt64){if(n.value.isNegative())throw new System.OverflowException;if(i=n.value.trunc().toString(),r=new System.UInt64(i),i!==r.value.toString())throw new System.OverflowException;return r}return Bridge.Int.check(Bridge.Int.trunc(n.value.toNumber()),t)}if(u=Bridge.Int.trunc(System.Decimal.getValue(n).toNumber()),!Bridge.Int.$is(u))throw new System.OverflowException;return u};System.Decimal.tryParse=function(n,t,i){try{return i.v=new System.Decimal(n,t),!0}catch(r){return i.v=new System.Decimal(0),!1}};System.Decimal.toFloat=function(n){return n?System.Decimal.getValue(n).toNumber():null};System.Decimal.setConfig=function(n){Bridge.$Decimal.config(n)};System.Decimal.min=function(){for(var t=[],n=0,i=arguments.length;n<i;n++)t.push(System.Decimal.getValue(arguments[n]));return new System.Decimal(Bridge.$Decimal.min.apply(Bridge.$Decimal,t))};System.Decimal.max=function(){for(var t=[],n=0,i=arguments.length;n<i;n++)t.push(System.Decimal.getValue(arguments[n]));return new System.Decimal(Bridge.$Decimal.max.apply(Bridge.$Decimal,t))};System.Decimal.random=function(n){return new System.Decimal(Bridge.$Decimal.random(n))};System.Decimal.exp=function(n){return new System.Decimal(System.Decimal.getValue(n).exp())};System.Decimal.exp=function(n){return new System.Decimal(System.Decimal.getValue(n).exp())};System.Decimal.ln=function(n){return new System.Decimal(System.Decimal.getValue(n).ln())};System.Decimal.log=function(n,t){return new System.Decimal(System.Decimal.getValue(n).log(t))};System.Decimal.pow=function(n,t){return new System.Decimal(System.Decimal.getValue(n).pow(t))};System.Decimal.sqrt=function(n){return new System.Decimal(System.Decimal.getValue(n).sqrt())};System.Decimal.prototype.isFinite=function(){return this.value.isFinite()};System.Decimal.prototype.isInteger=function(){return this.value.isInteger()};System.Decimal.prototype.isNaN=function(){return this.value.isNaN()};System.Decimal.prototype.isNegative=function(){return this.value.isNegative()};System.Decimal.prototype.isZero=function(){return this.value.isZero()};System.Decimal.prototype.log=function(n){return new System.Decimal(this.value.log(n))};System.Decimal.prototype.ln=function(){return new System.Decimal(this.value.ln())};System.Decimal.prototype.precision=function(){return this.value.precision()};System.Decimal.prototype.round=function(){var t=Bridge.$Decimal.rounding,n;return Bridge.$Decimal.rounding=6,n=new System.Decimal(this.value.round()),Bridge.$Decimal.rounding=t,n};System.Decimal.prototype.sqrt=function(){return new System.Decimal(this.value.sqrt())};System.Decimal.prototype.toDecimalPlaces=function(n,t){return new System.Decimal(this.value.toDecimalPlaces(n,t))};System.Decimal.prototype.toExponential=function(n,t){return this.value.toExponential(n,t)};System.Decimal.prototype.toFixed=function(n,t){return this.value.toFixed(n,t)};System.Decimal.prototype.pow=function(n){return new System.Decimal(this.value.pow(n))};System.Decimal.prototype.toPrecision=function(n,t){return this.value.toPrecision(n,t)};System.Decimal.prototype.toSignificantDigits=function(n,t){return new System.Decimal(this.value.toSignificantDigits(n,t))};System.Decimal.prototype.valueOf=function(){return this.value.valueOf()};System.Decimal.prototype.toFormat=function(n,t,i){var f=Bridge.$Decimal.format,u,e,r;return i&&!i.getFormat?(e=Bridge.merge({},f||{}),Bridge.$Decimal.format=Bridge.merge(e,i),u=this.value.toFormat(n,t)):(i=i||System.Globalization.CultureInfo.getCurrentCulture(),r=i&&i.getFormat(System.Globalization.NumberFormatInfo),r&&(Bridge.$Decimal.format.decimalSeparator=r.numberDecimalSeparator,Bridge.$Decimal.format.groupSeparator=r.numberGroupSeparator,Bridge.$Decimal.format.groupSize=r.numberGroupSizes[0]),u=this.value.toFormat(n,t)),Bridge.$Decimal.format=f,u};Bridge.$Decimal.config({precision:29});System.Decimal.Zero=System.Decimal(0);System.Decimal.One=System.Decimal(1);System.Decimal.MinusOne=System.Decimal(-1);System.Decimal.MinValue=System.Decimal("-79228162514264337593543950335");System.Decimal.MaxValue=System.Decimal("79228162514264337593543950335");System.Decimal.precision=29;Bridge.define("System.DayOfWeek",{$kind:"enum",$statics:{Sunday:0,Monday:1,Tuesday:2,Wednesday:3,Thursday:4,Friday:5,Saturday:6}});pt={getDefaultValue:function(){return new Date(-864e13)},utcNow:function(){var n=new Date;return new Date(n.getUTCFullYear(),n.getUTCMonth(),n.getUTCDate(),n.getUTCHours(),n.getUTCMinutes(),n.getUTCSeconds(),n.getUTCMilliseconds())},today:function(){var n=new Date;return new Date(n.getFullYear(),n.getMonth(),n.getDate())},timeOfDay:function(n){return new System.TimeSpan((n-new Date(n.getFullYear(),n.getMonth(),n.getDate()))*1e4)},isUseGenitiveForm:function(n,t,i,r){for(var f=0,u=t-1;u>=0&&n[u]!==r;u--);if(u>=0){while(--u>=0&&n[u]===r)f++;if(f<=1)return!0}for(u=t+i;u<n.length&&n[u]!==r;u++);if(u<n.length){for(f=0;++u<n.length&&n[u]===r;)f++;if(f<=1)return!0}return!1},format:function(n,t,i){var c=this,r=(i||System.Globalization.CultureInfo.getCurrentCulture()).getFormat(System.Globalization.DateTimeFormatInfo),o=n.getFullYear(),u=n.getMonth(),f=n.getDate(),l=n.getDay(),e=n.getHours(),a=n.getMinutes(),v=n.getSeconds(),y=n.getMilliseconds(),s=n.getTimezoneOffset(),h;return t=t||"G",t.length===1?(h=r.getAllDateTimePatterns(t,!0),t=h?h[0]:t):t.length===2&&t.charAt(0)==="%"&&(t=t.charAt(1)),t.replace(/(\\.|'[^']*'|"[^"]*"|d{1,4}|M{1,4}|yyyy|yy|y|HH?|hh?|mm?|ss?|tt?|f{1,3}|z{1,3}|\:|\/)/g,function(n,i,h){var p=n;switch(n){case"dddd":p=r.dayNames[l];break;case"ddd":p=r.abbreviatedDayNames[l];break;case"dd":p=f<10?"0"+f:f;break;case"d":p=f;break;case"MMMM":p=c.isUseGenitiveForm(t,h,4,"d")?r.monthGenitiveNames[u]:r.monthNames[u];break;case"MMM":p=c.isUseGenitiveForm(t,h,3,"d")?r.abbreviatedMonthGenitiveNames[u]:r.abbreviatedMonthNames[u];break;case"MM":p=u+1<10?"0"+(u+1):u+1;break;case"M":p=u+1;break;case"yyyy":p=o;break;case"yy":p=(o%100).toString();p.length===1&&(p="0"+p);break;case"y":p=o%100;break;case"h":case"hh":p=e%12;p?n==="hh"&&p.length===1&&(p="0"+p):p="12";break;case"HH":p=e.toString();p.length===1&&(p="0"+p);break;case"H":p=e;break;case"mm":p=a.toString();p.length===1&&(p="0"+p);break;case"m":p=a;break;case"ss":p=v.toString();p.length===1&&(p="0"+p);break;case"s":p=v;break;case"t":case"tt":p=e<12?r.amDesignator:r.pmDesignator;n==="t"&&(p=p.charAt(0));break;case"f":case"ff":case"fff":p=y.toString();p.length<3&&(p=Array(3-p.length).join("0")+p);n==="ff"?p=p.substr(0,2):n==="f"&&(p=p.charAt(0));break;case"z":p=s/60;p=(p>=0?"-":"+")+Math.floor(Math.abs(p));break;case"zz":case"zzz":p=s/60;p=(p>=0?"-":"+")+System.String.alignString(Math.floor(Math.abs(p)).toString(),2,"0",2);n==="zzz"&&(p+=r.timeSeparator+System.String.alignString(Math.floor(Math.abs(s%60)).toString(),2,"0",2));break;case":":p=r.timeSeparator;break;case"/":p=r.dateSeparator;break;default:p=n.substr(1,n.length-1-(n.charAt(0)!=="\\"))}return p})},parse:function(n,t,i,r){var u=this.parseExact(n,null,t,i,!0);if(u!==null)return u;if(u=Date.parse(n),isNaN(u)){if(!r)throw new System.FormatException("String does not contain a valid string representation of a date and time.");}else return new Date(u)},parseExact:function(n,t,i,r,u){var ft,ct;if(t||(t=["G","g","F","f","D","d","R","r","s","S","U","u","O","o","Y","y","M","m","T","t"]),Bridge.isArray(t)){for(ft=0,ft;ft<t.length;ft++)if(ct=Bridge.Date.parseExact(n,t[ft],i,r,!0),ct!=null)return ct;if(u)return null;throw new System.FormatException("String does not contain a valid string representation of a date and time.");}var y=(i||System.Globalization.CultureInfo.getCurrentCulture()).getFormat(System.Globalization.DateTimeFormatInfo),et=y.amDesignator,ot=y.pmDesignator,e=0,k=0,b=0,st,f,c=0,l=1,w=1,h=0,d=0,g=0,v=0,nt="",a=0,ht=0,tt,it,rt,ut,s,o=!1,p=!1,lt,at;if(n==null)throw new System.ArgumentNullException("str");for(t=t||"G",t.length===1?(at=y.getAllDateTimePatterns(t,!0),t=at?at[0]:t):t.length===2&&t.charAt(0)==="%"&&(t=t.charAt(1));k<t.length;){if(st=t.charAt(k),f="",p==="\\")f+=st,k++;else while(t.charAt(k)===st&&k<t.length)f+=st,k++;if(lt=!0,!p)if(f==="yyyy"||f==="yy"||f==="y"){if(f==="yyyy"?c=this.subparseInt(n,e,4,4):f==="yy"?c=this.subparseInt(n,e,2,2):f==="y"&&(c=this.subparseInt(n,e,2,4)),c==null){o=!0;break}e+=c.length;c.length===2&&(c=~~c,c=(c>30?1900:2e3)+c)}else if(f==="MMM"||f==="MMMM"){for(l=0,ut=f==="MMM"?this.isUseGenitiveForm(t,k,3,"d")?y.abbreviatedMonthGenitiveNames:y.abbreviatedMonthNames:this.isUseGenitiveForm(t,k,4,"d")?y.monthGenitiveNames:y.monthNames,b=0;b<ut.length;b++)if(s=ut[b],n.substring(e,e+s.length).toLowerCase()===s.toLowerCase()){l=b%12+1;e+=s.length;break}if(l<1||l>12){o=!0;break}}else if(f==="MM"||f==="M"){if(l=this.subparseInt(n,e,f.length,2),l==null||l<1||l>12){o=!0;break}e+=l.length}else if(f==="dddd"||f==="ddd"){for(ut=f==="ddd"?y.abbreviatedDayNames:y.dayNames,b=0;b<ut.length;b++)if(s=ut[b],n.substring(e,e+s.length).toLowerCase()===s.toLowerCase()){e+=s.length;break}}else if(f==="dd"||f==="d"){if(w=this.subparseInt(n,e,f.length,2),w==null||w<1||w>31){o=!0;break}e+=w.length}else if(f==="hh"||f==="h"){if(h=this.subparseInt(n,e,f.length,2),h==null||h<1||h>12){o=!0;break}e+=h.length}else if(f==="HH"||f==="H"){if(h=this.subparseInt(n,e,f.length,2),h==null||h<0||h>23){o=!0;break}e+=h.length}else if(f==="mm"||f==="m"){if(d=this.subparseInt(n,e,f.length,2),d==null||d<0||d>59)return null;e+=d.length}else if(f==="ss"||f==="s"){if(g=this.subparseInt(n,e,f.length,2),g==null||g<0||g>59){o=!0;break}e+=g.length}else if(f==="u"){if(v=this.subparseInt(n,e,1,7),v==null){o=!0;break}e+=v.length;v.length>3&&(v=v.substring(0,3))}else if(f==="fffffff"||f==="ffffff"||f==="fffff"||f==="ffff"||f==="fff"||f==="ff"||f==="f"){if(v=this.subparseInt(n,e,f.length,7),v==null){o=!0;break}e+=v.length;v.length>3&&(v=v.substring(0,3))}else if(f==="t"){if(n.substring(e,e+1).toLowerCase()===et.charAt(0).toLowerCase())nt=et;else if(n.substring(e,e+1).toLowerCase()===ot.charAt(0).toLowerCase())nt=ot;else{o=!0;break}e+=1}else if(f==="tt"){if(n.substring(e,e+2).toLowerCase()===et.toLowerCase())nt=et;else if(n.substring(e,e+2).toLowerCase()===ot.toLowerCase())nt=ot;else{o=!0;break}e+=2}else if(f==="z"||f==="zz"){if(it=n.charAt(e),it==="-")rt=!0;else if(it==="+")rt=!1;else{o=!0;break}if(e++,a=this.subparseInt(n,e,1,2),a==null||a>14){o=!0;break}e+=a.length;rt&&(a=-a)}else if(f==="zzz"){if(s=n.substring(e,e+6),e+=6,s.length!==6){o=!0;break}if(it=s.charAt(0),it==="-")rt=!0;else if(it==="+")rt=!1;else{o=!0;break}if(tt=1,a=this.subparseInt(s,tt,1,2),a==null||a>14){o=!0;break}if(tt+=a.length,rt&&(a=-a),s.charAt(tt)!==y.timeSeparator){o=!0;break}if(tt++,ht=this.subparseInt(s,tt,1,2),ht==null||a>59){o=!0;break}}else lt=!1;if(p||!lt){if(s=n.substring(e,e+f.length),!p&&(f===":"&&s!==y.timeSeparator||f==="/"&&s!==y.dateSeparator)||s!==f&&f!=="'"&&f!=='"'&&f!=="\\"){o=!0;break}if(p==="\\"&&(p=!1),f!=="'"&&f!=='"'&&f!=="\\")e+=f.length;else if(p===!1)p=f;else{if(p!==f){o=!0;break}p=!1}}}if(p&&(o=!0),o||(e!==n.length?o=!0:l===2?c%4==0&&c%100!=0||c%400==0?w>29&&(o=!0):w>28&&(o=!0):(l===4||l===6||l===9||l===11)&&w>30&&(o=!0)),o){if(u)return null;throw new System.FormatException("String does not contain a valid string representation of a date and time.");}return(h<12&&nt===ot?h=+h+12:h>11&&nt===et&&(h-=12),a===0&&ht===0&&!r)?new Date(c,l-1,w,h,d,g,v):new Date(Date.UTC(c,l-1,w,h-a,d-ht,g,v))},subparseInt:function(n,t,i,r){for(var f,u=r;u>=i;u--){if(f=n.substring(t,t+u),f.length<i)return null;if(/^\d+$/.test(f))return f}return null},tryParse:function(n,t,i,r){return(i.v=this.parse(n,t,r,!0),i.v==null)?(i.v=new Date(-864e13),!1):!0},tryParseExact:function(n,t,i,r,u){return(r.v=this.parseExact(n,t,i,u,!0),r.v==null)?(r.v=new Date(-864e13),!1):!0},isDaylightSavingTime:function(n){var t=Bridge.Date.today();return t.setMonth(0),t.setDate(1),t.getTimezoneOffset()!==n.getTimezoneOffset()},toUTC:function(n){return new Date(n.getUTCFullYear(),n.getUTCMonth(),n.getUTCDate(),n.getUTCHours(),n.getUTCMinutes(),n.getUTCSeconds(),n.getUTCMilliseconds())},toLocal:function(n){return new Date(Date.UTC(n.getFullYear(),n.getMonth(),n.getDate(),n.getHours(),n.getMinutes(),n.getSeconds(),n.getMilliseconds()))},dateAddSubTimespan:function(n,t,i){var r=new Date(n.getTime());return r.setDate(r.getDate()+i*t.getDays()),r.setHours(r.getHours()+i*t.getHours()),r.setMinutes(r.getMinutes()+i*t.getMinutes()),r.setSeconds(r.getSeconds()+i*t.getSeconds()),r.setMilliseconds(r.getMilliseconds()+i*t.getMilliseconds()),r},subdt:function(n,t){return Bridge.hasValue$1(n,t)?this.dateAddSubTimespan(n,t,-1):null},adddt:function(n,t){return Bridge.hasValue$1(n,t)?this.dateAddSubTimespan(n,t,1):null},subdd:function(n,t){return Bridge.hasValue$1(n,t)?new System.TimeSpan((n-t)*1e4):null},gt:function(n,t){return Bridge.hasValue$1(n,t)?n>t:!1},gte:function(n,t){return Bridge.hasValue$1(n,t)?n>=t:!1},lt:function(n,t){return Bridge.hasValue$1(n,t)?n<t:!1},lte:function(n,t){return Bridge.hasValue$1(n,t)?n<=t:!1}};Bridge.Date=pt;Bridge.define("System.TimeSpan",{inherits:[System.IComparable],config:{alias:["compareTo","System$IComparable$compareTo"]},$kind:"struct",statics:{fromDays:function(n){return new System.TimeSpan(n*864e9)},fromHours:function(n){return new System.TimeSpan(n*36e9)},fromMilliseconds:function(n){return new System.TimeSpan(n*1e4)},fromMinutes:function(n){return new System.TimeSpan(n*6e8)},fromSeconds:function(n){return new System.TimeSpan(n*1e7)},fromTicks:function(n){return new System.TimeSpan(n)},ctor:function(){this.zero=new System.TimeSpan(System.Int64.Zero);this.maxValue=new System.TimeSpan(System.Int64.MaxValue);this.minValue=new System.TimeSpan(System.Int64.MinValue)},getDefaultValue:function(){return new System.TimeSpan(System.Int64.Zero)},neg:function(n){return Bridge.hasValue(n)?new System.TimeSpan(n.ticks.neg()):null},sub:function(n,t){return Bridge.hasValue$1(n,t)?new System.TimeSpan(n.ticks.sub(t.ticks)):null},eq:function(n,t){return Bridge.hasValue$1(n,t)?n.ticks.eq(t.ticks):null},neq:function(n,t){return Bridge.hasValue$1(n,t)?n.ticks.ne(t.ticks):null},plus:function(n){return Bridge.hasValue(n)?new System.TimeSpan(n.ticks):null},add:function(n,t){return Bridge.hasValue$1(n,t)?new System.TimeSpan(n.ticks.add(t.ticks)):null},gt:function(n,t){return Bridge.hasValue$1(n,t)?n.ticks.gt(t.ticks):!1},gte:function(n,t){return Bridge.hasValue$1(n,t)?n.ticks.gte(t.ticks):!1},lt:function(n,t){return Bridge.hasValue$1(n,t)?n.ticks.lt(t.ticks):!1},lte:function(n,t){return Bridge.hasValue$1(n,t)?n.ticks.lte(t.ticks):!1}},ctor:function(){this.$initialize();this.ticks=System.Int64.Zero;arguments.length===1?this.ticks=arguments[0]instanceof System.Int64?arguments[0]:new System.Int64(arguments[0]):arguments.length===3?this.ticks=new System.Int64(arguments[0]).mul(60).add(arguments[1]).mul(60).add(arguments[2]).mul(1e7):arguments.length===4?this.ticks=new System.Int64(arguments[0]).mul(24).add(arguments[1]).mul(60).add(arguments[2]).mul(60).add(arguments[3]).mul(1e7):arguments.length===5&&(this.ticks=new System.Int64(arguments[0]).mul(24).add(arguments[1]).mul(60).add(arguments[2]).mul(60).add(arguments[3]).mul(1e3).add(arguments[4]).mul(1e4))},getTicks:function(){return this.ticks},getDays:function(){return this.ticks.div(864e9).toNumber()},getHours:function(){return this.ticks.div(36e9).mod(24).toNumber()},getMilliseconds:function(){return this.ticks.div(1e4).mod(1e3).toNumber()},getMinutes:function(){return this.ticks.div(6e8).mod(60).toNumber()},getSeconds:function(){return this.ticks.div(1e7).mod(60).toNumber()},getTotalDays:function(){return this.ticks.toNumberDivided(864e9)},getTotalHours:function(){return this.ticks.toNumberDivided(36e9)},getTotalMilliseconds:function(){return this.ticks.toNumberDivided(1e4)},getTotalMinutes:function(){return this.ticks.toNumberDivided(6e8)},getTotalSeconds:function(){return this.ticks.toNumberDivided(1e7)},get12HourHour:function(){return this.getHours()>12?this.getHours()-12:this.getHours()===0?12:this.getHours()},add:function(n){return new System.TimeSpan(this.ticks.add(n.ticks))},subtract:function(n){return new System.TimeSpan(this.ticks.sub(n.ticks))},duration:function(){return new System.TimeSpan(this.ticks.abs())},negate:function(){return new System.TimeSpan(this.ticks.neg())},compareTo:function(n){return this.ticks.compareTo(n.ticks)},equals:function(n){return n.ticks.eq(this.ticks)},equalsT:function(n){return n.ticks.eq(this.ticks)},format:function(n,t){return this.toString(n,t)},getHashCode:function(){return this.ticks.getHashCode()},toString:function(n,t){var i=this.ticks,f="",r=this,e=(t||System.Globalization.CultureInfo.getCurrentCulture()).getFormat(System.Globalization.DateTimeFormatInfo),u=function(n,t,i,r){return System.String.alignString((n|0).toString(),t||2,"0",i||2,r||!1)};return n?n.replace(/(\\.|'[^']*'|"[^"]*"|dd?|HH?|hh?|mm?|ss?|tt?|f{1,7}|\:|\/)/g,function(n){var t=n;switch(n){case"d":return r.getDays();case"dd":return u(r.getDays());case"H":return r.getHours();case"HH":return u(r.getHours());case"h":return r.get12HourHour();case"hh":return u(r.get12HourHour());case"m":return r.getMinutes();case"mm":return u(r.getMinutes());case"s":return r.getSeconds();case"ss":return u(r.getSeconds());case"t":return(r.getHours()<12?e.amDesignator:e.pmDesignator).substring(0,1);case"tt":return r.getHours()<12?e.amDesignator:e.pmDesignator;case"f":case"ff":case"fff":case"ffff":case"fffff":case"ffffff":case"fffffff":return u(r.getMilliseconds(),n.length,1,!0);default:return n.substr(1,n.length-1-(n.charAt(0)!=="\\"))}}):(i.abs().gte(864e9)&&(f+=u(i.toNumberDivided(864e9))+".",i=i.mod(864e9)),f+=u(i.toNumberDivided(36e9))+":",i=i.mod(36e9),f+=u(i.toNumberDivided(6e8)|0)+":",i=i.mod(6e8),f+=u(i.toNumberDivided(1e7)),i=i.mod(1e7),i.gt(0)&&(f+="."+u(i.toNumber(),7)),f)}});Bridge.Class.addExtend(System.TimeSpan,[System.IComparable$1(System.TimeSpan),System.IEquatable$1(System.TimeSpan)]);Bridge.define("System.Text.StringBuilder",{ctor:function(){this.$initialize();this.buffer=[];this.capacity=16;arguments.length===1?this.append(arguments[0]):arguments.length===2?(this.append(arguments[0]),this.setCapacity(arguments[1])):arguments.length===3&&this.append(arguments[0],arguments[1],arguments[2])},getLength:function(){if(this.buffer.length<2)return this.buffer[0]?this.buffer[0].length:0;var n=this.buffer.join("");return this.buffer=[],this.buffer[0]=n,n.length},getCapacity:function(){var n=this.getLength();return this.capacity>n?this.capacity:n},setCapacity:function(n){var t=this.getLength();n>t&&(this.capacity=n)},toString:function(){var n=this.buffer.join(""),t,i;return(this.buffer=[],this.buffer[0]=n,arguments.length===2)?(t=arguments[0],i=arguments[1],this.checkLimits(n,t,i),n.substr(t,i)):n},append:function(n){var i,t;if(n==null)return this;if(arguments.length===2){if(t=arguments[1],t===0)return this;if(t<0)throw new System.ArgumentOutOfRangeException("count","cannot be less than zero");n=Array(t+1).join(n).toString()}else if(arguments.length===3){if(i=arguments[1],t=arguments[2],t===0)return this;this.checkLimits(n,i,t);n=n.substr(i,t)}return this.buffer[this.buffer.length]=n,this},appendFormat:function(){return this.append(System.String.format.apply(System.String,arguments))},clear:function(){return this.buffer=[],this},appendLine:function(){return arguments.length===1&&this.append(arguments[0]),this.append("\r\n")},equals:function(n){return n==null?!1:n===this?!0:this.toString()===n.toString()},remove:function(n,t){var i=this.buffer.join("");return(this.checkLimits(i,n,t),i.length===t&&n===0)?this.clear():(t>0&&(this.buffer=[],this.buffer[0]=i.substring(0,n),this.buffer[1]=i.substring(n+t,i.length)),this)},insert:function(n,t){var r,i;if(t==null)return this;if(arguments.length===3){if(r=arguments[2],r===0)return this;if(r<0)throw new System.ArgumentOutOfRangeException("count","cannot be less than zero");t=Array(r+1).join(t).toString()}return i=this.buffer.join(""),this.buffer=[],n<1?(this.buffer[0]=t,this.buffer[1]=i):n>=i.length?(this.buffer[0]=i,this.buffer[1]=t):(this.buffer[0]=i.substring(0,n),this.buffer[1]=t,this.buffer[2]=i.substring(n,i.length)),this},replace:function(n,t){var f=new RegExp(n,"g"),i=this.buffer.join("");if(this.buffer=[],arguments.length===4){var r=arguments[2],u=arguments[3],e=i.substr(r,u);this.checkLimits(i,r,u);this.buffer[0]=i.substring(0,r);this.buffer[1]=e.replace(f,t);this.buffer[2]=i.substring(r+u,i.length)}else this.buffer[0]=i.replace(f,t);return this},checkLimits:function(n,t,i){if(i<0)throw new System.ArgumentOutOfRangeException("length","must be non-negative");if(t<0)throw new System.ArgumentOutOfRangeException("startIndex","startIndex cannot be less than zero");if(i>n.length-t)throw new System.ArgumentOutOfRangeException("Index and length must refer to a location within the string");}}),function(){var n=RegExp("[-\\[\\]\\/\\{\\}\\(\\)\\*\\+\\?\\.\\\\\\^\\$\\|]","g"),t=function(t){return t.replace(n,"\\$&")};Bridge.regexpEscape=t}();System.Diagnostics.Debug={writeln:function(n){Bridge.Console.debug(n)},_fail:function(n){System.Diagnostics.Debug.writeln(n)},assert:function(n,t){n||(t="Assert failed: "+t,confirm(t+"\r\n\r\nBreak into debugger?")&&System.Diagnostics.Debug._fail(t))},fail:function(n){System.Diagnostics.Debug._fail(n)}};Bridge.define("System.Diagnostics.Stopwatch",{ctor:function(){this.$initialize();this._stopTime=System.Int64.Zero;this._startTime=System.Int64.Zero;this.isRunning=!1},reset:function(){this._stopTime=this._startTime=System.Diagnostics.Stopwatch.getTimestamp();this.isRunning=!1},ticks:function(){return(this.isRunning?System.Diagnostics.Stopwatch.getTimestamp():this._stopTime).sub(this._startTime)},milliseconds:function(){return this.ticks().mul(1e3).div(System.Diagnostics.Stopwatch.frequency)},timeSpan:function(){return new System.TimeSpan(this.milliseconds().mul(1e4))},start:function(){this.isRunning||(this._startTime=System.Diagnostics.Stopwatch.getTimestamp(),this.isRunning=!0)},stop:function(){this.isRunning&&(this._stopTime=System.Diagnostics.Stopwatch.getTimestamp(),this.isRunning=!1)},restart:function(){this.isRunning=!1;this.start()},statics:{startNew:function(){var n=new System.Diagnostics.Stopwatch;return n.start(),n}}});typeof window!="undefined"&&window.performance&&window.performance.now?(System.Diagnostics.Stopwatch.frequency=new System.Int64(1e6),System.Diagnostics.Stopwatch.isHighResolution=!0,System.Diagnostics.Stopwatch.getTimestamp=function(){return new System.Int64(Math.round(window.performance.now()*1e3))}):typeof process!="undefined"&&process.hrtime?(System.Diagnostics.Stopwatch.frequency=new System.Int64(1e9),System.Diagnostics.Stopwatch.isHighResolution=!0,System.Diagnostics.Stopwatch.getTimestamp=function(){var n=process.hrtime();return new System.Int64(n[0]).mul(1e9).add(n[1])}):(System.Diagnostics.Stopwatch.frequency=new System.Int64(1e3),System.Diagnostics.Stopwatch.isHighResolution=!1,System.Diagnostics.Stopwatch.getTimestamp=function(){return new System.Int64((new Date).valueOf())});System.Diagnostics.Contracts.Contract={reportFailure:function(n,t,i,r,u){var f=i.toString(),e,o;if(f=f.substring(f.indexOf("return")+7),f=f.substr(0,f.lastIndexOf(";")),e=f?"Contract '"+f+"' failed":"Contract failed",o=t?e+": "+t:e,u)throw new u(f,t);else throw new System.Diagnostics.Contracts.ContractException(n,o,t,f,r);},assert:function(n,t,i){t()||System.Diagnostics.Contracts.Contract.reportFailure(n,i,t,null)},requires:function(n,t,i){t()||System.Diagnostics.Contracts.Contract.reportFailure(0,i,t,null,n)},forAll:function(n,t,i){if(!i)throw new System.ArgumentNullException("predicate");for(;n<t;n++)if(!i(n))return!1;return!0},forAll$1:function(n,t){if(!n)throw new System.ArgumentNullException("collection");if(!t)throw new System.ArgumentNullException("predicate");var i=Bridge.getEnumerator(n);try{while(i.moveNext())if(!t(i.getCurrent()))return!1;return!0}finally{i.dispose()}},exists:function(n,t,i){if(!i)throw new System.ArgumentNullException("predicate");for(;n<t;n++)if(i(n))return!0;return!1},exists$1:function(n,t){if(!n)throw new System.ArgumentNullException("collection");if(!t)throw new System.ArgumentNullException("predicate");var i=Bridge.getEnumerator(n);try{while(i.moveNext())if(t(i.getCurrent()))return!0;return!1}finally{i.dispose()}}};Bridge.define("System.Diagnostics.Contracts.ContractFailureKind",{$kind:"enum",$statics:{precondition:0,postcondition:1,postconditionOnException:2,invarian:3,assert:4,assume:5}});Bridge.define("System.Diagnostics.Contracts.ContractException",{inherits:[System.Exception],ctor:function(n,t,i,r,u){this.$initialize();System.Exception.ctor.call(this,t,u);this._kind=n;this._failureMessage=t||null;this._userMessage=i||null;this._condition=r||null},getKind:function(){return this._kind},getFailure:function(){return this._failureMessage},getUserMessage:function(){return this._userMessage},getCondition:function(){return this._condition}});k={toIndex:function(n,t){if(t.length!==(n.$s?n.$s.length:1))throw new System.ArgumentException("Invalid number of indices");if(t[0]<0||t[0]>=(n.$s?n.$s[0]:n.length))throw new System.ArgumentException("Index 0 out of range");var r=t[0],i;if(n.$s)for(i=1;i<n.$s.length;i++){if(t[i]<0||t[i]>=n.$s[i])throw new System.ArgumentException("Index "+i+" out of range");r=r*n.$s[i]+t[i]}return r},$get:function(n){var t=this[System.Array.toIndex(this,n)];return typeof t!="undefined"?t:this.$v},get:function(n){var t,i,r;if(arguments.length<2)throw new System.ArgumentNullException("indices");for(t=Array.prototype.slice.call(arguments,1),i=0;i<t.length;i++)if(!Bridge.hasValue(t[i]))throw new System.ArgumentNullException("indices");return r=n[System.Array.toIndex(n,t)],typeof r!="undefined"?r:n.$v},$set:function(n,t){this[System.Array.toIndex(this,Array.prototype.slice.call(n,0))]=t},set:function(n,t){var i=Array.prototype.slice.call(arguments,2);n[System.Array.toIndex(n,i)]=t},getLength:function(n,t){if(t<0||t>=(n.$s?n.$s.length:1))throw new System.IndexOutOfRangeException;return n.$s?n.$s[t]:n.length},getRank:function(n){return n.$s?n.$s.length:1},getLower:function(n,t){return System.Array.getLength(n,t),0},create:function(n,t){var i=[],h=arguments.length>2?1:0,r,f,e,u,o,s;for(i.$v=n,i.$s=[],i.get=System.Array.$get,i.set=System.Array.$set,r=2;r<arguments.length;r++)h*=arguments[r],i.$s[r-2]=arguments[r];if(i.length=h,t)for(r=0;r<i.length;r++){for(o=[],s=r,f=i.$s.length-1;f>=0;f--)u=s%i.$s[f],o.unshift(u),s=Bridge.Int.div(s-u,i.$s[f]);for(e=t,u=0;u<o.length;u++)e=e[o[u]];i[r]=e}return i},init:function(n,t,i){for(var u=new Array(n),f=i!==!0&&Bridge.isFunction(t),r=0;r<n;r++)u[r]=f?t():t;return u},toEnumerable:function(n){return new Bridge.ArrayEnumerable(n)},toEnumerator:function(n,t){return new Bridge.ArrayEnumerator(n,t)},_typedArrays:{Float32Array:!0,Float64Array:!0,Int8Array:!0,Int16Array:!0,Int32Array:!0,Uint8Array:!0,Uint8ClampedArray:!0,Uint16Array:!0,Uint32Array:!0},is:function(n,t){return n instanceof Bridge.ArrayEnumerator?n.constructor===t||n instanceof t||t===Bridge.ArrayEnumerator||t.$$name&&System.String.startsWith(t.$$name,"System.Collections.IEnumerator")||t.$$name&&System.String.startsWith(t.$$name,"System.Collections.Generic.IEnumerator")?!0:!1:Bridge.isArray(n)?n.constructor===t||n instanceof t?!0:t===System.Collections.IEnumerable||t===System.Collections.ICollection||t===System.ICloneable||t.$$name&&System.String.startsWith(t.$$name,"System.Collections.Generic.IEnumerable$1")||t.$$name&&System.String.startsWith(t.$$name,"System.Collections.Generic.ICollection$1")||t.$$name&&System.String.startsWith(t.$$name,"System.Collections.Generic.IList$1")?!0:!!System.Array._typedArrays[String.prototype.slice.call(Object.prototype.toString.call(n),8,-1)]:!1},clone:function(n){return n.length===1?[n[0]]:n.slice(0)},getCount:function(n,t){var i;return Bridge.isArray(n)?n.length:Bridge.isFunction(n[i="System$Collections$ICollection$getCount"])||t&&Bridge.isFunction(n[i="System$Collections$Generic$ICollection$1$"+Bridge.getTypeAlias(t)+"$getCount"])?n[i]():Bridge.isFunction(n.getCount)?n.getCount():0},getIsReadOnly:function(n,t){var i;return Bridge.isArray(n)?t?!0:!1:Bridge.isFunction(n[i="System$Collections$ICollection$getIsReadOnly"])||t&&Bridge.isFunction(n[i="System$Collections$Generic$ICollection$1$"+Bridge.getTypeAlias(t)+"$getIsReadOnly"])?n[i]():Bridge.isFunction(n.getIsReadOnly)?n.getIsReadOnly():0},add:function(n,t,i){var r;Bridge.isArray(n)?n.push(t):i&&Bridge.isFunction(n[r="System$Collections$Generic$ICollection$1$"+Bridge.getTypeAlias(i)+"$add"])?n[r](t):Bridge.isFunction(n.add)&&n.add(t)},clear:function(n,t){var i;Bridge.isArray(n)?System.Array.fill(n,t?t.getDefaultValue||Bridge.getDefaultValue(t):null,0,n.length):t&&Bridge.isFunction(n[i="System$Collections$Generic$ICollection$1$"+Bridge.getTypeAlias(t)+"$clear"])?n[i]():Bridge.isFunction(n.clear)&&n.clear()},fill:function(n,t,i,r){if(!Bridge.hasValue(n))throw new System.ArgumentNullException("dst");if(i<0||r<0||i+r>n.length)throw new System.IndexOutOfRangeException;for(var u=Bridge.isFunction(t);--r>=0;)n[i+r]=u?t():t},copy:function(n,t,i,r,u){if(!i)throw new System.ArgumentNullException("dest","Value cannot be null");if(!n)throw new System.ArgumentNullException("src","Value cannot be null");if(t<0||r<0||u<0)throw new System.ArgumentOutOfRangeException("Number was less than the array's lower bound in the first dimension");if(u>n.length-t||u>i.length-r)throw new System.ArgumentException("Destination array was not long enough. Check destIndex and length, and the array's lower bounds");if(t<r&&n===i)while(--u>=0)i[r+u]=n[t+u];else for(var f=0;f<u;f++)i[r+f]=n[t+f]},copyTo:function(n,t,i,r){var u;if(Bridge.isArray(n))System.Array.copy(n,0,t,i,n?n.length:0);else if(Bridge.isFunction(n.copyTo))n.copyTo(t,i);else if(r&&Bridge.isFunction(n[u="System$Collections$Generic$ICollection$1$"+Bridge.getTypeAlias(r)+"$copyTo"]))n[u](t,i);else throw new System.NotImplementedException("copyTo");},indexOf:function(n,t,i,r,u){var o,f,e,s;if(Bridge.isArray(n)){for(i=i||0,r=r||n.length,s=i+r,f=i;f<s;f++)if(e=n[f],e===t||System.Collections.Generic.EqualityComparer$1.$default.equals2(e,t))return f}else{if(u&&Bridge.isFunction(n[o="System$Collections$Generic$IList$1$"+Bridge.getTypeAlias(u)+"$indexOf"]))return n[o](t);if(Bridge.isFunction(n.indexOf))return n.indexOf(t)}return-1},contains:function(n,t,i){var r;return Bridge.isArray(n)?System.Array.indexOf(n,t)>-1:i&&Bridge.isFunction(n[r="System$Collections$Generic$ICollection$1$"+Bridge.getTypeAlias(i)+"$contains"])?n[r](t):Bridge.isFunction(n.contains)?n.contains(t):!1},remove:function(n,t,i){var u,r;if(Bridge.isArray(n)){if(r=System.Array.indexOf(n,t),r>-1)return n.splice(r,1),!0}else{if(i&&Bridge.isFunction(n[u="System$Collections$Generic$ICollection$1$"+Bridge.getTypeAlias(i)+"$remove"]))return n[u](t);if(Bridge.isFunction(n.remove))return n.remove(t)}return!1},insert:function(n,t,i,r){var u;Bridge.isArray(n)?n.splice(t,0,i):r&&Bridge.isFunction(n[u="System$Collections$Generic$IList$1$"+Bridge.getTypeAlias(r)+"$insert"])?n[u](t,i):Bridge.isFunction(n.insert)&&n.insert(t,i)},removeAt:function(n,t,i){var r;Bridge.isArray(n)?n.splice(t,1):i&&Bridge.isFunction(n[r="System$Collections$Generic$IList$1$"+Bridge.getTypeAlias(i)+"$removeAt"])?n[r](t):Bridge.isFunction(n.removeAt)&&n.removeAt(t)},getItem:function(n,t,i){var r;return Bridge.isArray(n)?n[t]:Bridge.isFunction(n.get)?n.get(t):Bridge.isFunction(n.getItem)?n.getItem(t):i&&Bridge.isFunction(n[r="System$Collections$Generic$IList$1$"+Bridge.getTypeAlias(i)+"$getItem"])?n[r](t):Bridge.isFunction(n.get_Item)?n.get_Item(t):void 0},setItem:function(n,t,i,r){var u;if(Bridge.isArray(n))n[t]=i;else if(Bridge.isFunction(n.set))n.set(t,i);else if(Bridge.isFunction(n.setItem))n.setItem(t,i);else{if(r&&Bridge.isFunction(n[u="System$Collections$Generic$IList$1$"+Bridge.getTypeAlias(r)+"$setItem"]))return n[u](t,i);Bridge.isFunction(n.set_Item)&&n.set_Item(t,i)}},resize:function(n,t,i){var u;if(t<0)throw new System.ArgumentOutOfRangeException("newSize",null,null,t);var f=0,e=Bridge.isFunction(i),r=n.v;for(r?(f=r.length,r.length=t):r=new Array(t),u=f;u<t;u++)r[u]=e?i():i;n.v=r},reverse:function(n,t,i){var r,u,f;if(!k)throw new System.ArgumentNullException("arr");if(t||t===0||(t=0,i=n.length),t<0||i<0)throw new System.ArgumentOutOfRangeException(t<0?"index":"length","Non-negative number required.");if(k.length-t<i)throw new System.ArgumentException("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.");if(System.Array.getRank(n)!==1)throw new System.Exception("Only single dimension arrays are supported here.");for(r=t,u=t+i-1;r<u;)f=n[r],n[r]=n[u],n[u]=f,r++,u--},binarySearch:function(n,t,i,r,u){var o,f,s,e,h;if(!n)throw new System.ArgumentNullException("array");if(o=0,t<o||i<0)throw new System.ArgumentOutOfRangeException(t<o?"index":"length","Non-negative number required.");if(n.length-(t-o)<i)throw new System.ArgumentException("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.");if(System.Array.getRank(n)!==1)throw new System.RankException("Only single dimensional arrays are supported for the requested action.");for(u||(u=System.Collections.Generic.Comparer$1.$default),f=t,s=t+i-1;f<=s;){e=f+(s-f>>1);try{h=u.compare(n[e],r)}catch(c){throw new System.InvalidOperationException("Failed to compare two elements in the array.",c);}if(h===0)return e;h<0?f=e+1:s=e-1}return~f},sort:function(n,t,i,r){var f,u;if(!n)throw new System.ArgumentNullException("array");if(arguments.length===2&&typeof t=="object"&&(r=t,t=null),Bridge.isNumber(t)||(t=0),Bridge.isNumber(i)||(i=n.length),r||(r=System.Collections.Generic.Comparer$1.$default),t===0&&i===n.length)n.sort(Bridge.fn.bind(r,r.compare));else for(f=n.slice(t,t+i),f.sort(Bridge.fn.bind(r,r.compare)),u=t;u<t+i;u++)n[u]=f[u-t]},min:function(n,t){for(var r=n[0],u=n.length,i=0;i<u;i++)!(n[i]<r||r<t)||n[i]<t||(r=n[i]);return r},max:function(n,t){for(var r=n[0],u=n.length,i=0;i<u;i++)!(n[i]>r||r>t)||n[i]>t||(r=n[i]);return r},addRange:function(n,t){if(Bridge.isArray(t))n.push.apply(n,t);else{var i=Bridge.getEnumerator(t);try{while(i.moveNext())n.push(i.getCurrent())}finally{Bridge.is(i,System.IDisposable)&&i.dispose()}}},convertAll:function(n,t){if(!Bridge.hasValue(n))throw new System.ArgumentNullException("array");if(!Bridge.hasValue(t))throw new System.ArgumentNullException("converter");return n.map(t)},find:function(n,t,i){if(!Bridge.hasValue(t))throw new System.ArgumentNullException("array");if(!Bridge.hasValue(i))throw new System.ArgumentNullException("match");for(var r=0;r<t.length;r++)if(i(t[r]))return t[r];return Bridge.getDefaultValue(n)},findAll:function(n,t){var r,i;if(!Bridge.hasValue(n))throw new System.ArgumentNullException("array");if(!Bridge.hasValue(t))throw new System.ArgumentNullException("match");for(r=[],i=0;i<n.length;i++)t(n[i])&&r.push(n[i]);return r},findIndex:function(n,t,i,r){var f,u;if(!Bridge.hasValue(n))throw new System.ArgumentNullException("array");if(arguments.length===2?(r=t,t=0,i=n.length):arguments.length===3&&(r=i,i=n.length-t),t<0||t>n.length)throw new System.ArgumentOutOfRangeException("startIndex");if(i<0||t>n.length-i)throw new System.ArgumentOutOfRangeException("count");if(!Bridge.hasValue(r))throw new System.ArgumentNullException("match");for(f=t+i,u=t;u<f;u++)if(r(n[u]))return u;return-1},findLast:function(n,t,i){if(!Bridge.hasValue(t))throw new System.ArgumentNullException("array");if(!Bridge.hasValue(i))throw new System.ArgumentNullException("match");for(var r=t.length-1;r>=0;r--)if(i(t[r]))return t[r];return Bridge.getDefaultValue(n)},findLastIndex:function(n,t,i,r){var f,u;if(!Bridge.hasValue(n))throw new System.ArgumentNullException("array");if(arguments.length===2?(r=t,t=n.length-1,i=n.length):arguments.length===3&&(r=i,i=t+1),!Bridge.hasValue(r))throw new System.ArgumentNullException("match");if(n.length===0){if(t!==-1)throw new System.ArgumentOutOfRangeException("startIndex");}else if(t<0||t>=n.length)throw new System.ArgumentOutOfRangeException("startIndex");if(i<0||t-i+1<0)throw new System.ArgumentOutOfRangeException("count");for(f=t-i,u=t;u>f;u--)if(r(n[u]))return u;return-1},forEach:function(n,t){if(!Bridge.hasValue(n))throw new System.ArgumentNullException("array");if(!Bridge.hasValue(t))throw new System.ArgumentNullException("action");for(var i=0;i<n.length;i++)t(n[i],i,n)},indexOfT:function(n,t,i,r){if(!Bridge.hasValue(n))throw new System.ArgumentNullException("array");if(arguments.length===2?(i=0,r=n.length):arguments.length===3&&(r=n.length-i),i<0||i>=n.length&&n.length>0)throw new System.ArgumentOutOfRangeException("startIndex","out of range");if(r<0||r>n.length-i)throw new System.ArgumentOutOfRangeException("count","out of range");return System.Array.indexOf(n,t,i,r)},lastIndexOfT:function(n,t,i,r){var e,u,f;if(!Bridge.hasValue(n))throw new System.ArgumentNullException("array");if(arguments.length===2?(i=n.length-1,r=n.length):arguments.length===3&&(r=n.length===0?0:i+1),i<0||i>=n.length&&n.length>0)throw new System.ArgumentOutOfRangeException("startIndex","out of range");if(r<0||i-r+1<0)throw new System.ArgumentOutOfRangeException("count","out of range");for(e=i-r+1,u=i;u>=e;u--)if(f=n[u],f===t||System.Collections.Generic.EqualityComparer$1.$default.equals2(f,t))return u;return-1},trueForAll:function(n,t){if(!Bridge.hasValue(n))throw new System.ArgumentNullException("array");if(!Bridge.hasValue(t))throw new System.ArgumentNullException("match");for(var i=0;i<n.length;i++)if(!t(n[i]))return!1;return!0}};System.Array=k;Bridge.define("System.ArraySegment",{ctor:function(n,t,i){this.$initialize();this.array=n;this.offset=t||0;this.count=i||n.length},getArray:function(){return this.array},getCount:function(){return this.count},getOffset:function(){return this.offset}});Bridge.define("System.Collections.IEnumerable",{$kind:"interface"});Bridge.define("System.Collections.IEnumerator",{$kind:"interface"});Bridge.define("System.Collections.IEqualityComparer",{$kind:"interface"});Bridge.define("System.Collections.ICollection",{inherits:[System.Collections.IEnumerable],$kind:"interface"});Bridge.define("System.Collections.Generic.IEnumerator$1",function(){return{inherits:[System.Collections.IEnumerator],$kind:"interface"}});Bridge.define("System.Collections.Generic.IEnumerable$1",function(){return{inherits:[System.Collections.IEnumerable],$kind:"interface"}});Bridge.define("System.Collections.Generic.ICollection$1",function(n){return{inherits:[System.Collections.Generic.IEnumerable$1(n)],$kind:"interface"}});Bridge.define("System.Collections.Generic.IEqualityComparer$1",function(){return{$kind:"interface"}});Bridge.define("System.Collections.Generic.IDictionary$2",function(n,t){return{inherits:[System.Collections.Generic.IEnumerable$1(System.Collections.Generic.KeyValuePair$2(n,t))],$kind:"interface"}});Bridge.define("System.Collections.Generic.IList$1",function(n){return{inherits:[System.Collections.Generic.ICollection$1(n)],$kind:"interface"}});Bridge.define("System.Collections.Generic.IComparer$1",function(){return{$kind:"interface"}});Bridge.define("System.Collections.Generic.ISet$1",function(n){return{inherits:[System.Collections.Generic.ICollection$1(n)],$kind:"interface"}});Bridge.define("System.Collections.Generic.IReadOnlyCollection$1",function(n){return{inherits:[System.Collections.Generic.IEnumerable$1(n)],$kind:"interface"}});Bridge.define("System.Collections.Generic.IReadOnlyList$1",function(n){return{inherits:[System.Collections.Generic.IReadOnlyCollection$1(n)],$kind:"interface"}});Bridge.define("Bridge.CustomEnumerator",{inherits:[System.Collections.IEnumerator],config:{alias:["getCurrent","System$Collections$IEnumerator$getCurrent","moveNext","System$Collections$IEnumerator$moveNext","reset","System$Collections$IEnumerator$reset"]},ctor:function(n,t,i,r,u){this.$initialize();this.$moveNext=n;this.$getCurrent=t;this.$dispose=r;this.$reset=i;this.scope=u},moveNext:function(){try{return this.$moveNext.call(this.scope)}catch(n){this.dispose.call(this.scope);throw n;}},getCurrent:function(){return this.$getCurrent.call(this.scope)},getCurrent$1:function(){return this.$getCurrent.call(this.scope)},reset:function(){this.$reset&&this.$reset.call(this.scope)},dispose:function(){this.$dispose&&this.$dispose.call(this.scope)}});Bridge.define("Bridge.ArrayEnumerator",{inherits:[System.Collections.IEnumerator,System.IDisposable],statics:{$isArrayEnumerator:!0},config:{alias:["getCurrent","System$Collections$IEnumerator$getCurrent","moveNext","System$Collections$IEnumerator$moveNext","reset","System$Collections$IEnumerator$reset","dispose","System$IDisposable$dispose"]},ctor:function(n,t){this.$initialize();this.array=n;this.reset();t&&(this["System$Collections$Generic$IEnumerator$1$"+Bridge.getTypeAlias(t)+"$getCurrent$1"]=this.getCurrent)},moveNext:function(){return this.index++,this.index<this.array.length},getCurrent:function(){return this.array[this.index]},getCurrent$1:function(){return this.array[this.index]},reset:function(){this.index=-1},dispose:Bridge.emptyFn});Bridge.define("Bridge.ArrayEnumerable",{inherits:[System.Collections.IEnumerable],config:{alias:["getEnumerator","System$Collections$IEnumerable$getEnumerator"]},ctor:function(n){this.$initialize();this.array=n},getEnumerator:function(){return new Bridge.ArrayEnumerator(this.array)}});Bridge.define("System.Collections.Generic.EqualityComparer$1",function(n){return{inherits:[System.Collections.Generic.IEqualityComparer$1(n)],statics:{config:{init:function(){this.def=new(System.Collections.Generic.EqualityComparer$1(n))}}},config:{alias:["equals2","System$Collections$Generic$IEqualityComparer$1$"+Bridge.getTypeAlias(n)+"$equals2","getHashCode2","System$Collections$Generic$IEqualityComparer$1$"+Bridge.getTypeAlias(n)+"$getHashCode2"]},equals2:function(n,t){if(Bridge.isDefined(n,!0)){if(Bridge.isDefined(t,!0)){var i=n&&n.$$name;if(i){if(Bridge.isFunction(n.equalsT))return Bridge.equalsT(n,t);if(Bridge.isFunction(n.equals))return Bridge.equals(n,t)}else return Bridge.equals(n,t);return n===t}}else return!Bridge.isDefined(t,!0);return!1},getHashCode2:function(n){return Bridge.isDefined(n,!0)?Bridge.getHashCode(n):0}}});System.Collections.Generic.EqualityComparer$1.$default=new(System.Collections.Generic.EqualityComparer$1(Object));Bridge.define("System.Collections.Generic.Comparer$1",function(n){return{inherits:[System.Collections.Generic.IComparer$1(n)],config:{alias:["compare","System$Collections$Generic$IComparer$1$"+Bridge.getTypeAlias(n)+"$compare"]},ctor:function(n){this.$initialize();this.fn=n;this.compare=n}}});System.Collections.Generic.Comparer$1.$default=new(System.Collections.Generic.Comparer$1(Object))(function(n,t){if(Bridge.hasValue(n)){if(!Bridge.hasValue(t))return 1}else return Bridge.hasValue(t)?-1:0;return Bridge.compare(n,t)});Bridge.define("System.Collections.Generic.KeyValuePair$2",function(n,t){return{$kind:"struct",statics:{getDefaultValue:function(){return new(System.Collections.Generic.KeyValuePair$2(n,t))(Bridge.getDefaultValue(n),Bridge.getDefaultValue(t))}},ctor:function(i,r){i===undefined&&(i=Bridge.getDefaultValue(n));r===undefined&&(r=Bridge.getDefaultValue(t));this.$initialize();this.key=i;this.value=r},toString:function(){var n="[";return this.key!=null&&(n+=this.key.toString()),n+=", ",this.value!=null&&(n+=this.value.toString()),n+"]"}}});Bridge.define("System.Collections.Generic.Dictionary$2",function(n,t){return{inherits:[System.Collections.Generic.IDictionary$2(n,t)],config:{alias:["getCount","System$Collections$Generic$IDictionary$2$"+Bridge.getTypeAlias(n)+"$"+Bridge.getTypeAlias(t)+"$getCount","getKeys","System$Collections$Generic$IDictionary$2$"+Bridge.getTypeAlias(n)+"$"+Bridge.getTypeAlias(t)+"$getKeys","getValues","System$Collections$Generic$IDictionary$2$"+Bridge.getTypeAlias(n)+"$"+Bridge.getTypeAlias(t)+"$getValues","get","System$Collections$Generic$IDictionary$2$"+Bridge.getTypeAlias(n)+"$"+Bridge.getTypeAlias(t)+"$getItem","set","System$Collections$Generic$IDictionary$2$"+Bridge.getTypeAlias(n)+"$"+Bridge.getTypeAlias(t)+"$setItem","add","System$Collections$Generic$IDictionary$2$"+Bridge.getTypeAlias(n)+"$"+Bridge.getTypeAlias(t)+"$add","containsKey","System$Collections$Generic$IDictionary$2$"+Bridge.getTypeAlias(n)+"$"+Bridge.getTypeAlias(t)+"$containsKey","getEnumerator","System$Collections$Generic$IEnumerable$1$System$Collections$Generic$KeyValuePair$2$"+Bridge.getTypeAlias(n)+"$"+Bridge.getTypeAlias(t)+"$getEnumerator","remove","System$Collections$Generic$IDictionary$2$"+Bridge.getTypeAlias(n)+"$"+Bridge.getTypeAlias(t)+"$remove","tryGetValue","System$Collections$Generic$IDictionary$2$"+Bridge.getTypeAlias(n)+"$"+Bridge.getTypeAlias(t)+"$tryGetValue"]},ctor:function(i,r){var f,e,o,s,u;if(this.$initialize(),this.comparer=r||System.Collections.Generic.EqualityComparer$1(n).def,this.clear(),Bridge.is(i,System.Collections.Generic.Dictionary$2(n,t)))for(f=Bridge.getEnumerator(i);f.moveNext();)e=f.getCurrent(),this.add(e.key,e.value);else if(Object.prototype.toString.call(i)==="[object Object]")for(o=Object.keys(i),u=0;u<o.length;u++)s=o[u],this.add(s,i[s])},getKeys:function(){return new(System.Collections.Generic.DictionaryCollection$1(n))(this,!0)},getValues:function(){return new(System.Collections.Generic.DictionaryCollection$1(t))(this,!1)},clear:function(){this.entries={};this.count=0},findEntry:function(n){var r=this.comparer.getHashCode2(n),i,t;if(Bridge.isDefined(this.entries[r]))for(i=this.entries[r],t=0;t<i.length;t++)if(this.comparer.equals2(i[t].key,n))return i[t]},containsKey:function(n){return!!this.findEntry(n)},containsValue:function(n){var i,t,r;for(i in this.entries)if(this.entries.hasOwnProperty(i))for(r=this.entries[i],t=0;t<r.length;t++)if(this.comparer.equals2(r[t].value,n))return!0;return!1},get:function(n){var t=this.findEntry(n);if(!t)throw new System.Collections.Generic.KeyNotFoundException("Key "+n+" does not exist.");return t.value},getItem:function(n){return this.get(n)},set:function(i,r,u){var f=this.findEntry(i),e;if(f){if(u)throw new System.ArgumentException("Key "+i+" already exists.");f.value=r;return}e=this.comparer.getHashCode2(i);f=new(System.Collections.Generic.KeyValuePair$2(n,t))(i,r);this.entries[e]?this.entries[e].push(f):this.entries[e]=[f];this.count++},setItem:function(n,t,i){this.set(n,t,i)},add:function(n,t){this.set(n,t,!0)},remove:function(n){var r=this.comparer.getHashCode2(n),t,i;if(!this.entries[r])return!1;for(t=this.entries[r],i=0;i<t.length;i++)if(this.comparer.equals2(t[i].key,n))return t.splice(i,1),t.length==0&&delete this.entries[r],this.count--,!0;return!1},getCount:function(){return this.count},getComparer:function(){return this.comparer},tryGetValue:function(n,i){var r=this.findEntry(n);return i.v=r?r.value:Bridge.getDefaultValue(t),!!r},getCustomEnumerator:function(n){var r=Bridge.getPropertyNames(this.entries),t=-1,i;return new Bridge.CustomEnumerator(function(){return((t<0||i>=this.entries[r[t]].length-1)&&(i=-1,t++),t>=r.length)?!1:(i++,!0)},function(){return n(this.entries[r[t]][i])},function(){t=-1},null,this)},getEnumerator:function(){return this.getCustomEnumerator(function(n){return n})}}});Bridge.define("System.Collections.Generic.DictionaryCollection$1",function(n){return{inherits:[System.Collections.Generic.ICollection$1(n)],config:{alias:["getEnumerator","System$Collections$Generic$IEnumerable$1$"+Bridge.getTypeAlias(n)+"$getEnumerator","getCount","System$Collections$Generic$ICollection$1$"+Bridge.getTypeAlias(n)+"$getCount","add","System$Collections$Generic$ICollection$1$"+Bridge.getTypeAlias(n)+"$add","clear","System$Collections$Generic$ICollection$1$"+Bridge.getTypeAlias(n)+"$clear","contains","System$Collections$Generic$ICollection$1$"+Bridge.getTypeAlias(n)+"$contains","remove","System$Collections$Generic$ICollection$1$"+Bridge.getTypeAlias(n)+"$remove"]},ctor:function(n,t){this.$initialize();this.dictionary=n;this.keys=t},getCount:function(){return this.dictionary.getCount()},getEnumerator:function(){return this.dictionary.getCustomEnumerator(this.keys?function(n){return n.key}:function(n){return n.value})},contains:function(n){return this.keys?this.dictionary.containsKey(n):this.dictionary.containsValue(n)},add:function(){throw new System.NotSupportedException;},clear:function(){throw new System.NotSupportedException;},remove:function(){throw new System.NotSupportedException;}}});Bridge.define("System.Collections.Generic.List$1",function(n){return{inherits:[System.Collections.Generic.ICollection$1(n),System.Collections.ICollection,System.Collections.Generic.IList$1(n)],config:{alias:["getItem","System$Collections$Generic$IList$1$"+Bridge.getTypeAlias(n)+"$getItem","setItem","System$Collections$Generic$IList$1$"+Bridge.getTypeAlias(n)+"$setItem","getCount","System$Collections$Generic$ICollection$1$"+Bridge.getTypeAlias(n)+"$getCount","getIsReadOnly","System$Collections$Generic$ICollection$1$"+Bridge.getTypeAlias(n)+"$getIsReadOnly","add","System$Collections$Generic$ICollection$1$"+Bridge.getTypeAlias(n)+"$add","clear","System$Collections$Generic$ICollection$1$"+Bridge.getTypeAlias(n)+"$clear","contains","System$Collections$Generic$ICollection$1$"+Bridge.getTypeAlias(n)+"$contains","copyTo","System$Collections$Generic$ICollection$1$"+Bridge.getTypeAlias(n)+"$copyTo","getEnumerator","System$Collections$Generic$IEnumerable$1$"+Bridge.getTypeAlias(n)+"$getEnumerator","indexOf","System$Collections$Generic$IList$1$"+Bridge.getTypeAlias(n)+"$indexOf","insert","System$Collections$Generic$IList$1$"+Bridge.getTypeAlias(n)+"$insert","remove","System$Collections$Generic$ICollection$1$"+Bridge.getTypeAlias(n)+"$remove","removeAt","System$Collections$Generic$IList$1$"+Bridge.getTypeAlias(n)+"$removeAt"]},ctor:function(n){this.$initialize();this.items=Object.prototype.toString.call(n)==="[object Array]"?System.Array.clone(n):Bridge.is(n,System.Collections.IEnumerable)?Bridge.toArray(n):[];this.clear.$clearCallbacks=[]},checkIndex:function(n){if(n<0||n>this.items.length-1)throw new System.ArgumentOutOfRangeException("Index out of range");},getCount:function(){return this.items.length},getIsReadOnly:function(){return!!this.readOnly},get:function(n){return this.checkIndex(n),this.items[n]},getItem:function(n){return this.get(n)},set:function(n,t){this.checkReadOnly();this.checkIndex(n);this.items[n]=t},setItem:function(n,t){this.set(n,t)},add:function(n){this.checkReadOnly();this.items.push(n)},addRange:function(n){this.checkReadOnly();for(var i=Bridge.toArray(n),t=0,r=i.length;t<r;++t)this.items.push(i[t])},clear:function(){this.checkReadOnly();this.items=[];for(var n=0;n<this.clear.$clearCallbacks.length;n++)this.clear.$clearCallbacks[n](this)},onClear:function(n){this.clear.$clearCallbacks.push(n)},indexOf:function(n,t){var i,r;for(Bridge.isDefined(t)||(t=0),t!==0&&this.checkIndex(t),i=t;i<this.items.length;i++)if(r=this.items[i],System.Collections.Generic.EqualityComparer$1.$default.equals2(r,n))return i;return-1},insertRange:function(n,t){var r,i;for(this.checkReadOnly(),n!==this.items.length&&this.checkIndex(n),r=Bridge.toArray(t),i=0;i<r.length;i++)this.insert(n++,r[i])},contains:function(n){return this.indexOf(n)>-1},copyTo:function(n,t){System.Array.copy(this.items,0,n,t,this.items.length)},getEnumerator:function(){return new Bridge.ArrayEnumerator(this.items,n)},getRange:function(t,i){Bridge.isDefined(t)||(t=0);Bridge.isDefined(i)||(i=this.items.length);t!==0&&this.checkIndex(t);this.checkIndex(t+i-1);for(var u=[],f=t+i,r=t;r<f;r++)u.push(this.items[r]);return new(System.Collections.Generic.List$1(n))(u)},insert:function(n,t){if(this.checkReadOnly(),n!==this.items.length&&this.checkIndex(n),Bridge.isArray(t))for(var i=0;i<t.length;i++)this.insert(n++,t[i]);else this.items.splice(n,0,t)},join:function(n){return this.items.join(n)},lastIndexOf:function(n,t){Bridge.isDefined(t)||(t=this.items.length-1);t!==0&&this.checkIndex(t);for(var i=t;i>=0;i--)if(n===this.items[i])return i;return-1},remove:function(n){this.checkReadOnly();var t=this.indexOf(n);return t<0?!1:(this.checkIndex(t),this.items.splice(t,1),!0)},removeAt:function(n){this.checkReadOnly();this.checkIndex(n);this.items.splice(n,1)},removeRange:function(n,t){this.checkReadOnly();this.checkIndex(n);this.items.splice(n,t)},reverse:function(){this.checkReadOnly();this.items.reverse()},slice:function(n,t){this.checkReadOnly();var i=this.$$name.substr(this.$$name.lastIndexOf("$")+1);return new(System.Collections.Generic.List$1(Bridge.unroll(i)))(this.items.slice(n,t))},sort:function(n){this.checkReadOnly();this.items.sort(n||System.Collections.Generic.Comparer$1.$default.compare)},splice:function(n,t,i){this.checkReadOnly();this.items.splice(n,t,i)},unshift:function(){this.checkReadOnly();this.items.unshift()},toArray:function(){return Bridge.toArray(this)},checkReadOnly:function(){if(this.readOnly)throw new System.NotSupportedException;},binarySearch:function(n,t,i,r){return arguments.length===1&&(i=n,n=null),arguments.length===2&&(i=n,r=t,n=null,t=null),Bridge.isNumber(n)||(n=0),Bridge.isNumber(t)||(t=this.items.length),r||(r=System.Collections.Generic.Comparer$1.$default),System.Array.binarySearch(this.items,n,t,i,r)},convertAll:function(n,t){var r,i;if(!Bridge.hasValue(t))throw new System.ArgumentNullException("converter is null.");for(r=new(System.Collections.Generic.List$1(n))(this.items.length),i=0;i<this.items.length;i++)r.items[i]=t(this.items[i]);return r}}});Bridge.define("System.Collections.ObjectModel.ReadOnlyCollection$1",function(n){return{inherits:[System.Collections.Generic.List$1(n),System.Collections.Generic.IReadOnlyList$1(n)],ctor:function(t){if(this.$initialize(),t==null)throw new System.ArgumentNullException("list");if(System.Collections.Generic.List$1(n).ctor.call(this,[]),this.readOnly=!0,Object.prototype.toString.call(t)==="[object Array]")this.items=t;else if(Bridge.is(t,System.Collections.Generic.List$1(n))){var i=this;this.items=t.items;t.onClear(function(n){i.items=n.items})}else Bridge.is(t,System.Collections.IEnumerable)&&(this.items=Bridge.toArray(t))}}});Bridge.define("System.Threading.Tasks.Task",{inherits:[System.IDisposable],config:{alias:["dispose","System$IDisposable$dispose"]},ctor:function(n,t){this.$initialize();this.action=n;this.state=t;this.exception=null;this.status=System.Threading.Tasks.TaskStatus.created;this.callbacks=[];this.result=null},statics:{delay:function(n,t){var i=new System.Threading.Tasks.TaskCompletionSource;return setTimeout(function(){i.setResult(t)},n),i.task},fromResult:function(n){var t=new System.Threading.Tasks.Task;return t.status=System.Threading.Tasks.TaskStatus.ranToCompletion,t.result=n,t},run:function(n){var t=new System.Threading.Tasks.TaskCompletionSource;return setTimeout(function(){try{t.setResult(n())}catch(i){t.setException(System.Exception.create(i))}},0),t.task},whenAll:function(n){var t=new System.Threading.Tasks.TaskCompletionSource,r,f,e=!1,u=[],i;if(Bridge.is(n,System.Collections.IEnumerable)?n=Bridge.toArray(n):Bridge.isArray(n)||(n=Array.prototype.slice.call(arguments,0)),n.length===0)return t.setResult([]),t.task;for(f=n.length,r=new Array(n.length),i=0;i<n.length;i++)(function(i){n[i].continueWith(function(n){switch(n.status){case System.Threading.Tasks.TaskStatus.ranToCompletion:r[i]=n.getResult();break;case System.Threading.Tasks.TaskStatus.canceled:e=!0;break;case System.Threading.Tasks.TaskStatus.faulted:System.Array.addRange(u,n.exception.innerExceptions);break;default:throw new System.InvalidOperationException("Invalid task status: "+n.status);}--f==0&&(u.length>0?t.setException(u):e?t.setCanceled():t.setResult(r))})})(i);return t.task},whenAny:function(n){if(Bridge.is(n,System.Collections.IEnumerable)?n=Bridge.toArray(n):Bridge.isArray(n)||(n=Array.prototype.slice.call(arguments,0)),!n.length)throw new System.ArgumentException("At least one task is required");for(var t=new System.Threading.Tasks.TaskCompletionSource,i=0;i<n.length;i++)n[i].continueWith(function(n){switch(n.status){case System.Threading.Tasks.TaskStatus.ranToCompletion:t.trySetResult(n);break;case System.Threading.Tasks.TaskStatus.canceled:t.trySetCanceled();break;case System.Threading.Tasks.TaskStatus.faulted:t.trySetException(n.exception.innerExceptions);break;default:throw new System.InvalidOperationException("Invalid task status: "+n.status);}});return t.task},fromCallback:function(n,t){var i=new System.Threading.Tasks.TaskCompletionSource,r=Array.prototype.slice.call(arguments,2),u;return u=function(n){i.setResult(n)},r.push(u),n[t].apply(n,r),i.task},fromCallbackResult:function(n,t,i){var r=new System.Threading.Tasks.TaskCompletionSource,u=Array.prototype.slice.call(arguments,3),f;return f=function(n){r.setResult(n)},i(u,f),n[t].apply(n,u),r.task},fromCallbackOptions:function(n,t,i){var u=new System.Threading.Tasks.TaskCompletionSource,r=Array.prototype.slice.call(arguments,3),f;return f=function(n){u.setResult(n)},r[0]=r[0]||{},r[0][i]=f,n[t].apply(n,r),u.task},fromPromise:function(n,t,i,r){var u=new System.Threading.Tasks.TaskCompletionSource;return n.then||(n=n.promise()),typeof t=="number"?t=function(n){return function(){return arguments[n>=0?n:arguments.length+n]}}(t):typeof t!="function"&&(t=function(){return Array.prototype.slice.call(arguments,0)}),n.then(function(){u.setResult(t?t.apply(null,arguments):Array.prototype.slice.call(arguments,0))},function(){u.setException(i?i.apply(null,arguments):new Bridge.PromiseException(Array.prototype.slice.call(arguments,0)))},r),u.task}},continueWith:function(n,t){var i=new System.Threading.Tasks.TaskCompletionSource,r=this,u=t?function(){i.setResult(n(r))}:function(){try{i.setResult(n(r))}catch(t){i.setException(System.Exception.create(t))}};return this.isCompleted()?setTimeout(u,0):this.callbacks.push(u),i.task},start:function(){if(this.status!==System.Threading.Tasks.TaskStatus.created)throw new System.InvalidOperationException("Task was already started.");var n=this;this.status=System.Threading.Tasks.TaskStatus.running;setTimeout(function(){try{var t=n.action(n.state);delete n.action;delete n.state;n.complete(t)}catch(i){n.fail(new System.AggregateException(null,[System.Exception.create(i)]))}},0)},runCallbacks:function(){var n=this;setTimeout(function(){for(var t=0;t<n.callbacks.length;t++)n.callbacks[t](n);delete n.callbacks},0)},complete:function(n){return this.isCompleted()?!1:(this.result=n,this.status=System.Threading.Tasks.TaskStatus.ranToCompletion,this.runCallbacks(),!0)},fail:function(n){return this.isCompleted()?!1:(this.exception=n,this.status=System.Threading.Tasks.TaskStatus.faulted,this.runCallbacks(),!0)},cancel:function(){return this.isCompleted()?!1:(this.status=System.Threading.Tasks.TaskStatus.canceled,this.runCallbacks(),!0)},isCanceled:function(){return this.status===System.Threading.Tasks.TaskStatus.canceled},isCompleted:function(){return this.status===System.Threading.Tasks.TaskStatus.ranToCompletion||this.status===System.Threading.Tasks.TaskStatus.canceled||this.status===System.Threading.Tasks.TaskStatus.faulted},isFaulted:function(){return this.status===System.Threading.Tasks.TaskStatus.faulted},_getResult:function(n){switch(this.status){case System.Threading.Tasks.TaskStatus.ranToCompletion:return this.result;case System.Threading.Tasks.TaskStatus.canceled:var t=new System.Threading.Tasks.TaskCanceledException(null,this);throw n?t:new System.AggregateException(null,[t]);case System.Threading.Tasks.TaskStatus.faulted:throw n?this.exception.innerExceptions.getCount()>0?this.exception.innerExceptions.get(0):null:this.exception;default:throw new System.InvalidOperationException("Task is not yet completed.");}},getResult:function(){return this._getResult(!1)},dispose:function(){},getAwaiter:function(){return this},getAwaitedResult:function(){return this._getResult(!0)}});Bridge.define("System.Threading.Tasks.TaskStatus",{$kind:"enum",$statics:{created:0,waitingForActivation:1,waitingToRun:2,running:3,waitingForChildrenToComplete:4,ranToCompletion:5,canceled:6,faulted:7}});Bridge.define("System.Threading.Tasks.TaskCompletionSource",{ctor:function(){this.$initialize();this.task=new System.Threading.Tasks.Task;this.task.status=System.Threading.Tasks.TaskStatus.running},setCanceled:function(){if(!this.task.cancel())throw new System.InvalidOperationException("Task was already completed.");},setResult:function(n){if(!this.task.complete(n))throw new System.InvalidOperationException("Task was already completed.");},setException:function(n){if(!this.trySetException(n))throw new System.InvalidOperationException("Task was already completed.");},trySetCanceled:function(){return this.task.cancel()},trySetResult:function(n){return this.task.complete(n)},trySetException:function(n){return Bridge.is(n,System.Exception)&&(n=[n]),this.task.fail(new System.AggregateException(null,n))}});Bridge.define("System.Threading.CancellationTokenSource",{inherits:[System.IDisposable],config:{alias:["dispose","System$IDisposable$dispose"]},ctor:function(n){this.$initialize();this.timeout=typeof n=="number"&&n>=0?setTimeout(Bridge.fn.bind(this,this.cancel),n,-1):null;this.isCancellationRequested=!1;this.token=new System.Threading.CancellationToken(this);this.handlers=[]},cancel:function(n){var i,r,t;if(!this.isCancellationRequested){for(this.isCancellationRequested=!0,i=[],r=this.handlers,this.clean(),t=0;t<r.length;t++)try{r[t].f(r[t].s)}catch(u){if(n&&n!==-1)throw u;i.push(u)}if(i.length>0&&n!==-1)throw new System.AggregateException(null,i);}},cancelAfter:function(n){this.isCancellationRequested||(this.timeout&&clearTimeout(this.timeout),this.timeout=setTimeout(Bridge.fn.bind(this,this.cancel),n,-1))},register:function(n,t){if(this.isCancellationRequested)return n(t),new System.Threading.CancellationTokenRegistration;var i={f:n,s:t};return this.handlers.push(i),new System.Threading.CancellationTokenRegistration(this,i)},deregister:function(n){var t=this.handlers.indexOf(n);t>=0&&this.handlers.splice(t,1)},dispose:function(){this.clean()},clean:function(){if(this.timeout&&clearTimeout(this.timeout),this.timeout=null,this.handlers=[],this.links){for(var n=0;n<this.links.length;n++)this.links[n].dispose();this.links=null}},statics:{createLinked:function(){var n=new System.Threading.CancellationTokenSource,i,t;for(n.links=[],i=Bridge.fn.bind(n,n.cancel),t=0;t<arguments.length;t++)n.links.push(arguments[t].register(i));return n}}});Bridge.define("System.Threading.CancellationToken",{$kind:"struct",ctor:function(n){this.$initialize();Bridge.is(n,System.Threading.CancellationTokenSource)||(n=n?System.Threading.CancellationToken.sourceTrue:System.Threading.CancellationToken.sourceFalse);this.source=n},getCanBeCanceled:function(){return!this.source.uncancellable},getIsCancellationRequested:function(){return this.source.isCancellationRequested},throwIfCancellationRequested:function(){if(this.source.isCancellationRequested)throw new System.OperationCanceledException(this);},register:function(n,t){return this.source.register(n,t)},getHashCode:function(){return Bridge.getHashCode(this.source)},equals:function(n){return n.source===this.source},equalsT:function(n){return n.source===this.source},statics:{sourceTrue:{isCancellationRequested:!0,register:function(n,t){return n(t),new System.Threading.CancellationTokenRegistration}},sourceFalse:{uncancellable:!0,isCancellationRequested:!1,register:function(){return new System.Threading.CancellationTokenRegistration}},getDefaultValue:function(){return new System.Threading.CancellationToken}}});System.Threading.CancellationToken.none=new System.Threading.CancellationToken;Bridge.define("System.Threading.CancellationTokenRegistration",{inherits:function(){return[System.IDisposable,System.IEquatable$1(System.Threading.CancellationTokenRegistration)]},$kind:"struct",config:{alias:["dispose","System$IDisposable$dispose"]},ctor:function(n,t){this.$initialize();this.cts=n;this.o=t},dispose:function(){this.cts&&(this.cts.deregister(this.o),this.cts=this.o=null)},equalsT:function(n){return this===n},equals:function(n){return this===n},statics:{getDefaultValue:function(){return new System.Threading.CancellationTokenRegistration}}});wt={isNull:function(n){return!Bridge.isDefined(n,!0)},isEmpty:function(n){return n==null||n.length===0||Bridge.is(n,System.Collections.ICollection)?n.getCount()===0:!1},isNotEmptyOrWhitespace:function(n){return Bridge.isDefined(n,!0)&&!/^$|\s+/.test(n)},isNotNull:function(n){return Bridge.isDefined(n,!0)},isNotEmpty:function(n){return!Bridge.Validation.isEmpty(n)},email:function(n){return/^(")?(?:[^\."])(?:(?:[\.])?(?:[\w\-!#$%&'*+/=?^_`{|}~]))*\1@(\w[\-\w]*\.){1,5}([A-Za-z]){2,6}$/.test(n)},url:function(n){return/(?:(?:https?|ftp):\/\/)(?:\S+(?::\S*)?@)?(?:(?!(?:\.\d{1,3}){3})(?!(?:\.\d{1,3}){2})(?!\.(?:1[6-9]|2\d|3[0-1])(?:\.\d{1,3}){2})(?:[1-9]\d?|1\d\d|2[01]\d|22[0-3])(?:\.(?:1?\d{1,2}|2[0-4]\d|25[0-5])){2}(?:\.(?:[1-9]\d?|1\d\d|2[0-4]\d|25[0-4]))|(?:(?:[a-z\u00a1-\uffff0-9]-*)*[a-z\u00a1-\uffff0-9]+)(?:\.(?:[a-z\u00a1-\uffff0-9]-*)*[a-z\u00a1-\uffff0-9]+)*(?:\.(?:[a-z\u00a1-\uffff]{2,}))\.?)(?::\d{2,5})?(?:[/?#]\S*)?$/.test(n)},alpha:function(n){return/^[a-zA-Z_]+$/.test(n)},alphaNum:function(n){return/^[a-zA-Z_]+$/.test(n)},creditCard:function(n,t){var r,u,i,f,e=!1;if(t==="Visa")r=/^4\d{3}[- ]?\d{4}[- ]?\d{4}[- ]?\d{4}$/;else if(t==="MasterCard")r=/^5[1-5]\d{2}[- ]?\d{4}[- ]?\d{4}[- ]?\d{4}$/;else if(t==="Discover")r=/^6011[- ]?\d{4}[- ]?\d{4}[- ]?\d{4}$/;else if(t==="AmericanExpress")r=/^3[4,7]\d{13}$/;else if(t==="DinersClub")r=/^(3[0,6,8]\d{12})|(5[45]\d{14})$/;else{if(!n||n.length<13||n.length>19)return!1;r=/[^0-9 \-]+/;e=!0}if(!r.test(n))return!1;for(n=n.split(e?"-":/[- ]/).join(""),u=0,i=2-n.length%2;i<=n.length;i+=2)u+=parseInt(n.charAt(i-1));for(i=n.length%2+1;i<n.length;i+=2)f=parseInt(n.charAt(i-1))*2,u+=f<10?f:f-9;return u%10==0}};Bridge.Validation=wt;Bridge.define("System.Version",{inherits:function(){return[System.ICloneable,System.IComparable$1(System.Version),System.IEquatable$1(System.Version)]},statics:{separatorsArray:".",ZERO_CHAR_VALUE:48,appendPositiveNumber:function(n,t){var r=t.getLength(),i;do i=n%10,n=Bridge.Int.div(n,10)|0,t.insert(r,String.fromCharCode((System.Version.ZERO_CHAR_VALUE+i|0)&65535));while(n>0)},parse:function(n){if(n==null)throw new System.ArgumentNullException("input");var t={v:new System.Version.VersionResult};if(t.v.init("input",!0),!System.Version.tryParseVersion(n,t))throw t.v.getVersionParseException();return t.v.m_parsedVersion},tryParse:function(n,t){var i={v:new System.Version.VersionResult},r;return i.v.init("input",!1),r=System.Version.tryParseVersion(n,i),t.v=i.v.m_parsedVersion,r},tryParseVersion:function(n,t){var u={},f={},e={},o={},r,i;if(n==null)return t.v.setFailure(System.Version.ParseFailureKind.ArgumentNullException),!1;if(r=n.split(System.Version.separatorsArray),i=r.length,i<2||i>4)return t.v.setFailure(System.Version.ParseFailureKind.ArgumentException),!1;if(!System.Version.tryParseComponent(r[0],"version",t,u)||!System.Version.tryParseComponent(r[1],"version",t,f))return!1;if(i=i-2|0,i>0){if(!System.Version.tryParseComponent(r[2],"build",t,e))return!1;if(i=i-1|0,i>0)if(System.Version.tryParseComponent(r[3],"revision",t,o))t.v.m_parsedVersion=new System.Version.$ctor3(u.v,f.v,e.v,o.v);else return!1;else t.v.m_parsedVersion=new System.Version.$ctor2(u.v,f.v,e.v)}else t.v.m_parsedVersion=new System.Version.$ctor1(u.v,f.v);return!0},tryParseComponent:function(n,t,i,r){return System.Int32.tryParse(n,r)?r.v<0?(i.v.setFailure$1(System.Version.ParseFailureKind.ArgumentOutOfRangeException,t),!1):!0:(i.v.setFailure$1(System.Version.ParseFailureKind.FormatException,n),!1)},op_Equality:function(n,t){return Bridge.referenceEquals(n,null)?Bridge.referenceEquals(t,null):n.equalsT(t)},op_Inequality:function(n,t){return!System.Version.op_Equality(n,t)},op_LessThan:function(n,t){if(n==null)throw new System.ArgumentNullException("v1");return n.compareTo(t)<0},op_LessThanOrEqual:function(n,t){if(n==null)throw new System.ArgumentNullException("v1");return n.compareTo(t)<=0},op_GreaterThan:function(n,t){return System.Version.op_LessThan(t,n)},op_GreaterThanOrEqual:function(n,t){return System.Version.op_LessThanOrEqual(t,n)}},_Major:0,_Minor:0,_Build:-1,_Revision:-1,config:{alias:["clone","System$ICloneable$clone","compareTo","System$IComparable$1$System$Version$compareTo","equalsT","System$IEquatable$1$System$Version$equalsT"]},$ctor3:function(n,t,i,r){if(this.$initialize(),n<0)throw new System.ArgumentOutOfRangeException("major","Cannot be < 0");if(t<0)throw new System.ArgumentOutOfRangeException("minor","Cannot be < 0");if(i<0)throw new System.ArgumentOutOfRangeException("build","Cannot be < 0");if(r<0)throw new System.ArgumentOutOfRangeException("revision","Cannot be < 0");this._Major=n;this._Minor=t;this._Build=i;this._Revision=r},$ctor2:function(n,t,i){if(this.$initialize(),n<0)throw new System.ArgumentOutOfRangeException("major","Cannot be < 0");if(t<0)throw new System.ArgumentOutOfRangeException("minor","Cannot be < 0");if(i<0)throw new System.ArgumentOutOfRangeException("build","Cannot be < 0");this._Major=n;this._Minor=t;this._Build=i},$ctor1:function(n,t){if(this.$initialize(),n<0)throw new System.ArgumentOutOfRangeException("major","Cannot be < 0");if(t<0)throw new System.ArgumentOutOfRangeException("minor","Cannot be < 0");this._Major=n;this._Minor=t},$ctor4:function(n){this.$initialize();var t=System.Version.parse(n);this._Major=t.getMajor();this._Minor=t.getMinor();this._Build=t.getBuild();this._Revision=t.getRevision()},ctor:function(){this.$initialize();this._Major=0;this._Minor=0},getMajor:function(){return this._Major},getMinor:function(){return this._Minor},getBuild:function(){return this._Build},getRevision:function(){return this._Revision},getMajorRevision:function(){return Bridge.Int.sxs(this._Revision>>16&65535)},getMinorRevision:function(){return Bridge.Int.sxs(this._Revision&65535)},clone:function(){var n=new System.Version.ctor;return n._Major=this._Major,n._Minor=this._Minor,n._Build=this._Build,n._Revision=this._Revision,n},compareTo$1:function(n){if(n==null)return 1;var t=Bridge.as(n,System.Version);if(System.Version.op_Equality(t,null))throw new System.ArgumentException("version should be of System.Version type");return this._Major!==t._Major?this._Major>t._Major?1:-1:this._Minor!==t._Minor?this._Minor>t._Minor?1:-1:this._Build!==t._Build?this._Build>t._Build?1:-1:this._Revision!==t._Revision?this._Revision>t._Revision?1:-1:0},compareTo:function(n){return System.Version.op_Equality(n,null)?1:this._Major!==n._Major?this._Major>n._Major?1:-1:this._Minor!==n._Minor?this._Minor>n._Minor?1:-1:this._Build!==n._Build?this._Build>n._Build?1:-1:this._Revision!==n._Revision?this._Revision>n._Revision?1:-1:0},equals:function(n){return this.equalsT(Bridge.as(n,System.Version))},equalsT:function(n){return System.Version.op_Equality(n,null)?!1:this._Major!==n._Major||this._Minor!==n._Minor||this._Build!==n._Build||this._Revision!==n._Revision?!1:!0},getHashCode:function(){var n=0;return n=n|(this._Major&15)<<28,n=n|(this._Minor&255)<<20,n=n|(this._Build&255)<<12,n|this._Revision&4095},toString:function(){return this._Build===-1?this.toString$1(2):this._Revision===-1?this.toString$1(3):this.toString$1(4)},toString$1:function(n){var t;switch(n){case 0:return"";case 1:return this._Major.toString();case 2:return t=new System.Text.StringBuilder,System.Version.appendPositiveNumber(this._Major,t),t.append(String.fromCharCode(46)),System.Version.appendPositiveNumber(this._Minor,t),t.toString();default:if(this._Build===-1)throw new System.ArgumentException("Build should be > 0 if fieldCount > 2","fieldCount");if(n===3)return t=new System.Text.StringBuilder,System.Version.appendPositiveNumber(this._Major,t),t.append(String.fromCharCode(46)),System.Version.appendPositiveNumber(this._Minor,t),t.append(String.fromCharCode(46)),System.Version.appendPositiveNumber(this._Build,t),t.toString();if(this._Revision===-1)throw new System.ArgumentException("Revision should be > 0 if fieldCount > 3","fieldCount");if(n===4)return t=new System.Text.StringBuilder,System.Version.appendPositiveNumber(this._Major,t),t.append(String.fromCharCode(46)),System.Version.appendPositiveNumber(this._Minor,t),t.append(String.fromCharCode(46)),System.Version.appendPositiveNumber(this._Build,t),t.append(String.fromCharCode(46)),System.Version.appendPositiveNumber(this._Revision,t),t.toString();throw new System.ArgumentException("Should be < 5","fieldCount");}}});Bridge.define("System.Version.ParseFailureKind",{$kind:"enum",statics:{ArgumentNullException:0,ArgumentException:1,ArgumentOutOfRangeException:2,FormatException:3}});Bridge.define("System.Version.VersionResult",{$kind:"struct",statics:{getDefaultValue:function(){return new System.Version.VersionResult}},m_parsedVersion:null,m_failure:0,m_exceptionArgument:null,m_argumentName:null,m_canThrow:!1,ctor:function(){this.$initialize()},init:function(n,t){this.m_canThrow=t;this.m_argumentName=n},setFailure:function(n){this.setFailure$1(n,"")},setFailure$1:function(n,t){if(this.m_failure=n,this.m_exceptionArgument=t,this.m_canThrow)throw this.getVersionParseException();},getVersionParseException:function(){switch(this.m_failure){case System.Version.ParseFailureKind.ArgumentNullException:return new System.ArgumentNullException(this.m_argumentName);case System.Version.ParseFailureKind.ArgumentException:return new System.ArgumentException("VersionString");case System.Version.ParseFailureKind.ArgumentOutOfRangeException:return new System.ArgumentOutOfRangeException(this.m_exceptionArgument,"Cannot be < 0");case System.Version.ParseFailureKind.FormatException:try{System.Int32.parse(this.m_exceptionArgument)}catch(n){n=System.Exception.create(n);var t;if(Bridge.is(n,System.FormatException)||Bridge.is(n,System.OverflowException))return t=n;throw n;}return new System.FormatException("InvalidString");default:return new System.ArgumentException("VersionString")}},getHashCode:function(){return Bridge.addHash([5139482776,this.m_parsedVersion,this.m_failure,this.m_exceptionArgument,this.m_argumentName,this.m_canThrow])},equals:function(n){return Bridge.is(n,System.Version.VersionResult)?Bridge.equals(this.m_parsedVersion,n.m_parsedVersion)&&Bridge.equals(this.m_failure,n.m_failure)&&Bridge.equals(this.m_exceptionArgument,n.m_exceptionArgument)&&Bridge.equals(this.m_argumentName,n.m_argumentName)&&Bridge.equals(this.m_canThrow,n.m_canThrow):!1},$clone:function(n){var t=n||new System.Version.VersionResult;return t.m_parsedVersion=this.m_parsedVersion,t.m_failure=this.m_failure,t.m_exceptionArgument=this.m_exceptionArgument,t.m_argumentName=this.m_argumentName,t.m_canThrow=this.m_canThrow,t}});Bridge.define("System.Attribute",{statics:{getCustomAttributes:function(n,t){if(n==null)throw new System.ArgumentNullException("element");if(t==null)throw new System.ArgumentNullException("attributeType");var i=n.at||[];return t?i.filter(function(n){return Bridge.is(n,t)}):i},getCustomAttributes$1:function(n,t,i){if(n==null)throw new System.ArgumentNullException("element");if(t==null)throw new System.ArgumentNullException("attributeType");return n.getCustomAttributes(t||i)}}});Bridge.define("System.ComponentModel.INotifyPropertyChanged",{$kind:"interface"});Bridge.define("System.ComponentModel.PropertyChangedEventArgs",{ctor:function(n,t,i){this.$initialize();this.propertyName=n;this.newValue=t;this.oldValue=i}});t={};t.convert={typeCodes:{Empty:0,Object:1,DBNull:2,Boolean:3,Char:4,SByte:5,Byte:6,Int16:7,UInt16:8,Int32:9,UInt32:10,Int64:11,UInt64:12,Single:13,Double:14,Decimal:15,DateTime:16,String:18},toBoolean:function(n,i){var r,u;switch(typeof n){case"boolean":return n;case"number":return n!==0;case"string":if(r=n.toLowerCase().trim(),r==="true")return!0;if(r==="false")return!1;throw new System.FormatException("String was not recognized as a valid Boolean.");case"object":if(n==null)return!1;if(n instanceof System.Decimal)return!n.isZero();if(System.Int64.is64Bit(n))return n.ne(0)}return u=t.internal.suggestTypeCode(n),t.internal.throwInvalidCastEx(u,t.convert.typeCodes.Boolean),t.convert.convertToType(t.convert.typeCodes.Boolean,n,i||null)},toChar:function(n,i,r){var u=t.convert.typeCodes,f,e;if(n instanceof System.Decimal&&(n=n.toFloat()),(n instanceof System.Int64||n instanceof System.UInt64)&&(n=n.toNumber()),f=typeof n,r=r||t.internal.suggestTypeCode(n),r===u.String&&n==null&&(f="string"),r!==u.Object)switch(f){case"boolean":t.internal.throwInvalidCastEx(u.Boolean,u.Char);case"number":return e=t.internal.isFloatingType(r),(e||n%1!=0)&&t.internal.throwInvalidCastEx(r,u.Char),t.internal.validateNumberRange(n,u.Char,!0),n;case"string":if(n==null)throw new System.ArgumentNullException("value");if(n.length!==1)throw new System.FormatException("String must be exactly one character long.");return n.charCodeAt(0)}if(r===u.Object||f==="object"){if(n==null)return 0;Bridge.isDate(n)&&t.internal.throwInvalidCastEx(u.DateTime,u.Char)}return t.internal.throwInvalidCastEx(r,t.convert.typeCodes.Char),t.convert.convertToType(u.Char,n,i||null)},toSByte:function(n,i,r){return t.internal.toNumber(n,i||null,t.convert.typeCodes.SByte,r||null)},toByte:function(n,i){return t.internal.toNumber(n,i||null,t.convert.typeCodes.Byte)},toInt16:function(n,i){return t.internal.toNumber(n,i||null,t.convert.typeCodes.Int16)},toUInt16:function(n,i){return t.internal.toNumber(n,i||null,t.convert.typeCodes.UInt16)},toInt32:function(n,i){return t.internal.toNumber(n,i||null,t.convert.typeCodes.Int32)},toUInt32:function(n,i){return t.internal.toNumber(n,i||null,t.convert.typeCodes.UInt32)},toInt64:function(n,i){var r=t.internal.toNumber(n,i||null,t.convert.typeCodes.Int64);return new System.Int64(r)},toUInt64:function(n,i){var r=t.internal.toNumber(n,i||null,t.convert.typeCodes.UInt64);return new System.UInt64(r)},toSingle:function(n,i){return t.internal.toNumber(n,i||null,t.convert.typeCodes.Single)},toDouble:function(n,i){return t.internal.toNumber(n,i||null,t.convert.typeCodes.Double)},toDecimal:function(n,i){return n instanceof System.Decimal?n:new System.Decimal(t.internal.toNumber(n,i||null,t.convert.typeCodes.Decimal))},toDateTime:function(n,i){var r=t.convert.typeCodes,u,f;switch(typeof n){case"boolean":t.internal.throwInvalidCastEx(r.Boolean,r.DateTime);case"number":u=t.internal.suggestTypeCode(n);t.internal.throwInvalidCastEx(u,r.DateTime);case"string":return Bridge.Date.parse(n,i||null);case"object":if(n==null)return t.internal.getMinValue(r.DateTime);if(Bridge.isDate(n))return n;n instanceof System.Decimal&&t.internal.throwInvalidCastEx(r.Decimal,r.DateTime);n instanceof System.Int64&&t.internal.throwInvalidCastEx(r.Int64,r.DateTime);n instanceof System.UInt64&&t.internal.throwInvalidCastEx(r.UInt64,r.DateTime)}return f=t.internal.suggestTypeCode(n),t.internal.throwInvalidCastEx(f,t.convert.typeCodes.DateTime),t.convert.convertToType(r.DateTime,n,i||null)},toString:function(n,i,r){var u=t.convert.typeCodes,f=typeof n;switch(f){case"boolean":return n?"True":"False";case"number":return(r||null)===u.Char?String.fromCharCode(n):isNaN(n)?"NaN":(n%1!=0&&(n=parseFloat(n.toPrecision(15))),n.toString());case"string":return n;case"object":return n==null?"":Bridge.isDate(n)?Bridge.Date.format(n,null,i||null):n instanceof System.Decimal?n.isInteger()?n.toFixed(0,4):n.toPrecision(n.precision()):System.Int64.is64Bit(n)?n.toString():n.format?n.format(null,i||null):Bridge.getTypeName(n)}return t.convert.convertToType(t.convert.typeCodes.String,n,i||null)},toNumberInBase:function(n,i,r){var h,o,v,c,b,y,p,u,k,s,e,d;if(i!==2&&i!==8&&i!==10&&i!==16)throw new System.ArgumentException("Invalid Base.");if(h=t.convert.typeCodes,n==null)return r===h.Int64?System.Int64.Zero:r===h.UInt64?System.UInt64.Zero:0;if(n.length===0)throw new System.ArgumentOutOfRangeException("Index was out of range. Must be non-negative and less than the size of the collection.");n=n.toLowerCase();var l=t.internal.getMinValue(r),a=t.internal.getMaxValue(r),w=!1,f=0;if(n[f]==="-"){if(i!==10)throw new System.ArgumentException("String cannot contain a minus sign if the base is not 10.");if(l>=0)throw new System.OverflowException("The string was being parsed as an unsigned number and could not have a negative sign.");w=!0;++f}else n[f]==="+"&&++f;if(i===16&&n.length>=2&&n[f]==="0"&&n[f+1]==="x"&&(f+=2),i===2)o=t.internal.charsToCodes("01");else if(i===8)o=t.internal.charsToCodes("01234567");else if(i===10)o=t.internal.charsToCodes("0123456789");else if(i===16)o=t.internal.charsToCodes("0123456789abcdef");else throw new System.ArgumentException("Invalid Base.");for(v={},c=0;c<o.length;c++)b=o[c],v[b]=c;if(y=o[0],p=o[o.length-1],r===h.Int64||r===h.UInt64){for(e=f;e<n.length;e++)if(s=n[e].charCodeAt(0),!(s>=y&&s<=p))if(e===f)throw new System.FormatException("Could not find any recognizable digits.");else throw new System.FormatException("Additional non-parsable characters are at the end of the string.");if(d=r===h.Int64,u=d?new System.Int64(Bridge.$Long.fromString(n,!1,i)):new System.UInt64(Bridge.$Long.fromString(n,!0,i)),u.toString(i)!==n)throw new System.OverflowException("Value was either too large or too small.");return u}for(u=0,k=a-l+1,e=f;e<n.length;e++)if(s=n[e].charCodeAt(0),s>=y&&s<=p){if(u*=i,u+=v[s],u>t.internal.typeRanges.Int64_MaxValue)throw new System.OverflowException("Value was either too large or too small.");}else if(e===f)throw new System.FormatException("Could not find any recognizable digits.");else throw new System.FormatException("Additional non-parsable characters are at the end of the string.");if(w&&(u*=-1),u>a&&i!==10&&l<0&&(u=u-k),u<l||u>a)throw new System.OverflowException("Value was either too large or too small.");return u},toStringInBase:function(n,i,r){var w=t.convert.typeCodes,v,e,h,y,p,o,u,f,c;if(i!==2&&i!==8&&i!==10&&i!==16)throw new System.ArgumentException("Invalid Base.");var l=t.internal.getMinValue(r),a=t.internal.getMaxValue(r),s=System.Int64.is64Bit(n);if(s){if(n.lt(l)||n.gt(a))throw new System.OverflowException("Value was either too large or too small for an unsigned byte.");}else if(n<l||n>a)throw new System.OverflowException("Value was either too large or too small for an unsigned byte.");if(v=!1,s)return i===10?n.toString():n.value.toUnsigned().toString(i);if(n<0&&(i===10?(v=!0,n*=-1):n=a+1-l+n),i===2)e="01";else if(i===8)e="01234567";else if(i===10)e="0123456789";else if(i===16)e="0123456789abcdef";else throw new System.ArgumentException("Invalid Base.");for(h={},y=e.split(""),o=0;o<y.length;o++)p=y[o],h[o]=p;if(u="",n===0||s&&n.eq(0))u="0";else if(s)while(n.gt(0))f=n.mod(i),n=n.sub(f).div(i),c=h[f.toNumber()],u+=c;else while(n>0)f=n%i,n=(n-f)/i,c=h[f],u+=c;return v&&(u+="-"),u.split("").reverse().join("")},toBase64String:function(n,i,r,u){var f;if(n==null)throw new System.ArgumentNullException("inArray");if(i=i||0,r=r!=null?r:n.length,u=u||0,r<0)throw new System.ArgumentOutOfRangeException("length","Index was out of range. Must be non-negative and less than the size of the collection.");if(i<0)throw new System.ArgumentOutOfRangeException("offset","Value must be positive.");if(u<0||u>1)throw new System.ArgumentException("Illegal enum value.");if(f=n.length,i>f-r)throw new System.ArgumentOutOfRangeException("offset","Offset and length must refer to a position in the string.");if(f===0)return"";var o=u===1,s=t.internal.toBase64_CalculateAndValidateOutputLength(r,o),e=[];return e.length=s,t.internal.convertToBase64Array(e,n,i,r,o),e.join("")},toBase64CharArray:function(n,i,r,u,f,e){var o,s,c;if(n==null)throw new System.ArgumentNullException("inArray");if(u==null)throw new System.ArgumentNullException("outArray");if(r<0)throw new System.ArgumentOutOfRangeException("length","Index was out of range. Must be non-negative and less than the size of the collection.");if(i<0)throw new System.ArgumentOutOfRangeException("offsetIn","Value must be positive.");if(f<0)throw new System.ArgumentOutOfRangeException("offsetOut","Value must be positive.");if(e=e||0,e<0||e>1)throw new System.ArgumentException("Illegal enum value.");if(o=n.length,i>o-r)throw new System.ArgumentOutOfRangeException("offsetIn","Offset and length must refer to a position in the string.");if(o===0)return 0;var h=e===1,l=u.length,a=t.internal.toBase64_CalculateAndValidateOutputLength(r,h);if(f>l-a)throw new System.ArgumentOutOfRangeException("offsetOut","Either offset did not refer to a position in the string, or there is an insufficient length of destination character array.");return s=[],c=t.internal.convertToBase64Array(s,n,i,r,h),t.internal.charsToCodes(s,u,f),c},fromBase64String:function(n){if(n==null)throw new System.ArgumentNullException("s");var i=n.split("");return t.internal.fromBase64CharPtr(i,0,i.length)},fromBase64CharArray:function(n,i,r){if(n==null)throw new System.ArgumentNullException("inArray");if(r<0)throw new System.ArgumentOutOfRangeException("length","Index was out of range. Must be non-negative and less than the size of the collection.");if(i<0)throw new System.ArgumentOutOfRangeException("offset","Value must be positive.");if(i>n.length-r)throw new System.ArgumentOutOfRangeException("offset","Offset and length must refer to a position in the string.");var u=t.internal.codesToChars(n);return t.internal.fromBase64CharPtr(u,i,r)},convertToType:function(){throw new System.NotSupportedException("IConvertible interface is not supported.");}};t.internal={base64Table:["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","+","/","="],typeRanges:{Char_MinValue:0,Char_MaxValue:65535,Byte_MinValue:0,Byte_MaxValue:255,SByte_MinValue:-128,SByte_MaxValue:127,Int16_MinValue:-32768,Int16_MaxValue:32767,UInt16_MinValue:0,UInt16_MaxValue:65535,Int32_MinValue:-2147483648,Int32_MaxValue:2147483647,UInt32_MinValue:0,UInt32_MaxValue:4294967295,Int64_MinValue:System.Int64.MinValue,Int64_MaxValue:System.Int64.MaxValue,UInt64_MinValue:System.UInt64.MinValue,UInt64_MaxValue:System.UInt64.MaxValue,Single_MinValue:-340282347e30,Single_MaxValue:340282347e30,Double_MinValue:-17976931348623157e292,Double_MaxValue:17976931348623157e292,Decimal_MinValue:System.Decimal.MinValue,Decimal_MaxValue:System.Decimal.MaxValue},base64LineBreakPosition:76,getTypeCodeName:function(n){var r=t.convert.typeCodes,u,i,e,f;if(t.internal.typeCodeNames==null){u={};for(i in r)r.hasOwnProperty(i)&&(e=r[i],u[e]=i);t.internal.typeCodeNames=u}if(f=t.internal.typeCodeNames[n],f==null)throw System.ArgumentOutOfRangeException("typeCode","The specified typeCode is undefined.");return f},suggestTypeCode:function(n){var i=t.convert.typeCodes,r=typeof n;switch(r){case"boolean":return i.Boolean;case"number":return n%1!=0?i.Double:i.Int32;case"string":return i.String;case"object":if(Bridge.isDate(n))return i.DateTime;if(n!=null)return i.Object}return null},getMinValue:function(n){var i=t.convert.typeCodes,r;switch(n){case i.Char:return t.internal.typeRanges.Char_MinValue;case i.SByte:return t.internal.typeRanges.SByte_MinValue;case i.Byte:return t.internal.typeRanges.Byte_MinValue;case i.Int16:return t.internal.typeRanges.Int16_MinValue;case i.UInt16:return t.internal.typeRanges.UInt16_MinValue;case i.Int32:return t.internal.typeRanges.Int32_MinValue;case i.UInt32:return t.internal.typeRanges.UInt32_MinValue;case i.Int64:return t.internal.typeRanges.Int64_MinValue;case i.UInt64:return t.internal.typeRanges.UInt64_MinValue;case i.Single:return t.internal.typeRanges.Single_MinValue;case i.Double:return t.internal.typeRanges.Double_MinValue;case i.Decimal:return t.internal.typeRanges.Decimal_MinValue;case i.DateTime:return r=new Date(0),r.setFullYear(1),r;default:return null}},getMaxValue:function(n){var i=t.convert.typeCodes;switch(n){case i.Char:return t.internal.typeRanges.Char_MaxValue;case i.SByte:return t.internal.typeRanges.SByte_MaxValue;case i.Byte:return t.internal.typeRanges.Byte_MaxValue;case i.Int16:return t.internal.typeRanges.Int16_MaxValue;case i.UInt16:return t.internal.typeRanges.UInt16_MaxValue;case i.Int32:return t.internal.typeRanges.Int32_MaxValue;case i.UInt32:return t.internal.typeRanges.UInt32_MaxValue;case i.Int64:return t.internal.typeRanges.Int64_MaxValue;case i.UInt64:return t.internal.typeRanges.UInt64_MaxValue;case i.Single:return t.internal.typeRanges.Single_MaxValue;case i.Double:return t.internal.typeRanges.Double_MaxValue;case i.Decimal:return t.internal.typeRanges.Decimal_MaxValue;default:throw new System.ArgumentOutOfRangeException("typeCode","The specified typeCode is undefined.");}},isFloatingType:function(n){var i=t.convert.typeCodes;return n===i.Single||n===i.Double||n===i.Decimal},toNumber:function(n,i,r,u){var f=t.convert.typeCodes,e=typeof n,o=t.internal.isFloatingType(r),h,c,s;u===f.String&&(e="string");(System.Int64.is64Bit(n)||n instanceof System.Decimal)&&(e="number");switch(e){case"boolean":return n?1:0;case"number":return r===f.Decimal?(t.internal.validateNumberRange(n,r,!0),new System.Decimal(n,i)):r===f.Int64?(t.internal.validateNumberRange(n,r,!0),new System.Int64(n)):r===f.UInt64?(t.internal.validateNumberRange(n,r,!0),new System.UInt64(n)):(System.Int64.is64Bit(n)?n=n.toNumber():n instanceof System.Decimal&&(n=n.toFloat()),o||n%1==0||(n=t.internal.roundToInt(n,r)),o&&(h=t.internal.getMinValue(r),c=t.internal.getMaxValue(r),n>c?n=Infinity:n<h&&(n=-Infinity)),t.internal.validateNumberRange(n,r,!1),n);case"string":if(n==null){if(i!=null)throw new System.ArgumentNullException("String","Value cannot be null.");return 0}if(o)if(r===f.Decimal){if(!/^[+-]?(\d+|\d+.|\d*\.\d+)$/.test(n)&&!/^[+-]?[0-9]+$/.test(n))throw new System.FormatException("Input string was not in a correct format.");n=System.Decimal(n,i)}else{if(!/^[-+]?[0-9]*\.?[0-9]+([eE][-+]?[0-9]+)?$/.test(n))throw new System.FormatException("Input string was not in a correct format.");n=parseFloat(n)}else{if(!/^[+-]?[0-9]+$/.test(n))throw new System.FormatException("Input string was not in a correct format.");s=n;r===f.Int64?(n=new System.Int64(n),s!==n.toString()&&this.throwOverflow(t.internal.getTypeCodeName(r))):r===f.UInt64?(n=new System.UInt64(n),s!==n.toString()&&this.throwOverflow(t.internal.getTypeCodeName(r))):n=parseInt(n,10)}if(isNaN(n))throw new System.FormatException("Input string was not in a correct format.");return t.internal.validateNumberRange(n,r,!0),n;case"object":if(n==null)return 0;Bridge.isDate(n)&&t.internal.throwInvalidCastEx(t.convert.typeCodes.DateTime,r)}return u=u||t.internal.suggestTypeCode(n),t.internal.throwInvalidCastEx(u,r),t.convert.convertToType(r,n,i)},validateNumberRange:function(n,i,r){var u=t.convert.typeCodes,e=t.internal.getMinValue(i),o=t.internal.getMaxValue(i),f=t.internal.getTypeCodeName(i);(i!==u.Single&&i!==u.Double||r||n!==Infinity&&n!==-Infinity)&&(i===u.Decimal||i===u.Int64||i===u.UInt64?i===u.Decimal?(System.Int64.is64Bit(n)||(e.gt(n)||o.lt(n))&&this.throwOverflow(f),n=new System.Decimal(n)):i===u.Int64?(n instanceof System.UInt64?n.gt(System.Int64.MaxValue)&&this.throwOverflow(f):n instanceof System.Decimal?(n.gt(new System.Decimal(o))||n.lt(new System.Decimal(e)))&&this.throwOverflow(f):n instanceof System.Int64||(e.toNumber()>n||o.toNumber()<n)&&this.throwOverflow(f),n=new System.Int64(n)):i===u.UInt64&&(n instanceof System.Int64?n.isNegative()&&this.throwOverflow(f):n instanceof System.Decimal?(n.gt(new System.Decimal(o))||n.lt(new System.Decimal(e)))&&this.throwOverflow(f):n instanceof System.UInt64||(e.toNumber()>n||o.toNumber()<n)&&this.throwOverflow(f),n=new System.UInt64(n)):(n<e||n>o)&&this.throwOverflow(f))},throwOverflow:function(n){throw new System.OverflowException("Value was either too large or too small for '"+n+"'.");},roundToInt:function(n,i){var r,f;if(n%1==0)return n;r=n>=0?Math.floor(n):-1*Math.floor(-n);var u=n-r,e=t.internal.getMinValue(i),o=t.internal.getMaxValue(i);if(n>=0){if(n<o+.5)return(u>.5||u===.5&&(r&1)!=0)&&++r,r}else if(n>=e-.5)return(u<-.5||u===-.5&&(r&1)!=0)&&--r,r;f=t.internal.getTypeCodeName(i);throw new System.OverflowException("Value was either too large or too small for an '"+f+"'.");},toBase64_CalculateAndValidateOutputLength:function(n,i){var f=t.internal.base64LineBreakPosition,r=~~(n/3)*4,u;if(r+=n%3!=0?4:0,r===0)return 0;if(i&&(u=~~(r/f),r%f==0&&--u,r+=u*2),r>2147483647)throw new System.OutOfMemoryException;return r},convertToBase64Array:function(n,i,r,u,f){for(var s=t.internal.base64Table,a=t.internal.base64LineBreakPosition,c=u%3,l=r+(u-c),h=0,e=0,o=r;o<l;o+=3)f&&(h===a&&(n[e++]="\r",n[e++]="\n",h=0),h+=4),n[e]=s[(i[o]&252)>>2],n[e+1]=s[(i[o]&3)<<4|(i[o+1]&240)>>4],n[e+2]=s[(i[o+1]&15)<<2|(i[o+2]&192)>>6],n[e+3]=s[i[o+2]&63],e+=4;o=l;f&&c!==0&&h===t.internal.base64LineBreakPosition&&(n[e++]="\r",n[e++]="\n");switch(c){case 2:n[e]=s[(i[o]&252)>>2];n[e+1]=s[(i[o]&3)<<4|(i[o+1]&240)>>4];n[e+2]=s[(i[o+1]&15)<<2];n[e+3]=s[64];e+=4;break;case 1:n[e]=s[(i[o]&252)>>2];n[e+1]=s[(i[o]&3)<<4];n[e+2]=s[64];n[e+3]=s[64];e+=4}return e},fromBase64CharPtr:function(n,i,r){var u,f,e;if(r<0)throw new System.ArgumentOutOfRangeException("inputLength","Index was out of range. Must be non-negative and less than the size of the collection.");if(i<0)throw new System.ArgumentOutOfRangeException("offset","Value must be positive.");while(r>0){if(u=n[i+r-1],u!==" "&&u!=="\n"&&u!=="\r"&&u!=="\t")break;r--}if(f=t.internal.fromBase64_ComputeResultLength(n,i,r),0>f)throw new System.InvalidOperationException("Contract voilation: 0 <= resultLength.");return e=[],e.length=f,t.internal.fromBase64_Decode(n,i,r,e,0,f),e},fromBase64_Decode:function(n,t,i,r,u,f){for(var k=u,a="A".charCodeAt(0),v="a".charCodeAt(0),y="0".charCodeAt(0),p="=".charCodeAt(0),d="+".charCodeAt(0),g="/".charCodeAt(0),nt=" ".charCodeAt(0),tt="\t".charCodeAt(0),it="\n".charCodeAt(0),rt="\r".charCodeAt(0),w="Z".charCodeAt(0)-"A".charCodeAt(0),ut="9".charCodeAt(0)-"0".charCodeAt(0),h=t+i,l=u+f,o,e=255,b=!1,c=!1,s;;){if(t>=h){b=!0;break}if(o=n[t].charCodeAt(0),t++,o-a>>>0<=w)o-=a;else if(o-v>>>0<=w)o-=v-26;else if(o-y>>>0<=ut)o-=y-52;else switch(o){case d:o=62;break;case g:o=63;break;case rt:case it:case nt:case tt:continue;case p:c=!0;break;default:throw new System.FormatException("The input is not a valid Base-64 string as it contains a non-base 64 character, more than two padding characters, or an illegal character among the padding characters.");}if(c)break;if(e=e<<6|o,(e&2147483648)!=0){if(l-u<3)return-1;r[u]=255&e>>16;r[u+1]=255&e>>8;r[u+2]=255&e;u+=3;e=255}}if(!b&&!c)throw new System.InvalidOperationException("Contract violation: should never get here.");if(c){if(o!==p)throw new System.InvalidOperationException("Contract violation: currCode == intEq.");if(t===h){if(e<<=6,(e&2147483648)==0)throw new System.FormatException("Invalid length for a Base-64 char array or string.");if(l-u<2)return-1;r[u]=255&e>>16;r[u+1]=255&e>>8;u+=2;e=255}else{while(t<h-1){if(s=n[t],s!==" "&&s!=="\n"&&s!=="\r"&&s!=="\t")break;t++}if(t===h-1&&n[t]==="="){if(e<<=12,(e&2147483648)==0)throw new System.FormatException("Invalid length for a Base-64 char array or string.");if(l-u<1)return-1;r[u]=255&e>>16;u++;e=255}else throw new System.FormatException("The input is not a valid Base-64 string as it contains a non-base 64 character, more than two padding characters, or an illegal character among the padding characters.");}}if(e!==255)throw new System.FormatException("Invalid length for a Base-64 char array or string.");return u-k},fromBase64_ComputeResultLength:function(n,t,i){var f;if(i<0)throw new System.ArgumentOutOfRangeException("inputLength","Index was out of range. Must be non-negative and less than the size of the collection.");for(var e=t+i,u=i,r=0;t<e;)f=n[t],t++,f<=" "?u--:f==="="&&(u--,r++);if(0>u)throw new System.InvalidOperationException("Contract violation: 0 <= usefulInputLength.");if(0>r)throw new System.InvalidOperationException("Contract violation: 0 <= padding.");if(r!==0)if(r===1)r=2;else if(r===2)r=1;else throw new System.FormatException("The input is not a valid Base-64 string as it contains a non-base 64 character, more than two padding characters, or an illegal character among the padding characters.");return~~(u/4)*3+r},charsToCodes:function(n,t,i){if(n==null)return null;i=i||0;t==null&&(t=[],t.length=n.length);for(var r=0;r<n.length;r++)t[r+i]=n[r].charCodeAt(0);return t},codesToChars:function(n,t){var i,r;if(n==null)return null;for(t=t||[],i=0;i<n.length;i++)r=n[i],t[i]=String.fromCharCode(r);return t},throwInvalidCastEx:function(n,i){var r=t.internal.getTypeCodeName(n),u=t.internal.getTypeCodeName(i);throw new System.InvalidCastException("Invalid cast from '"+r+"' to '"+u+"'.");}};System.Convert=t.convert;Bridge.define("System.Net.WebSockets.ClientWebSocket",{inherits:[System.IDisposable],ctor:function(){this.$initialize();this.messageBuffer=[];this.state="none";this.options=new System.Net.WebSockets.ClientWebSocketOptions;this.disposed=!1;this.closeStatus=null;this.closeStatusDescription=null},getCloseStatus:function(){return this.closeStatus},getState:function(){return this.state},getCloseStatusDescription:function(){return this.closeStatusDescription},getSubProtocol:function(){return this.socket?this.socket.protocol:null},connectAsync:function(n){if(this.state!=="none")throw new System.InvalidOperationException("Socket is not in initial state");this.options.setToReadOnly();this.state="connecting";var i=new System.Threading.Tasks.TaskCompletionSource,t=this;try{this.socket=new WebSocket(n.getAbsoluteUri(),this.options.requestedSubProtocols);this.socket.binaryType="arraybuffer";this.socket.onopen=function(){t.state="open";i.setResult(null)};this.socket.onmessage=function(n){var u=n.data,r={},i,f;if(r.bytes=[],typeof u=="string"){for(i=0;i<u.length;++i)r.bytes.push(u.charCodeAt(i));r.messageType="text";t.messageBuffer.push(r);return}if(u instanceof ArrayBuffer){for(f=new Uint8Array(u),i=0;i<f.length;i++)r.bytes.push(f[i]);r.messageType="binary";t.messageBuffer.push(r);return}throw new System.ArgumentException("Invalid message type.");};this.socket.onclose=function(n){t.state="closed";t.closeStatus=n.code;t.closeStatusDescription=n.reason}}catch(r){i.setException(System.Exception.create(r))}return i.task},sendAsync:function(n,t){var u,i,f,e,r;this.throwIfNotConnected();u=new System.Threading.Tasks.TaskCompletionSource;try{i=n.getArray();switch(t){case"binary":for(f=new ArrayBuffer(i.length),e=new Int8Array(f),r=0;r<i.length;r++)e[r]=i[r];break;case"text":f=String.fromCharCode.apply(null,i)}t==="close"?this.socket.close():this.socket.send(f);u.setResult(null)}catch(o){u.setException(System.Exception.create(o))}return u.task},receiveAsync:function(n,t){this.throwIfNotConnected();var u,i=new System.Threading.Tasks.TaskCompletionSource,r=this,f=Bridge.fn.bind(this,function(){var e,o,s,c,h;try{if(t.getIsCancellationRequested()){i.setException(new System.Threading.Tasks.TaskCanceledException("Receive has been cancelled.",i.task));return}if(r.messageBuffer.length===0){u=System.Threading.Tasks.Task.delay(0);u.continueWith(f);return}for(e=r.messageBuffer[0],o=n.getArray(),e.bytes.length<=o.length?(r.messageBuffer.shift(),s=e.bytes,c=!0):(s=e.bytes.slice(0,o.length),e.bytes=e.bytes.slice(o.length,e.bytes.length),c=!1),h=0;h<s.length;h++)o[h]=s[h];i.setResult(new System.Net.WebSockets.WebSocketReceiveResult(s.length,e.messageType,c))}catch(l){i.setException(System.Exception.create(l))}},arguments);return f(),i.task},closeAsync:function(n,t,i){if(this.throwIfNotConnected(),this.state!=="open")throw new System.InvalidOperationException("Socket is not in connected state");var r=new System.Threading.Tasks.TaskCompletionSource,e=this,u,f=function(){if(e.state==="closed"){r.setResult(null);return}if(i.getIsCancellationRequested()){r.setException(new System.Threading.Tasks.TaskCanceledException("Closing has been cancelled.",r.task));return}u=System.Threading.Tasks.Task.delay(0);u.continueWith(f)};try{this.state="closesent";this.socket.close(n,t)}catch(o){r.setException(System.Exception.create(o))}return f(),r.task},closeOutputAsync:function(n,t){if(this.throwIfNotConnected(),this.state!=="open")throw new System.InvalidOperationException("Socket is not in connected state");var i=new System.Threading.Tasks.TaskCompletionSource;try{this.state="closesent";this.socket.close(n,t);i.setResult(null)}catch(r){i.setException(System.Exception.create(r))}return i.task},abort:function(){this.dispose()},dispose:function(){this.disposed||(this.disposed=!0,this.messageBuffer=[],state==="open"&&(this.state="closesent",this.socket.close()))},throwIfNotConnected:function(){if(this.disposed)throw new System.InvalidOperationException("Socket is disposed.");if(this.socket.readyState!==1)throw new System.InvalidOperationException("Socket is not connected.");}});Bridge.define("System.Net.WebSockets.ClientWebSocketOptions",{ctor:function(){this.$initialize();this.isReadOnly=!1;this.requestedSubProtocols=[]},setToReadOnly:function(){if(this.isReadOnly)throw new System.InvalidOperationException("Options are already readonly.");this.isReadOnly=!0},addSubProtocol:function(n){if(this.isReadOnly)throw new System.InvalidOperationException("Socket already started.");if(this.requestedSubProtocols.indexOf(n)>-1)throw new System.ArgumentException("Socket cannot have duplicate sub-protocols.","subProtocol");this.requestedSubProtocols.push(n)}});Bridge.define("System.Net.WebSockets.WebSocketReceiveResult",{ctor:function(n,t,i,r,u){this.$initialize();this.count=n;this.messageType=t;this.endOfMessage=i;this.closeStatus=r;this.closeStatusDescription=u},getCount:function(){return this.count},getMessageType:function(){return this.messageType},getEndOfMessage:function(){return this.endOfMessage},getCloseStatus:function(){return this.closeStatus},getCloseStatusDescription:function(){return this.closeStatusDescription}});Bridge.define("System.Uri",{ctor:function(n){this.$initialize();this.absoluteUri=n},getAbsoluteUri:function(){return this.absoluteUri}}),function(n,t){var f={Identity:function(n){return n},True:function(){return!0},Blank:function(){}},o={Boolean:"boolean",Number:"number",String:"string",Object:"object",Undefined:typeof t,Function:typeof function(){}},w={"":f.Identity},r={createLambda:function(n){var t,l,i,a,u,e,r,s,h,v,c;if(n==null)return f.Identity;if(typeof n===o.String){if(t=w[n],t!=null)return t;if(n.indexOf("=>")===-1){for(l=new RegExp("[$]+","g"),i=0;(a=l.exec(n))!=null;)u=a[0].length,u>i&&(i=u);for(e=[],r=1;r<=i;r++){for(s="",h=0;h<r;h++)s+="$";e.push(s)}return v=Array.prototype.join.call(e,","),t=new Function(v,"return "+n),w[n]=t,t}return c=n.match(/^[(\s]*([^()]*?)[)\s]*=>(.*)/),t=new Function(c[1],"return "+c[2]),w[n]=t,t}return n},isIEnumerable:function(n){if(typeof Enumerator!==o.Undefined)try{return new Enumerator(n),!0}catch(t){}return!1},defineProperty:Object.defineProperties!=null?function(n,t,i){Object.defineProperty(n,t,{enumerable:!1,configurable:!0,writable:!0,value:i})}:function(n,t,i){n[t]=i},compare:function(n,t){return n===t?0:n>t?1:-1},dispose:function(n){n!=null&&n.dispose()}},l={Before:0,Running:1,After:2},u=function(n,t,i){var u=new b,r=l.Before;this.getCurrent=u.getCurrent;this.reset=function(){throw new Error("Reset is not supported");};this.moveNext=function(){try{switch(r){case l.Before:r=l.Running;n();case l.Running:return t.apply(u)?!0:(this.dispose(),!1);case l.After:return!1}}catch(i){this.dispose();throw i;}};this.dispose=function(){if(r==l.Running)try{i()}finally{r=l.After}};this.getCurrent$1=this.getCurrent;this.System$Collections$IEnumerator$getCurrent=this.getCurrent;this.System$Collections$IEnumerator$moveNext=this.moveNext;this.System$Collections$IEnumerator$reset=this.reset},b,i,k,s,a,y,e,h,c,p,v;u.$$inherits=[];Bridge.Class.addExtend(u,[System.IDisposable,System.Collections.IEnumerator]);b=function(){var n=null;this.getCurrent=function(){return n};this.yieldReturn=function(t){return n=t,!0};this.yieldBreak=function(){return!1}};i=function(n){this.getEnumerator=n};i.$$inherits=[];Bridge.Class.addExtend(i,[System.Collections.IEnumerable]);i.Utils={};i.Utils.createLambda=function(n){return r.createLambda(n)};i.Utils.createEnumerable=function(n){return new i(n)};i.Utils.createEnumerator=function(n,t,i){return new u(n,t,i)};i.Utils.extendTo=function(n){var u=n.prototype,o,t,f;n===Array?(o=e.prototype,r.defineProperty(u,"getSource",function(){return this})):(o=i.prototype,r.defineProperty(u,"getEnumerator",function(){return i.from(this).getEnumerator()}));for(t in o)(f=o[t],u[t]!=f)&&(u[t]==null||(t=t+"ByLinq",u[t]!=f))&&f instanceof Function&&r.defineProperty(u,t,f)};i.choice=function(){var n=arguments;return new i(function(){return new u(function(){n=n[0]instanceof Array?n[0]:n[0].getEnumerator!=null?n[0].toArray():n},function(){return this.yieldReturn(n[Math.floor(Math.random()*n.length)])},f.Blank)})};i.cycle=function(){var n=arguments;return new i(function(){var t=0;return new u(function(){n=n[0]instanceof Array?n[0]:n[0].getEnumerator!=null?n[0].toArray():n},function(){return t>=n.length&&(t=0),this.yieldReturn(n[t++])},f.Blank)})};k=new i(function(){return new u(f.Blank,function(){return!1},f.Blank)});i.empty=function(){return k};i.from=function(n){if(n==null)return i.empty();if(n instanceof i)return n;if(typeof n==o.Number||typeof n==o.Boolean)return i.repeat(n,1);if(typeof n==o.String)return new i(function(){var t=0;return new u(f.Blank,function(){return t<n.length?this.yieldReturn(n.charCodeAt(t++)):!1},f.Blank)});var t=Bridge.as(n,System.Collections.IEnumerable);if(t)return new i(function(){var n;return new u(function(){n=Bridge.getEnumerator(t)},function(){var t=n.moveNext();return t?this.yieldReturn(n.getCurrent()):!1},function(){var t=Bridge.as(n,System.IDisposable);t&&t.dispose()})});if(typeof n!=o.Function){if(typeof n.length==o.Number)return new e(n);if(!(n instanceof Object)&&r.isIEnumerable(n))return new i(function(){var i=!0,t;return new u(function(){t=new Enumerator(n)},function(){return i?i=!1:t.moveNext(),t.atEnd()?!1:this.yieldReturn(t.item())},f.Blank)});if(typeof Windows===o.Object&&typeof n.first===o.Function)return new i(function(){var i=!0,t;return new u(function(){t=n.first()},function(){return i?i=!1:t.moveNext(),t.hasCurrent?this.yieldReturn(t.current):this.yieldBreak()},f.Blank)})}return new i(function(){var t=[],i=0;return new u(function(){var i,r;for(i in n)r=n[i],r instanceof Function||!Object.prototype.hasOwnProperty.call(n,i)||t.push({key:i,value:r})},function(){return i<t.length?this.yieldReturn(t[i++]):!1},f.Blank)})};i.make=function(n){return i.repeat(n,1)};i.matches=function(n,t,r){return r==null&&(r=""),t instanceof RegExp&&(r+=t.ignoreCase?"i":"",r+=t.multiline?"m":"",t=t.source),r.indexOf("g")===-1&&(r+="g"),new i(function(){var i;return new u(function(){i=new RegExp(t,r)},function(){var t=i.exec(n);return t?this.yieldReturn(t):!1},f.Blank)})};i.range=function(n,t,r){return r==null&&(r=1),new i(function(){var i,e=0;return new u(function(){i=n-r},function(){return e++<t?this.yieldReturn(i+=r):this.yieldBreak()},f.Blank)})};i.rangeDown=function(n,t,r){return r==null&&(r=1),new i(function(){var i,e=0;return new u(function(){i=n+r},function(){return e++<t?this.yieldReturn(i-=r):this.yieldBreak()},f.Blank)})};i.rangeTo=function(n,t,r){return r==null&&(r=1),n<t?new i(function(){var i;return new u(function(){i=n-r},function(){var n=i+=r;return n<=t?this.yieldReturn(n):this.yieldBreak()},f.Blank)}):new i(function(){var i;return new u(function(){i=n+r},function(){var n=i-=r;return n>=t?this.yieldReturn(n):this.yieldBreak()},f.Blank)})};i.repeat=function(n,t){return t!=null?i.repeat(n).take(t):new i(function(){return new u(f.Blank,function(){return this.yieldReturn(n)},f.Blank)})};i.repeatWithFinalize=function(n,t){return n=r.createLambda(n),t=r.createLambda(t),new i(function(){var i;return new u(function(){i=n()},function(){return this.yieldReturn(i)},function(){i!=null&&(t(i),i=null)})})};i.generate=function(n,t){return t!=null?i.generate(n).take(t):(n=r.createLambda(n),new i(function(){return new u(f.Blank,function(){return this.yieldReturn(n())},f.Blank)}))};i.toInfinity=function(n,t){return n==null&&(n=0),t==null&&(t=1),new i(function(){var i;return new u(function(){i=n-t},function(){return this.yieldReturn(i+=t)},f.Blank)})};i.toNegativeInfinity=function(n,t){return n==null&&(n=0),t==null&&(t=1),new i(function(){var i;return new u(function(){i=n+t},function(){return this.yieldReturn(i-=t)},f.Blank)})};i.unfold=function(n,t){return t=r.createLambda(t),new i(function(){var r=!0,i;return new u(f.Blank,function(){return r?(r=!1,i=n,this.yieldReturn(i)):(i=t(i),this.yieldReturn(i))},f.Blank)})};i.defer=function(n){return new i(function(){var t;return new u(function(){t=i.from(n()).getEnumerator()},function(){return t.moveNext()?this.yieldReturn(t.getCurrent()):this.yieldBreak()},function(){r.dispose(t)})})};i.prototype.traverseBreadthFirst=function(n,t){var f=this;return n=r.createLambda(n),t=r.createLambda(t),new i(function(){var e,s=0,o=[];return new u(function(){e=f.getEnumerator()},function(){for(;;){if(e.moveNext())return o.push(e.getCurrent()),this.yieldReturn(t(e.getCurrent(),s));var u=i.from(o).selectMany(function(t){return n(t)});if(u.any())s++,o=[],r.dispose(e),e=u.getEnumerator();else return!1}},function(){r.dispose(e)})})};i.prototype.traverseDepthFirst=function(n,t){var f=this;return n=r.createLambda(n),t=r.createLambda(t),new i(function(){var o=[],e;return new u(function(){e=f.getEnumerator()},function(){for(;;){if(e.moveNext()){var u=t(e.getCurrent(),o.length);return o.push(e),e=i.from(n(e.getCurrent())).getEnumerator(),this.yieldReturn(u)}if(o.length<=0)return!1;r.dispose(e);e=o.pop()}},function(){try{r.dispose(e)}finally{i.from(o).forEach(function(n){n.dispose()})}})})};i.prototype.flatten=function(){var n=this;return new i(function(){var e,t=null;return new u(function(){e=n.getEnumerator()},function(){for(;;){if(t!=null){if(t.moveNext())return this.yieldReturn(t.getCurrent());t=null}if(e.moveNext())if(e.getCurrent()instanceof Array){r.dispose(t);t=i.from(e.getCurrent()).selectMany(f.Identity).flatten().getEnumerator();continue}else return this.yieldReturn(e.getCurrent());return!1}},function(){try{r.dispose(e)}finally{r.dispose(t)}})})};i.prototype.pairwise=function(n){var t=this;return n=r.createLambda(n),new i(function(){var i;return new u(function(){i=t.getEnumerator();i.moveNext()},function(){var t=i.getCurrent();return i.moveNext()?this.yieldReturn(n(t,i.getCurrent())):!1},function(){r.dispose(i)})})};i.prototype.scan=function(n,t){var f,e;return t==null?(t=r.createLambda(n),f=!1):(t=r.createLambda(t),f=!0),e=this,new i(function(){var i,o,s=!0;return new u(function(){i=e.getEnumerator()},function(){if(s){if(s=!1,f)return this.yieldReturn(o=n);if(i.moveNext())return this.yieldReturn(o=i.getCurrent())}return i.moveNext()?this.yieldReturn(o=t(o,i.getCurrent())):!1},function(){r.dispose(i)})})};i.prototype.select=function(n){if(n=r.createLambda(n),n.length<=1)return new c(this,null,n);var t=this;return new i(function(){var i,f=0;return new u(function(){i=t.getEnumerator()},function(){return i.moveNext()?this.yieldReturn(n(i.getCurrent(),f++)):!1},function(){r.dispose(i)})})};i.prototype.selectMany=function(n,f){var e=this;return n=r.createLambda(n),f==null&&(f=function(n,t){return t}),f=r.createLambda(f),new i(function(){var s,o=t,h=0;return new u(function(){s=e.getEnumerator()},function(){if(o===t&&!s.moveNext())return!1;do{if(o==null){var u=n(s.getCurrent(),h++);o=i.from(u).getEnumerator()}if(o.moveNext())return this.yieldReturn(f(s.getCurrent(),o.getCurrent()));r.dispose(o);o=null}while(s.moveNext());return!1},function(){try{r.dispose(s)}finally{r.dispose(o)}})})};i.prototype.where=function(n){if(n=r.createLambda(n),n.length<=1)return new h(this,n);var t=this;return new i(function(){var i,f=0;return new u(function(){i=t.getEnumerator()},function(){while(i.moveNext())if(n(i.getCurrent(),f++))return this.yieldReturn(i.getCurrent());return!1},function(){r.dispose(i)})})};i.prototype.choose=function(n){n=r.createLambda(n);var t=this;return new i(function(){var i,f=0;return new u(function(){i=t.getEnumerator()},function(){while(i.moveNext()){var t=n(i.getCurrent(),f++);if(t!=null)return this.yieldReturn(t)}return this.yieldBreak()},function(){r.dispose(i)})})};i.prototype.ofType=function(n){var t=this;return new i(function(){var i;return new u(function(){i=Bridge.getEnumerator(t)},function(){while(i.moveNext()){var t=Bridge.as(i.getCurrent(),n);if(Bridge.hasValue(t))return this.yieldReturn(t)}return!1},function(){r.dispose(i)})})};i.prototype.zip=function(){var e=arguments,n=r.createLambda(arguments[arguments.length-1]),t=this,f;return arguments.length==2?(f=arguments[0],new i(function(){var e,o,s=0;return new u(function(){e=t.getEnumerator();o=i.from(f).getEnumerator()},function(){return e.moveNext()&&o.moveNext()?this.yieldReturn(n(e.getCurrent(),o.getCurrent(),s++)):!1},function(){try{r.dispose(e)}finally{r.dispose(o)}})})):new i(function(){var f,o=0;return new u(function(){var n=i.make(t).concat(i.from(e).takeExceptLast().select(i.from)).select(function(n){return n.getEnumerator()}).toArray();f=i.from(n)},function(){if(f.all(function(n){return n.moveNext()})){var t=f.select(function(n){return n.getCurrent()}).toArray();return t.push(o++),this.yieldReturn(n.apply(null,t))}return this.yieldBreak()},function(){i.from(f).forEach(r.dispose)})})};i.prototype.merge=function(){var n=arguments,t=this;return new i(function(){var f,e=-1;return new u(function(){f=i.make(t).concat(i.from(n).select(i.from)).select(function(n){return n.getEnumerator()}).toArray()},function(){while(f.length>0){e=e>=f.length-1?0:e+1;var n=f[e];if(n.moveNext())return this.yieldReturn(n.getCurrent());n.dispose();f.splice(e--,1)}return this.yieldBreak()},function(){i.from(f).forEach(r.dispose)})})};i.prototype.join=function(n,e,o,s,h){e=r.createLambda(e);o=r.createLambda(o);s=r.createLambda(s);var c=this;return new i(function(){var l,v,a=null,y=0;return new u(function(){l=c.getEnumerator();v=i.from(n).toLookup(o,f.Identity,h)},function(){for(var n,i;;){if(a!=null){if(n=a[y++],n!==t)return this.yieldReturn(s(l.getCurrent(),n));n=null;y=0}if(l.moveNext())i=e(l.getCurrent()),a=v.get(i).toArray();else return!1}},function(){r.dispose(l)})})};i.prototype.groupJoin=function(n,t,e,o,s){t=r.createLambda(t);e=r.createLambda(e);o=r.createLambda(o);var h=this;return new i(function(){var c=h.getEnumerator(),l=null;return new u(function(){c=h.getEnumerator();l=i.from(n).toLookup(e,f.Identity,s)},function(){if(c.moveNext()){var n=l.get(t(c.getCurrent()));return this.yieldReturn(o(c.getCurrent(),n))}return!1},function(){r.dispose(c)})})};i.prototype.all=function(n){n=r.createLambda(n);var t=!0;return this.forEach(function(i){if(!n(i))return t=!1,!1}),t};i.prototype.any=function(n){n=r.createLambda(n);var t=this.getEnumerator();try{if(arguments.length==0)return t.moveNext();while(t.moveNext())if(n(t.getCurrent()))return!0;return!1}finally{r.dispose(t)}};i.prototype.isEmpty=function(){return!this.any()};i.prototype.concat=function(){var n=this,t,f;return arguments.length==1?(t=arguments[0],new i(function(){var e,f;return new u(function(){e=n.getEnumerator()},function(){if(f==null){if(e.moveNext())return this.yieldReturn(e.getCurrent());f=i.from(t).getEnumerator()}return f.moveNext()?this.yieldReturn(f.getCurrent()):!1},function(){try{r.dispose(e)}finally{r.dispose(f)}})})):(f=arguments,new i(function(){var t;return new u(function(){t=i.make(n).concat(i.from(f).select(i.from)).select(function(n){return n.getEnumerator()}).toArray()},function(){while(t.length>0){var n=t[0];if(n.moveNext())return this.yieldReturn(n.getCurrent());n.dispose();t.splice(0,1)}return this.yieldBreak()},function(){i.from(t).forEach(r.dispose)})}))};i.prototype.insert=function(n,t){var f=this;return new i(function(){var o,e,s=0,h=!1;return new u(function(){o=f.getEnumerator();e=i.from(t).getEnumerator()},function(){return s==n&&e.moveNext()?(h=!0,this.yieldReturn(e.getCurrent())):o.moveNext()?(s++,this.yieldReturn(o.getCurrent())):!h&&e.moveNext()?this.yieldReturn(e.getCurrent()):!1},function(){try{r.dispose(o)}finally{r.dispose(e)}})})};i.prototype.alternate=function(n){var t=this;return new i(function(){var f,e,s,o;return new u(function(){s=n instanceof Array||n.getEnumerator!=null?i.from(i.from(n).toArray()):i.make(n);e=t.getEnumerator();e.moveNext()&&(f=e.getCurrent())},function(){for(;;){if(o!=null){if(o.moveNext())return this.yieldReturn(o.getCurrent());o=null}if(f==null&&e.moveNext()){f=e.getCurrent();o=s.getEnumerator();continue}else if(f!=null){var n=f;return f=null,this.yieldReturn(n)}return this.yieldBreak()}},function(){try{r.dispose(e)}finally{r.dispose(o)}})})};i.prototype.contains=function(n,t){t=t||System.Collections.Generic.EqualityComparer$1.$default;var i=this.getEnumerator();try{while(i.moveNext())if(t.equals2(i.getCurrent(),n))return!0;return!1}finally{r.dispose(i)}};i.prototype.defaultIfEmpty=function(n){var f=this;return n===t&&(n=null),new i(function(){var t,i=!0;return new u(function(){t=f.getEnumerator()},function(){return t.moveNext()?(i=!1,this.yieldReturn(t.getCurrent())):i?(i=!1,this.yieldReturn(n)):!1},function(){r.dispose(t)})})};i.prototype.distinct=function(n){return this.except(i.empty(),n)};i.prototype.distinctUntilChanged=function(n){n=r.createLambda(n);var t=this;return new i(function(){var i,f,e;return new u(function(){i=t.getEnumerator()},function(){while(i.moveNext()){var t=n(i.getCurrent());if(e)return e=!1,f=t,this.yieldReturn(i.getCurrent());if(f!==t)return f=t,this.yieldReturn(i.getCurrent())}return this.yieldBreak()},function(){r.dispose(i)})})};i.prototype.except=function(n,t){var f=this;return new i(function(){var o,e;return new u(function(){o=f.getEnumerator();e=new(System.Collections.Generic.Dictionary$2(Object,Object))(null,t);i.from(n).forEach(function(n){e.containsKey(n)||e.add(n)})},function(){while(o.moveNext()){var n=o.getCurrent();if(!e.containsKey(n))return e.add(n),this.yieldReturn(n)}return!1},function(){r.dispose(o)})})};i.prototype.intersect=function(n,t){var f=this;return new i(function(){var e,o,s;return new u(function(){e=f.getEnumerator();o=new(System.Collections.Generic.Dictionary$2(Object,Object))(null,t);i.from(n).forEach(function(n){o.containsKey(n)||o.add(n)});s=new(System.Collections.Generic.Dictionary$2(Object,Object))(null,t)},function(){while(e.moveNext()){var n=e.getCurrent();if(!s.containsKey(n)&&o.containsKey(n))return s.add(n),this.yieldReturn(n)}return!1},function(){r.dispose(e)})})};i.prototype.sequenceEqual=function(n,t){var f,u;t=t||System.Collections.Generic.EqualityComparer$1.$default;f=this.getEnumerator();try{u=i.from(n).getEnumerator();try{while(f.moveNext())if(!u.moveNext()||!t.equals2(f.getCurrent(),u.getCurrent()))return!1;return u.moveNext()?!1:!0}finally{r.dispose(u)}}finally{r.dispose(f)}};i.prototype.union=function(n,f){var e=this;return new i(function(){var h,o,s;return new u(function(){h=e.getEnumerator();s=new(System.Collections.Generic.Dictionary$2(Object,Object))(null,f)},function(){var r;if(o===t){while(h.moveNext())if(r=h.getCurrent(),!s.containsKey(r))return s.add(r),this.yieldReturn(r);o=i.from(n).getEnumerator()}while(o.moveNext())if(r=o.getCurrent(),!s.containsKey(r))return s.add(r),this.yieldReturn(r);return!1},function(){try{r.dispose(h)}finally{r.dispose(o)}})})};i.prototype.orderBy=function(n,t){return new s(this,n,t,!1)};i.prototype.orderByDescending=function(n,t){return new s(this,n,t,!0)};i.prototype.reverse=function(){var n=this;return new i(function(){var t,i;return new u(function(){t=n.toArray();i=t.length},function(){return i>0?this.yieldReturn(t[--i]):!1},f.Blank)})};i.prototype.shuffle=function(){var n=this;return new i(function(){var t;return new u(function(){t=n.toArray()},function(){if(t.length>0){var n=Math.floor(Math.random()*t.length);return this.yieldReturn(t.splice(n,1)[0])}return!1},f.Blank)})};i.prototype.weightedSample=function(n){n=r.createLambda(n);var t=this;return new i(function(){var i,r=0;return new u(function(){i=t.choose(function(t){var i=n(t);return i<=0?null:(r+=i,{value:t,bound:r})}).toArray()},function(){var t;if(i.length>0){for(var f=Math.floor(Math.random()*r)+1,u=-1,n=i.length;n-u>1;)t=Math.floor((u+n)/2),i[t].bound>=f?n=t:u=t;return this.yieldReturn(i[n].value)}return this.yieldBreak()},f.Blank)})};i.prototype.groupBy=function(n,t,f,e){var o=this;return n=r.createLambda(n),t=r.createLambda(t),f!=null&&(f=r.createLambda(f)),new i(function(){var i;return new u(function(){i=o.toLookup(n,t,e).toEnumerable().getEnumerator()},function(){while(i.moveNext())return f==null?this.yieldReturn(i.getCurrent()):this.yieldReturn(f(i.getCurrent().key(),i.getCurrent()));return!1},function(){r.dispose(i)})})};i.prototype.partitionBy=function(n,t,f,e){var s=this,o;return n=r.createLambda(n),t=r.createLambda(t),e=e||System.Collections.Generic.EqualityComparer$1.$default,f==null?(o=!1,f=function(n,t){return new v(n,t)}):(o=!0,f=r.createLambda(f)),new i(function(){var h,l,c=[];return new u(function(){h=s.getEnumerator();h.moveNext()&&(l=n(h.getCurrent()),c.push(t(h.getCurrent())))},function(){for(var r,u;(r=h.moveNext())==!0;)if(e.equals2(l,n(h.getCurrent())))c.push(t(h.getCurrent()));else break;return c.length>0?(u=o?f(l,i.from(c)):f(l,c),r?(l=n(h.getCurrent()),c=[t(h.getCurrent())]):c=[],this.yieldReturn(u)):!1},function(){r.dispose(h)})})};i.prototype.buffer=function(n){var t=this;return new i(function(){var i;return new u(function(){i=t.getEnumerator()},function(){for(var t=[],r=0;i.moveNext();)if(t.push(i.getCurrent()),++r>=n)return this.yieldReturn(t);return t.length>0?this.yieldReturn(t):!1},function(){r.dispose(i)})})};i.prototype.aggregate=function(n,t,i){return i=r.createLambda(i),i(this.scan(n,t,i).last())};i.prototype.average=function(n,t){!n||t||Bridge.isFunction(n)||(t=n,n=null);n=r.createLambda(n);var i=t||0,u=0;if(this.forEach(function(t){t=n(t);t instanceof System.Decimal||System.Int64.is64Bit(t)?i=t.add(i):i instanceof System.Decimal||System.Int64.is64Bit(i)?i=i.add(t):i+=t;++u}),u===0)throw new System.InvalidOperationException("Sequence contains no elements");return i instanceof System.Decimal||System.Int64.is64Bit(i)?i.div(u):i/u};i.prototype.nullableAverage=function(n,t){return this.any(Bridge.isNull)?null:this.average(n,t)};i.prototype.count=function(n){n=n==null?f.True:r.createLambda(n);var t=0;return this.forEach(function(i,r){n(i,r)&&++t}),t};i.prototype.max=function(n){return n==null&&(n=f.Identity),this.select(n).aggregate(function(n,t){return Bridge.compare(n,t,!0)===1?n:t})};i.prototype.nullableMax=function(n){return this.any(Bridge.isNull)?null:this.max(n)};i.prototype.min=function(n){return n==null&&(n=f.Identity),this.select(n).aggregate(function(n,t){return Bridge.compare(n,t,!0)===-1?n:t})};i.prototype.nullableMin=function(n){return this.any(Bridge.isNull)?null:this.min(n)};i.prototype.maxBy=function(n){return n=r.createLambda(n),this.aggregate(function(t,i){return Bridge.compare(n(t),n(i),!0)===1?t:i})};i.prototype.minBy=function(n){return n=r.createLambda(n),this.aggregate(function(t,i){return Bridge.compare(n(t),n(i),!0)===-1?t:i})};i.prototype.sum=function(n,t){!n||t||Bridge.isFunction(n)||(t=n,n=null);n==null&&(n=f.Identity);var i=this.select(n).aggregate(0,function(n,t){return n instanceof System.Decimal||System.Int64.is64Bit(n)?n.add(t):t instanceof System.Decimal||System.Int64.is64Bit(t)?t.add(n):n+t});return i===0&&t?t:i};i.prototype.nullableSum=function(n,t){return this.any(Bridge.isNull)?null:this.sum(n,t)};i.prototype.elementAt=function(n){var t,i=!1;if(this.forEach(function(r,u){if(u==n)return t=r,i=!0,!1}),!i)throw new Error("index is less than 0 or greater than or equal to the number of elements in source.");return t};i.prototype.elementAtOrDefault=function(n,i){i===t&&(i=null);var r,u=!1;return this.forEach(function(t,i){if(i==n)return r=t,u=!0,!1}),u?r:i};i.prototype.first=function(n){if(n!=null)return this.where(n).first();var t,i=!1;if(this.forEach(function(n){return t=n,i=!0,!1}),!i)throw new Error("first:No element satisfies the condition.");return t};i.prototype.firstOrDefault=function(n,i){if(i===t&&(i=null),n!=null)return this.where(n).firstOrDefault(null,i);var r,u=!1;return this.forEach(function(n){return r=n,u=!0,!1}),u?r:i};i.prototype.last=function(n){if(n!=null)return this.where(n).last();var t,i=!1;if(this.forEach(function(n){i=!0;t=n}),!i)throw new Error("last:No element satisfies the condition.");return t};i.prototype.lastOrDefault=function(n,i){if(i===t&&(i=null),n!=null)return this.where(n).lastOrDefault(null,i);var r,u=!1;return this.forEach(function(n){u=!0;r=n}),u?r:i};i.prototype.single=function(n){if(n!=null)return this.where(n).single();var i,t=!1;if(this.forEach(function(n){if(t)throw new Error("single:sequence contains more than one element.");else t=!0,i=n}),!t)throw new Error("single:No element satisfies the condition.");return i};i.prototype.singleOrDefault=function(n,i){if(i===t&&(i=null),n!=null)return this.where(n).singleOrDefault(null,i);var u,r=!1;return this.forEach(function(n){if(r)throw new Error("single:sequence contains more than one element.");else r=!0,u=n}),r?u:i};i.prototype.skip=function(n){var t=this;return new i(function(){var i,f=0;return new u(function(){for(i=t.getEnumerator();f++<n&&i.moveNext(););},function(){return i.moveNext()?this.yieldReturn(i.getCurrent()):!1},function(){r.dispose(i)})})};i.prototype.skipWhile=function(n){n=r.createLambda(n);var t=this;return new i(function(){var i,e=0,f=!1;return new u(function(){i=t.getEnumerator()},function(){while(!f)if(i.moveNext()){if(!n(i.getCurrent(),e++))return f=!0,this.yieldReturn(i.getCurrent());continue}else return!1;return i.moveNext()?this.yieldReturn(i.getCurrent()):!1},function(){r.dispose(i)})})};i.prototype.take=function(n){var t=this;return new i(function(){var i,f=0;return new u(function(){i=t.getEnumerator()},function(){return f++<n&&i.moveNext()?this.yieldReturn(i.getCurrent()):!1},function(){r.dispose(i)})})};i.prototype.takeWhile=function(n){n=r.createLambda(n);var t=this;return new i(function(){var i,f=0;return new u(function(){i=t.getEnumerator()},function(){return i.moveNext()&&n(i.getCurrent(),f++)?this.yieldReturn(i.getCurrent()):!1},function(){r.dispose(i)})})};i.prototype.takeExceptLast=function(n){n==null&&(n=1);var t=this;return new i(function(){if(n<=0)return t.getEnumerator();var i,f=[];return new u(function(){i=t.getEnumerator()},function(){while(i.moveNext()){if(f.length==n)return f.push(i.getCurrent()),this.yieldReturn(f.shift());f.push(i.getCurrent())}return!1},function(){r.dispose(i)})})};i.prototype.takeFromLast=function(n){if(n<=0||n==null)return i.empty();var t=this;return new i(function(){var o,f,e=[];return new u(function(){o=t.getEnumerator()},function(){if(f==null){while(o.moveNext())e.length==n&&e.shift(),e.push(o.getCurrent());f=i.from(e).getEnumerator()}return f.moveNext()?this.yieldReturn(f.getCurrent()):!1},function(){r.dispose(f)})})};i.prototype.indexOf=function(n,t){var i=null;return typeof n===o.Function?this.forEach(function(t,r){if(n(t,r))return i=r,!1}):(t=t||System.Collections.Generic.EqualityComparer$1.$default,this.forEach(function(r,u){if(t.equals2(r,n))return i=u,!1})),i!==null?i:-1};i.prototype.lastIndexOf=function(n,t){var i=-1;return typeof n===o.Function?this.forEach(function(t,r){n(t,r)&&(i=r)}):(t=t||System.Collections.Generic.EqualityComparer$1.$default,this.forEach(function(r,u){t.equals2(r,n)&&(i=u)})),i};i.prototype.asEnumerable=function(){return i.from(this)};i.prototype.toArray=function(){var n=[];return this.forEach(function(t){n.push(t)}),n};i.prototype.toList=function(n){var t=[];return this.forEach(function(n){t.push(n)}),new(System.Collections.Generic.List$1(n||Object))(t)};i.prototype.toLookup=function(n,t,i){n=r.createLambda(n);t=r.createLambda(t);var u=new(System.Collections.Generic.Dictionary$2(Object,Object))(null,i),f=[];return this.forEach(function(i){var r=n(i),e=t(i),o={v:null};u.tryGetValue(r,o)?o.v.push(e):(f.push(r),u.add(r,[e]))}),new p(u,f)};i.prototype.toObject=function(n,t){n=r.createLambda(n);t=r.createLambda(t);var i={};return this.forEach(function(r){i[n(r)]=t(r)}),i};i.prototype.toDictionary=function(n,t,i,u,f){n=r.createLambda(n);t=r.createLambda(t);var e=new(System.Collections.Generic.Dictionary$2(i,u))(null,f);return this.forEach(function(i){e.add(n(i),t(i))}),e};i.prototype.toJSONString=function(n,t){if(typeof JSON===o.Undefined||JSON.stringify==null)throw new Error("toJSONString can't find JSON.stringify. This works native JSON support Browser or include json2.js");return JSON.stringify(this.toArray(),n,t)};i.prototype.toJoinedString=function(n,t){return n==null&&(n=""),t==null&&(t=f.Identity),this.select(t).toArray().join(n)};i.prototype.doAction=function(n){var t=this;return n=r.createLambda(n),new i(function(){var i,f=0;return new u(function(){i=t.getEnumerator()},function(){return i.moveNext()?(n(i.getCurrent(),f++),this.yieldReturn(i.getCurrent())):!1},function(){r.dispose(i)})})};i.prototype.forEach=function(n){n=r.createLambda(n);var i=0,t=this.getEnumerator();try{while(t.moveNext())if(n(t.getCurrent(),i++)===!1)break}finally{r.dispose(t)}};i.prototype.write=function(n,t){n==null&&(n="");t=r.createLambda(t);var i=!0;this.forEach(function(r){i?i=!1:document.write(n);document.write(t(r))})};i.prototype.writeLine=function(n){n=r.createLambda(n);this.forEach(function(t){document.writeln(n(t)+"<br />")})};i.prototype.force=function(){var n=this.getEnumerator();try{while(n.moveNext());}finally{r.dispose(n)}};i.prototype.letBind=function(n){n=r.createLambda(n);var t=this;return new i(function(){var f;return new u(function(){f=i.from(n(t)).getEnumerator()},function(){return f.moveNext()?this.yieldReturn(f.getCurrent()):!1},function(){r.dispose(f)})})};i.prototype.share=function(){var i=this,n,t=!1;return new y(function(){return new u(function(){n==null&&(n=i.getEnumerator())},function(){if(t)throw new Error("enumerator is disposed");return n.moveNext()?this.yieldReturn(n.getCurrent()):!1},f.Blank)},function(){t=!0;r.dispose(n)})};i.prototype.memoize=function(){var e=this,n,t,i=!1;return new y(function(){var r=-1;return new u(function(){t==null&&(t=e.getEnumerator(),n=[])},function(){if(i)throw new Error("enumerator is disposed");return(r++,n.length<=r)?t.moveNext()?this.yieldReturn(n[r]=t.getCurrent()):!1:this.yieldReturn(n[r])},f.Blank)},function(){i=!0;r.dispose(t);n=null})};i.prototype.catchError=function(n){n=r.createLambda(n);var t=this;return new i(function(){var i;return new u(function(){i=t.getEnumerator()},function(){try{return i.moveNext()?this.yieldReturn(i.getCurrent()):!1}catch(t){return n(t),!1}},function(){r.dispose(i)})})};i.prototype.finallyAction=function(n){n=r.createLambda(n);var t=this;return new i(function(){var i;return new u(function(){i=t.getEnumerator()},function(){return i.moveNext()?this.yieldReturn(i.getCurrent()):!1},function(){try{r.dispose(i)}finally{n()}})})};i.prototype.log=function(n){return n=r.createLambda(n),this.doAction(function(t){typeof console!==o.Undefined&&console.log(n(t))})};i.prototype.trace=function(n,t){return n==null&&(n="Trace"),t=r.createLambda(t),this.doAction(function(i){typeof console!==o.Undefined&&console.log(n,t(i))})};s=function(n,t,i,u,f){this.source=n;this.keySelector=r.createLambda(t);this.comparer=i||System.Collections.Generic.Comparer$1.$default;this.descending=u;this.parent=f};s.prototype=new i;s.prototype.createOrderedEnumerable=function(n,t,i){return new s(this.source,n,t,i,this)};s.prototype.thenBy=function(n,t){return this.createOrderedEnumerable(n,t,!1)};s.prototype.thenByDescending=function(n,t){return this.createOrderedEnumerable(n,t,!0)};s.prototype.getEnumerator=function(){var i=this,t,n,r=0;return new u(function(){t=[];n=[];i.source.forEach(function(i,r){t.push(i);n.push(r)});var r=a.create(i,null);r.GenerateKeys(t);n.sort(function(n,t){return r.compare(n,t)})},function(){return r<n.length?this.yieldReturn(t[n[r++]]):!1},f.Blank)};a=function(n,t,i,r){this.keySelector=n;this.comparer=t;this.descending=i;this.child=r;this.keys=null};a.create=function(n,t){var i=new a(n.keySelector,n.comparer,n.descending,t);return n.parent!=null?a.create(n.parent,i):i};a.prototype.GenerateKeys=function(n){for(var i=n.length,u=this.keySelector,r=new Array(i),t=0;t<i;t++)r[t]=u(n[t]);this.keys=r;this.child!=null&&this.child.GenerateKeys(n)};a.prototype.compare=function(n,t){var i=this.comparer.compare(this.keys[n],this.keys[t]);return i==0?this.child!=null?this.child.compare(n,t):r.compare(n,t):this.descending?-i:i};y=function(n,t){this.dispose=t;i.call(this,n)};y.prototype=new i;e=function(n){this.getSource=function(){return n}};e.prototype=new i;e.prototype.any=function(n){return n==null?this.getSource().length>0:i.prototype.any.apply(this,arguments)};e.prototype.count=function(n){return n==null?this.getSource().length:i.prototype.count.apply(this,arguments)};e.prototype.elementAt=function(n){var t=this.getSource();return 0<=n&&n<t.length?t[n]:i.prototype.elementAt.apply(this,arguments)};e.prototype.elementAtOrDefault=function(n,i){i===t&&(i=null);var r=this.getSource();return 0<=n&&n<r.length?r[n]:i};e.prototype.first=function(n){var t=this.getSource();return n==null&&t.length>0?t[0]:i.prototype.first.apply(this,arguments)};e.prototype.firstOrDefault=function(n,r){if(r===t&&(r=null),n!=null)return i.prototype.firstOrDefault.apply(this,arguments);var u=this.getSource();return u.length>0?u[0]:r};e.prototype.last=function(n){var t=this.getSource();return n==null&&t.length>0?t[t.length-1]:i.prototype.last.apply(this,arguments)};e.prototype.lastOrDefault=function(n,r){if(r===t&&(r=null),n!=null)return i.prototype.lastOrDefault.apply(this,arguments);var u=this.getSource();return u.length>0?u[u.length-1]:r};e.prototype.skip=function(n){var t=this.getSource();return new i(function(){var i;return new u(function(){i=n<0?0:n},function(){return i<t.length?this.yieldReturn(t[i++]):!1},f.Blank)})};e.prototype.takeExceptLast=function(n){return n==null&&(n=1),this.take(this.getSource().length-n)};e.prototype.takeFromLast=function(n){return this.skip(this.getSource().length-n)};e.prototype.reverse=function(){var n=this.getSource();return new i(function(){var t;return new u(function(){t=n.length},function(){return t>0?this.yieldReturn(n[--t]):!1},f.Blank)})};e.prototype.sequenceEqual=function(n,t){return(n instanceof e||n instanceof Array)&&t==null&&i.from(n).count()!=this.count()?!1:i.prototype.sequenceEqual.apply(this,arguments)};e.prototype.toJoinedString=function(n,t){var r=this.getSource();return t!=null||!(r instanceof Array)?i.prototype.toJoinedString.apply(this,arguments):(n==null&&(n=""),r.join(n))};e.prototype.getEnumerator=function(){return new Bridge.ArrayEnumerator(this.getSource())};h=function(n,t){this.prevSource=n;this.prevPredicate=t};h.prototype=new i;h.prototype.where=function(n){if(n=r.createLambda(n),n.length<=1){var t=this.prevPredicate,u=function(i){return t(i)&&n(i)};return new h(this.prevSource,u)}return i.prototype.where.call(this,n)};h.prototype.select=function(n){return n=r.createLambda(n),n.length<=1?new c(this.prevSource,this.prevPredicate,n):i.prototype.select.call(this,n)};h.prototype.getEnumerator=function(){var t=this.prevPredicate,i=this.prevSource,n;return new u(function(){n=i.getEnumerator()},function(){while(n.moveNext())if(t(n.getCurrent()))return this.yieldReturn(n.getCurrent());return!1},function(){r.dispose(n)})};c=function(n,t,i){this.prevSource=n;this.prevPredicate=t;this.prevSelector=i};c.prototype=new i;c.prototype.where=function(n){return n=r.createLambda(n),n.length<=1?new h(this,n):i.prototype.where.call(this,n)};c.prototype.select=function(n){if(n=r.createLambda(n),n.length<=1){var t=this.prevSelector,u=function(i){return n(t(i))};return new c(this.prevSource,this.prevPredicate,u)}return i.prototype.select.call(this,n)};c.prototype.getEnumerator=function(){var t=this.prevPredicate,i=this.prevSelector,f=this.prevSource,n;return new u(function(){n=f.getEnumerator()},function(){while(n.moveNext())if(t==null||t(n.getCurrent()))return this.yieldReturn(i(n.getCurrent()));return!1},function(){r.dispose(n)})};p=function(n,t){this.count=function(){return n.getCount()};this.get=function(t){var r={v:null},u=n.tryGetValue(t,r);return i.from(u?r.v:[])};this.contains=function(t){return n.containsKey(t)};this.toEnumerable=function(){return i.from(t).select(function(t){return new v(t,n.get(t))})};this.getEnumerator=function(){return this.toEnumerable().getEnumerator()}};p.$$inherits=[];Bridge.Class.addExtend(p,[System.Collections.IEnumerable]);v=function(n,t){this.key=function(){return n};e.call(this,t)};v.prototype=new e;v.$$inherits=[];Bridge.Class.addExtend(v,[System.Collections.IEnumerable]);Bridge.Linq={};Bridge.Linq.Enumerable=i;System.Linq={};System.Linq.Enumerable=i}(Bridge.global);Bridge.define("System.Guid",{inherits:function(){return[System.IEquatable$1(System.Guid),System.IComparable$1(System.Guid),System.IFormattable]},$kind:"struct",statics:{error1:"Byte array for GUID must be exactly {0} bytes long",valid:null,split:null,nonFormat:null,replace:null,rnd:null,config:{init:function(){this.valid=new RegExp("^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$","i");this.split=new RegExp("^(.{8})(.{4})(.{4})(.{4})(.{12})$");this.nonFormat=new RegExp("^[{(]?([0-9a-f]{8})-?([0-9a-f]{4})-?([0-9a-f]{4})-?([0-9a-f]{4})-?([0-9a-f]{12})[)}]?$","i");this.replace=new RegExp("-","g");this.rnd=new System.Random.ctor;this.empty=new System.Guid.ctor}},parse:function(n){return System.Guid.parseExact(n,null)},parseExact:function(n,t){var i=new System.Guid.ctor;return i.parseInternal(n,t,!0),i},tryParse:function(n,t){return System.Guid.tryParseExact(n,null,t)},tryParseExact:function(n,t,i){return i.v=new System.Guid.ctor,i.v.parseInternal(n,t,!1)},newGuid:function(){var n=System.Array.init(16,0);return System.Guid.rnd.nextBytes(n),n[7]=(n[7]&15|64)&255,n[8]=(n[8]&191|128)&255,new System.Guid.$ctor1(n)},makeBinary:function(n){return System.Int32.format(n&255,"x2")},op_Equality:function(n,t){return Bridge.referenceEquals(n,null)?Bridge.referenceEquals(t,null):n.equalsT(t)},op_Inequality:function(n,t){return!System.Guid.op_Equality(n,t)},getDefaultValue:function(){return new System.Guid}},_a:0,_b:0,_c:0,_d:0,_e:0,_f:0,_g:0,_h:0,_i:0,_j:0,_k:0,config:{alias:["equalsT","System$IEquatable$1$System$Guid$equalsT","compareTo","System$IComparable$1$System$Guid$compareTo","format","System$IFormattable$format"]},$ctor4:function(n){this.$initialize();(new System.Guid.ctor).$clone(this);this.parseInternal(n,null,!0)},$ctor1:function(n){if(this.$initialize(),n==null)throw new System.ArgumentNullException("b");if(n.length!==16)throw new System.ArgumentException(System.String.format(System.Guid.error1,16));this._a=n[3]<<24|n[2]<<16|n[1]<<8|n[0];this._b=Bridge.Int.sxs((n[5]<<8|n[4])&65535);this._c=Bridge.Int.sxs((n[7]<<8|n[6])&65535);this._d=n[8];this._e=n[9];this._f=n[10];this._g=n[11];this._h=n[12];this._i=n[13];this._j=n[14];this._k=n[15]},$ctor5:function(n,t,i,r,u,f,e,o,s,h,c){this.$initialize();this._a=n|0;this._b=Bridge.Int.sxs(t&65535);this._c=Bridge.Int.sxs(i&65535);this._d=r;this._e=u;this._f=f;this._g=e;this._h=o;this._i=s;this._j=h;this._k=c},$ctor3:function(n,t,i,r){if(this.$initialize(),r==null)throw new System.ArgumentNullException("d");if(r.length!==8)throw new System.ArgumentException(System.String.format(System.Guid.error1,8));this._a=n;this._b=t;this._c=i;this._d=r[0];this._e=r[1];this._f=r[2];this._g=r[3];this._h=r[4];this._i=r[5];this._j=r[6];this._k=r[7]},$ctor2:function(n,t,i,r,u,f,e,o,s,h,c){this.$initialize();this._a=n;this._b=t;this._c=i;this._d=r;this._e=u;this._f=f;this._g=e;this._h=o;this._i=s;this._j=h;this._k=c},ctor:function(){this.$initialize()},equalsT:function(n){return this._a!==n._a||this._b!==n._b||this._c!==n._c||this._d!==n._d||this._e!==n._e||this._f!==n._f||this._g!==n._g||this._h!==n._h||this._i!==n._i||this._j!==n._j||this._k!==n._k?!1:!0},compareTo:function(n){return System.String.compare(this.toString(),n.toString())},toString:function(){return this.format$1(null)},toString$1:function(n){return this.format$1(n)},format:function(n){return this.format$1(n)},toByteArray:function(){var n=System.Array.init(16,0);return n[0]=this._a&255,n[1]=this._a>>8&255,n[2]=this._a>>16&255,n[3]=this._a>>24&255,n[4]=this._b&255,n[5]=this._b>>8&255,n[6]=this._c&255,n[7]=this._c>>8&255,n[8]=this._d,n[9]=this._e,n[10]=this._f,n[11]=this._g,n[12]=this._h,n[13]=this._i,n[14]=this._j,n[15]=this._k,n},parseInternal:function(n,t,i){var u=null,f,r,e,o;if(System.String.isNullOrEmpty(n))throw new System.ArgumentNullException("input");if(System.String.isNullOrEmpty(t)?(f=System.Guid.nonFormat.exec(n),f!=null&&(u=f.slice(1).join("-").toLowerCase())):(t=t.toUpperCase(),r=!1,Bridge.referenceEquals(t,"N")?(e=System.Guid.split.exec(n),e!=null&&(r=!0,n=e.slice(1).join("-"))):Bridge.referenceEquals(t,"B")||Bridge.referenceEquals(t,"P")?(o=Bridge.referenceEquals(t,"B")?[123,125]:[40,41],n.charCodeAt(0)===o[0]&&n.charCodeAt(n.length-1|0)===o[1]&&(r=!0,n=n.substr(1,n.length-2|0))):r=!0,r&&n.match(System.Guid.valid)!=null&&(u=n.toLowerCase())),u!=null)return this.fromString(u),!0;if(i)throw new System.FormatException("input is not in a recognized format");return!1},format$1:function(n){var t=System.String.concat(System.UInt32.format(this._a>>>0,"x8"),System.UInt16.format(this._b&65535,"x4"),System.UInt16.format(this._c&65535,"x4"));t=System.String.concat(t,[this._d,this._e,this._f,this._g,this._h,this._i,this._j,this._k].map(System.Guid.makeBinary).join(""));t=System.Guid.split.exec(t).slice(1).join("-");switch(n){case"n":case"N":return t.replace(System.Guid.replace,"");case"b":case"B":return System.String.concat(String.fromCharCode(123),t,String.fromCharCode(125));case"p":case"P":return System.String.concat(String.fromCharCode(40),t,String.fromCharCode(41));default:return t}},fromString:function(n){var t,i;if(!System.String.isNullOrEmpty(n)){for(n=n.replace(System.Guid.replace,""),t=System.Array.init(8,0),this._a=System.UInt32.parse(n.substr(0,8),16)|0,this._b=Bridge.Int.sxs(System.UInt16.parse(n.substr(8,4),16)&65535),this._c=Bridge.Int.sxs(System.UInt16.parse(n.substr(12,4),16)&65535),i=8;i<16;i=i+1|0)t[i-8|0]=System.Byte.parse(n.substr(i*2|0,2),16);this._d=t[0];this._e=t[1];this._f=t[2];this._g=t[3];this._h=t[4];this._i=t[5];this._j=t[6];this._k=t[7]}},getHashCode:function(){return Bridge.addHash([1684632903,this._a,this._b,this._c,this._d,this._e,this._f,this._g,this._h,this._i,this._j,this._k])},$clone:function(){return this}});Bridge.define("System.Text.RegularExpressions.Regex",{statics:{_cacheSize:15,_defaultMatchTimeout:System.TimeSpan.fromMilliseconds(-1),getCacheSize:function(){return System.Text.RegularExpressions.Regex._cacheSize},setCacheSize:function(n){if(n<0)throw new System.ArgumentOutOfRangeException("value");System.Text.RegularExpressions.Regex._cacheSize=n},escape:function(n){if(n==null)throw new System.ArgumentNullException("str");return System.Text.RegularExpressions.RegexParser.escape(n)},unescape:function(n){if(n==null)throw new System.ArgumentNullException("str");return System.Text.RegularExpressions.RegexParser.unescape(n)},isMatch:function(n,t){var i=System.Text.RegularExpressions;return i.Regex.isMatch$2(n,t,i.RegexOptions.None,i.Regex._defaultMatchTimeout)},isMatch$1:function(n,t,i){var r=System.Text.RegularExpressions;return r.Regex.isMatch$2(n,t,i,r.Regex._defaultMatchTimeout)},isMatch$2:function(n,t,i,r){var u=new System.Text.RegularExpressions.Regex.$ctor3(t,i,r,!0);return u.isMatch(n)},match:function(n,t){var i=System.Text.RegularExpressions;return i.Regex.match$2(n,t,i.RegexOptions.None,i.Regex._defaultMatchTimeout)},match$1:function(n,t,i){var r=System.Text.RegularExpressions;return r.Regex.match$2(n,t,i,r.Regex._defaultMatchTimeout)},match$2:function(n,t,i,r){var u=new System.Text.RegularExpressions.Regex.$ctor3(t,i,r,!0);return u.match(n)},matches:function(n,t){var i=System.Text.RegularExpressions;return i.Regex.matches$2(n,t,i.RegexOptions.None,i.Regex._defaultMatchTimeout)},matches$1:function(n,t,i){var r=System.Text.RegularExpressions;return r.Regex.matches$2(n,t,i,r.Regex._defaultMatchTimeout)},matches$2:function(n,t,i,r){var u=new System.Text.RegularExpressions.Regex.$ctor3(t,i,r,!0);return u.matches(n)},replace:function(n,t,i){var r=System.Text.RegularExpressions;return r.Regex.replace$2(n,t,i,r.RegexOptions.None,r.Regex._defaultMatchTimeout)},replace$1:function(n,t,i,r){var u=System.Text.RegularExpressions;return u.Regex.replace$2(n,t,i,r,u.Regex._defaultMatchTimeout)},replace$2:function(n,t,i,r,u){var f=new System.Text.RegularExpressions.Regex.$ctor3(t,r,u,!0);return f.replace(n,i)},replace$3:function(n,t,i){var r=System.Text.RegularExpressions;return r.Regex.replace$5(n,t,i,r.RegexOptions.None,r.Regex._defaultMatchTimeout)},replace$4:function(n,t,i,r){var u=System.Text.RegularExpressions;return u.Regex.replace$5(n,t,i,r,u.Regex._defaultMatchTimeout)},replace$5:function(n,t,i,r,u){var f=new System.Text.RegularExpressions.Regex.$ctor3(t,r,u,!0);return f.replace$3(n,i)},split:function(n,t){var i=System.Text.RegularExpressions;return i.Regex.split$2(n,t,i.RegexOptions.None,i.Regex._defaultMatchTimeout)},split$1:function(n,t,i){var r=System.Text.RegularExpressions;return r.Regex.split$2(n,t,i,r.Regex._defaultMatchTimeout)},split$2:function(n,t,i,r){var u=new System.Text.RegularExpressions.Regex.$ctor3(t,i,r,!0);return u.split(n)}},_pattern:"",_matchTimeout:System.TimeSpan.fromMilliseconds(-1),_runner:null,_caps:null,_capsize:0,_capnames:null,_capslist:null,config:{init:function(){this._options=System.Text.RegularExpressions.RegexOptions.None}},ctor:function(n){this.$ctor1(n,System.Text.RegularExpressions.RegexOptions.None)},$ctor1:function(n,t){this.$ctor2(n,t,System.TimeSpan.fromMilliseconds(-1))},$ctor2:function(n,t,i){this.$ctor3(n,t,i,!1)},$ctor3:function(n,t,i){var r,u,f;if(this.$initialize(),r=System.Text.RegularExpressions,n==null)throw new System.ArgumentNullException("pattern");if(t<r.RegexOptions.None||t>>10!=0)throw new System.ArgumentOutOfRangeException("options");if((t&r.RegexOptions.ECMAScript)!=0&&(t&~(r.RegexOptions.ECMAScript|r.RegexOptions.IgnoreCase|r.RegexOptions.Multiline|r.RegexOptions.CultureInvariant))!=0)throw new System.ArgumentOutOfRangeException("options");if(u=System.Text.RegularExpressions.RegexOptions.IgnoreCase|System.Text.RegularExpressions.RegexOptions.Multiline|System.Text.RegularExpressions.RegexOptions.Singleline|System.Text.RegularExpressions.RegexOptions.IgnorePatternWhitespace|System.Text.RegularExpressions.RegexOptions.ExplicitCapture,(t|u)!==u)throw new System.NotSupportedException("Specified Regex options are not supported.");this._validateMatchTimeout(i);this._pattern=n;this._options=t;this._matchTimeout=i;this._runner=new r.RegexRunner(this);f=this._runner.parsePattern();this._capnames=f.sparseSettings.sparseSlotNameMap;this._capslist=f.sparseSettings.sparseSlotNameMap.keys;this._capsize=this._capslist.length},getMatchTimeout:function(){return this._matchTimeout},getOptions:function(){return this._options},getRightToLeft:function(){return(this._options&System.Text.RegularExpressions.RegexOptions.RightToLeft)!=0},isMatch:function(n){if(n==null)throw new System.ArgumentNullException("input");var t=this.getRightToLeft()?n.length:0;return this.isMatch$1(n,t)},isMatch$1:function(n,t){if(n==null)throw new System.ArgumentNullException("input");var i=this._runner.run(!0,-1,n,0,n.length,t);return i==null},match:function(n){if(n==null)throw new System.ArgumentNullException("input");var t=this.getRightToLeft()?n.length:0;return this.match$1(n,t)},match$1:function(n,t){if(n==null)throw new System.ArgumentNullException("input");return this._runner.run(!1,-1,n,0,n.length,t)},match$2:function(n,t,i){if(n==null)throw new System.ArgumentNullException("input");var r=this.getRightToLeft()?t+i:t;return this._runner.run(!1,-1,n,t,i,r)},matches:function(n){if(n==null)throw new System.ArgumentNullException("input");var t=this.getRightToLeft()?n.length:0;return this.matches$1(n,t)},matches$1:function(n,t){if(n==null)throw new System.ArgumentNullException("input");return new System.Text.RegularExpressions.MatchCollection(this,n,0,n.length,t)},getGroupNames:function(){if(this._capslist==null){for(var i=System.Globalization.CultureInfo.invariantCulture,t=[],r=this._capsize,n=0;n<r;n++)t[n]=System.Convert.toString(n,i,System.Convert.typeCodes.Int32);return t}return this._capslist.slice()},getGroupNumbers:function(){var t=this._caps,n,i,u,r;if(t==null)for(n=[],u=this._capsize,r=0;r<u;r++)n.push(r);else{n=[];for(i in t)t.hasOwnProperty(i)&&(n[t[i]]=i)}return n},groupNameFromNumber:function(n){var i,t;return this._capslist==null?n>=0&&n<this._capsize?(i=System.Globalization.CultureInfo.invariantCulture,System.Convert.toString(n,i,System.Convert.typeCodes.Int32)):"":this._caps!=null?(t=this._caps[n],t==null)?"":parseInt(t):n>=0&&n<this._capslist.length?this._capslist[n]:""},groupNumberFromName:function(n){var u,t,i,r;if(n==null)throw new System.ArgumentNullException("name");if(this._capnames!=null)return(u=this._capnames[n],u==null)?-1:parseInt(u);for(t=0,r=0;r<n.Length;r++){if(i=n[r],i>"9"||i<"0")return-1;t*=10;t+=i-"0"}return t>=0&&t<this._capsize?t:-1},replace:function(n,t){if(n==null)throw new System.ArgumentNullException("input");var i=this.getRightToLeft()?n.length:0;return this.replace$2(n,t,-1,i)},replace$1:function(n,t,i){if(n==null)throw new System.ArgumentNullException("input");var r=this.getRightToLeft()?n.length:0;return this.replace$2(n,t,i,r)},replace$2:function(n,t,i,r){if(n==null)throw new System.ArgumentNullException("input");if(t==null)throw new System.ArgumentNullException("replacement");var u=System.Text.RegularExpressions.RegexParser.parseReplacement(t,this._caps,this._capsize,this._capnames,this._options);return u.replace(this,n,i,r)},replace$3:function(n,t){if(n==null)throw new System.ArgumentNullException("input");var i=this.getRightToLeft()?n.length:0;return this.replace$5(n,t,-1,i)},replace$4:function(n,t,i){if(n==null)throw new System.ArgumentNullException("input");var r=this.getRightToLeft()?n.length:0;return this.replace$5(n,t,i,r)},replace$5:function(n,t,i,r){if(n==null)throw new System.ArgumentNullException("input");return System.Text.RegularExpressions.RegexReplacement.replace(t,this,n,i,r)},split:function(n){if(n==null)throw new System.ArgumentNullException("input");var t=this.getRightToLeft()?n.length:0;return this.split$2(n,0,t)},split$1:function(n,t){if(n==null)throw new System.ArgumentNullException("input");var i=this.getRightToLeft()?n.length:0;return this.split$2(n,t,i)},split$2:function(n,t,i){if(n==null)throw new System.ArgumentNullException("input");return System.Text.RegularExpressions.RegexReplacement.split(this,n,t,i)},_validateMatchTimeout:function(n){var t=n.getTotalMilliseconds();if(-1!==t&&(!(t>0)||!(t<=2147483646)))throw new System.ArgumentOutOfRangeException("matchTimeout");}});Bridge.define("System.Text.RegularExpressions.Capture",{_text:"",_index:0,_length:0,ctor:function(n,t,i){this.$initialize();this._text=n;this._index=t;this._length=i},getIndex:function(){return this._index},getLength:function(){return this._length},getValue:function(){return this._text.substr(this._index,this._length)},toString:function(){return this.getValue()},_getOriginalString:function(){return this._text},_getLeftSubstring:function(){return this._text.slice(0,_index)},_getRightSubstring:function(){return this._text.slice(this._index+this._length,this._text.length)}});Bridge.define("System.Text.RegularExpressions.CaptureCollection",{inherits:function(){return[System.Collections.ICollection]},config:{alias:["getEnumerator","System$Collections$IEnumerable$getEnumerator","getCount","System$Collections$ICollection$getCount"]},_group:null,_capcount:0,_captures:null,ctor:function(n){this.$initialize();this._group=n;this._capcount=n._capcount},getSyncRoot:function(){return this._group},getIsSynchronized:function(){return!1},getIsReadOnly:function(){return!0},getCount:function(){return this._capcount},get:function(n){if(n===this._capcount-1&&n>=0)return this._group;if(n>=this._capcount||n<0)throw new System.ArgumentOutOfRangeException("i");return this._ensureCapturesInited(),this._captures[n]},copyTo:function(n,t){if(n==null)throw new System.ArgumentNullException("array");if(n.length<t+this._capcount)throw new System.IndexOutOfRangeException;for(var u,r=t,i=0;i<this._capcount;r++,i++)u=this.get(i),System.Array.set(n,u,[r])},getEnumerator:function(){return new System.Text.RegularExpressions.CaptureEnumerator(this)},_ensureCapturesInited:function(){var t,n,i,r;if(this._captures==null){for(t=[],t.length=this._capcount,n=0;n<this._capcount-1;n++)i=this._group._caps[n*2],r=this._group._caps[n*2+1],t[n]=new System.Text.RegularExpressions.Capture(this._group._text,i,r);this._capcount>0&&(t[this._capcount-1]=this._group);this._captures=t}}});Bridge.define("System.Text.RegularExpressions.CaptureEnumerator",{inherits:function(){return[System.Collections.IEnumerator]},config:{alias:["getCurrent","System$Collections$IEnumerator$getCurrent","moveNext","System$Collections$IEnumerator$moveNext","reset","System$Collections$IEnumerator$reset"]},_captureColl:null,_curindex:0,ctor:function(n){this.$initialize();this._curindex=-1;this._captureColl=n},moveNext:function(){var n=this._captureColl.getCount();return this._curindex>=n?!1:(this._curindex++,this._curindex<n)},getCurrent:function(){return this.getCapture()},getCapture:function(){if(this._curindex<0||this._curindex>=this._captureColl.getCount())throw new System.InvalidOperationException("Enumeration has either not started or has already finished.");return this._captureColl.get(this._curindex)},reset:function(){this._curindex=-1}});Bridge.define("System.Text.RegularExpressions.Group",{inherits:function(){return[System.Text.RegularExpressions.Capture]},statics:{config:{init:function(){var n=new System.Text.RegularExpressions.Group("",[],0);this.getEmpty=function(){return n}}},synchronized:function(n){if(n==null)throw new System.ArgumentNullException("group");var t=n.getCaptures();return t.getCount()>0&&t.get(0),n}},_caps:null,_capcount:0,_capColl:null,ctor:function(n,t,i){this.$initialize();var r=System.Text.RegularExpressions,u=i===0?0:t[(i-1)*2],f=i===0?0:t[i*2-1];r.Capture.ctor.call(this,n,u,f);this._caps=t;this._capcount=i},getSuccess:function(){return this._capcount!==0},getCaptures:function(){return this._capColl==null&&(this._capColl=new System.Text.RegularExpressions.CaptureCollection(this)),this._capColl}});Bridge.define("System.Text.RegularExpressions.GroupCollection",{inherits:function(){return[System.Collections.ICollection]},config:{alias:["getEnumerator","System$Collections$IEnumerable$getEnumerator","getCount","System$Collections$ICollection$getCount"]},_match:null,_captureMap:null,_groups:null,ctor:function(n,t){this.$initialize();this._match=n;this._captureMap=t},getSyncRoot:function(){return this._match},getIsSynchronized:function(){return!1},getIsReadOnly:function(){return!0},getCount:function(){return this._match._matchcount.length},get:function(n){return this._getGroup(n)},getByName:function(n){if(this._match._regex==null)return System.Text.RegularExpressions.Group.getEmpty();var t=this._match._regex.groupNumberFromName(n);return this._getGroup(t)},copyTo:function(n,t){var r,f,u,i;if(n==null)throw new System.ArgumentNullException("array");if(r=this.getCount(),n.length<t+r)throw new System.IndexOutOfRangeException;for(u=t,i=0;i<r;u++,i++)f=this._getGroup(i),System.Array.set(n,f,[u])},getEnumerator:function(){return new System.Text.RegularExpressions.GroupEnumerator(this)},_getGroup:function(n){var t,i;return this._captureMap!=null?(i=this._captureMap[n],t=i==null?System.Text.RegularExpressions.Group.getEmpty():this._getGroupImpl(i)):t=n>=this._match._matchcount.length||n<0?System.Text.RegularExpressions.Group.getEmpty():this._getGroupImpl(n),t},_getGroupImpl:function(n){return n===0?this._match:(this._ensureGroupsInited(),this._groups[n])},_ensureGroupsInited:function(){var n,i,r,u,t;if(this._groups==null){for(n=[],n.length=this._match._matchcount.length,n.length>0&&(n[0]=this._match),t=0;t<n.length-1;t++)i=this._match._text,r=this._match._matches[t+1],u=this._match._matchcount[t+1],n[t+1]=new System.Text.RegularExpressions.Group(i,r,u);this._groups=n}}});Bridge.define("System.Text.RegularExpressions.GroupEnumerator",{inherits:function(){return[System.Collections.IEnumerator]},config:{alias:["getCurrent","System$Collections$IEnumerator$getCurrent","moveNext","System$Collections$IEnumerator$moveNext","reset","System$Collections$IEnumerator$reset"]},_groupColl:null,_curindex:0,ctor:function(n){this.$initialize();this._curindex=-1;this._groupColl=n},moveNext:function(){var n=this._groupColl.getCount();return this._curindex>=n?!1:(this._curindex++,this._curindex<n)},getCurrent:function(){return this.getCapture()},getCapture:function(){if(this._curindex<0||this._curindex>=this._groupColl.getCount())throw new System.InvalidOperationException("Enumeration has either not started or has already finished.");return this._groupColl.get(this._curindex)},reset:function(){this._curindex=-1}});Bridge.define("System.Text.RegularExpressions.Match",{inherits:function(){return[System.Text.RegularExpressions.Group]},statics:{config:{init:function(){var n=new System.Text.RegularExpressions.Match(null,1,"",0,0,0);this.getEmpty=function(){return n}}},synchronized:function(n){if(n==null)throw new System.ArgumentNullException("match");for(var i=n.getGroups(),u=i.getCount(),r,t=0;t<u;t++)r=i.get(t),System.Text.RegularExpressions.Group.synchronized(r);return n}},_regex:null,_matchcount:null,_matches:null,_textbeg:0,_textend:0,_textstart:0,_groupColl:null,_textpos:0,ctor:function(n,t,i,r,u,f){var s,o,e;for(this.$initialize(),s=System.Text.RegularExpressions,o=[0,0],s.Group.ctor.call(this,i,o,0),this._regex=n,this._matchcount=[],this._matchcount.length=t,e=0;e<t;e++)this._matchcount[e]=0;this._matches=[];this._matches.length=t;this._matches[0]=o;this._textbeg=r;this._textend=r+u;this._textstart=f},getGroups:function(){return this._groupColl==null&&(this._groupColl=new System.Text.RegularExpressions.GroupCollection(this,null)),this._groupColl},nextMatch:function(){return this._regex==null?this:this._regex._runner.run(!1,this._length,this._text,this._textbeg,this._textend-this._textbeg,this._textpos)},result:function(n){if(n==null)throw new System.ArgumentNullException("replacement");if(this._regex==null)throw new System.NotSupportedException("Result cannot be called on a failed Match.");var t=System.Text.RegularExpressions.RegexParser.parseReplacement(n,this._regex._caps,this._regex._capsize,this._regex._capnames,this._regex._options);return t.replacement(this)},_isMatched:function(n){return n<this._matchcount.length&&this._matchcount[n]>0&&this._matches[n][this._matchcount[n]*2-1]!==-2},_addMatch:function(n,t,i){var r,e,f,u;if(this._matches[n]==null&&(this._matches[n]=new Array(2)),r=this._matchcount[n],r*2+2>this._matches[n].length){for(e=this._matches[n],f=new Array(r*8),u=0;u<r*2;u++)f[u]=e[u];this._matches[n]=f}this._matches[n][r*2]=t;this._matches[n][r*2+1]=i;this._matchcount[n]=r+1},_tidy:function(n){var t=this._matches[0];this._index=t[0];this._length=t[1];this._textpos=n;this._capcount=this._matchcount[0]},_groupToStringImpl:function(n){var t=this._matchcount[n];if(t===0)return"";var i=this._matches[n],r=i[(t-1)*2],u=i[t*2-1];return this._text.slice(r,r+u)},_lastGroupToStringImpl:function(){return this._groupToStringImpl(this._matchcount.length-1)}});Bridge.define("System.Text.RegularExpressions.MatchSparse",{inherits:function(){return[System.Text.RegularExpressions.Match]},_caps:null,ctor:function(n,t,i,r,u,f,e){this.$initialize();var o=System.Text.RegularExpressions;o.Match.ctor.call(this,n,i,r,u,f,e);this._caps=t},getGroups:function(){return this._groupColl==null&&(this._groupColl=new System.Text.RegularExpressions.GroupCollection(this,this._caps)),this._groupColl}});Bridge.define("System.Text.RegularExpressions.MatchCollection",{inherits:function(){return[System.Collections.ICollection]},config:{alias:["getEnumerator","System$Collections$IEnumerable$getEnumerator","getCount","System$Collections$ICollection$getCount"]},_regex:null,_input:null,_beginning:0,_length:0,_startat:0,_prevlen:0,_matches:null,_done:!1,ctor:function(n,t,i,r,u){if(this.$initialize(),u<0||u>t.Length)throw new System.ArgumentOutOfRangeException("startat");this._regex=n;this._input=t;this._beginning=i;this._length=r;this._startat=u;this._prevlen=-1;this._matches=[]},getCount:function(){return this._done||this._getMatch(2147483647),this._matches.length},getSyncRoot:function(){return this},getIsSynchronized:function(){return!1},getIsReadOnly:function(){return!0},get:function(n){var t=this._getMatch(n);if(t==null)throw new System.ArgumentOutOfRangeException("i");return t},copyTo:function(n,t){var r,f,u,i;if(n==null)throw new System.ArgumentNullException("array");if(r=this.getCount(),n.length<t+r)throw new System.IndexOutOfRangeException;for(u=t,i=0;i<r;u++,i++)f=this._getMatch(i),System.Array.set(n,f,[u])},getEnumerator:function(){return new System.Text.RegularExpressions.MatchEnumerator(this)},_getMatch:function(n){if(n<0)return null;if(this._matches.length>n)return this._matches[n];if(this._done)return null;var t;do{if(t=this._regex._runner.run(!1,this._prevLen,this._input,this._beginning,this._length,this._startat),!t.getSuccess())return this._done=!0,null;this._matches.push(t);this._prevLen=t._length;this._startat=t._textpos}while(this._matches.length<=n);return t}});Bridge.define("System.Text.RegularExpressions.MatchEnumerator",{inherits:function(){return[System.Collections.IEnumerator]},config:{alias:["getCurrent","System$Collections$IEnumerator$getCurrent","moveNext","System$Collections$IEnumerator$moveNext","reset","System$Collections$IEnumerator$reset"]},_matchcoll:null,_match:null,_curindex:0,_done:!1,ctor:function(n){this.$initialize();this._matchcoll=n},moveNext:function(){return this._done?!1:(this._match=this._matchcoll._getMatch(this._curindex),this._curindex++,this._match==null)?(this._done=!0,!1):!0},getCurrent:function(){if(this._match==null)throw new System.InvalidOperationException("Enumeration has either not started or has already finished.");return this._match},reset:function(){this._curindex=0;this._done=!1;this._match=null}});Bridge.define("System.Text.RegularExpressions.RegexOptions",{statics:{None:0,IgnoreCase:1,Multiline:2,ExplicitCapture:4,Compiled:8,Singleline:16,IgnorePatternWhitespace:32,RightToLeft:64,ECMAScript:256,CultureInvariant:512},$kind:"enum",$flags:!0});Bridge.define("System.Text.RegularExpressions.RegexRunner",{statics:{},_runregex:null,_netEngine:null,_runtext:"",_runtextpos:0,_runtextbeg:0,_runtextend:0,_runtextstart:0,_quick:!1,_prevlen:0,ctor:function(n){if(this.$initialize(),n==null)throw new System.ArgumentNullException("regex");this._runregex=n;var i=n.getOptions(),t=System.Text.RegularExpressions.RegexOptions,r=(i&t.IgnoreCase)===t.IgnoreCase,u=(i&t.Multiline)===t.Multiline,f=(i&t.Singleline)===t.Singleline,e=(i&t.IgnorePatternWhitespace)===t.IgnorePatternWhitespace,o=(i&t.ExplicitCapture)===t.ExplicitCapture,s=n._matchTimeout.getTotalMilliseconds();this._netEngine=new System.Text.RegularExpressions.RegexEngine(n._pattern,r,u,f,e,o,s)},run:function(n,t,i,r,u,f){var e,o,s,h;if(f<0||f>i.Length)throw new System.ArgumentOutOfRangeException("start","Start index cannot be less than 0 or greater than input length.");if(u<0||u>i.Length)throw new ArgumentOutOfRangeException("length","Length cannot be less than 0 or exceed input length.");if(this._runtext=i,this._runtextbeg=r,this._runtextend=r+u,this._runtextstart=f,this._quick=n,this._prevlen=t,this._runregex.getRightToLeft()?(e=this._runtextbeg,o=-1):(e=this._runtextend,o=1),this._prevlen===0){if(this._runtextstart===e)return System.Text.RegularExpressions.Match.getEmpty();this._runtextstart+=o}return s=this._netEngine.match(this._runtext,this._runtextstart),h=this._convertNetEngineResults(s),h},parsePattern:function(){return this._netEngine.parsePattern()},_convertNetEngineResults:function(n){var f,i,t,e,o,r,u,s;if(n.success&&this._quick)return null;if(!n.success)return System.Text.RegularExpressions.Match.getEmpty();for(f=this.parsePattern(),i=f.sparseSettings.isSparse?new System.Text.RegularExpressions.MatchSparse(this._runregex,f.sparseSettings.sparseSlotMap,n.groups.length,this._runtext,0,this._runtext.length,this._runtextstart):new System.Text.RegularExpressions.Match(this._runregex,n.groups.length,this._runtext,0,this._runtext.length,this._runtextstart),r=0;r<n.groups.length;r++)for(t=n.groups[r],o=0,t.descriptor!=null&&(o=this._runregex.groupNumberFromName(t.descriptor.name)),u=0;u<t.captures.length;u++)e=t.captures[u],i._addMatch(o,e.capIndex,e.capLength);return s=n.capIndex+n.capLength,i._tidy(s),i}});Bridge.define("System.Text.RegularExpressions.RegexParser",{statics:{_Q:5,_S:4,_Z:3,_X:2,_E:1,_category:[0,0,0,0,0,0,0,0,0,2,2,0,2,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,0,0,3,4,0,0,0,4,4,5,5,0,0,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4,4,0,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5,4,0,0,0],escape:function(n){for(var r,i,u,t=0;t<n.length;t++)if(System.Text.RegularExpressions.RegexParser._isMetachar(n[t])){r="";i=n[t];r+=n.slice(0,t);do{r+="\\";switch(i){case"\n":i="n";break;case"\r":i="r";break;case"\t":i="t";break;case"\f":i="f"}for(r+=i,t++,u=t;t<n.length;){if(i=n[t],System.Text.RegularExpressions.RegexParser._isMetachar(i))break;t++}r+=n.slice(u,t)}while(t<n.length);return r}return n},unescape:function(n){for(var f=System.Globalization.CultureInfo.invariantCulture,i,u,r,t=0;t<n.length;t++)if(n[t]==="\\"){i="";r=new System.Text.RegularExpressions.RegexParser(f);r._setPattern(n);i+=n.slice(0,t);do{for(t++,r._textto(t),t<n.length&&(i+=r._scanCharEscape()),t=r._textpos(),u=t;t<n.length&&n[t]!=="\\";)t++;i+=n.slice(u,t)}while(t<n.length);return i}return n},parseReplacement:function(n,t,i,r,u){var o=System.Globalization.CultureInfo.getCurrentCulture(),f=new System.Text.RegularExpressions.RegexParser(o),e;return f._options=u,f._noteCaptures(t,i,r),f._setPattern(n),e=f._scanReplacement(),new System.Text.RegularExpressions.RegexReplacement(n,e,t)},_isMetachar:function(n){var t=n.charCodeAt(0);return t<="|".charCodeAt(0)&&System.Text.RegularExpressions.RegexParser._category[t]>=System.Text.RegularExpressions.RegexParser._E}},_caps:null,_capsize:0,_capnames:null,_pattern:"",_currentPos:0,_concatenation:null,_culture:null,config:{init:function(){this._options=System.Text.RegularExpressions.RegexOptions.None}},ctor:function(n){this.$initialize();this._culture=n;this._caps={}},_noteCaptures:function(n,t,i){this._caps=n;this._capsize=t;this._capnames=i},_setPattern:function(n){n==null&&(n="");this._pattern=n||"";this._currentPos=0},_scanReplacement:function(){this._concatenation=new System.Text.RegularExpressions.RegexNode(System.Text.RegularExpressions.RegexNode.Concatenate,this._options);for(var n,t,i;;){if(n=this._charsRight(),n===0)break;for(t=this._textpos();n>0&&this._rightChar()!=="$";)this._moveRight(),n--;this._addConcatenate(t,this._textpos()-t);n>0&&this._moveRightGetChar()==="$"&&(i=this._scanDollar(),this._concatenation.addChild(i))}return this._concatenation},_addConcatenate:function(n,t){var i,r,u;t!==0&&(t>1?(r=this._pattern.slice(n,n+t),i=new System.Text.RegularExpressions.RegexNode(System.Text.RegularExpressions.RegexNode.Multi,this._options,r)):(u=this._pattern[n],i=new System.Text.RegularExpressions.RegexNode(System.Text.RegularExpressions.RegexNode.One,this._options,u)),this._concatenation.addChild(i))},_useOptionE:function(){return(this._options&System.Text.RegularExpressions.RegexOptions.ECMAScript)!=0},_makeException:function(n){return new System.ArgumentException("Incorrect pattern. "+n)},_scanDollar:function(){var o=214748364,n,f,i,e,h;if(this._charsRight()===0)return new System.Text.RegularExpressions.RegexNode(System.Text.RegularExpressions.RegexNode.One,this._options,"$");var t=this._rightChar(),r,s=this._textpos(),u=s;if(t==="{"&&this._charsRight()>1?(r=!0,this._moveRight(),t=this._rightChar()):r=!1,t>="0"&&t<="9"){if(!r&&this._useOptionE()){for(n=-1,i=t-"0",this._moveRight(),this._isCaptureSlot(i)&&(n=i,u=this._textpos());this._charsRight()>0&&(t=this._rightChar())>="0"&&t<="9";){if(f=t-"0",i>o||i===o&&f>7)throw this._makeException("Capture group is out of range.");i=i*10+f;this._moveRight();this._isCaptureSlot(i)&&(n=i,u=this._textpos())}if(this._textto(u),n>=0)return new System.Text.RegularExpressions.RegexNode(System.Text.RegularExpressions.RegexNode.Ref,this._options,n)}else if(n=this._scanDecimal(),(!r||this._charsRight()>0&&this._moveRightGetChar()==="}")&&this._isCaptureSlot(n))return new System.Text.RegularExpressions.RegexNode(System.Text.RegularExpressions.RegexNode.Ref,this._options,n)}else if(r&&this._isWordChar(t)){if(e=this._scanCapname(),this._charsRight()>0&&this._moveRightGetChar()==="}"&&this._isCaptureName(e))return h=this._captureSlotFromName(e),new System.Text.RegularExpressions.RegexNode(System.Text.RegularExpressions.RegexNode.Ref,this._options,h)}else if(!r){n=1;switch(t){case"$":return this._moveRight(),new System.Text.RegularExpressions.RegexNode(System.Text.RegularExpressions.RegexNode.One,this._options,"$");case"&":n=0;break;case"`":n=System.Text.RegularExpressions.RegexReplacement.LeftPortion;break;case"'":n=System.Text.RegularExpressions.RegexReplacement.RightPortion;break;case"+":n=System.Text.RegularExpressions.RegexReplacement.LastGroup;break;case"_":n=System.Text.RegularExpressions.RegexReplacement.WholeString}if(n!==1)return this._moveRight(),new System.Text.RegularExpressions.RegexNode(System.Text.RegularExpressions.RegexNode.Ref,this._options,n)}return this._textto(s),new System.Text.RegularExpressions.RegexNode(System.Text.RegularExpressions.RegexNode.One,this._options,"$")},_scanDecimal:function(){for(var r=214748364,n=0,t,i;this._charsRight()>0;){if(t=this._rightChar(),t<"0"||t>"9")break;if(i=t-"0",this._moveRight(),n>r||n===r&&i>7)throw this._makeException("Capture group is out of range.");n*=10;n+=i}return n},_scanOctal:function(){var i,n,t;for(t=3,t>this._charsRight()&&(t=this._charsRight()),n=0;t>0&&(i=this._rightChar()-"0")<=7;t-=1)if(this._moveRight(),n*=8,n+=i,this._useOptionE()&&n>=32)break;return n&=255,String.fromCharCode(n)},_scanHex:function(n){var t,i;if(t=0,this._charsRight()>=n)for(;n>0&&(i=this._hexDigit(this._moveRightGetChar()))>=0;n-=1)t*=16,t+=i;if(n>0)throw this._makeException("Insufficient hexadecimal digits.");return t},_hexDigit:function(n){var t,i=n.charCodeAt(0);return(t=i-"0".charCodeAt(0))<=9?t:(t=i-"a".charCodeAt(0))<=5?t+10:(t=i-"A".charCodeAt(0))<=5?t+10:-1},_scanControl:function(){if(this._charsRight()<=0)throw this._makeException("Missing control character.");var t=this._moveRightGetChar(),n=t.charCodeAt(0);if(n>="a".charCodeAt(0)&&n<="z".charCodeAt(0)&&(n=n-("a".charCodeAt(0)-"A".charCodeAt(0))),(n=n-"@".charCodeAt(0))<" ".charCodeAt(0))return String.fromCharCode(n);throw this._makeException("Unrecognized control character.");},_scanCapname:function(){for(var n=this._textpos();this._charsRight()>0;)if(!this._isWordChar(this._moveRightGetChar())){this._moveLeft();break}return _pattern.slice(n,this._textpos())},_scanCharEscape:function(){var n=this._moveRightGetChar(),t;if(n>="0"&&n<="7")return this._moveLeft(),this._scanOctal();switch(n){case"x":return this._scanHex(2);case"u":return this._scanHex(4);case"a":return"\x07";case"b":return"\b";case"e":return"\x1b";case"f":return"\f";case"n":return"\n";case"r":return"\r";case"t":return"\t";case"v":return"\x0b";case"c":return this._scanControl();default:if(t=n==="8"||n==="9"||n==="_",t||!this._useOptionE()&&this._isWordChar(n))throw this._makeException("Unrecognized escape sequence \\"+n+".");return n}},_captureSlotFromName:function(n){return this._capnames[n]},_isCaptureSlot:function(n){return this._caps!=null?this._caps[n]!=null:n>=0&&n<this._capsize},_isCaptureName:function(n){return this._capnames==null?!1:_capnames[n]!=null},_isWordChar:function(n){return System.Char.isLetter(n.charCodeAt(0))},_charsRight:function(){return this._pattern.length-this._currentPos},_rightChar:function(){return this._pattern[this._currentPos]},_moveRightGetChar:function(){return this._pattern[this._currentPos++]},_moveRight:function(){this._currentPos++},_textpos:function(){return this._currentPos},_textto:function(n){this._currentPos=n},_moveLeft:function(){this._currentPos--}});Bridge.define("System.Text.RegularExpressions.RegexNode",{statics:{One:9,Multi:12,Ref:13,Empty:23,Concatenate:25},_type:0,_str:null,_children:null,_next:null,_m:0,config:{init:function(){this._options=System.Text.RegularExpressions.RegexOptions.None}},ctor:function(n,t,i){this.$initialize();this._type=n;this._options=t;n===System.Text.RegularExpressions.RegexNode.Ref?this._m=i:this._str=i||null},addChild:function(n){this._children==null&&(this._children=[]);var t=n._reduce();this._children.push(t);t._next=this},childCount:function(){return this._children==null?0:this._children.length},child:function(n){return this._children[n]},_reduce:function(){var n;switch(this._type){case System.Text.RegularExpressions.RegexNode.Concatenate:n=this._reduceConcatenation();break;default:n=this}return n},_reduceConcatenation:function(){var e=!1,o=0,u,n,i,r,t,f;if(this._children==null)return new System.Text.RegularExpressions.RegexNode(System.Text.RegularExpressions.RegexNode.Empty,this._options);for(r=0,t=0;r<this._children.length;r++,t++)if(n=this._children[r],t<r&&(this._children[t]=n),n._type===System.Text.RegularExpressions.RegexNode.Concatenate&&n._isRightToLeft()){for(f=0;f<n._children.length;f++)n._children[f]._next=this;this._children.splice.apply(this._children,[r+1,0].concat(n._children));t--}else if(n._type===System.Text.RegularExpressions.RegexNode.Multi||n._type===System.Text.RegularExpressions.RegexNode.One){if(u=n._options&(System.Text.RegularExpressions.RegexOptions.RightToLeft|System.Text.RegularExpressions.RegexOptions.IgnoreCase),!e||o!==u){e=!0;o=u;continue}i=this._children[--t];i._type===System.Text.RegularExpressions.RegexNode.One&&(i._type=System.Text.RegularExpressions.RegexNode.Multi,i._str=i._str);(u&System.Text.RegularExpressions.RegexOptions.RightToLeft)==0?i._str+=n._str:i._str=n._str+i._str}else n._type===System.Text.RegularExpressions.RegexNode.Empty?t--:e=!1;return t<r&&this._children.splice(t,r-t),this._stripEnation(System.Text.RegularExpressions.RegexNode.Empty)},_stripEnation:function(n){switch(this.childCount()){case 0:return new t.RegexNode(n,this._options);case 1:return this.child(0);default:return this}},_isRightToLeft:function(){return(this._options&System.Text.RegularExpressions.RegexOptions.RightToLeft)>0?!0:!1}});Bridge.define("System.Text.RegularExpressions.RegexReplacement",{statics:{replace:function(n,t,i,r,u){var f,o,e,s,h,c,l;if(n==null)throw new System.ArgumentNullException("evaluator");if(r<-1)throw new System.ArgumentOutOfRangeException("count","Count cannot be less than -1.");if(u<0||u>i.length)throw new System.ArgumentOutOfRangeException("startat","Start index cannot be less than 0 or greater than input length.");if(r===0)return i;if(f=t.match$1(i,u),f.getSuccess()){if(o="",t.getRightToLeft()){c=[];e=i.length;do{if(s=f.getIndex(),h=f.getLength(),s+h!==e&&c.push(i.slice(s+h,e)),e=s,c.push(n(f)),--r==0)break;f=f.nextMatch()}while(f.getSuccess());for(o=new StringBuilder,e>0&&(o+=o.slice(0,e)),l=c.length-1;l>=0;l--)o+=c[l]}else{e=0;do{if(s=f.getIndex(),h=f.getLength(),s!==e&&(o+=i.slice(e,s)),e=s+h,o+=n(f),--r==0)break;f=f.nextMatch()}while(f.getSuccess());e<i.length&&(o+=i.slice(e,i.length))}return o}return i},split:function(n,t,i,r){var f,u,e,o,s,c,h,l;if(i<0)throw new System.ArgumentOutOfRangeException("count","Count can't be less than 0.");if(r<0||r>t.length)throw new System.ArgumentOutOfRangeException("startat","Start index cannot be less than 0 or greater than input length.");if(f=[],i===1)return f.push(t),f;if(--i,u=n.match$1(t,r),u.getSuccess())if(n.getRightToLeft()){for(o=t.length;;){for(s=u.getIndex(),c=u.getLength(),h=u.getGroups(),l=h.getCount(),f.push(t.slice(s+c,o)),o=s,e=1;e<l;e++)u._isMatched(e)&&f.push(h.get(e).toString());if(--i,i===0)break;if(u=u.nextMatch(),!u.getSuccess())break}f.push(t.slice(0,o));f.reverse()}else{for(o=0;;){for(s=u.getIndex(),c=u.getLength(),h=u.getGroups(),l=h.getCount(),f.push(t.slice(o,s)),o=s+c,e=1;e<l;e++)u._isMatched(e)&&f.push(h.get(e).toString());if(--i,i===0)break;if(u=u.nextMatch(),!u.getSuccess())break}f.push(t.slice(o,t.length))}else f.push(t);return f},Specials:4,LeftPortion:-1,RightPortion:-2,LastGroup:-3,WholeString:-4},_rep:"",_strings:[],_rules:[],ctor:function(n,t,i){if(this.$initialize(),this._rep=n,t._type!==System.Text.RegularExpressions.RegexNode.Concatenate)throw new System.ArgumentException("Replacement error.");for(var r="",u=[],e=[],f,o,s=0;s<t.childCount();s++){o=t.child(s);switch(o._type){case System.Text.RegularExpressions.RegexNode.Multi:case System.Text.RegularExpressions.RegexNode.One:r+=o._str;break;case System.Text.RegularExpressions.RegexNode.Ref:r.length>0&&(e.push(u.length),u.push(r),r="");f=o._m;i!=null&&f>=0&&(f=i[f]);e.push(-System.Text.RegularExpressions.RegexReplacement.Specials-1-f);break;default:throw new System.ArgumentException("Replacement error.");}}r.length>0&&(e.push(u.length),u.push(r));this._strings=u;this._rules=e},getPattern:function(){return _rep},replacement:function(n){return this._replacementImpl("",n)},replace:function(n,t,i,r){var u,e,f,o,s,h,c;if(i<-1)throw new System.ArgumentOutOfRangeException("count","Count cannot be less than -1.");if(r<0||r>t.length)throw new System.ArgumentOutOfRangeException("startat","Start index cannot be less than 0 or greater than input length.");if(i===0)return t;if(u=n.match$1(t,r),u.getSuccess()){if(e="",n.getRightToLeft()){h=[];f=t.length;do{if(o=u.getIndex(),s=u.getLength(),o+s!==f&&h.push(t.slice(o+s,f)),f=o,this._replacementImplRTL(h,u),--i==0)break;u=u.nextMatch()}while(u.getSuccess());for(f>0&&(e+=e.slice(0,f)),c=h.length-1;c>=0;c--)e+=h[c]}else{f=0;do{if(o=u.getIndex(),s=u.getLength(),o!==f&&(e+=t.slice(f,o)),f=o+s,e=this._replacementImpl(e,u),--i==0)break;u=u.nextMatch()}while(u.getSuccess());f<t.length&&(e+=t.slice(f,t.length))}return e}return t},_replacementImpl:function(n,t){for(var u=System.Text.RegularExpressions.RegexReplacement.Specials,i,r=0;r<this._rules.length;r++)if(i=this._rules[r],i>=0)n+=this._strings[i];else if(i<-u)n+=t._groupToStringImpl(-u-1-i);else switch(-u-1-i){case System.Text.RegularExpressions.RegexReplacement.LeftPortion:n+=t._getLeftSubstring();break;case System.Text.RegularExpressions.RegexReplacement.RightPortion:n+=t._getRightSubstring();break;case System.Text.RegularExpressions.RegexReplacement.LastGroup:n+=t._lastGroupToStringImpl();break;case System.Text.RegularExpressions.RegexReplacement.WholeString:n+=t._getOriginalString()}return n},_replacementImplRTL:function(n,t){for(var u=System.Text.RegularExpressions.RegexReplacement.Specials,i,r=_rules.length-1;r>=0;r--)if(i=this._rules[r],i>=0)n.push(this._strings[i]);else if(i<-u)n.push(t._groupToStringImpl(-u-1-i));else switch(-u-1-i){case System.Text.RegularExpressions.RegexReplacement.LeftPortion:n.push(t._getLeftSubstring());break;case System.Text.RegularExpressions.RegexReplacement.RightPortion:n.push(t._getRightSubstring());break;case System.Text.RegularExpressions.RegexReplacement.LastGroup:n.push(t._lastGroupToStringImpl());break;case System.Text.RegularExpressions.RegexReplacement.WholeString:n.push(t._getOriginalString())}}});Bridge.define("System.Text.RegularExpressions.RegexEngine",{_pattern:"",_patternInfo:null,_text:"",_textStart:0,_timeoutMs:-1,_timeoutTime:-1,_settings:null,_branchType:{base:0,offset:1,lazy:2,greedy:3,or:4},_branchResultKind:{ok:1,endPass:2,nextPass:3,nextBranch:4},ctor:function(n,t,i,r,u,f,e){if(this.$initialize(),n==null)throw new System.ArgumentNullException("pattern");this._pattern=n;this._timeoutMs=e;this._settings={ignoreCase:t,multiline:i,singleline:r,ignoreWhitespace:u,explicitCapture:f}},match:function(n,t){var i;if(n==null)throw new System.ArgumentNullException("text");if(t!=null&&(t<0||t>n.length))throw new System.ArgumentOutOfRangeException("textStart","Start index cannot be less than 0 or greater than input length.");return(this._text=n,this._textStart=t,this._timeoutTime=this._timeoutMs>0?(new Date).getTime()+System.Convert.toInt32(this._timeoutMs+.5):-1,i=this.parsePattern(),i.shouldFail)?this._getEmptyMatch():(this._checkTimeout(),this._scanAndTransformResult(t,i.tokens,!1,null))},parsePattern:function(){if(this._patternInfo==null){var n=System.Text.RegularExpressions.RegexEngineParser,t=n.parsePattern(this._pattern,this._cloneSettings(this._settings));this._patternInfo=t}return this._patternInfo},_scanAndTransformResult:function(n,t,i,r){var u=this._scan(n,this._text.length,t,i,r);return this._collectScanResults(u,n)},_scan:function(n,t,i,r,u){var c=this._branchResultKind,f=[],e,h,o;if(f.grCaptureCache={},e=null,h=null,i.length===0)return o=new System.Text.RegularExpressions.RegexEngineState,o.capIndex=n,o.txtIndex=n,o.capLength=0,o;var l=r?this._branchType.base:this._branchType.offset,a=this._patternInfo.isContiguous?n:t,s=new System.Text.RegularExpressions.RegexEngineBranch(l,n,n,a);for(s.pushPass(0,i,this._cloneSettings(this._settings)),s.started=!0,s.state.txtIndex=n,f.push(s);f.length;){if(e=f[f.length-1],h=this._scanBranch(t,f,e),h===c.ok&&(u==null||e.state.capLength===u))return e.state;this._advanceToNextBranch(f,e);this._checkTimeout()}return null},_scanBranch:function(n,t,i){var r=this._branchResultKind,u,f;if(i.mustFail)return i.mustFail=!1,r.nextBranch;while(i.hasPass()){if(u=i.peekPass(),u.tokens==null||u.tokens.length===0)f=r.endPass;else{if(this._addAlternationBranches(t,i,u)===r.nextBranch)return r.nextBranch;f=this._scanPass(n,t,i,u)}switch(f){case r.nextBranch:return f;case r.nextPass:continue;case r.endPass:case r.ok:i.popPass();break;default:throw new System.InvalidOperationException("Unexpected branch result.");}}return r.ok},_scanPass:function(n,t,i,r){for(var f=this._branchResultKind,s=r.tokens.length,o,u,e;r.index<s;){if(o=r.tokens[r.index],u=r.probe,u==null){if(this._addBranchBeforeProbing(t,i,r,o))return f.nextBranch}else{if(u.value<u.min||u.forced){if(e=this._scanToken(n,t,i,r,o),e!==f.ok)return e;u.value+=1;u.forced=!1;continue}if(this._addBranchAfterProbing(t,i,r,u),u.forced)continue;r.probe=null;r.index++;continue}e=this._scanToken(n,t,i,r,o);switch(e){case f.nextBranch:case f.nextPass:case f.endPass:return e;case f.ok:r.index++;break;default:throw new System.InvalidOperationException("Unexpected branch-pass result.");}}return f.ok},_addAlternationBranches:function(n,t,i){var h=System.Text.RegularExpressions.RegexEngineParser.tokenTypes,c=this._branchType,l=i.tokens.length,o=this._branchResultKind,u,f,e,s,r;if(!i.alternationHandled&&!i.tokens.noAlternation){for(u=[-1],r=0;r<l;r++)s=i.tokens[r],s.type===h.alternation&&u.push(r);if(u.length>1){for(r=0;r<u.length;r++)f=new System.Text.RegularExpressions.RegexEngineBranch(c.or,r,0,u.length,t.state),f.isNotFailing=!0,e=f.peekPass(),e.alternationHandled=!0,e.index=u[r]+1,n.splice(n.length-r,0,f);return n[n.length-u.length].isNotFailing=!1,t.mustFail=!0,i.alternationHandled=!0,o.nextBranch}i.tokens.noAlternation=!0}return o.ok},_addBranchBeforeProbing:function(n,t,i,r){var u=this._tryGetTokenProbe(r),f,e;return u==null?!1:(i.probe=u,f=u.isLazy?this._branchType.lazy:this._branchType.greedy,e=new System.Text.RegularExpressions.RegexEngineBranch(f,u.value,u.min,u.max,t.state),n.push(e),!0)},_addBranchAfterProbing:function(n,t,i,r){var f,e,u;r.isLazy?r.value+1<=r.max&&(f=t.clone(),e=f.peekPass().probe,f.value+=1,e.forced=!0,n.splice(n.length-1,0,f),t.isNotFailing=!0):r.value+1<=r.max&&(u=t.clone(),u.started=!0,u.peekPass().probe=null,u.peekPass().index++,n.splice(n.length-1,0,u),r.forced=!0,t.value+=1,t.isNotFailing=!0)},_tryGetTokenProbe:function(n){var t=n.qtoken,u,i,r;if(t==null)return null;if(u=System.Text.RegularExpressions.RegexEngineParser.tokenTypes,t.type===u.quantifier)switch(t.value){case"*":case"*?":i=0;r=2147483647;break;case"+":case"+?":i=1;r=2147483647;break;case"?":case"??":i=0;r=1;break;default:throw new System.InvalidOperationException("Unexpected quantifier value.");}else if(t.type===u.quantifierN)i=t.data.n,r=t.data.n;else if(t.type===u.quantifierNM)i=t.data.n,r=t.data.m!=null?t.data.m:2147483647;else return null;return new System.Text.RegularExpressions.RegexEngineProbe(i,r,0,t.data.isLazy)},_advanceToNextBranch:function(n,t){if(n.length!==0){var i=n[n.length-1];if(!i.started){i.started=!0;return}if(t!==i)throw new System.InvalidOperationException("Current branch is supposed to be the last one.");if(n.length===1&&t.type===this._branchType.offset)t.value++,t.state.txtIndex=t.value,t.mustFail=!1,t.state.capIndex=null,t.state.capLength=0,t.state.groups.length=0,t.state.passes.length=1,t.state.passes[0].clearState(this._cloneSettings(this._settings)),t.value>t.max&&n.pop();else if(n.pop(),!t.isNotFailing){i=n[n.length-1];this._advanceToNextBranch(n,i);return}}},_collectScanResults:function(n,t){var o=this._patternInfo.groups,a=this._text,l={},s,f,h={},r,e,i,u,c=this._getEmptyMatch();if(n!=null){for(s=n.groups,this._fillMatch(c,n.capIndex,n.capLength,t),u=0;u<s.length;u++)(f=s[u],r=o[f.rawIndex-1],r.constructs.skipCapture)||(e={capIndex:f.capIndex,capLength:f.capLength,value:a.slice(f.capIndex,f.capIndex+f.capLength)},i=h[r.name],i==null?(i={capIndex:0,capLength:0,value:"",success:!1,captures:[e]},h[r.name]=i):i.captures.push(e));for(u=0;u<o.length;u++)(r=o[u],r.constructs.skipCapture)||l[r.name]!==!0&&(i=h[r.name],i==null?i={capIndex:0,capLength:0,value:"",success:!1,captures:[]}:i.captures.length>0&&(e=i.captures[i.captures.length-1],i.capIndex=e.capIndex,i.capLength=e.capLength,i.value=e.value,i.success=!0),l[r.name]=!0,i.descriptor=r,c.groups.push(i))}return c},_scanToken:function(n,t,i,r,u){var f=System.Text.RegularExpressions.RegexEngineParser.tokenTypes,e=this._branchResultKind;switch(u.type){case f.group:case f.groupImnsx:case f.alternationGroup:return this._scanGroupToken(n,t,i,r,u);case f.groupImnsxMisc:return this._scanGroupImnsxToken(u.group.constructs,r.settings);case f.charGroup:return this._scanCharGroupToken(t,i,r,u,!1);case f.charNegativeGroup:return this._scanCharNegativeGroupToken(t,i,r,u,!1);case f.escChar:case f.escCharOctal:case f.escCharHex:case f.escCharUnicode:case f.escCharCtrl:return this._scanLiteral(n,t,i,r,u.data.ch);case f.escCharOther:case f.escCharClass:return this._scanEscapeToken(t,i,r,u);case f.escCharClassCategory:throw new System.NotSupportedException("Unicode Category constructions are not supported.");case f.escCharClassBlock:throw new System.NotSupportedException("Unicode Named block constructions are not supported.");case f.escCharClassDot:return this._scanDotToken(n,t,i,r);case f.escBackrefNumber:return this._scanBackrefNumberToken(n,t,i,r,u);case f.escBackrefName:return this._scanBackrefNameToken(n,t,i,r,u);case f.anchor:case f.escAnchor:return this._scanAnchorToken(n,t,i,r,u);case f.groupConstruct:case f.groupConstructName:case f.groupConstructImnsx:case f.groupConstructImnsxMisc:return e.ok;case f.alternationGroupCondition:case f.alternationGroupRefNameCondition:case f.alternationGroupRefNumberCondition:return this._scanAlternationConditionToken(n,t,i,r,u);case f.alternation:return e.endPass;case f.commentInline:case f.commentXMode:return e.ok;default:return this._scanLiteral(n,t,i,r,u.value)}},_scanGroupToken:function(n,t,i,r,u){var h=System.Text.RegularExpressions.RegexEngineParser.tokenTypes,c=this._branchResultKind,o=i.state.txtIndex,l,f;if(r.onHold){if(u.type===h.group){var a=u.group.rawIndex,s=r.onHoldTextIndex,v=o-s,e=t.grCaptureCache[a];if(e==null&&(e={},t.grCaptureCache[a]=e),l=s.toString()+"_"+v.toString(),e[l]==null)e[l]=!0;else return c.nextBranch;u.group.constructs.emptyCapture||(u.group.isBalancing?i.state.logCaptureGroupBalancing(u.group,s):i.state.logCaptureGroup(u.group,s,v))}return r.onHold=!1,r.onHoldTextIndex=-1,c.ok}if(u.type===h.group||u.type===h.groupImnsx){if(f=u.group.constructs,this._scanGroupImnsxToken(f,r.settings),f.isPositiveLookahead||f.isNegativeLookahead||f.isPositiveLookbehind||f.isNegativeLookbehind)return this._scanLook(i,o,n,u);if(f.isNonbacktracking)return this._scanNonBacktracking(i,o,n,u)}return r.onHoldTextIndex=o,r.onHold=!0,i.pushPass(0,u.children,this._cloneSettings(r.settings)),c.nextPass},_scanGroupImnsxToken:function(n,t){var i=this._branchResultKind;return n.isIgnoreCase!=null&&(t.ignoreCase=n.isIgnoreCase),n.isMultiline!=null&&(t.multiline=n.isMultiline),n.isSingleLine!=null&&(t.singleline=n.isSingleLine),n.isIgnoreWhitespace!=null&&(t.ignoreWhitespace=n.isIgnoreWhitespace),n.isExplicitCapture!=null&&(t.explicitCapture=n.isExplicitCapture),i.ok},_scanAlternationConditionToken:function(n,t,i,r,u){var o=System.Text.RegularExpressions.RegexEngineParser.tokenTypes,f=this._branchResultKind,c=u.children,l=i.state.txtIndex,e=f.nextBranch,s,h;return u.type===o.alternationGroupRefNameCondition||u.type===o.alternationGroupRefNumberCondition?(s=i.state.resolveBackref(u.data.packedSlotId),e=s!=null?f.ok:f.nextBranch):(h=this._scan(l,n,c,!0,null),this._combineScanResults(i,h)&&(e=f.ok)),e===f.nextBranch&&r.tokens.noAlternation&&(e=f.endPass),e},_scanLook:function(n,t,i,r){var u=r.group.constructs,e=this._branchResultKind,f=r.children,o,s,h=u.isPositiveLookahead||u.isNegativeLookahead,c=u.isPositiveLookbehind||u.isNegativeLookbehind;return h||c?(f=f.slice(1,f.length),o=u.isPositiveLookahead||u.isPositiveLookbehind,s=h?this._scanLookAhead(n,t,i,f):this._scanLookBehind(n,t,i,f),o===s?e.ok:e.nextBranch):null},_scanLookAhead:function(n,t,i,r){var u=this._scan(t,i,r,!0,null);return this._combineScanResults(n,u)},_scanLookBehind:function(n,t,i,r){for(var u=t,f,e;u>=0;){if(f=t-u,e=this._scan(u,i,r,!0,f),this._combineScanResults(n,e))return!0;--u}return!1},_scanNonBacktracking:function(n,t,i,r){var e=this._branchResultKind,u=r.children,f;return(u=u.slice(1,u.length),f=this._scan(t,i,u,!0,null),!f)?e.nextBranch:(n.state.logCapture(f.capLength),e.ok)},_scanLiteral:function(n,t,i,r,u){var e=this._branchResultKind,o=i.state.txtIndex,f;if(o+u.length>n)return e.nextBranch;if(r.settings.ignoreCase){for(f=0;f<u.length;f++)if(this._text[o+f].toLowerCase()!==u[f].toLowerCase())return e.nextBranch}else for(f=0;f<u.length;f++)if(this._text[o+f]!==u[f])return e.nextBranch;return i.state.logCapture(u.length),e.ok},_scanWithJsRegex:function(n,t,i,r,u){var o=this._branchResultKind,h=t.state.txtIndex,e=this._text[h],s,f;return(e==null&&(e=""),s=i.settings.ignoreCase?"i":"",f=r.rgx,f==null&&(u==null&&(u=r.value),f=new RegExp(u,s),r.rgx=f),f.test(e))?(t.state.logCapture(e.length),o.ok):o.nextBranch},_scanWithJsRegex2:function(n,t){var r=this._branchResultKind,i=this._text[n],u;return(i==null&&(i=""),u=new RegExp(t,""),u.test(i))?r.ok:r.nextBranch},_scanCharGroupToken:function(n,t,i,r,u){var l=System.Text.RegularExpressions.RegexEngineParser.tokenTypes,f=this._branchResultKind,w=t.state.txtIndex,e=this._text[w],s,a,h,o,v,c,y,p;if(e==null)return f.nextBranch;if(h=e.charCodeAt(0),o=r.data.ranges,r.data.substractToken!=null){if(r.data.substractToken.type===l.charGroup)y=this._scanCharGroupToken(n,t,i,r.data.substractToken,!0);else if(r.data.substractToken.type===l.charNegativeGroup)y=this._scanCharNegativeGroupToken(n,t,i,r.data.substractToken,!0);else throw new System.InvalidOperationException("Unexpected substuct group token.");if(y===f.ok)return r.type===l.charGroup?f.nextBranch:f.ok}if(o.charClassToken!=null&&(p=this._scanWithJsRegex(n,t,i,o.charClassToken),p===f.ok))return f.ok;for(a=0;a<2;a++){for(s=0;s<o.length;s++){if(v=o[s],v.n>h)break;if(h<=v.m)return u||t.state.logCapture(1),f.ok}c==null&&i.settings.ignoreCase&&(c=e.toUpperCase(),e=e===c?e.toLowerCase():c,h=e.charCodeAt(0))}return f.nextBranch},_scanCharNegativeGroupToken:function(n,t,i,r,u){var f=this._branchResultKind,o=t.state.txtIndex,s=this._text[o],e;return s==null?f.nextBranch:(e=this._scanCharGroupToken(n,t,i,r,!0),e===f.ok)?f.nextBranch:(u||t.state.logCapture(1),f.ok)},_scanEscapeToken:function(n,t,i,r){return this._scanWithJsRegex(n,t,i,r)},_scanDotToken:function(n,t,i,r){var u=this._branchResultKind,f=i.state.txtIndex;if(r.settings.singleline){if(f<n)return i.state.logCapture(1),u.ok}else if(f<n&&this._text[f]!=="\n")return i.state.logCapture(1),u.ok;return u.nextBranch},_scanBackrefNumberToken:function(n,t,i,r,u){var o=this._branchResultKind,f=i.state.resolveBackref(u.data.slotId),e;return f==null?o.nextBranch:(e=this._text.slice(f.capIndex,f.capIndex+f.capLength),this._scanLiteral(n,t,i,r,e))},_scanBackrefNameToken:function(n,t,i,r,u){var o=this._branchResultKind,f=i.state.resolveBackref(u.data.slotId),e;return f==null?o.nextBranch:(e=this._text.slice(f.capIndex,f.capIndex+f.capLength),this._scanLiteral(n,t,i,r,e))},_scanAnchorToken:function(n,t,i,r,u){var e=this._branchResultKind,f=i.state.txtIndex,o,s;if(u.value==="\\b"||u.value==="\\B"){if(o=f>0&&this._scanWithJsRegex2(f-1,"\\w")===e.ok,s=this._scanWithJsRegex2(f,"\\w")===e.ok,o===s==(u.value==="\\B"))return e.ok}else if(u.value==="^"){if(f===0||r.settings.multiline&&this._text[f-1]==="\n")return e.ok}else if(u.value==="$"){if(f===n||r.settings.multiline&&this._text[f]==="\n")return e.ok}else if(u.value==="\\A"){if(f===0)return e.ok}else if(u.value==="\\z"){if(f===n)return e.ok}else if(u.value==="\\Z"){if(f===n||f===n-1&&this._text[f]==="\n")return e.ok}else if(u.value==="\\G")return e.ok;return e.nextBranch},_cloneSettings:function(n){return{ignoreCase:n.ignoreCase,multiline:n.multiline,singleline:n.singleline,ignoreWhitespace:n.ignoreWhitespace,explicitCapture:n.explicitCapture}},_combineScanResults:function(n,t){if(t!=null){for(var u=n.state.groups,r=t.groups,f=r.length,i=0;i<f;++i)u.push(r[i]);return!0}return!1},_getEmptyMatch:function(){return{capIndex:0,capLength:0,success:!1,value:"",groups:[],captures:[]}},_fillMatch:function(n,t,i,r){t==null&&(t=r);n.capIndex=t;n.capLength=i;n.success=!0;n.value=this._text.slice(t,t+i);n.groups.push({capIndex:t,capLength:i,value:n.value,success:!0,captures:[{capIndex:t,capLength:i,value:n.value}]});n.captures.push(n.groups[0].captures[0])},_checkTimeout:function(){if(!(this._timeoutTime<0)){var n=(new Date).getTime();if(n>=this._timeoutTime)throw new System.RegexMatchTimeoutException(this._text,this._pattern,System.TimeSpan.fromMilliseconds(this._timeoutMs));}}});Bridge.define("System.Text.RegularExpressions.RegexEngineBranch",{type:0,value:0,min:0,max:0,isStarted:!1,isNotFailing:!1,state:null,ctor:function(n,t,i,r,u){this.$initialize();this.type=n;this.value=t;this.min=i;this.max=r;this.state=u!=null?u.clone():new System.Text.RegularExpressions.RegexEngineState},pushPass:function(n,t,i){var r=new System.Text.RegularExpressions.RegexEnginePass(n,t,i);this.state.passes.push(r)},peekPass:function(){return this.state.passes[this.state.passes.length-1]},popPass:function(){return this.state.passes.pop()},hasPass:function(){return this.state.passes.length>0},clone:function(){var n=new System.Text.RegularExpressions.RegexEngineBranch(this.type,this.value,this.min,this.max,this.state);return n.isNotFailing=this.isNotFailing,n}});Bridge.define("System.Text.RegularExpressions.RegexEngineState",{txtIndex:0,capIndex:null,capLength:0,passes:null,groups:null,ctor:function(){this.$initialize();this.passes=[];this.groups=[]},logCapture:function(n){this.capIndex==null&&(this.capIndex=this.txtIndex);this.txtIndex+=n;this.capLength+=n},logCaptureGroup:function(n,t,i){this.groups.push({rawIndex:n.rawIndex,slotId:n.packedSlotId,capIndex:t,capLength:i})},logCaptureGroupBalancing:function(n,t){for(var s=n.balancingSlotId,r=this.groups,i=r.length-1,u,f,e,o;i>=0;){if(r[i].slotId===s){u=r[i];f=i;break}--i}return u!=null&&f!=null?(r.splice(f,1),n.constructs.name1!=null&&(e=u.capIndex+u.capLength,o=t-e,this.logCaptureGroup(n,e,o)),!0):!1},resolveBackref:function(n){for(var i=this.groups,t=i.length-1;t>=0;){if(i[t].slotId===n)return i[t];--t}return null},clone:function(){var t=new System.Text.RegularExpressions.RegexEngineState,e,u;t.txtIndex=this.txtIndex;t.capIndex=this.capIndex;t.capLength=this.capLength;for(var o=t.passes,f=this.passes,r=f.length,i,n=0;n<r;n++)i=f[n].clone(),o.push(i);for(e=t.groups,u=this.groups,r=u.length,n=0;n<r;n++)i=u[n],e.push(i);return t}});Bridge.define("System.Text.RegularExpressions.RegexEnginePass",{index:0,tokens:null,probe:null,onHold:!1,onHoldTextIndex:-1,alternationHandled:!1,settings:null,ctor:function(n,t,i){this.$initialize();this.index=n;this.tokens=t;this.settings=i},clearState:function(n){this.index=0;this.probe=null;this.onHold=!1;this.onHoldTextIndex=-1;this.alternationHandled=!1;this.settings=n},clone:function(){var n=new System.Text.RegularExpressions.RegexEnginePass(this.index,this.tokens,this.settings);return n.onHold=this.onHold,n.onHoldTextIndex=this.onHoldTextIndex,n.alternationHandled=this.alternationHandled,n.probe=this.probe!=null?this.probe.clone():null,n}});Bridge.define("System.Text.RegularExpressions.RegexEngineProbe",{min:0,max:0,value:0,isLazy:!1,forced:!1,ctor:function(n,t,i,r){this.$initialize();this.min=n;this.max=t;this.value=i;this.isLazy=r;this.forced=!1},clone:function(){var n=new System.Text.RegularExpressions.RegexEngineProbe(this.min,this.max,this.value,this.isLazy);return n.forced=this.forced,n}});Bridge.define("System.Text.RegularExpressions.RegexEngineParser",{statics:{_hexSymbols:"0123456789abcdefABCDEF",_octSymbols:"01234567",_decSymbols:"0123456789",_escapedChars:"abtrvfnexcu",_escapedCharClasses:"pPwWsSdD",_escapedAnchors:"AZzGbB",_escapedSpecialSymbols:" .,$^{}[]()|*+-=?\\|/\"':;~!@#%&",_whiteSpaceChars:" \r\n\t\v\f\u00A0\uFEFF",_unicodeCategories:["Lu","Ll","Lt","Lm","Lo","L","Mn","Mc","Me","M","Nd","Nl","No","N","Pc","Pd","Ps","Pe","Pi","Pf","Po","P","Sm","Sc","Sk","So","S","Zs","Zl","Zp","Z","Cc","Cf","Cs","Co","Cn","C"],_namedCharBlocks:["IsBasicLatin","IsLatin-1Supplement","IsLatinExtended-A","IsLatinExtended-B","IsIPAExtensions","IsSpacingModifierLetters","IsCombiningDiacriticalMarks","IsGreek","IsGreekandCoptic","IsCyrillic","IsCyrillicSupplement","IsArmenian","IsHebrew","IsArabic","IsSyriac","IsThaana","IsDevanagari","IsBengali","IsGurmukhi","IsGujarati","IsOriya","IsTamil","IsTelugu","IsKannada","IsMalayalam","IsSinhala","IsThai","IsLao","IsTibetan","IsMyanmar","IsGeorgian","IsHangulJamo","IsEthiopic","IsCherokee","IsUnifiedCanadianAboriginalSyllabics","IsOgham","IsRunic","IsTagalog","IsHanunoo","IsBuhid","IsTagbanwa","IsKhmer","IsMongolian","IsLimbu","IsTaiLe","IsKhmerSymbols","IsPhoneticExtensions","IsLatinExtendedAdditional","IsGreekExtended","IsGeneralPunctuation","IsSuperscriptsandSubscripts","IsCurrencySymbols","IsCombiningDiacriticalMarksforSymbols","IsCombiningMarksforSymbols","IsLetterlikeSymbols","IsNumberForms","IsArrows","IsMathematicalOperators","IsMiscellaneousTechnical","IsControlPictures","IsOpticalCharacterRecognition","IsEnclosedAlphanumerics","IsBoxDrawing","IsBlockElements","IsGeometricShapes","IsMiscellaneousSymbols","IsDingbats","IsMiscellaneousMathematicalSymbols-A","IsSupplementalArrows-A","IsBraillePatterns","IsSupplementalArrows-B","IsMiscellaneousMathematicalSymbols-B","IsSupplementalMathematicalOperators","IsMiscellaneousSymbolsandArrows","IsCJKRadicalsSupplement","IsKangxiRadicals","IsIdeographicDescriptionCharacters","IsCJKSymbolsandPunctuation","IsHiragana","IsKatakana","IsBopomofo","IsHangulCompatibilityJamo","IsKanbun","IsBopomofoExtended","IsKatakanaPhoneticExtensions","IsEnclosedCJKLettersandMonths","IsCJKCompatibility","IsCJKUnifiedIdeographsExtensionA","IsYijingHexagramSymbols","IsCJKUnifiedIdeographs","IsYiSyllables","IsYiRadicals","IsHangulSyllables","IsHighSurrogates","IsHighPrivateUseSurrogates","IsLowSurrogates","IsPrivateUse or IsPrivateUseArea","IsCJKCompatibilityIdeographs","IsAlphabeticPresentationForms","IsArabicPresentationForms-A","IsVariationSelectors","IsCombiningHalfMarks","IsCJKCompatibilityForms","IsSmallFormVariants","IsArabicPresentationForms-B","IsHalfwidthandFullwidthForms","IsSpecials"],_controlChars:["@","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","[","\\","]","^","_"],tokenTypes:{literal:0,escChar:110,escCharOctal:111,escCharHex:112,escCharCtrl:113,escCharUnicode:114,escCharOther:115,escCharClass:120,escCharClassCategory:121,escCharClassBlock:122,escCharClassDot:123,escAnchor:130,escBackrefNumber:140,escBackrefName:141,charGroup:200,charNegativeGroup:201,charInterval:202,anchor:300,group:400,groupImnsx:401,groupImnsxMisc:402,groupConstruct:403,groupConstructName:404,groupConstructImnsx:405,groupConstructImnsxMisc:406,quantifier:500,quantifierN:501,quantifierNM:502,alternation:600,alternationGroup:601,alternationGroupCondition:602,alternationGroupRefNumberCondition:603,alternationGroupRefNameCondition:604,commentInline:700,commentXMode:701},parsePattern:function(n,t){var i=System.Text.RegularExpressions.RegexEngineParser,r=i._parsePatternImpl(n,t,0,n.length),f=[],u;return i._fillGroupDescriptors(r,f),u=i._getGroupSparseInfo(f),i._fillBalancingGroupInfo(f,u),i._preTransformBackrefTokens(n,r,u),i._transformRawTokens(t,r,u,[],[],0),i._updateGroupDescriptors(r),{groups:f,sparseSettings:u,isContiguous:t.isContiguous||!1,shouldFail:t.shouldFail||!1,tokens:r}},_transformRawTokens:function(n,t,i,r,u,f){for(var l=System.Text.RegularExpressions.RegexEngineParser,s=l.tokenTypes,a,e,c,h,p,b,v,y,w,o=0;o<t.length;o++){if(e=t[o],o<t.length-1){w=t[o+1];switch(w.type){case s.quantifier:case s.quantifierN:case s.quantifierNM:e.qtoken=w;t.splice(o+1,1);--o}}if(e.type===s.escBackrefNumber){if(p=e.data.number,h=i.getPackedSlotIdBySlotNumber(p),h==null)throw new System.ArgumentException("Reference to undefined group number "+p.toString()+".");if(r.indexOf(h)<0){n.shouldFail=!0;continue}e.data.slotId=h}else if(e.type===s.escBackrefName){if(c=e.data.name,h=i.getPackedSlotIdBySlotName(c),h==null){if(b=l._matchChars(c,0,c.length,l._decSymbols),b.matchLength===c.length){c="\\"+c;l._updatePatternToken(e,s.escBackrefNumber,e.index,c.length,c);--o;continue}throw new System.ArgumentException("Reference to undefined group name '"+c+"'.");}if(r.indexOf(h)<0){n.shouldFail=!0;continue}e.data.slotId=h}else if(e.type===s.anchor||e.type===s.escAnchor){if(e.value==="\\G"){f===0&&o===0?n.isContiguous=!0:n.shouldFail=!0;t.splice(o,1);--o;continue}}else if(e.type===s.commentInline||e.type===s.commentXMode){t.splice(o,1);--o;continue}else if(e.type===s.literal){if(o>0&&!e.qtoken&&(a=t[o-1],a.type===s.literal&&!a.qtoken)){a.value+=e.value;a.length+=e.length;t.splice(o,1);--o;continue}}else if(e.type===s.alternationGroupCondition&&e.data!=null)if(e.data.number!=null){if(h=i.getPackedSlotIdBySlotNumber(e.data.number),h==null)throw new System.ArgumentException("Reference to undefined group number "+c+".");e.data.packedSlotId=h;l._updatePatternToken(e,s.alternationGroupRefNumberCondition,e.index,e.length,e.value)}else h=i.getPackedSlotIdBySlotName(e.data.name),h!=null?(e.data.packedSlotId=h,l._updatePatternToken(e,s.alternationGroupRefNameCondition,e.index,e.length,e.value)):delete e.data;e.children&&e.children.length&&(v=e.type===s.group?[e.group.rawIndex]:[],v=v.concat(u),y=e.localSettings||n,l._transformRawTokens(y,e.children,i,r,v,f+1),n.shouldFail=n.shouldFail||y.shouldFail,n.isContiguous=n.isContiguous||y.isContiguous);e.type===s.group&&r.push(e.group.packedSlotId)}},_fillGroupDescriptors:function(n,t){var f=System.Text.RegularExpressions.RegexEngineParser,i,r,u;for(f._fillGroupStructure(t,n,null),u=1,r=0;r<t.length;r++)i=t[r],i.constructs.name1!=null?(i.name=i.constructs.name1,i.hasName=!0):(i.hasName=!1,i.name=u.toString(),++u)},_fillGroupStructure:function(n,t,i){for(var s=System.Text.RegularExpressions.RegexEngineParser,e=s.tokenTypes,f,r,u,c,h,o=0;o<t.length;o++)r=t[o],h=r.children&&r.children.length,(r.type===e.group||r.type===e.groupImnsx||r.type===e.groupImnsxMisc)&&(f={rawIndex:n.length+1,number:-1,parentGroup:null,innerGroups:[],name:null,hasName:!1,constructs:null,quantifier:null,exprIndex:-1,exprLength:0,expr:null,exprFull:null},r.group=f,r.type===e.group&&(n.push(f),i!=null&&(r.group.parentGroup=i,i.innerGroups.push(f))),c=h?r.children[0]:null,f.constructs=s._fillGroupConstructs(c),u=f.constructs,r.isNonCapturingExplicit&&(delete r.isNonCapturingExplicit,u.isNonCapturingExplicit=!0),r.isEmptyCapturing&&(delete r.isEmptyCapturing,u.emptyCapture=!0),u.skipCapture=u.isNonCapturing||u.isNonCapturingExplicit||u.isNonbacktracking||u.isPositiveLookahead||u.isNegativeLookahead||u.isPositiveLookbehind||u.isNegativeLookbehind||u.name1==null&&u.name2!=null),h&&s._fillGroupStructure(n,r.children,r.group)},_getGroupSparseInfo:function(n){var h=System.Text.RegularExpressions.RegexEngineParser,f={},l=[],c={},r,a,t,s,i,u,v,o={0:0},e,p,y;for(o.lastSlot=0,e={"0":0},e.keys=["0"],u=0;u<n.length;u++)(i=n[u],i.constructs.skipCapture)||(i.constructs.isNumberName1?(t=parseInt(i.constructs.name1),l.push(t),f[t]?f[t].push(i):f[t]=[i]):(s=i.constructs.name1,c[s]?c[s].push(i):c[s]=[i]));for(p=function(n,t){return n-t},l.sort(p),y=!1,v=0;v<2;v++){for(u=0;u<n.length;u++)(i=n[u],i.constructs.skipCapture)||i.constructs.emptyCapture===!0===y&&(t=e.keys.length,i.hasName||(a=[i],r=f[t],r!=null&&(a=a.concat(r),f[t]=null),h._addSparseSlotForSameNamedGroups(a,t,o,e)));y=!0}for(u=0;u<n.length;u++)if((i=n[u],!i.constructs.skipCapture)&&i.hasName&&!i.constructs.isNumberName1){for(t=e.keys.length,r=f[t];r!=null;)h._addSparseSlotForSameNamedGroups(r,t,o,e),f[t]=null,t=e.keys.length,r=f[t];if(!i.constructs.isNumberName1)for(t=e.keys.length,r=f[t];r!=null;)h._addSparseSlotForSameNamedGroups(r,t,o,e),f[t]=null,t=e.keys.length,r=f[t];s=i.constructs.name1;r=c[s];r!=null&&(h._addSparseSlotForSameNamedGroups(r,t,o,e),c[s]=null)}for(u=0;u<l.length;u++)t=l[u],r=f[t],r!=null&&(h._addSparseSlotForSameNamedGroups(r,t,o,e),f[t]=null);return{isSparse:o.isSparse||!1,sparseSlotMap:o,sparseSlotNameMap:e,getPackedSlotIdBySlotNumber:function(n){return this.sparseSlotMap[n]},getPackedSlotIdBySlotName:function(n){return this.sparseSlotNameMap[n]}}},_addSparseSlot:function(n,t,i,r){var u=r.keys.length;n.packedSlotId=u;i[t]=u;r[n.name]=u;r.keys.push(n.name);!i.isSparse&&t-i.lastSlot>1&&(i.isSparse=!0);i.lastSlot=t},_addSparseSlotForSameNamedGroups:function(n,t,i,r){var o=System.Text.RegularExpressions.RegexEngineParser,u,f,e;if(o._addSparseSlot(n[0],t,i,r),f=n[0].sparseSlotId,e=n[0].packedSlotId,n.length>1)for(u=1;u<n.length;u++)n[u].sparseSlotId=f,n[u].packedSlotId=e},_fillGroupConstructs:function(n){var o=System.Text.RegularExpressions.RegexEngineParser,f=o.tokenTypes,t={name1:null,name2:null,isNumberName1:!1,isNumberName2:!1,isNonCapturing:!1,isNonCapturingExplicit:!1,isIgnoreCase:null,isMultiline:null,isExplicitCapture:null,isSingleLine:null,isIgnoreWhitespace:null,isPositiveLookahead:!1,isNegativeLookahead:!1,isPositiveLookbehind:!1,isNegativeLookbehind:!1,isNonbacktracking:!1},s,i,h,c;if(n==null)return t;if(n.type===f.groupConstruct)switch(n.value){case"?:":t.isNonCapturing=!0;break;case"?=":t.isPositiveLookahead=!0;break;case"?!":t.isNegativeLookahead=!0;break;case"?>":t.isNonbacktracking=!0;break;case"?<=":t.isPositiveLookbehind=!0;break;case"?<!":t.isNegativeLookbehind=!0;break;default:throw new System.ArgumentException("Unrecognized grouping construct.");}else if(n.type===f.groupConstructName){if(s=n.value.slice(2,n.length-1),i=s.split("-"),i.length===0||i.length>2)throw new System.ArgumentException("Invalid group name.");i[0].length&&(t.name1=i[0],h=o._validateGroupName(i[0]),t.isNumberName1=h.isNumberName);i.length===2&&(t.name2=i[1],c=o._validateGroupName(i[1]),t.isNumberName2=c.isNumberName)}else if(n.type===f.groupConstructImnsx||n.type===f.groupConstructImnsxMisc)for(var l=n.type===f.groupConstructImnsx?1:0,a=n.length-1-l,u=!0,r,e=1;e<=a;e++)r=n.value[e],r==="-"?u=!1:r==="i"?t.isIgnoreCase=u:r==="m"?t.isMultiline=u:r==="n"?t.isExplicitCapture=u:r==="s"?t.isSingleLine=u:r==="x"&&(t.isIgnoreWhitespace=u);return t},_validateGroupName:function(n){var t,i,r;if(!n||!n.length)throw new System.ArgumentException("Invalid group name: Group names must begin with a word character.");if(t=n[0]>="0"&&n[0]<="9",t&&(i=System.Text.RegularExpressions.RegexEngineParser,r=i._matchChars(n,0,n.length,i._decSymbols),r.matchLength!==n.length))throw new System.ArgumentException("Invalid group name: Group names must begin with a word character.");return{isNumberName:t}},_fillBalancingGroupInfo:function(n,t){for(var i,r=0;r<n.length;r++)if(i=n[r],i.constructs.name2!=null&&(i.isBalancing=!0,i.balancingSlotId=t.getPackedSlotIdBySlotName(i.constructs.name2),i.balancingSlotId==null))throw new System.ArgumentException("Reference to undefined group name '"+i.constructs.name2+"'.");},_preTransformBackrefTokens:function(n,t,i){for(var u=System.Text.RegularExpressions.RegexEngineParser,s=u.tokenTypes,f,e,h,c,r,o=0;o<t.length;o++){if(r=t[o],r.type===s.escBackrefNumber){if(f=r.data.number,f>=1&&i.getPackedSlotIdBySlotNumber(f)!=null)continue;if(f<=9)throw new System.ArgumentException("Reference to undefined group number "+f.toString()+".");if(e=u._parseOctalCharToken(r.value,0,r.length),e==null)throw new System.ArgumentException("Unrecognized escape sequence "+r.value.slice(0,2)+".");h=r.length-e.length;u._modifyPatternToken(r,n,s.escCharOctal,null,e.length);r.data=e.data;h>0&&(c=u._createPatternToken(n,s.literal,r.index+r.length,h),t.splice(o+1,0,c))}r.children&&r.children.length&&u._preTransformBackrefTokens(n,r.children,i)}},_updateGroupDescriptors:function(n,t){for(var o=System.Text.RegularExpressions.RegexEngineParser,e=o.tokenTypes,r,i,f,h,c,s=t||0,u=0;u<n.length;u++)i=n[u],i.index=s,i.children&&(c=i.childrenPostfix.length,o._updateGroupDescriptors(i.children,s+c),h=o._constructPattern(i.children),i.value=i.childrenPrefix+h+i.childrenPostfix,i.length=i.value.length),i.type===e.group&&i.group&&(r=i.group,r.exprIndex=i.index,r.exprLength=i.length,u+1<n.length&&(f=n[u+1],(f.type===e.quantifier||f.type===e.quantifierN||f.type===e.quantifierNM)&&(r.quantifier=f.value)),r.expr=i.value,r.exprFull=r.expr+(r.quantifier!=null?r.quantifier:"")),s+=i.length},_constructPattern:function(n){for(var i="",r,t=0;t<n.length;t++)r=n[t],i+=r.value;return i},_parsePatternImpl:function(n,t,i,r){if(n==null)throw new System.ArgumentNullException("pattern");if(i<0||i>n.length)throw new System.ArgumentOutOfRangeException("startIndex");if(r<i||r>n.length)throw new System.ArgumentOutOfRangeException("endIndex");for(var f=System.Text.RegularExpressions.RegexEngineParser,h=f.tokenTypes,s=[],o,e,u=i;u<r;){if(e=n[u],t.ignoreWhitespace&&f._whiteSpaceChars.indexOf(e)>=0){++u;continue}o=e==="."?f._parseDotToken(n,u,r):e==="\\"?f._parseEscapeToken(n,u,r):e==="["?f._parseCharRangeToken(n,u,r):e==="^"||e==="$"?f._parseAnchorToken(n,u):e==="("?f._parseGroupToken(n,t,u,r):e==="|"?f._parseAlternationToken(n,u):e==="#"&&t.ignoreWhitespace?f._parseXModeCommentToken(n,u,r):f._parseQuantifierToken(n,u,r);o==null&&(o=f._createPatternToken(n,h.literal,u,1));o!=null&&(s.push(o),u+=o.length)}return s},_parseEscapeToken:function(n,t,i){var u=System.Text.RegularExpressions.RegexEngineParser,o=u.tokenTypes,f=n[t],h,c,l,s,y,e,a,r,v;if(f!=="\\")return null;if(t+1>=i)throw new System.ArgumentException("Illegal \\ at end of pattern.");if(f=n[t+1],f>="1"&&f<="9")return h=u._matchChars(n,t+1,i,u._decSymbols,3),c=u._createPatternToken(n,o.escBackrefNumber,t,1+h.matchLength),c.data={number:parseInt(h.match,10)},c;if(u._escapedAnchors.indexOf(f)>=0)return u._createPatternToken(n,o.escAnchor,t,2);if(l=u._parseEscapedChar(n,t,i),l!=null)return l;if(f==="k"){if(t+2<i&&(s=n[t+2],(s==="'"||s==="<")&&(y=s==="<"?">":"'",e=u._matchUntil(n,t+3,i,y),e.unmatchLength===1&&e.matchLength>0)))return a=u._createPatternToken(n,o.escBackrefName,t,3+e.matchLength+1),a.data={name:e.match},a;throw new System.ArgumentException("Malformed \\k<...> named back reference.");}if(r=f.charCodeAt(0),r>=0&&r<48||r>57&&r<65||r>90&&r<95||r===96||r>122&&r<128)return v=u._createPatternToken(n,o.escChar,t,2),v.data={n:r,ch:f},v;throw new System.ArgumentException("Unrecognized escape sequence \\"+f+".");},_parseOctalCharToken:function(n,t,i){var r=System.Text.RegularExpressions.RegexEngineParser,s=r.tokenTypes,u=n[t];if(u==="\\"&&t+1<i&&(u=n[t+1],u>="0"&&u<="7")){var f=r._matchChars(n,t+1,i,r._octSymbols,3),e=parseInt(f.match,8),o=r._createPatternToken(n,s.escCharOctal,t,1+f.matchLength);return o.data={n:e,ch:String.fromCharCode(e)},o}return null},_parseEscapedChar:function(n,t,i){var r=System.Text.RegularExpressions.RegexEngineParser,o=r.tokenTypes,f,u=n[t],a,v,h,c,y,p,e,s,l;if(u!=="\\"||t+1>=i)return null;if(u=n[t+1],r._escapedChars.indexOf(u)>=0){if(u==="x"){if(a=r._matchChars(n,t+2,i,r._hexSymbols,2),a.matchLength!==2)throw new System.ArgumentException("Insufficient hexadecimal digits.");return v=parseInt(a.match,16),f=r._createPatternToken(n,o.escCharHex,t,4),f.data={n:v,ch:String.fromCharCode(v)},f}if(u==="c"){if(t+2>=i)throw new System.ArgumentException("Missing control character.");if(h=n[t+2],h=h.toUpperCase(),c=this._controlChars.indexOf(h),c>=0)return f=r._createPatternToken(n,o.escCharCtrl,t,3),f.data={n:c,ch:String.fromCharCode(c)},f;throw new System.ArgumentException("Unrecognized control character.");}else if(u==="u"){if(y=r._matchChars(n,t+2,i,r._hexSymbols,4),y.matchLength!==4)throw new System.ArgumentException("Insufficient hexadecimal digits.");return p=parseInt(y.match,16),f=r._createPatternToken(n,o.escCharUnicode,t,6),f.data={n:p,ch:String.fromCharCode(p)},f}f=r._createPatternToken(n,o.escChar,t,2);switch(u){case"a":e=7;break;case"b":e=8;break;case"t":e=9;break;case"r":e=13;break;case"v":e=11;break;case"f":e=12;break;case"n":e=10;break;case"e":e=27;break;default:throw new System.ArgumentException("Unexpected escaped char: '"+u+"'.");}return f.data={n:e,ch:String.fromCharCode(e)},f}if(u>="0"&&u<="7")return r._parseOctalCharToken(n,t,i);if(r._escapedCharClasses.indexOf(u)>=0){if(u==="p"||u==="P"){if(s=r._matchUntil(n,t+2,i,"}"),s.matchLength<2||s.match[0]!=="{"||s.unmatchLength!==1)throw new System.ArgumentException("Incomplete p{X} character escape.");if(l=s.match.slice(1),r._unicodeCategories.indexOf(l)>=0)return r._createPatternToken(n,o.escCharClassCategory,t,2+s.matchLength+1);if(r._namedCharBlocks.indexOf(l)>=0)return r._createPatternToken(n,o.escCharClassBlock,t,2+s.matchLength+1);throw new System.ArgumentException("Unknown property '"+l+"'.");}return r._createPatternToken(n,o.escCharClass,t,2)}return r._escapedSpecialSymbols.indexOf(u)>=0?(f=r._createPatternToken(n,o.escCharOther,t,2),f.data={n:u.charCodeAt(0),ch:u},f):null},_parseCharRangeToken:function(n,t,i){var e=System.Text.RegularExpressions.RegexEngineParser,a=e.tokenTypes,u=[],v,o,f,y=!1,p=!1,w=!1,s=n[t],r,h,c,b,l,k;if(s!=="[")return null;for(r=t+1,h=-1,r<i&&n[r]==="^"&&(y=!0,r++),b=r;r<i;){if(s=n[r],p=w,s==="-"&&r+1<i&&n[r+1]==="[")o=e._parseCharRangeToken(n,r+1,i),o.childrenPrefix="-"+o.childrenPrefix,o.length++,f=o,c=o.length,w=!0;else if(s==="\\"){if(f=e._parseEscapedChar(n,r,i),f==null)throw new System.ArgumentException("Unrecognized escape sequence \\"+s+".");c=f.length}else if(s==="]"&&r>b){h=r;break}else f=e._createPatternToken(n,a.literal,r,1),c=1;if(p)throw new System.ArgumentException("A subtraction must be the last element in a character class.");u.length>1&&(v=e._parseCharIntervalToken(n,u[u.length-2],u[u.length-1],f),v!=null&&(u.pop(),u.pop(),f=v));f!=null&&(u.push(f),r+=c)}if(h<0||u.length<1)throw new System.ArgumentException("Unterminated [] set.");return l=y?e._createPatternToken(n,a.charNegativeGroup,t,1+h-t,u,"[^","]"):e._createPatternToken(n,a.charGroup,t,1+h-t,u,"[","]"),k=e._tidyCharRange(u),l.data={ranges:k},o!=null&&(l.data.substractToken=o),l},_parseCharIntervalToken:function(n,t,i,r){var h=System.Text.RegularExpressions.RegexEngineParser,u=h.tokenTypes,f,o,e,s;if(i.type!==u.literal||i.value!=="-"||t.type!==u.literal&&t.type!==u.escChar&&t.type!==u.escCharOctal&&t.type!==u.escCharHex&&t.type!==u.escCharCtrl&&t.type!==u.escCharUnicode&&t.type!==u.escCharOther||r.type!==u.literal&&r.type!==u.escChar&&r.type!==u.escCharOctal&&r.type!==u.escCharHex&&r.type!==u.escCharCtrl&&r.type!==u.escCharUnicode&&r.type!==u.escCharOther)return null;if(t.type===u.literal?(f=t.value.charCodeAt(0),o=t.value):(f=t.data.n,o=t.data.ch),r.type===u.literal?(e=r.value.charCodeAt(0),s=r.value):(e=r.data.n,s=r.data.ch),f>e)throw new System.NotSupportedException("[x-y] range in reverse order.");var l=t.index,a=t.length+i.length+r.length,c=h._createPatternToken(n,u.charInterval,l,a,[t,i,r],"","");return c.data={startN:f,startCh:o,endN:e,endCh:s},c},_tidyCharRange:function(n){for(var l=System.Text.RegularExpressions.RegexEngineParser,i=l.tokenTypes,f,e,o,t,r=[],a=[],s,h,c,v,u=0;u<n.length;u++){if(t=n[u],t.type===i.literal)e=t.value.charCodeAt(0),o=e;else if(t.type===i.charInterval)e=t.data.startN,o=t.data.endN;else if(t.type===i.literal||t.type===i.escChar||t.type===i.escCharOctal||t.type===i.escCharHex||t.type===i.escCharCtrl||t.type===i.escCharUnicode||t.type===i.escCharOther)e=t.data.n,o=e;else if(t.type===i.charGroup||t.type===i.charNegativeGroup)continue;else{a.push(t);continue}if(r.length===0){r.push({n:e,m:o});continue}for(f=0;f<r.length;f++)if(r[f].n>e)break;r.splice(f,0,{n:e,m:o})}for(u=0;u<r.length;u++){for(s=r[u],c=0,f=u+1;f<r.length;f++){if(h=r[f],h.n>1+s.m)break;c++;h.m>s.m&&(s.m=h.m)}c>0&&r.splice(u+1,c)}return a.length>0&&(v="["+l._constructPattern(a)+"]",r.charClassToken=l._createPatternToken(v,i.charGroup,0,v.length,n,"[","]")),r},_parseDotToken:function(n,t){var i=System.Text.RegularExpressions.RegexEngineParser,r=i.tokenTypes,u=n[t];return u!=="."?null:i._createPatternToken(n,r.escCharClassDot,t,1)},_parseAnchorToken:function(n,t){var i=System.Text.RegularExpressions.RegexEngineParser,u=i.tokenTypes,r=n[t];return r!=="^"&&r!=="$"?null:i._createPatternToken(n,u.anchor,t,1)},_updateSettingsFromConstructs:function(n,t){t.isIgnoreWhitespace!=null&&(n.ignoreWhitespace=t.isIgnoreWhitespace);t.isExplicitCapture!=null&&(n.explicitCapture=t.isExplicitCapture)},_parseGroupToken:function(n,t,i,r){var s=System.Text.RegularExpressions.RegexEngineParser,u=s.tokenTypes,a={ignoreWhitespace:t.ignoreWhitespace,explicitCapture:t.explicitCapture},e=n[i],h,c,l,ft,et,p,w,ot,b,nt;if(e!=="(")return null;var k=1,y=!1,d=i+1,o=-1,g=!1,tt=!1,it=!1,rt=!1,ut=!1,v=null,f=s._parseGroupConstructToken(n,a,i+1,r);for(f!=null&&(v=this._fillGroupConstructs(f),d+=f.length,f.type===u.commentInline?g=!0:f.type===u.alternationGroupCondition?tt=!0:f.type===u.groupConstructImnsx?(this._updateSettingsFromConstructs(a,v),rt=!0):f.type===u.groupConstructImnsxMisc&&(this._updateSettingsFromConstructs(t,v),it=!0)),a.explicitCapture&&(v==null||v.name1==null)&&(ut=!0),h=d;h<r;){if(e=n[h],e==="\\")h++;else if(e==="[")y=!0;else if(e==="]"&&y)y=!1;else if(!y)if(e!=="("||g){if(e===")"&&(--k,k===0)){o=h;break}}else++k;++h}if(c=null,g){if(o<0)throw new System.ArgumentException("Unterminated (?#...) comment.");c=s._createPatternToken(n,u.commentInline,i,1+o-i)}else{if(o<0)throw new System.ArgumentException("Not enough )'s.");if(l=s._parsePatternImpl(n,a,d,o),f!=null&&l.splice(0,0,f),tt){for(ft=l.length,w=0,p=0;p<ft;p++)if(et=l[p],et.type===u.alternation&&(++w,w>1))throw new System.ArgumentException("Too many | in (?()|).");if(w===0)throw new System.NotSupportedException("Alternation group without | is not supported.");ot=s._createPatternToken(n,u.alternationGroup,i,1+o-i,l,"(",")");c=ot}else b=u.group,it?b=u.groupImnsxMisc:rt&&(b=u.groupImnsx),nt=s._createPatternToken(n,b,i,1+o-i,l,"(",")"),nt.localSettings=a,c=nt}return ut&&(c.isNonCapturingExplicit=!0),c},_parseGroupConstructToken:function(n,t,i,r){var f=System.Text.RegularExpressions.RegexEngineParser,o=f.tokenTypes,u=n[i],h,c,s,l,e,a,v;if(u!=="?"||i+1>=r)return null;if(u=n[i+1],u===":"||u==="="||u==="!"||u===">")return f._createPatternToken(n,o.groupConstruct,i,2);if(u==="#")return f._createPatternToken(n,o.commentInline,i,2);if(u==="(")return f._parseAlternationGroupConditionToken(n,t,i,r);if(u==="<"&&i+2<r&&(h=n[i+2],h==="="||h==="!"))return f._createPatternToken(n,o.groupConstruct,i,3);if(u==="<"||u==="'"){if(c=u==="<"?">":u,s=f._matchUntil(n,i+2,r,c),s.unmatchLength!==1||s.matchLength===0)throw new System.ArgumentException("Unrecognized grouping construct.");if(l=s.match.slice(0,1),"`~@#$%^&*()+{}[]|\\/|'\";:,.?".indexOf(l)>=0)throw new System.ArgumentException("Invalid group name: Group names must begin with a word character.");return f._createPatternToken(n,o.groupConstructName,i,2+s.matchLength+1)}if(e=f._matchChars(n,i+1,r,"imnsx-"),e.matchLength>0&&(e.unmatchCh===":"||e.unmatchCh===")"))return a=e.unmatchCh===":"?o.groupConstructImnsx:o.groupConstructImnsxMisc,v=e.unmatchCh===":"?1:0,f._createPatternToken(n,a,i,1+e.matchLength+v);throw new System.ArgumentException("Unrecognized grouping construct.");},_parseQuantifierToken:function(n,t,i){var f=System.Text.RegularExpressions.RegexEngineParser,s=f.tokenTypes,r=null,e=n[t],u,o,h,c;if(e==="*"||e==="+"||e==="?")r=f._createPatternToken(n,s.quantifier,t,1),r.data={val:e};else if(e==="{"&&(u=f._matchChars(n,t+1,i,f._decSymbols),u.matchLength!==0))if(u.unmatchCh==="}")r=f._createPatternToken(n,s.quantifierN,t,1+u.matchLength+1),r.data={n:parseInt(u.match,10)};else if(u.unmatchCh===","&&(o=f._matchChars(n,u.unmatchIndex+1,i,f._decSymbols),o.unmatchCh==="}"&&(r=f._createPatternToken(n,s.quantifierNM,t,1+u.matchLength+1+o.matchLength+1),r.data={n:parseInt(u.match,10),m:null},o.matchLength!==0&&(r.data.m=parseInt(o.match,10),r.data.n>r.data.m))))throw new System.ArgumentException("Illegal {x,y} with x > y.");return r!=null&&(h=t+r.length,h<i&&(c=n[h],c==="?"&&(this._modifyPatternToken(r,n,r.type,r.index,r.length+1),r.data.isLazy=!0))),r},_parseAlternationToken:function(n,t){var i=System.Text.RegularExpressions.RegexEngineParser,r=i.tokenTypes,u=n[t];return u!=="|"?null:i._createPatternToken(n,r.alternation,t,1)},_parseAlternationGroupConditionToken:function(n,t,i,r){var s=System.Text.RegularExpressions.RegexEngineParser,u=s.tokenTypes,h,l,c=null,w=n[i],f,e,o,v,y,p,a;if(w!=="?"||i+1>=r||n[i+1]!=="("||(f=s._parseGroupToken(n,t,i+1,r),f==null))return null;if(f.type===u.commentInline)throw new System.ArgumentException("Alternation conditions cannot be comments.");if(e=f.children,e&&e.length){if(h=e[0],h.type===u.groupConstructName)throw new System.ArgumentException("Alternation conditions do not capture and cannot be named.");if((h.type===u.groupConstruct||h.type===u.groupConstructImnsx)&&(l=s._findFirstGroupWithoutConstructs(e),l!=null&&(l.isEmptyCapturing=!0)),h.type===u.literal)if(o=f.value.slice(1,f.value.length-1),v=o[0]>="0"&&o[0]<="9",v){if(y=s._matchChars(o,0,o.length,s._decSymbols),y.matchLength!==o.length)throw new System.ArgumentException("Malformed Alternation group number: "+o+".");p=parseInt(o,10);c={number:p}}else c={name:o}}return e.length&&(e[0].type===u.groupConstruct||e[0].type===u.groupConstructImnsx)||(h=s._createPatternToken("?:",u.groupConstruct,0,2),e.splice(0,0,h)),a=s._createPatternToken(n,u.alternationGroupCondition,f.index-1,1+f.length,[f],"?",""),c!=null&&(a.data=c),a},_findFirstGroupWithoutConstructs:function(n){for(var f=System.Text.RegularExpressions.RegexEngineParser,u=f.tokenTypes,i=null,t,r=0;r<n.length;++r)if(t=n[r],t.type===u.group&&t.children&&t.children.length){if(t.children[0].type!==u.groupConstruct&&t.children[0].type!==u.groupConstructImnsx){i=t;break}if(t.children&&t.children.length&&(i=f._findFirstGroupWithoutConstructs(t.children),i!=null))break}return i},_parseXModeCommentToken:function(n,t,i){var f=System.Text.RegularExpressions.RegexEngineParser,e=f.tokenTypes,u=n[t],r;if(u!=="#")return null;for(r=t+1;r<i;)if(u=n[r],++r,u==="\n")break;return f._createPatternToken(n,e.commentXMode,t,r-t)},_createLiteralToken:function(n){var t=System.Text.RegularExpressions.RegexEngineParser;return t._createPatternToken(n,t.tokenTypes.literal,0,n.length)},_createPositiveLookaheadToken:function(n,t){var r=System.Text.RegularExpressions.RegexEngineParser,i="(?="+n+")";return r._parseGroupToken(i,t,0,i.length)},_createPatternToken:function(n,t,i,r,u,f,e){var o={type:t,index:i,length:r,value:n.slice(i,i+r)};return u!=null&&u.length>0&&(o.children=u,o.childrenPrefix=f,o.childrenPostfix=e),o},_modifyPatternToken:function(n,t,i,r,u){i!=null&&(n.type=i);(r!=null||u!=null)&&(r!=null&&(n.index=r),u!=null&&(n.length=u),n.value=t.slice(n.index,n.index+n.length))},_updatePatternToken:function(n,t,i,r,u){n.type=t;n.index=i;n.length=r;n.value=u},_matchChars:function(n,t,i,r,u){var f={match:"",matchIndex:-1,matchLength:0,unmatchCh:"",unmatchIndex:-1,unmatchLength:0},e=t,o;for(u!=null&&u>=0&&(i=t+u);e<i;){if(o=n[e],r.indexOf(o)<0){f.unmatchCh=o;f.unmatchIndex=e;f.unmatchLength=1;break}e++}return e>t&&(f.match=n.slice(t,e),f.matchIndex=t,f.matchLength=e-t),f},_matchUntil:function(n,t,i,r,u){var f={match:"",matchIndex:-1,matchLength:0,unmatchCh:"",unmatchIndex:-1,unmatchLength:0},e=t,o;for(u!=null&&u>=0&&(i=t+u);e<i;){if(o=n[e],r.indexOf(o)>=0){f.unmatchCh=o;f.unmatchIndex=e;f.unmatchLength=1;break}e++}return e>t&&(f.match=n.slice(t,e),f.matchIndex=t,f.matchLength=e-t),f}}});Bridge.define("System.Random",{statics:{MBIG:2147483647,MSEED:161803398,MZ:0},inext:0,inextp:0,seedArray:null,config:{init:function(){this.seedArray=System.Array.init(56,0)}},ctor:function(){System.Random.$ctor1.call(this,System.Int64.clip32(System.Int64((new Date).getTime()).mul(1e4)))},$ctor1:function(n){var e,u,i,o,r,f,t;for(this.$initialize(),o=n===-2147483648?2147483647:Math.abs(n),u=System.Random.MSEED-o|0,this.seedArray[55]=u,i=1,r=1;r<55;r=r+1|0)e=(21*r|0)%55,this.seedArray[e]=i,i=u-i|0,i<0&&(i=i+System.Random.MBIG|0),u=this.seedArray[e];for(f=1;f<5;f=f+1|0)for(t=1;t<56;t=t+1|0)this.seedArray[t]=this.seedArray[t]-this.seedArray[1+(t+30|0)%55|0]|0,this.seedArray[t]<0&&(this.seedArray[t]=this.seedArray[t]+System.Random.MBIG|0);this.inext=0;this.inextp=21;n=1},sample:function(){return this.internalSample()*46566128752457969e-26},internalSample:function(){var n,t=this.inext,i=this.inextp;return(t=t+1|0)>=56&&(t=1),(i=i+1|0)>=56&&(i=1),n=this.seedArray[t]-this.seedArray[i]|0,n===System.Random.MBIG&&(n=n-1|0),n<0&&(n=n+System.Random.MBIG|0),this.seedArray[t]=n,this.inext=t,this.inextp=i,n},next:function(){return this.internalSample()},next$2:function(n,t){if(n>t)throw new System.ArgumentOutOfRangeException("minValue","'minValue' cannot be greater than maxValue.");var i=System.Int64(t).sub(System.Int64(n));return i.lte(System.Int64(2147483647))?Bridge.Int.clip32(this.sample()*System.Int64.toNumber(i))+n|0:System.Int64.clip32(Bridge.Int.clip64(this.getSampleForLargeRange()*System.Int64.toNumber(i)).add(System.Int64(n)))},next$1:function(n){if(n<0)throw new System.ArgumentOutOfRangeException("maxValue","'maxValue' must be greater than zero.");return Bridge.Int.clip32(this.sample()*n)},getSampleForLargeRange:function(){var n=this.internalSample(),i=this.internalSample()%2==0?!0:!1,t;return i&&(n=-n|0),t=n,t+=2147483646,t/4294967293},nextDouble:function(){return this.sample()},nextBytes:function(n){if(n==null)throw new System.ArgumentNullException("buffer");for(var t=0;t<n.length;t=t+1|0)n[t]=this.internalSample()%256&255}});Bridge.define("System.Threading.Timer",{inherits:[System.IDisposable],statics:{MAX_SUPPORTED_TIMEOUT:4294967294,EXC_LESS:"Number must be either non-negative and less than or equal to Int32.MaxValue or -1.",EXC_MORE:"Time-out interval must be less than 2^32-2.",EXC_DISPOSED:"The timer has been already disposed."},dueTime:System.Int64(0),period:System.Int64(0),timerCallback:null,state:null,id:null,disposed:!1,config:{alias:["dispose","System$IDisposable$dispose"]},$ctor1:function(n,t,i,r){this.$initialize();this.timerSetup(n,t,System.Int64(i),System.Int64(r))},$ctor3:function(n,t,i,r){this.$initialize();var u=Bridge.Int.clip64(i.getTotalMilliseconds()),f=Bridge.Int.clip64(r.getTotalMilliseconds());this.timerSetup(n,t,u,f)},$ctor4:function(n,t,i,r){this.$initialize();this.timerSetup(n,t,System.Int64(i),System.Int64(r))},$ctor2:function(n,t,i,r){this.$initialize();this.timerSetup(n,t,i,r)},ctor:function(n){this.$initialize();this.timerSetup(n,this,System.Int64(-1),System.Int64(-1))},timerSetup:function(n,t,i,r){if(this.disposed)throw new System.InvalidOperationException(System.Threading.Timer.EXC_DISPOSED);if(Bridge.staticEquals(n,null))throw new System.ArgumentNullException("TimerCallback");if(i.lt(System.Int64(-1)))throw new System.ArgumentOutOfRangeException("dueTime",System.Threading.Timer.EXC_LESS);if(r.lt(System.Int64(-1)))throw new System.ArgumentOutOfRangeException("period",System.Threading.Timer.EXC_LESS);if(i.gt(System.Int64(System.Threading.Timer.MAX_SUPPORTED_TIMEOUT)))throw new System.ArgumentOutOfRangeException("dueTime",System.Threading.Timer.EXC_MORE);if(r.gt(System.Int64(System.Threading.Timer.MAX_SUPPORTED_TIMEOUT)))throw new System.ArgumentOutOfRangeException("period",System.Threading.Timer.EXC_MORE);return this.dueTime=i,this.period=r,this.state=t,this.timerCallback=n,this.runTimer(this.dueTime)},handleCallback:function(){if(!this.disposed&&!Bridge.staticEquals(this.timerCallback,null)){var n=this.id;this.timerCallback(this.state);System.Nullable.eq(this.id,n)&&this.runTimer(this.period,!1)}},runTimer:function(n,t){if(t===void 0&&(t=!0),t&&this.disposed)throw new System.InvalidOperationException(System.Threading.Timer.EXC_DISPOSED);if(n.ne(System.Int64(-1))&&!this.disposed){var i=n.toNumber();return this.id=Bridge.global.setTimeout(Bridge.fn.bind(this,this.handleCallback),i),!0}return!1},change:function(n,t){return this.changeTimer(System.Int64(n),System.Int64(t))},change$2:function(n,t){return this.changeTimer(Bridge.Int.clip64(n.getTotalMilliseconds()),Bridge.Int.clip64(t.getTotalMilliseconds()))},change$3:function(n,t){return this.changeTimer(System.Int64(n),System.Int64(t))},change$1:function(n,t){return this.changeTimer(n,t)},changeTimer:function(n,t){return this.clearTimeout(),this.timerSetup(this.timerCallback,this.state,n,t)},clearTimeout:function(){System.Nullable.hasValue(this.id)&&(Bridge.global.clearTimeout(System.Nullable.getValue(this.id)),this.id=null)},dispose:function(){this.clearTimeout();this.disposed=!0}});Bridge.define("Bridge.Console",{statics:{BODY_WRAPPER_ID:"bridge-body-wrapper",CONSOLE_MESSAGES_ID:"bridge-console-messages",position:"horizontal",instance:null,getInstance:function(){return Bridge.Console.instance==null&&(Bridge.Console.instance=new Bridge.Console),Bridge.Console.instance},logBase:function(n,t){var i,r,u;if(t===void 0&&(t=0),i=Bridge.Console.getInstance(),r=n!=null?n.toString():"null",i.bufferedOutput!=null){i.bufferedOutput=System.String.concat(i.bufferedOutput,r);return}Bridge.Console.show();u=i.buildConsoleMessage(r,t);i.consoleMessages.appendChild(u);i.currentMessageElement=u;i.consoleDefined?t===1&&i.consoleDebugDefined?Bridge.global.console.debug(r):Bridge.global.console.log(r):i.operaPostErrorDefined&&Bridge.global.opera.postError(r)},error:function(n){Bridge.Console.logBase(n,2)},debug:function(n){Bridge.Console.logBase(n,1)},log:function(n){Bridge.Console.logBase(n)},hide:function(){if(Bridge.Console.instance!=null){var n=Bridge.Console.getInstance();n.hidden||n.close()}},show:function(){var n=Bridge.Console.getInstance();n.hidden&&n.init(!0)},toggle:function(){Bridge.Console.getInstance().hidden?Bridge.Console.show():Bridge.Console.hide()}},svgNS:"http://www.w3.org/2000/svg",consoleHeight:"300px",consoleHeaderHeight:"35px",tooltip:null,consoleWrapper:null,consoleMessages:null,bridgeIcon:null,bridgeIconPath:null,bridgeConsoleLabel:null,closeBtn:null,closeIcon:null,closeIconPath:null,consoleHeader:null,consoleBody:null,hidden:!0,consoleDefined:!1,consoleDebugDefined:!1,operaPostErrorDefined:!1,currentMessageElement:null,bufferedOutput:null,ctor:function(){this.$initialize();this.init()},init:function(n){var s,i,h,c,f,r;n===void 0&&(n=!1);this.hidden=!1;var t=Bridge.fn.bind(this,o.$.Bridge.Console.f1)(new(System.Collections.Generic.Dictionary$2(String,String))),e=o.$.Bridge.Console.f2(new(System.Collections.Generic.Dictionary$2(String,String))),u=o.$.Bridge.Console.f3(new(System.Collections.Generic.Dictionary$2(String,String)));this.bridgeIcon=this.bridgeIcon||document.createElementNS(this.svgNS,"svg");s=Bridge.fn.bind(this,o.$.Bridge.Console.f4)(new(System.Collections.Generic.Dictionary$2(String,String)));this.setAttributes(this.bridgeIcon,s);this.bridgeIconPath=this.bridgeIconPath||document.createElementNS(this.svgNS,"path");i=new(System.Collections.Generic.Dictionary$2(String,String));i.set("d","M19 14.4h2.2V9.6L19 7.1v7.3zm4.3-2.5v2.5h2.2l-2.2-2.5zm-8.5 2.5H17V4.8l-2.2-2.5v12.1zM0 14.4h3l7.5-8.5v8.5h2.2V0L0 14.4z");i.set("fill","#555");this.setAttributes(this.bridgeIconPath,i);this.bridgeConsoleLabel=this.bridgeConsoleLabel||document.createElement("span");this.bridgeConsoleLabel.innerHTML="Bridge Console";this.closeBtn=this.closeBtn||document.createElement("span");this.closeBtn.setAttribute("style","position: relative;display: inline-block;float: right;cursor: pointer");this.closeIcon=this.closeIcon||document.createElementNS(this.svgNS,"svg");h=Bridge.fn.bind(this,o.$.Bridge.Console.f5)(new(System.Collections.Generic.Dictionary$2(String,String)));this.setAttributes(this.closeIcon,h);this.closeIconPath=this.closeIconPath||document.createElementNS(this.svgNS,"path");c=o.$.Bridge.Console.f6(new(System.Collections.Generic.Dictionary$2(String,String)));this.setAttributes(this.closeIconPath,c);this.tooltip=this.tooltip||document.createElement("div");this.tooltip.innerHTML="Refresh page to open Bridge Console";this.tooltip.setAttribute("style","position: absolute;right: 30px;top: -6px;white-space: nowrap;padding: 7px;border-radius: 3px;background-color: rgba(0, 0, 0, 0.75);color: #eee;text-align: center;visibility: hidden;opacity: 0;-webkit-transition: all 0.25s ease-in-out;transition: all 0.25s ease-in-out;z-index: 1;");Bridge.Console.position="horizontal";Bridge.referenceEquals(Bridge.Console.position,"horizontal")?(this.wrapBodyContent(),t.set("right","0"),e.set("border-top","1px solid #a3a3a3"),u.set("height",this.consoleHeight)):Bridge.referenceEquals(Bridge.Console.position,"vertical")&&(f="400px",document.body.style.marginLeft=f,t.set("top","0"),t.set("width",f),t.set("border-right","1px solid #a3a3a3"),u.set("height","100%"));this.consoleWrapper=this.consoleWrapper||document.createElement("div");this.consoleWrapper.setAttribute("style",this.obj2Css(t));this.consoleHeader=this.consoleHeader||document.createElement("div");this.consoleHeader.setAttribute("style",this.obj2Css(e));this.consoleBody=this.consoleBody||document.createElement("div");this.consoleBody.setAttribute("style",this.obj2Css(u));this.consoleMessages=this.consoleMessages||document.createElement("ul");r=this.consoleMessages;r.id=Bridge.Console.CONSOLE_MESSAGES_ID;r.setAttribute("style","margin: 0;padding: 0;list-style: none;");n||(this.bridgeIcon.appendChild(this.bridgeIconPath),this.closeIcon.appendChild(this.closeIconPath),this.closeBtn.appendChild(this.closeIcon),this.closeBtn.appendChild(this.tooltip),this.consoleHeader.appendChild(this.bridgeIcon),this.consoleHeader.appendChild(this.bridgeConsoleLabel),this.consoleHeader.appendChild(this.closeBtn),this.consoleBody.appendChild(r),this.consoleWrapper.appendChild(this.consoleHeader),this.consoleWrapper.appendChild(this.consoleBody),document.body.appendChild(this.consoleWrapper),this.closeBtn.addEventListener("click",Bridge.fn.bind(this,this.close)),this.closeBtn.addEventListener("mouseover",Bridge.fn.bind(this,this.showTooltip)),this.closeBtn.addEventListener("mouseout",Bridge.fn.bind(this,this.hideTooltip)),this.consoleDefined=Bridge.isDefined(Bridge.global)&&Bridge.isDefined(Bridge.global.console),this.consoleDebugDefined=this.consoleDefined&&Bridge.isDefined(Bridge.global.console.debug),this.operaPostErrorDefined=Bridge.isDefined(Bridge.global.opera)&&Bridge.isDefined(Bridge.global.opera.postError))},showTooltip:function(){var n=Bridge.Console.getInstance();n.tooltip.style.right="20px";n.tooltip.style.visibility="visible";n.tooltip.style.opacity="1"},hideTooltip:function(){var n=Bridge.Console.getInstance();n.tooltip.style.right="30px";n.tooltip.style.opacity="0"},close:function(){this.hidden=!0;this.consoleWrapper.style.display="none";Bridge.referenceEquals(Bridge.Console.position,"horizontal")?this.unwrapBodyContent():Bridge.referenceEquals(Bridge.Console.position,"vertical")&&document.body.removeAttribute("style")},wrapBodyContent:function(){if(document.body!=null){var n=document.defaultView.getComputedStyle(document.body,null),i=n.paddingTop,r=n.paddingRight,s=n.paddingBottom,u=n.paddingLeft,f=n.marginTop,e=n.marginRight,h=n.marginBottom,o=n.marginLeft,t=document.createElement("div");for(t.id=Bridge.Console.BODY_WRAPPER_ID,t.setAttribute("style",System.String.concat("height: calc(100vh - ",this.consoleHeight," - ",this.consoleHeaderHeight,");","margin-top: calc(-1 * ","(",System.String.concat(f," + ",i),"));","margin-right: calc(-1 * ","(",System.String.concat(e," + ",r),"));","margin-left: calc(-1 * ","(",System.String.concat(o," + ",u),"));","padding-top: calc(",System.String.concat(f," + ",i),");","padding-right: calc(",System.String.concat(e," + ",r),");","padding-bottom: calc(",System.String.concat(h," + ",s),");","padding-left: calc(",System.String.concat(o," + ",u),");","overflow-x: auto;","box-sizing: border-box !important;"));document.body.firstChild!=null;)t.appendChild(document.body.firstChild);document.body.appendChild(t)}},unwrapBodyContent:function(){var n=document.getElementById(Bridge.Console.BODY_WRAPPER_ID);if(n!=null){while(n.firstChild!=null)document.body.insertBefore(n.firstChild,n);document.body.removeChild(n)}},buildConsoleMessage:function(n,t){var r=document.createElement("li"),u,h,i,s,f,e;return r.setAttribute("style","padding: 5px 10px;border-bottom: 1px solid #f0f0f0;"),u=document.createElementNS(this.svgNS,"svg"),h=Bridge.fn.bind(this,o.$.Bridge.Console.f7)(new(System.Collections.Generic.Dictionary$2(String,String))),this.setAttributes(u,h),i="#555",t===2?i="#d65050":t===1&&(i="#1800FF"),s=document.createElementNS(this.svgNS,"path"),f=new(System.Collections.Generic.Dictionary$2(String,String)),f.set("d","M3.8 3.5L.7 6.6s-.1.1-.2.1-.1 0-.2-.1l-.2-.3C0 6.2 0 6.2 0 6.1c0 0 0-.1.1-.1l2.6-2.6L.1.7C0 .7 0 .6 0 .6 0 .5 0 .5.1.4L.4.1c0-.1.1-.1.2-.1s.1 0 .2.1l3.1 3.1s.1.1.1.2-.1.1-.2.1z"),f.set("fill",i),this.setAttributes(s,f),u.appendChild(s),e=document.createElement("span"),e.innerHTML=n,e.setAttribute("style",System.String.concat("color: ",i,"; white-space: pre;")),r.appendChild(u),r.appendChild(e),r},setAttributes:function(n,t){for(var r,i=Bridge.getEnumerator(t);i.moveNext();)r=i.getCurrent(),n.setAttribute(r.key,r.value)},obj2Css:function(n){for(var i="",r,t=Bridge.getEnumerator(n);t.moveNext();)r=t.getCurrent(),i=System.String.concat(i,System.String.concat(r.key.toLowerCase(),":",r.value,";"));return i}});Bridge.ns("Bridge.Console",o.$);Bridge.apply(o.$.Bridge.Console,{f1:function(n){return n.add("position","fixed"),n.add("left","0"),n.add("bottom","0"),n.add("padding-top",this.consoleHeaderHeight),n.add("background-color","#fff"),n.add("font","normal normal normal 13px/1 sans-serif"),n.add("color","#555"),n},f2:function(n){return n.add("position","absolute"),n.add("top","0"),n.add("left","0"),n.add("right","0"),n.add("height","35px"),n.add("padding","9px 15px 7px 10px"),n.add("border-bottom","1px solid #ccc"),n.add("background-color","#f3f3f3"),n.add("box-sizing","border-box"),n},f3:function(n){return n.add("overflow-x","auto"),n.add("font-family","Menlo, Monaco, Consolas, 'Courier New', monospace"),n},f4:function(n){return n.add("xmlns",this.svgNS),n.add("width","25.5"),n.add("height","14.4"),n.add("viewBox","0 0 25.5 14.4"),n.add("style","margin: 0 3px 3px 0;vertical-align:middle;"),n},f5:function(n){return n.add("xmlns",this.svgNS),n.add("width","11.4"),n.add("height","11.4"),n.add("viewBox","0 0 11.4 11.4"),n.add("style","vertical-align: middle;"),n},f6:function(n){return n.add("d","M11.4 1.4L10 0 5.7 4.3 1.4 0 0 1.4l4.3 4.3L0 10l1.4 1.4 4.3-4.3 4.3 4.3 1.4-1.4-4.3-4.3"),n.add("fill","#555"),n},f7:function(n){return n.add("xmlns",this.svgNS),n.add("width","3.9"),n.add("height","6.7"),n.add("viewBox","0 0 3.9 6.7"),n.add("style","margin-right: 7px; vertical-align: middle;"),n}});typeof define=="function"&&define.amd?define("bridge",[],function(){return Bridge}):typeof module!="undefined"&&module.exports&&(module.exports=Bridge)})(this);
9Bridge.assembly("Bridge.Collections",function(){"use strict";Bridge.define("System.Collections.BitArray",{inherits:[System.Collections.ICollection,System.ICloneable],statics:{BitsPerInt32:32,BytesPerInt32:4,BitsPerByte:8,_ShrinkThreshold:256,getArrayLength:function(n,t){return n>0?(Bridge.Int.div(n-1|0,t)|0)+1|0:0}},m_array:null,m_length:0,_version:0,config:{alias:["getCount","System$Collections$ICollection$getCount","clone","System$ICloneable$clone","getIsReadOnly","System$Collections$ICollection$getIsReadOnly","getEnumerator","System$Collections$IEnumerable$getEnumerator"]},$ctor3:function(n){System.Collections.BitArray.$ctor4.call(this,n,!1)},$ctor4:function(n,t){var r,i;if(this.$initialize(),n<0)throw new System.ArgumentOutOfRangeException("length","Index is less than zero.");for(this.m_array=System.Array.init(System.Collections.BitArray.getArrayLength(n,System.Collections.BitArray.BitsPerInt32),0),this.m_length=n,r=t?-1:0,i=0;i<this.m_array.length;i=i+1|0)this.m_array[i]=r;this._version=0},$ctor1:function(n){var i,t,r;if(this.$initialize(),n==null)throw new System.ArgumentNullException("bytes");if(n.length>268435455)throw new System.ArgumentException(System.String.format("The input array length must not exceed Int32.MaxValue / {0}. Otherwise BitArray.Length would exceed Int32.MaxValue.",System.Collections.BitArray.BitsPerByte),"bytes");for(this.m_array=System.Array.init(System.Collections.BitArray.getArrayLength(n.length,System.Collections.BitArray.BytesPerInt32),0),this.m_length=n.length*System.Collections.BitArray.BitsPerByte|0,i=0,t=0;(n.length-t|0)>=4;)this.m_array[Bridge.identity(i,i=i+1|0)]=n[t]&255|(n[t+1|0]&255)<<8|(n[t+2|0]&255)<<16|(n[t+3|0]&255)<<24,t=t+4|0;r=n.length-t|0;r===3&&(this.m_array[i]=(n[t+2|0]&255)<<16,r=2);r===2&&(this.m_array[i]=this.m_array[i]|(n[t+1|0]&255)<<8,r=1);r===1&&(this.m_array[i]=this.m_array[i]|n[t]&255);this._version=0},ctor:function(n){if(this.$initialize(),n==null)throw new System.ArgumentNullException("values");this.m_array=System.Array.init(System.Collections.BitArray.getArrayLength(n.length,System.Collections.BitArray.BitsPerInt32),0);this.m_length=n.length;for(var t=0;t<n.length;t=t+1|0)n[t]&&(this.m_array[Bridge.Int.div(t,32)|0]=this.m_array[Bridge.Int.div(t,32)|0]|1<<t%32);this._version=0},$ctor5:function(n){if(this.$initialize(),n==null)throw new System.ArgumentNullException("values");if(n.length>67108863)throw new System.ArgumentException(System.String.format("The input array length must not exceed Int32.MaxValue / {0}. Otherwise BitArray.Length would exceed Int32.MaxValue.",System.Collections.BitArray.BitsPerInt32),"values");this.m_array=System.Array.init(n.length,0);this.m_length=n.length*System.Collections.BitArray.BitsPerInt32|0;System.Array.copy(n,0,this.m_array,0,n.length);this._version=0},$ctor2:function(n){if(this.$initialize(),n==null)throw new System.ArgumentNullException("bits");var t=System.Collections.BitArray.getArrayLength(n.m_length,System.Collections.BitArray.BitsPerInt32);this.m_array=System.Array.init(t,0);this.m_length=n.m_length;System.Array.copy(n.m_array,0,this.m_array,0,t);this._version=n._version},getItem:function(n){return this.get(n)},setItem:function(n,t){this.set(n,t)},getLength:function(){return this.m_length},setLength:function(n){var t,r,i,u;if(n<0)throw new System.ArgumentOutOfRangeException("value","Non-negative number required.");t=System.Collections.BitArray.getArrayLength(n,System.Collections.BitArray.BitsPerInt32);(t>this.m_array.length||(t+System.Collections.BitArray._ShrinkThreshold|0)<this.m_array.length)&&(r=System.Array.init(t,0),System.Array.copy(this.m_array,0,r,0,t>this.m_array.length?this.m_array.length:t),this.m_array=r);n>this.m_length&&(i=System.Collections.BitArray.getArrayLength(this.m_length,System.Collections.BitArray.BitsPerInt32)-1|0,u=this.m_length%32,u>0&&(this.m_array[i]=this.m_array[i]&((1<<u)-1|0)),System.Array.fill(this.m_array,0,i+1|0,(t-i|0)-1|0));this.m_length=n;this._version=this._version+1|0},getCount:function(){return this.m_length},getIsReadOnly:function(){return!1},getIsSynchronized:function(){return!1},get:function(n){if(n<0||n>=this.getLength())throw new System.ArgumentOutOfRangeException("index","Index was out of range. Must be non-negative and less than the size of the collection.");return(this.m_array[Bridge.Int.div(n,32)|0]&1<<n%32)!=0},set:function(n,t){if(n<0||n>=this.getLength())throw new System.ArgumentOutOfRangeException("index","Index was out of range. Must be non-negative and less than the size of the collection.");this.m_array[Bridge.Int.div(n,32)|0]=t?this.m_array[Bridge.Int.div(n,32)|0]|1<<n%32:this.m_array[Bridge.Int.div(n,32)|0]&~(1<<n%32);this._version=this._version+1|0},setAll:function(n){for(var i=n?-1:0,r=System.Collections.BitArray.getArrayLength(this.m_length,System.Collections.BitArray.BitsPerInt32),t=0;t<r;t=t+1|0)this.m_array[t]=i;this._version=this._version+1|0},and:function(n){var i,t;if(n==null)throw new System.ArgumentNullException("value");if(this.getLength()!==n.getLength())throw new System.ArgumentException("Array lengths must be the same.");for(i=System.Collections.BitArray.getArrayLength(this.m_length,System.Collections.BitArray.BitsPerInt32),t=0;t<i;t=t+1|0)this.m_array[t]=this.m_array[t]&n.m_array[t];return this._version=this._version+1|0,this},or:function(n){var i,t;if(n==null)throw new System.ArgumentNullException("value");if(this.getLength()!==n.getLength())throw new System.ArgumentException("Array lengths must be the same.");for(i=System.Collections.BitArray.getArrayLength(this.m_length,System.Collections.BitArray.BitsPerInt32),t=0;t<i;t=t+1|0)this.m_array[t]=this.m_array[t]|n.m_array[t];return this._version=this._version+1|0,this},xor:function(n){var i,t;if(n==null)throw new System.ArgumentNullException("value");if(this.getLength()!==n.getLength())throw new System.ArgumentException("Array lengths must be the same.");for(i=System.Collections.BitArray.getArrayLength(this.m_length,System.Collections.BitArray.BitsPerInt32),t=0;t<i;t=t+1|0)this.m_array[t]=this.m_array[t]^n.m_array[t];return this._version=this._version+1|0,this},not:function(){for(var t=System.Collections.BitArray.getArrayLength(this.m_length,System.Collections.BitArray.BitsPerInt32),n=0;n<t;n=n+1|0)this.m_array[n]=~this.m_array[n];return this._version=this._version+1|0,this},clone:function(){var n=new System.Collections.BitArray.$ctor5(this.m_array);return n._version=this._version,n.m_length=this.m_length,n},getEnumerator:function(){return new System.Collections.BitArray.BitArrayEnumeratorSimple(this)}});Bridge.define("System.Collections.BitArray.BitArrayEnumeratorSimple",{inherits:[System.Collections.IEnumerator],bitarray:null,index:0,version:0,currentElement:!1,config:{alias:["moveNext","System$Collections$IEnumerator$moveNext","getCurrent","System$Collections$IEnumerator$getCurrent","reset","System$Collections$IEnumerator$reset"]},ctor:function(n){this.$initialize();this.bitarray=n;this.index=-1;this.version=n._version},getCurrent:function(){if(this.index===-1)throw new System.InvalidOperationException("Enumeration has not started. Call MoveNext.");if(this.index>=this.bitarray.getCount())throw new System.InvalidOperationException("Enumeration already finished.");return this.currentElement},moveNext:function(){if(this.version!==this.bitarray._version)throw new System.InvalidOperationException("Collection was modified; enumeration operation may not execute.");return this.index<(this.bitarray.getCount()-1|0)?(this.index=this.index+1|0,this.currentElement=this.bitarray.get(this.index),!0):(this.index=this.bitarray.getCount(),!1)},reset:function(){if(this.version!==this.bitarray._version)throw new System.InvalidOperationException("Collection was modified; enumeration operation may not execute.");this.index=-1}});Bridge.define("System.Collections.Generic.BitHelper",{statics:{MarkedBitFlag:1,IntSize:32,toIntArrayLength:function(n){return n>0?(Bridge.Int.div(n-1|0,System.Collections.Generic.BitHelper.IntSize)|0)+1|0:0}},_length:0,_array:null,ctor:function(n,t){this.$initialize();this._array=n;this._length=t},markBit:function(n){var t=Bridge.Int.div(n,System.Collections.Generic.BitHelper.IntSize)|0,i;t<this._length&&t>=0&&(i=System.Collections.Generic.BitHelper.MarkedBitFlag<<n%System.Collections.Generic.BitHelper.IntSize,this._array[t]=this._array[t]|i)},isMarked:function(n){var t=Bridge.Int.div(n,System.Collections.Generic.BitHelper.IntSize)|0,i;return t<this._length&&t>=0?(i=System.Collections.Generic.BitHelper.MarkedBitFlag<<n%System.Collections.Generic.BitHelper.IntSize,(this._array[t]&i)!=0):!1}});Bridge.define("Bridge.Collections.EnumerableHelpers",{statics:{toArray:function(n,t){var i={},r={v:Bridge.Collections.EnumerableHelpers.toArray$1(n,t,i)};return System.Array.resize(r,i.v,Bridge.getDefaultValue(n)),r.v},toArray$1:function(n,t,i){var u=Bridge.getEnumerator(t,null,n),s,f,r,e,o;try{if(u.System$Collections$IEnumerator$moveNext()){for(s=4,f={v:System.Array.init(s,function(){return Bridge.getDefaultValue(n)})},f.v[0]=u[Bridge.geti(u,"System$Collections$Generic$IEnumerator$1$"+Bridge.getTypeAlias(n)+"$getCurrent$1","getCurrent$1")](),r=1;u.System$Collections$IEnumerator$moveNext();)r===f.v.length&&(e=2146435071,o=r<<1,o>>>0>e&&(o=e<=r?r+1|0:e),System.Array.resize(f,o,Bridge.getDefaultValue(n))),f.v[Bridge.identity(r,r=r+1|0)]=u[Bridge.geti(u,"System$Collections$Generic$IEnumerator$1$"+Bridge.getTypeAlias(n)+"$getCurrent$1","getCurrent$1")]();return i.v=r,f.v}}finally{Bridge.hasValue(u)&&u.dispose()}return i.v=0,System.Array.init(0,function(){return Bridge.getDefaultValue(n)})}}});Bridge.define("System.Collections.Generic.HashSet$1",function(n){return{inherits:[System.Collections.Generic.ICollection$1(n),System.Collections.Generic.ISet$1(n)],statics:{Lower31BitMask:2147483647,ShrinkThreshold:3,hashSetEquals:function(t,i,r){var u,f,e,s,h,o,c;if(t==null)return i==null;if(i==null)return!1;if(System.Collections.Generic.HashSet$1(n).areEqualityComparersEqual(t,i)){if(t.getCount()!==i.getCount())return!1;for(u=Bridge.getEnumerator(i);u.moveNext();)if(s=u.getCurrent(),!t.contains(s))return!1;return!0}for(f=Bridge.getEnumerator(i);f.moveNext();){for(h=f.getCurrent(),o=!1,e=Bridge.getEnumerator(t);e.moveNext();)if(c=e.getCurrent(),r["System$Collections$Generic$IEqualityComparer$1$"+Bridge.getTypeAlias(n)+"$equals2"](h,c)){o=!0;break}if(!o)return!1}return!0},areEqualityComparersEqual:function(n,t){return Bridge.equals(n.getComparer(),t.getComparer())}},_buckets:null,_slots:null,_count:0,_lastIndex:0,_freeList:0,_comparer:null,_version:0,config:{alias:["System$Collections$Generic$ICollection$1$T$add","System$Collections$Generic$ICollection$1$"+Bridge.getTypeAlias(n)+"$add","clear","System$Collections$Generic$ICollection$1$"+Bridge.getTypeAlias(n)+"$clear","contains","System$Collections$Generic$ICollection$1$"+Bridge.getTypeAlias(n)+"$contains","copyTo","System$Collections$Generic$ICollection$1$"+Bridge.getTypeAlias(n)+"$copyTo","remove","System$Collections$Generic$ICollection$1$"+Bridge.getTypeAlias(n)+"$remove","getCount","System$Collections$Generic$ICollection$1$"+Bridge.getTypeAlias(n)+"$getCount","getIsReadOnly","System$Collections$Generic$ICollection$1$"+Bridge.getTypeAlias(n)+"$getIsReadOnly","System$Collections$Generic$IEnumerable$1$T$getEnumerator","System$Collections$Generic$IEnumerable$1$"+Bridge.getTypeAlias(n)+"$getEnumerator","add","System$Collections$Generic$ISet$1$"+Bridge.getTypeAlias(n)+"$add","unionWith","System$Collections$Generic$ISet$1$"+Bridge.getTypeAlias(n)+"$unionWith","intersectWith","System$Collections$Generic$ISet$1$"+Bridge.getTypeAlias(n)+"$intersectWith","exceptWith","System$Collections$Generic$ISet$1$"+Bridge.getTypeAlias(n)+"$exceptWith","symmetricExceptWith","System$Collections$Generic$ISet$1$"+Bridge.getTypeAlias(n)+"$symmetricExceptWith","isSubsetOf","System$Collections$Generic$ISet$1$"+Bridge.getTypeAlias(n)+"$isSubsetOf","isProperSubsetOf","System$Collections$Generic$ISet$1$"+Bridge.getTypeAlias(n)+"$isProperSubsetOf","isSupersetOf","System$Collections$Generic$ISet$1$"+Bridge.getTypeAlias(n)+"$isSupersetOf","isProperSupersetOf","System$Collections$Generic$ISet$1$"+Bridge.getTypeAlias(n)+"$isProperSupersetOf","overlaps","System$Collections$Generic$ISet$1$"+Bridge.getTypeAlias(n)+"$overlaps","setEquals","System$Collections$Generic$ISet$1$"+Bridge.getTypeAlias(n)+"$setEquals"]},ctor:function(){System.Collections.Generic.HashSet$1(n).$ctor3.call(this,System.Collections.Generic.EqualityComparer$1(n).def)},$ctor3:function(t){this.$initialize();t==null&&(t=System.Collections.Generic.EqualityComparer$1(n).def);this._comparer=t;this._lastIndex=0;this._count=0;this._freeList=-1;this._version=0},$ctor1:function(t){System.Collections.Generic.HashSet$1(n).$ctor2.call(this,t,System.Collections.Generic.EqualityComparer$1(n).def)},$ctor2:function(t,i){if(System.Collections.Generic.HashSet$1(n).$ctor3.call(this,i),t==null)throw new System.ArgumentNullException("collection");var r=0,u=Bridge.as(t,System.Collections.Generic.ICollection$1(n));u!=null&&(r=System.Array.getCount(u,n));this.initialize(r);this.unionWith(t);(this._count===0&&this._slots.length>System.Collections.HashHelpers.getMinPrime()||this._count>0&&(Bridge.Int.div(this._slots.length,this._count)|0)>System.Collections.Generic.HashSet$1(n).ShrinkThreshold)&&this.trimExcess()},getCount:function(){return this._count},getIsReadOnly:function(){return!1},getComparer:function(){return this._comparer},System$Collections$Generic$ICollection$1$T$add:function(n){this.addIfNotPresent(n)},add:function(n){return this.addIfNotPresent(n)},clear:function(){var t,i;if(this._lastIndex>0){for(t=0;t<this._lastIndex;t=t+1|0)this._slots[t]=new(System.Collections.Generic.HashSet$1.Slot(n));for(i=0;i<this._buckets.length;i=i+1|0)this._buckets[i]=0;this._lastIndex=0;this._count=0;this._freeList=-1}this._version=this._version+1|0},arrayClear:function(){},contains:function(t){var r,i;if(this._buckets!=null)for(r=this.internalGetHashCode(t),i=this._buckets[r%this._buckets.length]-1|0;i>=0;i=this._slots[i].next)if(this._slots[i].hashCode===r&&this._comparer["System$Collections$Generic$IEqualityComparer$1$"+Bridge.getTypeAlias(n)+"$equals2"](this._slots[i].value,t))return!0;return!1},copyTo:function(n,t){this.copyTo$2(n,t,this._count)},copyTo$1:function(n){this.copyTo$2(n,0,this._count)},copyTo$2:function(n,t,i){var u,r;if(n==null)throw new System.ArgumentNullException("array");if(t<0)throw new System.ArgumentOutOfRangeException("arrayIndex");if(i<0)throw new System.ArgumentOutOfRangeException("count");if(t>n.length||i>(n.length-t|0))throw new System.ArgumentException("Destination array is not long enough to copy all the items in the collection. Check array index and length.");for(u=0,r=0;r<this._lastIndex&&u<i;r=r+1|0)this._slots[r].hashCode>=0&&(n[t+u|0]=this._slots[r].value,u=u+1|0)},remove:function(t){var i;if(this._buckets!=null){var u=this.internalGetHashCode(t),f=u%this._buckets.length,r=-1;for(i=this._buckets[f]-1|0;i>=0;r=i,i=this._slots[i].next)if(this._slots[i].hashCode===u&&this._comparer["System$Collections$Generic$IEqualityComparer$1$"+Bridge.getTypeAlias(n)+"$equals2"](this._slots[i].value,t))return r<0?this._buckets[f]=this._slots[i].next+1|0:this._slots[r].next=this._slots[i].next,this._slots[i].hashCode=-1,this._slots[i].value=Bridge.getDefaultValue(n),this._slots[i].next=this._freeList,this._count=this._count-1|0,this._version=this._version+1|0,this._count===0?(this._lastIndex=0,this._freeList=-1):this._freeList=i,!0}return!1},getEnumerator:function(){return new(System.Collections.Generic.HashSet$1.Enumerator(n).$ctor1)(this)},System$Collections$Generic$IEnumerable$1$T$getEnumerator:function(){return new(System.Collections.Generic.HashSet$1.Enumerator(n).$ctor1)(this)},System$Collections$IEnumerable$getEnumerator:function(){return new(System.Collections.Generic.HashSet$1.Enumerator(n).$ctor1)(this)},unionWith:function(t){var i,r;if(t==null)throw new System.ArgumentNullException("other");for(i=Bridge.getEnumerator(t,null,n);i.moveNext();)r=i.getCurrent(),this.addIfNotPresent(r)},intersectWith:function(t){var r,i;if(t==null)throw new System.ArgumentNullException("other");if(this._count!==0){if(r=Bridge.as(t,System.Collections.Generic.ICollection$1(n)),r!=null){if(System.Array.getCount(r,n)===0){this.clear();return}if(i=Bridge.as(t,System.Collections.Generic.HashSet$1(n)),i!=null&&System.Collections.Generic.HashSet$1(n).areEqualityComparersEqual(this,i)){this.intersectWithHashSetWithSameEC(i);return}}this.intersectWithEnumerable(t)}},exceptWith:function(t){var i,r;if(t==null)throw new System.ArgumentNullException("other");if(this._count!==0){if(Bridge.referenceEquals(t,this)){this.clear();return}for(i=Bridge.getEnumerator(t,null,n);i.moveNext();)r=i.getCurrent(),this.remove(r)}},symmetricExceptWith:function(t){if(t==null)throw new System.ArgumentNullException("other");if(this._count===0){this.unionWith(t);return}if(Bridge.referenceEquals(t,this)){this.clear();return}var i=Bridge.as(t,System.Collections.Generic.HashSet$1(n));i!=null&&System.Collections.Generic.HashSet$1(n).areEqualityComparersEqual(this,i)?this.symmetricExceptWithUniqueHashSet(i):this.symmetricExceptWithEnumerable(t)},isSubsetOf:function(t){var i,r;if(t==null)throw new System.ArgumentNullException("other");return this._count===0?!0:(i=Bridge.as(t,System.Collections.Generic.HashSet$1(n)),i!=null&&System.Collections.Generic.HashSet$1(n).areEqualityComparersEqual(this,i)?this._count>i.getCount()?!1:this.isSubsetOfHashSetWithSameEC(i):(r=this.checkUniqueAndUnfoundElements(t,!1).$clone(),r.uniqueCount===this._count&&r.unfoundCount>=0))},isProperSubsetOf:function(t){var r,i,u;if(t==null)throw new System.ArgumentNullException("other");if(r=Bridge.as(t,System.Collections.Generic.ICollection$1(n)),r!=null){if(this._count===0)return System.Array.getCount(r,n)>0;if(i=Bridge.as(t,System.Collections.Generic.HashSet$1(n)),i!=null&&System.Collections.Generic.HashSet$1(n).areEqualityComparersEqual(this,i))return this._count>=i.getCount()?!1:this.isSubsetOfHashSetWithSameEC(i)}return u=this.checkUniqueAndUnfoundElements(t,!1).$clone(),u.uniqueCount===this._count&&u.unfoundCount>0},isSupersetOf:function(t){var r,i;if(t==null)throw new System.ArgumentNullException("other");if(r=Bridge.as(t,System.Collections.Generic.ICollection$1(n)),r!=null){if(System.Array.getCount(r,n)===0)return!0;if(i=Bridge.as(t,System.Collections.Generic.HashSet$1(n)),i!=null&&System.Collections.Generic.HashSet$1(n).areEqualityComparersEqual(this,i)&&i.getCount()>this._count)return!1}return this.containsAllElements(t)},isProperSupersetOf:function(t){var r,i,u;if(t==null)throw new System.ArgumentNullException("other");if(this._count===0)return!1;if(r=Bridge.as(t,System.Collections.Generic.ICollection$1(n)),r!=null){if(System.Array.getCount(r,n)===0)return!0;if(i=Bridge.as(t,System.Collections.Generic.HashSet$1(n)),i!=null&&System.Collections.Generic.HashSet$1(n).areEqualityComparersEqual(this,i))return i.getCount()>=this._count?!1:this.containsAllElements(i)}return u=this.checkUniqueAndUnfoundElements(t,!0).$clone(),u.uniqueCount<this._count&&u.unfoundCount===0},overlaps:function(t){var i,r;if(t==null)throw new System.ArgumentNullException("other");if(this._count===0)return!1;for(i=Bridge.getEnumerator(t,null,n);i.moveNext();)if(r=i.getCurrent(),this.contains(r))return!0;return!1},setEquals:function(t){var i,r,u;if(t==null)throw new System.ArgumentNullException("other");return i=Bridge.as(t,System.Collections.Generic.HashSet$1(n)),i!=null&&System.Collections.Generic.HashSet$1(n).areEqualityComparersEqual(this,i)?this._count!==i.getCount()?!1:this.containsAllElements(i):(r=Bridge.as(t,System.Collections.Generic.ICollection$1(n)),r!=null&&this._count===0&&System.Array.getCount(r,n)>0)?!1:(u=this.checkUniqueAndUnfoundElements(t,!0).$clone(),u.uniqueCount===this._count&&u.unfoundCount===0)},removeWhere:function(n){var i,t,r;if(Bridge.staticEquals(n,null))throw new System.ArgumentNullException("match");for(i=0,t=0;t<this._lastIndex;t=t+1|0)this._slots[t].hashCode>=0&&(r=this._slots[t].value,n(r)&&this.remove(r)&&(i=i+1|0));return i},trimExcess:function(){var i,e;if(this._count===0)this._buckets=null,this._slots=null,this._version=this._version+1|0;else{var u=System.Collections.HashHelpers.getPrime(this._count),r=System.Array.init(u,function(){return new(System.Collections.Generic.HashSet$1.Slot(n))}),f=System.Array.init(u,0),t=0;for(i=0;i<this._lastIndex;i=i+1|0)this._slots[i].hashCode>=0&&(r[t]=this._slots[i].$clone(),e=r[t].hashCode%u,r[t].next=f[e]-1|0,f[e]=t+1|0,t=t+1|0);this._lastIndex=t;this._slots=r;this._buckets=f;this._freeList=-1}},initialize:function(t){var i=System.Collections.HashHelpers.getPrime(t);this._buckets=System.Array.init(i,0);this._slots=System.Array.init(i,function(){return new(System.Collections.Generic.HashSet$1.Slot(n))})},increaseCapacity:function(){var n=System.Collections.HashHelpers.expandPrime(this._count);if(n<=this._count)throw new System.ArgumentException("HashSet capacity is too big.");this.setCapacity(n,!1)},setCapacity:function(t,i){var r=System.Array.init(t,function(){return new(System.Collections.Generic.HashSet$1.Slot(n))}),e,u,o,f,s;if(this._slots!=null)for(e=0;e<this._lastIndex;e=e+1|0)r[e]=this._slots[e].$clone();if(i)for(u=0;u<this._lastIndex;u=u+1|0)r[u].hashCode!==-1&&(r[u].hashCode=this.internalGetHashCode(r[u].value));for(o=System.Array.init(t,0),f=0;f<this._lastIndex;f=f+1|0)s=r[f].hashCode%t,r[f].next=o[s]-1|0,o[s]=f+1|0;this._slots=r;this._buckets=o},addIfNotPresent:function(t){var u,f,r,i;for(this._buckets==null&&this.initialize(0),u=this.internalGetHashCode(t),f=u%this._buckets.length,r=this._buckets[f]-1|0;r>=0;r=this._slots[r].next)if(this._slots[r].hashCode===u&&this._comparer["System$Collections$Generic$IEqualityComparer$1$"+Bridge.getTypeAlias(n)+"$equals2"](this._slots[r].value,t))return!1;return this._freeList>=0?(i=this._freeList,this._freeList=this._slots[i].next):(this._lastIndex===this._slots.length&&(this.increaseCapacity(),f=u%this._buckets.length),i=this._lastIndex,this._lastIndex=this._lastIndex+1|0),this._slots[i].hashCode=u,this._slots[i].value=t,this._slots[i].next=this._buckets[f]-1|0,this._buckets[f]=i+1|0,this._count=this._count+1|0,this._version=this._version+1|0,!0},containsAllElements:function(t){for(var r,i=Bridge.getEnumerator(t,null,n);i.moveNext();)if(r=i.getCurrent(),!this.contains(r))return!1;return!0},isSubsetOfHashSetWithSameEC:function(n){for(var i,t=Bridge.getEnumerator(this);t.moveNext();)if(i=t.getCurrent(),!n.contains(i))return!1;return!0},intersectWithHashSetWithSameEC:function(n){for(var i,t=0;t<this._lastIndex;t=t+1|0)this._slots[t].hashCode>=0&&(i=this._slots[t].value,n.contains(i)||this.remove(i))},intersectWithEnumerable:function(t){for(var e=this._lastIndex,o=System.Collections.Generic.BitHelper.toIntArrayLength(e),h=System.Array.init(o,0),s,f,i,u=new System.Collections.Generic.BitHelper(h,o),r=Bridge.getEnumerator(t,null,n);r.moveNext();)s=r.getCurrent(),f=this.internalIndexOf(s),f>=0&&u.markBit(f);for(i=0;i<e;i=i+1|0)this._slots[i].hashCode>=0&&!u.isMarked(i)&&this.remove(this._slots[i].value)},internalIndexOf:function(t){for(var r=this.internalGetHashCode(t),i=this._buckets[r%this._buckets.length]-1|0;i>=0;i=this._slots[i].next)if(this._slots[i].hashCode===r&&this._comparer["System$Collections$Generic$IEqualityComparer$1$"+Bridge.getTypeAlias(n)+"$equals2"](this._slots[i].value,t))return i;return-1},symmetricExceptWithUniqueHashSet:function(n){for(var i,t=Bridge.getEnumerator(n);t.moveNext();)i=t.getCurrent(),this.remove(i)||this.addIfNotPresent(i)},symmetricExceptWithEnumerable:function(t){var f,e=this._lastIndex,u=System.Collections.Generic.BitHelper.toIntArrayLength(e),o,s,c=System.Array.init(u,0),h,i;for(o=new System.Collections.Generic.BitHelper(c,u),h=System.Array.init(u,0),s=new System.Collections.Generic.BitHelper(h,u),f=Bridge.getEnumerator(t,null,n);f.moveNext();){var l=f.getCurrent(),r={v:0},a=this.addOrGetLocation(l,r);a?s.markBit(r.v):r.v<e&&!s.isMarked(r.v)&&o.markBit(r.v)}for(i=0;i<e;i=i+1|0)o.isMarked(i)&&this.remove(this._slots[i].value)},addOrGetLocation:function(t,i){for(var r,f=this.internalGetHashCode(t),e=f%this._buckets.length,u=this._buckets[e]-1|0;u>=0;u=this._slots[u].next)if(this._slots[u].hashCode===f&&this._comparer["System$Collections$Generic$IEqualityComparer$1$"+Bridge.getTypeAlias(n)+"$equals2"](this._slots[u].value,t))return i.v=u,!1;return this._freeList>=0?(r=this._freeList,this._freeList=this._slots[r].next):(this._lastIndex===this._slots.length&&(this.increaseCapacity(),e=f%this._buckets.length),r=this._lastIndex,this._lastIndex=this._lastIndex+1|0),this._slots[r].hashCode=f,this._slots[r].value=t,this._slots[r].next=this._buckets[e]-1|0,this._buckets[e]=r+1|0,this._count=this._count+1|0,this._version=this._version+1|0,i.v=r,!0},checkUniqueAndUnfoundElements:function(t,i){var s,h,r=new(System.Collections.Generic.HashSet$1.ElementCount(n)),u,v,f,e,a,o;if(this._count===0){for(u=0,s=Bridge.getEnumerator(t,null,n);s.moveNext();){v=s.getCurrent();u=u+1|0;break}return r.uniqueCount=0,r.unfoundCount=u,r.$clone()}var y=this._lastIndex,l=System.Collections.Generic.BitHelper.toIntArrayLength(y),c,p=System.Array.init(l,0);for(c=new System.Collections.Generic.BitHelper(p,l),f=0,e=0,h=Bridge.getEnumerator(t,null,n);h.moveNext();)if(a=h.getCurrent(),o=this.internalIndexOf(a),o>=0)c.isMarked(o)||(c.markBit(o),e=e+1|0);else if(f=f+1|0,i)break;return r.uniqueCount=e,r.unfoundCount=f,r.$clone()},toArray:function(){var t=System.Array.init(this.getCount(),function(){return Bridge.getDefaultValue(n)});return this.copyTo$1(t),t},internalGetHashCode:function(t){return t==null?0:this._comparer["System$Collections$Generic$IEqualityComparer$1$"+Bridge.getTypeAlias(n)+"$getHashCode2"](t)&System.Collections.Generic.HashSet$1(n).Lower31BitMask}}});Bridge.define("System.Collections.Generic.HashSet$1.ElementCount",function(n){return{$kind:"struct",statics:{getDefaultValue:function(){return new(System.Collections.Generic.HashSet$1.ElementCount(n))}},uniqueCount:0,unfoundCount:0,ctor:function(){this.$initialize()},getHashCode:function(){return Bridge.addHash([4920463385,this.uniqueCount,this.unfoundCount])},equals:function(t){return Bridge.is(t,System.Collections.Generic.HashSet$1.ElementCount(n))?Bridge.equals(this.uniqueCount,t.uniqueCount)&&Bridge.equals(this.unfoundCount,t.unfoundCount):!1},$clone:function(t){var i=t||new(System.Collections.Generic.HashSet$1.ElementCount(n));return i.uniqueCount=this.uniqueCount,i.unfoundCount=this.unfoundCount,i}}});Bridge.define("System.Collections.Generic.HashSet$1.Enumerator",function(n){return{inherits:[System.Collections.Generic.IEnumerator$1(n)],$kind:"struct",statics:{getDefaultValue:function(){return new(System.Collections.Generic.HashSet$1.Enumerator(n))}},_set:null,_index:0,_version:0,_current:Bridge.getDefaultValue(n),config:{alias:["dispose","System$IDisposable$dispose","moveNext","System$Collections$IEnumerator$moveNext","getCurrent","System$Collections$Generic$IEnumerator$1$"+Bridge.getTypeAlias(n)+"$getCurrent$1"]},$ctor1:function(t){this.$initialize();this._set=t;this._index=0;this._version=t._version;this._current=Bridge.getDefaultValue(n)},ctor:function(){this.$initialize()},getCurrent:function(){return this._current},System$Collections$IEnumerator$getCurrent:function(){if(this._index===0||this._index===(this._set._lastIndex+1|0))throw new System.InvalidOperationException("Enumeration has either not started or has already finished.");return this.getCurrent()},dispose:function(){},moveNext:function(){if(this._version!==this._set._version)throw new System.InvalidOperationException("Collection was modified; enumeration operation may not execute.");while(this._index<this._set._lastIndex){if(this._set._slots[this._index].hashCode>=0)return this._current=this._set._slots[this._index].value,this._index=this._index+1|0,!0;this._index=this._index+1|0}return this._index=this._set._lastIndex+1|0,this._current=Bridge.getDefaultValue(n),!1},System$Collections$IEnumerator$reset:function(){if(this._version!==this._set._version)throw new System.InvalidOperationException("Collection was modified; enumeration operation may not execute.");this._index=0;this._current=Bridge.getDefaultValue(n)},getHashCode:function(){return Bridge.addHash([3788985113,this._set,this._index,this._version,this._current])},equals:function(t){return Bridge.is(t,System.Collections.Generic.HashSet$1.Enumerator(n))?Bridge.equals(this._set,t._set)&&Bridge.equals(this._index,t._index)&&Bridge.equals(this._version,t._version)&&Bridge.equals(this._current,t._current):!1},$clone:function(t){var i=t||new(System.Collections.Generic.HashSet$1.Enumerator(n));return i._set=this._set,i._index=this._index,i._version=this._version,i._current=this._current,i}}});Bridge.define("System.Collections.Generic.HashSet$1.Slot",function(n){return{$kind:"struct",statics:{getDefaultValue:function(){return new(System.Collections.Generic.HashSet$1.Slot(n))}},hashCode:0,value:Bridge.getDefaultValue(n),next:0,ctor:function(){this.$initialize()},getHashCode:function(){return Bridge.addHash([1953459283,this.hashCode,this.value,this.next])},equals:function(t){return Bridge.is(t,System.Collections.Generic.HashSet$1.Slot(n))?Bridge.equals(this.hashCode,t.hashCode)&&Bridge.equals(this.value,t.value)&&Bridge.equals(this.next,t.next):!1},$clone:function(t){var i=t||new(System.Collections.Generic.HashSet$1.Slot(n));return i.hashCode=this.hashCode,i.value=this.value,i.next=this.next,i}}});Bridge.define("System.Collections.Generic.Queue$1",function(n){return{inherits:[System.Collections.Generic.IEnumerable$1(n),System.Collections.ICollection],statics:{MinimumGrow:4,GrowFactor:200,DefaultCapacity:4},_array:null,_head:0,_tail:0,_size:0,_version:0,config:{alias:["getCount","System$Collections$ICollection$getCount","getIsReadOnly","System$Collections$ICollection$getIsReadOnly","System$Collections$Generic$IEnumerable$1$T$getEnumerator","System$Collections$Generic$IEnumerable$1$"+Bridge.getTypeAlias(n)+"$getEnumerator"]},ctor:function(){this.$initialize();this._array=System.Array.init(0,function(){return Bridge.getDefaultValue(n)})},$ctor2:function(t){if(this.$initialize(),t<0)throw new System.ArgumentOutOfRangeException("capacity","Non-negative number required.");this._array=System.Array.init(t,function(){return Bridge.getDefaultValue(n)})},$ctor1:function(t){if(this.$initialize(),t==null)throw new System.ArgumentNullException("collection");this._array=System.Array.init(System.Collections.Generic.Queue$1(n).DefaultCapacity,function(){return Bridge.getDefaultValue(n)});var i=Bridge.getEnumerator(t,null,n);try{while(i.System$Collections$IEnumerator$moveNext())this.enqueue(i[Bridge.geti(i,"System$Collections$Generic$IEnumerator$1$"+Bridge.getTypeAlias(n)+"$getCurrent$1","getCurrent$1")]())}finally{Bridge.hasValue(i)&&i.dispose()}},getCount:function(){return this._size},getIsReadOnly:function(){return!1},clear:function(){this._head<this._tail?System.Array.fill(this._array,Bridge.getDefaultValue(n),this._head,this._size):(System.Array.fill(this._array,Bridge.getDefaultValue(n),this._head,this._array.length-this._head|0),System.Array.fill(this._array,Bridge.getDefaultValue(n),0,this._tail));this._head=0;this._tail=0;this._size=0;this._version=this._version+1|0},copyTo:function(n,t){var r,i,u;if(n==null)throw new System.ArgumentNullException("array");if(t<0||t>n.length)throw new System.ArgumentOutOfRangeException("arrayIndex","Index was out of range. Must be non-negative and less than the size of the collection.");if(r=n.length,(r-t|0)<this._size)throw new System.ArgumentException("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.");(i=(r-t|0)<this._size?r-t|0:this._size,i!==0)&&(u=(this._array.length-this._head|0)<i?this._array.length-this._head|0:i,System.Array.copy(this._array,this._head,n,t,u),i=i-u|0,i>0&&System.Array.copy(this._array,0,n,(t+this._array.length|0)-this._head|0,i))},enqueue:function(t){if(this._size===this._array.length){var i=Bridge.Int.div(this._array.length*System.Collections.Generic.Queue$1(n).GrowFactor|0,100)|0;i<(this._array.length+System.Collections.Generic.Queue$1(n).MinimumGrow|0)&&(i=this._array.length+System.Collections.Generic.Queue$1(n).MinimumGrow|0);this.setCapacity(i)}this._array[this._tail]=t;this._tail=this.moveNext(this._tail);this._size=this._size+1|0;this._version=this._version+1|0},getEnumerator:function(){return new(System.Collections.Generic.Queue$1.Enumerator(n).$ctor1)(this)},System$Collections$Generic$IEnumerable$1$T$getEnumerator:function(){return new(System.Collections.Generic.Queue$1.Enumerator(n).$ctor1)(this)},System$Collections$IEnumerable$getEnumerator:function(){return new(System.Collections.Generic.Queue$1.Enumerator(n).$ctor1)(this)},dequeue:function(){if(this._size===0)throw new System.InvalidOperationException("Queue empty.");var t=this._array[this._head];return this._array[this._head]=Bridge.getDefaultValue(n),this._head=this.moveNext(this._head),this._size=this._size-1|0,this._version=this._version+1|0,t},peek:function(){if(this._size===0)throw new System.InvalidOperationException("Queue empty.");return this._array[this._head]},contains:function(t){for(var i=this._head,r=this._size,u=System.Collections.Generic.EqualityComparer$1(n).def;Bridge.identity(r,r=r-1|0)>0;){if(t==null){if(this._array[i]==null)return!0}else if(this._array[i]!=null&&u.equals2(this._array[i],t))return!0;i=this.moveNext(i)}return!1},getElement:function(n){return this._array[(this._head+n|0)%this._array.length]},toArray:function(){var t=System.Array.init(this._size,function(){return Bridge.getDefaultValue(n)});return this._size===0?t:(this._head<this._tail?System.Array.copy(this._array,this._head,t,0,this._size):(System.Array.copy(this._array,this._head,t,0,this._array.length-this._head|0),System.Array.copy(this._array,0,t,this._array.length-this._head|0,this._tail)),t)},setCapacity:function(t){var i=System.Array.init(t,function(){return Bridge.getDefaultValue(n)});this._size>0&&(this._head<this._tail?System.Array.copy(this._array,this._head,i,0,this._size):(System.Array.copy(this._array,this._head,i,0,this._array.length-this._head|0),System.Array.copy(this._array,0,i,this._array.length-this._head|0,this._tail)));this._array=i;this._head=0;this._tail=this._size===t?0:this._size;this._version=this._version+1|0},moveNext:function(n){var t=n+1|0;return t===this._array.length?0:t},trimExcess:function(){var n=Bridge.Int.clip32(this._array.length*.9);this._size<n&&this.setCapacity(this._size)}}});Bridge.define("System.Collections.Generic.Queue$1.Enumerator",function(n){return{inherits:[System.Collections.Generic.IEnumerator$1(n),System.Collections.IEnumerator],$kind:"struct",statics:{getDefaultValue:function(){return new(System.Collections.Generic.Queue$1.Enumerator(n))}},_q:null,_index:0,_version:0,_currentElement:Bridge.getDefaultValue(n),config:{alias:["dispose","System$IDisposable$dispose","moveNext","System$Collections$IEnumerator$moveNext","getCurrent","System$Collections$Generic$IEnumerator$1$"+Bridge.getTypeAlias(n)+"$getCurrent$1"]},$ctor1:function(t){this.$initialize();this._q=t;this._version=this._q._version;this._index=-1;this._currentElement=Bridge.getDefaultValue(n)},ctor:function(){this.$initialize()},getCurrent:function(){if(this._index<0)if(this._index===-1)throw new System.InvalidOperationException("Enumeration has not started. Call MoveNext.");else throw new System.InvalidOperationException("Enumeration already finished.");return this._currentElement},System$Collections$IEnumerator$getCurrent:function(){return this.getCurrent()},dispose:function(){this._index=-2;this._currentElement=Bridge.getDefaultValue(n)},moveNext:function(){if(this._version!==this._q._version)throw new System.InvalidOperationException("Collection was modified; enumeration operation may not execute.");return this._index===-2?!1:(this._index=this._index+1|0,this._index===this._q._size)?(this._index=-2,this._currentElement=Bridge.getDefaultValue(n),!1):(this._currentElement=this._q.getElement(this._index),!0)},System$Collections$IEnumerator$reset:function(){if(this._version!==this._q._version)throw new System.InvalidOperationException("Collection was modified; enumeration operation may not execute.");this._index=-1;this._currentElement=Bridge.getDefaultValue(n)},getHashCode:function(){return Bridge.addHash([3788985113,this._q,this._index,this._version,this._currentElement])},equals:function(t){return Bridge.is(t,System.Collections.Generic.Queue$1.Enumerator(n))?Bridge.equals(this._q,t._q)&&Bridge.equals(this._index,t._index)&&Bridge.equals(this._version,t._version)&&Bridge.equals(this._currentElement,t._currentElement):!1},$clone:function(t){var i=t||new(System.Collections.Generic.Queue$1.Enumerator(n));return i._q=this._q,i._index=this._index,i._version=this._version,i._currentElement=this._currentElement,i}}});Bridge.define("System.Collections.Generic.Stack$1",function(n){return{inherits:[System.Collections.Generic.IEnumerable$1(n),System.Collections.ICollection],statics:{DefaultCapacity:4},_array:null,_size:0,_version:0,config:{alias:["getCount","System$Collections$ICollection$getCount","getIsReadOnly","System$Collections$ICollection$getIsReadOnly","System$Collections$Generic$IEnumerable$1$T$getEnumerator","System$Collections$Generic$IEnumerable$1$"+Bridge.getTypeAlias(n)+"$getEnumerator"]},ctor:function(){this.$initialize();this._array=System.Array.init(0,function(){return Bridge.getDefaultValue(n)})},$ctor2:function(t){if(this.$initialize(),t<0)throw new System.ArgumentOutOfRangeException("capacity","Non-negative number required.");this._array=System.Array.init(t,function(){return Bridge.getDefaultValue(n)})},$ctor1:function(t){if(this.$initialize(),t==null)throw new System.ArgumentNullException("collection");var i={};this._array=Bridge.Collections.EnumerableHelpers.toArray$1(n,t,i);this._size=i.v},getCount:function(){return this._size},getIsReadOnly:function(){return!1},clear:function(){System.Array.fill(this._array,Bridge.getDefaultValue(n),0,this._size);this._size=0;this._version=this._version+1|0},contains:function(t){for(var i=this._size,r=System.Collections.Generic.EqualityComparer$1(n).def;Bridge.identity(i,i=i-1|0)>0;)if(t==null){if(this._array[i]==null)return!0}else if(this._array[i]!=null&&r.equals2(this._array[i],t))return!0;return!1},copyTo:function(n,t){var i,u,r;if(n==null)throw new System.ArgumentNullException("array");if(t<0||t>n.length)throw new System.ArgumentOutOfRangeException("arrayIndex","Non-negative number required.");if((n.length-t|0)<this._size)throw new System.ArgumentException("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.");if(Bridge.referenceEquals(n,this._array))System.Array.copy(this._array,0,n,t,this._size),System.Array.reverse(n,t,this._size);else for(i=0,u=t+this._size|0,r=0;r<this._size;r=r+1|0)n[u=u-1|0]=this._array[Bridge.identity(i,i=i+1|0)]},copyTo$1:function(n,t){if(n==null)throw new System.ArgumentNullException("array");if(System.Array.getRank(n)!==1)throw new System.ArgumentException("Only single dimensional arrays are supported for the requested action.");if(System.Array.getLower(n,0)!==0)throw new System.ArgumentException("The lower bound of target array must be zero.");if(t<0||t>n.length)throw new System.ArgumentOutOfRangeException("arrayIndex","Non-negative number required.");if((n.length-t|0)<this._size)throw new System.ArgumentException("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.");try{System.Array.copy(this._array,0,n,t,this._size);System.Array.reverse(n,t,this._size)}catch(i){i=System.Exception.create(i);throw new System.ArgumentException("Target array type is not compatible with the type of items in the collection.");}},getEnumerator:function(){return new(System.Collections.Generic.Stack$1.Enumerator(n).$ctor1)(this)},System$Collections$Generic$IEnumerable$1$T$getEnumerator:function(){return new(System.Collections.Generic.Stack$1.Enumerator(n).$ctor1)(this)},System$Collections$IEnumerable$getEnumerator:function(){return new(System.Collections.Generic.Stack$1.Enumerator(n).$ctor1)(this)},trimExcess:function(){var i=Bridge.Int.clip32(this._array.length*.9),t;this._size<i&&(t={v:this._array},System.Array.resize(t,this._size,Bridge.getDefaultValue(n)),this._array=t.v,this._version=this._version+1|0)},peek:function(){if(this._size===0)throw new System.InvalidOperationException("Stack empty.");return this._array[this._size-1|0]},pop:function(){if(this._size===0)throw new System.InvalidOperationException("Stack empty.");this._version=this._version+1|0;var t=this._array[this._size=this._size-1|0];return this._array[this._size]=Bridge.getDefaultValue(n),t},push:function(t){if(this._size===this._array.length){var i={v:this._array};System.Array.resize(i,this._array.length===0?System.Collections.Generic.Stack$1(n).DefaultCapacity:2*this._array.length|0,Bridge.getDefaultValue(n));this._array=i.v}this._array[Bridge.identity(this._size,this._size=this._size+1|0)]=t;this._version=this._version+1|0},toArray:function(){for(var i=System.Array.init(this._size,function(){return Bridge.getDefaultValue(n)}),t=0;t<this._size;)i[t]=this._array[(this._size-t|0)-1|0],t=t+1|0;return i}}});Bridge.define("System.Collections.Generic.Stack$1.Enumerator",function(n){return{inherits:[System.Collections.Generic.IEnumerator$1(n),System.Collections.IEnumerator],$kind:"struct",statics:{getDefaultValue:function(){return new(System.Collections.Generic.Stack$1.Enumerator(n))}},_stack:null,_index:0,_version:0,_currentElement:Bridge.getDefaultValue(n),config:{alias:["dispose","System$IDisposable$dispose","moveNext","System$Collections$IEnumerator$moveNext","getCurrent","System$Collections$Generic$IEnumerator$1$"+Bridge.getTypeAlias(n)+"$getCurrent$1"]},$ctor1:function(t){this.$initialize();this._stack=t;this._version=this._stack._version;this._index=-2;this._currentElement=Bridge.getDefaultValue(n)},ctor:function(){this.$initialize()},getCurrent:function(){if(this._index===-2)throw new System.InvalidOperationException("Enumeration has not started. Call MoveNext.");if(this._index===-1)throw new System.InvalidOperationException("Enumeration already finished.");return this._currentElement},System$Collections$IEnumerator$getCurrent:function(){if(this._index===-2)throw new System.InvalidOperationException("Enumeration has not started. Call MoveNext.");if(this._index===-1)throw new System.InvalidOperationException("Enumeration already finished.");return this._currentElement},dispose:function(){this._index=-1},moveNext:function(){var t;if(this._version!==this._stack._version)throw new System.InvalidOperationException("Collection was modified; enumeration operation may not execute.");return this._index===-2?(this._index=this._stack._size-1|0,t=this._index>=0,t&&(this._currentElement=this._stack._array[this._index]),t):this._index===-1?!1:(t=(this._index=this._index-1|0)>=0,this._currentElement=t?this._stack._array[this._index]:Bridge.getDefaultValue(n),t)},System$Collections$IEnumerator$reset:function(){if(this._version!==this._stack._version)throw new System.InvalidOperationException("Collection was modified; enumeration operation may not execute.");this._index=-2;this._currentElement=Bridge.getDefaultValue(n)},getHashCode:function(){return Bridge.addHash([3788985113,this._stack,this._index,this._version,this._currentElement])},equals:function(t){return Bridge.is(t,System.Collections.Generic.Stack$1.Enumerator(n))?Bridge.equals(this._stack,t._stack)&&Bridge.equals(this._index,t._index)&&Bridge.equals(this._version,t._version)&&Bridge.equals(this._currentElement,t._currentElement):!1},$clone:function(t){var i=t||new(System.Collections.Generic.Stack$1.Enumerator(n));return i._stack=this._stack,i._index=this._index,i._version=this._version,i._currentElement=this._currentElement,i}}});Bridge.define("System.Collections.HashHelpers",{statics:{HashPrime:101,primes:null,MaxPrimeArrayLength:2146435069,config:{init:function(){this.primes=[3,7,11,17,23,29,37,47,59,71,89,107,131,163,197,239,293,353,431,521,631,761,919,1103,1327,1597,1931,2333,2801,3371,4049,4861,5839,7013,8419,10103,12143,14591,17519,21023,25229,30293,36353,43627,52361,62851,75431,90523,108631,130363,156437,187751,225307,270371,324449,389357,467237,560689,672827,807403,968897,1162687,1395263,1674319,2009191,2411033,2893249,3471899,4166287,4999559,5999471,7199369]}},isPrime:function(n){var i,t;if((n&1)!=0){for(i=Bridge.Int.clip32(Math.sqrt(n)),t=3;t<=i;t=t+2|0)if(n%t==0)return!1;return!0}return n===2},getPrime:function(n){var i,r,t;if(n<0)throw new System.ArgumentException("Hashtable's capacity overflowed and went negative. Check load factor, capacity and the current size of the table.");for(i=0;i<System.Collections.HashHelpers.primes.length;i=i+1|0)if(r=System.Collections.HashHelpers.primes[i],r>=n)return r;for(t=n|1;t<2147483647;t=t+2|0)if(System.Collections.HashHelpers.isPrime(t)&&(t-1|0)%System.Collections.HashHelpers.HashPrime!=0)return t;return n},getMinPrime:function(){return System.Collections.HashHelpers.primes[0]},expandPrime:function(n){var t=2*n|0;return t>>>0>System.Collections.HashHelpers.MaxPrimeArrayLength&&System.Collections.HashHelpers.MaxPrimeArrayLength>n?System.Collections.HashHelpers.MaxPrimeArrayLength:System.Collections.HashHelpers.getPrime(t)}}})});
10Bridge.assembly("OrgChart.Layout",function($asm){"use strict";Bridge.define("OrgChart.Annotations.CanBeNullAttribute",{inherits:[System.Attribute]});Bridge.define("OrgChart.Annotations.ContractAnnotationAttribute",{inherits:[System.Attribute],config:{properties:{Contract:null,ForceFullStates:!1}},ctor:function(contract){OrgChart.Annotations.ContractAnnotationAttribute.$ctor1.call(this,contract,!1)},$ctor1:function(contract,forceFullStates){this.$initialize();System.Attribute.ctor.call(this);this.setContract(contract);this.setForceFullStates(forceFullStates)}});Bridge.define("OrgChart.Annotations.NotNullAttribute",{inherits:[System.Attribute]});Bridge.define("OrgChart.Annotations.PureAttribute",{inherits:[System.Attribute]});Bridge.define("OrgChart.Layout.Boundary",{Left:null,Right:null,m_spacerMerger:null,config:{properties:{BoundingRect:null},init:function(){this.BoundingRect=new OrgChart.Layout.Rect}},ctor:function(){OrgChart.Layout.Boundary.$ctor1.call(this,!0)},$ctor1:function(frompublic){this.$initialize();this.Left=new(System.Collections.Generic.List$1(OrgChart.Layout.Boundary.Step));this.Right=new(System.Collections.Generic.List$1(OrgChart.Layout.Boundary.Step));frompublic&&(this.m_spacerMerger=new OrgChart.Layout.Boundary.$ctor1(!1))},PrepareForHorizontalLayout:function(node){if(this.Prepare(node),!node.getElement().DisableCollisionDetection){var rect=node.getState();this.Left.add(new OrgChart.Layout.Boundary.Step.$ctor1(node,rect.getLeft(),rect.getTop(),rect.getBottom()));this.Right.add(new OrgChart.Layout.Boundary.Step.$ctor1(node,rect.getRight(),rect.getTop(),rect.getBottom()))}},Prepare:function(node){this.Left.clear();this.Right.clear();this.setBoundingRect(new OrgChart.Layout.Rect.$ctor1(node.getState().TopLeft,node.getState().Size))},VerticalMergeFrom:function(other){this.setBoundingRect(OrgChart.Layout.Rect.op_Addition(this.getBoundingRect(),other.getBoundingRect()))},MergeFrom:function(other){var merge,my,th,theirWins;if(other.getBoundingRect().getTop()>=other.getBoundingRect().getBottom())throw new System.ArgumentException("Cannot merge boundary of height "+System.Double.format(other.getBoundingRect().getBottom()-other.getBoundingRect().getTop(),"G"));for(merge=114;merge!==0;){for(var mySteps=merge===114?this.Right:this.Left,theirSteps=merge===114?other.Right:other.Left,i=0,k=0;k<theirSteps.getCount()&&i<mySteps.getCount();){if(my=mySteps.getItem(i),th=theirSteps.getItem(k),my.Bottom<=th.Top){i=i+1|0;continue}if(th.Bottom<=my.Top){mySteps.insert(i,th);k=k+1|0;this.ValidateState();continue}theirWins=merge===114?my.X<=th.X:my.X>=th.X;OrgChart.Layout.LayoutAlgorithm.IsEqual(my.Top,th.Top)?OrgChart.Layout.LayoutAlgorithm.IsEqual(my.Bottom,th.Bottom)?(theirWins&&mySteps.setItem(i,th),i=i+1|0,k=k+1|0,this.ValidateState()):my.Bottom<th.Bottom?(theirWins&&mySteps.setItem(i,my.ChangeOwner(th.Node,th.X)),theirSteps.setItem(k,th.ChangeTop(my.Bottom)),i=i+1|0,this.ValidateState()):(theirWins&&(mySteps.setItem(i,my.ChangeTop(th.Bottom)),mySteps.insert(i,th),i=i+1|0),k=k+1|0,this.ValidateState()):OrgChart.Layout.LayoutAlgorithm.IsEqual(my.Bottom,th.Bottom)?my.Top<th.Top?(theirWins&&(mySteps.setItem(i,my.ChangeBottom(th.Top)),mySteps.insert(i+1|0,th),i=i+1|0),i=i+1|0,k=k+1|0,this.ValidateState()):(theirWins?mySteps.setItem(i,th):(mySteps.insert(i,th.ChangeBottom(my.Top)),i=i+1|0),i=i+1|0,k=k+1|0,this.ValidateState()):my.Top<th.Top&&my.Bottom<th.Bottom?(theirWins&&(mySteps.setItem(i,my.ChangeBottom(th.Top)),mySteps.insert(i+1|0,new OrgChart.Layout.Boundary.Step.$ctor1(th.Node,th.X,th.Top,my.Bottom)),i=i+1|0),theirSteps.setItem(k,th.ChangeTop(my.Bottom)),i=i+1|0,this.ValidateState()):my.Top<th.Top&&my.Bottom>th.Bottom?(theirWins&&(mySteps.setItem(i,my.ChangeBottom(th.Top)),mySteps.insert(i+1|0,th),mySteps.insert(i+2|0,my.ChangeTop(th.Bottom)),i=i+2|0),k=k+1|0,this.ValidateState()):my.Bottom>th.Bottom?(theirWins?(mySteps.setItem(i,my.ChangeTop(th.Bottom)),mySteps.insert(i,th)):mySteps.insert(i,th.ChangeBottom(my.Top)),i=i+1|0,k=k+1|0,this.ValidateState()):(theirWins?mySteps.setItem(i,th.ChangeBottom(my.Bottom)):(mySteps.insert(i,th.ChangeBottom(my.Top)),i=i+1|0),theirSteps.setItem(k,th.ChangeTop(my.Bottom)),i=i+1|0,this.ValidateState())}if(i===mySteps.getCount())while(k<theirSteps.getCount())mySteps.add(theirSteps.getItem(k)),k=k+1|0,this.ValidateState();merge=merge===114?108:0}this.setBoundingRect(OrgChart.Layout.Rect.op_Addition(this.getBoundingRect(),other.getBoundingRect()))},MergeFrom$1:function(node){node.getElement().DisableCollisionDetection||OrgChart.Layout.LayoutAlgorithm.IsZero(node.getState().Size.Height)||(this.m_spacerMerger.PrepareForHorizontalLayout(node),this.MergeFrom(this.m_spacerMerger))},ValidateState:function(){for(var i1,i=1;i<this.Left.getCount();i=i+1|0)if(OrgChart.Layout.LayoutAlgorithm.IsEqual(this.Left.getItem(i).Top,this.Left.getItem(i).Bottom)||this.Left.getItem(i).Top<this.Left.getItem(i-1|0).Bottom||this.Left.getItem(i).Top<=this.Left.getItem(i-1|0).Top||this.Left.getItem(i).Bottom<=this.Left.getItem(i).Top||this.Left.getItem(i).Bottom<=this.Left.getItem(i-1|0).Bottom)throw new System.Exception("State error at Left index "+i);for(i1=1;i1<this.Right.getCount();i1=i1+1|0)if(OrgChart.Layout.LayoutAlgorithm.IsEqual(this.Right.getItem(i1).Top,this.Right.getItem(i1).Bottom)||this.Right.getItem(i1).Top<this.Right.getItem(i1-1|0).Bottom||this.Right.getItem(i1).Top<=this.Right.getItem(i1-1|0).Top||this.Right.getItem(i1).Bottom<=this.Right.getItem(i1).Top||this.Right.getItem(i1).Bottom<=this.Right.getItem(i1-1|0).Bottom)throw new System.Exception("State error at Right index "+i1);},ComputeOverlap:function(other,siblingSpacing,branchSpacing){for(var i=0,k=0,offense=0,my,th,desiredSpacing,diff;i<this.Right.getCount()&&k<other.Left.getCount();)my=this.Right.getItem(i),th=other.Left.getItem(k),my.Bottom<=th.Top?i=i+1|0:th.Bottom<=my.Top?k=k+1|0:(my.Node.getElement().DisableCollisionDetection||th.Node.getElement().DisableCollisionDetection||(desiredSpacing=my.Node.getElement().IsSpecial||th.Node.getElement().IsSpecial?0:my.Node.getElement().ParentId===th.Node.getElement().ParentId?siblingSpacing:branchSpacing,diff=my.X+desiredSpacing-th.X,diff>offense&&(offense=diff)),my.Bottom>=th.Bottom&&(k=k+1|0),th.Bottom>=my.Bottom&&(i=i+1|0));return offense},ReloadFromBranch:function(branchRoot){for(var left,newLeft,i1,right,newRight,leftmost=System.Double.max,rightmost=System.Double.min,i=0;i<this.Left.getCount();i=i+1|0)left=this.Left.getItem(i),newLeft=left.Node.getState().getLeft(),this.Left.setItem(i,left.ChangeX(newLeft)),leftmost=Math.min(leftmost,newLeft);for(i1=0;i1<this.Right.getCount();i1=i1+1|0)right=this.Right.getItem(i1),newRight=right.Node.getState().getRight(),this.Right.setItem(i1,right.ChangeX(newRight)),rightmost=Math.max(rightmost,newRight);leftmost=Math.min(branchRoot.getState().getLeft(),leftmost);rightmost=Math.max(branchRoot.getState().getRight(),rightmost);this.setBoundingRect(new OrgChart.Layout.Rect.$ctor1(new OrgChart.Layout.Point.$ctor1(leftmost,this.getBoundingRect().getTop()),new OrgChart.Layout.Size.$ctor1(rightmost-leftmost,this.getBoundingRect().Size.Height)))}});Bridge.define("OrgChart.Layout.Boundary.Step",{$kind:"struct",statics:{getDefaultValue:function(){return new OrgChart.Layout.Boundary.Step}},Node:null,X:0,Top:0,Bottom:0,$ctor1:function(node,x,top,bottom){this.$initialize();this.Node=node;this.X=x;this.Top=top;this.Bottom=bottom},ctor:function(){this.$initialize()},ChangeTop:function(newTop){return new OrgChart.Layout.Boundary.Step.$ctor1(this.Node,this.X,newTop,this.Bottom)},ChangeBottom:function(newBottom){return new OrgChart.Layout.Boundary.Step.$ctor1(this.Node,this.X,this.Top,newBottom)},ChangeOwner:function(newNode,newX){return new OrgChart.Layout.Boundary.Step.$ctor1(newNode,newX,this.Top,this.Bottom)},ChangeX:function(newX){return new OrgChart.Layout.Boundary.Step.$ctor1(this.Node,newX,this.Top,this.Bottom)},getHashCode:function(){return Bridge.addHash([1885697107,this.Node,this.X,this.Top,this.Bottom])},equals:function(o){return Bridge.is(o,OrgChart.Layout.Boundary.Step)?Bridge.equals(this.Node,o.Node)&&Bridge.equals(this.X,o.X)&&Bridge.equals(this.Top,o.Top)&&Bridge.equals(this.Bottom,o.Bottom):!1},$clone:function(to){var s=to||new OrgChart.Layout.Boundary.Step;return s.Node=this.Node,s.X=this.X,s.Top=this.Top,s.Bottom=this.Bottom,s}});Bridge.define("OrgChart.Layout.BoundaryChangedEventArgs",{State:null,LayoutLevel:null,Boundary:null,ctor:function(boundary,layoutLevel,state){this.$initialize();this.Boundary=boundary;this.LayoutLevel=layoutLevel;this.State=state}});Bridge.define("OrgChart.Layout.Box",{statics:{None:-1,Special:function(id,visualParentId,disableCollisionDetection){return new OrgChart.Layout.Box.$ctor1(null,id,visualParentId,!0,disableCollisionDetection,!1)}},Id:0,ParentId:0,DataId:null,IsSpecial:!1,IsAssistant:!1,DisableCollisionDetection:!1,LayoutStrategyId:null,AssistantLayoutStrategyId:null,IsCollapsed:!1,config:{init:function(){this.Size=new OrgChart.Layout.Size}},ctor:function(dataId,id,parentId,isAssistant){OrgChart.Layout.Box.$ctor1.call(this,dataId,id,parentId,!1,!1,isAssistant)},$ctor1:function(dataId,id,parentId,isSpecial,disableCollisionDetection,isAssistant){if(this.$initialize(),id===0)throw new System.ArgumentOutOfRangeException("id");this.Id=id;this.ParentId=parentId;this.DataId=dataId;this.IsSpecial=isSpecial;this.IsAssistant=isAssistant;this.DisableCollisionDetection=disableCollisionDetection},getIsDataBound:function(){return!System.String.isNullOrEmpty(this.DataId)}});Bridge.define("OrgChart.Layout.BoxContainer",{m_lastBoxId:0,m_boxesById:null,m_boxesByDataId:null,config:{properties:{SystemRoot:null},init:function(){this.m_boxesById=new(System.Collections.Generic.Dictionary$2(System.Int32,OrgChart.Layout.Box));this.m_boxesByDataId=new(System.Collections.Generic.Dictionary$2(String,OrgChart.Layout.Box))}},ctor:function(){this.$initialize()},$ctor1:function(source){this.$initialize();this.ReloadBoxes(source)},getBoxesById:function(){return this.m_boxesById},getBoxesByDataId:function(){return this.m_boxesByDataId},ReloadBoxes:function(source){var $t,$t1,map,dataId,getDataItem;for(this.m_boxesByDataId.clear(),this.m_boxesById.clear(),this.m_lastBoxId=0,this.setSystemRoot(OrgChart.Layout.Box.Special(this.m_lastBoxId=this.m_lastBoxId+1|0,OrgChart.Layout.Box.None,!0)),this.m_boxesById.add(this.getSystemRoot().Id,this.getSystemRoot()),map=new(System.Collections.Generic.Dictionary$2(String,System.Int32)),$t=Bridge.getEnumerator(source.OrgChart$Layout$IChartDataSource$getAllDataItemIds(),String);$t.moveNext();)dataId=$t.getCurrent(),map.add(dataId,this.NextBoxId());for(getDataItem=source.OrgChart$Layout$IChartDataSource$getGetDataItemFunc(),$t1=Bridge.getEnumerator(source.OrgChart$Layout$IChartDataSource$getAllDataItemIds(),String);$t1.moveNext();){var dataId1=$t1.getCurrent(),parentDataId=System.String.isNullOrEmpty(dataId1)?null:source.OrgChart$Layout$IChartDataSource$getGetParentKeyFunc()(dataId1),visualParentId=System.String.isNullOrEmpty(parentDataId)?this.getSystemRoot().Id:map.get(parentDataId);this.AddBox$1(dataId1,map.get(dataId1),visualParentId,getDataItem(dataId1).OrgChart$Layout$IChartDataItem$getIsAssistant())}},AddBox:function(dataId,visualParentId,isAssistant){return this.AddBox$1(dataId,this.NextBoxId(),visualParentId,isAssistant)},AddBox$1:function(dataId,id,visualParentId,isAssistant){var box=new OrgChart.Layout.Box.ctor(dataId,id,visualParentId,isAssistant);return this.m_boxesById.add(box.Id,box),System.String.isNullOrEmpty(dataId)||this.m_boxesByDataId.add(box.DataId,box),box},NextBoxId:function(){return this.m_lastBoxId=this.m_lastBoxId+1|0,this.m_lastBoxId}});Bridge.define("OrgChart.Layout.BoxTree",{statics:{Build:function(state){for(var $t1,result=new OrgChart.Layout.BoxTree,box,node,$t=Bridge.getEnumerator(state.getDiagram().getBoxes().getBoxesById().System$Collections$Generic$IDictionary$2$System$Int32$OrgChart$Layout$Box$getValues(),OrgChart.Layout.Box);$t.moveNext();)box=$t.getCurrent(),node=new OrgChart.Layout.BoxTree.Node(box),result.getNodes().add(box.Id,node);for($t1=Bridge.getEnumerator(result.getNodes().getValues(),OrgChart.Layout.BoxTree.Node);$t1.moveNext();){var node1=$t1.getCurrent(),parentKey=node1.getElement().ParentId,parentNode={};if(result.getNodes().tryGetValue(parentKey,parentNode))node1.getElement().IsAssistant&&parentNode.v.getElement().ParentId!==OrgChart.Layout.Box.None?parentNode.v.AddAssistantChild(node1):parentNode.v.AddRegularChild$1(node1);else{if(result.getRoot()!=null)throw new System.InvalidOperationException("More then one root found: "+node1.getElement().Id);result.setRoot(node1)}}return result}},config:{properties:{Root:null,Nodes:null,Depth:0}},ctor:function(){this.$initialize();this.setNodes(new(System.Collections.Generic.Dictionary$2(System.Int32,OrgChart.Layout.BoxTree.Node)))},IterateChildFirst:function(func){return this.getRoot().IterateChildFirst(func)},IterateParentFirst:function(enter,exit){exit===void 0&&(exit=null);this.getRoot().IterateParentFirst(enter,exit)},UpdateHierarchyStats:function(){this.setDepth(0);this.IterateParentFirst(Bridge.fn.bind(this,$asm.$.OrgChart.Layout.BoxTree.f1))}});Bridge.ns("OrgChart.Layout.BoxTree",$asm.$);Bridge.apply($asm.$.OrgChart.Layout.BoxTree,{f1:function(x){return x.getParentNode()!=null?(x.setLevel(x.getParentNode().getLevel()),x.getParentNode().getIsAssistantRoot()||x.setLevel(x.getLevel()+1|0),this.setDepth(Math.max(1+x.getLevel()|0,this.getDepth()))):(x.setLevel(0),this.setDepth(1)),!0}});Bridge.define("OrgChart.Layout.BoxTree.Node",{config:{properties:{Level:0,Element:null,State:null,ParentNode:null,Children:null,AssistantsRoot:null}},ctor:function(element){this.$initialize();this.setElement(element);this.setState(new OrgChart.Layout.NodeLayoutInfo)},getChildCount:function(){return this.getChildren()==null?0:System.Array.getCount(this.getChildren(),OrgChart.Layout.BoxTree.Node)},getIsAssistantRoot:function(){var $t;return Bridge.referenceEquals(($t=this.getParentNode())!=null?$t.getAssistantsRoot():null,this)},AddAssistantChild:function(child){return this.getAssistantsRoot()==null&&this.setAssistantsRoot(Bridge.merge(new OrgChart.Layout.BoxTree.Node(OrgChart.Layout.Box.Special(OrgChart.Layout.Box.None,this.getElement().Id,!0)),{setParentNode:this,setLevel:this.getLevel()+1|0})),this.getAssistantsRoot().AddRegularChild$1(child),this},AddRegularChild$1:function(child){return this.InsertRegularChild$1(this.getChildCount(),child)},AddRegularChild:function(child){return this.InsertRegularChild(this.getChildCount(),child)},InsertRegularChild:function(index,child){return this.InsertRegularChild$1(index,new OrgChart.Layout.BoxTree.Node(child))},InsertRegularChild$1:function(index,child){return this.getChildren()==null&&this.setChildren(new(System.Collections.Generic.List$1(OrgChart.Layout.BoxTree.Node))),System.Array.insert(this.getChildren(),index,child,OrgChart.Layout.BoxTree.Node),child.setParentNode(this),child.setLevel(this.getLevel()+1|0),this},IterateChildFirst:function(func){var $t,child;if(this.getAssistantsRoot()!=null&&!this.getAssistantsRoot().IterateChildFirst(func))return!1;if(this.getChildren()!=null)for($t=Bridge.getEnumerator(this.getChildren(),OrgChart.Layout.BoxTree.Node);$t.moveNext();)if(child=$t.getCurrent(),!child.IterateChildFirst(func))return!1;return func(this)},IterateParentFirst:function(enter,exit){var $t,$t1,child;if(exit===void 0&&(exit=null),!enter(this))return Bridge.staticEquals(exit,null)?null:exit(this),!1;if(($t=this.getAssistantsRoot())!=null?$t.IterateParentFirst(enter,exit):null,this.getChildren()!=null)for($t1=Bridge.getEnumerator(this.getChildren(),OrgChart.Layout.BoxTree.Node);$t1.moveNext();)child=$t1.getCurrent(),child.IterateParentFirst(enter,exit);return Bridge.staticEquals(exit,null)?null:exit(this),!0},SuppressAssistants:function(){var $t,child;if(this.getAssistantsRoot()!=null){for($t=Bridge.getEnumerator(this.getAssistantsRoot().getChildren(),OrgChart.Layout.BoxTree.Node);$t.moveNext();)child=$t.getCurrent(),this.AddRegularChild$1(child);this.setAssistantsRoot(null)}}});Bridge.define("OrgChart.Layout.BranchParentAlignment",{$kind:"enum",statics:{InvalidValue:0,Left:1,Center:2,Right:3}});Bridge.define("OrgChart.Layout.Connector",{config:{properties:{Segments:null}},ctor:function(segments){if(this.$initialize(),segments.length===0)throw new System.ArgumentException("Need at least one segment","segments");this.setSegments(segments)}});Bridge.define("OrgChart.Layout.Diagram",{m_visualTree:null,m_boxes:null,config:{properties:{LayoutSettings:null}},ctor:function(){this.$initialize();this.setLayoutSettings(new OrgChart.Layout.DiagramLayoutSettings)},getBoxes:function(){return this.m_boxes},setBoxes:function(value){this.m_visualTree=null;this.m_boxes=value},getVisualTree:function(){return this.m_visualTree},setVisualTree:function(value){this.m_visualTree=value}});Bridge.define("OrgChart.Layout.DiagramLayoutSettings",{m_branchSpacing:0,config:{properties:{LayoutStrategies:null,DefaultAssistantLayoutStrategyId:null,DefaultLayoutStrategyId:null}},ctor:function(){this.$initialize();this.setBranchSpacing(50);this.setLayoutStrategies(new(System.Collections.Generic.Dictionary$2(String,OrgChart.Layout.LayoutStrategyBase)))},getBranchSpacing:function(){return this.m_branchSpacing},setBranchSpacing:function(value){if(value<0)throw new System.ArgumentOutOfRangeException("value","Cannot be negative",null,value);this.m_branchSpacing=value},RequireDefaultLayoutStrategy:function(){var result={};if(System.String.isNullOrEmpty(this.getDefaultLayoutStrategyId())||!this.getLayoutStrategies().tryGetValue(this.getDefaultLayoutStrategyId(),result))throw new System.InvalidOperationException("defaultLayoutStrategyId is null or not valid");return result.v},RequireDefaultAssistantLayoutStrategy:function(){var result={};if(System.String.isNullOrEmpty(this.getDefaultAssistantLayoutStrategyId())||!this.getLayoutStrategies().tryGetValue(this.getDefaultAssistantLayoutStrategyId(),result))throw new System.InvalidOperationException("defaultAssistantLayoutStrategyId is null or not valid");return result.v}});Bridge.define("OrgChart.Layout.DiagramLayoutTemplates");Bridge.define("OrgChart.Layout.Dimensions",{$kind:"struct",statics:{MinMax:function(){return new OrgChart.Layout.Dimensions.$ctor1(System.Double.max,System.Double.min)},op_Addition:function(x,y){return new OrgChart.Layout.Dimensions.$ctor1(Math.min(x.From,y.From),Math.max(x.To,y.To))},getDefaultValue:function(){return new OrgChart.Layout.Dimensions}},From:0,To:0,$ctor1:function(from,to){this.$initialize();this.From=from;this.To=to},ctor:function(){this.$initialize()},getHashCode:function(){return Bridge.addHash([3570880544,this.From,this.To])},equals:function(o){return Bridge.is(o,OrgChart.Layout.Dimensions)?Bridge.equals(this.From,o.From)&&Bridge.equals(this.To,o.To):!1},$clone:function(to){var s=to||new OrgChart.Layout.Dimensions;return s.From=this.From,s.To=this.To,s}});Bridge.define("OrgChart.Layout.Edge",{$kind:"struct",statics:{getDefaultValue:function(){return new OrgChart.Layout.Edge}},config:{init:function(){this.From=new OrgChart.Layout.Point;this.To=new OrgChart.Layout.Point}},$ctor1:function(from,to){this.$initialize();this.From=from;this.To=to},ctor:function(){this.$initialize()},getHashCode:function(){return Bridge.addHash([1701274693,this.From,this.To])},equals:function(o){return Bridge.is(o,OrgChart.Layout.Edge)?Bridge.equals(this.From,o.From)&&Bridge.equals(this.To,o.To):!1},$clone:function(to){var s=to||new OrgChart.Layout.Edge;return s.From=this.From,s.To=this.To,s}});Bridge.define("OrgChart.Layout.LayoutStrategyBase",{ParentAlignment:0,ParentChildSpacing:20,ParentConnectorShield:50,SiblingSpacing:20,ChildConnectorHookLength:5});Bridge.define("OrgChart.Layout.Frame1",{Connector:null,config:{init:function(){this.Exterior=new OrgChart.Layout.Rect;this.BranchExterior=new OrgChart.Layout.Rect;this.SiblingsRowV=new OrgChart.Layout.Dimensions}}});Bridge.define("OrgChart.Layout.IChartDataItem",{$kind:"interface"});Bridge.define("OrgChart.Layout.IChartDataSource",{$kind:"interface"});Bridge.define("OrgChart.Layout.LayoutAlgorithm",{statics:{ComputeBranchVisualBoundingRect:function(visualTree){var result=new OrgChart.Layout.Rect.ctor,initialized=!1;return visualTree.getRoot().IterateParentFirst(function(node){var box=node.getElement();return node.getState().IsHidden||box.IsSpecial||(initialized?result=OrgChart.Layout.Rect.op_Addition(result,new OrgChart.Layout.Rect.$ctor1(node.getState().TopLeft,node.getState().Size)):(initialized=!0,result=new OrgChart.Layout.Rect.$ctor1(node.getState().TopLeft,node.getState().Size))),!box.IsCollapsed}),result},Apply:function(state){var $t,$t1,tree,box,box1;if(state.getDiagram().getBoxes().getSystemRoot()==null)throw new System.InvalidOperationException("SystemRoot is not initialized on the box container");if(state.setCurrentOperation(OrgChart.Layout.LayoutState.Operation.Preparing),tree=OrgChart.Layout.BoxTree.Build(state),state.getDiagram().setVisualTree(tree),tree.getRoot()==null||tree.getRoot().getElement().Id!==state.getDiagram().getBoxes().getSystemRoot().Id)throw new System.Exception("SystemRoot is not on the top of the visual tree");if(tree.UpdateHierarchyStats(),state.AttachVisualTree(tree),tree.IterateParentFirst($asm.$.OrgChart.Layout.LayoutAlgorithm.f1),state.setCurrentOperation(OrgChart.Layout.LayoutState.Operation.PreprocessVisualTree),!Bridge.staticEquals(state.getBoxSizeFunc(),null))for($t=Bridge.getEnumerator(System.Linq.Enumerable.from(state.getDiagram().getBoxes().getBoxesById().System$Collections$Generic$IDictionary$2$System$Int32$OrgChart$Layout$Box$getValues()).where($asm.$.OrgChart.Layout.LayoutAlgorithm.f2));$t.moveNext();)box=$t.getCurrent(),box.Size=state.getBoxSizeFunc()(box.DataId);for($t1=Bridge.getEnumerator(state.getDiagram().getBoxes().getBoxesById().System$Collections$Generic$IDictionary$2$System$Int32$OrgChart$Layout$Box$getValues(),OrgChart.Layout.Box);$t1.moveNext();)box1=$t1.getCurrent(),OrgChart.Layout.LayoutAlgorithm.AssertBoxSize(box1);tree.IterateParentFirst($asm.$.OrgChart.Layout.LayoutAlgorithm.f3);OrgChart.Layout.LayoutAlgorithm.PreprocessVisualTree(state,tree);tree.UpdateHierarchyStats();state.setCurrentOperation(OrgChart.Layout.LayoutState.Operation.VerticalLayout);OrgChart.Layout.LayoutAlgorithm.VerticalLayout(state,tree.getRoot());state.setCurrentOperation(OrgChart.Layout.LayoutState.Operation.HorizontalLayout);OrgChart.Layout.LayoutAlgorithm.HorizontalLayout(state,tree.getRoot());state.setCurrentOperation(OrgChart.Layout.LayoutState.Operation.ConnectorsLayout);OrgChart.Layout.LayoutAlgorithm.RouteConnectors(state,tree);state.setCurrentOperation(OrgChart.Layout.LayoutState.Operation.Completed)},AssertBoxSize:function(box){if(!(box.Size.Width>=0)||!(box.Size.Width<=1e9)||!(box.Size.Height>=0)||!(box.Size.Width<=1e9))throw new System.InvalidOperationException(System.String.format("Box {0} has invalid size: {1}x{2}",box.Id,box.Size.Width,box.Size.Height));},PreprocessVisualTree:function(state,visualTree){var defaultStrategy=state.getDiagram().getLayoutSettings().RequireDefaultLayoutStrategy(),defaultAssistantsStrategy=state.getDiagram().getLayoutSettings().RequireDefaultAssistantLayoutStrategy(),regular=new(System.Collections.Generic.Stack$1(OrgChart.Layout.LayoutStrategyBase).ctor),assistants;regular.push(defaultStrategy);assistants=new(System.Collections.Generic.Stack$1(OrgChart.Layout.LayoutStrategyBase).ctor);assistants.push(defaultAssistantsStrategy);visualTree.IterateParentFirst(function(node){var strategy,suggestedStrategyId;return node.getState().IsHidden?!1:(strategy=null,Bridge.staticEquals(state.getLayoutOptimizerFunc(),null)||(suggestedStrategyId=state.getLayoutOptimizerFunc()(node),System.String.isNullOrEmpty(suggestedStrategyId)||(strategy=state.getDiagram().getLayoutSettings().getLayoutStrategies().get(suggestedStrategyId))),node.getIsAssistantRoot()?(strategy==null&&(strategy=node.getParentNode().getElement().AssistantLayoutStrategyId!=null?state.getDiagram().getLayoutSettings().getLayoutStrategies().get(node.getParentNode().getElement().AssistantLayoutStrategyId):assistants.peek()),assistants.push(strategy)):(strategy==null&&(strategy=node.getElement().LayoutStrategyId!=null?state.getDiagram().getLayoutSettings().getLayoutStrategies().get(node.getElement().LayoutStrategyId):regular.peek()),regular.push(strategy),strategy.getSupportsAssistants()||node.SuppressAssistants()),node.getState().setEffectiveLayoutStrategy(strategy),node.getState().RequireLayoutStrategy().PreProcessThisNode(state,node),!node.getElement().IsCollapsed&&node.getChildCount()>0||node.getAssistantsRoot()!=null)},function(node){node.getState().IsHidden||(node.getIsAssistantRoot()?assistants.pop():regular.pop())})},HorizontalLayout:function(state,branchRoot){if(branchRoot.getState().IsHidden)throw new System.InvalidOperationException(System.String.format("Branch root {0} does not affect layout",branchRoot.getElement().Id));var level=state.PushLayoutLevel(branchRoot);try{(branchRoot.getLevel()===0||(branchRoot.getState().NumberOfSiblings>0||branchRoot.getAssistantsRoot()!=null)&&!branchRoot.getElement().IsCollapsed)&&branchRoot.getState().RequireLayoutStrategy().ApplyHorizontalLayout(state,level)}finally{state.PopLayoutLevel()}},VerticalLayout:function(state,branchRoot){if(branchRoot.getState().IsHidden)throw new System.InvalidOperationException(System.String.format("Branch root {0} does not affect layout",branchRoot.getElement().Id));var level=state.PushLayoutLevel(branchRoot);try{(branchRoot.getLevel()===0||(branchRoot.getState().NumberOfSiblings>0||branchRoot.getAssistantsRoot()!=null)&&!branchRoot.getElement().IsCollapsed)&&branchRoot.getState().RequireLayoutStrategy().ApplyVerticalLayout(state,level)}finally{state.PopLayoutLevel()}},RouteConnectors:function(state,visualTree){visualTree.IterateParentFirst(function(node){return node.getElement().IsCollapsed||node.getState().NumberOfSiblings===0&&node.getAssistantsRoot()==null?!1:node.getLevel()===0?!0:!node.getElement().IsSpecial||node.getIsAssistantRoot()?(node.getState().RequireLayoutStrategy().RouteConnectors(state,node),!0):!1})},MoveChildrenOnly:function(state,layoutLevel,offset){var $t,children=layoutLevel.BranchRoot.getChildren(),action,child;if(children==null||System.Array.getCount(children,OrgChart.Layout.BoxTree.Node)===0)throw new System.InvalidOperationException("Should never be invoked when children not set");for(action=function(node){return node.getState().IsHidden||(node.getState().TopLeft=node.getState().TopLeft.MoveH(offset),node.getState().BranchExterior=node.getState().BranchExterior.MoveH(offset)),!0},$t=Bridge.getEnumerator(children,OrgChart.Layout.BoxTree.Node);$t.moveNext();)child=$t.getCurrent(),child.IterateChildFirst(action);layoutLevel.Boundary.ReloadFromBranch(layoutLevel.BranchRoot);layoutLevel.BranchRoot.getState().BranchExterior=layoutLevel.Boundary.getBoundingRect()},MoveOneChild:function(state,root,offset){root.IterateChildFirst(function(node){return node.getState().IsHidden||(node.getState().TopLeft=node.getState().TopLeft.MoveH(offset),node.getState().BranchExterior=node.getState().BranchExterior.MoveH(offset)),!0})},MoveBranch:function(state,layoutLevel,offset){OrgChart.Layout.LayoutAlgorithm.MoveOneChild(state,layoutLevel.BranchRoot,offset);layoutLevel.Boundary.ReloadFromBranch(layoutLevel.BranchRoot);layoutLevel.BranchRoot.getState().BranchExterior=layoutLevel.Boundary.getBoundingRect()},AlignHorizontalCenters:function(state,level,subset){for(var $t1,center=System.Double.min,child,c,leftmost,rightmost,diff,$t=Bridge.getEnumerator(subset,OrgChart.Layout.BoxTree.Node);$t.moveNext();)child=$t.getCurrent(),c=child.getState().getCenterH(),c>center&&(center=c);for(leftmost=System.Double.max,rightmost=System.Double.min,$t1=Bridge.getEnumerator(subset,OrgChart.Layout.BoxTree.Node);$t1.moveNext();){var child1=$t1.getCurrent(),frame=child1.getState(),c1=frame.getCenterH();OrgChart.Layout.LayoutAlgorithm.IsEqual(c1,center)||(diff=center-c1,OrgChart.Layout.LayoutAlgorithm.MoveOneChild(state,child1,diff));leftmost=Math.min(leftmost,child1.getState().BranchExterior.getLeft());rightmost=Math.max(rightmost,child1.getState().BranchExterior.getRight())}return level.Boundary.ReloadFromBranch(level.BranchRoot),new OrgChart.Layout.Dimensions.$ctor1(leftmost,rightmost)},CopyExteriorFrom:function(state,other){state.TopLeft=other.TopLeft;state.Size=other.Size;state.BranchExterior=other.BranchExterior;state.SiblingsRowV=other.SiblingsRowV},IsMinValue:function(value){return value<=System.Double.min+494065645841247e-338},IsMaxValue:function(value){return value>=System.Double.max-494065645841247e-338},IsZero:function(value){return value<=494065645841247e-338&&value>=-494065645841247e-338},IsEqual:function(value,other){return Math.abs(value-other)<=494065645841247e-338},MoveTo:function(state,x,y){state.TopLeft=new OrgChart.Layout.Point.$ctor1(x,y)},AdjustSpacer:function(state,x,y,w,h){state.TopLeft=new OrgChart.Layout.Point.$ctor1(x,y);state.Size=new OrgChart.Layout.Size.$ctor1(w,h);state.BranchExterior=new OrgChart.Layout.Rect.$ctor3(x,y,w,h)}}});Bridge.ns("OrgChart.Layout.LayoutAlgorithm",$asm.$);Bridge.apply($asm.$.OrgChart.Layout.LayoutAlgorithm,{f1:function(node){return node.getState().IsHidden=node.getParentNode()!=null&&(node.getParentNode().getState().IsHidden||node.getParentNode().getElement().IsCollapsed),!0},f2:function(x){return x.getIsDataBound()},f3:function(node){return OrgChart.Layout.LayoutAlgorithm.MoveTo(node.getState(),0,0),node.getState().Size=node.getElement().Size,node.getState().BranchExterior=new OrgChart.Layout.Rect.$ctor1(new OrgChart.Layout.Point.$ctor1(0,0),node.getElement().Size),!0}});Bridge.define("OrgChart.Layout.LayoutState",{m_layoutStack:null,m_pooledBoundaries:null,m_currentOperation:0,config:{events:{BoundaryChanged:null,OperationChanged:null},properties:{Diagram:null,BoxSizeFunc:null,LayoutOptimizerFunc:null},init:function(){this.m_layoutStack=new(System.Collections.Generic.Stack$1(OrgChart.Layout.LayoutState.LayoutLevel).ctor);this.m_pooledBoundaries=new(System.Collections.Generic.Stack$1(OrgChart.Layout.Boundary).ctor)}},ctor:function(diagram){this.$initialize();this.setDiagram(diagram)},getCurrentOperation:function(){return this.m_currentOperation},setCurrentOperation:function(value){this.m_currentOperation=value;Bridge.staticEquals(this.OperationChanged,null)?null:this.OperationChanged(this,new OrgChart.Layout.LayoutStateOperationChangedEventArgs(this))},AttachVisualTree:function(tree){while(this.m_pooledBoundaries.getCount()<tree.getDepth())this.m_pooledBoundaries.push(new OrgChart.Layout.Boundary.ctor)},PushLayoutLevel:function(node){var boundary,result;this.m_pooledBoundaries.getCount()===0&&this.m_pooledBoundaries.push(new OrgChart.Layout.Boundary.ctor);boundary=this.m_pooledBoundaries.pop();switch(this.getCurrentOperation()){case OrgChart.Layout.LayoutState.Operation.VerticalLayout:boundary.Prepare(node);break;case OrgChart.Layout.LayoutState.Operation.HorizontalLayout:boundary.PrepareForHorizontalLayout(node);break;default:throw new System.InvalidOperationException("This operation can only be invoked when performing vertical or horizontal layouts");}return result=new OrgChart.Layout.LayoutState.LayoutLevel(node,boundary),this.m_layoutStack.push(result),Bridge.staticEquals(this.BoundaryChanged,null)?null:this.BoundaryChanged(this,new OrgChart.Layout.BoundaryChangedEventArgs(boundary,result,this)),result},MergeSpacer:function(spacer){if(this.getCurrentOperation()!==OrgChart.Layout.LayoutState.Operation.HorizontalLayout)throw new System.InvalidOperationException("Spacers can only be merged during horizontal layout");if(this.m_layoutStack.getCount()===0)throw new System.InvalidOperationException("Cannot merge spacers at top nesting level");var level=this.m_layoutStack.peek();level.Boundary.MergeFrom$1(spacer);Bridge.staticEquals(this.BoundaryChanged,null)?null:this.BoundaryChanged(this,new OrgChart.Layout.BoundaryChangedEventArgs(level.Boundary,level,this))},PopLayoutLevel:function(){var innerLevel=this.m_layoutStack.pop(),higherLevel,strategy,overlap;if(Bridge.staticEquals(this.BoundaryChanged,null)?null:this.BoundaryChanged(this,new OrgChart.Layout.BoundaryChangedEventArgs(innerLevel.Boundary,innerLevel,this)),this.m_layoutStack.getCount()>0){higherLevel=this.m_layoutStack.peek();switch(this.getCurrentOperation()){case OrgChart.Layout.LayoutState.Operation.VerticalLayout:higherLevel.Boundary.VerticalMergeFrom(innerLevel.Boundary);higherLevel.BranchRoot.getState().BranchExterior=higherLevel.Boundary.getBoundingRect();break;case OrgChart.Layout.LayoutState.Operation.HorizontalLayout:Bridge.referenceEquals(higherLevel.BranchRoot.getAssistantsRoot(),innerLevel.BranchRoot)||(strategy=higherLevel.BranchRoot.getState().RequireLayoutStrategy(),overlap=higherLevel.Boundary.ComputeOverlap(innerLevel.Boundary,strategy.SiblingSpacing,this.getDiagram().getLayoutSettings().getBranchSpacing()),overlap>0&&(OrgChart.Layout.LayoutAlgorithm.MoveBranch(this,innerLevel,overlap),Bridge.staticEquals(this.BoundaryChanged,null)?null:this.BoundaryChanged(this,new OrgChart.Layout.BoundaryChangedEventArgs(innerLevel.Boundary,innerLevel,this))));higherLevel.Boundary.MergeFrom(innerLevel.Boundary);higherLevel.BranchRoot.getState().BranchExterior=new OrgChart.Layout.Rect.$ctor3(higherLevel.Boundary.getBoundingRect().getLeft(),higherLevel.BranchRoot.getState().BranchExterior.getTop(),higherLevel.Boundary.getBoundingRect().Size.Width,higherLevel.BranchRoot.getState().BranchExterior.Size.Height);break;default:throw new System.InvalidOperationException("This operation can only be invoked when performing vertical or horizontal layouts");}Bridge.staticEquals(this.BoundaryChanged,null)?null:this.BoundaryChanged(this,new OrgChart.Layout.BoundaryChangedEventArgs(higherLevel.Boundary,higherLevel,this))}this.m_pooledBoundaries.push(innerLevel.Boundary)}});Bridge.define("OrgChart.Layout.LayoutState.LayoutLevel",{BranchRoot:null,Boundary:null,ctor:function(node,boundary){this.$initialize();this.BranchRoot=node;this.Boundary=boundary}});Bridge.define("OrgChart.Layout.LayoutState.Operation",{$kind:"enum",statics:{Idle:0,Preparing:1,PreprocessVisualTree:2,VerticalLayout:3,HorizontalLayout:4,ConnectorsLayout:5,Completed:6}});Bridge.define("OrgChart.Layout.LayoutStateOperationChangedEventArgs",{State:null,ctor:function(state){this.$initialize();this.State=state}});Bridge.define("OrgChart.Layout.MultiLineFishboneLayoutStrategy.SingleFishboneLayoutAdapter.GroupIterator",{m_numberOfSiblings:0,m_numberOfGroups:0,Group:0,FromIndex:0,Count:0,MaxOnLeft:0,ctor:function(numberOfSiblings,numberOfGroups){this.$initialize();this.m_numberOfSiblings=numberOfSiblings;this.m_numberOfGroups=numberOfGroups},CountInGroup:function(){for(var countInRow=this.m_numberOfGroups*2|0,result=0,countToThisGroup=(this.Group*2|0)+2|0,firstInRow=0,countInThisRow;;){if(countInThisRow=firstInRow>=(this.m_numberOfSiblings-countInRow|0)?this.m_numberOfSiblings-firstInRow|0:countInRow,countInThisRow>=countToThisGroup)result=result+2|0;else{countToThisGroup=countToThisGroup-1|0;countInThisRow>=countToThisGroup&&(result=result+1|0);break}firstInRow=firstInRow+countInRow|0}return result},NextGroup:function(){return this.FromIndex=this.FromIndex+this.Count|0,this.FromIndex>0&&(this.Group=this.Group+1|0),this.Count=this.CountInGroup(),this.MaxOnLeft=(Bridge.Int.div(this.Count,2)|0)+this.Count%2|0,this.Count!==0}});Bridge.define("OrgChart.Layout.NodeLayoutInfo",{IsHidden:!1,NumberOfSiblings:0,NumberOfSiblingRows:0,NumberOfSiblingColumns:0,Connector:null,m_effectiveLayoutStrategy:null,config:{init:function(){this.TopLeft=new OrgChart.Layout.Point;this.Size=new OrgChart.Layout.Size;this.BranchExterior=new OrgChart.Layout.Rect;this.SiblingsRowV=new OrgChart.Layout.Dimensions}},setEffectiveLayoutStrategy:function(value){this.m_effectiveLayoutStrategy=value},getLeft:function(){return this.TopLeft.X},getRight:function(){return this.TopLeft.X+this.Size.Width},getTop:function(){return this.TopLeft.Y},getBottom:function(){return this.TopLeft.Y+this.Size.Height},getCenterH:function(){return this.TopLeft.X+this.Size.Width/2},getCenterV:function(){return this.TopLeft.Y+this.Size.Height/2},RequireLayoutStrategy:function(){if(this.m_effectiveLayoutStrategy==null)throw new System.Exception("effectiveLayoutStrategy is not set");return this.m_effectiveLayoutStrategy}});Bridge.define("OrgChart.Layout.Point",{$kind:"struct",statics:{getDefaultValue:function(){return new OrgChart.Layout.Point}},X:0,Y:0,$ctor1:function(x,y){this.$initialize();this.X=x;this.Y=y},ctor:function(){this.$initialize()},MoveH:function(offsetX){return new OrgChart.Layout.Point.$ctor1(this.X+offsetX,this.Y)},getHashCode:function(){return Bridge.addHash([1852403652,this.X,this.Y])},equals:function(o){return Bridge.is(o,OrgChart.Layout.Point)?Bridge.equals(this.X,o.X)&&Bridge.equals(this.Y,o.Y):!1},$clone:function(to){var s=to||new OrgChart.Layout.Point;return s.X=this.X,s.Y=this.Y,s}});Bridge.define("OrgChart.Layout.Rect",{$kind:"struct",statics:{op_Addition:function(x,y){var left=Math.min(x.getLeft(),y.getLeft()),top=Math.min(x.getTop(),y.getTop()),right=Math.max(x.getRight(),y.getRight()),bottom=Math.max(x.getBottom(),y.getBottom());return new OrgChart.Layout.Rect.$ctor3(left,top,right-left,bottom-top)},getDefaultValue:function(){return new OrgChart.Layout.Rect}},config:{init:function(){this.TopLeft=new OrgChart.Layout.Point;this.Size=new OrgChart.Layout.Size}},$ctor3:function(x,y,w,h){if(this.$initialize(),w<0)throw new System.ArgumentOutOfRangeException("w");if(h<0)throw new System.ArgumentOutOfRangeException("h");this.TopLeft=new OrgChart.Layout.Point.$ctor1(x,y);this.Size=new OrgChart.Layout.Size.$ctor1(w,h)},$ctor1:function(topLeft,size){this.$initialize();this.TopLeft=topLeft;this.Size=size},$ctor2:function(size){this.$initialize();this.TopLeft=new OrgChart.Layout.Point.$ctor1(0,0);this.Size=size},ctor:function(){this.$initialize()},getBottomRight:function(){return new OrgChart.Layout.Point.$ctor1(this.TopLeft.X+this.Size.Width,this.TopLeft.Y+this.Size.Height)},getLeft:function(){return this.TopLeft.X},getRight:function(){return this.TopLeft.X+this.Size.Width},getCenterH:function(){return this.TopLeft.X+this.Size.Width/2},getCenterV:function(){return this.TopLeft.Y+this.Size.Height/2},getTop:function(){return this.TopLeft.Y},getBottom:function(){return this.TopLeft.Y+this.Size.Height},MoveH:function(offsetX){return new OrgChart.Layout.Rect.$ctor1(new OrgChart.Layout.Point.$ctor1(this.getLeft()+offsetX,this.getTop()),this.Size)},getHashCode:function(){return Bridge.addHash([1952671058,this.TopLeft,this.Size])},equals:function(o){return Bridge.is(o,OrgChart.Layout.Rect)?Bridge.equals(this.TopLeft,o.TopLeft)&&Bridge.equals(this.Size,o.Size):!1},$clone:function(to){var s=to||new OrgChart.Layout.Rect;return s.TopLeft=this.TopLeft,s.Size=this.Size,s}});Bridge.define("OrgChart.Layout.Size",{$kind:"struct",statics:{getDefaultValue:function(){return new OrgChart.Layout.Size}},Width:0,Height:0,$ctor1:function(w,h){this.$initialize();this.Width=w;this.Height=h},ctor:function(){this.$initialize()},getHashCode:function(){return Bridge.addHash([1702521171,this.Width,this.Height])},equals:function(o){return Bridge.is(o,OrgChart.Layout.Size)?Bridge.equals(this.Width,o.Width)&&Bridge.equals(this.Height,o.Height):!1},$clone:function(to){var s=to||new OrgChart.Layout.Size;return s.Width=this.Width,s.Height=this.Height,s}});Bridge.define("OrgChart.Layout.StackOrientation",{$kind:"enum",statics:{InvalidValue:0,SingleRowHorizontal:1,SingleColumnVertical:2}});Bridge.define("OrgChart.Test.TestDataGen",{statics:{GenerateBoxSizes:function(boxContainer){var $t,seed=0,random,box;for(System.Diagnostics.Debug.writeln(seed.toString()),random=new System.Random.$ctor1(seed),$t=Bridge.getEnumerator(boxContainer.getBoxesById().System$Collections$Generic$IDictionary$2$System$Int32$OrgChart$Layout$Box$getValues(),OrgChart.Layout.Box);$t.moveNext();)box=$t.getCurrent(),box.IsSpecial||(box.Size=new OrgChart.Layout.Size.$ctor1(50+random.next$1(50)|0,50+random.next$1(50)|0))}},GenerateDataItems:function(dataSource,count,percentAssistants){for(var item,$t=Bridge.getEnumerator(this.GenerateRandomDataItems(count,percentAssistants));$t.moveNext();)item=$t.getCurrent(),dataSource.Items.add(item.getId(),item)},GenerateRandomDataItems:function(itemCount,percentAssistants){var random,items,i,firstInLayer,prevLayerSize,layerSize,i1,parentIndex,i2,assistantCount,i3;if(itemCount<0)throw new System.ArgumentOutOfRangeException("itemCount","Count must be zero or positive",null,itemCount);for(random=new System.Random.$ctor1(0),items=new(System.Collections.Generic.List$1(OrgChart.Test.TestDataItem))(itemCount),i=0;i<itemCount;i=i+1|0)items.add(Bridge.merge(new OrgChart.Test.TestDataItem,{setId:i.toString()}));for(firstInLayer=1,prevLayerSize=1;firstInLayer<itemCount;){for(layerSize=(15+prevLayerSize|0)+random.next$1(prevLayerSize*2|0)|0,i1=firstInLayer;i1<(firstInLayer+layerSize|0)&&i1<itemCount;i1=i1+1|0)parentIndex=(firstInLayer-1|0)-random.next$1(prevLayerSize)|0,items.getItem(i1).setParentId(items.getItem(parentIndex).getId());firstInLayer=firstInLayer+layerSize|0;prevLayerSize=layerSize}for(i2=0;i2<(Bridge.Int.div(items.getCount(),2)|0);i2=i2+1|0){var from=random.next$1(items.getCount()),to=random.next$1(items.getCount()),temp=items.getItem(from);items.setItem(from,items.getItem(to));items.setItem(to,temp)}if(percentAssistants>0)for(assistantCount=Math.min(items.getCount(),Bridge.Int.clip32(Math.ceil((items.getCount()*percentAssistants|0)/100))),i3=0;i3<assistantCount;i3=i3+1|0)items.getItem(random.next$1(items.getCount())).setIsAssistant(!0);return items}});Bridge.define("System.Diagnostics.DebuggerDisplayAttribute",{inherits:[System.Attribute],ctor:function(){this.$initialize();System.Attribute.ctor.call(this)}});Bridge.define("OrgChart.Layout.FishboneAssistantsLayoutStrategy",{inherits:[OrgChart.Layout.LayoutStrategyBase],getSupportsAssistants:function(){return!1},PreProcessThisNode:function(state,node){if(node.getState().NumberOfSiblings=node.getChildCount(),node.getState().NumberOfSiblings>0){node.getState().NumberOfSiblingColumns=1;node.getState().NumberOfSiblingRows=Bridge.Int.div(node.getState().NumberOfSiblings,2)|0;node.getState().NumberOfSiblings%2!=0&&(node.getState().NumberOfSiblingRows=node.getState().NumberOfSiblingRows+1|0);var spacer=OrgChart.Layout.Box.Special(OrgChart.Layout.Box.None,node.getElement().Id,!1);node.AddRegularChild(spacer)}},ApplyVerticalLayout:function(state,level){var node=level.BranchRoot,prevRowBottom,maxOnLeft,i,rowExterior,i2,child2,frame2;if(node.getLevel()===0)throw new System.InvalidOperationException("Should never be invoked on root node");for(prevRowBottom=node.getState().SiblingsRowV.To,maxOnLeft=this.MaxOnLeft(node),i=0;i<maxOnLeft;i=i+1|0){var spacing=i===0?this.ParentChildSpacing:this.SiblingSpacing,child=System.Array.getItem(node.getChildren(),i,OrgChart.Layout.BoxTree.Node),frame=child.getState();OrgChart.Layout.LayoutAlgorithm.MoveTo(frame,frame.getLeft(),prevRowBottom+spacing);rowExterior=new OrgChart.Layout.Dimensions.$ctor1(frame.getTop(),frame.getBottom());i2=i+maxOnLeft|0;i2<node.getState().NumberOfSiblings&&(child2=System.Array.getItem(node.getChildren(),i2,OrgChart.Layout.BoxTree.Node),frame2=child2.getState(),OrgChart.Layout.LayoutAlgorithm.MoveTo(frame2,frame2.getLeft(),prevRowBottom+spacing),frame2.getBottom()>frame.getBottom()?OrgChart.Layout.LayoutAlgorithm.MoveTo(frame,frame.getLeft(),frame2.getCenterV()-frame.Size.Height/2):frame2.getBottom()<frame.getBottom()&&OrgChart.Layout.LayoutAlgorithm.MoveTo(frame2,frame2.getLeft(),frame.getCenterV()-frame2.Size.Height/2),frame2.BranchExterior=new OrgChart.Layout.Rect.$ctor1(frame2.TopLeft,frame2.Size),rowExterior=OrgChart.Layout.Dimensions.op_Addition(rowExterior,new OrgChart.Layout.Dimensions.$ctor1(frame2.getTop(),frame2.getBottom())),frame2.SiblingsRowV=rowExterior,OrgChart.Layout.LayoutAlgorithm.VerticalLayout(state,child2),prevRowBottom=frame2.BranchExterior.getBottom());frame.BranchExterior=new OrgChart.Layout.Rect.$ctor1(frame.TopLeft,frame.Size);frame.SiblingsRowV=rowExterior;OrgChart.Layout.LayoutAlgorithm.VerticalLayout(state,child);prevRowBottom=Math.max(prevRowBottom,frame.BranchExterior.getBottom())}},ApplyHorizontalLayout:function(state,level){var node=level.BranchRoot,i,child,rightmost,k,opposite,spacer,diff,carrier,desiredCenter;node.getLevel()===0&&(node.getState().SiblingsRowV=new OrgChart.Layout.Dimensions.$ctor1(node.getState().getTop(),node.getState().getBottom()));var left=!0,countOnThisSide=0,maxOnLeft=this.MaxOnLeft(node);for(i=0;i<node.getState().NumberOfSiblings;i=i+1|0)if(child=System.Array.getItem(node.getChildren(),i,OrgChart.Layout.BoxTree.Node),OrgChart.Layout.LayoutAlgorithm.HorizontalLayout(state,child),(countOnThisSide=countOnThisSide+1|0)===maxOnLeft&&left){for(OrgChart.Layout.LayoutAlgorithm.AlignHorizontalCenters(state,level,this.EnumerateSiblings(node,0,maxOnLeft)),left=!1,countOnThisSide=0,rightmost=System.Double.min,k=0;k<=i;k=k+1|0)rightmost=Math.max(rightmost,System.Array.getItem(node.getChildren(),k,OrgChart.Layout.BoxTree.Node).getState().BranchExterior.getRight());node.getState().NumberOfSiblings%2!=0?rightmost=Math.max(rightmost,child.getState().getRight()):(opposite=System.Array.getItem(node.getChildren(),node.getState().NumberOfSiblings-1|0,OrgChart.Layout.BoxTree.Node),rightmost=opposite.getElement().IsCollapsed||opposite.getChildCount()===0?Math.max(rightmost,child.getState().getRight()):Math.max(rightmost,child.getState().BranchExterior.getRight()));spacer=System.Array.getItem(node.getChildren(),node.getState().NumberOfSiblings,OrgChart.Layout.BoxTree.Node);OrgChart.Layout.LayoutAlgorithm.AdjustSpacer(spacer.getState(),rightmost,node.getState().getBottom(),this.ParentConnectorShield,node.getState().BranchExterior.getBottom()-node.getState().getBottom());level.Boundary.MergeFrom$1(spacer)}OrgChart.Layout.LayoutAlgorithm.AlignHorizontalCenters(state,level,this.EnumerateSiblings(node,maxOnLeft,node.getState().NumberOfSiblings));node.getLevel()>0&&node.getState().NumberOfSiblings>0&&(carrier=System.Array.getItem(node.getChildren(),node.getState().NumberOfSiblings,OrgChart.Layout.BoxTree.Node).getState().getCenterH(),desiredCenter=node.getState().getCenterH(),diff=desiredCenter-carrier,OrgChart.Layout.LayoutAlgorithm.MoveChildrenOnly(state,level,diff))},RouteConnectors:function(state,node){var count=node.getState().NumberOfSiblings,i,to,y;if(count!==0){this.NeedCarrierProtector(node)&&(count=count+1|0);var segments=System.Array.init(count,function(){return new OrgChart.Layout.Edge}),ix=0,maxOnLeft=this.MaxOnLeft(node),carrier=System.Array.getItem(node.getChildren(),node.getState().NumberOfSiblings,OrgChart.Layout.BoxTree.Node).getState(),from=carrier.getCenterH(),isLeft=!0,countOnThisSide=0,bottomMost=System.Double.min;for(i=0;i<node.getState().NumberOfSiblings;i=i+1|0)to=isLeft?System.Array.getItem(node.getChildren(),i,OrgChart.Layout.BoxTree.Node).getState().getRight():System.Array.getItem(node.getChildren(),i,OrgChart.Layout.BoxTree.Node).getState().getLeft(),y=System.Array.getItem(node.getChildren(),i,OrgChart.Layout.BoxTree.Node).getState().getCenterV(),bottomMost=Math.max(bottomMost,y),segments[Bridge.identity(ix,ix=ix+1|0)]=new OrgChart.Layout.Edge.$ctor1(new OrgChart.Layout.Point.$ctor1(from,y),new OrgChart.Layout.Point.$ctor1(to,y)),(countOnThisSide=countOnThisSide+1|0)===maxOnLeft&&(countOnThisSide=0,isLeft=!isLeft);this.NeedCarrierProtector(node)&&(segments[node.getState().NumberOfSiblings]=new OrgChart.Layout.Edge.$ctor1(new OrgChart.Layout.Point.$ctor1(carrier.getCenterH(),carrier.getTop()),new OrgChart.Layout.Point.$ctor1(carrier.getCenterH(),bottomMost)));node.getState().Connector=new OrgChart.Layout.Connector(segments)}},MaxOnLeft:function(node){return(Bridge.Int.div(node.getState().NumberOfSiblings,2)|0)+node.getState().NumberOfSiblings%2|0},NeedCarrierProtector:function(node){return node.getParentNode().getChildCount()===0},EnumerateSiblings:function(node,from,to){for(var $yield=[],i=from;i<to;i=i+1|0)$yield.push(System.Array.getItem(node.getChildren(),i,OrgChart.Layout.BoxTree.Node));return System.Array.toEnumerable($yield)}});Bridge.define("OrgChart.Layout.LinearLayoutStrategy",{inherits:[OrgChart.Layout.LayoutStrategyBase],getSupportsAssistants:function(){return!0},PreProcessThisNode:function(state,node){var verticalSpacer,horizontalSpacer;node.getChildCount()>0&&(node.getState().NumberOfSiblings=node.getElement().IsCollapsed?0:node.getChildCount(),node.getElement().IsCollapsed||(verticalSpacer=OrgChart.Layout.Box.Special(OrgChart.Layout.Box.None,node.getElement().Id,!1),node.AddRegularChild(verticalSpacer),horizontalSpacer=OrgChart.Layout.Box.Special(OrgChart.Layout.Box.None,node.getElement().Id,!1),node.AddRegularChild(horizontalSpacer)))},ApplyVerticalLayout:function(state,level){var node=level.BranchRoot,siblingsRowExterior,top,i,child,rect,i1,child1;if(node.getLevel()===0&&(node.getState().SiblingsRowV=new OrgChart.Layout.Dimensions.$ctor1(node.getState().getTop(),node.getState().getBottom())),node.getAssistantsRoot()!=null&&(OrgChart.Layout.LayoutAlgorithm.CopyExteriorFrom(node.getAssistantsRoot().getState(),node.getState()),OrgChart.Layout.LayoutAlgorithm.VerticalLayout(state,node.getAssistantsRoot())),node.getState().NumberOfSiblings!==0){for(siblingsRowExterior=OrgChart.Layout.Dimensions.MinMax(),top=node.getAssistantsRoot()==null?node.getState().SiblingsRowV.To+this.ParentChildSpacing:node.getState().BranchExterior.getBottom()+this.ParentChildSpacing,i=0;i<node.getState().NumberOfSiblings;i=i+1|0)child=System.Array.getItem(node.getChildren(),i,OrgChart.Layout.BoxTree.Node),rect=child.getState(),OrgChart.Layout.LayoutAlgorithm.MoveTo(child.getState(),0,top),child.getState().BranchExterior=new OrgChart.Layout.Rect.$ctor1(child.getState().TopLeft,child.getState().Size),siblingsRowExterior=OrgChart.Layout.Dimensions.op_Addition(siblingsRowExterior,new OrgChart.Layout.Dimensions.$ctor1(top,top+rect.Size.Height));for(siblingsRowExterior=new OrgChart.Layout.Dimensions.$ctor1(siblingsRowExterior.From,siblingsRowExterior.To),i1=0;i1<node.getState().NumberOfSiblings;i1=i1+1|0)child1=System.Array.getItem(node.getChildren(),i1,OrgChart.Layout.BoxTree.Node),child1.getState().SiblingsRowV=siblingsRowExterior,OrgChart.Layout.LayoutAlgorithm.VerticalLayout(state,child1)}},ApplyHorizontalLayout:function(state,level){var node=level.BranchRoot,i,child,verticalSpacer,firstInRow,horizontalSpacer;for(node.getAssistantsRoot()!=null&&OrgChart.Layout.LayoutAlgorithm.HorizontalLayout(state,node.getAssistantsRoot()),i=0;i<node.getState().NumberOfSiblings;i=i+1|0)child=System.Array.getItem(node.getChildren(),i,OrgChart.Layout.BoxTree.Node),OrgChart.Layout.LayoutAlgorithm.HorizontalLayout(state,child);if(node.getLevel()>0&&node.getChildCount()>0){var rect=node.getState(),leftmost=System.Array.getItem(node.getChildren(),0,OrgChart.Layout.BoxTree.Node).getState().getCenterH(),rightmost=System.Array.getItem(node.getChildren(),node.getState().NumberOfSiblings-1|0,OrgChart.Layout.BoxTree.Node).getState().getCenterH(),desiredCenter=node.getState().NumberOfSiblings===1||this.ParentAlignment===OrgChart.Layout.BranchParentAlignment.Center?leftmost+(rightmost-leftmost)/2:this.ParentAlignment===OrgChart.Layout.BranchParentAlignment.Left?leftmost+this.ChildConnectorHookLength:rightmost-this.ChildConnectorHookLength,center=rect.getCenterH(),diff=center-desiredCenter;OrgChart.Layout.LayoutAlgorithm.MoveChildrenOnly(state,level,diff);verticalSpacer=System.Array.getItem(node.getChildren(),node.getState().NumberOfSiblings,OrgChart.Layout.BoxTree.Node);OrgChart.Layout.LayoutAlgorithm.AdjustSpacer(verticalSpacer.getState(),center-this.ParentConnectorShield/2,rect.getBottom(),this.ParentConnectorShield,System.Array.getItem(node.getChildren(),0,OrgChart.Layout.BoxTree.Node).getState().SiblingsRowV.From-rect.getBottom());state.MergeSpacer(verticalSpacer);firstInRow=System.Array.getItem(node.getChildren(),0,OrgChart.Layout.BoxTree.Node).getState();horizontalSpacer=System.Array.getItem(node.getChildren(),node.getState().NumberOfSiblings+1|0,OrgChart.Layout.BoxTree.Node);OrgChart.Layout.LayoutAlgorithm.AdjustSpacer(horizontalSpacer.getState(),firstInRow.getLeft(),firstInRow.SiblingsRowV.From-this.ParentChildSpacing,System.Array.getItem(node.getChildren(),node.getState().NumberOfSiblings-1|0,OrgChart.Layout.BoxTree.Node).getState().getRight()-firstInRow.getLeft(),this.ParentChildSpacing);state.MergeSpacer(horizontalSpacer)}},RouteConnectors:function(state,node){var normalChildCount=node.getState().NumberOfSiblings,count=normalChildCount===0?0:normalChildCount===1?1:2+normalChildCount|0,space,i,childRect,childCenter;if(count===0){node.getState().Connector=null;return}var segments=System.Array.init(count,function(){return new OrgChart.Layout.Edge}),rootRect=node.getState(),center=rootRect.getCenterH();if(node.getChildren()==null)throw new System.Exception("State is present, but children not set");if(count===1)segments[0]=new OrgChart.Layout.Edge.$ctor1(new OrgChart.Layout.Point.$ctor1(center,rootRect.getBottom()),new OrgChart.Layout.Point.$ctor1(center,System.Array.getItem(node.getChildren(),0,OrgChart.Layout.BoxTree.Node).getState().getTop()));else{for(space=System.Array.getItem(node.getChildren(),0,OrgChart.Layout.BoxTree.Node).getState().SiblingsRowV.From-rootRect.getBottom(),segments[0]=new OrgChart.Layout.Edge.$ctor1(new OrgChart.Layout.Point.$ctor1(center,rootRect.getBottom()),new OrgChart.Layout.Point.$ctor1(center,rootRect.getBottom()+space-this.ChildConnectorHookLength)),i=0;i<normalChildCount;i=i+1|0)childRect=System.Array.getItem(node.getChildren(),i,OrgChart.Layout.BoxTree.Node).getState(),childCenter=childRect.getCenterH(),segments[1+i|0]=new OrgChart.Layout.Edge.$ctor1(new OrgChart.Layout.Point.$ctor1(childCenter,childRect.getTop()),new OrgChart.Layout.Point.$ctor1(childCenter,childRect.getTop()-this.ChildConnectorHookLength));segments[count-1|0]=new OrgChart.Layout.Edge.$ctor1(new OrgChart.Layout.Point.$ctor1(segments[1].To.X,segments[1].To.Y),new OrgChart.Layout.Point.$ctor1(segments[count-2|0].To.X,segments[1].To.Y))}node.getState().Connector=new OrgChart.Layout.Connector(segments)}});Bridge.define("OrgChart.Layout.MultiLineFishboneLayoutStrategy.SingleFishboneLayoutAdapter",{inherits:[OrgChart.Layout.LayoutStrategyBase],RealRoot:null,SpecialRoot:null,Iterator:null,ctor:function(realRoot){this.$initialize();OrgChart.Layout.LayoutStrategyBase.ctor.call(this);this.Iterator=new OrgChart.Layout.MultiLineFishboneLayoutStrategy.SingleFishboneLayoutAdapter.GroupIterator(realRoot.getState().NumberOfSiblings,realRoot.getState().NumberOfSiblingColumns);this.RealRoot=realRoot;this.SpecialRoot=Bridge.merge(new OrgChart.Layout.MultiLineFishboneLayoutStrategy.SingleFishboneLayoutAdapter.TreeNodeView(OrgChart.Layout.Box.Special(OrgChart.Layout.Box.None,realRoot.getElement().Id,!0)),{setLevel:this.RealRoot.getLevel(),setParentNode:this.RealRoot});this.SpecialRoot.getState().setEffectiveLayoutStrategy(this);var parentStrategy=Bridge.cast(realRoot.getState().RequireLayoutStrategy(),OrgChart.Layout.MultiLineFishboneLayoutStrategy);this.SiblingSpacing=parentStrategy.SiblingSpacing;this.ParentConnectorShield=parentStrategy.ParentConnectorShield;this.ParentChildSpacing=parentStrategy.ParentChildSpacing;this.ParentAlignment=parentStrategy.ParentAlignment;this.ChildConnectorHookLength=parentStrategy.ChildConnectorHookLength},getSupportsAssistants:function(){return!1},NextGroup:function(){var i,spacer;if(!this.Iterator.NextGroup())return!1;for(this.SpecialRoot.getState().NumberOfSiblings=this.Iterator.Count,this.SpecialRoot.Prepare(this.RealRoot.getState().NumberOfSiblingRows*2|0),i=0;i<this.Iterator.Count;i=i+1|0)this.SpecialRoot.AddChildView(System.Array.getItem(this.RealRoot.getChildren(),this.Iterator.FromIndex+i|0,OrgChart.Layout.BoxTree.Node));return spacer=System.Array.getItem(this.RealRoot.getChildren(),(this.RealRoot.getState().NumberOfSiblings+1|0)+this.Iterator.Group|0,OrgChart.Layout.BoxTree.Node),this.SpecialRoot.AddChildView(spacer),OrgChart.Layout.LayoutAlgorithm.CopyExteriorFrom(this.SpecialRoot.getState(),this.RealRoot.getState()),!0},PreProcessThisNode:function(){throw new System.NotSupportedException;},ApplyVerticalLayout:function(state){for(var rowExterior,i2,child2,frame2,$t,$t1,prevRowBottom=($t=this.RealRoot.getAssistantsRoot())!=null?$t.getState().BranchExterior.getBottom():($t1=null,$t1!=null?$t1:this.SpecialRoot.getState().SiblingsRowV.To),i=0;i<this.Iterator.MaxOnLeft;i=i+1|0){var spacing=i===0?this.ParentChildSpacing:this.SiblingSpacing,child=System.Array.getItem(this.SpecialRoot.getChildren(),i,OrgChart.Layout.BoxTree.Node),frame=child.getState();OrgChart.Layout.LayoutAlgorithm.MoveTo(frame,frame.getLeft(),prevRowBottom+spacing);rowExterior=new OrgChart.Layout.Dimensions.$ctor1(frame.getTop(),frame.getBottom());i2=i+this.Iterator.MaxOnLeft|0;i2<this.Iterator.Count&&(child2=System.Array.getItem(this.SpecialRoot.getChildren(),i2,OrgChart.Layout.BoxTree.Node),frame2=child2.getState(),OrgChart.Layout.LayoutAlgorithm.MoveTo(frame2,frame2.getLeft(),prevRowBottom+spacing),frame2.getBottom()>frame.getBottom()?OrgChart.Layout.LayoutAlgorithm.MoveTo(frame,frame.getLeft(),frame2.getCenterV()-frame.Size.Height/2):frame2.getBottom()<frame.getBottom()&&OrgChart.Layout.LayoutAlgorithm.MoveTo(frame2,frame2.getLeft(),frame.getCenterV()-frame2.Size.Height/2),frame2.BranchExterior=new OrgChart.Layout.Rect.$ctor1(frame2.TopLeft,frame2.Size),rowExterior=OrgChart.Layout.Dimensions.op_Addition(rowExterior,new OrgChart.Layout.Dimensions.$ctor1(frame2.getTop(),frame2.getBottom())),frame2.SiblingsRowV=rowExterior,OrgChart.Layout.LayoutAlgorithm.VerticalLayout(state,child2),prevRowBottom=frame2.BranchExterior.getBottom());frame.BranchExterior=new OrgChart.Layout.Rect.$ctor1(frame.TopLeft,frame.Size);frame.SiblingsRowV=rowExterior;OrgChart.Layout.LayoutAlgorithm.VerticalLayout(state,child);prevRowBottom=Math.max(prevRowBottom,frame.BranchExterior.getBottom())}},ApplyHorizontalLayout:function(state,level){var left,countOnThisSide,i,child,rightmost,k,spacer;if(!Bridge.referenceEquals(level.BranchRoot,this.SpecialRoot))throw new System.InvalidOperationException("Wrong root node received");for(left=!0,countOnThisSide=0,i=0;i<this.Iterator.Count;i=i+1|0)if(child=System.Array.getItem(this.SpecialRoot.getChildren(),i,OrgChart.Layout.BoxTree.Node),OrgChart.Layout.LayoutAlgorithm.HorizontalLayout(state,child),(countOnThisSide=countOnThisSide+1|0)===this.Iterator.MaxOnLeft&&left){for(OrgChart.Layout.LayoutAlgorithm.AlignHorizontalCenters(state,level,this.EnumerateSiblings(0,this.Iterator.MaxOnLeft)),left=!1,countOnThisSide=0,rightmost=System.Double.min,k=0;k<i;k=k+1|0)rightmost=Math.max(rightmost,System.Array.getItem(this.SpecialRoot.getChildren(),k,OrgChart.Layout.BoxTree.Node).getState().BranchExterior.getRight());rightmost=Math.max(rightmost,child.getState().getRight());spacer=System.Array.getItem(this.SpecialRoot.getChildren(),this.SpecialRoot.getState().NumberOfSiblings,OrgChart.Layout.BoxTree.Node);OrgChart.Layout.LayoutAlgorithm.AdjustSpacer(spacer.getState(),rightmost,System.Array.getItem(this.SpecialRoot.getChildren(),0,OrgChart.Layout.BoxTree.Node).getState().SiblingsRowV.From,this.SiblingSpacing,child.getState().SiblingsRowV.To-System.Array.getItem(this.SpecialRoot.getChildren(),0,OrgChart.Layout.BoxTree.Node).getState().SiblingsRowV.From);level.Boundary.MergeFrom$1(spacer)}OrgChart.Layout.LayoutAlgorithm.AlignHorizontalCenters(state,level,this.EnumerateSiblings(this.Iterator.MaxOnLeft,this.Iterator.Count))},EnumerateSiblings:function(from,to){for(var $yield=[],i=from;i<to;i=i+1|0)$yield.push(System.Array.getItem(this.SpecialRoot.getChildren(),i,OrgChart.Layout.BoxTree.Node));return System.Array.toEnumerable($yield)},RouteConnectors:function(){throw new System.NotSupportedException;}});Bridge.define("OrgChart.Layout.MultiLineFishboneLayoutStrategy.SingleFishboneLayoutAdapter.TreeNodeView",{inherits:[OrgChart.Layout.BoxTree.Node],ctor:function(element){this.$initialize();OrgChart.Layout.BoxTree.Node.ctor.call(this,element)},Prepare:function(capacity){this.getChildren()==null?this.setChildren(new(System.Collections.Generic.List$1(OrgChart.Layout.BoxTree.Node))(capacity)):System.Array.clear(this.getChildren(),OrgChart.Layout.BoxTree.Node)},AddChildView:function(node){System.Array.add(this.getChildren(),node,OrgChart.Layout.BoxTree.Node)}});Bridge.define("OrgChart.Layout.SingleColumnLayoutStrategy",{inherits:[OrgChart.Layout.LayoutStrategyBase],getSupportsAssistants:function(){return!0},PreProcessThisNode:function(state,node){if(this.ParentAlignment!==OrgChart.Layout.BranchParentAlignment.Left&&this.ParentAlignment!==OrgChart.Layout.BranchParentAlignment.Right)throw new System.InvalidOperationException("Unsupported value for ParentAlignment");if(node.getState().NumberOfSiblings=node.getElement().IsCollapsed?0:node.getChildCount(),node.getState().NumberOfSiblings>0&&node.getLevel()>0){node.getState().NumberOfSiblingColumns=1;node.getState().NumberOfSiblingRows=node.getChildCount();var verticalSpacer=OrgChart.Layout.Box.Special(OrgChart.Layout.Box.None,node.getElement().Id,!1);node.AddRegularChild(verticalSpacer)}},ApplyVerticalLayout:function(state,level){var node=level.BranchRoot,prevRowExterior,row,rowExterior,childBranchBottom;for(node.getLevel()===0&&(node.getState().SiblingsRowV=new OrgChart.Layout.Dimensions.$ctor1(node.getState().getTop(),node.getState().getBottom())),node.getAssistantsRoot()!=null&&(OrgChart.Layout.LayoutAlgorithm.CopyExteriorFrom(node.getAssistantsRoot().getState(),node.getState()),OrgChart.Layout.LayoutAlgorithm.VerticalLayout(state,node.getAssistantsRoot())),prevRowExterior=new OrgChart.Layout.Dimensions.$ctor1(node.getState().SiblingsRowV.From,node.getAssistantsRoot()==null?node.getState().SiblingsRowV.To:node.getState().BranchExterior.getBottom()),row=0;row<node.getState().NumberOfSiblings;row=row+1|0){var child=System.Array.getItem(node.getChildren(),row,OrgChart.Layout.BoxTree.Node),rect=child.getState(),top=prevRowExterior.To+(row===0?this.ParentChildSpacing:this.SiblingSpacing);OrgChart.Layout.LayoutAlgorithm.MoveTo(child.getState(),rect.getLeft(),top);child.getState().BranchExterior=new OrgChart.Layout.Rect.$ctor1(child.getState().TopLeft,child.getState().Size);rowExterior=new OrgChart.Layout.Dimensions.$ctor1(top,top+rect.Size.Height);child=System.Array.getItem(node.getChildren(),row,OrgChart.Layout.BoxTree.Node);child.getState().SiblingsRowV=rowExterior;OrgChart.Layout.LayoutAlgorithm.VerticalLayout(state,child);childBranchBottom=child.getState().BranchExterior.getBottom();prevRowExterior=new OrgChart.Layout.Dimensions.$ctor1(rowExterior.From,Math.max(childBranchBottom,rowExterior.To))}},ApplyHorizontalLayout:function(state,level){var node=level.BranchRoot,nodeState=node.getState(),row,child,edges,rect,diff,desiredLeft,desiredRight,verticalSpacer,spacerTop,spacerBottom;for(node.getAssistantsRoot()!=null&&OrgChart.Layout.LayoutAlgorithm.HorizontalLayout(state,node.getAssistantsRoot()),row=0;row<nodeState.NumberOfSiblings;row=row+1|0)child=System.Array.getItem(node.getChildren(),row,OrgChart.Layout.BoxTree.Node),OrgChart.Layout.LayoutAlgorithm.HorizontalLayout(state,child);if(edges=OrgChart.Layout.LayoutAlgorithm.AlignHorizontalCenters(state,level,this.EnumerateColumn(node)),node.getLevel()>0&&node.getChildCount()>0){if(rect=node.getState(),this.ParentAlignment===OrgChart.Layout.BranchParentAlignment.Left)desiredLeft=rect.getCenterH()+this.ParentConnectorShield/2,diff=desiredLeft-edges.From;else if(this.ParentAlignment===OrgChart.Layout.BranchParentAlignment.Right)desiredRight=rect.getCenterH()-this.ParentConnectorShield/2,diff=desiredRight-edges.To;else throw new System.InvalidOperationException("Invalid ParentAlignment setting");OrgChart.Layout.LayoutAlgorithm.MoveChildrenOnly(state,level,diff);verticalSpacer=node.getLevel()>0?System.Array.getItem(node.getChildren(),node.getChildCount()-1|0,OrgChart.Layout.BoxTree.Node):null;verticalSpacer!=null&&(spacerTop=node.getState().getBottom(),spacerBottom=System.Array.getItem(node.getChildren(),node.getChildCount()-2|0,OrgChart.Layout.BoxTree.Node).getState().getBottom(),OrgChart.Layout.LayoutAlgorithm.AdjustSpacer(verticalSpacer.getState(),rect.getCenterH()-this.ParentConnectorShield/2,spacerTop,this.ParentConnectorShield,spacerBottom-spacerTop),state.MergeSpacer(verticalSpacer))}},EnumerateColumn:function(branchRoot){for(var $yield=[],i=0;i<branchRoot.getState().NumberOfSiblings;i=i+1|0)$yield.push(System.Array.getItem(branchRoot.getChildren(),i,OrgChart.Layout.BoxTree.Node));return System.Array.toEnumerable($yield)},RouteConnectors:function(state,node){var ix,rect,destination;if(node.getChildCount()!==0){var count=1+node.getState().NumberOfSiblings|0,segments=System.Array.init(count,function(){return new OrgChart.Layout.Edge}),rootRect=node.getState(),center=rootRect.getCenterH(),verticalCarrierHeight=System.Array.getItem(node.getChildren(),node.getState().NumberOfSiblings-1|0,OrgChart.Layout.BoxTree.Node).getState().getCenterV()-node.getState().getBottom();for(segments[0]=new OrgChart.Layout.Edge.$ctor1(new OrgChart.Layout.Point.$ctor1(center,rootRect.getBottom()),new OrgChart.Layout.Point.$ctor1(center,rootRect.getBottom()+verticalCarrierHeight)),ix=0;ix<node.getState().NumberOfSiblings;ix=ix+1|0)rect=System.Array.getItem(node.getChildren(),ix,OrgChart.Layout.BoxTree.Node).getState(),destination=this.ParentAlignment===OrgChart.Layout.BranchParentAlignment.Left?rect.getLeft():rect.getRight(),segments[1+ix|0]=new OrgChart.Layout.Edge.$ctor1(new OrgChart.Layout.Point.$ctor1(center,rect.getCenterV()),new OrgChart.Layout.Point.$ctor1(destination,rect.getCenterV()));node.getState().Connector=new OrgChart.Layout.Connector(segments)}}});Bridge.define("OrgChart.Layout.StackingLayoutStrategy",{inherits:[OrgChart.Layout.LayoutStrategyBase],Orientation:0,ctor:function(){this.$initialize();OrgChart.Layout.LayoutStrategyBase.ctor.call(this);this.Orientation=OrgChart.Layout.StackOrientation.SingleRowHorizontal;this.ParentAlignment=OrgChart.Layout.BranchParentAlignment.InvalidValue;this.ChildConnectorHookLength=0;this.ParentConnectorShield=0;this.SiblingSpacing=5},getSupportsAssistants:function(){return!1},PreProcessThisNode:function(state,node){if(node.getState().NumberOfSiblings=node.getElement().IsCollapsed?0:node.getChildCount(),node.getState().NumberOfSiblings>0&&this.Orientation!==OrgChart.Layout.StackOrientation.SingleRowHorizontal&&this.Orientation!==OrgChart.Layout.StackOrientation.SingleColumnVertical)throw new System.InvalidOperationException("Unsupported value for orientation: "+System.Enum.toString(OrgChart.Layout.StackOrientation,this.Orientation));},ApplyVerticalLayout:function(state,level){var node=level.BranchRoot,siblingsRowExterior,top,i,child,rect,i1,child1,prevRowExterior,row,rowExterior,childBranchBottom;if(node.getLevel()===0&&(node.getState().SiblingsRowV=new OrgChart.Layout.Dimensions.$ctor1(node.getState().getTop(),node.getState().getBottom())),node.getState().NumberOfSiblings!==0)if(siblingsRowExterior=OrgChart.Layout.Dimensions.MinMax(),this.Orientation===OrgChart.Layout.StackOrientation.SingleRowHorizontal){for(top=node.getAssistantsRoot()==null?node.getState().SiblingsRowV.To+this.ParentChildSpacing:node.getState().BranchExterior.getBottom()+this.ParentChildSpacing,i=0;i<node.getState().NumberOfSiblings;i=i+1|0)child=System.Array.getItem(node.getChildren(),i,OrgChart.Layout.BoxTree.Node),rect=child.getState(),OrgChart.Layout.LayoutAlgorithm.MoveTo(child.getState(),0,top),child.getState().BranchExterior=new OrgChart.Layout.Rect.$ctor1(child.getState().TopLeft,child.getState().Size),siblingsRowExterior=OrgChart.Layout.Dimensions.op_Addition(siblingsRowExterior,new OrgChart.Layout.Dimensions.$ctor1(top,top+rect.Size.Height));for(siblingsRowExterior=new OrgChart.Layout.Dimensions.$ctor1(siblingsRowExterior.From,siblingsRowExterior.To),i1=0;i1<node.getState().NumberOfSiblings;i1=i1+1|0)child1=System.Array.getItem(node.getChildren(),i1,OrgChart.Layout.BoxTree.Node),child1.getState().SiblingsRowV=siblingsRowExterior,OrgChart.Layout.LayoutAlgorithm.VerticalLayout(state,child1)}else if(this.Orientation===OrgChart.Layout.StackOrientation.SingleColumnVertical)for(prevRowExterior=new OrgChart.Layout.Dimensions.$ctor1(node.getState().SiblingsRowV.From,node.getState().SiblingsRowV.To),row=0;row<node.getState().NumberOfSiblings;row=row+1|0){var child2=System.Array.getItem(node.getChildren(),row,OrgChart.Layout.BoxTree.Node),rect1=child2.getState(),top1=prevRowExterior.To+(row===0?this.ParentChildSpacing:this.SiblingSpacing);OrgChart.Layout.LayoutAlgorithm.MoveTo(child2.getState(),rect1.getLeft(),top1);child2.getState().BranchExterior=new OrgChart.Layout.Rect.$ctor1(child2.getState().TopLeft,child2.getState().Size);rowExterior=new OrgChart.Layout.Dimensions.$ctor1(top1,top1+rect1.Size.Height);child2=System.Array.getItem(node.getChildren(),row,OrgChart.Layout.BoxTree.Node);child2.getState().SiblingsRowV=rowExterior;OrgChart.Layout.LayoutAlgorithm.VerticalLayout(state,child2);childBranchBottom=child2.getState().BranchExterior.getBottom();prevRowExterior=new OrgChart.Layout.Dimensions.$ctor1(rowExterior.From,Math.max(childBranchBottom,rowExterior.To))}},ApplyHorizontalLayout:function(state,level){for(var node=level.BranchRoot,child,width,$t=Bridge.getEnumerator(node.getChildren(),OrgChart.Layout.BoxTree.Node);$t.moveNext();)child=$t.getCurrent(),OrgChart.Layout.LayoutAlgorithm.HorizontalLayout(state,child);if(node.getChildCount()>0)if(this.Orientation===OrgChart.Layout.StackOrientation.SingleRowHorizontal){width=System.Array.getItem(node.getChildren(),node.getState().NumberOfSiblings-1|0,OrgChart.Layout.BoxTree.Node).getState().getRight()-System.Array.getItem(node.getChildren(),0,OrgChart.Layout.BoxTree.Node).getState().getLeft();node.getState().Size=new OrgChart.Layout.Size.$ctor1(Math.max(node.getState().Size.Width,width),node.getState().Size.Height);var center=(System.Array.getItem(node.getChildren(),0,OrgChart.Layout.BoxTree.Node).getState().getLeft()+System.Array.getItem(node.getChildren(),node.getChildCount()-1|0,OrgChart.Layout.BoxTree.Node).getState().getRight())/2,desiredCenter=node.getState().getCenterH(),diff=desiredCenter-center;OrgChart.Layout.LayoutAlgorithm.MoveChildrenOnly(state,level,diff)}else if(this.Orientation===OrgChart.Layout.StackOrientation.SingleColumnVertical){OrgChart.Layout.LayoutAlgorithm.AlignHorizontalCenters(state,level,node.getChildren());var center1=System.Array.getItem(node.getChildren(),0,OrgChart.Layout.BoxTree.Node).getState().getCenterH(),desiredCenter1=node.getState().getCenterH(),diff1=desiredCenter1-center1;OrgChart.Layout.LayoutAlgorithm.MoveChildrenOnly(state,level,diff1)}},RouteConnectors:function(){}});Bridge.define("OrgChart.Test.TestDataItem",{inherits:[OrgChart.Layout.IChartDataItem],config:{properties:{Id:null,IsAssistant:!1,ParentId:null,String1:null,String2:null,Date1:null},alias:["getId","OrgChart$Layout$IChartDataItem$getId","setId","OrgChart$Layout$IChartDataItem$setId","getIsAssistant","OrgChart$Layout$IChartDataItem$getIsAssistant","setIsAssistant","OrgChart$Layout$IChartDataItem$setIsAssistant"],init:function(){this.Date1=new Date(-864e13)}}});Bridge.define("OrgChart.Test.TestDataSource",{inherits:[OrgChart.Layout.IChartDataSource],Items:null,config:{alias:["getAllDataItemIds","OrgChart$Layout$IChartDataSource$getAllDataItemIds","getGetParentKeyFunc","OrgChart$Layout$IChartDataSource$getGetParentKeyFunc","getGetDataItemFunc","OrgChart$Layout$IChartDataSource$getGetDataItemFunc"],init:function(){this.Items=new(System.Collections.Generic.Dictionary$2(String,OrgChart.Test.TestDataItem))}},getAllDataItemIds:function(){return System.Linq.Enumerable.from(this.Items.getKeys()).orderBy($asm.$.OrgChart.Test.TestDataSource.f1)},getGetParentKeyFunc:function(){return Bridge.fn.bind(this,this.GetParentKey)},getGetDataItemFunc:function(){return Bridge.fn.bind(this,this.GetDataItem)},GetParentKey:function(itemId){return this.Items.get(itemId).getParentId()},GetDataItem:function(itemId){return this.Items.get(itemId)}});Bridge.ns("OrgChart.Test.TestDataSource",$asm.$);Bridge.apply($asm.$.OrgChart.Test.TestDataSource,{f1:function(x){return x}});Bridge.define("OrgChart.Layout.MultiLineFishboneLayoutStrategy",{inherits:[OrgChart.Layout.LinearLayoutStrategy],MaxGroups:4,getSupportsAssistants:function(){return!0},PreProcessThisNode:function(state,node){var parentSpacer,i,verticalSpacer,horizontalSpacer;if(this.MaxGroups<=0)throw new System.InvalidOperationException("MaxGroups must be a positive value");if(node.getChildCount()<=(this.MaxGroups*2|0)){OrgChart.Layout.LinearLayoutStrategy.prototype.PreProcessThisNode.call(this,state,node);return}if(node.getState().NumberOfSiblings=node.getChildCount(),node.getState().NumberOfSiblings>0){for(node.getState().NumberOfSiblingColumns=this.MaxGroups,node.getState().NumberOfSiblingRows=Bridge.Int.div(node.getState().NumberOfSiblings,this.MaxGroups*2|0)|0,node.getState().NumberOfSiblings%(this.MaxGroups*2|0)!=0&&(node.getState().NumberOfSiblingRows=node.getState().NumberOfSiblingRows+1|0),parentSpacer=OrgChart.Layout.Box.Special(OrgChart.Layout.Box.None,node.getElement().Id,!1),node.AddRegularChild(parentSpacer),i=0;i<node.getState().NumberOfSiblingColumns;i=i+1|0)verticalSpacer=OrgChart.Layout.Box.Special(OrgChart.Layout.Box.None,node.getElement().Id,!1),node.AddRegularChild(verticalSpacer);node.getState().NumberOfSiblingColumns>1&&(horizontalSpacer=OrgChart.Layout.Box.Special(OrgChart.Layout.Box.None,node.getElement().Id,!1),node.AddRegularChild(horizontalSpacer))}},ApplyVerticalLayout:function(state,level){var node=level.BranchRoot,adapter;if(node.getState().NumberOfSiblings<=(this.MaxGroups*2|0)){OrgChart.Layout.LinearLayoutStrategy.prototype.ApplyVerticalLayout.call(this,state,level);return}for(node.getLevel()===0&&(node.getState().SiblingsRowV=new OrgChart.Layout.Dimensions.$ctor1(node.getState().getTop(),node.getState().getBottom())),node.getAssistantsRoot()!=null&&(OrgChart.Layout.LayoutAlgorithm.CopyExteriorFrom(node.getAssistantsRoot().getState(),node.getState()),OrgChart.Layout.LayoutAlgorithm.VerticalLayout(state,node.getAssistantsRoot())),adapter=new OrgChart.Layout.MultiLineFishboneLayoutStrategy.SingleFishboneLayoutAdapter(node);adapter.NextGroup();)OrgChart.Layout.LayoutAlgorithm.VerticalLayout(state,adapter.SpecialRoot)},ApplyHorizontalLayout:function(state,level){var node=level.BranchRoot,adapter,rect,diff,carrier,desiredCenter1,ix,verticalSpacer;if(node.getState().NumberOfSiblings<=(this.MaxGroups*2|0)){OrgChart.Layout.LinearLayoutStrategy.prototype.ApplyHorizontalLayout.call(this,state,level);return}for(node.getLevel()===0&&(node.getState().SiblingsRowV=new OrgChart.Layout.Dimensions.$ctor1(node.getState().getTop(),node.getState().getBottom())),node.getAssistantsRoot()!=null&&OrgChart.Layout.LayoutAlgorithm.HorizontalLayout(state,node.getAssistantsRoot()),adapter=new OrgChart.Layout.MultiLineFishboneLayoutStrategy.SingleFishboneLayoutAdapter(node);adapter.NextGroup();)OrgChart.Layout.LayoutAlgorithm.HorizontalLayout(state,adapter.SpecialRoot);if(rect=node.getState(),node.getLevel()>0){if(node.getState().NumberOfSiblingColumns>1){var leftCarrier=System.Array.getItem(node.getChildren(),node.getState().NumberOfSiblings+1|0,OrgChart.Layout.BoxTree.Node).getState().getCenterH(),rightCarrier=System.Array.getItem(node.getChildren(),node.getState().NumberOfSiblings+node.getState().NumberOfSiblingColumns|0,OrgChart.Layout.BoxTree.Node).getState().getCenterH(),desiredCenter=node.getState().NumberOfSiblings===1||this.ParentAlignment===OrgChart.Layout.BranchParentAlignment.Center?leftCarrier+(rightCarrier-leftCarrier)/2:this.ParentAlignment===OrgChart.Layout.BranchParentAlignment.Left?leftCarrier+this.ChildConnectorHookLength:rightCarrier-this.ChildConnectorHookLength;diff=rect.getCenterH()-desiredCenter}else carrier=System.Array.getItem(node.getChildren(),1+node.getState().NumberOfSiblings|0,OrgChart.Layout.BoxTree.Node).getState().getCenterH(),desiredCenter1=rect.getCenterH(),diff=desiredCenter1-carrier;OrgChart.Layout.LayoutAlgorithm.MoveChildrenOnly(state,level,diff)}if(node.getLevel()>0&&(ix=node.getState().NumberOfSiblings,verticalSpacer=System.Array.getItem(node.getChildren(),ix,OrgChart.Layout.BoxTree.Node),OrgChart.Layout.LayoutAlgorithm.AdjustSpacer(verticalSpacer.getState(),rect.getCenterH()-this.ParentConnectorShield/2,rect.getBottom(),this.ParentConnectorShield,System.Array.getItem(node.getChildren(),0,OrgChart.Layout.BoxTree.Node).getState().SiblingsRowV.From-rect.getBottom()),state.MergeSpacer(verticalSpacer),ix=ix+1|0,ix=ix+node.getState().NumberOfSiblingColumns|0,node.getState().NumberOfSiblingColumns>1)){var horizontalSpacer=System.Array.getItem(node.getChildren(),ix,OrgChart.Layout.BoxTree.Node),leftmost=System.Array.getItem(node.getChildren(),node.getState().NumberOfSiblings+1|0,OrgChart.Layout.BoxTree.Node).getState().TopLeft,rightmost=System.Array.getItem(node.getChildren(),ix-1|0,OrgChart.Layout.BoxTree.Node).getState().getRight();OrgChart.Layout.LayoutAlgorithm.AdjustSpacer(horizontalSpacer.getState(),leftmost.X,leftmost.Y-this.ParentChildSpacing,rightmost-leftmost.X,this.ParentChildSpacing);state.MergeSpacer(horizontalSpacer)}},RouteConnectors:function(state,node){var count,iterator,i,to,y,leftGroup,rightGroup;if(node.getState().NumberOfSiblings<=(this.MaxGroups*2|0)){OrgChart.Layout.LinearLayoutStrategy.prototype.RouteConnectors.call(this,state,node);return}count=(1+node.getState().NumberOfSiblings|0)+node.getState().NumberOfSiblingColumns|0;node.getState().NumberOfSiblingColumns>1&&(count=count+1|0);var segments=System.Array.init(count,function(){return new OrgChart.Layout.Edge}),rootRect=node.getState(),center=rootRect.getCenterH(),ix=0,space=System.Array.getItem(node.getChildren(),0,OrgChart.Layout.BoxTree.Node).getState().SiblingsRowV.From-rootRect.getBottom();for(segments[Bridge.identity(ix,ix=ix+1|0)]=new OrgChart.Layout.Edge.$ctor1(new OrgChart.Layout.Point.$ctor1(center,rootRect.getBottom()),new OrgChart.Layout.Point.$ctor1(center,rootRect.getBottom()+space-this.ChildConnectorHookLength)),iterator=new OrgChart.Layout.MultiLineFishboneLayoutStrategy.SingleFishboneLayoutAdapter.GroupIterator(node.getState().NumberOfSiblings,node.getState().NumberOfSiblingColumns);iterator.NextGroup();){var carrier=System.Array.getItem(node.getChildren(),(1+node.getState().NumberOfSiblings|0)+iterator.Group|0,OrgChart.Layout.BoxTree.Node).getState(),from=carrier.getCenterH(),isLeft=!0,countOnThisSide=0;for(i=iterator.FromIndex;i<(iterator.FromIndex+iterator.Count|0);i=i+1|0)to=isLeft?System.Array.getItem(node.getChildren(),i,OrgChart.Layout.BoxTree.Node).getState().getRight():System.Array.getItem(node.getChildren(),i,OrgChart.Layout.BoxTree.Node).getState().getLeft(),y=System.Array.getItem(node.getChildren(),i,OrgChart.Layout.BoxTree.Node).getState().getCenterV(),segments[Bridge.identity(ix,ix=ix+1|0)]=new OrgChart.Layout.Edge.$ctor1(new OrgChart.Layout.Point.$ctor1(from,y),new OrgChart.Layout.Point.$ctor1(to,y)),(countOnThisSide=countOnThisSide+1|0)===iterator.MaxOnLeft&&(countOnThisSide=0,isLeft&&(segments[(1+node.getState().NumberOfSiblings|0)+iterator.Group|0]=new OrgChart.Layout.Edge.$ctor1(new OrgChart.Layout.Point.$ctor1(carrier.getCenterH(),carrier.getTop()-this.ChildConnectorHookLength),new OrgChart.Layout.Point.$ctor1(carrier.getCenterH(),System.Array.getItem(node.getChildren(),i,OrgChart.Layout.BoxTree.Node).getState().getCenterV()))),isLeft=!isLeft)}ix=ix+node.getState().NumberOfSiblingColumns|0;node.getState().NumberOfSiblingColumns>1&&(leftGroup=System.Array.getItem(node.getChildren(),1+node.getState().NumberOfSiblings|0,OrgChart.Layout.BoxTree.Node).getState(),rightGroup=System.Array.getItem(node.getChildren(),((1+node.getState().NumberOfSiblings|0)+node.getState().NumberOfSiblingColumns|0)-1|0,OrgChart.Layout.BoxTree.Node).getState(),segments[ix]=new OrgChart.Layout.Edge.$ctor1(new OrgChart.Layout.Point.$ctor1(leftGroup.getCenterH(),leftGroup.getTop()-this.ChildConnectorHookLength),new OrgChart.Layout.Point.$ctor1(rightGroup.getCenterH(),rightGroup.getTop()-this.ChildConnectorHookLength)));node.getState().Connector=new OrgChart.Layout.Connector(segments)}});Bridge.define("OrgChart.Layout.MultiLineHangerLayoutStrategy",{inherits:[OrgChart.Layout.LinearLayoutStrategy],MaxSiblingsPerRow:4,getSupportsAssistants:function(){return!0},PreProcessThisNode:function(state,node){var lastRowBoxCount,ix,siblingSpacer,verticalSpacer,i,horizontalSpacer;if(this.MaxSiblingsPerRow<=0||this.MaxSiblingsPerRow%2!=0)throw new System.InvalidOperationException("MaxSiblingsPerRow must be a positive even value");if(node.getChildCount()<=this.MaxSiblingsPerRow){OrgChart.Layout.LinearLayoutStrategy.prototype.PreProcessThisNode.call(this,state,node);return}if(node.getState().NumberOfSiblings=node.getChildCount(),node.getState().NumberOfSiblings>0){for(lastRowBoxCount=node.getChildCount()%this.MaxSiblingsPerRow,node.getState().NumberOfSiblingColumns=1+this.MaxSiblingsPerRow|0,node.getState().NumberOfSiblingRows=Bridge.Int.div(node.getChildCount(),this.MaxSiblingsPerRow)|0,lastRowBoxCount!==0&&(node.getState().NumberOfSiblingRows=node.getState().NumberOfSiblingRows+1|0),node.getState().NumberOfSiblings=node.getChildCount()+node.getState().NumberOfSiblingRows|0,lastRowBoxCount>0&&lastRowBoxCount<=(Bridge.Int.div(this.MaxSiblingsPerRow,2)|0)&&(node.getState().NumberOfSiblings=node.getState().NumberOfSiblings-1|0),ix=Bridge.Int.div(this.MaxSiblingsPerRow,2)|0;ix<node.getState().NumberOfSiblings;)siblingSpacer=OrgChart.Layout.Box.Special(OrgChart.Layout.Box.None,node.getElement().Id,!1),node.InsertRegularChild(ix,siblingSpacer),ix=ix+node.getState().NumberOfSiblingColumns|0;for(verticalSpacer=OrgChart.Layout.Box.Special(OrgChart.Layout.Box.None,node.getElement().Id,!1),node.AddRegularChild(verticalSpacer),i=0;i<node.getState().NumberOfSiblingRows;i=i+1|0)horizontalSpacer=OrgChart.Layout.Box.Special(OrgChart.Layout.Box.None,node.getElement().Id,!1),node.AddRegularChild(horizontalSpacer)}},ApplyVerticalLayout:function(state,level){var node=level.BranchRoot,prevRowExterior,row,i,child,rect,top,siblingsBottom,i1,child1,spacerIndex,spacerBottom,spacer;if(node.getState().NumberOfSiblings<=this.MaxSiblingsPerRow){OrgChart.Layout.LinearLayoutStrategy.prototype.ApplyVerticalLayout.call(this,state,level);return}for(node.getLevel()===0&&(node.getState().SiblingsRowV=new OrgChart.Layout.Dimensions.$ctor1(node.getState().getTop(),node.getState().getBottom())),node.getAssistantsRoot()!=null&&(OrgChart.Layout.LayoutAlgorithm.CopyExteriorFrom(node.getAssistantsRoot().getState(),node.getState()),OrgChart.Layout.LayoutAlgorithm.VerticalLayout(state,node.getAssistantsRoot())),prevRowExterior=new OrgChart.Layout.Dimensions.$ctor1(node.getState().SiblingsRowV.From,node.getAssistantsRoot()==null?node.getState().SiblingsRowV.To:node.getState().BranchExterior.getBottom()),row=0;row<node.getState().NumberOfSiblingRows;row=row+1|0){var siblingsRowExterior=OrgChart.Layout.Dimensions.MinMax(),spacing=row===0?this.ParentChildSpacing:this.SiblingSpacing,from=row*node.getState().NumberOfSiblingColumns|0,to=Math.min(from+node.getState().NumberOfSiblingColumns|0,node.getState().NumberOfSiblings);for(i=from;i<to;i=i+1|0)(child=System.Array.getItem(node.getChildren(),i,OrgChart.Layout.BoxTree.Node),child.getElement().IsSpecial)||(rect=child.getState(),top=prevRowExterior.To+spacing,OrgChart.Layout.LayoutAlgorithm.MoveTo(child.getState(),rect.getLeft(),top),child.getState().BranchExterior=new OrgChart.Layout.Rect.$ctor1(child.getState().TopLeft,child.getState().Size),siblingsRowExterior=OrgChart.Layout.Dimensions.op_Addition(siblingsRowExterior,new OrgChart.Layout.Dimensions.$ctor1(top,top+rect.Size.Height)));for(siblingsRowExterior=new OrgChart.Layout.Dimensions.$ctor1(siblingsRowExterior.From,siblingsRowExterior.To),siblingsBottom=System.Double.min,i1=from;i1<to;i1=i1+1|0)child1=System.Array.getItem(node.getChildren(),i1,OrgChart.Layout.BoxTree.Node),child1.getState().SiblingsRowV=siblingsRowExterior,OrgChart.Layout.LayoutAlgorithm.VerticalLayout(state,child1),siblingsBottom=Math.max(siblingsBottom,child1.getState().BranchExterior.getBottom());prevRowExterior=new OrgChart.Layout.Dimensions.$ctor1(siblingsRowExterior.From,Math.max(siblingsBottom,siblingsRowExterior.To));spacerIndex=from+(Bridge.Int.div(node.getState().NumberOfSiblingColumns,2)|0)|0;spacerIndex<node.getState().NumberOfSiblings&&(spacerBottom=row===(node.getState().NumberOfSiblingRows-1|0)?System.Array.getItem(node.getChildren(),spacerIndex-1|0,OrgChart.Layout.BoxTree.Node).getState().SiblingsRowV.To:prevRowExterior.To,spacer=System.Array.getItem(node.getChildren(),spacerIndex,OrgChart.Layout.BoxTree.Node).getState(),OrgChart.Layout.LayoutAlgorithm.AdjustSpacer(spacer,0,prevRowExterior.From,this.ParentConnectorShield,spacerBottom-prevRowExterior.From))}},ApplyHorizontalLayout:function(state,level){var node=level.BranchRoot,col,row,ix,child,verticalSpacer,spacing,firstInRowIndex;if(node.getState().NumberOfSiblings<=this.MaxSiblingsPerRow){OrgChart.Layout.LinearLayoutStrategy.prototype.ApplyHorizontalLayout.call(this,state,level);return}for(node.getAssistantsRoot()!=null&&OrgChart.Layout.LayoutAlgorithm.HorizontalLayout(state,node.getAssistantsRoot()),col=0;col<node.getState().NumberOfSiblingColumns;col=col+1|0){for(row=0;row<node.getState().NumberOfSiblingRows;row=row+1|0){if(ix=(row*node.getState().NumberOfSiblingColumns|0)+col|0,ix>=node.getState().NumberOfSiblings)break;child=System.Array.getItem(node.getChildren(),ix,OrgChart.Layout.BoxTree.Node);OrgChart.Layout.LayoutAlgorithm.HorizontalLayout(state,child)}OrgChart.Layout.LayoutAlgorithm.AlignHorizontalCenters(state,level,this.EnumerateColumn(node,col))}var rect=node.getState(),spacer=System.Array.getItem(node.getChildren(),Bridge.Int.div(node.getState().NumberOfSiblingColumns,2)|0,OrgChart.Layout.BoxTree.Node),desiredCenter=spacer.getState().getCenterH(),diff=rect.getCenterH()-desiredCenter;for(OrgChart.Layout.LayoutAlgorithm.MoveChildrenOnly(state,level,diff),verticalSpacer=System.Array.getItem(node.getChildren(),node.getState().NumberOfSiblings,OrgChart.Layout.BoxTree.Node),OrgChart.Layout.LayoutAlgorithm.AdjustSpacer(verticalSpacer.getState(),rect.getCenterH()-this.ParentConnectorShield/2,rect.getBottom(),this.ParentConnectorShield,System.Array.getItem(node.getChildren(),0,OrgChart.Layout.BoxTree.Node).getState().SiblingsRowV.From-rect.getBottom()),state.MergeSpacer(verticalSpacer),spacing=this.ParentChildSpacing,firstInRowIndex=0;firstInRowIndex<node.getState().NumberOfSiblings;firstInRowIndex=firstInRowIndex+node.getState().NumberOfSiblingColumns|0){var firstInRow=System.Array.getItem(node.getChildren(),firstInRowIndex,OrgChart.Layout.BoxTree.Node).getState(),lastInRow=System.Array.getItem(node.getChildren(),Math.min((firstInRowIndex+node.getState().NumberOfSiblingColumns|0)-1|0,node.getState().NumberOfSiblings-1|0),OrgChart.Layout.BoxTree.Node).getState(),horizontalSpacer=System.Array.getItem(node.getChildren(),(1+node.getState().NumberOfSiblings|0)+(Bridge.Int.div(firstInRowIndex,node.getState().NumberOfSiblingColumns)|0)|0,OrgChart.Layout.BoxTree.Node),width=lastInRow.getRight()>=verticalSpacer.getState().getRight()?lastInRow.getRight()-firstInRow.getLeft():verticalSpacer.getState().getRight()-firstInRow.getLeft();OrgChart.Layout.LayoutAlgorithm.AdjustSpacer(horizontalSpacer.getState(),firstInRow.getLeft(),firstInRow.SiblingsRowV.From-spacing,width,spacing);state.MergeSpacer(horizontalSpacer);spacing=this.SiblingSpacing}},EnumerateColumn:function(branchRoot,col){for(var ix,$yield=[],row=0;row<branchRoot.getState().NumberOfSiblingRows;row=row+1|0){if(ix=(row*branchRoot.getState().NumberOfSiblingColumns|0)+col|0,ix>=branchRoot.getState().NumberOfSiblings)break;$yield.push(System.Array.getItem(branchRoot.getChildren(),ix,OrgChart.Layout.BoxTree.Node))}return System.Array.toEnumerable($yield)},RouteConnectors:function(state,node){var $t,count,child,ix,i,child1,childRect,childCenter,lastChildHookIndex,firstInRowIndex,firstInRow,lastInRow;if(node.getState().NumberOfSiblings<=this.MaxSiblingsPerRow){OrgChart.Layout.LinearLayoutStrategy.prototype.RouteConnectors.call(this,state,node);return}for(count=1+node.getState().NumberOfSiblingRows|0,$t=Bridge.getEnumerator(node.getChildren(),OrgChart.Layout.BoxTree.Node);$t.moveNext();)child=$t.getCurrent(),child.getElement().IsSpecial||(count=count+1|0);var segments=System.Array.init(count,function(){return new OrgChart.Layout.Edge}),rootRect=node.getState(),center=rootRect.getCenterH(),verticalCarrierHeight=System.Array.getItem(node.getChildren(),node.getState().NumberOfSiblings-1|0,OrgChart.Layout.BoxTree.Node).getState().SiblingsRowV.From-this.ChildConnectorHookLength-rootRect.getBottom();for(segments[0]=new OrgChart.Layout.Edge.$ctor1(new OrgChart.Layout.Point.$ctor1(center,rootRect.getBottom()),new OrgChart.Layout.Point.$ctor1(center,rootRect.getBottom()+verticalCarrierHeight)),ix=1,i=0;i<node.getState().NumberOfSiblings;i=i+1|0)child1=System.Array.getItem(node.getChildren(),i,OrgChart.Layout.BoxTree.Node),child1.getElement().IsSpecial||(childRect=child1.getState(),childCenter=childRect.getCenterH(),segments[Bridge.identity(ix,ix=ix+1|0)]=new OrgChart.Layout.Edge.$ctor1(new OrgChart.Layout.Point.$ctor1(childCenter,childRect.getTop()),new OrgChart.Layout.Point.$ctor1(childCenter,childRect.getTop()-this.ChildConnectorHookLength)));for(lastChildHookIndex=(count-node.getState().NumberOfSiblingRows|0)-1|0,firstInRowIndex=1;firstInRowIndex<(count-node.getState().NumberOfSiblingRows|0);firstInRowIndex=firstInRowIndex+this.MaxSiblingsPerRow|0)firstInRow=segments[firstInRowIndex],lastInRow=segments[Math.min((firstInRowIndex+this.MaxSiblingsPerRow|0)-1|0,lastChildHookIndex)],segments[Bridge.identity(ix,ix=ix+1|0)]=lastInRow.From.X<segments[0].From.X?new OrgChart.Layout.Edge.$ctor1(new OrgChart.Layout.Point.$ctor1(firstInRow.To.X,firstInRow.To.Y),new OrgChart.Layout.Point.$ctor1(segments[0].To.X,firstInRow.To.Y)):new OrgChart.Layout.Edge.$ctor1(new OrgChart.Layout.Point.$ctor1(firstInRow.To.X,firstInRow.To.Y),new OrgChart.Layout.Point.$ctor1(lastInRow.To.X,firstInRow.To.Y));node.getState().Connector=new OrgChart.Layout.Connector(segments)}});var $m=Bridge.setMetadata,$n=[OrgChart.Layout,System,System.Collections.Generic,OrgChart.Annotations,OrgChart.Test];$m($n[3].ContractAnnotationAttribute,function(){return{m:[{at:[new OrgChart.Annotations.NotNullAttribute],a:2,n:"Contract",t:16,rt:String,g:{a:2,n:"get_Contract",t:8,sn:"getContract",rt:String},s:{a:1,n:"set_Contract",t:8,pi:[{n:"value",pt:String,ps:0}],sn:"setContract",rt:Object,p:[String]}}],am:!0}});$m($n[0].Boundary.Step,function(){return{at:[new System.Diagnostics.DebuggerDisplayAttribute("{X}, {Top} - {Bottom}, {Node.Element.Id}")],m:[{at:[new OrgChart.Annotations.NotNullAttribute],a:2,n:"Node",t:4,rt:$n[0].BoxTree.Node,sn:"Node",ro:!0}]}});$m($n[0].Box,function(){return{at:[new System.Diagnostics.DebuggerDisplayAttribute("{Id}, Size.Width}x{Size.Height}")],m:[{at:[new OrgChart.Annotations.NotNullAttribute],a:2,n:"Special",is:!0,t:8,pi:[{n:"id",pt:$n[1].Int32,ps:0},{n:"visualParentId",pt:$n[1].Int32,ps:1},{n:"disableCollisionDetection",pt:Boolean,ps:2}],sn:"Special",rt:$n[0].Box,p:[$n[1].Int32,$n[1].Int32,Boolean]},{at:[new OrgChart.Annotations.CanBeNullAttribute],a:2,n:"AssistantLayoutStrategyId",t:4,rt:String,sn:"AssistantLayoutStrategyId"},{at:[new OrgChart.Annotations.CanBeNullAttribute],a:2,n:"DataId",t:4,rt:String,sn:"DataId",ro:!0},{at:[new OrgChart.Annotations.CanBeNullAttribute],a:2,n:"LayoutStrategyId",t:4,rt:String,sn:"LayoutStrategyId"}]}});$m($n[0].BoxContainer,function(){return{m:[{at:[new OrgChart.Annotations.CanBeNullAttribute],a:2,n:"SystemRoot",t:16,rt:$n[0].Box,g:{a:2,n:"get_SystemRoot",t:8,sn:"getSystemRoot",rt:$n[0].Box},s:{a:2,n:"set_SystemRoot",t:8,pi:[{n:"value",pt:$n[0].Box,ps:0}],sn:"setSystemRoot",rt:Object,p:[$n[0].Box]}}]}});$m($n[0].BoxTree.Node,function(){return{m:[{at:[new OrgChart.Annotations.CanBeNullAttribute],a:2,n:"AssistantsRoot",t:16,rt:$n[0].BoxTree.Node,g:{a:2,n:"get_AssistantsRoot",t:8,sn:"getAssistantsRoot",rt:$n[0].BoxTree.Node},s:{a:3,n:"set_AssistantsRoot",t:8,pi:[{n:"value",pt:$n[0].BoxTree.Node,ps:0}],sn:"setAssistantsRoot",rt:Object,p:[$n[0].BoxTree.Node]}},{at:[new OrgChart.Annotations.CanBeNullAttribute],a:2,n:"Children",t:16,rt:$n[2].IList$1(OrgChart.Layout.BoxTree.Node),g:{a:2,n:"get_Children",t:8,sn:"getChildren",rt:$n[2].IList$1(OrgChart.Layout.BoxTree.Node)},s:{a:3,n:"set_Children",t:8,pi:[{n:"value",pt:$n[2].IList$1(OrgChart.Layout.BoxTree.Node),ps:0}],sn:"setChildren",rt:Object,p:[$n[2].IList$1(OrgChart.Layout.BoxTree.Node)]}},{at:[new OrgChart.Annotations.NotNullAttribute],a:2,n:"Element",t:16,rt:$n[0].Box,g:{a:2,n:"get_Element",t:8,sn:"getElement",rt:$n[0].Box},s:{a:1,n:"set_Element",t:8,pi:[{n:"value",pt:$n[0].Box,ps:0}],sn:"setElement",rt:Object,p:[$n[0].Box]}},{at:[new OrgChart.Annotations.CanBeNullAttribute],a:2,n:"ParentNode",t:16,rt:$n[0].BoxTree.Node,g:{a:2,n:"get_ParentNode",t:8,sn:"getParentNode",rt:$n[0].BoxTree.Node},s:{a:2,n:"set_ParentNode",t:8,pi:[{n:"value",pt:$n[0].BoxTree.Node,ps:0}],sn:"setParentNode",rt:Object,p:[$n[0].BoxTree.Node]}},{at:[new OrgChart.Annotations.NotNullAttribute],a:2,n:"State",t:16,rt:$n[0].NodeLayoutInfo,g:{a:2,n:"get_State",t:8,sn:"getState",rt:$n[0].NodeLayoutInfo},s:{a:1,n:"set_State",t:8,pi:[{n:"value",pt:$n[0].NodeLayoutInfo,ps:0}],sn:"setState",rt:Object,p:[$n[0].NodeLayoutInfo]}}]}});$m($n[0].Connector,function(){return{m:[{at:[new OrgChart.Annotations.NotNullAttribute],a:2,n:"Segments",t:16,rt:Array,g:{a:2,n:"get_Segments",t:8,sn:"getSegments",rt:Array},s:{a:1,n:"set_Segments",t:8,pi:[{n:"value",pt:Array,ps:0}],sn:"setSegments",rt:Object,p:[Array]}}]}});$m($n[0].Diagram,function(){return{m:[{at:[new OrgChart.Annotations.CanBeNullAttribute],a:2,n:"VisualTree",t:16,rt:$n[0].BoxTree,g:{a:2,n:"get_VisualTree",t:8,sn:"getVisualTree",rt:$n[0].BoxTree},s:{a:2,n:"set_VisualTree",t:8,pi:[{n:"value",pt:$n[0].BoxTree,ps:0}],sn:"setVisualTree",rt:Object,p:[$n[0].BoxTree]}}]}});$m($n[0].DiagramLayoutSettings,function(){return{m:[{at:[new OrgChart.Annotations.CanBeNullAttribute],a:2,n:"DefaultAssistantLayoutStrategyId",t:16,rt:String,g:{a:2,n:"get_DefaultAssistantLayoutStrategyId",t:8,sn:"getDefaultAssistantLayoutStrategyId",rt:String},s:{a:2,n:"set_DefaultAssistantLayoutStrategyId",t:8,pi:[{n:"value",pt:String,ps:0}],sn:"setDefaultAssistantLayoutStrategyId",rt:Object,p:[String]}},{at:[new OrgChart.Annotations.CanBeNullAttribute],a:2,n:"DefaultLayoutStrategyId",t:16,rt:String,g:{a:2,n:"get_DefaultLayoutStrategyId",t:8,sn:"getDefaultLayoutStrategyId",rt:String},s:{a:2,n:"set_DefaultLayoutStrategyId",t:8,pi:[{n:"value",pt:String,ps:0}],sn:"setDefaultLayoutStrategyId",rt:Object,p:[String]}},{at:[new OrgChart.Annotations.NotNullAttribute],a:2,n:"LayoutStrategies",t:16,rt:$n[2].Dictionary$2(String,OrgChart.Layout.LayoutStrategyBase),g:{a:2,n:"get_LayoutStrategies",t:8,sn:"getLayoutStrategies",rt:$n[2].Dictionary$2(String,OrgChart.Layout.LayoutStrategyBase)},s:{a:1,n:"set_LayoutStrategies",t:8,pi:[{n:"value",pt:$n[2].Dictionary$2(String,OrgChart.Layout.LayoutStrategyBase),ps:0}],sn:"setLayoutStrategies",rt:Object,p:[$n[2].Dictionary$2(String,OrgChart.Layout.LayoutStrategyBase)]}}]}});$m($n[0].Frame1,function(){return{at:[new System.Diagnostics.DebuggerDisplayAttribute("{Exterior.Left}:{Exterior.Top}, {Exterior.Size.Width}x{Exterior.Size.Height}")],m:[{at:[new OrgChart.Annotations.CanBeNullAttribute],a:2,n:"Connector",t:4,rt:$n[0].Connector,sn:"Connector"}]}});$m($n[0].IChartDataSource,function(){return{m:[{at:[new OrgChart.Annotations.NotNullAttribute],ab:!0,a:2,n:"AllDataItemIds",t:16,rt:$n[2].IEnumerable$1(String),g:{ab:!0,a:2,n:"get_AllDataItemIds",t:8,sn:"OrgChart$Layout$IChartDataSource$getAllDataItemIds",rt:$n[2].IEnumerable$1(String)},s:{ab:!0,a:1,n:"set_AllDataItemIds",t:8,pi:[{n:"value",pt:$n[2].IEnumerable$1(String),ps:0}],sn:"OrgChart$Layout$IChartDataSource$setAllDataItemIds",rt:Object,p:[$n[2].IEnumerable$1(String)]}},{at:[new OrgChart.Annotations.NotNullAttribute],ab:!0,a:2,n:"GetDataItemFunc",t:16,rt:Function,g:{ab:!0,a:2,n:"get_GetDataItemFunc",t:8,sn:"OrgChart$Layout$IChartDataSource$getGetDataItemFunc",rt:Function},s:{ab:!0,a:1,n:"set_GetDataItemFunc",t:8,pi:[{n:"value",pt:Function,ps:0}],sn:"OrgChart$Layout$IChartDataSource$setGetDataItemFunc",rt:Object,p:[Function]}},{at:[new OrgChart.Annotations.NotNullAttribute],ab:!0,a:2,n:"GetParentKeyFunc",t:16,rt:Function,g:{ab:!0,a:2,n:"get_GetParentKeyFunc",t:8,sn:"OrgChart$Layout$IChartDataSource$getGetParentKeyFunc",rt:Function},s:{ab:!0,a:1,n:"set_GetParentKeyFunc",t:8,pi:[{n:"value",pt:Function,ps:0}],sn:"OrgChart$Layout$IChartDataSource$setGetParentKeyFunc",rt:Object,p:[Function]}}]}});$m($n[0].LayoutState,function(){return{m:[{at:[new OrgChart.Annotations.CanBeNullAttribute],a:2,n:"BoxSizeFunc",t:16,rt:Function,g:{a:2,n:"get_BoxSizeFunc",t:8,sn:"getBoxSizeFunc",rt:Function},s:{a:2,n:"set_BoxSizeFunc",t:8,pi:[{n:"value",pt:Function,ps:0}],sn:"setBoxSizeFunc",rt:Object,p:[Function]}},{at:[new OrgChart.Annotations.NotNullAttribute],a:2,n:"Diagram",t:16,rt:$n[0].Diagram,g:{a:2,n:"get_Diagram",t:8,sn:"getDiagram",rt:$n[0].Diagram},s:{a:1,n:"set_Diagram",t:8,pi:[{n:"value",pt:$n[0].Diagram,ps:0}],sn:"setDiagram",rt:Object,p:[$n[0].Diagram]}},{at:[new OrgChart.Annotations.CanBeNullAttribute],a:2,n:"LayoutOptimizerFunc",t:16,rt:Function,g:{a:2,n:"get_LayoutOptimizerFunc",t:8,sn:"getLayoutOptimizerFunc",rt:Function},s:{a:2,n:"set_LayoutOptimizerFunc",t:8,pi:[{n:"value",pt:Function,ps:0}],sn:"setLayoutOptimizerFunc",rt:Object,p:[Function]}},{at:[new OrgChart.Annotations.NotNullAttribute],a:1,n:"m_layoutStack",t:4,rt:$n[2].Stack$1(OrgChart.Layout.LayoutState.LayoutLevel),sn:"m_layoutStack",ro:!0},{at:[new OrgChart.Annotations.NotNullAttribute],a:1,n:"m_pooledBoundaries",t:4,rt:$n[2].Stack$1(OrgChart.Layout.Boundary),sn:"m_pooledBoundaries",ro:!0},{at:[new OrgChart.Annotations.CanBeNullAttribute],a:2,n:"BoundaryChanged",t:2,ad:{a:2,n:"add_BoundaryChanged",t:8,pi:[{n:"value",pt:Function,ps:0}],sn:"addBoundaryChanged",rt:Object,p:[Function]},r:{a:2,n:"remove_BoundaryChanged",t:8,pi:[{n:"value",pt:Function,ps:0}],sn:"removeBoundaryChanged",rt:Object,p:[Function]}},{at:[new OrgChart.Annotations.CanBeNullAttribute],a:2,n:"OperationChanged",t:2,ad:{a:2,n:"add_OperationChanged",t:8,pi:[{n:"value",pt:Function,ps:0}],sn:"addOperationChanged",rt:Object,p:[Function]},r:{a:2,n:"remove_OperationChanged",t:8,pi:[{n:"value",pt:Function,ps:0}],sn:"removeOperationChanged",rt:Object,p:[Function]}}]}});$m($n[0].LayoutState.LayoutLevel,function(){return{at:[new System.Diagnostics.DebuggerDisplayAttribute("{BranchRoot.Element.Id}, {Boundary.BoundingRect.Top}..{Boundary.BoundingRect.Bottom}")]}});$m($n[0].NodeLayoutInfo,function(){return{m:[{at:[new OrgChart.Annotations.NotNullAttribute],a:2,n:"RequireLayoutStrategy",t:8,sn:"RequireLayoutStrategy",rt:$n[0].LayoutStrategyBase},{at:[new OrgChart.Annotations.CanBeNullAttribute],a:2,n:"Connector",t:4,rt:$n[0].Connector,sn:"Connector"}]}});$m($n[0].Rect,function(){return{at:[new System.Diagnostics.DebuggerDisplayAttribute("{TopLeft.X}:{TopLeft.Y}, {Size.Width}x{Size.Height}")]}});$m($n[4].TestDataItem,function(){return{m:[{at:[new OrgChart.Annotations.NotNullAttribute],a:2,n:"Id",t:16,rt:String,g:{a:2,n:"get_Id",t:8,sn:"getId",rt:String},s:{a:2,n:"set_Id",t:8,pi:[{n:"value",pt:String,ps:0}],sn:"setId",rt:Object,p:[String]}},{at:[new OrgChart.Annotations.CanBeNullAttribute],a:2,n:"ParentId",t:16,rt:String,g:{a:2,n:"get_ParentId",t:8,sn:"getParentId",rt:String},s:{a:2,n:"set_ParentId",t:8,pi:[{n:"value",pt:String,ps:0}],sn:"setParentId",rt:Object,p:[String]}},{at:[new OrgChart.Annotations.CanBeNullAttribute],a:2,n:"String1",t:16,rt:String,g:{a:2,n:"get_String1",t:8,sn:"getString1",rt:String},s:{a:2,n:"set_String1",t:8,pi:[{n:"value",pt:String,ps:0}],sn:"setString1",rt:Object,p:[String]}},{at:[new OrgChart.Annotations.CanBeNullAttribute],a:2,n:"String2",t:16,rt:String,g:{a:2,n:"get_String2",t:8,sn:"getString2",rt:String},s:{a:2,n:"set_String2",t:8,pi:[{n:"value",pt:String,ps:0}],sn:"setString2",rt:Object,p:[String]}}]}})});
11function mxOrgChartLayout(b,a,g,d){mxGraphLayout.call(this,b);this.correctY=!1;switch(parseInt(a)){case 0:this.branchOptimizer=mxOrgChartLayout.prototype.BRANCH_OPT_LINEAR;this.correctY=!0;break;case 1:this.branchOptimizer=mxOrgChartLayout.prototype.BRANCH_OPT_HANGER2;this.correctY=!0;break;case 3:this.branchOptimizer=mxOrgChartLayout.prototype.BRANCH_OPT_FISHBONE1;break;case 4:this.branchOptimizer=mxOrgChartLayout.prototype.BRANCH_OPT_FISHBONE2;break;case 5:this.branchOptimizer=mxOrgChartLayout.prototype.BRANCH_OPT_1COLUMN_L;
12break;case 6:this.branchOptimizer=mxOrgChartLayout.prototype.BRANCH_OPT_1COLUMN_R;break;case 7:this.branchOptimizer=mxOrgChartLayout.prototype.BRANCH_OPT_SMART;break;default:this.branchOptimizer=mxOrgChartLayout.prototype.BRANCH_OPT_HANGER4,this.correctY=!0}this.parentChildSpacing=0<g?g:20;this.siblingSpacing=0<d?d:20}mxOrgChartLayout.prototype=new mxGraphLayout;mxOrgChartLayout.prototype.constructor=mxOrgChartLayout;mxOrgChartLayout.prototype.BRANCH_OPT_LINEAR="branchOptimizerAllLinear";
13mxOrgChartLayout.prototype.BRANCH_OPT_HANGER2="branchOptimizerAllHanger2";mxOrgChartLayout.prototype.BRANCH_OPT_HANGER4="branchOptimizerAllHanger4";mxOrgChartLayout.prototype.BRANCH_OPT_FISHBONE1="branchOptimizerAllFishbone1";mxOrgChartLayout.prototype.BRANCH_OPT_FISHBONE2="branchOptimizerAllFishbone2";mxOrgChartLayout.prototype.BRANCH_OPT_1COLUMN_L="branchOptimizerAllSingleColumnLeft";mxOrgChartLayout.prototype.BRANCH_OPT_1COLUMN_R="branchOptimizerAllSingleColumnRight";
14mxOrgChartLayout.prototype.BRANCH_OPT_SMART="branchOptimizerSmart";mxOrgChartLayout.prototype.execute=function(b){this.graph.model.beginUpdate();try{RPOrgChart.main(this.graph,b,this.branchOptimizer,this.parentChildSpacing,this.siblingSpacing,this.correctY)}finally{this.graph.model.endUpdate()}};
15Bridge.define("RPOrgChart",{statics:{config:{init:function(){}},main:function(b,a,g,d,u,r){Bridge.Console.log=console.log;Bridge.Console.error=console.error;Bridge.Console.debug=console.debug;RPOrgChart.graph=b;RPOrgChart.parent=a;RPOrgChart.dx=0;RPOrgChart.dy=0;"group"==a.style&&a.geometry&&(RPOrgChart.dx=a.geometry.x,RPOrgChart.dy=a.geometry.y);RPOrgChart.branchOptimizer=g;RPOrgChart.correctY=r;RPOrgChart.parentChildSpacing=parseInt(d);RPOrgChart.siblingSpacing=parseInt(u);RPOrgChart.buildChart(!0)},
16diagram:{},dataSource:{},buildChart:function(b){b&&RPOrgChart.initDiagram();RPOrgChart.positionBoxes()},collapseAllBoxes:function(b,a){for(var g=b.getBoxesById().getValues().getEnumerator();g.moveNext();){var d=g.getCurrent();d.IsSpecial||(d.IsCollapsed=a)}},generateData:function(){for(var b=new OrgChart.Test.TestDataSource,a=RPOrgChart.graph,g=a.getChildVertices(RPOrgChart.parent),d=0;d<g.length;d++){var u=g[d];if(null!=u.geometry&&u.vertex&&u.parent==RPOrgChart.parent){var r=null,p=a.getIncomingEdges(u)[0];
17null!=p&&null!=p.source&&(r=p.source.id);p=new OrgChart.Test.TestDataItem;p.Id=u.id;p.ParentId=r;b.Items.add(p.getId(),p)}}return b},initDiagram:function(){var b=RPOrgChart.generateData();RPOrgChart.dataSource=b;var a=new OrgChart.Layout.BoxContainer.$ctor1(b);RPOrgChart.diagram=new OrgChart.Layout.Diagram;b=RPOrgChart.diagram;b.setBoxes(a);a=new OrgChart.Layout.LinearLayoutStrategy;a.ParentAlignment=OrgChart.Layout.BranchParentAlignment.Center;a.ParentChildSpacing=RPOrgChart.parentChildSpacing;a.SiblingSpacing=
18RPOrgChart.siblingSpacing;b.LayoutSettings.LayoutStrategies.add("linear",a);a=new OrgChart.Layout.MultiLineHangerLayoutStrategy;a.ParentAlignment=OrgChart.Layout.BranchParentAlignment.Center;a.MaxSiblingsPerRow=2;a.ParentChildSpacing=RPOrgChart.parentChildSpacing;a.SiblingSpacing=RPOrgChart.siblingSpacing;b.LayoutSettings.LayoutStrategies.add("hanger2",a);a=new OrgChart.Layout.MultiLineHangerLayoutStrategy;a.ParentAlignment=OrgChart.Layout.BranchParentAlignment.Center;a.MaxSiblingsPerRow=4;a.ParentChildSpacing=
19RPOrgChart.parentChildSpacing;a.SiblingSpacing=RPOrgChart.siblingSpacing;b.LayoutSettings.LayoutStrategies.add("hanger4",a);a=new OrgChart.Layout.SingleColumnLayoutStrategy;a.ParentAlignment=OrgChart.Layout.BranchParentAlignment.Right;a.ParentChildSpacing=RPOrgChart.parentChildSpacing;a.SiblingSpacing=RPOrgChart.siblingSpacing;b.LayoutSettings.LayoutStrategies.add("singleColumnRight",a);a=new OrgChart.Layout.SingleColumnLayoutStrategy;a.ParentAlignment=OrgChart.Layout.BranchParentAlignment.Left;a.ParentChildSpacing=
20RPOrgChart.parentChildSpacing;a.SiblingSpacing=RPOrgChart.siblingSpacing;b.LayoutSettings.LayoutStrategies.add("singleColumnLeft",a);a=new OrgChart.Layout.MultiLineFishboneLayoutStrategy;a.ParentAlignment=OrgChart.Layout.BranchParentAlignment.Center;a.MaxGroups=1;a.ParentChildSpacing=RPOrgChart.parentChildSpacing;a.SiblingSpacing=RPOrgChart.siblingSpacing;b.LayoutSettings.LayoutStrategies.add("fishbone1",a);a=new OrgChart.Layout.MultiLineFishboneLayoutStrategy;a.ParentAlignment=OrgChart.Layout.BranchParentAlignment.Center;
21a.MaxGroups=2;a.ParentChildSpacing=RPOrgChart.parentChildSpacing;a.SiblingSpacing=RPOrgChart.siblingSpacing;b.LayoutSettings.LayoutStrategies.add("fishbone2",a);a=new OrgChart.Layout.StackingLayoutStrategy;a.ParentAlignment=OrgChart.Layout.BranchParentAlignment.InvalidValue;a.Orientation=OrgChart.Layout.StackOrientation.SingleRowHorizontal;a.ParentChildSpacing=RPOrgChart.parentChildSpacing;a.SiblingSpacing=RPOrgChart.siblingSpacing;b.LayoutSettings.LayoutStrategies.add("hstack",a);a=new OrgChart.Layout.StackingLayoutStrategy;
22a.ParentAlignment=OrgChart.Layout.BranchParentAlignment.InvalidValue;a.Orientation=OrgChart.Layout.StackOrientation.SingleColumnVertical;a.ParentChildSpacing=RPOrgChart.parentChildSpacing;a.SiblingSpacing=RPOrgChart.siblingSpacing;b.LayoutSettings.LayoutStrategies.add("vstack",a);a=new OrgChart.Layout.StackingLayoutStrategy;a.ParentAlignment=OrgChart.Layout.BranchParentAlignment.InvalidValue;a.Orientation=OrgChart.Layout.StackOrientation.SingleColumnVertical;a.ParentChildSpacing=RPOrgChart.parentChildSpacing;
23a.SiblingSpacing=RPOrgChart.siblingSpacing;b.LayoutSettings.LayoutStrategies.add("vstackMiddle",a);a=new OrgChart.Layout.StackingLayoutStrategy;a.ParentAlignment=OrgChart.Layout.BranchParentAlignment.InvalidValue;a.Orientation=OrgChart.Layout.StackOrientation.SingleColumnVertical;a.ParentChildSpacing=RPOrgChart.parentChildSpacing;a.SiblingSpacing=RPOrgChart.siblingSpacing;b.LayoutSettings.LayoutStrategies.add("vstackTop",a);a=new OrgChart.Layout.FishboneAssistantsLayoutStrategy;a.ParentAlignment=
24OrgChart.Layout.BranchParentAlignment.Center;a.ParentChildSpacing=RPOrgChart.parentChildSpacing;a.SiblingSpacing=RPOrgChart.siblingSpacing;b.LayoutSettings.LayoutStrategies.add("assistants",a);b.LayoutSettings.DefaultLayoutStrategyId="vstack";b.LayoutSettings.DefaultAssistantLayoutStrategyId="assistants"},getBoxLevel:function(b,a){for(var g=0,d={};0<a.ParentId&&b.getBoxesById().tryGetValue(a.ParentId,d);)a=d.v,g++;return g},onLayoutStateChanged:function(b,a){a.State.getCurrentOperation()===OrgChart.Layout.LayoutState.Operation.PreprocessVisualTree&&
25RPOrgChart.renderBoxes()},renderBoxes:function(){RPOrgChart.diagram.getVisualTree().IterateParentFirst(function(b){var a=b.Element;if(a.getIsDataBound()){if(b.State.IsHidden)return!0;a.Size=RPOrgChart.getBoxElementSize(a.DataId)}return!0})},getBranchOptimizerFunc:function(){return RPOrgChart[RPOrgChart.branchOptimizer]},branchOptimizerAllLinear:function(b){return b.getIsAssistantRoot()?null:"linear"},branchOptimizerAllHanger2:function(b){return b.getIsAssistantRoot()?null:"hanger2"},branchOptimizerAllHanger4:function(b){return b.getIsAssistantRoot()?
26null:"hanger4"},branchOptimizerAllFishbone1:function(b){return b.getIsAssistantRoot()?null:"fishbone1"},branchOptimizerAllFishbone2:function(b){return b.getIsAssistantRoot()?null:"fishbone2"},branchOptimizerAllSingleColumnLeft:function(b){return b.getIsAssistantRoot()?null:"singleColumnRight"},branchOptimizerAllSingleColumnRight:function(b){return b.getIsAssistantRoot()?null:"singleColumnLeft"},branchOptimizerStackers:function(b){return b.getIsAssistantRoot()?null:0===b.Level?"vstackTop":1===b.Level?
27"vstackMiddle":"hstack"},branchOptimizerSmart:function(b){if(b.getIsAssistantRoot())return null;var a=b.getChildCount();if(1>=a)return"vstack";for(var g=0,d=0;d<a;d++)0<b.Children.getItem(d).getChildCount()&&g++;return 1>=g?4>=a?"vstack":8>=a?"fishbone1":"fishbone2":"hanger4"},boxSizeFunc:function(b){b=RPOrgChart.diagram.getBoxes().getBoxesByDataId().getItem(b).Id;return RPOrgChart.diagram.getBoxes().getBoxesById().getItem(b).Size},getBoxElementSize:function(b){b=RPOrgChart.graph.model.cells[b].geometry;
28return new OrgChart.Layout.Size.$ctor1(b.width,b.height)},positionBoxes:function(){var b=RPOrgChart.diagram,a=new OrgChart.Layout.LayoutState(b);a.addOperationChanged(RPOrgChart.onLayoutStateChanged);a.BoxSizeFunc=Bridge.fn.bind(this,RPOrgChart.boxSizeFunc,null,!0);a.LayoutOptimizerFunc=Bridge.fn.bind(this,RPOrgChart.getBranchOptimizerFunc(),null,!0);OrgChart.Layout.LayoutAlgorithm.Apply(a);var a=OrgChart.Layout.LayoutAlgorithm.ComputeBranchVisualBoundingRect(b.getVisualTree()),g=-a.getLeft()+a.getTop(),
29d=RPOrgChart.graph,u=d.model.cells,r=[];b.getVisualTree().IterateParentFirst(function(a){if(a.State.IsHidden)return!1;var b=a.Element;if(b.getIsDataBound()){var b=u[b.DataId],p=b.geometry.clone();p.x=a.State.TopLeft.X+g;p.y=a.State.TopLeft.Y;d.model.setGeometry(b,p)}return!0});b.getVisualTree().IterateParentFirst(function(a){var b=RPOrgChart.correctY?Math.min(0,-(RPOrgChart.parentChildSpacing/2)+5):0;if(null!=a.State.Connector){for(var p=function(a,c){for(var f=a.geometry.clone(),e=0;c&&e<c.length;e++)c[e].corrected||
30(c[e].y+=b,c[e].corrected=!0);f.points=c;d.model.setGeometry(a,f);d.setCellStyles("entryX",null,[a]);d.setCellStyles("entryY",null,[a]);d.setCellStyles("exitX",null,[a]);d.setCellStyles("exitY",null,[a]);d.setCellStyles("edgeStyle","orthogonalEdgeStyle",[a])},C=function(a,b){return b.x>=a.x&&b.x<=a.x+a.width&&b.y>=a.y&&b.y<=a.y+a.height},k=u[a.Element.DataId],h=d.getOutgoingEdges(k),h={},n=0;n<a.State.Connector.Segments.length;n++){var c=a.State.Connector.Segments[n];c.mark=1<<n;c.From.X+=g;c.To.X+=
31g;var l=c.From.X,q=c.From.Y,w=c.To.X,x=c.To.Y;if(l==w&&q>x||q==x&&l>w){var f=c.From;c.From=c.To;c.To=f}}for(n=0;n<a.State.Connector.Segments.length;n++){c=a.State.Connector.Segments[n];l=c.From.X;q=c.From.Y;w=c.To.X;x=c.To.Y;f=new mxPoint(l,q);r.push(f);f.mark=c.mark;var e=h[l+","+q];null!=e?e.mark|=f.mark:h[l+","+q]=f;f=new mxPoint(w,x);r.push(f);f.mark=c.mark;e=h[w+","+x];null!=e?e.mark|=f.mark:h[w+","+x]=f;for(f=n+1;f<a.State.Connector.Segments.length;f++){var e=a.State.Connector.Segments[f],y=
32e.From.X,z=e.From.Y,t=e.To.X,D=e.To.Y;l==w&&q<=z&&x>=z&&y<=l&&t>=l?(t=new mxPoint(l,z),r.push(t),t.mark=c.mark|e.mark,e=h[l+","+z],null!=e?e.mark|=t.mark:h[l+","+z]=t):q==x&&l<=y&&w>=y&&z<=q&&D>=q&&(t=new mxPoint(y,q),r.push(t),t.mark=c.mark|e.mark,e=h[y+","+q],null!=e?e.mark|=t.mark:h[y+","+q]=t)}}var v=[],m;for(m in h)v.push(h[m]);v.sort(function(a,b){var c=a.y-b.y;return 0==c?a.x-b.x:c});h=d.getOutgoingEdges(k);if(2==v.length&&1==h.length)p(h[0],v);else{a=function(a){for(var b=0;b<v.length;b++){var c=
33v[b];if(!B[c.x+","+c.y]&&c.mark&a.mark)return B[c.x+","+c.y]=!0,c}};var f=k.geometry,A;for(m=0;m<v.length;m++)if(C(f,v[m])){A=v[m];break}for(var B,f=0;f<h.length;f++)if(null!=h[f].target){B={};B[A.x+","+A.y]=!0;m=h[f].target.geometry;k=[A];n=A;for(c=0;1E3>c;)if(c++,l=a(n),null==l)k.pop(),n=k[k.length-1];else if(k.push(l),n=l,C(m,l))break;if(2<k.length)for(n=k[0].x,c=k[k.length-1].x,m=k.length-2;0<m;m--)(n>c&&k[m].x<c||n<c&&k[m].x<n)&&k.splice(m,1);m=h[f].geometry.clone();m.points=k;RPOrgChart.graph.model.setGeometry(h[f],
34m);p(h[f],k)}}}return!0});for(b=0;b<r.length;b++)delete r[b].mark,delete r[b].corrected}}});Bridge.init();
35