text: (function(n){"use strict";n.IntelliFactory={Runtime:{Ctor:function(n,t){return n.prototype=t.prototype,n},Class:function(n,t,i){var u=n,f,r,e;if(t){u=new t;for(f in n)u[f]=n[f]}if(r=function(n){if(n)for(var t in n)this[t]=n[t]},r.prototype=u,i)for(e in i)r[e]=i[e];return r},Clone:function(n){var t={};for(var i in n)t[i]=n[i];return t},NewObject:function(n){for(var i={},t=0;t<n.length;t++)i[n[t][0]]=n[t][1];return i},DeleteEmptyFields:function(n,t){for(var r,i=0;i<t.length;i++)r=t[i],n[r]===void 0&&delete n[r];return n},GetOptional:function(n){return n===void 0?null:{$:1,$0:n}},SetOptional:function(n,t,i){i?n[t]=i.$0:delete n[t]},SetOrDelete:function(n,t,i){i===void 0?delete n[t]:n[t]=i},Apply:function(n,t,i){return n.apply(t,i)},Bind:function(n){return function(){return n.apply(this,arguments)}},CreateFuncWithArgs:function(n){return function(){return n(Array.prototype.slice.call(arguments))}},CreateFuncWithOnlyThis:function(n){return function(){return n(this)}},CreateFuncWithThis:function(n){return function(){return n(this).apply(null,arguments)}},CreateFuncWithThisArgs:function(n){return function(){return n(this)(Array.prototype.slice.call(arguments))}},CreateFuncWithRest:function(n,t){return function(){return t(Array.prototype.slice.call(arguments,0,n).concat([Array.prototype.slice.call(arguments,n)]))}},CreateFuncWithArgsRest:function(n,t){return function(){return t([Array.prototype.slice.call(arguments,0,n),Array.prototype.slice.call(arguments,n)])}},BindDelegate:function(n,t){var i=n.bind(t);return i.$Func=n,i.$Target=t,i},CreateDelegate:function(n){if(n.length==0)return null;if(n.length==1)return n[0];var t=function(){for(var i,t=0;t<n.length;t++)i=n[t].apply(null,arguments);return i};return t.$Invokes=n,t},CombineDelegates:function(n){for(var t,i=[],r=0;r<n.length;r++)t=n[r],t&&("$Invokes"in t?i=i.concat(t.$Invokes):i.push(t));return IntelliFactory.Runtime.CreateDelegate(i)},DelegateEqual:function(n,t){var f,e,i,r,u;if(n===t)return!0;if(n==null||t==null||(f=n.$Invokes||[n],e=t.$Invokes||[t],f.length!=e.length))return!1;for(i=0;i<f.length;i++)if(r=f[i],u=e[i],!(r===u||"$Func"in r&&"$Func"in u&&r.$Func===u.$Func&&r.$Target==u.$Target))return!1;return!0},ThisFunc:function(n){return function(){var t=Array.prototype.slice.call(arguments);return t.unshift(this),n.apply(null,t)}},ThisFuncOut:function(n){return function(){var t=Array.prototype.slice.call(arguments);return n.apply(t.shift(),t)}},ParamsFunc:function(n,t){return function(){var i=Array.prototype.slice.call(arguments);return t.apply(null,i.slice(0,n).concat([i.slice(n)]))}},ParamsFuncOut:function(n,t){return function(){var i=Array.prototype.slice.call(arguments);return t.apply(null,i.slice(0,n).concat(i[n]))}},ThisParamsFunc:function(n,t){return function(){var i=Array.prototype.slice.call(arguments);return i.unshift(this),t.apply(null,i.slice(0,n+1).concat([i.slice(n+1)]))}},ThisParamsFuncOut:function(n,t){return function(){var i=Array.prototype.slice.call(arguments);return t.apply(i.shift(),i.slice(0,n).concat(i[n]))}},Curried:function(n,t,i){return i=i||[],function(r){var u=i.concat([r===void 0?null:r]);return t==1?n.apply(null,u):t==2?function(t){return n.apply(null,u.concat([t===void 0?null:t]))}:IntelliFactory.Runtime.Curried(n,t-1,u)}},Curried2:function(n){return function(t){return function(i){return n(t,i)}}},Curried3:function(n){return function(t){return function(i){return function(r){return n(t,i,r)}}}},UnionByType:function(n,t,i){for(var u,f=typeof t,r=0;r<n.length;r++)if(u=n[r],typeof u=="number"){if(Array.isArray(t)&&(u==0||t.length==u))return{$:r,$0:t}}else if(u==f)return{$:r,$0:t};if(!i)throw new Error("Type not expected for creating Choice value.");},ScriptBasePath:"./",ScriptPath:function(n,t){return this.ScriptBasePath+(this.ScriptSkipAssemblyDir?"":n+"/")+t},OnLoad:function(n){"load"in this||(this.load=[]);this.load.push(n)},Start:function(){function n(n){for(var t=0;t<n.length;t++)n[t]()}"load"in this&&(n(this.load),this.load=[])}}};n.IntelliFactory.Runtime.OnLoad(function(){n.WebSharper&&WebSharper.Activator&&WebSharper.Activator.Activate&&WebSharper.Activator.Activate()});Date.now||(Date.now=function(){return(new Date).getTime()});Math.trunc||(Math.trunc=function(n){return n<0?Math.ceil(n):Math.floor(n)});Object.setPrototypeOf||(Object.setPrototypeOf=function(n,t){return n.__proto__=t,n});n.ignore=function(){};n.id=function(n){return n};n.fst=function(n){return n[0]};n.snd=function(n){return n[1]};n.trd=function(n){return n[2]};n.console||(n.console={count:ignore,dir:ignore,error:ignore,group:ignore,groupEnd:ignore,info:ignore,log:ignore,profile:ignore,profileEnd:ignore,time:ignore,timeEnd:ignore,trace:ignore,warn:ignore})})(self);
  !function(t){var e={};function r(n){if(e[n])return e[n].exports;var o=e[n]={i:n,l:!1,exports:{}};return t[n].call(o.exports,o,o.exports,r),o.l=!0,o.exports}r.m=t,r.c=e,r.d=function(t,e,n){r.o(t,e)||Object.defineProperty(t,e,{configurable:!1,enumerable:!0,get:n})},r.r=function(t){Object.defineProperty(t,"__esModule",{value:!0})},r.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return r.d(e,"a",e),e},r.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},r.p="",r(r.s=36)}([function(t,e){var r;r=function(){return this}();try{r=r||Function("return this")()||(0,eval)("this")}catch(t){"object"==typeof window&&(r=window)}t.exports=r},function(t,e,r){var n=r(24),o=function(){return!this}();function i(t,e){this.name="AuthTokenExpiredError",this.message=t,this.expiry=e,Error.captureStackTrace&&!o?Error.captureStackTrace(this,arguments.callee):this.stack=(new Error).stack}function s(t){this.name="AuthTokenInvalidError",this.message=t,Error.captureStackTrace&&!o?Error.captureStackTrace(this,arguments.callee):this.stack=(new Error).stack}function a(t,e){this.name="AuthTokenNotBeforeError",this.message=t,this.date=e,Error.captureStackTrace&&!o?Error.captureStackTrace(this,arguments.callee):this.stack=(new Error).stack}function c(t){this.name="AuthTokenError",this.message=t,Error.captureStackTrace&&!o?Error.captureStackTrace(this,arguments.callee):this.stack=(new Error).stack}function u(t,e){this.name="SilentMiddlewareBlockedError",this.message=t,this.type=e,Error.captureStackTrace&&!o?Error.captureStackTrace(this,arguments.callee):this.stack=(new Error).stack}function h(t){this.name="InvalidActionError",this.message=t,Error.captureStackTrace&&!o?Error.captureStackTrace(this,arguments.callee):this.stack=(new Error).stack}function p(t){this.name="InvalidArgumentsError",this.message=t,Error.captureStackTrace&&!o?Error.captureStackTrace(this,arguments.callee):this.stack=(new Error).stack}function f(t){this.name="InvalidOptionsError",this.message=t,Error.captureStackTrace&&!o?Error.captureStackTrace(this,arguments.callee):this.stack=(new Error).stack}function l(t){this.name="InvalidMessageError",this.message=t,Error.captureStackTrace&&!o?Error.captureStackTrace(this,arguments.callee):this.stack=(new Error).stack}function d(t,e){this.name="SocketProtocolError",this.message=t,this.code=e,Error.captureStackTrace&&!o?Error.captureStackTrace(this,arguments.callee):this.stack=(new Error).stack}function y(t){this.name="ServerProtocolError",this.message=t,Error.captureStackTrace&&!o?Error.captureStackTrace(this,arguments.callee):this.stack=(new Error).stack}function g(t){this.name="HTTPServerError",this.message=t,Error.captureStackTrace&&!o?Error.captureStackTrace(this,arguments.callee):this.stack=(new Error).stack}function m(t){this.name="ResourceLimitError",this.message=t,Error.captureStackTrace&&!o?Error.captureStackTrace(this,arguments.callee):this.stack=(new Error).stack}function v(t){this.name="TimeoutError",this.message=t,Error.captureStackTrace&&!o?Error.captureStackTrace(this,arguments.callee):this.stack=(new Error).stack}function b(t,e){this.name="BadConnectionError",this.message=t,this.type=e,Error.captureStackTrace&&!o?Error.captureStackTrace(this,arguments.callee):this.stack=(new Error).stack}function E(t){this.name="BrokerError",this.message=t,Error.captureStackTrace&&!o?Error.captureStackTrace(this,arguments.callee):this.stack=(new Error).stack}function S(t,e){this.name="ProcessExitError",this.message=t,this.code=e,Error.captureStackTrace&&!o?Error.captureStackTrace(this,arguments.callee):this.stack=(new Error).stack}function w(t){this.name="UnknownError",this.message=t,Error.captureStackTrace&&!o?Error.captureStackTrace(this,arguments.callee):this.stack=(new Error).stack}i.prototype=Object.create(Error.prototype),s.prototype=Object.create(Error.prototype),a.prototype=Object.create(Error.prototype),c.prototype=Object.create(Error.prototype),u.prototype=Object.create(Error.prototype),h.prototype=Object.create(Error.prototype),p.prototype=Object.create(Error.prototype),f.prototype=Object.create(Error.prototype),l.prototype=Object.create(Error.prototype),d.prototype=Object.create(Error.prototype),y.prototype=Object.create(Error.prototype),g.prototype=Object.create(Error.prototype),m.prototype=Object.create(Error.prototype),v.prototype=Object.create(Error.prototype),b.prototype=Object.create(Error.prototype),E.prototype=Object.create(Error.prototype),S.prototype=Object.create(Error.prototype),w.prototype=Object.create(Error.prototype),t.exports={AuthTokenExpiredError:i,AuthTokenInvalidError:s,AuthTokenNotBeforeError:a,AuthTokenError:c,SilentMiddlewareBlockedError:u,InvalidActionError:h,InvalidArgumentsError:p,InvalidOptionsError:f,InvalidMessageError:l,SocketProtocolError:d,ServerProtocolError:y,HTTPServerError:g,ResourceLimitError:m,TimeoutError:v,BadConnectionError:b,BrokerError:E,ProcessExitError:S,UnknownError:w},t.exports.socketProtocolErrorStatuses={1001:"Socket was disconnected",1002:"A WebSocket protocol error was encountered",1003:"Server terminated socket because it received invalid data",1005:"Socket closed without status code",1006:"Socket hung up",1007:"Message format was incorrect",1008:"Encountered a policy violation",1009:"Message was too big to process",1010:"Client ended the connection because the server did not comply with extension requirements",1011:"Server encountered an unexpected fatal condition",4000:"Server ping timed out",4001:"Client pong timed out",4002:"Server failed to sign auth token",4003:"Failed to complete handshake",4004:"Client failed to save auth token",4005:"Did not receive #handshake from client before timeout",4006:"Failed to bind socket to message broker",4007:"Client connection establishment timed out"},t.exports.socketProtocolIgnoreStatuses={1000:"Socket closed normally",1001:"Socket hung up"};var T={domain:1,domainEmitter:1,domainThrown:1};t.exports.dehydrateError=function(t,e){var r;if(t&&"object"==typeof t)for(var o in r={message:t.message},e&&(r.stack=t.stack),t)T[o]||(r[o]=t[o]);else r="function"==typeof t?"[function "+(t.name||"anonymous")+"]":t;return n(r)},t.exports.hydrateError=function(t){var e=null;if(null!=t)if("object"==typeof t)for(var r in e=new Error(t.message),t)t.hasOwnProperty(r)&&(e[r]=t[r]);else e=t;return e},t.exports.decycle=n},function(t,e,r){var n=r(27);Object.create||(Object.create=r(26));var o=function(){n.call(this)};(o.prototype=Object.create(n.prototype)).emit=function(t){if("error"==t){var e=["__domainError"];if(void 0!==arguments[1]&&e.push(arguments[1]),n.prototype.emit.apply(this,e),this.domain){var r=arguments[1];r||(r=new Error('Uncaught, unspecified "error" event.')),r.domainEmitter=this,r.domain=this.domain,r.domainThrown=!1,this.domain.emit("error",r)}}n.prototype.emit.apply(this,arguments)},t.exports.SCEmitter=o},function(t,e,r){"use strict";t.exports=r(35)},function(t,e,r){"use strict";e.decode=e.parse=r(20),e.encode=e.stringify=r(19)},function(t,e,r){var n=r(1),o=n.InvalidActionError,i=function(t,e){this.socket=t,this.id=e,this.sent=!1};i.prototype._respond=function(t){if(this.sent)throw new o("Response "+this.id+" has already been sent");this.sent=!0,this.socket.send(this.socket.encode(t))},i.prototype.end=function(t){if(this.id){var e={rid:this.id};void 0!==t&&(e.data=t),this._respond(e)}},i.prototype.error=function(t,e){if(this.id){var r=n.dehydrateError(t),o={rid:this.id,error:r};void 0!==e&&(o.data=e),this._respond(o)}},i.prototype.callback=function(t,e){t?this.error(t,e):this.end(e)},t.exports.Response=i},function(t,e,r){"use strict";(function(t){
  /*!
   * The buffer module from node.js, for the browser.
   *
   * @author   Feross Aboukhadijeh <feross@feross.org> <http://feross.org>
   * @license  MIT
   */
  var n=r(30),o=r(29),i=r(28);function s(){return c.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function a(t,e){if(s()<e)throw new RangeError("Invalid typed array length");return c.TYPED_ARRAY_SUPPORT?(t=new Uint8Array(e)).__proto__=c.prototype:(null===t&&(t=new c(e)),t.length=e),t}function c(t,e,r){if(!(c.TYPED_ARRAY_SUPPORT||this instanceof c))return new c(t,e,r);if("number"==typeof t){if("string"==typeof e)throw new Error("If encoding is specified then the first argument must be a string");return p(this,t)}return u(this,t,e,r)}function u(t,e,r,n){if("number"==typeof e)throw new TypeError('"value" argument must not be a number');return"undefined"!=typeof ArrayBuffer&&e instanceof ArrayBuffer?function(t,e,r,n){if(e.byteLength,r<0||e.byteLength<r)throw new RangeError("'offset' is out of bounds");if(e.byteLength<r+(n||0))throw new RangeError("'length' is out of bounds");e=void 0===r&&void 0===n?new Uint8Array(e):void 0===n?new Uint8Array(e,r):new Uint8Array(e,r,n);c.TYPED_ARRAY_SUPPORT?(t=e).__proto__=c.prototype:t=f(t,e);return t}(t,e,r,n):"string"==typeof e?function(t,e,r){"string"==typeof r&&""!==r||(r="utf8");if(!c.isEncoding(r))throw new TypeError('"encoding" must be a valid string encoding');var n=0|d(e,r),o=(t=a(t,n)).write(e,r);o!==n&&(t=t.slice(0,o));return t}(t,e,r):function(t,e){if(c.isBuffer(e)){var r=0|l(e.length);return 0===(t=a(t,r)).length?t:(e.copy(t,0,0,r),t)}if(e){if("undefined"!=typeof ArrayBuffer&&e.buffer instanceof ArrayBuffer||"length"in e)return"number"!=typeof e.length||(n=e.length)!=n?a(t,0):f(t,e);if("Buffer"===e.type&&i(e.data))return f(t,e.data)}var n;throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")}(t,e)}function h(t){if("number"!=typeof t)throw new TypeError('"size" argument must be a number');if(t<0)throw new RangeError('"size" argument must not be negative')}function p(t,e){if(h(e),t=a(t,e<0?0:0|l(e)),!c.TYPED_ARRAY_SUPPORT)for(var r=0;r<e;++r)t[r]=0;return t}function f(t,e){var r=e.length<0?0:0|l(e.length);t=a(t,r);for(var n=0;n<r;n+=1)t[n]=255&e[n];return t}function l(t){if(t>=s())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+s().toString(16)+" bytes");return 0|t}function d(t,e){if(c.isBuffer(t))return t.length;if("undefined"!=typeof ArrayBuffer&&"function"==typeof ArrayBuffer.isView&&(ArrayBuffer.isView(t)||t instanceof ArrayBuffer))return t.byteLength;"string"!=typeof t&&(t=""+t);var r=t.length;if(0===r)return 0;for(var n=!1;;)switch(e){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":case void 0:return Y(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return F(t).length;default:if(n)return Y(t).length;e=(""+e).toLowerCase(),n=!0}}function y(t,e,r){var n=t[e];t[e]=t[r],t[r]=n}function g(t,e,r,n,o){if(0===t.length)return-1;if("string"==typeof r?(n=r,r=0):r>2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),r=+r,isNaN(r)&&(r=o?0:t.length-1),r<0&&(r=t.length+r),r>=t.length){if(o)return-1;r=t.length-1}else if(r<0){if(!o)return-1;r=0}if("string"==typeof e&&(e=c.from(e,n)),c.isBuffer(e))return 0===e.length?-1:m(t,e,r,n,o);if("number"==typeof e)return e&=255,c.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?o?Uint8Array.prototype.indexOf.call(t,e,r):Uint8Array.prototype.lastIndexOf.call(t,e,r):m(t,[e],r,n,o);throw new TypeError("val must be string, number or Buffer")}function m(t,e,r,n,o){var i,s=1,a=t.length,c=e.length;if(void 0!==n&&("ucs2"===(n=String(n).toLowerCase())||"ucs-2"===n||"utf16le"===n||"utf-16le"===n)){if(t.length<2||e.length<2)return-1;s=2,a/=2,c/=2,r/=2}function u(t,e){return 1===s?t[e]:t.readUInt16BE(e*s)}if(o){var h=-1;for(i=r;i<a;i++)if(u(t,i)===u(e,-1===h?0:i-h)){if(-1===h&&(h=i),i-h+1===c)return h*s}else-1!==h&&(i-=i-h),h=-1}else for(r+c>a&&(r=a-c),i=r;i>=0;i--){for(var p=!0,f=0;f<c;f++)if(u(t,i+f)!==u(e,f)){p=!1;break}if(p)return i}return-1}function v(t,e,r,n){r=Number(r)||0;var o=t.length-r;n?(n=Number(n))>o&&(n=o):n=o;var i=e.length;if(i%2!=0)throw new TypeError("Invalid hex string");n>i/2&&(n=i/2);for(var s=0;s<n;++s){var a=parseInt(e.substr(2*s,2),16);if(isNaN(a))return s;t[r+s]=a}return s}function b(t,e,r,n){return $(Y(e,t.length-r),t,r,n)}function E(t,e,r,n){return $(function(t){for(var e=[],r=0;r<t.length;++r)e.push(255&t.charCodeAt(r));return e}(e),t,r,n)}function S(t,e,r,n){return E(t,e,r,n)}function w(t,e,r,n){return $(F(e),t,r,n)}function T(t,e,r,n){return $(function(t,e){for(var r,n,o,i=[],s=0;s<t.length&&!((e-=2)<0);++s)r=t.charCodeAt(s),n=r>>8,o=r%256,i.push(o),i.push(n);return i}(e,t.length-r),t,r,n)}function _(t,e,r){return 0===e&&r===t.length?n.fromByteArray(t):n.fromByteArray(t.slice(e,r))}function k(t,e,r){r=Math.min(t.length,r);for(var n=[],o=e;o<r;){var i,s,a,c,u=t[o],h=null,p=u>239?4:u>223?3:u>191?2:1;if(o+p<=r)switch(p){case 1:u<128&&(h=u);break;case 2:128==(192&(i=t[o+1]))&&(c=(31&u)<<6|63&i)>127&&(h=c);break;case 3:i=t[o+1],s=t[o+2],128==(192&i)&&128==(192&s)&&(c=(15&u)<<12|(63&i)<<6|63&s)>2047&&(c<55296||c>57343)&&(h=c);break;case 4:i=t[o+1],s=t[o+2],a=t[o+3],128==(192&i)&&128==(192&s)&&128==(192&a)&&(c=(15&u)<<18|(63&i)<<12|(63&s)<<6|63&a)>65535&&c<1114112&&(h=c)}null===h?(h=65533,p=1):h>65535&&(h-=65536,n.push(h>>>10&1023|55296),h=56320|1023&h),n.push(h),o+=p}return function(t){var e=t.length;if(e<=A)return String.fromCharCode.apply(String,t);var r="",n=0;for(;n<e;)r+=String.fromCharCode.apply(String,t.slice(n,n+=A));return r}(n)}e.Buffer=c,e.SlowBuffer=function(t){+t!=t&&(t=0);return c.alloc(+t)},e.INSPECT_MAX_BYTES=50,c.TYPED_ARRAY_SUPPORT=void 0!==t.TYPED_ARRAY_SUPPORT?t.TYPED_ARRAY_SUPPORT:function(){try{var t=new Uint8Array(1);return t.__proto__={__proto__:Uint8Array.prototype,foo:function(){return 42}},42===t.foo()&&"function"==typeof t.subarray&&0===t.subarray(1,1).byteLength}catch(t){return!1}}(),e.kMaxLength=s(),c.poolSize=8192,c._augment=function(t){return t.__proto__=c.prototype,t},c.from=function(t,e,r){return u(null,t,e,r)},c.TYPED_ARRAY_SUPPORT&&(c.prototype.__proto__=Uint8Array.prototype,c.__proto__=Uint8Array,"undefined"!=typeof Symbol&&Symbol.species&&c[Symbol.species]===c&&Object.defineProperty(c,Symbol.species,{value:null,configurable:!0})),c.alloc=function(t,e,r){return function(t,e,r,n){return h(e),e<=0?a(t,e):void 0!==r?"string"==typeof n?a(t,e).fill(r,n):a(t,e).fill(r):a(t,e)}(null,t,e,r)},c.allocUnsafe=function(t){return p(null,t)},c.allocUnsafeSlow=function(t){return p(null,t)},c.isBuffer=function(t){return!(null==t||!t._isBuffer)},c.compare=function(t,e){if(!c.isBuffer(t)||!c.isBuffer(e))throw new TypeError("Arguments must be Buffers");if(t===e)return 0;for(var r=t.length,n=e.length,o=0,i=Math.min(r,n);o<i;++o)if(t[o]!==e[o]){r=t[o],n=e[o];break}return r<n?-1:n<r?1:0},c.isEncoding=function(t){switch(String(t).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},c.concat=function(t,e){if(!i(t))throw new TypeError('"list" argument must be an Array of Buffers');if(0===t.length)return c.alloc(0);var r;if(void 0===e)for(e=0,r=0;r<t.length;++r)e+=t[r].length;var n=c.allocUnsafe(e),o=0;for(r=0;r<t.length;++r){var s=t[r];if(!c.isBuffer(s))throw new TypeError('"list" argument must be an Array of Buffers');s.copy(n,o),o+=s.length}return n},c.byteLength=d,c.prototype._isBuffer=!0,c.prototype.swap16=function(){var t=this.length;if(t%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var e=0;e<t;e+=2)y(this,e,e+1);return this},c.prototype.swap32=function(){var t=this.length;if(t%4!=0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var e=0;e<t;e+=4)y(this,e,e+3),y(this,e+1,e+2);return this},c.prototype.swap64=function(){var t=this.length;if(t%8!=0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var e=0;e<t;e+=8)y(this,e,e+7),y(this,e+1,e+6),y(this,e+2,e+5),y(this,e+3,e+4);return this},c.prototype.toString=function(){var t=0|this.length;return 0===t?"":0===arguments.length?k(this,0,t):function(t,e,r){var n=!1;if((void 0===e||e<0)&&(e=0),e>this.length)return"";if((void 0===r||r>this.length)&&(r=this.length),r<=0)return"";if((r>>>=0)<=(e>>>=0))return"";for(t||(t="utf8");;)switch(t){case"hex":return R(this,e,r);case"utf8":case"utf-8":return k(this,e,r);case"ascii":return C(this,e,r);case"latin1":case"binary":return O(this,e,r);case"base64":return _(this,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return P(this,e,r);default:if(n)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),n=!0}}.apply(this,arguments)},c.prototype.equals=function(t){if(!c.isBuffer(t))throw new TypeError("Argument must be a Buffer");return this===t||0===c.compare(this,t)},c.prototype.inspect=function(){var t="",r=e.INSPECT_MAX_BYTES;return this.length>0&&(t=this.toString("hex",0,r).match(/.{2}/g).join(" "),this.length>r&&(t+=" ... ")),"<Buffer "+t+">"},c.prototype.compare=function(t,e,r,n,o){if(!c.isBuffer(t))throw new TypeError("Argument must be a Buffer");if(void 0===e&&(e=0),void 0===r&&(r=t?t.length:0),void 0===n&&(n=0),void 0===o&&(o=this.length),e<0||r>t.length||n<0||o>this.length)throw new RangeError("out of range index");if(n>=o&&e>=r)return 0;if(n>=o)return-1;if(e>=r)return 1;if(e>>>=0,r>>>=0,n>>>=0,o>>>=0,this===t)return 0;for(var i=o-n,s=r-e,a=Math.min(i,s),u=this.slice(n,o),h=t.slice(e,r),p=0;p<a;++p)if(u[p]!==h[p]){i=u[p],s=h[p];break}return i<s?-1:s<i?1:0},c.prototype.includes=function(t,e,r){return-1!==this.indexOf(t,e,r)},c.prototype.indexOf=function(t,e,r){return g(this,t,e,r,!0)},c.prototype.lastIndexOf=function(t,e,r){return g(this,t,e,r,!1)},c.prototype.write=function(t,e,r,n){if(void 0===e)n="utf8",r=this.length,e=0;else if(void 0===r&&"string"==typeof e)n=e,r=this.length,e=0;else{if(!isFinite(e))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");e|=0,isFinite(r)?(r|=0,void 0===n&&(n="utf8")):(n=r,r=void 0)}var o=this.length-e;if((void 0===r||r>o)&&(r=o),t.length>0&&(r<0||e<0)||e>this.length)throw new RangeError("Attempt to write outside buffer bounds");n||(n="utf8");for(var i=!1;;)switch(n){case"hex":return v(this,t,e,r);case"utf8":case"utf-8":return b(this,t,e,r);case"ascii":return E(this,t,e,r);case"latin1":case"binary":return S(this,t,e,r);case"base64":return w(this,t,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return T(this,t,e,r);default:if(i)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),i=!0}},c.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var A=4096;function C(t,e,r){var n="";r=Math.min(t.length,r);for(var o=e;o<r;++o)n+=String.fromCharCode(127&t[o]);return n}function O(t,e,r){var n="";r=Math.min(t.length,r);for(var o=e;o<r;++o)n+=String.fromCharCode(t[o]);return n}function R(t,e,r){var n=t.length;(!e||e<0)&&(e=0),(!r||r<0||r>n)&&(r=n);for(var o="",i=e;i<r;++i)o+=L(t[i]);return o}function P(t,e,r){for(var n=t.slice(e,r),o="",i=0;i<n.length;i+=2)o+=String.fromCharCode(n[i]+256*n[i+1]);return o}function N(t,e,r){if(t%1!=0||t<0)throw new RangeError("offset is not uint");if(t+e>r)throw new RangeError("Trying to access beyond buffer length")}function I(t,e,r,n,o,i){if(!c.isBuffer(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>o||e<i)throw new RangeError('"value" argument is out of bounds');if(r+n>t.length)throw new RangeError("Index out of range")}function x(t,e,r,n){e<0&&(e=65535+e+1);for(var o=0,i=Math.min(t.length-r,2);o<i;++o)t[r+o]=(e&255<<8*(n?o:1-o))>>>8*(n?o:1-o)}function B(t,e,r,n){e<0&&(e=4294967295+e+1);for(var o=0,i=Math.min(t.length-r,4);o<i;++o)t[r+o]=e>>>8*(n?o:3-o)&255}function j(t,e,r,n,o,i){if(r+n>t.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function U(t,e,r,n,i){return i||j(t,0,r,4),o.write(t,e,r,n,23,4),r+4}function D(t,e,r,n,i){return i||j(t,0,r,8),o.write(t,e,r,n,52,8),r+8}c.prototype.slice=function(t,e){var r,n=this.length;if(t=~~t,e=void 0===e?n:~~e,t<0?(t+=n)<0&&(t=0):t>n&&(t=n),e<0?(e+=n)<0&&(e=0):e>n&&(e=n),e<t&&(e=t),c.TYPED_ARRAY_SUPPORT)(r=this.subarray(t,e)).__proto__=c.prototype;else{var o=e-t;r=new c(o,void 0);for(var i=0;i<o;++i)r[i]=this[i+t]}return r},c.prototype.readUIntLE=function(t,e,r){t|=0,e|=0,r||N(t,e,this.length);for(var n=this[t],o=1,i=0;++i<e&&(o*=256);)n+=this[t+i]*o;return n},c.prototype.readUIntBE=function(t,e,r){t|=0,e|=0,r||N(t,e,this.length);for(var n=this[t+--e],o=1;e>0&&(o*=256);)n+=this[t+--e]*o;return n},c.prototype.readUInt8=function(t,e){return e||N(t,1,this.length),this[t]},c.prototype.readUInt16LE=function(t,e){return e||N(t,2,this.length),this[t]|this[t+1]<<8},c.prototype.readUInt16BE=function(t,e){return e||N(t,2,this.length),this[t]<<8|this[t+1]},c.prototype.readUInt32LE=function(t,e){return e||N(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+16777216*this[t+3]},c.prototype.readUInt32BE=function(t,e){return e||N(t,4,this.length),16777216*this[t]+(this[t+1]<<16|this[t+2]<<8|this[t+3])},c.prototype.readIntLE=function(t,e,r){t|=0,e|=0,r||N(t,e,this.length);for(var n=this[t],o=1,i=0;++i<e&&(o*=256);)n+=this[t+i]*o;return n>=(o*=128)&&(n-=Math.pow(2,8*e)),n},c.prototype.readIntBE=function(t,e,r){t|=0,e|=0,r||N(t,e,this.length);for(var n=e,o=1,i=this[t+--n];n>0&&(o*=256);)i+=this[t+--n]*o;return i>=(o*=128)&&(i-=Math.pow(2,8*e)),i},c.prototype.readInt8=function(t,e){return e||N(t,1,this.length),128&this[t]?-1*(255-this[t]+1):this[t]},c.prototype.readInt16LE=function(t,e){e||N(t,2,this.length);var r=this[t]|this[t+1]<<8;return 32768&r?4294901760|r:r},c.prototype.readInt16BE=function(t,e){e||N(t,2,this.length);var r=this[t+1]|this[t]<<8;return 32768&r?4294901760|r:r},c.prototype.readInt32LE=function(t,e){return e||N(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24},c.prototype.readInt32BE=function(t,e){return e||N(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},c.prototype.readFloatLE=function(t,e){return e||N(t,4,this.length),o.read(this,t,!0,23,4)},c.prototype.readFloatBE=function(t,e){return e||N(t,4,this.length),o.read(this,t,!1,23,4)},c.prototype.readDoubleLE=function(t,e){return e||N(t,8,this.length),o.read(this,t,!0,52,8)},c.prototype.readDoubleBE=function(t,e){return e||N(t,8,this.length),o.read(this,t,!1,52,8)},c.prototype.writeUIntLE=function(t,e,r,n){(t=+t,e|=0,r|=0,n)||I(this,t,e,r,Math.pow(2,8*r)-1,0);var o=1,i=0;for(this[e]=255&t;++i<r&&(o*=256);)this[e+i]=t/o&255;return e+r},c.prototype.writeUIntBE=function(t,e,r,n){(t=+t,e|=0,r|=0,n)||I(this,t,e,r,Math.pow(2,8*r)-1,0);var o=r-1,i=1;for(this[e+o]=255&t;--o>=0&&(i*=256);)this[e+o]=t/i&255;return e+r},c.prototype.writeUInt8=function(t,e,r){return t=+t,e|=0,r||I(this,t,e,1,255,0),c.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),this[e]=255&t,e+1},c.prototype.writeUInt16LE=function(t,e,r){return t=+t,e|=0,r||I(this,t,e,2,65535,0),c.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8):x(this,t,e,!0),e+2},c.prototype.writeUInt16BE=function(t,e,r){return t=+t,e|=0,r||I(this,t,e,2,65535,0),c.TYPED_ARRAY_SUPPORT?(this[e]=t>>>8,this[e+1]=255&t):x(this,t,e,!1),e+2},c.prototype.writeUInt32LE=function(t,e,r){return t=+t,e|=0,r||I(this,t,e,4,4294967295,0),c.TYPED_ARRAY_SUPPORT?(this[e+3]=t>>>24,this[e+2]=t>>>16,this[e+1]=t>>>8,this[e]=255&t):B(this,t,e,!0),e+4},c.prototype.writeUInt32BE=function(t,e,r){return t=+t,e|=0,r||I(this,t,e,4,4294967295,0),c.TYPED_ARRAY_SUPPORT?(this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t):B(this,t,e,!1),e+4},c.prototype.writeIntLE=function(t,e,r,n){if(t=+t,e|=0,!n){var o=Math.pow(2,8*r-1);I(this,t,e,r,o-1,-o)}var i=0,s=1,a=0;for(this[e]=255&t;++i<r&&(s*=256);)t<0&&0===a&&0!==this[e+i-1]&&(a=1),this[e+i]=(t/s>>0)-a&255;return e+r},c.prototype.writeIntBE=function(t,e,r,n){if(t=+t,e|=0,!n){var o=Math.pow(2,8*r-1);I(this,t,e,r,o-1,-o)}var i=r-1,s=1,a=0;for(this[e+i]=255&t;--i>=0&&(s*=256);)t<0&&0===a&&0!==this[e+i+1]&&(a=1),this[e+i]=(t/s>>0)-a&255;return e+r},c.prototype.writeInt8=function(t,e,r){return t=+t,e|=0,r||I(this,t,e,1,127,-128),c.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),t<0&&(t=255+t+1),this[e]=255&t,e+1},c.prototype.writeInt16LE=function(t,e,r){return t=+t,e|=0,r||I(this,t,e,2,32767,-32768),c.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8):x(this,t,e,!0),e+2},c.prototype.writeInt16BE=function(t,e,r){return t=+t,e|=0,r||I(this,t,e,2,32767,-32768),c.TYPED_ARRAY_SUPPORT?(this[e]=t>>>8,this[e+1]=255&t):x(this,t,e,!1),e+2},c.prototype.writeInt32LE=function(t,e,r){return t=+t,e|=0,r||I(this,t,e,4,2147483647,-2147483648),c.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8,this[e+2]=t>>>16,this[e+3]=t>>>24):B(this,t,e,!0),e+4},c.prototype.writeInt32BE=function(t,e,r){return t=+t,e|=0,r||I(this,t,e,4,2147483647,-2147483648),t<0&&(t=4294967295+t+1),c.TYPED_ARRAY_SUPPORT?(this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t):B(this,t,e,!1),e+4},c.prototype.writeFloatLE=function(t,e,r){return U(this,t,e,!0,r)},c.prototype.writeFloatBE=function(t,e,r){return U(this,t,e,!1,r)},c.prototype.writeDoubleLE=function(t,e,r){return D(this,t,e,!0,r)},c.prototype.writeDoubleBE=function(t,e,r){return D(this,t,e,!1,r)},c.prototype.copy=function(t,e,r,n){if(r||(r=0),n||0===n||(n=this.length),e>=t.length&&(e=t.length),e||(e=0),n>0&&n<r&&(n=r),n===r)return 0;if(0===t.length||0===this.length)return 0;if(e<0)throw new RangeError("targetStart out of bounds");if(r<0||r>=this.length)throw new RangeError("sourceStart out of bounds");if(n<0)throw new RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length),t.length-e<n-r&&(n=t.length-e+r);var o,i=n-r;if(this===t&&r<e&&e<n)for(o=i-1;o>=0;--o)t[o+e]=this[o+r];else if(i<1e3||!c.TYPED_ARRAY_SUPPORT)for(o=0;o<i;++o)t[o+e]=this[o+r];else Uint8Array.prototype.set.call(t,this.subarray(r,r+i),e);return i},c.prototype.fill=function(t,e,r,n){if("string"==typeof t){if("string"==typeof e?(n=e,e=0,r=this.length):"string"==typeof r&&(n=r,r=this.length),1===t.length){var o=t.charCodeAt(0);o<256&&(t=o)}if(void 0!==n&&"string"!=typeof n)throw new TypeError("encoding must be a string");if("string"==typeof n&&!c.isEncoding(n))throw new TypeError("Unknown encoding: "+n)}else"number"==typeof t&&(t&=255);if(e<0||this.length<e||this.length<r)throw new RangeError("Out of range index");if(r<=e)return this;var i;if(e>>>=0,r=void 0===r?this.length:r>>>0,t||(t=0),"number"==typeof t)for(i=e;i<r;++i)this[i]=t;else{var s=c.isBuffer(t)?t:Y(new c(t,n).toString()),a=s.length;for(i=0;i<r-e;++i)this[i+e]=s[i%a]}return this};var M=/[^+\/0-9A-Za-z-_]/g;function L(t){return t<16?"0"+t.toString(16):t.toString(16)}function Y(t,e){var r;e=e||1/0;for(var n=t.length,o=null,i=[],s=0;s<n;++s){if((r=t.charCodeAt(s))>55295&&r<57344){if(!o){if(r>56319){(e-=3)>-1&&i.push(239,191,189);continue}if(s+1===n){(e-=3)>-1&&i.push(239,191,189);continue}o=r;continue}if(r<56320){(e-=3)>-1&&i.push(239,191,189),o=r;continue}r=65536+(o-55296<<10|r-56320)}else o&&(e-=3)>-1&&i.push(239,191,189);if(o=null,r<128){if((e-=1)<0)break;i.push(r)}else if(r<2048){if((e-=2)<0)break;i.push(r>>6|192,63&r|128)}else if(r<65536){if((e-=3)<0)break;i.push(r>>12|224,r>>6&63|128,63&r|128)}else{if(!(r<1114112))throw new Error("Invalid code point");if((e-=4)<0)break;i.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}}return i}function F(t){return n.toByteArray(function(t){if((t=function(t){return t.trim?t.trim():t.replace(/^\s+|\s+$/g,"")}(t).replace(M,"")).length<2)return"";for(;t.length%4!=0;)t+="=";return t}(t))}function $(t,e,r,n){for(var o=0;o<n&&!(o+r>=e.length||o>=t.length);++o)e[o+r]=t[o];return o}}).call(this,r(0))},function(t,e,r){(function(e,n){var o=r(2).SCEmitter,i=r(25).SCChannel,s=(r(5).Response,r(23).AuthEngine),a=r(22),c=r(21).SCTransport,u=r(4),h=r(17),p=r(15),f=r(13),l=r(1),d=l.InvalidArgumentsError,y=l.InvalidMessageError,g=l.SocketProtocolError,m=l.TimeoutError,v="undefined"!=typeof window,b=function(t){var r=this;o.call(this),this.id=null,this.state=this.CLOSED,this.authState=this.PENDING,this.signedAuthToken=null,this.authToken=null,this.pendingReconnect=!1,this.pendingReconnectTimeout=null,this.pendingConnectCallback=!1,this.connectTimeout=t.connectTimeout,this.ackTimeout=t.ackTimeout,this.channelPrefix=t.channelPrefix||null,this.disconnectOnUnload=null==t.disconnectOnUnload||t.disconnectOnUnload,this.pingTimeout=this.ackTimeout;var n=Math.pow(2,31)-1,i=function(t){if(r[t]>n)throw new d("The "+t+" value provided exceeded the maximum amount allowed")};if(i("connectTimeout"),i("ackTimeout"),i("pingTimeout"),this._localEvents={connect:1,connectAbort:1,disconnect:1,message:1,error:1,raw:1,fail:1,kickOut:1,subscribe:1,unsubscribe:1,subscribeStateChange:1,authStateChange:1,authenticate:1,deauthenticate:1,removeAuthToken:1,subscribeRequest:1},this.connectAttempts=0,this._emitBuffer=new h,this._channels={},this.options=t,this._cid=1,this.options.callIdGenerator=function(){return r._callIdGenerator()},this.options.autoReconnect){null==this.options.autoReconnectOptions&&(this.options.autoReconnectOptions={});var c=this.options.autoReconnectOptions;null==c.initialDelay&&(c.initialDelay=1e4),null==c.randomness&&(c.randomness=1e4),null==c.multiplier&&(c.multiplier=1.5),null==c.maxDelay&&(c.maxDelay=6e4)}if(null==this.options.subscriptionRetryOptions&&(this.options.subscriptionRetryOptions={}),this.options.authEngine?this.auth=this.options.authEngine:this.auth=new s,this.options.codecEngine?this.codec=this.options.codecEngine:this.codec=a,this.options.path=this.options.path.replace(/\/$/,"")+"/",this.options.query=t.query||{},"string"==typeof this.options.query&&(this.options.query=u.parse(this.options.query)),this.options.autoConnect&&this.connect(),this._channelEmitter=new o,v&&this.disconnectOnUnload){var p=function(){r.disconnect()};e.attachEvent?e.attachEvent("onunload",p):e.addEventListener&&e.addEventListener("beforeunload",p,!1)}};b.prototype=Object.create(o.prototype),b.CONNECTING=b.prototype.CONNECTING=c.prototype.CONNECTING,b.OPEN=b.prototype.OPEN=c.prototype.OPEN,b.CLOSED=b.prototype.CLOSED=c.prototype.CLOSED,b.AUTHENTICATED=b.prototype.AUTHENTICATED="authenticated",b.UNAUTHENTICATED=b.prototype.UNAUTHENTICATED="unauthenticated",b.PENDING=b.prototype.PENDING="pending",b.ignoreStatuses=l.socketProtocolIgnoreStatuses,b.errorStatuses=l.socketProtocolErrorStatuses,b.prototype._privateEventHandlerMap={"#publish":function(t){var e=this._undecorateChannelName(t.channel);this.isSubscribed(e,!0)&&this._channelEmitter.emit(e,t.data)},"#kickOut":function(t){var e=this._undecorateChannelName(t.channel),r=this._channels[e];r&&(o.prototype.emit.call(this,"kickOut",t.message,e),r.emit("kickOut",t.message,e),this._triggerChannelUnsubscribe(r))},"#setAuthToken":function(t,e){var r=this;if(t){this.auth.saveToken(this.options.authTokenName,t.token,{},function(n){n?(e.error(n),r._onSCError(n)):(r._changeToAuthenticatedState(t.token),e.end())})}else e.error(new y("No token data provided by #setAuthToken event"))},"#removeAuthToken":function(t,e){var r=this;this.auth.removeToken(this.options.authTokenName,function(t,n){t?(e.error(t),r._onSCError(t)):(o.prototype.emit.call(r,"removeAuthToken",n),r._changeToUnauthenticatedState(),e.end())})},"#disconnect":function(t){this.transport.close(t.code,t.data)}},b.prototype._callIdGenerator=function(){return this._cid++},b.prototype.getState=function(){return this.state},b.prototype.getBytesReceived=function(){return this.transport.getBytesReceived()},b.prototype.deauthenticate=function(t){var e=this;this.auth.removeToken(this.options.authTokenName,function(r,n){r?e._onSCError(r):(e.emit("#removeAuthToken"),o.prototype.emit.call(e,"removeAuthToken",n),e._changeToUnauthenticatedState()),t&&t(r)})},b.prototype.connect=b.prototype.open=function(){var t=this;this.state==this.CLOSED&&(this.pendingReconnect=!1,this.pendingReconnectTimeout=null,clearTimeout(this._reconnectTimeoutRef),this.state=this.CONNECTING,o.prototype.emit.call(this,"connecting"),this._changeToPendingAuthState(),this.transport&&this.transport.off(),this.transport=new c(this.auth,this.codec,this.options),this.transport.on("open",function(e){t.state=t.OPEN,t._onSCOpen(e)}),this.transport.on("error",function(e){t._onSCError(e)}),this.transport.on("close",function(e,r){t.state=t.CLOSED,t._onSCClose(e,r)}),this.transport.on("openAbort",function(e,r){t.state=t.CLOSED,t._onSCClose(e,r,!0)}),this.transport.on("event",function(e,r,n){t._onSCEvent(e,r,n)}))},b.prototype.reconnect=function(){this.disconnect(),this.connect()},b.prototype.disconnect=function(t,e){if("number"!=typeof(t=t||1e3))throw new d("If specified, the code argument must be a number");this.state==this.OPEN||this.state==this.CONNECTING?this.transport.close(t,e):(this.pendingReconnect=!1,this.pendingReconnectTimeout=null,clearTimeout(this._reconnectTimeoutRef))},b.prototype._changeToPendingAuthState=function(){if(this.authState!=this.PENDING){var t=this.authState;this.authState=this.PENDING;var e={oldState:t,newState:this.authState};o.prototype.emit.call(this,"authStateChange",e)}},b.prototype._changeToUnauthenticatedState=function(){if(this.authState!=this.UNAUTHENTICATED){var t=this.authState;this.authState=this.UNAUTHENTICATED,this.signedAuthToken=null,this.authToken=null;var e={oldState:t,newState:this.authState};o.prototype.emit.call(this,"authStateChange",e),t==this.AUTHENTICATED&&o.prototype.emit.call(this,"deauthenticate"),o.prototype.emit.call(this,"authTokenChange",this.signedAuthToken)}},b.prototype._changeToAuthenticatedState=function(t){if(this.signedAuthToken=t,this.authToken=this._extractAuthTokenData(t),this.authState!=this.AUTHENTICATED){var e=this.authState;this.authState=this.AUTHENTICATED;var r={oldState:e,newState:this.authState,signedAuthToken:t,authToken:this.authToken};this.processPendingSubscriptions(),o.prototype.emit.call(this,"authStateChange",r),o.prototype.emit.call(this,"authenticate",t)}o.prototype.emit.call(this,"authTokenChange",t)},b.prototype.decodeBase64=function(t){var r;void 0===n?r=e.atob?e.atob(t):p.decode(t):r=new n(t,"base64").toString("utf8");return r},b.prototype.encodeBase64=function(t){var r;void 0===n?r=e.btoa?e.btoa(t):p.encode(t):r=new n(t,"utf8").toString("base64");return r},b.prototype._extractAuthTokenData=function(t){var e=(t||"").split(".")[1];if(null!=e){var r=e;try{return r=this.decodeBase64(r),JSON.parse(r)}catch(t){return r}}return null},b.prototype.getAuthToken=function(){return this.authToken},b.prototype.getSignedAuthToken=function(){return this.signedAuthToken},b.prototype.authenticate=function(t,e){var r=this;this._changeToPendingAuthState(),this.emit("#authenticate",t,function(n,o){o&&o.authError&&(o.authError=l.hydrateError(o.authError)),n?(r._changeToUnauthenticatedState(),e&&e(n,o)):r.auth.saveToken(r.options.authTokenName,t,{},function(n){e&&e(n,o),n?(r._changeToUnauthenticatedState(),r._onSCError(n)):o.isAuthenticated?r._changeToAuthenticatedState(t):r._changeToUnauthenticatedState()})})},b.prototype._tryReconnect=function(t){var e,r=this,n=this.connectAttempts++,o=this.options.autoReconnectOptions;if(null==t||n>0){var i=Math.round(o.initialDelay+(o.randomness||0)*Math.random());e=Math.round(i*Math.pow(o.multiplier,n))}else e=t;e>o.maxDelay&&(e=o.maxDelay),clearTimeout(this._reconnectTimeoutRef),this.pendingReconnect=!0,this.pendingReconnectTimeout=e,this._reconnectTimeoutRef=setTimeout(function(){r.connect()},e)},b.prototype._onSCOpen=function(t){var e=this;t?(this.id=t.id,this.pingTimeout=t.pingTimeout,this.transport.pingTimeout=this.pingTimeout,t.isAuthenticated?this._changeToAuthenticatedState(t.authToken):this._changeToUnauthenticatedState()):this._changeToUnauthenticatedState(),this.connectAttempts=0,this.options.autoProcessSubscriptions?this.processPendingSubscriptions():this.pendingConnectCallback=!0,o.prototype.emit.call(this,"connect",t,function(){e.processPendingSubscriptions()}),this._flushEmitBuffer()},b.prototype._onSCError=function(t){var e=this;setTimeout(function(){if(e.listeners("error").length<1)throw t;o.prototype.emit.call(e,"error",t)},0)},b.prototype._suspendSubscriptions=function(){var t,e;for(var r in this._channels)this._channels.hasOwnProperty(r)&&(e=(t=this._channels[r]).state==t.SUBSCRIBED||t.state==t.PENDING?t.PENDING:t.UNSUBSCRIBED,this._triggerChannelUnsubscribe(t,e))},b.prototype._onSCClose=function(t,e,r){if(this.id=null,this.transport&&this.transport.off(),this.pendingReconnect=!1,this.pendingReconnectTimeout=null,clearTimeout(this._reconnectTimeoutRef),this._changeToPendingAuthState(),this._suspendSubscriptions(),this.options.autoReconnect&&(4e3==t||4001==t||1005==t?this._tryReconnect(0):1e3!=t&&t<4500&&this._tryReconnect()),r?o.prototype.emit.call(this,"connectAbort",t,e):o.prototype.emit.call(this,"disconnect",t,e),!b.ignoreStatuses[t]){var n;n=e?"Socket connection failed: "+e:"Socket connection failed for unknown reasons";var i=new g(b.errorStatuses[t]||n,t);this._onSCError(i)}},b.prototype._onSCEvent=function(t,e,r){var n=this._privateEventHandlerMap[t];n?n.call(this,e,r):o.prototype.emit.call(this,t,e,function(){r&&r.callback.apply(r,arguments)})},b.prototype.decode=function(t){return this.transport.decode(t)},b.prototype.encode=function(t){return this.transport.encode(t)},b.prototype._flushEmitBuffer=function(){for(var t,e=this._emitBuffer.head;e;){t=e.next;var r=e.data;e.detach(),this.transport.emitObject(r),e=t}},b.prototype._handleEventAckTimeout=function(t,e){e&&e.detach();var r=t.callback;if(r){delete t.callback;var n=new m("Event response for '"+t.event+"' timed out");r.call(t,n,t)}},b.prototype._emit=function(t,e,r){var n=this;this.state==this.CLOSED&&this.connect();var o={event:t,data:e,callback:r},i=new h.Item;this.options.cloneData?i.data=f(o):i.data=o,o.timeout=setTimeout(function(){n._handleEventAckTimeout(o,i)},this.ackTimeout),this._emitBuffer.append(i),this.state==this.OPEN&&this._flushEmitBuffer()},b.prototype.send=function(t){this.transport.send(t)},b.prototype.emit=function(t,e,r){null==this._localEvents[t]?this._emit(t,e,r):o.prototype.emit.call(this,t,e)},b.prototype.publish=function(t,e,r){var n={channel:this._decorateChannelName(t),data:e};this.emit("#publish",n,r)},b.prototype._triggerChannelSubscribe=function(t,e){var r=t.name;if(t.state!=t.SUBSCRIBED){var n=t.state;t.state=t.SUBSCRIBED;var i={channel:r,oldState:n,newState:t.state,subscriptionOptions:e};t.emit("subscribeStateChange",i),t.emit("subscribe",r,e),o.prototype.emit.call(this,"subscribeStateChange",i),o.prototype.emit.call(this,"subscribe",r,e)}},b.prototype._triggerChannelSubscribeFail=function(t,e,r){var n=e.name,i=!e.waitForAuth||this.authState==this.AUTHENTICATED;e.state!=e.UNSUBSCRIBED&&i&&(e.state=e.UNSUBSCRIBED,e.emit("subscribeFail",t,n,r),o.prototype.emit.call(this,"subscribeFail",t,n,r))},b.prototype._cancelPendingSubscribeCallback=function(t){null!=t._pendingSubscriptionCid&&(this.transport.cancelPendingResponse(t._pendingSubscriptionCid),delete t._pendingSubscriptionCid)},b.prototype._decorateChannelName=function(t){return this.channelPrefix&&(t=this.channelPrefix+t),t},b.prototype._undecorateChannelName=function(t){return this.channelPrefix&&0==t.indexOf(this.channelPrefix)?t.replace(this.channelPrefix,""):t},b.prototype._trySubscribe=function(t){var e=this,r=!t.waitForAuth||this.authState==this.AUTHENTICATED;if(this.state==this.OPEN&&!this.pendingConnectCallback&&null==t._pendingSubscriptionCid&&r){var n={noTimeout:!0},i={channel:this._decorateChannelName(t.name)};t.waitForAuth&&(n.waitForAuth=!0,i.waitForAuth=n.waitForAuth),t.data&&(i.data=t.data),t._pendingSubscriptionCid=this.transport.emit("#subscribe",i,n,function(r){delete t._pendingSubscriptionCid,r?e._triggerChannelSubscribeFail(r,t,i):e._triggerChannelSubscribe(t,i)}),o.prototype.emit.call(this,"subscribeRequest",t.name,i)}},b.prototype.subscribe=function(t,e){var r=this._channels[t];return r?e&&r.setOptions(e):(r=new i(t,this,e),this._channels[t]=r),r.state==r.UNSUBSCRIBED&&(r.state=r.PENDING,this._trySubscribe(r)),r},b.prototype._triggerChannelUnsubscribe=function(t,e){var r=t.name,n=t.state;if(t.state=e||t.UNSUBSCRIBED,this._cancelPendingSubscribeCallback(t),n==t.SUBSCRIBED){var i={channel:r,oldState:n,newState:t.state};t.emit("subscribeStateChange",i),t.emit("unsubscribe",r),o.prototype.emit.call(this,"subscribeStateChange",i),o.prototype.emit.call(this,"unsubscribe",r)}},b.prototype._tryUnsubscribe=function(t){if(this.state==this.OPEN){this._cancelPendingSubscribeCallback(t);var e=this._decorateChannelName(t.name);this.transport.emit("#unsubscribe",e,{noTimeout:!0})}},b.prototype.unsubscribe=function(t){var e=this._channels[t];e&&e.state!=e.UNSUBSCRIBED&&(this._triggerChannelUnsubscribe(e),this._tryUnsubscribe(e))},b.prototype.channel=function(t,e){var r=this._channels[t];return r||(r=new i(t,this,e),this._channels[t]=r),r},b.prototype.destroyChannel=function(t){var e=this._channels[t];e.unwatch(),e.unsubscribe(),delete this._channels[t]},b.prototype.subscriptions=function(t){var e,r=[];for(var n in this._channels)this._channels.hasOwnProperty(n)&&(e=this._channels[n],(t?e&&(e.state==e.SUBSCRIBED||e.state==e.PENDING):e&&e.state==e.SUBSCRIBED)&&r.push(n));return r},b.prototype.isSubscribed=function(t,e){var r=this._channels[t];return e?!!r&&(r.state==r.SUBSCRIBED||r.state==r.PENDING):!!r&&r.state==r.SUBSCRIBED},b.prototype.processPendingSubscriptions=function(){var t,e=this;for(var r in this.pendingConnectCallback=!1,this._channels)this._channels.hasOwnProperty(r)&&(t=this._channels[r]).state==t.PENDING&&e._trySubscribe(t)},b.prototype.watch=function(t,e){if("function"!=typeof e)throw new d("No handler function was provided");this._channelEmitter.on(t,e)},b.prototype.unwatch=function(t,e){e?this._channelEmitter.removeListener(t,e):this._channelEmitter.removeAllListeners(t)},b.prototype.watchers=function(t){return this._channelEmitter.listeners(t)},t.exports=b}).call(this,r(0),r(6).Buffer)},function(t,e){t.exports=function(t,e){if("$"!==e)for(var r=function(t){var e,r=/(?:\.(\w+))|(?:\[(\d+)\])|(?:\["((?:[^\\"]|\\.)*)"\])/g,n=[];for(;e=r.exec(t);)n.push(e[1]||e[2]||e[3]);return n}(e),n=0;n<r.length;n++)e=r[n].toString().replace(/\\"/g,'"'),void 0===t[e]&&n!==r.length-1||(t=t[e]);return t}},function(t,e,r){var n=r(33);e.stringify=function(t,e,r,o){if(arguments.length<4)try{return 1===arguments.length?JSON.stringify(t):JSON.stringify.apply(JSON,arguments)}catch(t){}var i=o||!1;"boolean"==typeof i&&(i={date:i,function:i,regex:i,undefined:i,error:i,symbol:i,map:i,set:i,nan:i,infinity:i});var s=n.decycle(t,i,e);return 1===arguments.length?JSON.stringify(s):JSON.stringify(s,e,r)},e.parse=function(t,e){var r,o=/"\$jsan"/.test(t);return r=1===arguments.length?JSON.parse(t):JSON.parse(t,e),o&&(r=n.retrocycle(r)),r}},function(t,e,r){"use strict";e.__esModule=!0;e.defaultSocketOptions={secure:!0,hostname:"remotedev.io",port:443,autoReconnect:!0,autoReconnectOptions:{randomness:6e4}}},function(t,e,r){"use strict";function n(t){return t&&("AndroidConstants"===t[0]||"PlatformConstants"===t[0])}t.exports=function(t){if("object"!=typeof __fbBatchedBridge||"localhost"!==t&&"127.0.0.1"!==t)return t;t=function(t){var e="undefined"!=typeof window&&window.__fbBatchedBridgeConfig&&window.__fbBatchedBridgeConfig.remoteModuleConfig;if(!Array.isArray(e)||"localhost"!==t&&"127.0.0.1"!==t)return t;var r=(e.find(n)||[])[1];return r?(r.ServerHost||t).split(":")[0]:t}(t);var e,r,o,i=console.warn;return console.warn=function(){if(!(arguments[0]&&arguments[0].indexOf("Requiring module 'NativeModules' by name")>-1))return i.apply(console,arguments)},"undefined"!=typeof window&&window.__DEV__&&"function"==typeof window.require?(e=window.require("NativeModules"),console.warn=i,e&&(e.PlatformConstants||e.AndroidConstants)?(r=e.PlatformConstants,o=e.AndroidConstants,((r?r.ServerHost:o.ServerHost)||t).split(":")[0]):t):t}},function(t,e,r){(function(e){var n=r(7),o=r(1).InvalidArgumentsError,i={};function s(t){var e=t.secure?"https://":"http://",r="";if(t.query)if("string"==typeof t.query)r=t.query;else{var n=[],o=t.query;for(var i in o)o.hasOwnProperty(i)&&n.push(i+"="+o[i]);n.length&&(r="?"+n.join("&"))}return e+(t.host?t.host:t.hostname+":"+t.port)+t.path+r}function a(){return e.location&&"https:"==location.protocol}function c(t,r){var n=null==t.secure?r:t.secure;return t.port||(e.location&&location.port?location.port:n?443:80)}t.exports={connect:function(t){if((t=t||{}).host&&t.port)throw new o("The host option should already include the port number in the format hostname:port - Because of this, the host and port options cannot be specified together; use the hostname option instead");var r=a(),u={port:c(t,r),hostname:e.location&&location.hostname,path:"/socketcluster/",secure:r,autoConnect:!0,autoReconnect:!0,autoProcessSubscriptions:!0,connectTimeout:2e4,ackTimeout:1e4,timestampRequests:!1,timestampParam:"t",authEngine:null,authTokenName:"socketCluster.authToken",binaryType:"arraybuffer",multiplex:!0,cloneData:!1};for(var h in t)t.hasOwnProperty(h)&&(u[h]=t[h]);var p=s(u);return!1===u.multiplex?new n(u):(i[p]?i[p].connect():i[p]=new n(u),i[p])},destroy:function(t){t=t||{};var r=a(),n={port:c(t,r),hostname:e.location&&location.hostname,path:"/socketcluster/",secure:r};for(var o in t)t.hasOwnProperty(o)&&(n[o]=t[o]);var u=s(n),h=i[u];h&&h.disconnect(),delete i[u]},connections:i}}).call(this,r(0))},function(t,e,r){(function(e){var r=function(){"use strict";function t(t,e){return null!=e&&t instanceof e}var r,n,o;try{r=Map}catch(t){r=function(){}}try{n=Set}catch(t){n=function(){}}try{o=Promise}catch(t){o=function(){}}function i(s,c,u,h,p){"object"==typeof c&&(u=c.depth,h=c.prototype,p=c.includeNonEnumerable,c=c.circular);var f=[],l=[],d=void 0!==e;return void 0===c&&(c=!0),void 0===u&&(u=1/0),function s(u,y){if(null===u)return null;if(0===y)return u;var g,m;if("object"!=typeof u)return u;if(t(u,r))g=new r;else if(t(u,n))g=new n;else if(t(u,o))g=new o(function(t,e){u.then(function(e){t(s(e,y-1))},function(t){e(s(t,y-1))})});else if(i.__isArray(u))g=[];else if(i.__isRegExp(u))g=new RegExp(u.source,a(u)),u.lastIndex&&(g.lastIndex=u.lastIndex);else if(i.__isDate(u))g=new Date(u.getTime());else{if(d&&e.isBuffer(u))return g=new e(u.length),u.copy(g),g;t(u,Error)?g=Object.create(u):void 0===h?(m=Object.getPrototypeOf(u),g=Object.create(m)):(g=Object.create(h),m=h)}if(c){var v=f.indexOf(u);if(-1!=v)return l[v];f.push(u),l.push(g)}for(var b in t(u,r)&&u.forEach(function(t,e){var r=s(e,y-1),n=s(t,y-1);g.set(r,n)}),t(u,n)&&u.forEach(function(t){var e=s(t,y-1);g.add(e)}),u){var E;m&&(E=Object.getOwnPropertyDescriptor(m,b)),E&&null==E.set||(g[b]=s(u[b],y-1))}if(Object.getOwnPropertySymbols){var S=Object.getOwnPropertySymbols(u);for(b=0;b<S.length;b++){var w=S[b];(!(_=Object.getOwnPropertyDescriptor(u,w))||_.enumerable||p)&&(g[w]=s(u[w],y-1),_.enumerable||Object.defineProperty(g,w,{enumerable:!1}))}}if(p){var T=Object.getOwnPropertyNames(u);for(b=0;b<T.length;b++){var _,k=T[b];(_=Object.getOwnPropertyDescriptor(u,k))&&_.enumerable||(g[k]=s(u[k],y-1),Object.defineProperty(g,k,{enumerable:!1}))}}return g}(s,u)}function s(t){return Object.prototype.toString.call(t)}function a(t){var e="";return t.global&&(e+="g"),t.ignoreCase&&(e+="i"),t.multiline&&(e+="m"),e}return i.clonePrototype=function(t){if(null===t)return null;var e=function(){};return e.prototype=t,new e},i.__objToStr=s,i.__isDate=function(t){return"object"==typeof t&&"[object Date]"===s(t)},i.__isArray=function(t){return"object"==typeof t&&"[object Array]"===s(t)},i.__isRegExp=function(t){return"object"==typeof t&&"[object RegExp]"===s(t)},i.__getRegExpFlags=a,i}();"object"==typeof t&&t.exports&&(t.exports=r)}).call(this,r(6).Buffer)},function(t,e){t.exports=function(t){return t.webpackPolyfill||(t.deprecate=function(){},t.paths=[],t.children||(t.children=[]),Object.defineProperty(t,"loaded",{enumerable:!0,get:function(){return t.l}}),Object.defineProperty(t,"id",{enumerable:!0,get:function(){return t.i}}),t.webpackPolyfill=1),t}},function(t,e,r){(function(t,n){var o;/*! http://mths.be/base64 v0.1.0 by @mathias | MIT license */!function(i){var s="object"==typeof e&&e,a=("object"==typeof t&&t&&t.exports,"object"==typeof n&&n);a.global!==a&&a.window;var c=function(t){this.message=t};(c.prototype=new Error).name="InvalidCharacterError";var u=function(t){throw new c(t)},h="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",p=/[\t\n\f\r ]/g,f={encode:function(t){t=String(t),/[^\0-\xFF]/.test(t)&&u("The string to be encoded contains characters outside of the Latin1 range.");for(var e,r,n,o,i=t.length%3,s="",a=-1,c=t.length-i;++a<c;)e=t.charCodeAt(a)<<16,r=t.charCodeAt(++a)<<8,n=t.charCodeAt(++a),s+=h.charAt((o=e+r+n)>>18&63)+h.charAt(o>>12&63)+h.charAt(o>>6&63)+h.charAt(63&o);return 2==i?(e=t.charCodeAt(a)<<8,r=t.charCodeAt(++a),s+=h.charAt((o=e+r)>>10)+h.charAt(o>>4&63)+h.charAt(o<<2&63)+"="):1==i&&(o=t.charCodeAt(a),s+=h.charAt(o>>2)+h.charAt(o<<4&63)+"=="),s},decode:function(t){var e=(t=String(t).replace(p,"")).length;e%4==0&&(e=(t=t.replace(/==?$/,"")).length),(e%4==1||/[^+a-zA-Z0-9/]/.test(t))&&u("Invalid character: the string to be decoded is not correctly encoded.");for(var r,n,o=0,i="",s=-1;++s<e;)n=h.indexOf(t.charAt(s)),r=o%4?64*r+n:n,o++%4&&(i+=String.fromCharCode(255&r>>(-2*o&6)));return i},version:"0.1.0"};void 0===(o=function(){return f}.call(e,r,e,t))||(t.exports=o)}()}).call(this,r(14)(t),r(0))},function(t,e,r){"use strict";var n,o;function i(){if(arguments.length)return i.from(arguments)}function s(){}n="An argument without append, prepend, or detach methods was given to `List",o=i.prototype,i.of=function(){return i.from.call(this,arguments)},i.from=function(t){var e,r,n,o=new this;if(t&&(e=t.length))for(r=-1;++r<e;)null!==(n=t[r])&&void 0!==n&&o.append(n);return o},o.head=null,o.tail=null,o.toArray=function(){for(var t=this.head,e=[];t;)e.push(t),t=t.next;return e},o.prepend=function(t){if(!t)return!1;if(!t.append||!t.prepend||!t.detach)throw new Error(n+"#prepend`.");var e;return this,(e=this.head)?e.prepend(t):(t.detach(),t.list=this,this.head=t,t)},o.append=function(t){if(!t)return!1;if(!t.append||!t.prepend||!t.detach)throw new Error(n+"#append`.");var e,r;return this,(r=this.tail)?r.append(t):(e=this.head)?e.append(t):(t.detach(),t.list=this,this.head=t,t)},i.Item=s;var a=s.prototype;a.next=null,a.prev=null,a.list=null,a.detach=function(){var t=this.list,e=this.prev,r=this.next;return t?(t.tail===this&&(t.tail=e),t.head===this&&(t.head=r),t.tail===t.head&&(t.tail=null),e&&(e.next=r),r&&(r.prev=e),this.prev=this.next=this.list=null,this):this},a.prepend=function(t){if(!(t&&t.append&&t.prepend&&t.detach))throw new Error(n+"Item#prepend`.");var e=this.list,r=this.prev;return!!e&&(t.detach(),r&&(t.prev=r,r.next=t),t.next=this,t.list=e,this.prev=t,this===e.head&&(e.head=t),e.tail||(e.tail=this),t)},a.append=function(t){if(!(t&&t.append&&t.prepend&&t.detach))throw new Error(n+"Item#append`.");var e=this.list,r=this.next;return!!e&&(t.detach(),r&&(t.next=r,r.prev=t),t.prev=this,t.list=e,this.next=t,this!==e.tail&&e.tail||(e.tail=t),t)},t.exports=i},function(t,e,r){"use strict";t.exports=r(16)},function(t,e){var r,n=(r="undefined"!=typeof WorkerGlobalScope?self:"undefined"!=typeof window&&window||function(){return this}()).WebSocket||r.MozWebSocket;function o(t,e,r){return e?new n(t,e):new n(t)}n&&(o.prototype=n.prototype),t.exports=n?o:null},function(t,e,r){"use strict";var n=function(t){switch(typeof t){case"string":return t;case"boolean":return t?"true":"false";case"number":return isFinite(t)?t:"";default:return""}};t.exports=function(t,e,r,a){return e=e||"&",r=r||"=",null===t&&(t=void 0),"object"==typeof t?i(s(t),function(s){var a=encodeURIComponent(n(s))+r;return o(t[s])?i(t[s],function(t){return a+encodeURIComponent(n(t))}).join(e):a+encodeURIComponent(n(t[s]))}).join(e):a?encodeURIComponent(n(a))+r+encodeURIComponent(n(t)):""};var o=Array.isArray||function(t){return"[object Array]"===Object.prototype.toString.call(t)};function i(t,e){if(t.map)return t.map(e);for(var r=[],n=0;n<t.length;n++)r.push(e(t[n],n));return r}var s=Object.keys||function(t){var e=[];for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&e.push(r);return e}},function(t,e,r){"use strict";function n(t,e){return Object.prototype.hasOwnProperty.call(t,e)}t.exports=function(t,e,r,i){e=e||"&",r=r||"=";var s={};if("string"!=typeof t||0===t.length)return s;var a=/\+/g;t=t.split(e);var c=1e3;i&&"number"==typeof i.maxKeys&&(c=i.maxKeys);var u=t.length;c>0&&u>c&&(u=c);for(var h=0;h<u;++h){var p,f,l,d,y=t[h].replace(a,"%20"),g=y.indexOf(r);g>=0?(p=y.substr(0,g),f=y.substr(g+1)):(p=y,f=""),l=decodeURIComponent(p),d=decodeURIComponent(f),n(s,l)?o(s[l])?s[l].push(d):s[l]=[s[l],d]:s[l]=d}return s};var o=Array.isArray||function(t){return"[object Array]"===Object.prototype.toString.call(t)}},function(t,e,r){(function(e){var n,o,i=r(2).SCEmitter,s=r(5).Response,a=r(4);e.WebSocket?(n=e.WebSocket,o=function(t,e){return new n(t)}):(n=r(18),o=function(t,e){return new n(t,null,e)});var c=r(1),u=c.TimeoutError,h=function(t,e,r){this.state=this.CLOSED,this.auth=t,this.codec=e,this.options=r,this.connectTimeout=r.connectTimeout,this.pingTimeout=r.ackTimeout,this.callIdGenerator=r.callIdGenerator,this._pingTimeoutTicker=null,this._callbackMap={},this.open()};h.prototype=Object.create(i.prototype),h.CONNECTING=h.prototype.CONNECTING="connecting",h.OPEN=h.prototype.OPEN="open",h.CLOSED=h.prototype.CLOSED="closed",h.prototype.uri=function(){var t,e=this.options.query||{},r=this.options.secure?"wss":"ws";if(this.options.timestampRequests&&(e[this.options.timestampParam]=(new Date).getTime()),(e=a.encode(e)).length&&(e="?"+e),this.options.host)t=this.options.host;else{var n="";this.options.port&&("wss"==r&&443!=this.options.port||"ws"==r&&80!=this.options.port)&&(n=":"+this.options.port),t=this.options.hostname+n}return r+"://"+t+this.options.path+e},h.prototype.open=function(){var t=this;this.state=this.CONNECTING;var e=this.uri(),r=o(e,this.options);r.binaryType=this.options.binaryType,this.socket=r,r.onopen=function(){t._onOpen()},r.onclose=function(e){var r;r=null==e.code?1005:e.code,t._onClose(r,e.reason)},r.onmessage=function(e,r){t._onMessage(e.data)},r.onerror=function(e){t.state===t.CONNECTING&&t._onClose(1006)},this._connectTimeoutRef=setTimeout(function(){t._onClose(4007),t.socket.close(4007)},this.connectTimeout)},h.prototype._onOpen=function(){var t=this;clearTimeout(this._connectTimeoutRef),this._resetPingTimeout(),this._handshake(function(e,r){e?(t._onError(e),t._onClose(4003),t.socket.close(4003)):(t.state=t.OPEN,i.prototype.emit.call(t,"open",r),t._resetPingTimeout())})},h.prototype._handshake=function(t){var e=this;this.auth.loadToken(this.options.authTokenName,function(r,n){if(r)t(r);else{e.emit("#handshake",{authToken:n},{force:!0},function(e,r){r&&(r.authToken=n,r.authError&&(r.authError=c.hydrateError(r.authError))),t(e,r)})}})},h.prototype._onClose=function(t,e){delete this.socket.onopen,delete this.socket.onclose,delete this.socket.onmessage,delete this.socket.onerror,clearTimeout(this._connectTimeoutRef),this.state==this.OPEN?(this.state=this.CLOSED,i.prototype.emit.call(this,"close",t,e)):this.state==this.CONNECTING&&(this.state=this.CLOSED,i.prototype.emit.call(this,"openAbort",t,e))},h.prototype._onMessage=function(t){i.prototype.emit.call(this,"event","message",t);var e=this.decode(t);if("#1"==e)this._resetPingTimeout(),this.socket.readyState==this.socket.OPEN&&this.sendObject("#2");else{var r=e.event;if(r){var n=new s(this,e.cid);i.prototype.emit.call(this,"event",r,e.data,n)}else if(null!=e.rid){var o=this._callbackMap[e.rid];if(o&&(clearTimeout(o.timeout),delete this._callbackMap[e.rid],o.callback)){var a=c.hydrateError(e.error);o.callback(a,e.data)}}else i.prototype.emit.call(this,"event","raw",e)}},h.prototype._onError=function(t){i.prototype.emit.call(this,"error",t)},h.prototype._resetPingTimeout=function(){var t=this;(new Date).getTime();clearTimeout(this._pingTimeoutTicker),this._pingTimeoutTicker=setTimeout(function(){t._onClose(4e3),t.socket.close(4e3)},this.pingTimeout)},h.prototype.getBytesReceived=function(){return this.socket.bytesReceived},h.prototype.close=function(t,e){if(t=t||1e3,this.state==this.OPEN){var r={code:t,data:e};this.emit("#disconnect",r),this._onClose(t,e),this.socket.close(t)}else this.state==this.CONNECTING&&(this._onClose(t,e),this.socket.close(t))},h.prototype.emitObject=function(t){var e={event:t.event,data:t.data};return t.callback&&(e.cid=t.cid=this.callIdGenerator(),this._callbackMap[t.cid]=t),this.sendObject(e),t.cid||null},h.prototype._handleEventAckTimeout=function(t){var e="Event response for '"+t.event+"' timed out",r=new u(e);t.cid&&delete this._callbackMap[t.cid];var n=t.callback;delete t.callback,n.call(t,r,t)},h.prototype.emit=function(t,e,r,n){var o,i,s=this;n?(i=r,o=n):r instanceof Function?(i={},o=r):i=r;var a={event:t,data:e,callback:o};o&&!i.noTimeout&&(a.timeout=setTimeout(function(){s._handleEventAckTimeout(a)},this.options.ackTimeout));var c=null;return(this.state==this.OPEN||i.force)&&(c=this.emitObject(a)),c},h.prototype.cancelPendingResponse=function(t){delete this._callbackMap[t]},h.prototype.decode=function(t){return this.codec.decode(t)},h.prototype.encode=function(t){return this.codec.encode(t)},h.prototype.send=function(t){this.socket.readyState!=this.socket.OPEN?this._onClose(1005):this.socket.send(t)},h.prototype.serializeObject=function(t){var e,r;try{e=this.encode(t)}catch(t){r=t,this._onError(r)}return r?null:e},h.prototype.sendObject=function(t){var e=this.serializeObject(t);null!=e&&this.send(e)},t.exports.SCTransport=h}).call(this,r(0))},function(t,e,r){(function(e){var r="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",n=/^[ \n\r\t]*[{\[]/,o=function(t,n){if(e.ArrayBuffer&&n instanceof e.ArrayBuffer)return{base64:!0,data:function(t){for(var e=new Uint8Array(t),n=e.length,o="",i=0;i<n;i+=3)o+=r[e[i]>>2],o+=r[(3&e[i])<<4|e[i+1]>>4],o+=r[(15&e[i+1])<<2|e[i+2]>>6],o+=r[63&e[i+2]];return n%3==2?o=o.substring(0,o.length-1)+"=":n%3==1&&(o=o.substring(0,o.length-2)+"=="),o}(n)};if(e.Buffer){if(n instanceof e.Buffer)return{base64:!0,data:n.toString("base64")};if(n&&"Buffer"===n.type&&Array.isArray(n.data))return{base64:!0,data:(e.Buffer.from?e.Buffer.from(n.data):new e.Buffer(n.data)).toString("base64")}}return n};t.exports.decode=function(t){if(null==t)return null;if("#1"===t||"#2"===t)return t;var e=t.toString();if(!n.test(e))return e;try{return JSON.parse(e)}catch(t){}return e},t.exports.encode=function(t){return"#1"===t||"#2"===t?t:JSON.stringify(t,o)}}).call(this,r(0))},function(t,e,r){(function(e){var r=function(){this._internalStorage={}};r.prototype._isLocalStorageEnabled=function(){var t;try{e.localStorage,e.localStorage.setItem("__scLocalStorageTest",1),e.localStorage.removeItem("__scLocalStorageTest")}catch(e){t=e}return!t},r.prototype.saveToken=function(t,r,n,o){this._isLocalStorageEnabled()&&e.localStorage?e.localStorage.setItem(t,r):this._internalStorage[t]=r,o&&o(null,r)},r.prototype.removeToken=function(t,r){var n;this.loadToken(t,function(t,e){n=e}),this._isLocalStorageEnabled()&&e.localStorage&&e.localStorage.removeItem(t),delete this._internalStorage[t],r&&r(null,n)},r.prototype.loadToken=function(t,r){r(null,this._isLocalStorageEnabled()&&e.localStorage?e.localStorage.getItem(t):this._internalStorage[t]||null)},t.exports.AuthEngine=r}).call(this,r(0))},function(t,e){t.exports=function(t){var e=[],r=[];return function t(n,o){var i,s,a;if(!("object"!=typeof n||null===n||n instanceof Boolean||n instanceof Date||n instanceof Number||n instanceof RegExp||n instanceof String)){for(i=0;i<e.length;i+=1)if(e[i]===n)return{$ref:r[i]};if(e.push(n),r.push(o),"[object Array]"===Object.prototype.toString.apply(n))for(a=[],i=0;i<n.length;i+=1)a[i]=t(n[i],o+"["+i+"]");else for(s in a={},n)Object.prototype.hasOwnProperty.call(n,s)&&(a[s]=t(n[s],o+"["+JSON.stringify(s)+"]"));return a}return n}(t,"$")}},function(t,e,r){var n=r(2).SCEmitter,o=function(t,e,r){n.call(this),this.PENDING="pending",this.SUBSCRIBED="subscribed",this.UNSUBSCRIBED="unsubscribed",this.name=t,this.state=this.UNSUBSCRIBED,this.client=e,this.options=r||{},this.setOptions(this.options)};(o.prototype=Object.create(n.prototype)).setOptions=function(t){t||(t={}),this.waitForAuth=t.waitForAuth||!1,void 0!==t.data&&(this.data=t.data)},o.prototype.getState=function(){return this.state},o.prototype.subscribe=function(t){this.client.subscribe(this.name,t)},o.prototype.unsubscribe=function(){this.client.unsubscribe(this.name)},o.prototype.isSubscribed=function(t){return this.client.isSubscribed(this.name,t)},o.prototype.publish=function(t,e){this.client.publish(this.name,t,e)},o.prototype.watch=function(t){this.client.watch(this.name,t)},o.prototype.unwatch=function(t){this.client.unwatch(this.name,t)},o.prototype.watchers=function(){return this.client.watchers(this.name)},o.prototype.destroy=function(){this.client.destroyChannel(this.name)},t.exports.SCChannel=o},function(t,e){t.exports.create=function(){function t(){}return function(e){if(1!=arguments.length)throw new Error("Object.create implementation only accepts one parameter.");return t.prototype=e,new t}}()},function(t,e){function r(t){if(t)return function(t){for(var e in r.prototype)t[e]=r.prototype[e];return t}(t)}t.exports=r,r.prototype.on=r.prototype.addEventListener=function(t,e){return this._callbacks=this._callbacks||{},(this._callbacks["$"+t]=this._callbacks["$"+t]||[]).push(e),this},r.prototype.once=function(t,e){function r(){this.off(t,r),e.apply(this,arguments)}return r.fn=e,this.on(t,r),this},r.prototype.off=r.prototype.removeListener=r.prototype.removeAllListeners=r.prototype.removeEventListener=function(t,e){if(this._callbacks=this._callbacks||{},0==arguments.length)return this._callbacks={},this;var r,n=this._callbacks["$"+t];if(!n)return this;if(1==arguments.length)return delete this._callbacks["$"+t],this;for(var o=0;o<n.length;o++)if((r=n[o])===e||r.fn===e){n.splice(o,1);break}return this},r.prototype.emit=function(t){this._callbacks=this._callbacks||{};var e=[].slice.call(arguments,1),r=this._callbacks["$"+t];if(r)for(var n=0,o=(r=r.slice(0)).length;n<o;++n)r[n].apply(this,e);return this},r.prototype.listeners=function(t){return this._callbacks=this._callbacks||{},this._callbacks["$"+t]||[]},r.prototype.hasListeners=function(t){return!!this.listeners(t).length}},function(t,e){var r={}.toString;t.exports=Array.isArray||function(t){return"[object Array]"==r.call(t)}},function(t,e){e.read=function(t,e,r,n,o){var i,s,a=8*o-n-1,c=(1<<a)-1,u=c>>1,h=-7,p=r?o-1:0,f=r?-1:1,l=t[e+p];for(p+=f,i=l&(1<<-h)-1,l>>=-h,h+=a;h>0;i=256*i+t[e+p],p+=f,h-=8);for(s=i&(1<<-h)-1,i>>=-h,h+=n;h>0;s=256*s+t[e+p],p+=f,h-=8);if(0===i)i=1-u;else{if(i===c)return s?NaN:1/0*(l?-1:1);s+=Math.pow(2,n),i-=u}return(l?-1:1)*s*Math.pow(2,i-n)},e.write=function(t,e,r,n,o,i){var s,a,c,u=8*i-o-1,h=(1<<u)-1,p=h>>1,f=23===o?Math.pow(2,-24)-Math.pow(2,-77):0,l=n?0:i-1,d=n?1:-1,y=e<0||0===e&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(a=isNaN(e)?1:0,s=h):(s=Math.floor(Math.log(e)/Math.LN2),e*(c=Math.pow(2,-s))<1&&(s--,c*=2),(e+=s+p>=1?f/c:f*Math.pow(2,1-p))*c>=2&&(s++,c/=2),s+p>=h?(a=0,s=h):s+p>=1?(a=(e*c-1)*Math.pow(2,o),s+=p):(a=e*Math.pow(2,p-1)*Math.pow(2,o),s=0));o>=8;t[r+l]=255&a,l+=d,a/=256,o-=8);for(s=s<<o|a,u+=o;u>0;t[r+l]=255&s,l+=d,s/=256,u-=8);t[r+l-d]|=128*y}},function(t,e,r){"use strict";e.byteLength=function(t){return 3*t.length/4-u(t)},e.toByteArray=function(t){var e,r,n,s,a,c=t.length;s=u(t),a=new i(3*c/4-s),r=s>0?c-4:c;var h=0;for(e=0;e<r;e+=4)n=o[t.charCodeAt(e)]<<18|o[t.charCodeAt(e+1)]<<12|o[t.charCodeAt(e+2)]<<6|o[t.charCodeAt(e+3)],a[h++]=n>>16&255,a[h++]=n>>8&255,a[h++]=255&n;2===s?(n=o[t.charCodeAt(e)]<<2|o[t.charCodeAt(e+1)]>>4,a[h++]=255&n):1===s&&(n=o[t.charCodeAt(e)]<<10|o[t.charCodeAt(e+1)]<<4|o[t.charCodeAt(e+2)]>>2,a[h++]=n>>8&255,a[h++]=255&n);return a},e.fromByteArray=function(t){for(var e,r=t.length,o=r%3,i="",s=[],a=0,c=r-o;a<c;a+=16383)s.push(h(t,a,a+16383>c?c:a+16383));1===o?(e=t[r-1],i+=n[e>>2],i+=n[e<<4&63],i+="=="):2===o&&(e=(t[r-2]<<8)+t[r-1],i+=n[e>>10],i+=n[e>>4&63],i+=n[e<<2&63],i+="=");return s.push(i),s.join("")};for(var n=[],o=[],i="undefined"!=typeof Uint8Array?Uint8Array:Array,s="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",a=0,c=s.length;a<c;++a)n[a]=s[a],o[s.charCodeAt(a)]=a;function u(t){var e=t.length;if(e%4>0)throw new Error("Invalid string. Length must be a multiple of 4");return"="===t[e-2]?2:"="===t[e-1]?1:0}function h(t,e,r){for(var o,i,s=[],a=e;a<r;a+=3)o=(t[a]<<16&16711680)+(t[a+1]<<8&65280)+(255&t[a+2]),s.push(n[(i=o)>>18&63]+n[i>>12&63]+n[i>>6&63]+n[63&i]);return s.join("")}o["-".charCodeAt(0)]=62,o["_".charCodeAt(0)]=63},function(t,e,r){var n=r(7),o=r(12);t.exports.SCSocketCreator=o,t.exports.SCSocket=n,t.exports.SCEmitter=r(2).SCEmitter,t.exports.connect=function(t){return o.connect(t)},t.exports.destroy=function(t){return o.destroy(t)},t.exports.connections=o.connections,t.exports.version="5.5.2"},function(t,e,r){var n=r(8),o=r(9);e.getRegexFlags=function(t){var e="";return t.ignoreCase&&(e+="i"),t.global&&(e+="g"),t.multiline&&(e+="m"),e},e.stringifyFunction=function(t,e){if("function"==typeof e)return e(t);var r=t.toString(),n=r.match(/^[^{]*{|^[^=]*=>/),o=n?n[0]:"<function> ",i="}"===r[r.length-1]?"}":"";return o.replace(/\r\n|\n/g," ").replace(/\s+/g," ")+" /* ... */ "+i},e.restore=function(t,e){var r=t[0],i=t.slice(1);switch(r){case"$":return n(e,t);case"r":var s=i.indexOf(","),a=i.slice(0,s),c=i.slice(s+1);return RegExp(c,a);case"d":return new Date(+i);case"f":var u=function(){throw new Error("can't run jsan parsed function")};return u.toString=function(){return i},u;case"u":return;case"e":var h=new Error(i);return h.stack="Stack is unavailable for jsan parsed errors",h;case"s":return Symbol(i);case"g":return Symbol.for(i);case"m":return new Map(o.parse(i));case"l":return new Set(o.parse(i));case"n":return NaN;case"i":return 1/0;case"y":return-1/0;default:return console.warn("unknown type",t),t}}},function(t,e,r){r(8);var n=r(32),o="undefined"!=typeof WeakMap?WeakMap:function(){var t=[],e=[];return{set:function(r,n){t.push(r),e.push(n)},get:function(r){for(var n=0;n<t.length;n++)if(t[n]===r)return e[n]}}};e.decycle=function t(e,r,i){"use strict";var s=new o,a=Object.prototype.hasOwnProperty.call(r,"circular");return function e(o,c,u){var h,p,f,l=i?i(u||"",o):o;if(r.date&&l instanceof Date)return{$jsan:"d"+l.getTime()};if(r.regex&&l instanceof RegExp)return{$jsan:"r"+n.getRegexFlags(l)+","+l.source};if(r.function&&"function"==typeof l)return{$jsan:"f"+n.stringifyFunction(l,r.function)};if(r.nan&&"number"==typeof l&&isNaN(l))return{$jsan:"n"};if(r.infinity){if(Number.POSITIVE_INFINITY===l)return{$jsan:"i"};if(Number.NEGATIVE_INFINITY===l)return{$jsan:"y"}}if(r[void 0]&&void 0===l)return{$jsan:"u"};if(r.error&&l instanceof Error)return{$jsan:"e"+l.message};if(r.symbol&&"symbol"==typeof l){var d=Symbol.keyFor(l);return void 0!==d?{$jsan:"g"+d}:{$jsan:"s"+l.toString().slice(7,-1)}}if(r.map&&"function"==typeof Map&&l instanceof Map&&"function"==typeof Array.from)return{$jsan:"m"+JSON.stringify(t(Array.from(l),r,i))};if(r.set&&"function"==typeof Set&&l instanceof Set&&"function"==typeof Array.from)return{$jsan:"l"+JSON.stringify(t(Array.from(l),r,i))};if(l&&"function"==typeof l.toJSON&&(l=l.toJSON(u)),!("object"!=typeof l||null===l||l instanceof Boolean||l instanceof Date||l instanceof Number||l instanceof RegExp||l instanceof String||"symbol"==typeof l||l instanceof Error)){if("object"==typeof l&&null!==l){var y=s.get(l);if(y)return a&&0===c.indexOf(y)?"function"==typeof r.circular?r.circular(l,c,y):r.circular:{$jsan:y};s.set(l,c)}if("[object Array]"===Object.prototype.toString.apply(l))for(f=[],h=0;h<l.length;h+=1)f[h]=e(l[h],c+"["+h+"]",h);else for(p in f={},l)if(Object.prototype.hasOwnProperty.call(l,p)){var g=/^\w+$/.test(p)?"."+p:"["+JSON.stringify(p)+"]";f[p]="$jsan"===p?[e(l[p],c+g)]:e(l[p],c+g,p)}return f}return l}(e,"$")},e.retrocycle=function(t){"use strict";return function e(r){var o,i,s;if(r&&"object"==typeof r)if("[object Array]"===Object.prototype.toString.apply(r))for(o=0;o<r.length;o+=1)(i=r[o])&&"object"==typeof i&&(i.$jsan?r[o]=n.restore(i.$jsan,t):e(i));else for(s in r){if("string"==typeof r[s]&&"$jsan"===s)return n.restore(r.$jsan,t);"$jsan"===s&&(r[s]=r[s][0]),"object"==typeof r[s]&&(i=r[s])&&"object"==typeof i&&(i.$jsan?r[s]=n.restore(i.$jsan,t):e(i))}return r}(t)}},function(t,e,r){t.exports=r(9)},function(t,e,r){"use strict";e.__esModule=!0,e.send=void 0,e.extractState=p,e.generateId=f,e.start=y,e.connect=m,e.connectViaExtension=v;var n=r(34),o=a(r(31)),i=a(r(11)),s=r(10);function a(t){return t&&t.__esModule?t:{default:t}}var c=void 0,u=void 0,h={};function p(t){if(t&&t.state)return"string"==typeof t.state?(0,n.parse)(t.state):t.state}function f(){return Math.random().toString(36).substr(2)}function l(t){t.payload||(t.payload=t.action),Object.keys(h).forEach(function(e){t.instanceId&&e!==t.instanceId||("function"==typeof h[e]?h[e](t):h[e].forEach(function(e){e(t)}))})}function d(t){if(!c){var e=void 0;e=t.port?{port:t.port,hostname:(0,i.default)(t.hostname||"localhost"),secure:!!t.secure}:s.defaultSocketOptions,c=o.default.connect(e),u||c.emit("login","master",function(t,e){t?console.log(t):((u=c.subscribe(e)).watch(l),c.on(e,l))})}}function y(t){t&&t.port&&!t.hostname&&(t.hostname="localhost"),d(t)}function g(t,e,r,o,i){y(r),setTimeout(function(){var s={payload:e?(0,n.stringify)(e):"",action:"ACTION"===o?(0,n.stringify)(function(t,e){if(t.action)return t;var r={timestamp:Date.now()};return t?e.getActionType?r.action=e.getActionType(t):"string"==typeof t?r.action={type:t}:t.type?r.action=t:r.action={type:"update"}:r.action={type:t},r}(t,r)):t,type:o||"ACTION",id:c.id,instanceId:i,name:r.name};c.emit(c.id?"log":"log-noid",s)},0)}function m(){var t=arguments.length<=0||void 0===arguments[0]?{}:arguments[0],e=f(t.instanceId);return y(t),{init:function(r,n){g(n||{},r,t,"INIT",e)},subscribe:function(t){if(t)return h[e]||(h[e]=[]),h[e].push(t),function(){var r=h[e].indexOf(t);h[e].splice(r,1)}},unsubscribe:function(){delete h[e]},send:function(r,n){r?g(r,n,t,"ACTION",e):g(void 0,n,t,"STATE",e)},error:function(t){c.emit({type:"ERROR",payload:t,id:c.id,instanceId:e})}}}function v(t){return t&&t.remote||"undefined"==typeof window||!window.devToolsExtension?m(t):window.devToolsExtension.connect(t)}e.send=g,e.default={connect:m,connectViaExtension:v,send:g,extractState:p,generateId:f}},function(t,e,r){"use strict";r.r(e);var n=r(3);window.RemoteDev={connectViaExtension:n.connectViaExtension,extractState:n.extractState}}]);;
  /* https://github.com/jonathantneal/closest */
  (function(w,p){p=w.Element.prototype
  if(!p.matches){p.matches=p.msMatchesSelector||function(s){var m=(this.document||this.ownerDocument).querySelectorAll(s);for(var i=0;m[i]&&m[i]!==e;++i);return!!m[i]}}
  if(!p.closest){p.closest=function(s){var e=this;while(e&&e.nodeType==1){if(e.matches(s))return e;e=e.parentNode}return null}}})(self);
  (function(){for(var i=0,t=["webkit","moz"],n=0;n<t.length&&!window.requestAnimationFrame;++n)window.requestAnimationFrame=window[t[n]+"RequestAnimationFrame"],window.cancelAnimationFrame=window[t[n]+"CancelAnimationFrame"]||window[t[n]+"CancelRequestAnimationFrame"];window.requestAnimationFrame||(window.requestAnimationFrame=function(n){var t=(new Date).getTime(),r=Math.max(0,16-(t-i)),u=window.setTimeout(function(){n(t+r)},r);return i=t+r,u});window.cancelAnimationFrame||(window.cancelAnimationFrame=function(n){clearTimeout(n)})})();
  (function(a){"use strict";var b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z,_0,_1,_2,_3,_4,_5,_6,_7,_8,_9,_,$,ba,bb,bc,bd,be,bf,bg,bh,bi,bj,bk,bl,bm,bn,bo,bp,bq,br,bs,bt,bu,bv,bw,bx,by,bz,bA,bB,bC,bD,bE,bF,bG,bH,bI,bJ,bK,bL,bM,bN,bO,bP,bQ,bR,bS,bT,bU,bV,bW,bX,bY,bZ,b0,b1,b2,b3,b4,b5,b6,b7,b8,b9,b_,b$,ca,cb,cc,cd,ce,cf,cg,ch,ci,cj,ck,cl;b=a.TodoMvc=a.TodoMvc||{};c=b.Client=b.Client||{};d=a.WebSharper=a.WebSharper||{};e=d.Operators=d.Operators||{};f=d.Mvu=d.Mvu||{};g=f.App=f.App||{};h=c.TodoList=c.TodoList||{};i=h.Model=h.Model||{};j=d.Obj=d.Obj||{};k=d.UI=d.UI||{};l=k.Var$1=k.Var$1||{};m=c.EndPoint=c.EndPoint||{};n=a.WebSharper$Mvu$TodoMvc_Router=a.WebSharper$Mvu$TodoMvc_Router||{};o=a.WebSharper$Mvu$TodoMvc_JsonEncoder=a.WebSharper$Mvu$TodoMvc_JsonEncoder||{};p=a.WebSharper$Mvu$TodoMvc_JsonDecoder=a.WebSharper$Mvu$TodoMvc_JsonDecoder||{};q=a.WebSharper$Mvu$TodoMvc_Templates=a.WebSharper$Mvu$TodoMvc_Templates||{};r=c.Entry=c.Entry||{};s=r.Message=r.Message||{};t=h.Message=h.Message||{};u=r.Model=r.Model||{};v=d.List=d.List||{};w=v.T=v.T||{};x=k.View=k.View||{};y=d.Arrays=d.Arrays||{};z=k.Templating=k.Templating||{};A=z.Runtime=z.Runtime||{};B=A.Server=A.Server||{};C=B.ProviderBuilder=B.ProviderBuilder||{};D=B.Handler=B.Handler||{};E=a.Event;F=a.UIEvent;G=k.AttrModule=k.AttrModule||{};H=k.Router=k.Router||{};I=k.Var=k.Var||{};J=d.Option=d.Option||{};K=k.Abbrev=k.Abbrev||{};L=K.Fresh=K.Fresh||{};M=d.Numeric=d.Numeric||{};N=d.Sitelets=d.Sitelets||{};O=N.RouterOperators=N.RouterOperators||{};P=d.ClientSideJson=d.ClientSideJson||{};Q=P.Provider=P.Provider||{};R=d.Seq=d.Seq||{};S=d.JavaScript=d.JavaScript||{};T=S.Pervasives=S.Pervasives||{};U=k.Snap=k.Snap||{};V=B.TemplateInstance=B.TemplateInstance||{};W=k.FromView=k.FromView||{};X=d.Unchecked=d.Unchecked||{};Y=a.System=a.System||{};Z=Y.Guid=Y.Guid||{};_0=d.Collections=d.Collections||{};_1=_0.List=_0.List||{};_2=k.Attrs=k.Attrs||{};_3=k.DomUtility=k.DomUtility||{};_4=N.RouterModule=N.RouterModule||{};_5=N.Route=N.Route||{};_6=S.JS=S.JS||{};_7=a.EventTarget;_8=a.Node;_9=a.WindowOrWorkerGlobalScope;_=N.Router=N.Router||{};$=N.List=N.List||{};ba=a.Object;bb=k.ConcreteVar=k.ConcreteVar||{};bc=d.Enumerator=d.Enumerator||{};bd=bc.T=bc.T||{};be=k.Doc=k.Doc||{};bf=k.AttrProxy=k.AttrProxy||{};bg=k.DynamicAttrNode=k.DynamicAttrNode||{};bh=d.Utils=d.Utils||{};bi=d.Strings=d.Strings||{};bj=d.Concurrency=d.Concurrency||{};bk=a.StartupCode$WebSharper_UI$Abbrev=a.StartupCode$WebSharper_UI$Abbrev||{};bl=_0.FSharpMap=_0.FSharpMap||{};bm=_0.Dictionary=_0.Dictionary||{};bn=_0.HashSet=_0.HashSet||{};bo=B.TemplateInitializer=B.TemplateInitializer||{};bp=k.CheckedInput=k.CheckedInput||{};bq=k.Client=k.Client||{};br=bq.Templates=bq.Templates||{};bs=k.Array=k.Array||{};bt=k.Docs=k.Docs||{};bu=_0.Map=_0.Map||{};bv=d.Lazy=d.Lazy||{};bw=_0.BalancedTree=_0.BalancedTree||{};bx=bw.Tree=bw.Tree||{};by=_0.Pair=_0.Pair||{};bz=_0.DictionaryUtil=_0.DictionaryUtil||{};bA=d.LazyExtensionsProxy=d.LazyExtensionsProxy||{};bB=bA.LazyRecord=bA.LazyRecord||{};bC=bj.Scheduler=bj.Scheduler||{};bD=N.PathUtil=N.PathUtil||{};bE=d.Queue=d.Queue||{};bF=k.DocElemNode=k.DocElemNode||{};bG=a.CharacterData;bH=a.StartupCode$WebSharper_UI$Templates=a.StartupCode$WebSharper_UI$Templates||{};bI=br.Prepare=br.Prepare||{};bJ=d.Slice=d.Slice||{};bK=k.Elt=k.Elt||{};bL=k.An=k.An||{};bM=bq.Settings=bq.Settings||{};bN=K.Mailbox=K.Mailbox||{};bO=a.StartupCode$WebSharper_UI$Attr_Client=a.StartupCode$WebSharper_UI$Attr_Client||{};bP=_0.MapUtil=_0.MapUtil||{};bQ=a.StartupCode$WebSharper_Main$Concurrency=a.StartupCode$WebSharper_Main$Concurrency||{};bR=bq.Attrs=bq.Attrs||{};bS=bR.Dyn=bR.Dyn||{};bT=k.Updates=k.Updates||{};bU=_0.ValueCollection=_0.ValueCollection||{};bV=bq.Docs=bq.Docs||{};bW=bV.RunState=bV.RunState||{};bX=bV.NodeSet=bV.NodeSet||{};bY=k.Anims=k.Anims||{};bZ=a.StartupCode$WebSharper_UI$Doc_Proxy=a.StartupCode$WebSharper_UI$Doc_Proxy||{};b0=k.BindVar=k.BindVar||{};b1=k.String=k.String||{};b2=_0.KeyCollection=_0.KeyCollection||{};b3=bj.CT=bj.CT||{};b4=d.CancellationTokenSource=d.CancellationTokenSource||{};b5=bj.AsyncBody=bj.AsyncBody||{};b6=_0.HashSetUtil=_0.HashSetUtil||{};b7=a.StartupCode$WebSharper_UI$DomUtility=a.StartupCode$WebSharper_UI$DomUtility||{};b8=a.StartupCode$WebSharper_UI$Animation=a.StartupCode$WebSharper_UI$Animation||{};b9=k.AppendList=k.AppendList||{};b_=d.Char=d.Char||{};b$=k.Easing=k.Easing||{};ca=K.HashSet=K.HashSet||{};cb=bV.DomNodes=bV.DomNodes||{};cc=a.Error;cd=d.OperationCanceledException=d.OperationCanceledException||{};ce=a.StartupCode$WebSharper_UI$AppendList=a.StartupCode$WebSharper_UI$AppendList||{};cf=a.IntelliFactory;cg=cf&&cf.Runtime;ch=a.JSON;ci=a.RemoteDev;cj=a.console;ck=a.Math;cl=a.Date;c.Main=function(){var cm,cn,co,cp;g.Run((cm=(cn=g.CreateSimple(i.get_Empty(),h.Update,function(cq){return function(cr){return h.Render(cq,cr);};}),(co=n.r(),g.withRouting(l.Lens(cn.Var,function(cq){return cq.EndPoint;},function(cq,cr){return i.New(cr,cq.NewTask,cq.Entries,cq.NextKey);}),co,function(cq){return cq.EndPoint;},cn))),g.withRemoteDev({Encode:o.j(),Decode:p.j()},{Encode:o.j$2(),Decode:p.j$2()},(cp={},cp.hostname="localhost",cp.port=8000,cp),cm)));};e.FailWith=function(cm){throw new cc(cm);};e.KeyValue=function(cm){return[cm.K,cm.V];};g.CreateSimple=function(cm,cn,co){function cp(cq,cr,cs){return{$:1,$0:cn(cr,cs)};}return g.create(cm,cg.Curried3(cp),co);};g.withRouting=function(cm,cn,co,cp){return g.New(function(cq){cp.Init(cq);H.InstallHashInto(cm,co(cp.Var.Get()),cn);},cp.Var,cp.View,cp.Update,cp.Render);};g.Run=function(cm){function cn(co){cm.Var.UpdateMaybe((cm.Update(cn))(co));}cm.Init(cn);return(cm.Render(cn))(cm.View);};g.create=function(cm,cn,co){var cp;cp=l.Create$1(cm);return g.New(a.ignore,cp,cp.get_View(),cn,co);};g.withRemoteDev=function(cm,cn,co,cp){var cq;function cr(ct){return typeof ct=="string"?cn.Decode(ch.parse(ct)):cn.Decode(ct);}function cs(ct,cu,cv){var cw;cw=((cp.Update(ct))(cu))(cv);if(cw==null);else cq.send(cm.Encode(cu),cn.Encode(cw.$0));return cw;}cq=ci.connectViaExtension(co);cq.subscribe(function(ct){var cu;if(ct.type==="DISPATCH"){switch(ct.payload.type){case"JUMP_TO_STATE":case"JUMP_TO_ACTION":cp.Var.Set(cr(ci.extractState(ct)));break;case"IMPORT_STATE":cp.Var.Set(cr(y.last(ct.payload.nextLiftedState.computedStates).state));cq.send(null,ct.payload.nextLiftedState);break;default:null;break;}}});return g.New(function(ct){cp.Init(ct);x.Get(function(cu){cq.init(cn.Encode(cu));},cp.View);},cp.Var,cp.View,cg.Curried3(cs),cp.Render);};i.get_Empty=function(){return i.New(m.All,"",w.Empty,0);};i.New=function(cm,cn,co,cp){return{EndPoint:cm,NewTask:cn,Entries:co,NextKey:cp};};h.Update=function(cm,cn){var co,cp,cq;return cm.$==1?i.New(cn.EndPoint,"",v.append(cn.Entries,v.ofArray([r.New(cn.NextKey,cn.NewTask)])),cn.NextKey+1):cm.$==2?i.New(cn.EndPoint,cn.NewTask,v.filter(function(cr){return!cr.IsCompleted;},cn.Entries),cn.NextKey):cm.$==3?(co=cm.$0,i.New(cn.EndPoint,cn.NewTask,v.map(function(cr){return u.New(cr.Id,cr.Task,co,cr.Editing);},cn.Entries),cn.NextKey)):cm.$==4?(cp=cm.$1,(cq=cm.$0,i.New(cn.EndPoint,cn.NewTask,v.choose(function(cr){return r.KeyOf(cr)===cq?r.Update(cp,cr):{$:1,$0:cr};},cn.Entries),cn.NextKey))):i.New(cn.EndPoint,cm.$0,cn.Entries,cn.NextKey);};h.Render=function(cm,cn){var co,cp,cq,cr,cs,ct,cu,cv,cw,cx,cy,cz,cA,cB,cC,cD,cE,cF,cG;co=x.Map(function(cH){return v.length(v.filter(function(cI){return!cI.IsCompleted;},cH.Entries));},cn);cp=(cq=G.DynamicClassPred("selected",x.Map(function(cH){return cH.EndPoint.$===2;},cn)),(cr=(cs=G.DynamicClassPred("selected",x.Map(function(cH){return cH.EndPoint.$===1;},cn)),(ct=(cu=G.DynamicClassPred("selected",x.Map(function(cH){return cH.EndPoint.$===0;},cn)),(cv=(cw=x.Map(function(cH){return cH===1?"1 item left":a.String(cH)+" items left";},co),(cx=(cy=(cz=x.Map(function(cH){return cH.NewTask;},cn),(cA=(cB=x.Map(function(cH){return cH===0;},co),(cC=(cD=(cE=be.ConvertSeqBy(r.KeyOf,function(cH){return function(cI){return r.Render(function(cJ){cm({$:4,$0:cH,$1:cJ});},x.Map(function(cJ){return cJ.EndPoint;},cn),cI);};},x.Map(function(cH){return cH.Entries;},cn)),(cF=new C.New$1(),(cF.h.push({$:0,$0:"entries",$1:cE}),cF))),(cD.h.push(D.EventQ2(cD.k,"clearcompleted",function(){return cD.i;},function(){cm(t.ClearCompleted);})),cD)),(cC.h.push({$:9,$0:"iscompleted",$1:new W.New(cB,function(cH){cm({$:3,$0:cH});})}),cC))),(cA.h.push({$:8,$0:"task",$1:new W.New(cz,function(cH){cm({$:0,$0:cH});})}),cA))),(cy.h.push(D.EventQ2(cy.k,"edit",function(){return cy.i;},function(cH){if(cH.Event.key==="Enter"){cm(t.AddEntry);cH.Event.preventDefault();}})),cy)),(cx.h.push({$:2,$0:"itemsleft",$1:cw}),cx))),(cv.h.push({$:3,$0:"cssfilterall",$1:cu}),cv))),(ct.h.push({$:3,$0:"cssfilteractive",$1:cs}),ct))),(cr.h.push({$:3,$0:"cssfiltercompleted",$1:cq}),cr)));cG=D.CompleteHoles(cp.k,cp.h,[["task",0],["iscompleted",2]]);cp.i=new V.New(cG[1],br.RunFullDocTemplate(cG[0]));};j=d.Obj=cg.Class({Equals:function(cm){return this===cm;},GetHashCode:function(){return -1;}},null,j);j.New=cg.Ctor(function(){},j);l=k.Var$1=cg.Class({},j,l);l.Lens=function(cm,cn,co){var cp,cq,cr;cp=L.Id();cq=x.Map(cn,cm.get_View());cr=new I({Get:function(){return cn(cm.Get());},Set:function(cs){return cm.Update(function(ct){return co(ct,cs);});},SetFinal:function(cs){return this.Set(cs);},Update:function(cs){return cm.Update(function(ct){return co(ct,cs(cn(ct)));});},UpdateMaybe:function(cs){return cm.UpdateMaybe(function(ct){var cu;cu=cs(cn(ct));return cu==null?null:{$:1,$0:co(ct,cu.$0)};});},get_View:function(){return cq;},get_Id:function(){return cp;}});I.New.call(cr);return cr;};l.Create$1=function(cm){return new bb.New(false,U.New({$:2,$0:cm,$1:[]}),cm);};l.Set=function(cm,cn){cm.Set(cn);};g.New=function(cm,cn,co,cp,cq){return{Init:cm,Var:cn,View:co,Update:cp,Render:cq};};m.All={$:0};n.r=function(){return O.JSUnion(void 0,[[null,[[null,[]]],[]],[null,[[null,["active"]]],[]],[null,[[null,["completed"]]],[]]]);};o.j=function(){return o._v?o._v:o._v=(Q.EncodeUnion(void 0,"type",[["EditNewTask",[["$0","text",Q.Id(),0]]],["AddEntry",[]],["ClearCompleted",[]],["SetAllCompleted",[["$0","completed",Q.Id(),0]]],["EntryMessage",[["$0","key",Q.Id(),0],["$1","message",o.j$1,0]]]]))();};p.j=function(){return p._v?p._v:p._v=(Q.DecodeUnion(void 0,"type",[["EditNewTask",[["$0","text",Q.Id(),0]]],["AddEntry",[]],["ClearCompleted",[]],["SetAllCompleted",[["$0","completed",Q.Id(),0]]],["EntryMessage",[["$0","key",Q.Id(),0],["$1","message",p.j$1,0]]]]))();};o.j$2=function(){return o._v$2?o._v$2:o._v$2=(Q.EncodeRecord(void 0,[["EndPoint",o.j$3,0],["NewTask",Q.Id(),0],["Entries",Q.EncodeList(o.j$4),0],["NextKey",Q.Id(),0]]))();};p.j$2=function(){return p._v$2?p._v$2:p._v$2=(Q.DecodeRecord(void 0,[["EndPoint",p.j$3,0],["NewTask",Q.Id(),0],["Entries",Q.DecodeList(p.j$4),0],["NextKey",Q.Id(),0]]))();};o.j$1=function(){return o._v$1?o._v$1:o._v$1=(Q.EncodeUnion(void 0,"type",[["Remove",[]],["StartEdit",[]],["Edit",[["$0","text",Q.Id(),0]]],["CommitEdit",[]],["CancelEdit",[]],["SetCompleted",[["$0","completed",Q.Id(),0]]]]))();};p.j$1=function(){return p._v$1?p._v$1:p._v$1=(Q.DecodeUnion(void 0,"type",[["Remove",[]],["StartEdit",[]],["Edit",[["$0","text",Q.Id(),0]]],["CommitEdit",[]],["CancelEdit",[]],["SetCompleted",[["$0","completed",Q.Id(),0]]]]))();};o.j$3=function(){return o._v$3?o._v$3:o._v$3=(Q.EncodeUnion(void 0,"$",[[0,[]],[1,[]],[2,[]]]))();};o.j$4=function(){return o._v$4?o._v$4:o._v$4=(Q.EncodeRecord(void 0,[["Id",Q.Id(),0],["Task",Q.Id(),0],["IsCompleted",Q.Id(),0],["Editing",Q.Id(),1]]))();};p.j$3=function(){return p._v$3?p._v$3:p._v$3=(Q.DecodeUnion(void 0,"$",[[0,[]],[1,[]],[2,[]]]))();};p.j$4=function(){return p._v$4?p._v$4:p._v$4=(Q.DecodeRecord(void 0,[["Id",Q.Id(),0],["Task",Q.Id(),0],["IsCompleted",Q.Id(),0],["Editing",Q.Id(),1]]))();};q.entry=function(cm){br.LoadLocalTemplates("index");return cm?br.NamedTemplate("index",{$:1,$0:"entry"},cm):void 0;};s.CommitEdit={$:3};s.CancelEdit={$:4};s.Remove={$:0};s.StartEdit={$:1};t.ClearCompleted={$:2};t.AddEntry={$:1};u.New=function(cm,cn,co,cp){return{Id:cm,Task:cn,IsCompleted:co,Editing:cp};};w=v.T=cg.Class({GetEnumerator:function(){return new bd.New(this,null,function(cm){var cn;cn=cm.s;return cn.$==0?false:(cm.c=cn.$0,cm.s=cn.$1,true);},void 0);},GetEnumerator0:function(){return bc.Get(this);}},null,w);w.Empty=new w({$:0});v.ofArray=function(cm){var cn,co,cp;cn=w.Empty;for(co=y.length(cm)-1,cp=0;co>=cp;co--)cn=new w({$:1,$0:y.get(cm,co),$1:cn});return cn;};v.filter=function(cm,cn){return v.ofSeq(R.filter(cm,cn));};v.map=function(cm,cn){var co,cp,cq,cr,cs;if(cn.$==0)return cn;else{cr=new w({$:1});co=cr;cp=cn;cq=true;while(cq){co.$0=cm(cp.$0);cp=cp.$1;if(cp.$==0)cq=false;else co=(cs=new w({$:1}),co.$1=cs,cs);}co.$1=w.Empty;return cr;}};v.choose=function(cm,cn){return v.ofSeq(R.choose(cm,cn));};v.length=function(cm){var cn,co;cn=cm;co=0;while(cn.$==1){cn=v.tail(cn);co=co+1;}return co;};v.append=function(cm,cn){var co,cp,cq,cr,cs;if(cm.$==0)return cn;else if(cn.$==0)return cm;else{cr=new w({$:1});co=cr;cp=cm;cq=true;while(cq){co.$0=cp.$0;cp=cp.$1;if(cp.$==0)cq=false;else co=(cs=new w({$:1}),co.$1=cs,cs);}co.$1=cn;return cr;}};v.ofSeq=function(cm){var cn,co,cp,cq,cr,cs;if(cm instanceof w)return cm;else if(cm instanceof a.Array)return v.ofArray(cm);else{cn=bc.Get(cm);try{cp=cn.MoveNext();if(!cp)co=w.Empty;else{cr=new w({$:1});cq=cr;while(cp){cq.$0=cn.Current();if(cn.MoveNext())cq=(cs=new w({$:1}),cq.$1=cs,cs);else cp=false;}cq.$1=w.Empty;co=cr;}return co;}finally{if(typeof cn=="object"&&"Dispose"in cn)cn.Dispose();}}};v.rev=function(cm){var cn,co;cn=w.Empty;co=cm;while(co.$==1){cn=new w({$:1,$0:co.$0,$1:cn});co=co.$1;}return cn;};v.iter=function(cm,cn){var co;co=cn;while(co.$==1){cm(v.head(co));co=v.tail(co);}};v.init=function(cm,cn){return v.ofArray(y.init(cm,cn));};v.tail=function(cm){return cm.$==1?cm.$1:v.listEmpty();};v.listEmpty=function(){return e.FailWith("The input list was empty.");};v.head=function(cm){return cm.$==1?cm.$0:v.listEmpty();};r.New=function(cm,cn){return u.New(cm,cn,false,null);};r.KeyOf=function(cm){return cm.Id;};r.Update=function(cm,cn){var co,cp;return cm.$==1?{$:1,$0:u.New(cn.Id,cn.Task,cn.IsCompleted,(co=cn.Editing,co==null?{$:1,$0:cn.Task}:co))}:cm.$==2?{$:1,$0:u.New(cn.Id,cn.Task,cn.IsCompleted,{$:1,$0:cm.$0})}:cm.$==3?{$:1,$0:u.New(cn.Id,(cp=cn.Editing,cp==null?cn.Task:cp.$0),cn.IsCompleted,null)}:cm.$==4?{$:1,$0:u.New(cn.Id,cn.Task,cn.IsCompleted,null)}:cm.$==5?{$:1,$0:u.New(cn.Id,cn.Task,cm.$0,cn.Editing)}:null;};r.Render=function(cm,cn,co){var cp,cq,cr,cs,ct,cu,cv,cw,cx,cy,cz,cA,cB,cC,cD;return(cp=(cq=(cr=(cs=x.Map(function(cE){return cE.IsCompleted;},co),(ct=(cu=(cv=(cw=x.Map(function(cE){var cF;cF=cE.Editing;return cF==null?"":cF.$0;},co),(cx=(cy=[G.DynamicClassPred("completed",x.Map(function(cE){return cE.IsCompleted;},co)),G.DynamicClassPred("editing",x.Map(function(cE){return cE.Editing!=null;},co)),G.DynamicClassPred("hidden",x.Map2(function(cE,cF){return cE.$==2?!cF.IsCompleted:cE.$==1&&cF.IsCompleted;},cn,co))],(cz=(cA=be.TextView(x.Map(function(cE){return cE.Task;},co)),(cB=new C.New$1(),(cB.h.push({$:0,$0:"label",$1:cA}),cB))),(cz.h.push({$:3,$0:"cssattrs",$1:bf.Concat(cy)}),cz))),(cx.h.push({$:8,$0:"editingtask",$1:new W.New(cw,function(cE){cm({$:2,$0:cE});})}),cx))),(cv.h.push(D.EventQ2(cv.k,"editblur",function(){return cv.i;},function(){cm(s.CommitEdit);})),cv)),(cu.h.push(D.EventQ2(cu.k,"editkeyup",function(){return cu.i;},function(cE){var cF;cF=cE.Event.key;if(cF==="Enter")cm(s.CommitEdit);else cF==="Escape"?cm(s.CancelEdit):void 0;})),cu)),(ct.h.push({$:9,$0:"iscompleted",$1:new W.New(cs,function(cE){cm({$:5,$0:cE});})}),ct))),(cr.h.push(D.EventQ2(cr.k,"remove",function(){return cr.i;},function(){cm(s.Remove);})),cr)),(cq.h.push(D.EventQ2(cq.k,"startedit",function(){return cq.i;},function(){cm(s.StartEdit);})),cq)),(cC=D.CompleteHoles(cp.k,cp.h,[["iscompleted",2],["editingtask",0]]),(cD=new V.New(cC[1],q.entry(cC[0])),cp.i=cD,cD))).get_Doc();};x.Map=function(cm,cn){return x.CreateLazy(function(){return U.Map(cm,cn());});};x.CreateLazy=function(cm){var cn;cn={c:null,o:cm};return function(){var co,cp;co=cn.c;return co===null?(co=cn.o(),cn.c=co,(cp=co.s,cp!=null&&cp.$==0)?cn.o=null:U.WhenObsoleteRun(co,function(){cn.c=null;}),co):co;};};x.Map2=function(cm,cn,co){return x.CreateLazy(function(){return U.Map2(cm,cn(),co());});};x.Sink=function(cm,cn){function co(){U.WhenRun(cn(),cm,function(){bj.scheduler().Fork(co);});}bj.scheduler().Fork(co);};x.Get=function(cm,cn){var co;function cp(){U.WhenRun(cn(),function(cq){if(!co[0]){co[0]=true;cm(cq);}},function(){if(!co[0])cp();});}co=[false];cp();};x.TryGet=function(cm){return U.TryGet(cm());};x.MapSeqCachedViewBy=function(cm,cn,co){var cp;cp=[new bm.New$5()];return x.Map(function(cq){var cr,cs,ct;cr=cp[0];cs=new bm.New$5();ct=bs.mapInPlace(function(cu){var cv,cw,cx;cv=cm(cu);cw=cr.ContainsKey(cv)?(cx=cr.get_Item(cv),(l.Set(cx.r,cu),cx)):x.ConvertSeqNode(function(cy){return cn(cv,cy);},cu);cs.set_Item(cv,cw);return cw.e;},y.ofSeq(cq));cp[0]=cs;return ct;},co);};x.Const=function(cm){var cn;cn=U.New({$:0,$0:cm});return function(){return cn;};};x.ConvertSeqNode=function(cm,cn){var co,cp;co=l.Create$1(cn);cp=co.get_View();return{e:cm(cp),r:co,w:cp};};x.Bind=function(cm,cn){return x.Join(x.Map(cm,cn));};x.Map3=function(cm,cn,co,cp){return x.CreateLazy(function(){return U.Map3(cm,cn(),co(),cp());});};x.Sequence=function(cm){return x.CreateLazy(function(){return U.Sequence(R.map(function(cn){return cn();},cm));});};x.Map2Unit=function(cm,cn){return x.CreateLazy(function(){return U.Map2Unit(cm(),cn());});};x.Join=function(cm){return x.CreateLazy(function(){return U.Join(cm());});};y.get=function(cm,cn){y.checkBounds(cm,cn);return cm[cn];};y.length=function(cm){return cm.dims===2?cm.length*cm.length:cm.length;};y.checkBounds=function(cm,cn){if(cn<0||cn>=cm.length)e.FailWith("Index was outside the bounds of the array.");};y.set=function(cm,cn,co){y.checkBounds(cm,cn);cm[cn]=co;};C=B.ProviderBuilder=cg.Class({},j,C);C.New$1=cg.Ctor(function(){var cm;j.New.call(this);this.i=null;this.k=(cm=Z.NewGuid(),a.String(cm));this.h=[];cg.SetOptional(this,"s",null);},C);x=k.View=cg.Class({},null,x);D.EventQ2=function(cm,cn,co,cp){return{$:5,$0:cn,$1:function(cq){return function(cr){return cp({Vars:co(),Target:cq,Event:cr});};}};};D.CompleteHoles=function(cm,cn,co){var cq,cr,cs,ct,cu;function cp(cv,cw){var cx;return cr.Contains(cv)?null:(cx=cw===0?bo.GetOrAddHoleFor(cm,cv,function(){return{$:8,$0:cv,$1:l.Create$1("")};}):cw===1?bo.GetOrAddHoleFor(cm,cv,function(){return{$:13,$0:cv,$1:l.Create$1(0)};}):cw===2?bo.GetOrAddHoleFor(cm,cv,function(){return{$:9,$0:cv,$1:l.Create$1(false)};}):e.FailWith("Invalid value type"),(cq.set_Item(cv,cx),{$:1,$0:cx}));}cq=new bm.New$5();cr=new bn.New$3();cs=bc.Get(cn);try{while(cs.MoveNext()){ct=cs.Current();cu=ct.$0;cr.Add(cu);cq.set_Item(cu,ct);}}finally{if(typeof cs=="object"&&"Dispose"in cs)cs.Dispose();}return[R.append(cn,y.choose(function(cv){return cp(cv[0],cv[1]);},co)),{$:0,$0:cq}];};G.ClassPred=function(cm,cn){return _2.Static(function(co){if(cn)_3.AddClass(co,cm);else _3.RemoveClass(co,cm);});};G.DynamicClassPred=function(cm,cn){return _2.Dynamic(cn,function(co){return function(cp){return cp?_3.AddClass(co,cm):_3.RemoveClass(co,cm);};});};G.Handler=function(cm,cn){return _2.Static(function(co){co.addEventListener(cm,function(cp){return(cn(co))(cp);},false);});};G.OnAfterRender=function(cm){return new bf({$:4,$0:cm});};G.Value=function(cm){var cn;cn=(((b0.StringApply())(cm))(_2.Static))(function(co){return G.DynamicCustom(co,cm.get_View());});return bf.Append(cn[0],cn[1]);};G.Checked=function(cm){var cn;cn=(((b0.BoolCheckedApply())(cm))(_2.Static))(function(co){return G.DynamicCustom(co,cm.get_View());});return bf.Append(cn[0],cn[1]);};G.IntValue=function(cm){var cn;cn=(((b0.IntApplyChecked())(cm))(_2.Static))(function(co){return G.DynamicCustom(co,cm.get_View());});return bf.Append(cn[0],cn[1]);};G.IntValueUnchecked=function(cm){var cn;cn=(((b0.IntApplyUnchecked())(cm))(_2.Static))(function(co){return G.DynamicCustom(co,cm.get_View());});return bf.Append(cn[0],cn[1]);};G.FloatValue=function(cm){var cn;cn=(((b0.FloatApplyChecked())(cm))(_2.Static))(function(co){return G.DynamicCustom(co,cm.get_View());});return bf.Append(cn[0],cn[1]);};G.FloatValueUnchecked=function(cm){var cn;cn=(((b0.FloatApplyUnchecked())(cm))(_2.Static))(function(co){return G.DynamicCustom(co,cm.get_View());});return bf.Append(cn[0],cn[1]);};G.Dynamic=function(cm,cn){return _2.Dynamic(cn,function(co){return function(cp){return co.setAttribute(cm,cp);};});};G.DynamicCustom=function(cm,cn){return _2.Dynamic(cn,cm);};H.InstallHashInto=function(cm,cn,co){function cp(cs){return _4.Parse(co,_5.FromHash(cs,{$:1,$0:true}));}function cq(){return H.getCurrentHash(cp,cn);}function cr(cs){if(!X.Equals(cm.Get(),cs))cm.Set(cs);}cr(cq());self.addEventListener("popstate",function(){return cr(cq());},false);self.addEventListener("hashchange",function(){return cr(cq());},false);self.document.body.addEventListener("click",function(cs){var ct,cu,cv;ct=(cu=H.findLinkHref(cs.target),cu==null?null:(cv=cu.$0,bi.StartsWith(cv,"#")?cp(cv):null));return ct==null?null:(cr(ct.$0),cs.preventDefault());},false);x.Sink(function(cs){var ct;if(!X.Equals(cs,cq())){ct=_4.HashLink(co,cs);self.history.pushState(null,null,ct);}},cm.get_View());};H.getCurrentHash=function(cm,cn){var co,cp;co=self.location.hash;cp=cm(co);return cp==null?((function(cq){return function(cr){return cq("Failed to parse route: "+bh.toSafe(cr));};}(function(cq){cj.log(cq);}))(co),cn):cp.$0;};H.findLinkHref=function(cm){while(true)if(cm.tagName==="A")return J.ofObj(cm.getAttribute("href"));else if(cm===self.document.body)return null;else cm=cm.parentNode;};I=k.Var=cg.Class({},j,I);I.New=cg.Ctor(function(){j.New.call(this);},I);J.ofObj=function(cm){return cm==null?null:{$:1,$0:cm};};L.Id=function(){L.set_counter(L.counter()+1);return"uid"+a.String(L.counter());};L.set_counter=function(cm){bk.$cctor();bk.counter=cm;};L.counter=function(){bk.$cctor();return bk.counter;};L.Int=function(){L.set_counter(L.counter()+1);return L.counter();};M.TryParseInt32=function(cm,cn){return M.TryParse(cm,-2147483648,2147483647,cn);};O.JSUnion=function(cm,cn){var co;function cp(ct){var cu;function cv(cw){return cw!=null&&cw.$==1&&X.Equals(ct,cw.$0);}cu=R.tryFindIndex(function(cw){return cv(cw[0]);},cn);return cu!=null&&cu.$==1?cu.$0:ct.$;}function cq(ct,cu){return y.init(y.length((y.get(cn,ct))[2]),function(cv){return cu["$"+a.String(cv)];});}function cr(ct,cu){var cv,cw,cx;cv=cm==null?{}:new cm();cw=y.get(cn,ct);return(cx=cw[0],cx!=null&&cx.$==1)?cw[0].$0:(cv.$=ct,R.iteri(function(cy,cz){cv["$"+a.String(cy)]=cz;},cu),cv);}function cs(ct,cu){var cv;function cw(cx,cy){return[ct,cx,cy,cv];}cv=cu[2];return R.map(function(cx){return cw(cx[0],cx[1]);},cu[1]);}co=R.collect(function(ct){return cs(ct[0],ct[1]);},R.indexed(cn));return _.New$1(function(ct){function cu(cv,cw,cx,cy){var cz,cA,cB;function cC(cD){return function(cE){return function(cF){var cG;function cH(cI,cJ){return((cC(cG))(cI))(new w({$:1,$0:cJ,$1:cF}));}return cD.$==1?(cG=cD.$1,R.collect(function(cI){return cH(cI[0],cI[1]);},cD.$0.Parse(cE))):[[cE,cr(cv,y.ofList(v.rev(cF)))]];};};}return O.isCorrectMethod(cw,ct.Method)?(cz=$.startsWith(v.ofArray(cx),ct.Segments),cz==null?[]:(cA=cz.$0,(cB=v.ofArray(cy),cB.$==0?[[_5.New(cA,ct.QueryArgs,ct.FormData,ct.Method,ct.Body),cr(cv,[])]]:((cC(cB))(_5.New(cA,ct.QueryArgs,ct.FormData,ct.Method,ct.Body)))(w.Empty)))):[];}return R.collect(function(cv){return cu(cv[0],cv[1],cv[2],cv[3]);},co);},function(ct){var cu,cv,cw,cx,cy,cz;function cA(cB,cC){return cC.Write(cB);}cu=cp(ct);cv=y.get(cn,cu);cw=cv[2];cx=y.get(cv[1],0);cy=[_5.Segment(v.ofArray(cx[1]),cx[0])];return!X.Equals(cw,null)&&cw.length===0?{$:1,$0:cy}:(cz=(((cg.Curried3(y.map2))(cA))(cq(cu,ct)))(cw),y.forall(function(cB){return cB!=null;},cz)?{$:1,$0:R.append(cy,R.collect(function(cB){return cB.$0;},cz))}:null);});};O.isCorrectMethod=function(cm,cn){return cn!=null&&cn.$==1?cm!=null&&cm.$==1?X.Equals(cn.$0,cm.$0):true:!(cm!=null&&cm.$==1);};Q.EncodeUnion=function(cm,cn,co){return function(){return function(cp){var cq,cr;function cs(ct,cu,cv,cw){var cx,cy,cz;if(ct===null){cx=(cv(null))(cp.$0);for(var cA in cx)if(function(cB){cq[cB]=cx[cB];return false;}(cA))break;}else if(cw===0)cq[cu]=(cv(null))(cp[ct]);else if(cw===1){cz=cp[ct];if(cz==null);else cq[cu]=(cv(null))(cz.$0);}else e.FailWith("Invalid field option kind");}return typeof cp==="object"&&cp!=null?(cq={},(cr=y.get(co,cp.$),(X.Equals(typeof cn,"string")?cq[cn]=cr[0]:void 0,y.iter(function(ct){return cs(ct[0],ct[1],ct[2],ct[3]);},cr[1]),cq))):cp;};};};Q.Id=cg.Curried3(function(cm,cn,co){return co;});Q.DecodeUnion=function(cm,cn,co){return function(){return function(cp){var cq,cr,cu,cv,cw;function cs(cx,cy){return cx===cr;}function ct(cx,cy,cz,cA){var cB;if(cx===null){cB=(cz(null))(cp);if(cy)delete cB[cn];cu.$0=cB;}else if(cA===0)cu[cx]=(cz(null))(cp[cy]);else if(cA===1)cu[cx]=cp.hasOwnProperty(cy)?{$:1,$0:(cz(null))(cp[cy])}:null;else e.FailWith("Invalid field option kind");}if(typeof cp==="object"&&cp!=null){cu=cm===void 0?{}:new cm();if(X.Equals(typeof cn,"string"))cq=(cr=cp[cn],y.findIndex(function(cx){return cs(cx[0],cx[1]);},co));else{cv=[void 0];for(var cx in cn)if(function(cy){return cp.hasOwnProperty(cy)&&(cv[0]=cn[cy],true);}(cx))break;cq=cv[0];}cu.$=cq;y.iter(function(cy){return ct(cy[0],cy[1],cy[2],cy[3]);},(y.get(co,cq))[1]);return cu;}else return cp;};};};Q.EncodeRecord=function(cm,cn){return function(){return function(co){var cp;function cq(cr,cs,ct){var cu;if(ct===0)cp[cr]=(cs(null))(co[cr]);else if(ct===1){cu=co[cr];if(cu==null);else cp[cr]=(cs(null))(cu.$0);}else if(ct===2){if(co.hasOwnProperty(cr))cp[cr]=(cs(null))(co[cr]);}else if(ct===3){if(co[cr]===void 0)cp[cr]=(cs(null))(co[cr]);}else e.FailWith("Invalid field option kind");}cp={};y.iter(function(cr){return cq(cr[0],cr[1],cr[2]);},cn);return cp;};};};Q.EncodeList=cg.Curried3(function(cm,cn,co){var cp,cq;cp=[];cq=cm();v.iter(function(cr){cp.push(cq(cr));},co);return cp;});Q.DecodeRecord=function(cm,cn){return function(){return function(co){var cp;function cq(cr,cs,ct){if(ct===0){if(co.hasOwnProperty(cr))cp[cr]=(cs(null))(co[cr]);else e.FailWith("Missing mandatory field: "+cr);}else if(ct===1)cp[cr]=co.hasOwnProperty(cr)?{$:1,$0:(cs(null))(co[cr])}:null;else if(ct===2){if(co.hasOwnProperty(cr))cp[cr]=(cs(null))(co[cr]);}else if(ct===3){if(co[cr]===void 0)cp[cr]=(cs(null))(co[cr]);}else e.FailWith("Invalid field option kind");}cp=cm===void 0?{}:new cm();y.iter(function(cr){return cq(cr[0],cr[1],cr[2]);},cn);return cp;};};};Q.DecodeList=cg.Curried3(function(cm,cn,co){var cp;cp=cm();return v.init(y.length(co),function(cq){return cp(y.get(co,cq));});});R.filter=function(cm,cn){return{GetEnumerator:function(){var co;co=bc.Get(cn);return new bd.New(null,null,function(cp){var cq,cr,cs;cq=co.MoveNext();cr=co.Current();cs=false;while(cq)if(cm(cr)){cp.c=cr;cs=true;cq=false;}else if(co.MoveNext())cr=co.Current();else cq=false;return cs;},function(){co.Dispose();});}};};R.choose=function(cm,cn){return R.collect(function(co){var cp;cp=cm(co);return cp==null?w.Empty:v.ofArray([cp.$0]);},cn);};R.iteri=function(cm,cn){var co,cp;co=0;cp=bc.Get(cn);try{while(cp.MoveNext()){cm(co,cp.Current());co=co+1;}}finally{if(typeof cp=="object"&&"Dispose"in cp)cp.Dispose();}};R.collect=function(cm,cn){return R.concat(R.map(cm,cn));};R.append=function(cm,cn){return{GetEnumerator:function(){var co,cp;co=bc.Get(cm);cp=[true];return new bd.New(co,null,function(cq){var cr;return cq.s.MoveNext()?(cq.c=cq.s.Current(),true):(cr=cq.s,!X.Equals(cr,null)?cr.Dispose():void 0,cq.s=null,cp[0]&&(cp[0]=false,cq.s=bc.Get(cn),cq.s.MoveNext()?(cq.c=cq.s.Current(),true):(cq.s.Dispose(),cq.s=null,false)));},function(cq){var cr;cr=cq.s;if(!X.Equals(cr,null))cr.Dispose();});}};};R.indexed=function(cm){return R.mapi(function(cn,co){return[cn,co];},cm);};R.map=function(cm,cn){return{GetEnumerator:function(){var co;co=bc.Get(cn);return new bd.New(null,null,function(cp){return co.MoveNext()&&(cp.c=cm(co.Current()),true);},function(){co.Dispose();});}};};R.tryFindIndex=function(cm,cn){var co,cp,cq;co=bc.Get(cn);try{cp=true;cq=0;while(cp&&co.MoveNext())if(cm(co.Current()))cp=false;else cq=cq+1;return cp?null:{$:1,$0:cq};}finally{if(typeof co=="object"&&"Dispose"in co)co.Dispose();}};R.tryPick=function(cm,cn){var co,cp;co=bc.Get(cn);try{cp=null;while(X.Equals(cp,null)&&co.MoveNext())cp=cm(co.Current());return cp;}finally{if(typeof co=="object"&&"Dispose"in co)co.Dispose();}};R.concat=function(cm){return{GetEnumerator:function(){var cn;function co(cp){var cq;while(true){cq=cp.s;if(X.Equals(cq,null)){if(cn.MoveNext()){cp.s=bc.Get(cn.Current());cp=cp;}else{cn.Dispose();return false;}}else if(cq.MoveNext()){cp.c=cq.Current();return true;}else{cp.Dispose();cp.s=null;cp=cp;}}}cn=bc.Get(cm);return new bd.New(null,null,co,function(cp){var cq;cq=cp.s;if(!X.Equals(cq,null))cq.Dispose();if(!X.Equals(cn,null))cn.Dispose();});}};};R.mapi=function(cm,cn){return R.map2(cm,R.initInfinite(a.id),cn);};R.map2=function(cm,cn,co){return{GetEnumerator:function(){var cp,cq;cp=bc.Get(cn);cq=bc.Get(co);return new bd.New(null,null,function(cr){return cp.MoveNext()&&cq.MoveNext()&&(cr.c=cm(cp.Current(),cq.Current()),true);},function(){cp.Dispose();cq.Dispose();});}};};R.initInfinite=function(cm){return{GetEnumerator:function(){return new bd.New(0,null,function(cn){cn.c=cm(cn.s);cn.s=cn.s+1;return true;},void 0);}};};R.forall2=function(cm,cn,co){return!R.exists2(function(cp,cq){return!cm(cp,cq);},cn,co);};R.head=function(cm){var cn;cn=bc.Get(cm);try{return cn.MoveNext()?cn.Current():R.insufficient();}finally{if(typeof cn=="object"&&"Dispose"in cn)cn.Dispose();}};R.exists2=function(cm,cn,co){var cp,cq,cr,cs;cp=bc.Get(cn);try{cr=bc.Get(co);try{cs=false;while(!cs&&cp.MoveNext()&&cr.MoveNext())cs=cm(cp.Current(),cr.Current());cq=cs;}finally{if(typeof cr=="object"&&"Dispose"in cr)cr.Dispose();}return cq;}finally{if(typeof cp=="object"&&"Dispose"in cp)cp.Dispose();}};R.fold=function(cm,cn,co){var cp,cq;cp=cn;cq=bc.Get(co);try{while(cq.MoveNext())cp=cm(cp,cq.Current());return cp;}finally{if(typeof cq=="object"&&"Dispose"in cq)cq.Dispose();}};R.rev=function(cm){return R.delay(function(){return y.ofSeq(cm).slice().reverse();});};R.distinctBy=function(cm,cn){return{GetEnumerator:function(){var co,cp;co=bc.Get(cn);cp=new bn.New$3();return new bd.New(null,null,function(cq){var cr,cs;if(co.MoveNext()){cr=co.Current();cs=cp.Add(cm(cr));while(!cs&&co.MoveNext()){cr=co.Current();cs=cp.Add(cm(cr));}return cs&&(cq.c=cr,true);}else return false;},function(){co.Dispose();});}};};R.iter=function(cm,cn){var co;co=bc.Get(cn);try{while(co.MoveNext())cm(co.Current());}finally{if(typeof co=="object"&&"Dispose"in co)co.Dispose();}};R.delay=function(cm){return{GetEnumerator:function(){return bc.Get(cm());}};};R.distinct=function(cm){return R.distinctBy(a.id,cm);};R.unfold=function(cm,cn){return{GetEnumerator:function(){return new bd.New(cn,null,function(co){var cp;cp=cm(co.s);return cp==null?false:(co.c=cp.$0[0],co.s=cp.$0[1],true);},void 0);}};};R.forall=function(cm,cn){return!R.exists(function(co){return!cm(co);},cn);};R.max=function(cm){var cn,co,cp;cn=bc.Get(cm);try{if(!cn.MoveNext())R.seqEmpty();co=cn.Current();while(cn.MoveNext()){cp=cn.Current();if(X.Compare(cp,co)===1)co=cp;}return co;}finally{if(typeof cn=="object"&&"Dispose"in cn)cn.Dispose();}};R.exists=function(cm,cn){var co,cp;co=bc.Get(cn);try{cp=false;while(!cp&&co.MoveNext())cp=cm(co.Current());return cp;}finally{if(typeof co=="object"&&"Dispose"in co)co.Dispose();}};R.seqEmpty=function(){return e.FailWith("The input sequence was empty.");};R.compareWith=function(cm,cn,co){var cp,cq,cr,cs,ct;cp=bc.Get(cn);try{cr=bc.Get(co);try{cs=0;ct=true;while(ct&&cs===0)if(cp.MoveNext())cs=cr.MoveNext()?cm(cp.Current(),cr.Current()):1;else if(cr.MoveNext())cs=-1;else ct=false;cq=cs;}finally{if(typeof cr=="object"&&"Dispose"in cr)cr.Dispose();}return cq;}finally{if(typeof cp=="object"&&"Dispose"in cp)cp.Dispose();}};T.NewFromSeq=function(cm){var cn,co,cp;cn={};co=bc.Get(cm);try{while(co.MoveNext()){cp=co.Current();cn[cp[0]]=cp[1];}}finally{if(typeof co=="object"&&"Dispose"in co)co.Dispose();}return cn;};U.Map=function(cm,cn){var co,cp;co=cn.s;return co!=null&&co.$==0?U.New({$:0,$0:cm(co.$0)}):(cp=U.New({$:3,$0:[],$1:[]}),(U.When(cn,function(cq){U.MarkDone(cp,cn,cm(cq));},cp),cp));};U.WhenObsoleteRun=function(cm,cn){var co;co=cm.s;if(co==null)cn();else co!=null&&co.$==2?co.$1.push(cn):co!=null&&co.$==3?co.$1.push(cn):void 0;};U.When=function(cm,cn,co){var cp;cp=cm.s;if(cp==null)U.Obsolete(co);else cp!=null&&cp.$==2?(U.EnqueueSafe(cp.$1,co),cn(cp.$0)):cp!=null&&cp.$==3?(cp.$0.push(cn),U.EnqueueSafe(cp.$1,co)):cn(cp.$0);};U.MarkDone=function(cm,cn,co){var cp;if(cp=cn.s,cp!=null&&cp.$==0)U.MarkForever(cm,co);else U.MarkReady(cm,co);};U.Map2=function(cm,cn,co){var cp,cq,cr;function cs(ct){var cu,cv,cw;if(!(cu=cr.s,cu!=null&&cu.$==0||cu!=null&&cu.$==2)){cv=U.ValueAndForever(cn);cw=U.ValueAndForever(co);if(cv!=null&&cv.$==1)cw!=null&&cw.$==1?cv.$0[1]&&cw.$0[1]?U.MarkForever(cr,cm(cv.$0[0],cw.$0[0])):U.MarkReady(cr,cm(cv.$0[0],cw.$0[0])):void 0;}}cp=cn.s;cq=co.s;return cp!=null&&cp.$==0?cq!=null&&cq.$==0?U.New({$:0,$0:cm(cp.$0,cq.$0)}):U.Map2Opt1(cm,cp.$0,co):cq!=null&&cq.$==0?U.Map2Opt2(cm,cq.$0,cn):(cr=U.New({$:3,$0:[],$1:[]}),(U.When(cn,cs,cr),U.When(co,cs,cr),cr));};U.WhenRun=function(cm,cn,co){var cp;cp=cm.s;if(cp==null)co();else cp!=null&&cp.$==2?(cp.$1.push(co),cn(cp.$0)):cp!=null&&cp.$==3?(cp.$0.push(cn),cp.$1.push(co)):cn(cp.$0);};U.EnqueueSafe=function(cm,cn){var co,cp,cq,cr;cm.push(cn);if(cm.length%20===0){co=cm.slice(0);bE.Clear(cm);for(cp=0,cq=y.length(co)-1;cp<=cq;cp++){cr=y.get(co,cp);if(typeof cr=="object")(function(cs){if(cs.s)cm.push(cs);}(cr));else(function(cs){cm.push(cs);}(cr));}}else void 0;};U.MarkForever=function(cm,cn){var co,cp,cq,cr;co=cm.s;if(co!=null&&co.$==3){cm.s={$:0,$0:cn};cp=co.$0;for(cq=0,cr=y.length(cp)-1;cq<=cr;cq++)(y.get(cp,cq))(cn);}else void 0;};U.MarkReady=function(cm,cn){var co,cp,cq,cr;co=cm.s;if(co!=null&&co.$==3){cm.s={$:2,$0:cn,$1:co.$1};cp=co.$0;for(cq=0,cr=y.length(cp)-1;cq<=cr;cq++)(y.get(cp,cq))(cn);}else void 0;};U.TryGet=function(cm){var cn,co;cn=cm.s;return(cn!=null&&cn.$==0?(co=cn.$0,true):cn!=null&&cn.$==2&&(co=cn.$0,true))?{$:1,$0:co}:null;};U.Map2Opt1=function(cm,cn,co){return U.Map(function(cp){return cm(cn,cp);},co);};U.Map2Opt2=function(cm,cn,co){return U.Map(function(cp){return cm(cp,cn);},co);};U.ValueAndForever=function(cm){var cn;cn=cm.s;return cn!=null&&cn.$==0?{$:1,$0:[cn.$0,true]}:cn!=null&&cn.$==2?{$:1,$0:[cn.$0,false]}:null;};U.Map3=function(cm,cn,co,cp){var cq,cr,cs,ct;function cu(cv){var cw,cx,cy,cz;if(!(cw=ct.s,cw!=null&&cw.$==0||cw!=null&&cw.$==2)){cx=U.ValueAndForever(cn);cy=U.ValueAndForever(co);cz=U.ValueAndForever(cp);if(cx!=null&&cx.$==1)cy!=null&&cy.$==1?cz!=null&&cz.$==1?cx.$0[1]&&cy.$0[1]&&cz.$0[1]?U.MarkForever(ct,cm(cx.$0[0],cy.$0[0],cz.$0[0])):U.MarkReady(ct,cm(cx.$0[0],cy.$0[0],cz.$0[0])):void 0:void 0;}}cq=cn.s;cr=co.s;cs=cp.s;return cq!=null&&cq.$==0?cr!=null&&cr.$==0?cs!=null&&cs.$==0?U.New({$:0,$0:cm(cq.$0,cr.$0,cs.$0)}):U.Map3Opt1(cm,cq.$0,cr.$0,cp):cs!=null&&cs.$==0?U.Map3Opt2(cm,cq.$0,cs.$0,co):U.Map3Opt3(cm,cq.$0,co,cp):cr!=null&&cr.$==0?cs!=null&&cs.$==0?U.Map3Opt4(cm,cr.$0,cs.$0,cn):U.Map3Opt5(cm,cr.$0,cn,cp):cs!=null&&cs.$==0?U.Map3Opt6(cm,cs.$0,cn,co):(ct=U.New({$:3,$0:[],$1:[]}),(U.When(cn,cu,ct),U.When(co,cu,ct),U.When(cp,cu,ct),ct));};U.Sequence=function(cm){var cn,co,cp;function cq(cr){var cs;if(cp[0]===0){cs=y.map(function(ct){var cu;cu=ct.s;return cu!=null&&cu.$==0?cu.$0:cu!=null&&cu.$==2?cu.$0:e.FailWith("value not found by View.Sequence");},cn);if(y.forall(function(ct){var cu;cu=ct.s;return cu!=null&&cu.$==0;},cn))U.MarkForever(co,cs);else U.MarkReady(co,cs);}else cp[0]--;}cn=y.ofSeq(cm);return cn.length==0?U.New({$:0,$0:[]}):(co=U.New({$:3,$0:[],$1:[]}),(cp=[y.length(cn)-1],(y.iter(function(cr){U.When(cr,cq,co);},cn),co)));};U.Map2Unit=function(cm,cn){var co,cp,cq;function cr(){var cs,ct,cu;if(!(cs=cq.s,cs!=null&&cs.$==0||cs!=null&&cs.$==2)){ct=U.ValueAndForever(cm);cu=U.ValueAndForever(cn);if(ct!=null&&ct.$==1)cu!=null&&cu.$==1?ct.$0[1]&&cu.$0[1]?U.MarkForever(cq,null):U.MarkReady(cq,null):void 0;}}co=cm.s;cp=cn.s;return co!=null&&co.$==0?cp!=null&&cp.$==0?U.New({$:0,$0:null}):cn:cp!=null&&cp.$==0?cm:(cq=U.New({$:3,$0:[],$1:[]}),(U.When(cm,cr,cq),U.When(cn,cr,cq),cq));};U.Copy=function(cm){var cn,co,cp;cn=cm.s;return cn==null?cm:cn!=null&&cn.$==2?(co=U.New({$:2,$0:cn.$0,$1:[]}),(U.WhenObsolete(cm,co),co)):cn!=null&&cn.$==3?(cp=U.New({$:3,$0:[],$1:[]}),(U.When(cm,function(cq){U.MarkDone(cp,cm,cq);},cp),cp)):cm;};U.Join=function(cm){var cn;cn=U.New({$:3,$0:[],$1:[]});U.When(cm,function(co){var cp;cp=co();U.When(cp,function(cq){var cr,cs;if((cr=cp.s,cr!=null&&cr.$==0)&&(cs=cm.s,cs!=null&&cs.$==0))U.MarkForever(cn,cq);else U.MarkReady(cn,cq);},cn);},cn);return cn;};U.Map3Opt1=function(cm,cn,co,cp){return U.Map(function(cq){return cm(cn,co,cq);},cp);};U.Map3Opt2=function(cm,cn,co,cp){return U.Map(function(cq){return cm(cn,cq,co);},cp);};U.Map3Opt3=function(cm,cn,co,cp){return U.Map2(function(cq,cr){return cm(cn,cq,cr);},co,cp);};U.Map3Opt4=function(cm,cn,co,cp){return U.Map(function(cq){return cm(cq,cn,co);},cp);};U.Map3Opt5=function(cm,cn,co,cp){return U.Map2(function(cq,cr){return cm(cq,cn,cr);},co,cp);};U.Map3Opt6=function(cm,cn,co,cp){return U.Map2(function(cq,cr){return cm(cq,cr,cn);},co,cp);};U.WhenObsolete=function(cm,cn){var co;co=cm.s;if(co==null)U.Obsolete(cn);else co!=null&&co.$==2?U.EnqueueSafe(co.$1,cn):co!=null&&co.$==3?U.EnqueueSafe(co.$1,cn):void 0;};V=B.TemplateInstance=cg.Class({get_Doc:function(){return this.doc;}},j,V);V.New=cg.Ctor(function(cm,cn){j.New.call(this);this.doc=cn;this.allVars=cm.$==0?cm.$0:e.FailWith("Should not happen");},V);W=k.FromView=cg.Class({Get:function(){return this.current;},Update:function(cm){var cn;x.Get((cn=this.set,function(co){return cn(cm(co));}),this.view);},Set:function(cm){this.set(cm);},UpdateMaybe:function(cm){var cn;cn=this;x.Get(function(co){var cp;cp=cm(co);if(cp!=null&&cp.$==1)cn.set(cp.$0);},this.view);},get_View:function(){return this.view;}},I,W);W.New=cg.Ctor(function(cm,cn){var co,cp;co=this;I.New.call(this);this.set=cn;this.id=L.Int();this.current=(cp=x.TryGet(cm),cp==null?null:cp.$0);this.view=x.Map(function(cq){co.current=cq;return cq;},cm);},W);X.Equals=function(cm,cn){var co,cp,cq,cr;if(cm===cn)return true;else{co=typeof cm;if(co=="object"){if(cm===null||cm===void 0||cn===null||cn===void 0)return false;else if("Equals"in cm)return cm.Equals(cn);else if(cm instanceof a.Array&&cn instanceof a.Array)return X.arrayEquals(cm,cn);else if(cm instanceof a.Date&&cn instanceof a.Date)return X.dateEquals(cm,cn);else{cp=[true];for(var cs in cm)if(function(ct){cp[0]=!cm.hasOwnProperty(ct)||cn.hasOwnProperty(ct)&&X.Equals(cm[ct],cn[ct]);return!cp[0];}(cs))break;if(cp[0]){for(var ct in cn)if(function(cu){cp[0]=!cn.hasOwnProperty(cu)||cm.hasOwnProperty(cu);return!cp[0];}(ct))break;}return cp[0];}}else return co=="function"&&("$Func"in cm?cm.$Func===cn.$Func&&cm.$Target===cn.$Target:"$Invokes"in cm&&"$Invokes"in cn&&X.arrayEquals(cm.$Invokes,cn.$Invokes));}};X.arrayEquals=function(cm,cn){var co,cp;if(y.length(cm)===y.length(cn)){co=true;cp=0;while(co&&cp<y.length(cm)){!X.Equals(y.get(cm,cp),y.get(cn,cp))?co=false:void 0;cp=cp+1;}return co;}else return false;};X.dateEquals=function(cm,cn){return cm.getTime()===cn.getTime();};X.Hash=function(cm){var cn;cn=typeof cm;return cn=="function"?0:cn=="boolean"?cm?1:0:cn=="number"?cm:cn=="string"?X.hashString(cm):cn=="object"?cm==null?0:cm instanceof a.Array?X.hashArray(cm):X.hashObject(cm):0;};X.hashString=function(cm){var cn,co,cp;if(cm===null)return 0;else{cn=5381;for(co=0,cp=cm.length-1;co<=cp;co++)cn=X.hashMix(cn,cm[co].charCodeAt());return cn;}};X.hashArray=function(cm){var cn,co,cp;cn=-34948909;for(co=0,cp=y.length(cm)-1;co<=cp;co++)cn=X.hashMix(cn,X.Hash(y.get(cm,co)));return cn;};X.hashObject=function(cm){var cn,co;if("GetHashCode"in cm)return cm.GetHashCode();else{cn=[0];for(var cp in cm)if(function(cq){cn[0]=X.hashMix(X.hashMix(cn[0],X.hashString(cq)),X.Hash(cm[cq]));return false;}(cp))break;return cn[0];}};X.hashMix=function(cm,cn){return(cm<<5)+cm+cn;};X.Compare=function(cm,cn){var co,cp,cq,cr,cs,ct;if(cm===cn)return 0;else{cp=typeof cm;switch(cp=="function"?1:cp=="boolean"?2:cp=="number"?2:cp=="string"?2:cp=="object"?3:0){case 0:return typeof cn=="undefined"?0:-1;case 1:return e.FailWith("Cannot compare function values.");case 2:return cm<cn?-1:1;case 3:if(cm===null)cq=-1;else if(cn===null)cq=1;else if("CompareTo"in cm)cq=cm.CompareTo(cn);else if("CompareTo0"in cm)cq=cm.CompareTo0(cn);else if(cm instanceof a.Array&&cn instanceof a.Array)cq=X.compareArrays(cm,cn);else if(cm instanceof a.Date&&cn instanceof a.Date)cq=X.compareDates(cm,cn);else{cr=[0];for(var cu in cm)if(function(cv){return!cm.hasOwnProperty(cv)?false:!cn.hasOwnProperty(cv)?(cr[0]=1,true):(cr[0]=X.Compare(cm[cv],cn[cv]),cr[0]!==0);}(cu))break;if(cr[0]===0){for(var cv in cn)if(function(cw){return!cn.hasOwnProperty(cw)?false:!cm.hasOwnProperty(cw)&&(cr[0]=-1,true);}(cv))break;}cq=cr[0];}return cq;}}};X.compareArrays=function(cm,cn){var co,cp;if(y.length(cm)<y.length(cn))return -1;else if(y.length(cm)>y.length(cn))return 1;else{co=0;cp=0;while(co===0&&cp<y.length(cm)){co=X.Compare(y.get(cm,cp),y.get(cn,cp));cp=cp+1;}return co;}};X.compareDates=function(cm,cn){return X.Compare(cm.getTime(),cn.getTime());};Z.NewGuid=function(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(new a.RegExp("[xy]","g"),function(cm){var cn,co;cn=ck.random()*16|0;co=cm=="x"?cn:cn&3|8;return co.toString(16);});};_1=_0.List=cg.Class({GetEnumerator:function(){return bc.Get(this);},GetEnumerator0:function(){return bc.Get0(this);}},null,_1);_2.Static=function(cm){return new bf({$:3,$0:cm});};_2.Dynamic=function(cm,cn){return new bf({$:1,$0:new bg.New(cm,cn)});};_2.AppendTree=function(cm,cn){var co;return cm===null?cn:cn===null?cm:(co=new bf({$:2,$0:cm,$1:cn}),(_2.SetFlags(co,_2.Flags(cm)|_2.Flags(cn)),co));};_2.EmptyAttr=function(){bO.$cctor();return bO.EmptyAttr;};_2.SetFlags=function(cm,cn){cm.flags=cn;};_2.Flags=function(cm){return cm!==null&&cm.hasOwnProperty("flags")?cm.flags:0;};_2.Insert=function(cm,cn){var co,cp,cq;function cr(cs){var ct,cu;while(true)if(!(cs===null)){if(cs!=null&&cs.$==1)return co.push(cs.$0);else if(cs!=null&&cs.$==2){ct=cs.$1;cu=cs.$0;cr(cu);cs=ct;}else return cs!=null&&cs.$==3?cs.$0(cm):cs!=null&&cs.$==4?cp.push(cs.$0):null;}else return null;}co=[];cp=[];cr(cn);cq=co.slice(0);return bS.New(cm,_2.Flags(cn),cq,cp.length===0?null:{$:1,$0:function(cs){R.iter(function(ct){ct(cs);},cp);}});};_2.Updates=function(cm){return bs.MapTreeReduce(function(cn){return cn.NChanged();},x.Const(),x.Map2Unit,cm.DynNodes);};_2.Empty=function(cm){return bS.New(cm,0,[],null);};_2.HasExitAnim=function(cm){var cn;cn=2;return(cm.DynFlags&cn)===cn;};_2.GetExitAnim=function(cm){return _2.GetAnim(cm,function(cn,co){return cn.NGetExitAnim(co);});};_2.HasEnterAnim=function(cm){var cn;cn=1;return(cm.DynFlags&cn)===cn;};_2.GetEnterAnim=function(cm){return _2.GetAnim(cm,function(cn,co){return cn.NGetEnterAnim(co);});};_2.HasChangeAnim=function(cm){var cn;cn=4;return(cm.DynFlags&cn)===cn;};_2.GetChangeAnim=function(cm){return _2.GetAnim(cm,function(cn,co){return cn.NGetChangeAnim(co);});};_2.GetAnim=function(cm,cn){return bL.Concat(y.map(function(co){return cn(co,cm.DynElem);},cm.DynNodes));};_2.Sync=function(cm,cn){y.iter(function(co){co.NSync(cm);},cn.DynNodes);};_3.AddClass=function(cm,cn){var co;co=_3.getClass(cm);if(co==="")_3.setClass(cm,cn);else!_3.clsRE(cn).test(co)?_3.setClass(cm,co+" "+cn):void 0;};_3.RemoveClass=function(cm,cn){var co;_3.setClass(cm,(co=_3.clsRE(cn),_3.getClass(cm).replace(co,function(cp,cq,cr){return cq===""||cr===""?"":" ";})));};_3.getClass=function(cm){return cm instanceof a.SVGElement?cm.getAttribute("class"):cm.className;};_3.setClass=function(cm,cn){if(cm instanceof a.SVGElement)cm.setAttribute("class",cn);else cm.className=cn;};_3.clsRE=function(cm){return new a.RegExp("(\\s+|^)"+cm+"(?:\\s+"+cm+")*(\\s+|$)","g");};_3.ParseHTMLIntoFakeRoot=function(cm){var cn,co,cp,cq,cr;function cs(ct,cu){var cv;while(true)if(cu===0)return ct;else{cv=cu;ct=ct.lastChild;cu=cv-1;}}cn=self.document.createElement("div");return!_3.rhtml().test(cm)?(cn.appendChild(self.document.createTextNode(cm)),cn):(co=(cp=_3.rtagName().exec(cm),X.Equals(cp,null)?"":y.get(cp,1).toLowerCase()),(cq=(cr=(_3.wrapMap())[co],cr?cr:_3.defaultWrap()),(cn.innerHTML=cq[1]+cm.replace(_3.rxhtmlTag(),"<$1></$2>")+cq[2],cs(cn,cq[0]))));};_3.rhtml=function(){b7.$cctor();return b7.rhtml;};_3.wrapMap=function(){b7.$cctor();return b7.wrapMap;};_3.defaultWrap=function(){b7.$cctor();return b7.defaultWrap;};_3.rxhtmlTag=function(){b7.$cctor();return b7.rxhtmlTag;};_3.rtagName=function(){b7.$cctor();return b7.rtagName;};_3.IterSelector=function(cm,cn,co){var cp,cq,cr;cp=cm.querySelectorAll(cn);for(cq=0,cr=cp.length-1;cq<=cr;cq++)co(cp[cq]);};_3.ChildrenArray=function(cm){var cn,co,cp;cn=[];for(co=0,cp=cm.childNodes.length-1;co<=cp;co++)cn.push(cm.childNodes[co]);return cn;};_3.InsertAt=function(cm,cn,co){var cp;if(!(co.parentNode===cm&&cn===(cp=co.nextSibling,X.Equals(cp,null)?null:cp)))cm.insertBefore(co,cn);};_3.RemoveNode=function(cm,cn){if(cn.parentNode===cm)cm.removeChild(cn);};_4.Parse=function(cm,cn){function co(cp,cq){return cp.Segments.$==0?{$:1,$0:cq}:null;}return R.tryPick(function(cp){return co(cp[0],cp[1]);},cm.Parse(cn));};_4.HashLink=function(cm,cn){return"#"+_4.Link(cm,cn);};_4.Link=function(cm,cn){var co;co=_4.Write(cm,cn);return co==null?"":co.$0.ToLink();};_4.Write=function(cm,cn){var co;co=cm.Write(cn);return co==null?null:{$:1,$0:_5.Combine(co.$0)};};_5=N.Route=cg.Class({ToLink:function(){return bD.WriteLink(this.Segments,this.QueryArgs);}},null,_5);_5.FromHash=function(cm,cn){var co,cp;co=cm.indexOf("#");return co===-1?_5.get_Empty():(cp=cm.substring(co+1),cn!=null&&cn.$0?cp===""||cp==="/"?_5.get_Empty():bi.StartsWith(cp,"/")?_5.FromUrl(cp.substring(1),{$:1,$0:true}):_5.Segment$2(cp):_5.FromUrl(cm.substring(co),{$:1,$0:false}));};_5.Segment=function(cm,cn){var co;co=_5.get_Empty();return _5.New(cm,co.QueryArgs,co.FormData,cn,co.Body);};_5.get_Empty=function(){return _5.New(w.Empty,new bl.New([]),new bl.New([]),null,bv.CreateFromValue(null));};_5.FromUrl=function(cm,cn){var co,cp,cq;co=(cp=cm.indexOf("?"),cp===-1?[cm,new bl.New([])]:[bi.Substring(cm,0,cp),_5.ParseQuery(cm.substring(cp+1))]);cq=_5.get_Empty();return _5.New(v.ofArray(bi.SplitChars(co[0],["/"],cn!=null&&cn.$0?0:1)),co[1],cq.FormData,cq.Method,cq.Body);};_5.Segment$2=function(cm){var cn;cn=_5.get_Empty();return _5.New(v.ofArray([cm]),cn.QueryArgs,cn.FormData,cn.Method,cn.Body);};_5.ParseQuery=function(cm){return bu.OfArray(y.ofSeq(y.choose(function(cn){var co,cp;co=bi.SplitChars(cn,["="],0);return!X.Equals(co,null)&&co.length===2?(cp=y.get(co,1),{$:1,$0:[y.get(co,0),cp]}):((function(cq){return function(cr){return cq("wrong format for query argument: "+bh.toSafe(cr));};}(function(cq){cj.log(cq);}))(cn),null);},bi.SplitChars(cm,["&"],0))));};_5.Combine=function(cm){var cn,co,cp,cq,cr,cs,ct;cn=y.ofSeq(cm);co=y.length(cn);return co===0?_5.get_Empty():co===1?y.get(cn,0):(cp=null,cq=null,cr=[],cs=new bl.New([]),ct=new bl.New([]),y.iter(function(cu){var cv,cw;cv=cu.Method;if(cv!=null&&cv.$==1)cp=cv;cw=cu.Body.f();if(cw===null);else cq=cw;cs=bu.FoldBack(function(cx,cy,cz){return cz.Add(cx,cy);},cs,cu.QueryArgs);ct=bu.FoldBack(function(cx,cy,cz){return cz.Add(cx,cy);},ct,cu.FormData);v.iter(function(cx){cr.push(cx);},cu.Segments);},cn),_5.New(v.ofSeq(cr),cs,ct,cp,bv.CreateFromValue(cq)));};_5.New=function(cm,cn,co,cp,cq){return new _5({Segments:cm,QueryArgs:cn,FormData:co,Method:cp,Body:cq});};_6.GetFieldValues=function(cm){var cn,co;cn=[];for(var cp in cm)cn.push(cm[cp]);return cn;};_.New$1=function(cm,cn){return{Parse:cm,Write:cn};};$.startsWith=function(cm,cn){var co;switch(cm.$==1?cn.$==1?X.Equals(cm.$0,cn.$0)?(co=[cn.$0,cn.$1,cm.$0,cm.$1],1):2:2:0){case 0:return{$:1,$0:cn};case 1:return $.startsWith(co[3],co[1]);case 2:return null;}};y.ofList=function(cm){var cn,co;co=[];cn=cm;while(!(cn.$==0)){co.push(v.head(cn));cn=v.tail(cn);}return co;};y.map2=function(cm,cn,co){var cp,cq,cr;y.checkLength(cn,co);cp=new a.Array(co.length);for(cq=0,cr=co.length-1;cq<=cr;cq++)cp[cq]=cm(cn[cq],co[cq]);return cp;};y.forall=function(cm,cn){var co,cp,cq,cr;co=true;cp=0;cr=y.length(cn);while(co&&cp<cr)if(cm(cn[cp]))cp=cp+1;else co=false;return co;};y.init=function(cm,cn){var co,cp,cq;if(cm<0)e.FailWith("Negative size given.");else null;co=new a.Array(cm);for(cp=0,cq=cm-1;cp<=cq;cp++)co[cp]=cn(cp);return co;};y.last=function(cm){y.nonEmpty(cm);return cm[cm.length-1];};y.iter=function(cm,cn){var co,cp;for(co=0,cp=cn.length-1;co<=cp;co++)cm(cn[co]);};y.findIndex=function(cm,cn){var co;co=y.tryFindIndex(cm,cn);return co==null?e.FailWith("KeyNotFoundException"):co.$0;};y.checkLength=function(cm,cn){if(cm.length!==cn.length)e.FailWith("The arrays have different lengths.");};y.nonEmpty=function(cm){if(cm.length===0)e.FailWith("The input array was empty.");};y.tryFindIndex=function(cm,cn){var co,cp;co=null;cp=0;while(cp<cn.length&&co==null){cm(cn[cp])?co={$:1,$0:cp}:void 0;cp=cp+1;}return co;};y.choose=function(cm,cn){var co,cp,cq,cr;co=[];for(cp=0,cq=cn.length-1;cp<=cq;cp++){cr=cm(cn[cp]);if(cr==null);else co.push(cr.$0);}return co;};y.tryPick=function(cm,cn){var co,cp,cq;co=null;cp=0;while(cp<cn.length&&co==null){cq=cm(cn[cp]);if(cq!=null&&cq.$==1)co=cq;cp=cp+1;}return co;};y.ofSeq=function(cm){var cn,co;if(cm instanceof a.Array)return cm.slice();else if(cm instanceof w)return y.ofList(cm);else{cn=[];co=bc.Get(cm);try{while(co.MoveNext())cn.push(co.Current());return cn;}finally{if(typeof co=="object"&&"Dispose"in co)co.Dispose();}}};y.exists=function(cm,cn){var co,cp,cq,cr;co=false;cp=0;cr=y.length(cn);while(!co&&cp<cr)if(cm(cn[cp]))co=true;else cp=cp+1;return co;};y.concat=function(cm){return a.Array.prototype.concat.apply([],y.ofSeq(cm));};y.filter=function(cm,cn){var co,cp,cq;co=[];for(cp=0,cq=cn.length-1;cp<=cq;cp++)if(cm(cn[cp]))co.push(cn[cp]);return co;};y.map=function(cm,cn){var co,cp,cq;co=new a.Array(cn.length);for(cp=0,cq=cn.length-1;cp<=cq;cp++)co[cp]=cm(cn[cp]);return co;};y.foldBack=function(cm,cn,co){var cp,cq,cr,cs,ct;cp=co;cr=cn.length;for(cs=1,ct=cr;cs<=ct;cs++)cp=cm(cn[cr-cs],cp);return cp;};y.pick=function(cm,cn){var co;co=y.tryPick(cm,cn);return co==null?e.FailWith("KeyNotFoundException"):co.$0;};y.sortInPlace=function(cm){y.mapInPlace(function(cn){return cn[0];},y.mapiInPlace(function(cn,co){return[co,cn];},cm).sort(X.Compare));};y.create=function(cm,cn){var co,cp,cq;co=new a.Array(cm);for(cp=0,cq=cm-1;cp<=cq;cp++)co[cp]=cn;return co;};bb=k.ConcreteVar=cg.Class({Get:function(){return this.current;},Update:function(cm){this.Set(cm(this.Get()));},Set:function(cm){if(this.isConst)(function(cn){return cn("WebSharper.UI: invalid attempt to change value of a Var after calling SetFinal");}(function(cn){cj.log(cn);}));else{U.Obsolete(this.snap);this.current=cm;this.snap=U.New({$:2,$0:cm,$1:[]});}},UpdateMaybe:function(cm){var cn;cn=cm(this.Get());if(cn!=null&&cn.$==1)this.Set(cn.$0);},get_View:function(){return this.view;}},I,bb);bb.New=cg.Ctor(function(cm,cn,co){var cp;cp=this;I.New.call(this);this.isConst=cm;this.current=co;this.snap=cn;this.view=function(){return cp.snap;};this.id=L.Int();},bb);bc.Get=function(cm){return cm instanceof a.Array?bc.ArrayEnumerator(cm):X.Equals(typeof cm,"string")?bc.StringEnumerator(cm):cm.GetEnumerator();};bc.ArrayEnumerator=function(cm){return new bd.New(0,null,function(cn){var co;co=cn.s;return co<y.length(cm)&&(cn.c=y.get(cm,co),cn.s=co+1,true);},void 0);};bc.StringEnumerator=function(cm){return new bd.New(0,null,function(cn){var co;co=cn.s;return co<cm.length&&(cn.c=cm[co],cn.s=co+1,true);},void 0);};bc.Get0=function(cm){return cm instanceof a.Array?bc.ArrayEnumerator(cm):X.Equals(typeof cm,"string")?bc.StringEnumerator(cm):"GetEnumerator0"in cm?cm.GetEnumerator0():cm.GetEnumerator();};bd=bc.T=cg.Class({MoveNext:function(){return this.n(this);},Current:function(){return this.c;},Dispose:function(){if(this.d)this.d(this);}},j,bd);bd.New=cg.Ctor(function(cm,cn,co,cp){j.New.call(this);this.s=cm;this.c=cn;this.n=co;this.d=cp;},bd);U.Obsolete=function(cm){var cn,co,cp,cq,cr;co=cm.s;if(co==null||(co!=null&&co.$==2?(cn=co.$1,false):co!=null&&co.$==3?(cn=co.$1,false):true))void 0;else{cm.s=null;for(cp=0,cq=y.length(cn)-1;cp<=cq;cp++){cr=y.get(cn,cp);if(typeof cr=="object")(function(cs){U.Obsolete(cs);}(cr));else cr();}}};U.New=function(cm){return{s:cm};};be=k.Doc=cg.Class({},j,be);be.ConvertSeqBy=function(cm,cn,co){return be.Flatten(x.MapSeqCachedViewBy(cm,function(cp,cq){return(cn(cp))(cq);},co));};be.TextNode=function(cm){return be.Mk({$:5,$0:self.document.createTextNode(cm)},x.Const());};be.TextView=function(cm){var cn;cn=bt.CreateTextNode();return be.Mk({$:4,$0:cn},x.Map(function(co){bt.UpdateTextNode(cn,co);},cm));};be.Flatten=function(cm){return be.EmbedView(x.Map(be.Concat,cm));};be.Mk=function(cm,cn){return new be.New(cm,cn);};be.RunInPlace=function(cm,cn,co){var cp;cp=bt.CreateRunState(cn,co.docNode);x.Sink(bL.get_UseAnimations()||bM.BatchUpdatesEnabled()?bN.StartProcessor(bt.PerformAnimatedUpdate(cm,cp,co.docNode)):function(){bt.PerformSyncUpdate(cm,cp,co.docNode);},co.updates);};be.Concat=function(cm){var cn;cn=bs.ofSeqNonCopying(cm);return bs.TreeReduce(be.get_Empty(),be.Append,cn);};be.EmbedView=function(cm){var cn;cn=bt.CreateEmbedNode();return be.Mk({$:2,$0:cn},x.Map(a.ignore,x.Bind(function(co){bt.UpdateEmbedNode(cn,co.docNode);return co.updates;},cm)));};be.get_Empty=function(){return be.Mk(null,x.Const());};be.Append=function(cm,cn){return be.Mk({$:0,$0:cm.docNode,$1:cn.docNode},x.Map2Unit(cm.updates,cn.updates));};be.New=cg.Ctor(function(cm,cn){j.New.call(this);this.docNode=cm;this.updates=cn;},be);bf=k.AttrProxy=cg.Class({},null,bf);bf.Concat=function(cm){var cn;cn=bs.ofSeqNonCopying(cm);return bs.TreeReduce(_2.EmptyAttr(),bf.Append,cn);};bf.Append=function(cm,cn){return _2.AppendTree(cm,cn);};bf.Handler=function(cm,cn){return bf.HandlerImpl(cm,cn);};bf.Create=function(cm,cn){return _2.Static(function(co){co.setAttribute(cm,cn);});};bf.HandlerImpl=function(cm,cn){return _2.Static(function(co){co.addEventListener(cm,function(cp){return(cn(co))(cp);},false);});};bg=k.DynamicAttrNode=cg.Class({NChanged:function(){return this.updates;},NGetExitAnim:function(cm){return bL.get_Empty();},NGetEnterAnim:function(cm){return bL.get_Empty();},NGetChangeAnim:function(cm){return bL.get_Empty();},NSync:function(cm){if(this.dirty){(this.push(cm))(this.value);this.dirty=false;}}},j,bg);bg.New=cg.Ctor(function(cm,cn){var co;co=this;j.New.call(this);this.push=cn;this.value=void 0;this.dirty=false;this.updates=x.Map(function(cp){co.value=cp;co.dirty=true;},cm);},bg);bh.toSafe=function(cm){return cm==null?"":cm;};bi.StartsWith=function(cm,cn){return cm.substring(0,cn.length)==cn;};bi.Substring=function(cm,cn,co){return cm.substr(cn,co);};bi.SplitChars=function(cm,cn,co){return bi.Split(cm,new a.RegExp("["+bi.RegexEscape(cn.join(""))+"]"),co);};bi.Split=function(cm,cn,co){return co===1?y.filter(function(cp){return cp!=="";},bi.SplitWith(cm,cn)):bi.SplitWith(cm,cn);};bi.RegexEscape=function(cm){return cm.replace(new a.RegExp("[-\\/\\\\^$*+?.()|[\\]{}]","g"),"\\$&");};bi.concat=function(cm,cn){return y.ofSeq(cn).join(cm);};bi.SplitWith=function(cm,cn){return cm.split(cn);};bi.forall=function(cm,cn){return R.forall(cm,bi.protect(cn));};bi.IsNullOrEmpty=function(cm){return cm==null||cm=="";};bi.Join=function(cm,cn){return cn.join(cm);};bi.protect=function(cm){return cm===null?"":cm;};bj.scheduler=function(){bQ.$cctor();return bQ.scheduler;};bj.Return=function(cm){return function(cn){cn.k({$:0,$0:cm});};};bj.Delay=function(cm){return function(cn){try{(cm(null))(cn);}catch(co){cn.k({$:1,$0:co});}};};bj.Bind=function(cm,cn){return bj.checkCancel(function(co){cm(b5.New(function(cp){var cq;if(cp.$==0){cq=cp.$0;bj.scheduler().Fork(function(){try{(cn(cq))(co);}catch(cr){co.k({$:1,$0:cr});}});}else bj.scheduler().Fork(function(){co.k(cp);});},co.ct));});};bj.Zero=function(){bQ.$cctor();return bQ.Zero;};bj.Start=function(cm,cn){var co,cp;co=(cp=(bj.defCTS())[0],cn==null?cp:cn.$0);bj.scheduler().Fork(function(){if(!co.c)cm(b5.New(function(cq){if(cq.$==1)bj.UncaughtAsyncError(cq.$0);},co));});};bj.checkCancel=function(cm){return function(cn){if(cn.ct.c)bj.cancel(cn);else cm(cn);};};bj.defCTS=function(){bQ.$cctor();return bQ.defCTS;};bj.UncaughtAsyncError=function(cm){cj.log("WebSharper: Uncaught asynchronous exception",cm);};bj.FromContinuations=function(cm){return function(cn){var co;function cp(cq){if(co[0])e.FailWith("A continuation provided by Async.FromContinuations was invoked multiple times");else{co[0]=true;bj.scheduler().Fork(cq);}}co=[false];cm(function(cq){cp(function(){cn.k({$:0,$0:cq});});},function(cq){cp(function(){cn.k({$:1,$0:cq});});},function(cq){cp(function(){cn.k({$:2,$0:cq});});});};};bj.cancel=function(cm){cm.k({$:2,$0:new cd.New(cm.ct)});};bk.$cctor=function(){bk.$cctor=a.ignore;bk.counter=0;};bl=_0.FSharpMap=cg.Class({Equals:function(cm){return this.get_Count()===cm.get_Count()&&R.forall2(X.Equals,this,cm);},GetEnumerator$1:function(){return bc.Get(R.map(function(cm){return{K:cm.Key,V:cm.Value};},bw.Enumerate(false,this.tree)));},get_Count:function(){var cm;cm=this.tree;return cm==null?0:cm.Count;},Add:function(cm,cn){return new bl.New$1(bw.Add(by.New(cm,cn),this.tree));},get_IsEmpty:function(){return this.tree==null;},get_Tree:function(){return this.tree;},GetHashCode:function(){return X.Hash(y.ofSeq(this));},GetEnumerator:function(){return this.GetEnumerator$1();},GetEnumerator0:function(){return this.GetEnumerator$1();},CompareTo0:function(cm){return R.compareWith(X.Compare,this,cm);}},j,bl);bl.New=cg.Ctor(function(cm){bl.New$1.call(this,bP.fromSeq(cm));},bl);bl.New$1=cg.Ctor(function(cm){j.New.call(this);this.tree=cm;},bl);bm=_0.Dictionary=cg.Class({set_Item:function(cm,cn){this.set(cm,cn);},set:function(cm,cn){var co,cp,cq,cr;co=this;cp=this.hash(cm);cq=this.data[cp];if(cq==null){this.count=this.count+1;this.data[cp]=new a.Array({K:cm,V:cn});}else{cr=y.tryFindIndex(function(cs){return co.equals.apply(null,[(e.KeyValue(cs))[0],cm]);},cq);cr==null?(this.count=this.count+1,cq.push({K:cm,V:cn})):cq[cr.$0]={K:cm,V:cn};}},TryGetValue:function(cm,cn){var co,cp,cq;co=this;cp=this.data[this.hash(cm)];return cp==null?false:(cq=y.tryPick(function(cr){var cs;cs=e.KeyValue(cr);return co.equals.apply(null,[cs[0],cm])?{$:1,$0:cs[1]}:null;},cp),cq!=null&&cq.$==1&&(cn.set(cq.$0),true));},ContainsKey:function(cm){var cn,co;cn=this;co=this.data[this.hash(cm)];return co==null?false:y.exists(function(cp){return cn.equals.apply(null,[(e.KeyValue(cp))[0],cm]);},co);},get_Item:function(cm){return this.get(cm);},get_Values:function(){return new bU.New(this);},get:function(cm){var cn,co;cn=this;co=this.data[this.hash(cm)];return co==null?bz.notPresent():y.pick(function(cp){var cq;cq=e.KeyValue(cp);return cn.equals.apply(null,[cq[0],cm])?{$:1,$0:cq[1]}:null;},co);},Remove:function(cm){return this.remove(cm);},get_Keys:function(){return new b2.New(this);},remove:function(cm){var cn,co,cp,cq;cn=this;co=this.hash(cm);cp=this.data[co];return cp==null?false:(cq=y.filter(function(cr){return!cn.equals.apply(null,[(e.KeyValue(cr))[0],cm]);},cp),y.length(cq)<cp.length&&(this.count=this.count-1,this.data[co]=cq,true));},GetEnumerator:function(){return bc.Get0(this);},GetEnumerator0:function(){return bc.Get0(y.concat(_6.GetFieldValues(this.data)));}},j,bm);bm.New$5=cg.Ctor(function(){bm.New$6.call(this,[],X.Equals,X.Hash);},bm);bm.New$6=cg.Ctor(function(cm,cn,co){var cp,cq;j.New.call(this);this.equals=cn;this.hash=co;this.count=0;this.data=[];cp=bc.Get(cm);try{while(cp.MoveNext()){cq=cp.Current();this.set(cq.K,cq.V);}}finally{if(typeof cp=="object"&&"Dispose"in cp)cp.Dispose();}},bm);bn=_0.HashSet=cg.Class({Add:function(cm){return this.add(cm);},Contains:function(cm){var cn;cn=this.data[this.hash(cm)];return cn==null?false:this.arrContains(cm,cn);},add:function(cm){var cn,co;cn=this.hash(cm);co=this.data[cn];return co==null?(this.data[cn]=[cm],this.count=this.count+1,true):this.arrContains(cm,co)?false:(co.push(cm),this.count=this.count+1,true);},arrContains:function(cm,cn){var co,cp,cq,cr;co=true;cp=0;cr=cn.length;while(co&&cp<cr)if(this.equals.apply(null,[cn[cp],cm]))co=false;else cp=cp+1;return!co;},ExceptWith:function(cm){var cn;cn=bc.Get(cm);try{while(cn.MoveNext())this.Remove(cn.Current());}finally{if(typeof cn=="object"&&"Dispose"in cn)cn.Dispose();}},get_Count:function(){return this.count;},CopyTo:function(cm){var cn,co,cp,cq;cn=0;co=b6.concat(this.data);for(cp=0,cq=co.length-1;cp<=cq;cp++)y.set(cm,cp,co[cp]);},IntersectWith:function(cm){var cn,co,cp,cq,cr;cn=new bn.New$4(cm,this.equals,this.hash);co=b6.concat(this.data);for(cp=0,cq=co.length-1;cp<=cq;cp++){cr=co[cp];if(!cn.Contains(cr))this.Remove(cr);}},Remove:function(cm){var cn;cn=this.data[this.hash(cm)];return cn==null?false:this.arrRemove(cm,cn)&&(this.count=this.count-1,true);},arrRemove:function(cm,cn){var co,cp,cq,cr;co=true;cp=0;cr=cn.length;while(co&&cp<cr)if(this.equals.apply(null,[cn[cp],cm])){cn.splice.apply(cn,[cp,1]);co=false;}else cp=cp+1;return!co;},GetEnumerator:function(){return bc.Get(b6.concat(this.data));},GetEnumerator0:function(){return bc.Get(b6.concat(this.data));}},j,bn);bn.New$3=cg.Ctor(function(){bn.New$4.call(this,[],X.Equals,X.Hash);},bn);bn.New$4=cg.Ctor(function(cm,cn,co){var cp;j.New.call(this);this.equals=cn;this.hash=co;this.data=[];this.count=0;cp=bc.Get(cm);try{while(cp.MoveNext())this.add(cp.Current());}finally{if(typeof cp=="object"&&"Dispose"in cp)cp.Dispose();}},bn);bn.New$2=cg.Ctor(function(cm){bn.New$4.call(this,cm,X.Equals,X.Hash);},bn);bo.$cctor=function(){bo.$cctor=a.ignore;bo.initialized=new bm.New$5();};bo=B.TemplateInitializer=cg.Class({},j,bo);bo.GetOrAddHoleFor=function(cm,cn,co){var cp,cq,cr,cs;bo.$cctor();cp=bo.GetHolesFor(cm);cq=(cr=null,[cp.TryGetValue(cn,{get:function(){return cr;},set:function(ct){cr=ct;}}),cr]);return cq[0]?cq[1]:(cs=co(),(cp.set_Item(cn,cs),cs));};bo.GetHolesFor=function(cm){var cn,co,cp;bo.$cctor();cn=(co=null,[bo.initialized.TryGetValue(cm,{get:function(){return co;},set:function(cq){co=cq;}}),co]);return cn[0]?cn[1]:(cp=new bm.New$5(),(bo.initialized.set_Item(cm,cp),cp));};bp=k.CheckedInput=cg.Class({get_Input:function(){return this.$==1?this.$0:this.$==2?this.$0:this.$1;}},null,bp);br.RunFullDocTemplate=function(cm){var cn,co,cp;return br.RenderedFullDocTemplate()==null?(cn=(br.LoadLocalTemplates(""),br.PrepareTemplateStrict("",null,self.document.body,null),co=br.ChildrenTemplate(self.document.body,cm),cp=self.document.body,function(cq){be.RunInPlace(true,cp,cq);}(co),co),(br.set_RenderedFullDocTemplate({$:1,$0:cn}),cn)):br.RenderedFullDocTemplate().$0;};br.LoadLocalTemplates=function(cm){!br.LocalTemplatesLoaded()?(br.set_LocalTemplatesLoaded(true),br.LoadNestedTemplates(self.document.body,"")):void 0;br.LoadedTemplates().set_Item(cm,br.LoadedTemplateFile(""));};br.NamedTemplate=function(cm,cn,co){var cp,cq;cp=(cq=null,[br.LoadedTemplateFile(cm).TryGetValue(cn==null?"":cn.$0,{get:function(){return cq;},set:function(cr){cq=cr;}}),cq]);return cp[0]?br.ChildrenTemplate(cp[1].cloneNode(true),co):(cj.warn("Local template doesn't exist",cn),be.get_Empty());};br.RenderedFullDocTemplate=function(){bH.$cctor();return bH.RenderedFullDocTemplate;};br.PrepareTemplateStrict=function(cm,cn,co,cp){var cq;function cr(cx,cy){var cz,cA,cB,cC,cD,cF,cG,cH,cI,cJ,cK,cL,cM,cN,cO,cP,cQ,cR,cS,cT,cU,cV,cW,cX,cY,cZ;function cE(c0){}while(true)switch(cx){case 0:if(cy!==null){cz=cy.nextSibling;if(X.Equals(cy.nodeType,_8.TEXT_NODE))bI.convertTextNode(cy);else if(X.Equals(cy.nodeType,_8.ELEMENT_NODE))ct(cy);cy=cz;}else return null;break;case 1:cF=bJ.string(cy.nodeName,{$:1,$0:3},null).toLowerCase();cG=(cA=cF.indexOf("."),cA===-1?[cm,cF]:[bJ.string(cF,null,{$:1,$0:cA-1}),bJ.string(cF,{$:1,$0:cA+1},null)]);cH=cG[1];cI=cG[0];if(cI!==""&&!br.LoadedTemplates().ContainsKey(cI))return bI.failNotLoaded(cH);else{if(cI===""&&cp!=null)cp.$0(cH);cJ=br.LoadedTemplates().get_Item(cI);if(!cJ.ContainsKey(cH))return bI.failNotLoaded(cH);else{cK=cJ.get_Item(cH);cL=cK.cloneNode(true);cM=new bn.New$3();cN=new bm.New$5();cO=cy.attributes;for(cP=0,cQ=cO.length-1;cP<=cQ;cP++){cR=cO.item(cP).name.toLowerCase();cN.set_Item(cR,(cS=cO.item(cP).nodeValue,cS===""?cR:cS.toLowerCase()));if(!cM.Add(cR))cj.warn("Hole mapped twice",cR);}for(cT=0,cU=cy.childNodes.length-1;cT<=cU;cT++){cV=cy.childNodes[cT];if(X.Equals(cV.nodeType,_8.ELEMENT_NODE))!cM.Add(cV.nodeName.toLowerCase())?cj.warn("Hole filled twice",cH):void 0;}cW=cy.childNodes.length===1&&X.Equals(cy.firstChild.nodeType,_8.TEXT_NODE);if(cW){cC=bI.fillTextHole(cL,cy.firstChild.textContent,cH);((function(c0){return function(c1){if(c1!=null)c0(c1.$0);};}((cD=function(c0){return function(c1){return c0.Add(c1);};}(cM),function(c0){return cE(cD(c0));})))(cC));}bI.removeHolesExcept(cL,cM);if(!cW){for(cX=0,cY=cy.childNodes.length-1;cX<=cY;cX++){cZ=cy.childNodes[cX];if(X.Equals(cZ.nodeType,_8.ELEMENT_NODE))cZ.hasAttributes()?bI.fillInstanceAttrs(cL,cZ):cs(cL,cZ);}}bI.mapHoles(cL,cN);bI.fill(cL,cy.parentNode,cy);cy.parentNode.removeChild(cy);return;}}break;}}function cs(cx,cy){var cz,cB,cC;function cA(cD,cE){var cF;if(cB==="title"&&cy.hasChildNodes()){cF=_3.ParseHTMLIntoFakeRoot(cy.textContent);cy.removeChild(cy.firstChild);while(cF.hasChildNodes())cy.appendChild(cF.firstChild);}else null;ct(cy);return bI.fill(cy,cD,cE);}cB=cy.nodeName.toLowerCase();br.foreachNotPreserved(cx,"[ws-attr-holes]",function(cD){var cE,cF,cG,cH,cI;cE=bi.SplitChars(cD.getAttribute("ws-attr-holes"),[" "],1);for(cF=0,cG=cE.length-1;cF<=cG;cF++){cH=y.get(cE,cF);cD.setAttribute(cH,(cI=new a.RegExp("\\${"+cB+"}","ig"),cD.getAttribute(cH).replace(cI,cy.textContent)));}});cC=cx.querySelector("[ws-hole="+cB+"]");if(X.Equals(cC,null)){cz=cx.querySelector("[ws-replace="+cB+"]");return X.Equals(cz,null)?null:(cA(cz.parentNode,cz),void cz.parentNode.removeChild(cz));}else{while(cC.hasChildNodes())cC.removeChild(cC.lastChild);cC.removeAttribute("ws-hole");return cA(cC,null);}}function ct(cx){if(!cx.hasAttribute("ws-preserve"))if(bi.StartsWith(cx.nodeName.toLowerCase(),"ws-"))cv(cx);else{bI.convertAttrs(cx);cu(cx.firstChild);}}function cu(cx){return cr(0,cx);}function cv(cx){return cr(1,cx);}function cw(cx){var cy,cz,cA,cB;while(true){cy=cx.querySelector("[ws-template]");if(X.Equals(cy,null)){cz=cx.querySelector("[ws-children-template]");if(X.Equals(cz,null))return null;else{cA=cz.getAttribute("ws-children-template");cz.removeAttribute("ws-children-template");br.PrepareTemplateStrict(cm,{$:1,$0:cA},cz,null);cx=cx;}}else{cB=cy.getAttribute("ws-template");(br.PrepareSingleTemplate(cm,{$:1,$0:cB},cy))(null);cx=cx;}}}cq=(cn==null?"":cn.$0).toLowerCase();br.LoadedTemplateFile(cm).set_Item(cq,co);if(co.hasChildNodes()){cw(co);cu(co.firstChild);}};br.ChildrenTemplate=function(cm,cn){var co,cp,cq,cr,cs;co=br.InlineTemplate(cm,R.append(cn,br.GlobalHoles().get_Values()));cp=co[1];cq=co[0];cr=cq.Els;return!X.Equals(cr,null)&&cr.length===1&&(y.get(cr,0)instanceof _8&&(X.Equals(y.get(cr,0).nodeType,_8.ELEMENT_NODE)&&(cs=y.get(cr,0),true)))?bK.TreeNode(cq,cp):be.Mk({$:6,$0:cq},cp);};br.set_RenderedFullDocTemplate=function(cm){bH.$cctor();bH.RenderedFullDocTemplate=cm;};br.LocalTemplatesLoaded=function(){bH.$cctor();return bH.LocalTemplatesLoaded;};br.set_LocalTemplatesLoaded=function(cm){bH.$cctor();bH.LocalTemplatesLoaded=cm;};br.LoadNestedTemplates=function(cm,cn){var cp,cq,cr,cs,ct,cu,cv,cw,cx,cy,cz,cA,cB;function co(cC){var cD,cE;if(!cp.ContainsKey(cC)){cD=(cE=null,[cq.TryGetValue(cC,{get:function(){return cE;},set:function(cF){cE=cF;}}),cE]);if(cD[0]){cB.Add(cC);cq.Remove(cC);br.PrepareTemplateStrict(cn,{$:1,$0:cC},cD[1],{$:1,$0:co});}else cj.warn(cB.Contains(cC)?"Encountered loop when instantiating "+cC:"Local template does not exist: "+cC);}}cp=br.LoadedTemplateFile(cn);cq=new bm.New$5();cr=cm.querySelectorAll("[ws-template]");for(cs=0,ct=cr.length-1;cs<=ct;cs++){cu=cr[cs];cv=cu.getAttribute("ws-template").toLowerCase();cu.removeAttribute("ws-template");cq.set_Item(cv,br.FakeRootSingle(cu));}cw=cm.querySelectorAll("[ws-children-template]");for(cx=0,cy=cw.length-1;cx<=cy;cx++){cz=cw[cx];cA=cz.getAttribute("ws-children-template").toLowerCase();cz.removeAttribute("ws-children-template");cq.set_Item(cA,br.FakeRoot(cz));}cB=new bn.New$3();while(cq.count>0)co(R.head(cq.get_Keys()));};br.LoadedTemplates=function(){bH.$cctor();return bH.LoadedTemplates;};br.LoadedTemplateFile=function(cm){var cn,co,cp;cn=(co=null,[br.LoadedTemplates().TryGetValue(cm,{get:function(){return co;},set:function(cq){co=cq;}}),co]);return cn[0]?cn[1]:(cp=new bm.New$5(),(br.LoadedTemplates().set_Item(cm,cp),cp));};br.foreachNotPreserved=function(cm,cn,co){_3.IterSelector(cm,cn,function(cp){if(cp.closest("[ws-preserve]")==null)co(cp);});};br.PrepareSingleTemplate=function(cm,cn,co){var cp;cp=br.FakeRootSingle(co);return function(cq){br.PrepareTemplateStrict(cm,cn,cp,cq);};};br.InlineTemplate=function(cm,cn){var co,cp,cq,cr,cu,cv,cw,cx,cy,cz,cA;function cs(cB,cC){var cD,cE,cF;cD=_2.Insert(cB,cC);cv.push(_2.Updates(cD));cw.push([cB,cD]);cE=cg.GetOptional(cD.OnAfterRender);return cE==null?null:(cF=cE.$0,void cx.push(function(){cF(cB);}));}function ct(cB){var cC,cD;cC=(cD=null,[cy.TryGetValue(cB,{get:function(){return cD;},set:function(cE){cD=cE;}}),cD]);return cC[0]?cC[1].$==0?{$:1,$0:cC[1].$1}:cC[1].$==1?{$:1,$0:be.TextNode(cC[1].$1)}:cC[1].$==2?{$:1,$0:be.TextView(cC[1].$1)}:cC[1].$==8?{$:1,$0:be.TextView(cC[1].$1.get_View())}:cC[1].$==9?{$:1,$0:be.TextView(x.Map(a.String,cC[1].$1.get_View()))}:cC[1].$==10?{$:1,$0:be.TextView(x.Map(function(cE){return cE.get_Input();},cC[1].$1.get_View()))}:cC[1].$==11?{$:1,$0:be.TextView(x.Map(a.String,cC[1].$1.get_View()))}:cC[1].$==12?{$:1,$0:be.TextView(x.Map(function(cE){return cE.get_Input();},cC[1].$1.get_View()))}:cC[1].$==13?{$:1,$0:be.TextView(x.Map(a.String,cC[1].$1.get_View()))}:(cj.warn("Content hole filled with attribute data",cB),null):null;}cu=[];cv=[];cw=[];cx=[];cy=new bm.New$5();cz=bc.Get(cn);try{while(cz.MoveNext()){cA=cz.Current();cy.set_Item(cA.$0,cA);}}finally{if(typeof cz=="object"&&"Dispose"in cz)cz.Dispose();}co=_3.ChildrenArray(cm);br.foreachNotPreserved(cm,"[ws-hole]",function(cB){var cC,cD,cE;cE=cB.getAttribute("ws-hole");cB.removeAttribute("ws-hole");while(cB.hasChildNodes())cB.removeChild(cB.lastChild);cC=ct(cE);if(cC!=null&&cC.$==1){cD=cC.$0;bt.LinkElement(cB,cD.docNode);cu.push(bF.New(_2.Empty(cB),cD.docNode,null,cB,L.Int(),null));cv.push(cD.updates);}});br.foreachNotPreserved(cm,"[ws-replace]",function(cB){var cC,cD,cE,cF,cG,cH;cC=ct(cB.getAttribute("ws-replace"));if(cC!=null&&cC.$==1){cD=cC.$0;cE=cB.parentNode;cF=self.document.createTextNode("");cE.replaceChild(cF,cB);cG=bt.InsertBeforeDelim(cF,cD.docNode);cH=y.tryFindIndex(function(cI){return cB===cI;},co);cH==null?void 0:y.set(co,cH.$0,cD.docNode);cu.push(bF.New(_2.Empty(cE),cD.docNode,{$:1,$0:[cG,cF]},cE,L.Int(),null));cv.push(cD.updates);}});br.foreachNotPreserved(cm,"[ws-attr]",function(cB){var cC,cD,cE;cC=cB.getAttribute("ws-attr");cB.removeAttribute("ws-attr");cD=(cE=null,[cy.TryGetValue(cC,{get:function(){return cE;},set:function(cF){cE=cF;}}),cE]);if(cD[0])cD[1].$==3?cs(cB,cD[1].$1):cj.warn("Attribute hole filled with non-attribute data",cC);});br.foreachNotPreserved(cm,"[ws-on]",function(cB){cs(cB,bf.Concat(y.choose(function(cC){var cD,cE,cF;cD=bi.SplitChars(cC,[":"],1);cE=(cF=null,[cy.TryGetValue(y.get(cD,1),{get:function(){return cF;},set:function(cG){cF=cG;}}),cF]);return cE[0]?cE[1].$==4?{$:1,$0:G.Handler(y.get(cD,0),cE[1].$1)}:cE[1].$==5?{$:1,$0:bf.Handler(y.get(cD,0),cE[1].$1)}:(cj.warn("Event hole on"+y.get(cD,0)+" filled with non-event data",y.get(cD,1)),null):null;},bi.SplitChars(cB.getAttribute("ws-on"),[" "],1))));cB.removeAttribute("ws-on");});br.foreachNotPreserved(cm,"[ws-onafterrender]",function(cB){var cC,cD,cE;cC=cB.getAttribute("ws-onafterrender");cD=(cE=null,[cy.TryGetValue(cC,{get:function(){return cE;},set:function(cF){cE=cF;}}),cE]);if(cD[0])cD[1].$==6?(cB.removeAttribute("ws-onafterrender"),cs(cB,G.OnAfterRender(cD[1].$1))):cD[1].$==7?(cB.removeAttribute("ws-onafterrender"),cs(cB,G.OnAfterRender(cD[1].$1))):cj.warn("onafterrender hole filled with non-onafterrender data",cC);});br.foreachNotPreserved(cm,"[ws-var]",function(cB){var cC,cD,cE;cC=cB.getAttribute("ws-var");cB.removeAttribute("ws-var");cD=(cE=null,[cy.TryGetValue(cC,{get:function(){return cE;},set:function(cF){cE=cF;}}),cE]);if(cD[0])cD[1].$==8?cs(cB,G.Value(cD[1].$1)):cD[1].$==9?cs(cB,G.Checked(cD[1].$1)):cD[1].$==10?cs(cB,G.IntValue(cD[1].$1)):cD[1].$==11?cs(cB,G.IntValueUnchecked(cD[1].$1)):cD[1].$==12?cs(cB,G.FloatValue(cD[1].$1)):cD[1].$==13?cs(cB,G.FloatValueUnchecked(cD[1].$1)):cj.warn("Var hole filled with non-Var data",cC);});br.foreachNotPreserved(cm,"[ws-attr-holes]",function(cB){var cC,cD,cE,cF;cC=new a.RegExp(br.TextHoleRE(),"g");cD=bi.SplitChars(cB.getAttribute("ws-attr-holes"),[" "],1);cB.removeAttribute("ws-attr-holes");for(cE=0,cF=cD.length-1;cE<=cF;cE++)(function(){var cG,cH,cI,cJ,cK,cL,cM,cN,cO,cP,cQ,cR,cS;cP=y.get(cD,cE);cQ=cB.getAttribute(cP);cG=null;cH=0;cR=[];while(cG=cC.exec(cQ),cG!==null){cS=bJ.string(cQ,{$:1,$0:cH},{$:1,$0:cC.lastIndex-y.get(cG,0).length-1});cH=cC.lastIndex;cR.push([cS,y.get(cG,1)]);}cJ=bJ.string(cQ,{$:1,$0:cH},null);cC.lastIndex=0;cK=y.foldBack(function(cT,cU){return(function(cV){var cW,cX;cW=cV[0];cX=cV[1];return function(cY){var cZ,c0,c1,c2,c3;cZ=cY[0];c0=cY[1];c1=(c2=(c3=null,[cy.TryGetValue(cX,{get:function(){return c3;},set:function(c4){c3=c4;}}),c3]),c2[0]?c2[1].$==1?{$:0,$0:c2[1].$1}:c2[1].$==2?{$:1,$0:c2[1].$1}:c2[1].$==8?{$:1,$0:c2[1].$1.get_View()}:c2[1].$==9?{$:1,$0:x.Map(a.String,c2[1].$1.get_View())}:c2[1].$==10?{$:1,$0:x.Map(function(c4){return c4.get_Input();},c2[1].$1.get_View())}:c2[1].$==11?{$:1,$0:x.Map(a.String,c2[1].$1.get_View())}:c2[1].$==12?{$:1,$0:x.Map(function(c4){return c4.get_Input();},c2[1].$1.get_View())}:c2[1].$==13?{$:1,$0:x.Map(a.String,c2[1].$1.get_View())}:(cj.warn("Attribute value hole filled with non-text data",cX),{$:0,$0:""}):{$:0,$0:""});return c1.$==1?[cW,new w({$:1,$0:cZ===""?c1.$0:x.Map(function(c4){return c4+cZ;},c1.$0),$1:c0})]:[cW+c1.$0+cZ,c0];};}(cT))(cU);},cR,[cJ,w.Empty]);return cs(cB,cK[1].$==1?cK[1].$1.$==1?cK[1].$1.$1.$==1?cK[1].$1.$1.$1.$==0?(cL=cK[0],G.Dynamic(cP,x.Map3(function(cT,cU,cV){return cL+cT+cU+cV;},cK[1].$0,cK[1].$1.$0,cK[1].$1.$1.$0))):(cM=cK[0],G.Dynamic(cP,x.Map(function(cT){return cM+bi.concat("",cT);},x.Sequence(cK[1])))):(cN=cK[0],G.Dynamic(cP,x.Map2(function(cT,cU){return cN+cT+cU;},cK[1].$0,cK[1].$1.$0))):cK[0]===""?G.Dynamic(cP,cK[1].$0):(cO=cK[0],G.Dynamic(cP,x.Map(function(cT){return cO+cT;},cK[1].$0))):bf.Create(cP,cK[0]));}());});return[cg.DeleteEmptyFields({Els:co,Dirty:true,Holes:cu,Attrs:cw,Render:(cp=cx.length==0?null:{$:1,$0:function(cB){y.iter(function(cC){cC(cB);},cx);}},cp?cp.$0:void 0),El:(cq=!X.Equals(co,null)&&co.length===1&&(y.get(co,0)instanceof _8&&(y.get(co,0)instanceof a.Element&&(cr=y.get(co,0),true)))?{$:1,$0:cr}:null,cq?cq.$0:void 0)},["Render","El"]),bs.TreeReduce(x.Const(),x.Map2Unit,cv)];};br.GlobalHoles=function(){bH.$cctor();return bH.GlobalHoles;};br.FakeRootSingle=function(cm){var cn,co,cp,cq;cm.removeAttribute("ws-template");cn=cm.getAttribute("ws-replace");if(cn===null);else{cm.removeAttribute("ws-replace");co=cm.parentNode;X.Equals(co,null)?void 0:(cp=self.document.createElement(cm.tagName),cp.setAttribute("ws-replace",cn),co.replaceChild(cp,cm));}cq=self.document.createElement("div");cq.appendChild(cm);return cq;};br.FakeRoot=function(cm){var cn;cn=self.document.createElement("div");while(cm.hasChildNodes())cn.appendChild(cm.firstChild);return cn;};br.TextHoleRE=function(){bH.$cctor();return bH.TextHoleRE;};bs.ofSeqNonCopying=function(cm){var cn,co;if(cm instanceof a.Array)return cm;else if(cm instanceof w)return y.ofList(cm);else if(cm===null)return[];else{cn=[];co=bc.Get(cm);try{while(co.MoveNext())cn.push(co.Current());return cn;}finally{if(typeof co=="object"&&"Dispose"in co)co.Dispose();}}};bs.TreeReduce=function(cm,cn,co){var cp;function cq(cr){return function(cs){var ct,cu;return cs<=0?cm:cs===1&&(cr>=0&&cr<cp)?y.get(co,cr):(cu=cs/2>>0,cn((cq(cr))(cu),(cq(cr+cu))(cs-cu)));};}cp=y.length(co);return(cq(0))(cp);};bs.mapInPlace=function(cm,cn){var co,cp;for(co=0,cp=cn.length-1;co<=cp;co++)cn[co]=cm(cn[co]);return cn;};bs.MapTreeReduce=function(cm,cn,co,cp){var cq;function cr(cs){return function(ct){var cu,cv;return ct<=0?cn:ct===1&&(cs>=0&&cs<cq)?cm(y.get(cp,cs)):(cv=ct/2>>0,co((cr(cs))(cv),(cr(cs+cv))(ct-cv)));};}cq=y.length(cp);return(cr(0))(cq);};bt.CreateTextNode=function(){return{Text:self.document.createTextNode(""),Dirty:false,Value:""};};bt.UpdateTextNode=function(cm,cn){cm.Value=cn;cm.Dirty=true;};bt.CreateRunState=function(cm,cn){return bW.New(bX.get_Empty(),bt.CreateElemNode(cm,_2.EmptyAttr(),cn));};bt.PerformAnimatedUpdate=function(cm,cn,co){var cp;return bL.get_UseAnimations()?(cp=null,bj.Delay(function(){var cq,cr,cs;cq=bX.FindAll(co);cr=bt.ComputeChangeAnim(cn,cq);cs=bt.ComputeEnterAnim(cn,cq);return bj.Bind(bL.Play(bL.Append(cr,bt.ComputeExitAnim(cn,cq))),function(){return bj.Bind(bt.SyncElemNodesNextFrame(cm,cn),function(){return bj.Bind(bL.Play(cs),function(){cn.PreviousNodes=cq;return bj.Return(null);});});});})):bt.SyncElemNodesNextFrame(cm,cn);};bt.PerformSyncUpdate=function(cm,cn,co){var cp;cp=bX.FindAll(co);bt.SyncElemNode(cm,cn.Top);cn.PreviousNodes=cp;};bt.CreateEmbedNode=function(){return{Current:null,Dirty:false};};bt.UpdateEmbedNode=function(cm,cn){cm.Current=cn;cm.Dirty=true;};bt.LinkElement=function(cm,cn){bt.InsertDoc(cm,cn,null);};bt.InsertBeforeDelim=function(cm,cn){var co,cp;co=cm.parentNode;cp=self.document.createTextNode("");co.insertBefore(cp,cm);bt.LinkPrevElement(cm,cn);return cp;};bt.CreateElemNode=function(cm,cn,co){var cp;bt.LinkElement(cm,co);cp=_2.Insert(cm,cn);return bF.New(cp,co,null,cm,L.Int(),cg.GetOptional(cp.OnAfterRender));};bt.SyncElemNodesNextFrame=function(cm,cn){function co(cp){a.requestAnimationFrame(function(){bt.SyncElemNode(cm,cn.Top);cp();});}return bM.BatchUpdatesEnabled()?bj.FromContinuations(function(cp,cq,cr){return co.apply(null,[cp,cq,cr]);}):(bt.SyncElemNode(cm,cn.Top),bj.Return(null));};bt.ComputeExitAnim=function(cm,cn){return bL.Concat(y.map(function(co){return _2.GetExitAnim(co.Attr);},bX.ToArray(bX.Except(cn,bX.Filter(function(co){return _2.HasExitAnim(co.Attr);},cm.PreviousNodes)))));};bt.ComputeEnterAnim=function(cm,cn){return bL.Concat(y.map(function(co){return _2.GetEnterAnim(co.Attr);},bX.ToArray(bX.Except(cm.PreviousNodes,bX.Filter(function(co){return _2.HasEnterAnim(co.Attr);},cn)))));};bt.ComputeChangeAnim=function(cm,cn){var co;function cp(cq){return _2.HasChangeAnim(cq.Attr);}co=function(cq){return bX.Filter(cp,cq);};return bL.Concat(y.map(function(cq){return _2.GetChangeAnim(cq.Attr);},bX.ToArray(bX.Intersect(co(cm.PreviousNodes),co(cn)))));};bt.SyncElemNode=function(cm,cn){!cm?bt.SyncElement(cn):void 0;bt.Sync(cn.Children);bt.AfterRender(cn);};bt.InsertDoc=function(cm,cn,co){var cp,cq,cr;while(true)if(cn!=null&&cn.$==1)return bt.InsertNode(cm,cn.$0.El,co);else if(cn!=null&&cn.$==2){cp=cn.$0;cp.Dirty=false;cn=cp.Current;}else if(cn==null)return co;else if(cn!=null&&cn.$==4)return bt.InsertNode(cm,cn.$0.Text,co);else if(cn!=null&&cn.$==5)return bt.InsertNode(cm,cn.$0,co);else if(cn!=null&&cn.$==6)return y.foldBack(function(cs,ct){return(((cg.Curried3(function(cu,cv,cw){return cv==null||cv.constructor===ba?bt.InsertDoc(cu,cv,cw):bt.InsertNode(cu,cv,cw);}))(cm))(cs))(ct);},cn.$0.Els,co);else{cq=cn.$1;cr=cn.$0;cn=cr;co=bt.InsertDoc(cm,cq,co);}};bt.LinkPrevElement=function(cm,cn){bt.InsertDoc(cm.parentNode,cn,cm);};bt.SyncElement=function(cm){function cn(co){function cp(cq){var cr,cs,ct,cu;while(true){if(cq!=null&&cq.$==0){cs=cq.$1;ct=cq.$0;if(cp(ct))return true;else cq=cs;}else if(cq!=null&&cq.$==2){cu=cq.$0;if(cu.Dirty)return true;else cq=cu.Current;}else return cq!=null&&cq.$==6&&(cr=cq.$0,cr.Dirty||y.exists(cn,cr.Holes));}}return cp(co.Children);}_2.Sync(cm.El,cm.Attr);if(cn(cm))bt.DoSyncElement(cm);};bt.Sync=function(cm){var cn,co,cp,cq,cr;while(true){if(cm!=null&&cm.$==1)return bt.SyncElemNode(false,cm.$0);else if(cm!=null&&cm.$==2){cp=cm.$0;cm=cp.Current;}else if(cm==null)return null;else if(cm!=null&&cm.$==5)return null;else if(cm!=null&&cm.$==4){cn=cm.$0;return cn.Dirty?(cn.Text.nodeValue=cn.Value,cn.Dirty=false):null;}else if(cm!=null&&cm.$==6){co=cm.$0;y.iter(function(cs){return function(ct){bt.SyncElemNode(cs,ct);};}(false),co.Holes);y.iter(function(cs){_2.Sync(cs[0],cs[1]);},co.Attrs);return bt.AfterRender(co);}else{cq=cm.$1;cr=cm.$0;bt.Sync(cr);cm=cq;}}};bt.AfterRender=function(cm){var cn;cn=cg.GetOptional(cm.Render);if(cn!=null&&cn.$==1){cn.$0(cm.El);cg.SetOptional(cm,"Render",null);}};bt.InsertNode=function(cm,cn,co){_3.InsertAt(cm,co,cn);return cn;};bt.DoSyncElement=function(cm){var cn,co,cp;function cq(cr,cs){var ct,cu,cv,cw;while(true){if(cr!=null&&cr.$==1)return cr.$0.El;else if(cr!=null&&cr.$==2){cu=cr.$0;if(cu.Dirty){cu.Dirty=false;return bt.InsertDoc(cn,cu.Current,cs);}else cr=cu.Current;}else if(cr==null)return cs;else if(cr!=null&&cr.$==4)return cr.$0.Text;else if(cr!=null&&cr.$==5)return cr.$0;else if(cr!=null&&cr.$==6){ct=cr.$0;ct.Dirty?ct.Dirty=false:void 0;return y.foldBack(function(cx,cy){return cx==null||cx.constructor===ba?cq(cx,cy):cx;},ct.Els,cs);}else{cv=cr.$1;cw=cr.$0;cr=cw;cs=cq(cv,cs);}}}cn=cm.El;cb.Iter((co=cm.El,function(cr){_3.RemoveNode(co,cr);}),cb.Except(cb.DocChildren(cm),cb.Children(cm.El,cg.GetOptional(cm.Delimiters))));cq(cm.Children,(cp=cg.GetOptional(cm.Delimiters),cp!=null&&cp.$==1?cp.$0[1]:null));};bu.OfArray=function(cm){return new bl.New$1(bw.OfSeq(R.map(function(cn){return by.New(cn[0],cn[1]);},cm)));};bu.FoldBack=function(cm,cn,co){return R.fold(function(cp,cq){return cm(cq.Key,cq.Value,cp);},co,bw.Enumerate(true,cn.get_Tree()));};bu.ToSeq=function(cm){return R.map(function(cn){return[cn.Key,cn.Value];},bw.Enumerate(false,cm.get_Tree()));};bv.CreateFromValue=function(cm){return bB.New(true,cm,bv.cachedLazy);};bv.cachedLazy=function(){return this.v;};bv.Create=function(cm){return bB.New(false,cm,bv.forceLazy);};bv.forceLazy=function(){var cm;cm=this.v();this.c=true;this.v=cm;this.f=bv.cachedLazy;return cm;};bx.New=function(cm,cn,co,cp,cq){return{Node:cm,Left:cn,Right:co,Height:cp,Count:cq};};by=_0.Pair=cg.Class({Equals:function(cm){return X.Equals(this.Key,cm.Key);},GetHashCode:function(){return X.Hash(this.Key);},CompareTo0:function(cm){return X.Compare(this.Key,cm.Key);}},null,by);by.New=function(cm,cn){return new by({Key:cm,Value:cn});};bz.notPresent=function(){return e.FailWith("The given key was not present in the dictionary.");};bB.New=function(cm,cn,co){return{c:cm,v:cn,f:co};};bC=bj.Scheduler=cg.Class({Fork:function(cm){var cn;cn=this;this.robin.push(cm);if(this.idle){this.idle=false;a.setTimeout(function(){cn.tick();},0);}},tick:function(){var cm,cn,co;cn=this;co=cl.now();cm=true;while(cm)if(this.robin.length===0){this.idle=true;cm=false;}else{(this.robin.shift())();cl.now()-co>40?(a.setTimeout(function(){cn.tick();},0),cm=false):void 0;}}},j,bC);bC.New=cg.Ctor(function(){j.New.call(this);this.idle=true;this.robin=[];},bC);bD.WriteLink=function(cm,cn){var co;co=cn.get_IsEmpty()?"":"?"+bD.WriteQuery(cn);return"/"+bD.Concat(cm)+co;};bD.Concat=function(cm){var cn,co;cn=[];co=true;v.iter(function(cp){if(!bi.IsNullOrEmpty(cp)){co?co=false:cn.push("/");cn.push(cp);}},cm);return bi.Join("",y.ofSeq(cn));};bD.WriteQuery=function(cm){function cn(co,cp){return co+"="+cp;}return bi.concat("&",R.map(function(co){return cn(co[0],co[1]);},bu.ToSeq(cm)));};bE.Clear=function(cm){cm.splice(0,y.length(cm));};bF=k.DocElemNode=cg.Class({Equals:function(cm){return this.ElKey===cm.ElKey;},GetHashCode:function(){return this.ElKey;}},null,bF);bF.New=function(cm,cn,co,cp,cq,cr){var cs;return new bF((cs={Attr:cm,Children:cn,El:cp,ElKey:cq},(cg.SetOptional(cs,"Delimiters",co),cg.SetOptional(cs,"Render",cr),cs)));};bH.$cctor=function(){bH.$cctor=a.ignore;bH.LoadedTemplates=new bm.New$5();bH.LocalTemplatesLoaded=false;bH.GlobalHoles=new bm.New$5();bH.TextHoleRE="\\${([^}]+)}";bH.RenderedFullDocTemplate=null;};bI.convertTextNode=function(cm){var cn,co,cp,cq,cr,cs;cn=null;co=0;cq=cm.textContent;cr=new a.RegExp(br.TextHoleRE(),"g");while(cn=cr.exec(cq),cn!==null){cm.parentNode.insertBefore(self.document.createTextNode(bJ.string(cq,{$:1,$0:co},{$:1,$0:cr.lastIndex-y.get(cn,0).length-1})),cm);co=cr.lastIndex;cs=self.document.createElement("span");cs.setAttribute("ws-replace",y.get(cn,1).toLowerCase());cm.parentNode.insertBefore(cs,cm);}cr.lastIndex=0;cm.textContent=bJ.string(cq,{$:1,$0:co},null);};bI.failNotLoaded=function(cm){cj.warn("Instantiating non-loaded template",cm);};bI.fillTextHole=function(cm,cn,co){var cp;cp=cm.querySelector("[ws-replace]");return X.Equals(cp,null)?(cj.warn("Filling non-existent text hole",co),null):(cp.parentNode.replaceChild(self.document.createTextNode(cn),cp),{$:1,$0:cp.getAttribute("ws-replace")});};bI.removeHolesExcept=function(cm,cn){function co(cp){br.foreachNotPreserved(cm,"["+cp+"]",function(cq){if(!cn.Contains(cq.getAttribute(cp)))cq.removeAttribute(cp);});}co("ws-attr");co("ws-onafterrender");co("ws-var");br.foreachNotPreserved(cm,"[ws-hole]",function(cp){if(!cn.Contains(cp.getAttribute("ws-hole"))){cp.removeAttribute("ws-hole");while(cp.hasChildNodes())cp.removeChild(cp.lastChild);}});br.foreachNotPreserved(cm,"[ws-replace]",function(cp){if(!cn.Contains(cp.getAttribute("ws-replace")))cp.parentNode.removeChild(cp);});br.foreachNotPreserved(cm,"[ws-on]",function(cp){cp.setAttribute("ws-on",bi.concat(" ",y.filter(function(cq){return cn.Contains(y.get(bi.SplitChars(cq,[":"],1),1));},bi.SplitChars(cp.getAttribute("ws-on"),[" "],1))));});br.foreachNotPreserved(cm,"[ws-attr-holes]",function(cp){var cq,cr,cs,ct,cu;cq=bi.SplitChars(cp.getAttribute("ws-attr-holes"),[" "],1);for(cr=0,cs=cq.length-1;cr<=cs;cr++){ct=y.get(cq,cr);cp.setAttribute(ct,(cu=new a.RegExp(br.TextHoleRE(),"g"),cp.getAttribute(ct).replace(cu,function(cv,cw){return cn.Contains(cw)?cv:"";})));}});};bI.fillInstanceAttrs=function(cm,cn){var co,cp,cq,cr,cs;bI.convertAttrs(cn);co=cn.nodeName.toLowerCase();cp=cm.querySelector("[ws-attr="+co+"]");if(X.Equals(cp,null))cj.warn("Filling non-existent attr hole",co);else{cp.removeAttribute("ws-attr");for(cq=0,cr=cn.attributes.length-1;cq<=cr;cq++){cs=cn.attributes.item(cq);if(cs.name==="class"&&cp.hasAttribute("class"))cp.setAttribute("class",cp.getAttribute("class")+" "+cs.nodeValue);else cp.setAttribute(cs.name,cs.nodeValue);}}};bI.mapHoles=function(cm,cn){function co(cp){br.foreachNotPreserved(cm,"["+cp+"]",function(cq){var cr,cs;cr=(cs=null,[cn.TryGetValue(cq.getAttribute(cp).toLowerCase(),{get:function(){return cs;},set:function(ct){cs=ct;}}),cs]);if(cr[0])cq.setAttribute(cp,cr[1]);});}co("ws-hole");co("ws-replace");co("ws-attr");co("ws-onafterrender");co("ws-var");br.foreachNotPreserved(cm,"[ws-on]",function(cp){cp.setAttribute("ws-on",bi.concat(" ",y.map(function(cq){var cr,cs,ct;cr=bi.SplitChars(cq,[":"],1);cs=(ct=null,[cn.TryGetValue(y.get(cr,1),{get:function(){return ct;},set:function(cu){ct=cu;}}),ct]);return cs[0]?y.get(cr,0)+":"+cs[1]:cq;},bi.SplitChars(cp.getAttribute("ws-on"),[" "],1))));});br.foreachNotPreserved(cm,"[ws-attr-holes]",function(cp){var cq,cr,cs;cq=bi.SplitChars(cp.getAttribute("ws-attr-holes"),[" "],1);for(cr=0,cs=cq.length-1;cr<=cs;cr++)(function(){var ct;function cu(cv,cw){var cx;cx=e.KeyValue(cw);return cv.replace(new a.RegExp("\\${"+cx[0]+"}","ig"),"${"+cx[1]+"}");}ct=y.get(cq,cr);return cp.setAttribute(ct,(((cg.Curried3(R.fold))(cu))(cp.getAttribute(ct)))(cn));}());});};bI.fill=function(cm,cn,co){while(true)if(cm.hasChildNodes())co=cn.insertBefore(cm.lastChild,co);else return null;};bI.convertAttrs=function(cm){var co,cp,cq,cr,cs,ct,cu,cv;function cn(cw){var cx;cx=cm.getAttribute(cw);if(cx===null);else cm.setAttribute(cw,cx.toLowerCase());}co=cm.attributes;cp=[];cq=[];cr=[];for(cs=0,ct=co.length-1;cs<=ct;cs++){cu=co.item(cs);if(bi.StartsWith(cu.nodeName,"ws-on")&&cu.nodeName!=="ws-onafterrender"&&cu.nodeName!=="ws-on"){cp.push(cu.nodeName);cq.push(bJ.string(cu.nodeName,{$:1,$0:"ws-on".length},null)+":"+cu.nodeValue.toLowerCase());}else!bi.StartsWith(cu.nodeName,"ws-")&&(new a.RegExp(br.TextHoleRE())).test(cu.nodeValue)?(cu.nodeValue=(cv=new a.RegExp(br.TextHoleRE(),"g"),cu.nodeValue.replace(cv,function(cw,cx){return"${"+cx.toLowerCase()+"}";})),cr.push(cu.nodeName)):void 0;}if(!(cq.length==0))cm.setAttribute("ws-on",bi.concat(" ",cq));if(!(cr.length==0))cm.setAttribute("ws-attr-holes",bi.concat(" ",cr));cn("ws-hole");cn("ws-replace");cn("ws-attr");cn("ws-onafterrender");cn("ws-var");y.iter(function(cw){cm.removeAttribute(cw);},cp);};bJ.string=function(cm,cn,co){return cn==null?co!=null&&co.$==1?cm.slice(0,co.$0+1):"":co==null?cm.slice(cn.$0):cm.slice(cn.$0,co.$0+1);};bK=k.Elt=cg.Class({},be,bK);bK.TreeNode=function(cm,cn){var co,cp;function cq(cr){return cr[1];}co=bT.Create(cn);return new bK.New$1({$:6,$0:cm},x.Map2Unit((cp=y.map(function(cr){return _2.Updates(cq(cr));},cm.Attrs),bs.TreeReduce(x.Const(),x.Map2Unit,cp)),co.v),y.get(cm.Els,0),co);};bK.New$1=cg.Ctor(function(cm,cn,co,cp){be.New.call(this,cm,cn);this.docNode$1=cm;this.updates$1=cn;this.elt=co;this.rvUpdates=cp;},bK);bL.get_UseAnimations=function(){return bY.UseAnimations();};bL.Play=function(cm){var cn;cn=null;return bj.Delay(function(){return bj.Bind(bL.Run(a.ignore,bY.Actions(cm)),function(){bY.Finalize(cm);return bj.Return(null);});});};bL.Append=function(cm,cn){return{$:0,$0:b9.Append(cm.$0,cn.$0)};};bL.Run=function(cm,cn){var co;function cp(cq){function cr(cs){return function(ct){var cu;cu=ct-cs;cn.Compute(cu);cm();return cu<=co?void a.requestAnimationFrame(function(cv){(cr(cs))(cv);}):cq();};}a.requestAnimationFrame(function(cs){(cr(cs))(cs);});}co=cn.Duration;return co===0?bj.Zero():bj.FromContinuations(function(cq,cr,cs){return cp.apply(null,[cq,cr,cs]);});};bL.Concat=function(cm){return{$:0,$0:b9.Concat(R.map(bY.List,cm))};};bL.get_Empty=function(){return{$:0,$0:b9.Empty()};};bM.BatchUpdatesEnabled=function(){bZ.$cctor();return bZ.BatchUpdatesEnabled;};bN.StartProcessor=function(cm){var cn;function co(){var cp;cp=null;return bj.Delay(function(){return bj.Bind(cm,function(){var cq;cq=cn[0];return cq===1?(cn[0]=0,bj.Zero()):cq===2?(cn[0]=1,co()):bj.Zero();});});}cn=[0];return function(){var cp;cp=cn[0];if(cp===0){cn[0]=1;bj.Start(co(),null);}else cp===1?cn[0]=2:void 0;};};bO.$cctor=function(){var cm,cn,co,cp,cq,cr,cs,ct,cu,cv;bO.$cctor=a.ignore;bO.EmptyAttr=null;bO.BoolCheckedApply=cg.Curried3(function(cw,cx,cy){return[cx(function(cz){cz.addEventListener("change",function(){return!X.Equals(cw.Get(),cz.checked)?cw.Set(cz.checked):null;});}),cy(function(cz){return function(cA){cz.checked=cA;};})];});bO.StringSet=function(cw){return function(cx){cw.value=cx;};};bO.StringGet=function(cw){return{$:1,$0:cw.value};};bO.StringApply=(cm=b0.StringGet(),(cn=b0.StringSet(),cg.Curried(b0.ApplyValue,3,[cm,function(cw,cx){return(cn(cw))(cx);}])));bO.IntSetUnchecked=function(cw){return function(cx){cw.value=a.String(cx);};};bO.IntGetUnchecked=function(cw){var cx,cy;cx=cw.value;return b1.isBlank(cx)?{$:1,$0:0}:(cy=+cx,cy!==cy>>0?null:{$:1,$0:cy});};bO.IntApplyUnchecked=(co=b0.IntGetUnchecked(),(cp=b0.IntSetUnchecked(),cg.Curried(b0.ApplyValue,3,[co,function(cw,cx){return(cp(cw))(cx);}])));bO.IntSetChecked=function(cw){return function(cx){var cy;cy=cx.get_Input();return cw.value!==cy?void(cw.value=cy):null;};};bO.IntGetChecked=function(cw){var cx,cy,cz;cx=cw.value;return{$:1,$0:b1.isBlank(cx)?(cw.checkValidity?cw.checkValidity():true)?new bp({$:2,$0:cx}):new bp({$:1,$0:cx}):(cy=(cz=0,[M.TryParseInt32(cx,{get:function(){return cz;},set:function(cA){cz=cA;}}),cz]),cy[0]?new bp({$:0,$0:cy[1],$1:cx}):new bp({$:1,$0:cx}))};};bO.IntApplyChecked=(cq=b0.IntGetChecked(),(cr=b0.IntSetChecked(),cg.Curried(b0.ApplyValue,3,[cq,function(cw,cx){return(cr(cw))(cx);}])));bO.FloatSetUnchecked=function(cw){return function(cx){cw.value=a.String(cx);};};bO.FloatGetUnchecked=function(cw){var cx,cy;cx=cw.value;return b1.isBlank(cx)?{$:1,$0:0}:(cy=+cx,a.isNaN(cy)?null:{$:1,$0:cy});};bO.FloatApplyUnchecked=(cs=b0.FloatGetUnchecked(),(ct=b0.FloatSetUnchecked(),cg.Curried(b0.ApplyValue,3,[cs,function(cw,cx){return(ct(cw))(cx);}])));bO.FloatSetChecked=function(cw){return function(cx){var cy;cy=cx.get_Input();return cw.value!==cy?void(cw.value=cy):null;};};bO.FloatGetChecked=function(cw){var cx,cy;cx=cw.value;return{$:1,$0:b1.isBlank(cx)?(cw.checkValidity?cw.checkValidity():true)?new bp({$:2,$0:cx}):new bp({$:1,$0:cx}):(cy=+cx,a.isNaN(cy)?new bp({$:1,$0:cx}):new bp({$:0,$0:cy,$1:cx}))};};bO.FloatApplyChecked=(cu=b0.FloatGetChecked(),(cv=b0.FloatSetChecked(),cg.Curried(b0.ApplyValue,3,[cu,function(cw,cx){return(cv(cw))(cx);}])));};bP.fromSeq=function(cm){var cn;cn=y.ofSeq(R.map(function(co){return by.New(co[0],co[1]);},R.distinctBy(function(co){return co[0];},R.rev(cm))));y.sortInPlace(cn);return bw.Build(cn,0,cn.length-1);};bQ.$cctor=function(){bQ.$cctor=a.ignore;bQ.noneCT=b3.New(false,[]);bQ.scheduler=new bC.New();bQ.defCTS=[new b4.New()];bQ.Zero=bj.Return();bQ.GetCT=function(cm){cm.k({$:0,$0:cm.ct});};};bw.OfSeq=function(cm){var cn;cn=y.ofSeq(R.distinct(cm));y.sortInPlace(cn);return bw.Build(cn,0,cn.length-1);};bw.Enumerate=function(cm,cn){function co(cp,cq){var cr;while(true)if(cp==null)return cq.$==1?{$:1,$0:[cq.$0[0],[cq.$0[1],cq.$1]]}:null;else if(cm){cr=cp;cp=cr.Right;cq=new w({$:1,$0:[cr.Node,cr.Left],$1:cq});}else{cr=cp;cp=cr.Left;cq=new w({$:1,$0:[cr.Node,cr.Right],$1:cq});}}return R.unfold(function(cp){return co(cp[0],cp[1]);},[cn,w.Empty]);};bw.Build=function(cm,cn,co){var cp,cq,cr;return co-cn+1<=0?null:(cp=(cn+co)/2>>0,(cq=bw.Build(cm,cn,cp-1),(cr=bw.Build(cm,cp+1,co),bw.Branch(y.get(cm,cp),cq,cr))));};bw.Add=function(cm,cn){return bw.Put(function(co,cp){return cp;},cm,cn);};bw.Branch=function(cm,cn,co){var cp,cq;return bx.New(cm,cn,co,1+(cp=cn==null?0:cn.Height,(cq=co==null?0:co.Height,X.Compare(cp,cq)===1?cp:cq)),1+(cn==null?0:cn.Count)+(co==null?0:co.Count));};bw.Put=function(cm,cn,co){var cp,cq;cp=bw.Lookup(cn,co);cq=cp[0];return cq==null?bw.Rebuild(cp[1],bw.Branch(cn,null,null)):bw.Rebuild(cp[1],bw.Branch(cm(cq.Node,cn),cq.Left,cq.Right));};bw.Lookup=function(cm,cn){var co,cp,cq,cr;co=[];cp=cn;cq=true;while(cq)if(cp==null)cq=false;else{cr=X.Compare(cm,cp.Node);if(cr===0)cq=false;else cr===1?(co.unshift([true,cp.Node,cp.Left]),cp=cp.Right):(co.unshift([false,cp.Node,cp.Right]),cp=cp.Left);}return[cp,co];};bw.Rebuild=function(cm,cn){var co,cq,cr,cs,ct,cu,cv,cw,cx,cy;function cp(cz){return cz==null?0:cz.Height;}co=cn;for(cq=0,cr=y.length(cm)-1;cq<=cr;cq++){co=(cs=y.get(cm,cq),cs[0]?(ct=cs[1],(cu=cs[2],cp(co)>cp(cu)+1?cp(co.Left)===cp(co.Right)+1?(cv=co.Left,bw.Branch(cv.Node,bw.Branch(ct,cu,cv.Left),bw.Branch(co.Node,cv.Right,co.Right))):bw.Branch(co.Node,bw.Branch(ct,cu,co.Left),co.Right):bw.Branch(ct,cu,co))):(cw=cs[1],(cx=cs[2],cp(co)>cp(cx)+1?cp(co.Right)===cp(co.Left)+1?(cy=co.Right,bw.Branch(cy.Node,bw.Branch(co.Node,co.Left,cy.Left),bw.Branch(cw,cy.Right,cx))):bw.Branch(co.Node,co.Left,bw.Branch(cw,co.Right,cx)):bw.Branch(cw,co,cx))));}return co;};bS.New=function(cm,cn,co,cp){var cq;cq={DynElem:cm,DynFlags:cn,DynNodes:co};cg.SetOptional(cq,"OnAfterRender",cp);return cq;};bT=k.Updates=cg.Class({},null,bT);bT.Create=function(cm){var cn;cn=null;cn=bT.New(cm,null,function(){var co;co=cn.s;return co===null?(co=U.Copy(cn.c()),cn.s=co,U.WhenObsoleteRun(co,function(){cn.s=null;}),co):co;});return cn;};bT.New=function(cm,cn,co){return new bT({c:cm,s:cn,v:co});};bU=_0.ValueCollection=cg.Class({GetEnumerator$1:function(){return bc.Get(R.map(function(cm){return cm.V;},this.d));},GetEnumerator:function(){return this.GetEnumerator$1();},GetEnumerator0:function(){return this.GetEnumerator$1();}},j,bU);bU.New=cg.Ctor(function(cm){j.New.call(this);this.d=cm;},bU);bW.New=function(cm,cn){return{PreviousNodes:cm,Top:cn};};bX.get_Empty=function(){return{$:0,$0:new bn.New$3()};};bX.FindAll=function(cm){var cn;function co(cr,cs){var ct,cu,cv,cw,cx;while(true)switch(cr){case 0:if(cs!=null&&cs.$==0){cu=cs.$1;cv=cs.$0;co(0,cv);cs=cu;}else if(cs!=null&&cs.$==1){cw=cs.$0;cs=cw;cr=1;}else if(cs!=null&&cs.$==2){cx=cs.$0;cs=cx.Current;}else return cs!=null&&cs.$==6?(ct=cs.$0.Holes,(function(cy){return function(cz){y.iter(cy,cz);};}(cq))(ct)):null;break;case 1:cn.push(cs);cs=cs.Children;cr=0;break;}}function cp(cr){return co(0,cr);}function cq(cr){return co(1,cr);}cn=[];cp(cm);return{$:0,$0:new bn.New$2(cn)};};bX.Filter=function(cm,cn){return{$:0,$0:ca.Filter(cm,cn.$0)};};bX.Except=function(cm,cn){return{$:0,$0:ca.Except(cm.$0,cn.$0)};};bX.ToArray=function(cm){return ca.ToArray(cm.$0);};bX.Intersect=function(cm,cn){return{$:0,$0:ca.Intersect(cm.$0,cn.$0)};};bY.UseAnimations=function(){b8.$cctor();return b8.UseAnimations;};bY.Actions=function(cm){return bY.ConcatActions(y.choose(function(cn){return cn.$==1?{$:1,$0:cn.$0}:null;},b9.ToArray(cm.$0)));};bY.Finalize=function(cm){y.iter(function(cn){if(cn.$==0)cn.$0();},b9.ToArray(cm.$0));};bY.ConcatActions=function(cm){var cn,co,cp,cq;cn=bs.ofSeqNonCopying(cm);co=y.length(cn);return co===0?bY.Const():co===1?y.get(cn,0):(cp=R.max(R.map(function(cr){return cr.Duration;},cn)),(cq=y.map(function(cr){return bY.Prolong(cp,cr);},cn),bY.Def(cp,function(cr){y.iter(function(cs){cs.Compute(cr);},cq);})));};bY.List=function(cm){return cm.$0;};bY.Const=function(cm){return bY.Def(0,function(){return cm;});};bY.Def=function(cm,cn){return{Compute:cn,Duration:cm};};bY.Prolong=function(cm,cn){var co,cp,cq;co=cn.Compute;cp=cn.Duration;cq=bv.Create(function(){return cn.Compute(cn.Duration);});return{Compute:function(cr){return cr>=cp?cq.f():co(cr);},Duration:cm};};bZ.$cctor=function(){bZ.$cctor=a.ignore;bZ.BatchUpdatesEnabled=true;};b0.ApplyValue=function(cm,cn,co,cp,cq){return[cp(function(cr){function cs(){co.UpdateMaybe(function(ct){var cu,cv;cu=cm(cr);return cu!=null&&cu.$==1&&(!X.Equals(cu.$0,ct)&&(cv=[cu,cu.$0],true))?cv[0]:null;});}cr.addEventListener("change",cs);cr.addEventListener("input",cs);cr.addEventListener("keypress",cs);}),cq(function(cr){return function(cs){var ct,cu;ct=cm(cr);return ct!=null&&ct.$==1&&(X.Equals(ct.$0,cs)&&(cu=ct.$0,true))?null:cn(cr,cs);};})];};b0.StringSet=function(){bO.$cctor();return bO.StringSet;};b0.StringGet=function(){bO.$cctor();return bO.StringGet;};b0.IntSetUnchecked=function(){bO.$cctor();return bO.IntSetUnchecked;};b0.IntGetUnchecked=function(){bO.$cctor();return bO.IntGetUnchecked;};b0.IntSetChecked=function(){bO.$cctor();return bO.IntSetChecked;};b0.IntGetChecked=function(){bO.$cctor();return bO.IntGetChecked;};b0.FloatSetUnchecked=function(){bO.$cctor();return bO.FloatSetUnchecked;};b0.FloatGetUnchecked=function(){bO.$cctor();return bO.FloatGetUnchecked;};b0.FloatSetChecked=function(){bO.$cctor();return bO.FloatSetChecked;};b0.FloatGetChecked=function(){bO.$cctor();return bO.FloatGetChecked;};b0.StringApply=function(){bO.$cctor();return bO.StringApply;};b0.BoolCheckedApply=function(){bO.$cctor();return bO.BoolCheckedApply;};b0.IntApplyChecked=function(){bO.$cctor();return bO.IntApplyChecked;};b0.IntApplyUnchecked=function(){bO.$cctor();return bO.IntApplyUnchecked;};b0.FloatApplyChecked=function(){bO.$cctor();return bO.FloatApplyChecked;};b0.FloatApplyUnchecked=function(){bO.$cctor();return bO.FloatApplyUnchecked;};b1.isBlank=function(cm){return bi.forall(b_.IsWhiteSpace,cm);};R.insufficient=function(){return e.FailWith("The input sequence has an insufficient number of elements.");};y.mapiInPlace=function(cm,cn){var co,cp;for(co=0,cp=cn.length-1;co<=cp;co++)cn[co]=cm(co,cn[co]);return cn;};y.mapInPlace=function(cm,cn){var co,cp;for(co=0,cp=cn.length-1;co<=cp;co++)cn[co]=cm(cn[co]);};b2=_0.KeyCollection=cg.Class({GetEnumerator$1:function(){return bc.Get(R.map(function(cm){return cm.K;},this.d));},GetEnumerator:function(){return this.GetEnumerator$1();},GetEnumerator0:function(){return this.GetEnumerator$1();}},j,b2);b2.New=cg.Ctor(function(cm){j.New.call(this);this.d=cm;},b2);b3.New=function(cm,cn){return{c:cm,r:cn};};b4=d.CancellationTokenSource=cg.Class({},j,b4);b4.New=cg.Ctor(function(){j.New.call(this);this.c=false;this.pending=null;this.r=[];this.init=1;},b4);b5.New=function(cm,cn){return{k:cm,ct:cn};};b6.concat=function(cm){var cn,co;cn=[];for(var cp in cm)cn.push.apply(cn,cm[cp]);return cn;};b7.$cctor=function(){var cm;b7.$cctor=a.ignore;b7.rxhtmlTag=new a.RegExp("<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\\w:]+)[^>]*)\\/>","gi");b7.rtagName=new a.RegExp("<([\\w:]+)");b7.rhtml=new a.RegExp("<|&#?\\w+;");b7.wrapMap=(cm=[1,"<table>","</table>"],{option:[1,"<select multiple='multiple'>","</select>"],legend:[1,"<fieldset>","</fieldset>"],area:[1,"<map>","</map>"],param:[1,"<object>","</object>"],thead:cm,tbody:cm,tfoot:cm,tr:[2,"<table><tbody>","</tbody></table>"],col:[2,"<table><colgroup>","</colgoup></table>"],td:[3,"<table><tbody><tr>","</tr></tbody></table>"]});b7.defaultWrap=[0,"",""];};b8.$cctor=function(){b8.$cctor=a.ignore;b8.CubicInOut=b$.Custom(function(cm){var cn;cn=cm*cm;return 3*cn-2*(cn*cm);});b8.UseAnimations=true;};b9.Append=function(cm,cn){return cm.$==0?cn:cn.$==0?cm:{$:2,$0:cm,$1:cn};};b9.ToArray=function(cm){var cn;function co(cp){var cq,cr;while(true)if(cp.$==1)return cn.push(cp.$0);else if(cp.$==2){cq=cp.$1;cr=cp.$0;co(cr);cp=cq;}else return cp.$==3?y.iter(function(cs){cn.push(cs);},cp.$0):null;}cn=[];co(cm);return cn.slice(0);};b9.Concat=function(cm){var cn;cn=bs.ofSeqNonCopying(cm);return bs.TreeReduce(b9.Empty(),b9.Append,cn);};b9.Empty=function(){ce.$cctor();return ce.Empty;};b_.IsWhiteSpace=function(cm){return cm.match(new a.RegExp("\\s"))!==null;};M.TryParse=function(cm,cn,co,cp){var cq,cr;cq=+cm;cr=cq===cq-cq%1&&cq>=cn&&cq<=co;if(cr)cp.set(cq);return cr;};b$=k.Easing=cg.Class({},j,b$);b$.Custom=function(cm){return new b$.New(cm);};b$.New=cg.Ctor(function(cm){j.New.call(this);this.transformTime=cm;},b$);ca.Filter=function(cm,cn){return new bn.New$2(y.filter(cm,ca.ToArray(cn)));};ca.Except=function(cm,cn){var co;co=new bn.New$2(ca.ToArray(cn));co.ExceptWith(ca.ToArray(cm));return co;};ca.ToArray=function(cm){var cn;cn=y.create(cm.get_Count(),void 0);cm.CopyTo(cn);return cn;};ca.Intersect=function(cm,cn){var co;co=new bn.New$2(ca.ToArray(cm));co.IntersectWith(ca.ToArray(cn));return co;};cb.Children=function(cm,cn){var co,cp,cq;if(cn!=null&&cn.$==1){cq=[];co=cn.$0[0].nextSibling;while(co!==cn.$0[1]){cq.push(co);co=co.nextSibling;}return{$:0,$0:cq};}else return{$:0,$0:y.init(cm.childNodes.length,(cp=cm.childNodes,function(cr){return cp[cr];}))};};cb.Except=function(cm,cn){var co;co=cm.$0;return{$:0,$0:y.filter(function(cp){return y.forall(function(cq){return!(cp===cq);},co);},cn.$0)};};cb.Iter=function(cm,cn){y.iter(cm,cn.$0);};cb.DocChildren=function(cm){var cn;function co(cp){var cq,cr,cs,ct;while(true){if(cp!=null&&cp.$==2){cr=cp.$0;cp=cr.Current;}else if(cp!=null&&cp.$==1)return cn.push(cp.$0.El);else if(cp==null)return null;else if(cp!=null&&cp.$==5)return cn.push(cp.$0);else if(cp!=null&&cp.$==4)return cn.push(cp.$0.Text);else if(cp!=null&&cp.$==6){cq=cp.$0.Els;return(function(cu){return function(cv){y.iter(cu,cv);};}(function(cu){if(cu==null||cu.constructor===ba)co(cu);else cn.push(cu);}))(cq);}else{cs=cp.$1;ct=cp.$0;co(ct);cp=cs;}}}cn=[];co(cm.Children);return{$:0,$0:bs.ofSeqNonCopying(cn)};};cd=d.OperationCanceledException=cg.Class({},cc,cd);cd.New=cg.Ctor(function(cm){cd.New$1.call(this,"The operation was canceled.",null,cm);},cd);cd.New$1=cg.Ctor(function(cm,cn,co){this.message=cm;this.inner=cn;ba.setPrototypeOf(this,cd.prototype);this.ct=co;},cd);ce.$cctor=function(){ce.$cctor=a.ignore;ce.Empty={$:0};};cg.OnLoad(function(){c.Main();});}(self));
  
  
  if (typeof IntelliFactory !=='undefined') {
    IntelliFactory.Runtime.ScriptBasePath = '/Content/';
    IntelliFactory.Runtime.Start();
  }
  