diff --git a/docs/404.html b/docs/404.html index 7cc5c9e..4be129e 100644 --- a/docs/404.html +++ b/docs/404.html @@ -28,6 +28,6 @@
- + \ No newline at end of file diff --git a/docs/index.html b/docs/index.html index 7cc5c9e..4be129e 100644 --- a/docs/index.html +++ b/docs/index.html @@ -28,6 +28,6 @@
- + \ No newline at end of file diff --git a/docs/static/js/main-18e4d471fa41020b2b3a.js b/docs/static/js/main-1ca9632430977f2491c6.js similarity index 84% rename from docs/static/js/main-18e4d471fa41020b2b3a.js rename to docs/static/js/main-1ca9632430977f2491c6.js index 8bcff9f..c52e378 100644 --- a/docs/static/js/main-18e4d471fa41020b2b3a.js +++ b/docs/static/js/main-1ca9632430977f2491c6.js @@ -4,4 +4,4 @@ * @author Feross Aboukhadijeh * @license MIT */ -var J=r(43),Q=r(44),X=r(45);t.Buffer=i,t.SlowBuffer=g,t.INSPECT_MAX_BYTES=50,i.TYPED_ARRAY_SUPPORT=void 0!==e.TYPED_ARRAY_SUPPORT?e.TYPED_ARRAY_SUPPORT:function(){try{var e=new Uint8Array(1);return e.__proto__={__proto__:Uint8Array.prototype,foo:function(){return 42}},42===e.foo()&&"function"==typeof e.subarray&&0===e.subarray(1,1).byteLength}catch(e){return!1}}(),t.kMaxLength=n(),i.poolSize=8192,i._augment=function(e){return e.__proto__=i.prototype,e},i.from=function(e,t,r){return o(null,e,t,r)},i.TYPED_ARRAY_SUPPORT&&(i.prototype.__proto__=Uint8Array.prototype,i.__proto__=Uint8Array,"undefined"!=typeof Symbol&&Symbol.species&&i[Symbol.species]===i&&Object.defineProperty(i,Symbol.species,{value:null,configurable:!0})),i.alloc=function(e,t,r){return s(null,e,t,r)},i.allocUnsafe=function(e){return c(null,e)},i.allocUnsafeSlow=function(e){return c(null,e)},i.isBuffer=function(e){return!(null==e||!e._isBuffer)},i.compare=function(e,t){if(!i.isBuffer(e)||!i.isBuffer(t))throw new TypeError("Arguments must be Buffers");if(e===t)return 0;for(var r=e.length,n=t.length,a=0,o=Math.min(r,n);a0&&(e=this.toString("hex",0,r).match(/.{2}/g).join(" "),this.length>r&&(e+=" ... ")),""},i.prototype.compare=function(e,t,r,n,a){if(!i.isBuffer(e))throw new TypeError("Argument must be a Buffer");if(void 0===t&&(t=0),void 0===r&&(r=e?e.length:0),void 0===n&&(n=0),void 0===a&&(a=this.length),t<0||r>e.length||n<0||a>this.length)throw new RangeError("out of range index");if(n>=a&&t>=r)return 0;if(n>=a)return-1;if(t>=r)return 1;if(t>>>=0,r>>>=0,n>>>=0,a>>>=0,this===e)return 0;for(var o=a-n,u=r-t,s=Math.min(o,u),c=this.slice(n,a),f=e.slice(t,r),l=0;la)&&(r=a),e.length>0&&(r<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");n||(n="utf8");for(var i=!1;;)switch(n){case"hex":return S(this,e,t,r);case"utf8":case"utf-8":return E(this,e,t,r);case"ascii":return T(this,e,t,r);case"latin1":case"binary":return w(this,e,t,r);case"base64":return I(this,e,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return A(this,e,t,r);default:if(i)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),i=!0}},i.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var Z=4096;i.prototype.slice=function(e,t){var r=this.length;e=~~e,t=void 0===t?r:~~t,e<0?(e+=r)<0&&(e=0):e>r&&(e=r),t<0?(t+=r)<0&&(t=0):t>r&&(t=r),t0&&(a*=256);)n+=this[e+--t]*a;return n},i.prototype.readUInt8=function(e,t){return t||L(e,1,this.length),this[e]},i.prototype.readUInt16LE=function(e,t){return t||L(e,2,this.length),this[e]|this[e+1]<<8},i.prototype.readUInt16BE=function(e,t){return t||L(e,2,this.length),this[e]<<8|this[e+1]},i.prototype.readUInt32LE=function(e,t){return t||L(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},i.prototype.readUInt32BE=function(e,t){return t||L(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},i.prototype.readIntLE=function(e,t,r){e|=0,t|=0,r||L(e,t,this.length);for(var n=this[e],a=1,i=0;++i=a&&(n-=Math.pow(2,8*t)),n},i.prototype.readIntBE=function(e,t,r){e|=0,t|=0,r||L(e,t,this.length);for(var n=t,a=1,i=this[e+--n];n>0&&(a*=256);)i+=this[e+--n]*a;return a*=128,i>=a&&(i-=Math.pow(2,8*t)),i},i.prototype.readInt8=function(e,t){return t||L(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},i.prototype.readInt16LE=function(e,t){t||L(e,2,this.length);var r=this[e]|this[e+1]<<8;return 32768&r?4294901760|r:r},i.prototype.readInt16BE=function(e,t){t||L(e,2,this.length);var r=this[e+1]|this[e]<<8;return 32768&r?4294901760|r:r},i.prototype.readInt32LE=function(e,t){return t||L(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},i.prototype.readInt32BE=function(e,t){return t||L(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},i.prototype.readFloatLE=function(e,t){return t||L(e,4,this.length),Q.read(this,e,!0,23,4)},i.prototype.readFloatBE=function(e,t){return t||L(e,4,this.length),Q.read(this,e,!1,23,4)},i.prototype.readDoubleLE=function(e,t){return t||L(e,8,this.length),Q.read(this,e,!0,52,8)},i.prototype.readDoubleBE=function(e,t){return t||L(e,8,this.length),Q.read(this,e,!1,52,8)},i.prototype.writeUIntLE=function(e,t,r,n){if(e=+e,t|=0,r|=0,!n){P(this,e,t,r,Math.pow(2,8*r)-1,0)}var a=1,i=0;for(this[t]=255&e;++i=0&&(i*=256);)this[t+a]=e/i&255;return t+r},i.prototype.writeUInt8=function(e,t,r){return e=+e,t|=0,r||P(this,e,t,1,255,0),i.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),this[t]=255&e,t+1},i.prototype.writeUInt16LE=function(e,t,r){return e=+e,t|=0,r||P(this,e,t,2,65535,0),i.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):D(this,e,t,!0),t+2},i.prototype.writeUInt16BE=function(e,t,r){return e=+e,t|=0,r||P(this,e,t,2,65535,0),i.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):D(this,e,t,!1),t+2},i.prototype.writeUInt32LE=function(e,t,r){return e=+e,t|=0,r||P(this,e,t,4,4294967295,0),i.TYPED_ARRAY_SUPPORT?(this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e):U(this,e,t,!0),t+4},i.prototype.writeUInt32BE=function(e,t,r){return e=+e,t|=0,r||P(this,e,t,4,4294967295,0),i.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):U(this,e,t,!1),t+4},i.prototype.writeIntLE=function(e,t,r,n){if(e=+e,t|=0,!n){var a=Math.pow(2,8*r-1);P(this,e,t,r,a-1,-a)}var i=0,o=1,u=0;for(this[t]=255&e;++i>0)-u&255;return t+r},i.prototype.writeIntBE=function(e,t,r,n){if(e=+e,t|=0,!n){var a=Math.pow(2,8*r-1);P(this,e,t,r,a-1,-a)}var i=r-1,o=1,u=0;for(this[t+i]=255&e;--i>=0&&(o*=256);)e<0&&0===u&&0!==this[t+i+1]&&(u=1),this[t+i]=(e/o>>0)-u&255;return t+r},i.prototype.writeInt8=function(e,t,r){return e=+e,t|=0,r||P(this,e,t,1,127,-128),i.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),e<0&&(e=255+e+1),this[t]=255&e,t+1},i.prototype.writeInt16LE=function(e,t,r){return e=+e,t|=0,r||P(this,e,t,2,32767,-32768),i.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):D(this,e,t,!0),t+2},i.prototype.writeInt16BE=function(e,t,r){return e=+e,t|=0,r||P(this,e,t,2,32767,-32768),i.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):D(this,e,t,!1),t+2},i.prototype.writeInt32LE=function(e,t,r){return e=+e,t|=0,r||P(this,e,t,4,2147483647,-2147483648),i.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24):U(this,e,t,!0),t+4},i.prototype.writeInt32BE=function(e,t,r){return e=+e,t|=0,r||P(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),i.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):U(this,e,t,!1),t+4},i.prototype.writeFloatLE=function(e,t,r){return M(this,e,t,!0,r)},i.prototype.writeFloatBE=function(e,t,r){return M(this,e,t,!1,r)},i.prototype.writeDoubleLE=function(e,t,r){return F(this,e,t,!0,r)},i.prototype.writeDoubleBE=function(e,t,r){return F(this,e,t,!1,r)},i.prototype.copy=function(e,t,r,n){if(r||(r=0),n||0===n||(n=this.length),t>=e.length&&(t=e.length),t||(t=0),n>0&&n=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),e.length-t=0;--a)e[a+t]=this[a+r];else if(o<1e3||!i.TYPED_ARRAY_SUPPORT)for(a=0;a>>=0,r=void 0===r?this.length:r>>>0,e||(e=0);var o;if("number"==typeof e)for(o=t;o8?3:1,y=[],m=[0,0,1,1,1,1,1,1,0,1,1,1,1,1,1,0],b=0,C=0;C>>4^E),E^=t,S^=t<<4,t=65535&(E>>>-16^S),S^=t,E^=t<<-16,t=858993459&(S>>>2^E),E^=t,S^=t<<2,t=65535&(E>>>-16^S),S^=t,E^=t<<-16,t=1431655765&(S>>>1^E),E^=t,S^=t<<1,t=16711935&(E>>>8^S),S^=t,E^=t<<8,t=1431655765&(S>>>1^E),E^=t,S^=t<<1,t=S<<8|E>>>20&240,S=E<<24|E<<8&16711680|E>>>8&65280|E>>>24&240,E=t;for(var T=0;T>>26,E=E<<2|E>>>26):(S=S<<1|S>>>27,E=E<<1|E>>>27),S&=-15,E&=-15;var w=r[S>>>28]|n[S>>>24&15]|a[S>>>20&15]|i[S>>>16&15]|o[S>>>12&15]|u[S>>>8&15]|s[S>>>4&15],I=c[E>>>28]|f[E>>>24&15]|l[E>>>20&15]|d[E>>>16&15]|h[E>>>12&15]|p[E>>>8&15]|g[E>>>4&15];t=65535&(I>>>16^w),y[b++]=w^t,y[b++]=I^t<<16}}return y}function i(e,t,r,n){var a,i=32===e.length?3:9;a=3===i?n?[30,-2,-2]:[0,32,2]:n?[94,62,-2,32,64,2,30,-2,-2]:[0,32,2,62,30,-2,64,96,2];var o,u=t[0],v=t[1];o=252645135&(u>>>4^v),v^=o,u^=o<<4,o=65535&(u>>>16^v),v^=o,u^=o<<16,o=858993459&(v>>>2^u),u^=o,v^=o<<2,o=16711935&(v>>>8^u),u^=o,v^=o<<8,o=1431655765&(u>>>1^v),v^=o,u^=o<<1,u=u<<1|u>>>31,v=v<<1|v>>>31;for(var y=0;y>>4|v<<28)^e[C+1];o=u,u=v,v=o^(c[S>>>24&63]|l[S>>>16&63]|h[S>>>8&63]|g[63&S]|s[E>>>24&63]|f[E>>>16&63]|d[E>>>8&63]|p[63&E])}o=u,u=v,v=o}u=u>>>1|u<<31,v=v>>>1|v<<31,o=1431655765&(u>>>1^v),v^=o,u^=o<<1,o=16711935&(v>>>8^u),u^=o,v^=o<<8,o=858993459&(v>>>2^u),u^=o,v^=o<<2,o=65535&(u>>>16^v),v^=o,u^=o<<16,o=252645135&(u>>>4^v),v^=o,u^=o<<4,r[0]=u,r[1]=v}function o(e){e=e||{};var t,r=(e.mode||"CBC").toUpperCase(),n="DES-"+r;t=e.decrypt?u.cipher.createDecipher(n,e.key):u.cipher.createCipher(n,e.key);var a=t.start;return t.start=function(e,r){var n=null;r instanceof u.util.ByteBuffer&&(n=r,r={}),r=r||{},r.output=n,r.iv=e,a.call(t,r)},t}var u=r(0);r(15),r(23),r(1),e.exports=u.des=u.des||{},u.des.startEncrypting=function(e,t,r,n){var a=o({key:e,output:r,decrypt:!1,mode:n||(null===t?"ECB":"CBC")});return a.start(t),a},u.des.createEncryptionCipher=function(e,t){return o({key:e,output:null,decrypt:!1,mode:t})},u.des.startDecrypting=function(e,t,r,n){var a=o({key:e,output:r,decrypt:!0,mode:n||(null===t?"ECB":"CBC")});return a.start(t),a},u.des.createDecryptionCipher=function(e,t){return o({key:e,output:null,decrypt:!0,mode:t})},u.des.Algorithm=function(e,t){var r=this;r.name=e,r.mode=new t({blockSize:8,cipher:{encrypt:function(e,t){return i(r._keys,e,t,!1)},decrypt:function(e,t){return i(r._keys,e,t,!0)}}}),r._init=!1},u.des.Algorithm.prototype.initialize=function(e){if(!this._init){var t=u.util.createBuffer(e.key);if(0===this.name.indexOf("3DES")&&24!==t.length())throw new Error("Invalid Triple-DES key size: "+8*t.length());this._keys=a(t),this._init=!0}},n("DES-ECB",u.cipher.modes.ecb),n("DES-CBC",u.cipher.modes.cbc),n("DES-CFB",u.cipher.modes.cfb),n("DES-OFB",u.cipher.modes.ofb),n("DES-CTR",u.cipher.modes.ctr),n("3DES-ECB",u.cipher.modes.ecb),n("3DES-CBC",u.cipher.modes.cbc),n("3DES-CFB",u.cipher.modes.cfb),n("3DES-OFB",u.cipher.modes.ofb),n("3DES-CTR",u.cipher.modes.ctr);var s=[16843776,0,65536,16843780,16842756,66564,4,65536,1024,16843776,16843780,1024,16778244,16842756,16777216,4,1028,16778240,16778240,66560,66560,16842752,16842752,16778244,65540,16777220,16777220,65540,0,1028,66564,16777216,65536,16843780,4,16842752,16843776,16777216,16777216,1024,16842756,65536,66560,16777220,1024,4,16778244,66564,16843780,65540,16842752,16778244,16777220,1028,66564,16843776,1028,16778240,16778240,0,65540,66560,0,16842756],c=[-2146402272,-2147450880,32768,1081376,1048576,32,-2146435040,-2147450848,-2147483616,-2146402272,-2146402304,-2147483648,-2147450880,1048576,32,-2146435040,1081344,1048608,-2147450848,0,-2147483648,32768,1081376,-2146435072,1048608,-2147483616,0,1081344,32800,-2146402304,-2146435072,32800,0,1081376,-2146435040,1048576,-2147450848,-2146435072,-2146402304,32768,-2146435072,-2147450880,32,-2146402272,1081376,32,32768,-2147483648,32800,-2146402304,1048576,-2147483616,1048608,-2147450848,-2147483616,1048608,1081344,0,-2147450880,32800,-2147483648,-2146435040,-2146402272,1081344],f=[520,134349312,0,134348808,134218240,0,131592,134218240,131080,134217736,134217736,131072,134349320,131080,134348800,520,134217728,8,134349312,512,131584,134348800,134348808,131592,134218248,131584,131072,134218248,8,134349320,512,134217728,134349312,134217728,131080,520,131072,134349312,134218240,0,512,131080,134349320,134218240,134217736,512,0,134348808,134218248,131072,134217728,134349320,8,131592,131584,134217736,134348800,134218248,520,134348800,131592,8,134348808,131584],l=[8396801,8321,8321,128,8396928,8388737,8388609,8193,0,8396800,8396800,8396929,129,0,8388736,8388609,1,8192,8388608,8396801,128,8388608,8193,8320,8388737,1,8320,8388736,8192,8396928,8396929,129,8388736,8388609,8396800,8396929,129,0,0,8396800,8320,8388736,8388737,1,8396801,8321,8321,128,8396929,129,1,8192,8388609,8193,8396928,8388737,8193,8320,8388608,8396801,128,8388608,8192,8396928],d=[256,34078976,34078720,1107296512,524288,256,1073741824,34078720,1074266368,524288,33554688,1074266368,1107296512,1107820544,524544,1073741824,33554432,1074266112,1074266112,0,1073742080,1107820800,1107820800,33554688,1107820544,1073742080,0,1107296256,34078976,33554432,1107296256,524544,524288,1107296512,256,33554432,1073741824,34078720,1107296512,1074266368,33554688,1073741824,1107820544,34078976,1074266368,256,33554432,1107820544,1107820800,524544,1107296256,1107820800,34078720,0,1074266112,1107296256,524544,33554688,1073742080,524288,0,1074266112,34078976,1073742080],h=[536870928,541065216,16384,541081616,541065216,16,541081616,4194304,536887296,4210704,4194304,536870928,4194320,536887296,536870912,16400,0,4194320,536887312,16384,4210688,536887312,16,541065232,541065232,0,4210704,541081600,16400,4210688,541081600,536870912,536887296,16,541065232,4210688,541081616,4194304,16400,536870928,4194304,536887296,536870912,16400,536870928,541081616,4210688,541065216,4210704,541081600,0,541065232,16,16384,541065216,4210704,16384,4194320,536887312,0,541081600,536870912,4194320,536887312],p=[2097152,69206018,67110914,0,2048,67110914,2099202,69208064,69208066,2097152,0,67108866,2,67108864,69206018,2050,67110912,2099202,2097154,67110912,67108866,69206016,69208064,2097154,69206016,2048,2050,69208066,2099200,2,67108864,2099200,67108864,2099200,2097152,67110914,67110914,69206018,69206018,2,2097154,67108864,67110912,2097152,69208064,2050,2099202,69208064,2050,67108866,69208066,69206016,2099200,0,2,69208066,0,2099202,69206016,2048,67108866,67110912,2048,2097154],g=[268439616,4096,262144,268701760,268435456,268439616,64,268435456,262208,268697600,268701760,266240,268701696,266304,4096,64,268697600,268435520,268439552,4160,266240,262208,268697664,268701696,4160,0,0,268697664,268435520,268439552,266304,262144,266304,262144,268701696,4096,64,268697664,4096,266304,268439552,64,268435520,268697600,268697664,268435456,262144,268439616,0,268701760,262208,268435520,268697600,268439552,268439616,0,268701760,266240,266240,4160,4160,262208,268435456,268701696]},function(e,t,r){function n(e,t,r){this.data=[],null!=e&&("number"==typeof e?this.fromNumber(e,t,r):null==t&&"string"!=typeof e?this.fromString(e,256):this.fromString(e,t))}function a(){return new n(null)}function i(e,t,r,n,a,i){for(;--i>=0;){var o=t*this.data[e++]+r.data[n]+a;a=Math.floor(o/67108864),r.data[n++]=67108863&o}return a}function o(e,t,r,n,a,i){for(var o=32767&t,u=t>>15;--i>=0;){var s=32767&this.data[e],c=this.data[e++]>>15,f=u*s+c*o;s=o*s+((32767&f)<<15)+r.data[n]+(1073741823&a),a=(s>>>30)+(f>>>15)+u*c+(a>>>30),r.data[n++]=1073741823&s}return a}function u(e,t,r,n,a,i){for(var o=16383&t,u=t>>14;--i>=0;){var s=16383&this.data[e],c=this.data[e++]>>14,f=u*s+c*o;s=o*s+((16383&f)<<14)+r.data[n]+a,a=(s>>28)+(f>>14)+u*c,r.data[n++]=268435455&s}return a}function s(e){return it.charAt(e)}function c(e,t){var r=ot[e.charCodeAt(t)];return null==r?-1:r}function f(e){for(var t=this.t-1;t>=0;--t)e.data[t]=this.data[t];e.t=this.t,e.s=this.s}function l(e){this.t=1,this.s=e<0?-1:0,e>0?this.data[0]=e:e<-1?this.data[0]=e+this.DV:this.t=0}function d(e){var t=a();return t.fromInt(e),t}function h(e,t){var r;if(16==t)r=4;else if(8==t)r=3;else if(256==t)r=8;else if(2==t)r=1;else if(32==t)r=5;else{if(4!=t)return void this.fromRadix(e,t);r=2}this.t=0,this.s=0;for(var a=e.length,i=!1,o=0;--a>=0;){var u=8==r?255&e[a]:c(e,a);u<0?"-"==e.charAt(a)&&(i=!0):(i=!1,0==o?this.data[this.t++]=u:o+r>this.DB?(this.data[this.t-1]|=(u&(1<>this.DB-o):this.data[this.t-1]|=u<=this.DB&&(o-=this.DB))}8==r&&0!=(128&e[0])&&(this.s=-1,o>0&&(this.data[this.t-1]|=(1<0&&this.data[this.t-1]==e;)--this.t}function g(e){if(this.s<0)return"-"+this.negate().toString(e);var t;if(16==e)t=4;else if(8==e)t=3;else if(2==e)t=1;else if(32==e)t=5;else{if(4!=e)return this.toRadix(e);t=2}var r,n=(1<0)for(u>u)>0&&(a=!0,i=s(r));o>=0;)u>(u+=this.DB-t)):(r=this.data[o]>>(u-=t)&n,u<=0&&(u+=this.DB,--o)),r>0&&(a=!0),a&&(i+=s(r));return a?i:"0"}function v(){var e=a();return n.ZERO.subTo(this,e),e}function y(){return this.s<0?this.negate():this}function m(e){var t=this.s-e.s;if(0!=t)return t;var r=this.t;if(0!=(t=r-e.t))return this.s<0?-t:t;for(;--r>=0;)if(0!=(t=this.data[r]-e.data[r]))return t;return 0}function b(e){var t,r=1;return 0!=(t=e>>>16)&&(e=t,r+=16),0!=(t=e>>8)&&(e=t,r+=8),0!=(t=e>>4)&&(e=t,r+=4),0!=(t=e>>2)&&(e=t,r+=2),0!=(t=e>>1)&&(e=t,r+=1),r}function C(){return this.t<=0?0:this.DB*(this.t-1)+b(this.data[this.t-1]^this.s&this.DM)}function S(e,t){var r;for(r=this.t-1;r>=0;--r)t.data[r+e]=this.data[r];for(r=e-1;r>=0;--r)t.data[r]=0;t.t=this.t+e,t.s=this.s}function E(e,t){for(var r=e;r=0;--r)t.data[r+o+1]=this.data[r]>>a|u,u=(this.data[r]&i)<=0;--r)t.data[r]=0;t.data[o]=u,t.t=this.t+o+1,t.s=this.s,t.clamp()}function w(e,t){t.s=this.s;var r=Math.floor(e/this.DB);if(r>=this.t)return void(t.t=0);var n=e%this.DB,a=this.DB-n,i=(1<>n;for(var o=r+1;o>n;n>0&&(t.data[this.t-r-1]|=(this.s&i)<>=this.DB;if(e.t>=this.DB;n+=this.s}else{for(n+=this.s;r>=this.DB;n-=e.s}t.s=n<0?-1:0,n<-1?t.data[r++]=this.DV+n:n>0&&(t.data[r++]=n),t.t=r,t.clamp()}function A(e,t){var r=this.abs(),a=e.abs(),i=r.t;for(t.t=i+a.t;--i>=0;)t.data[i]=0;for(i=0;i=0;)e.data[r]=0;for(r=0;r=t.DV&&(e.data[r+t.t]-=t.DV,e.data[r+t.t+1]=1)}e.t>0&&(e.data[e.t-1]+=t.am(r,t.data[r],e,2*r,0,1)),e.s=0,e.clamp()}function k(e,t,r){var i=e.abs();if(!(i.t<=0)){var o=this.abs();if(o.t0?(i.lShiftTo(f,u),o.lShiftTo(f,r)):(i.copyTo(u),o.copyTo(r));var l=u.t,d=u.data[l-1];if(0!=d){var h=d*(1<1?u.data[l-2]>>this.F2:0),p=this.FV/h,g=(1<=0&&(r.data[r.t++]=1,r.subTo(C,r)),n.ONE.dlShiftTo(l,C),C.subTo(u,u);u.t=0;){var S=r.data[--y]==d?this.DM:Math.floor(r.data[y]*p+(r.data[y-1]+v)*g);if((r.data[y]+=u.am(0,S,r,m,0,l))0&&r.rShiftTo(f,r),s<0&&n.ZERO.subTo(r,r)}}}function N(e){var t=a();return this.abs().divRemTo(e,null,t),this.s<0&&t.compareTo(n.ZERO)>0&&e.subTo(t,t),t}function R(e){this.m=e}function $(e){return e.s<0||e.compareTo(this.m)>=0?e.mod(this.m):e}function x(e){return e}function _(e){e.divRemTo(this.m,null,e)}function L(e,t,r){e.multiplyTo(t,r),this.reduce(r)}function P(e,t){e.squareTo(t),this.reduce(t)}function D(){if(this.t<1)return 0;var e=this.data[0];if(0==(1&e))return 0;var t=3&e;return t=t*(2-(15&e)*t)&15,t=t*(2-(255&e)*t)&255,t=t*(2-((65535&e)*t&65535))&65535,t=t*(2-e*t%this.DV)%this.DV,t>0?this.DV-t:-t}function U(e){this.m=e,this.mp=e.invDigit(),this.mpl=32767&this.mp,this.mph=this.mp>>15,this.um=(1<0&&this.m.subTo(t,t),t}function M(e){var t=a();return e.copyTo(t),this.reduce(t),t}function F(e){for(;e.t<=this.mt2;)e.data[e.t++]=0;for(var t=0;t>15)*this.mpl&this.um)<<15)&e.DM;for(r=t+this.m.t,e.data[r]+=this.m.am(0,n,e,t,0,this.m.t);e.data[r]>=e.DV;)e.data[r]-=e.DV,e.data[++r]++}e.clamp(),e.drShiftTo(this.m.t,e),e.compareTo(this.m)>=0&&e.subTo(this.m,e)}function V(e,t){e.squareTo(t),this.reduce(t)}function K(e,t,r){e.multiplyTo(t,r),this.reduce(r)}function H(){return 0==(this.t>0?1&this.data[0]:this.s)}function j(e,t){if(e>4294967295||e<1)return n.ONE;var r=a(),i=a(),o=t.convert(this),u=b(e)-1;for(o.copyTo(r);--u>=0;)if(t.sqrTo(r,i),(e&1<0)t.mulTo(i,o,r);else{var s=r;r=i,i=s}return t.revert(r)}function q(e,t){var r;return r=e<256||t.isEven()?new R(t):new U(t),this.exp(e,r)}function G(){var e=a();return this.copyTo(e),e}function z(){if(this.s<0){if(1==this.t)return this.data[0]-this.DV;if(0==this.t)return-1}else{if(1==this.t)return this.data[0];if(0==this.t)return 0}return(this.data[1]&(1<<32-this.DB)-1)<>24}function W(){return 0==this.t?this.s:this.data[0]<<16>>16}function J(e){return Math.floor(Math.LN2*this.DB/Math.log(e))}function Q(){return this.s<0?-1:this.t<=0||1==this.t&&this.data[0]<=0?0:1}function X(e){if(null==e&&(e=10),0==this.signum()||e<2||e>36)return"0";var t=this.chunkSize(e),r=Math.pow(e,t),n=d(r),i=a(),o=a(),u="";for(this.divRemTo(n,i,o);i.signum()>0;)u=(r+o.intValue()).toString(e).substr(1)+u,i.divRemTo(n,i,o);return o.intValue().toString(e)+u}function Z(e,t){this.fromInt(0),null==t&&(t=10);for(var r=this.chunkSize(t),a=Math.pow(t,r),i=!1,o=0,u=0,s=0;s=r&&(this.dMultiply(a),this.dAddOffset(u,0),o=0,u=0))}o>0&&(this.dMultiply(Math.pow(t,o)),this.dAddOffset(u,0)),i&&n.ZERO.subTo(this,this)}function ee(e,t,r){if("number"==typeof t)if(e<2)this.fromInt(1);else for(this.fromNumber(e,r),this.testBit(e-1)||this.bitwiseTo(n.ONE.shiftLeft(e-1),se,this),this.isEven()&&this.dAddOffset(1,0);!this.isProbablePrime(t);)this.dAddOffset(2,0),this.bitLength()>e&&this.subTo(n.ONE.shiftLeft(e-1),this);else{var a=new Array,i=7&e;a.length=1+(e>>3),t.nextBytes(a),i>0?a[0]&=(1<0)for(n>n)!=(this.s&this.DM)>>n&&(t[a++]=r|this.s<=0;)n<8?(r=(this.data[e]&(1<>(n+=this.DB-8)):(r=this.data[e]>>(n-=8)&255,n<=0&&(n+=this.DB,--e)),0!=(128&r)&&(r|=-256),0==a&&(128&this.s)!=(128&r)&&++a,(a>0||r!=this.s)&&(t[a++]=r);return t}function re(e){return 0==this.compareTo(e)}function ne(e){return this.compareTo(e)<0?this:e}function ae(e){return this.compareTo(e)>0?this:e}function ie(e,t,r){var n,a,i=Math.min(e.t,this.t);for(n=0;n>=16,t+=16),0==(255&e)&&(e>>=8,t+=8),0==(15&e)&&(e>>=4,t+=4),0==(3&e)&&(e>>=2,t+=2),0==(1&e)&&++t,t}function me(){for(var e=0;e=this.t?0!=this.s:0!=(this.data[t]&1<>=this.DB;if(e.t>=this.DB;n+=this.s}else{for(n+=this.s;r>=this.DB;n+=e.s}t.s=n<0?-1:0,n>0?t.data[r++]=n:n<-1&&(t.data[r++]=this.DV+n),t.t=r,t.clamp()}function Be(e){var t=a();return this.addTo(e,t),t}function ke(e){var t=a();return this.subTo(e,t),t}function Ne(e){var t=a();return this.multiplyTo(e,t),t}function Re(e){var t=a();return this.divRemTo(e,t,null),t}function $e(e){var t=a();return this.divRemTo(e,null,t),t}function xe(e){var t=a(),r=a();return this.divRemTo(e,t,r),new Array(t,r)}function _e(e){this.data[this.t]=this.am(0,e-1,this,0,0,this.t),++this.t,this.clamp()}function Le(e,t){if(0!=e){for(;this.t<=t;)this.data[this.t++]=0;for(this.data[t]+=e;this.data[t]>=this.DV;)this.data[t]-=this.DV,++t>=this.t&&(this.data[this.t++]=0),++this.data[t]}}function Pe(){}function De(e){return e}function Ue(e,t,r){e.multiplyTo(t,r)}function Oe(e,t){e.squareTo(t)}function Me(e){return this.exp(e,new Pe)}function Fe(e,t,r){var n=Math.min(this.t+e.t,t);for(r.s=0,r.t=n;n>0;)r.data[--n]=0;var a;for(a=r.t-this.t;n=0;)r.data[n]=0;for(n=Math.max(t-this.t,0);n2*this.m.t)return e.mod(this.m);if(e.compareTo(this.m)<0)return e;var t=a();return e.copyTo(t),this.reduce(t),t}function je(e){return e}function qe(e){for(e.drShiftTo(this.m.t-1,this.r2),e.t>this.m.t+1&&(e.t=this.m.t+1,e.clamp()),this.mu.multiplyUpperTo(this.r2,this.m.t+1,this.q3),this.m.multiplyLowerTo(this.q3,this.m.t+1,this.r2);e.compareTo(this.r2)<0;)e.dAddOffset(1,this.m.t+1);for(e.subTo(this.r2,e);e.compareTo(this.m)>=0;)e.subTo(this.m,e)}function Ge(e,t){e.squareTo(t),this.reduce(t)}function ze(e,t,r){e.multiplyTo(t,r),this.reduce(r)}function Ye(e,t){var r,n,i=e.bitLength(),o=d(1);if(i<=0)return o;r=i<18?1:i<48?3:i<144?4:i<768?5:6,n=i<8?new R(t):t.isEven()?new Ke(t):new U(t);var u=new Array,s=3,c=r-1,f=(1<1){var l=a();for(n.sqrTo(u[1],l);s<=f;)u[s]=a(),n.mulTo(l,u[s-2],u[s]),s+=2}var h,p,g=e.t-1,v=!0,y=a();for(i=b(e.data[g])-1;g>=0;){for(i>=c?h=e.data[g]>>i-c&f:(h=(e.data[g]&(1<0&&(h|=e.data[g-1]>>this.DB+i-c)),s=r;0==(1&h);)h>>=1,--s;if((i-=s)<0&&(i+=this.DB,--g),v)u[h].copyTo(o),v=!1;else{for(;s>1;)n.sqrTo(o,y),n.sqrTo(y,o),s-=2;s>0?n.sqrTo(o,y):(p=o,o=y,y=p),n.mulTo(y,u[h],o)}for(;g>=0&&0==(e.data[g]&1<0&&(t.rShiftTo(i,t),r.rShiftTo(i,r));t.signum()>0;)(a=t.getLowestSetBit())>0&&t.rShiftTo(a,t),(a=r.getLowestSetBit())>0&&r.rShiftTo(a,r),t.compareTo(r)>=0?(t.subTo(r,t),t.rShiftTo(1,t)):(r.subTo(t,r),r.rShiftTo(1,r));return i>0&&r.lShiftTo(i,r),r}function Je(e){if(e<=0)return 0;var t=this.DV%e,r=this.s<0?e-1:0;if(this.t>0)if(0==t)r=this.data[0]%e;else for(var n=this.t-1;n>=0;--n)r=(t*r+this.data[n])%e;return r}function Qe(e){var t=e.isEven();if(this.isEven()&&t||0==e.signum())return n.ZERO;for(var r=e.clone(),a=this.clone(),i=d(1),o=d(0),u=d(0),s=d(1);0!=r.signum();){for(;r.isEven();)r.rShiftTo(1,r),t?(i.isEven()&&o.isEven()||(i.addTo(this,i),o.subTo(e,o)),i.rShiftTo(1,i)):o.isEven()||o.subTo(e,o),o.rShiftTo(1,o);for(;a.isEven();)a.rShiftTo(1,a),t?(u.isEven()&&s.isEven()||(u.addTo(this,u),s.subTo(e,s)),u.rShiftTo(1,u)):s.isEven()||s.subTo(e,s),s.rShiftTo(1,s);r.compareTo(a)>=0?(r.subTo(a,r),t&&i.subTo(u,i),o.subTo(s,o)):(a.subTo(r,a),t&&u.subTo(i,u),s.subTo(o,s))}return 0!=a.compareTo(n.ONE)?n.ZERO:s.compareTo(e)>=0?s.subtract(e):s.signum()<0?(s.addTo(e,s),s.signum()<0?s.add(e):s):s}function Xe(e){var t,r=this.abs();if(1==r.t&&r.data[0]<=ut[ut.length-1]){for(t=0;t=0);var s=a.modPow(i,this);if(0!=s.compareTo(n.ONE)&&0!=s.compareTo(t)){for(var c=1;c++a-11){var i=new Error("Message is too long for PKCS#1 v1.5 padding.");throw i.length=e.length,i.max=a-11,i}n.putByte(0),n.putByte(r);var o,u=a-3-e.length;if(0===r||1===r){o=0===r?0:255;for(var s=0;s0;){for(var c=0,f=d.random.getBytes(u),s=0;s1;){if(255!==i.getByte()){--i.read;break}++s}else if(2===u)for(s=0;i.length()>1;){if(0===i.getByte()){--i.read;break}++s}if(0!==i.getByte()||s!==a-3-i.length())throw new Error("Encryption block is invalid.");return i.getBytes()}function i(e,t,r){function n(){a(e.pBits,function(t,n){return t?r(t):(e.p=n,null!==e.q?i(t,e.q):void a(e.qBits,i))})}function a(e,t){d.prime.generateProbablePrime(e,o,t)}function i(t,o){if(t)return r(t);if(e.q=o,e.p.compareTo(e.q)<0){var u=e.p;e.p=e.q,e.q=u}if(0!==e.p.subtract(h.ONE).gcd(e.e).compareTo(h.ONE))return e.p=null,void n();if(0!==e.q.subtract(h.ONE).gcd(e.e).compareTo(h.ONE))return e.q=null,void a(e.qBits,i);if(e.p1=e.p.subtract(h.ONE),e.q1=e.q.subtract(h.ONE),e.phi=e.p1.multiply(e.q1),0!==e.phi.gcd(e.e).compareTo(h.ONE))return e.p=e.q=null,void n();if(e.n=e.p.multiply(e.q),e.n.bitLength()!==e.bits)return e.q=null,void a(e.qBits,i);var s=e.e.modInverse(e.phi);e.keys={privateKey:y.rsa.setPrivateKey(e.n,e.e,s,e.p,e.q,s.mod(e.p1),s.mod(e.q1),e.q.modInverse(e.p)),publicKey:y.rsa.setPublicKey(e.n,e.e)},r(null,e.keys)}"function"==typeof t&&(r=t,t={}),t=t||{};var o={algorithm:{name:t.algorithm||"PRIMEINC",options:{workers:t.workers||2,workLoad:t.workLoad||100,workerScript:t.workerScript}}};"prng"in t&&(o.prng=t.prng),n()}function o(e){var t=e.toString(16);t[0]>="8"&&(t="00"+t);var r=d.util.hexToBytes(t);return r.length>1&&(0===r.charCodeAt(0)&&0==(128&r.charCodeAt(1))||255===r.charCodeAt(0)&&128==(128&r.charCodeAt(1)))?r.substr(1):r}function u(e){return e<=100?27:e<=150?18:e<=200?15:e<=250?12:e<=300?9:e<=350?8:e<=400?7:e<=500?6:e<=600?5:e<=800?4:e<=1250?3:2}function s(e){return d.util.isNodejs&&"function"==typeof p[e]}function c(e){return void 0!==v.globalScope&&"object"==typeof v.globalScope.crypto&&"object"==typeof v.globalScope.crypto.subtle&&"function"==typeof v.globalScope.crypto.subtle[e]}function f(e){return void 0!==v.globalScope&&"object"==typeof v.globalScope.msCrypto&&"object"==typeof v.globalScope.msCrypto.subtle&&"function"==typeof v.globalScope.msCrypto.subtle[e]}function l(e){for(var t=d.util.hexToBytes(e.toString(16)),r=new Uint8Array(t.length),n=0;n=0||!n.gcd(t.n).equals(h.ONE));e=e.multiply(n.modPow(t.e,t.n)).mod(t.n);for(var a=e.mod(t.p).modPow(t.dP,t.p),i=e.mod(t.q).modPow(t.dQ,t.q);a.compareTo(i)<0;)a=a.add(t.p);var o=a.subtract(i).multiply(t.qInv).mod(t.p).multiply(t.q).add(i);return o=o.multiply(n.modInverse(t.n)).mod(t.n)};y.rsa.encrypt=function(e,t,r){var a,i=r,o=Math.ceil(t.n.bitLength()/8);!1!==r&&!0!==r?(i=2===r,a=n(e,t,r)):(a=d.util.createBuffer(),a.putBytes(e));for(var u=new h(a.toHex(),16),s=w(u,t,i),c=s.toString(16),f=d.util.createBuffer(),l=o-Math.ceil(c.length/2);l>0;)f.putByte(0),--l;return f.putBytes(d.util.hexToBytes(c)),f.getBytes()},y.rsa.decrypt=function(e,t,r,n){var i=Math.ceil(t.n.bitLength()/8);if(e.length!==i){var o=new Error("Encrypted message length is invalid.");throw o.length=e.length,o.expected=i,o}var u=new h(d.util.createBuffer(e).toHex(),16);if(u.compareTo(t.n)>=0)throw new Error("Encrypted message is invalid.");for(var s=w(u,t,r),c=s.toString(16),f=d.util.createBuffer(),l=i-Math.ceil(c.length/2);l>0;)f.putByte(0),--l;return f.putBytes(d.util.hexToBytes(c)),!1!==n?a(f.getBytes(),t,r):f.getBytes()},y.rsa.createKeyPairGenerationState=function(e,t,r){"string"==typeof e&&(e=parseInt(e,10)),e=e||2048,r=r||{};var n,a=r.prng||d.random,i={nextBytes:function(e){for(var t=a.getBytesSync(e.length),r=0;r>1,pBits:e-(e>>1),pqState:0,num:null,keys:null},n.e.fromInt(n.eInt),n},y.rsa.stepKeyPairGenerationState=function(e,t){"algorithm"in e||(e.algorithm="PRIMEINC");var r=new h(null);r.fromInt(30);for(var n,a=0,i=function(e,t){return e|t},o=+new Date,s=0;null===e.keys&&(t<=0||sc?e.pqState=0:e.num.isProbablePrime(u(e.num.bitLength()))?++e.pqState:e.num.dAddOffset(m[a++%8],0):2===e.pqState?e.pqState=0===e.num.subtract(h.ONE).gcd(e.e).compareTo(h.ONE)?3:0:3===e.pqState&&(e.pqState=0,null===e.p?e.p=e.num:e.q=e.num,null!==e.p&&null!==e.q&&++e.state,e.num=null)}else if(1===e.state)e.p.compareTo(e.q)<0&&(e.num=e.p,e.p=e.q,e.q=e.num),++e.state;else if(2===e.state)e.p1=e.p.subtract(h.ONE),e.q1=e.q.subtract(h.ONE),e.phi=e.p1.multiply(e.q1),++e.state;else if(3===e.state)0===e.phi.gcd(e.e).compareTo(h.ONE)?++e.state:(e.p=null,e.q=null,e.state=0);else if(4===e.state)e.n=e.p.multiply(e.q),e.n.bitLength()===e.bits?++e.state:(e.q=null,e.state=0);else if(5===e.state){var l=e.e.modInverse(e.phi);e.keys={privateKey:y.rsa.setPrivateKey(e.n,e.e,l,e.p,e.q,l.mod(e.p1),l.mod(e.q1),e.q.modInverse(e.p)),publicKey:y.rsa.setPublicKey(e.n,e.e)}}n=+new Date,s+=n-o,o=n}return null!==e.keys},y.rsa.generateKeyPair=function(e,t,r,n){if(1===arguments.length?"object"==typeof e?(r=e,e=void 0):"function"==typeof e&&(n=e,e=void 0):2===arguments.length?"number"==typeof e?"function"==typeof t?(n=t,t=void 0):"number"!=typeof t&&(r=t,t=void 0):(r=e,n=t,e=void 0,t=void 0):3===arguments.length&&("number"==typeof t?"function"==typeof r&&(n=r,r=void 0):(n=r,r=t,t=void 0)),r=r||{},void 0===e&&(e=r.bits||2048),void 0===t&&(t=r.e||65537),!d.options.usePureJavaScript&&!r.prng&&e>=256&&e<=16384&&(65537===t||3===t))if(n){if(s("generateKeyPair"))return p.generateKeyPair("rsa",{modulusLength:e,publicExponent:t,publicKeyEncoding:{type:"spki",format:"pem"},privateKeyEncoding:{type:"pkcs8",format:"pem"}},function(e,t,r){if(e)return n(e);n(null,{privateKey:y.privateKeyFromPem(r),publicKey:y.publicKeyFromPem(t)})});if(c("generateKey")&&c("exportKey"))return v.globalScope.crypto.subtle.generateKey({name:"RSASSA-PKCS1-v1_5",modulusLength:e,publicExponent:l(t),hash:{name:"SHA-256"}},!0,["sign","verify"]).then(function(e){return v.globalScope.crypto.subtle.exportKey("pkcs8",e.privateKey)}).then(void 0,function(e){n(e)}).then(function(e){if(e){var t=y.privateKeyFromAsn1(g.fromDer(d.util.createBuffer(e)));n(null,{privateKey:t,publicKey:y.setRsaPublicKey(t.n,t.e)})}});if(f("generateKey")&&f("exportKey")){var a=v.globalScope.msCrypto.subtle.generateKey({name:"RSASSA-PKCS1-v1_5",modulusLength:e,publicExponent:l(t),hash:{name:"SHA-256"}},!0,["sign","verify"]);return a.oncomplete=function(e){var t=e.target.result,r=v.globalScope.msCrypto.subtle.exportKey("pkcs8",t.privateKey);r.oncomplete=function(e){var t=e.target.result,r=y.privateKeyFromAsn1(g.fromDer(d.util.createBuffer(t)));n(null,{privateKey:r,publicKey:y.setRsaPublicKey(r.n,r.e)})},r.onerror=function(e){n(e)}},void(a.onerror=function(e){n(e)})}}else if(s("generateKeyPairSync")){var o=p.generateKeyPairSync("rsa",{modulusLength:e,publicExponent:t,publicKeyEncoding:{type:"spki",format:"pem"},privateKeyEncoding:{type:"pkcs8",format:"pem"}});return{privateKey:y.privateKeyFromPem(o.privateKey),publicKey:y.publicKeyFromPem(o.publicKey)}}var u=y.rsa.createKeyPairGenerationState(e,t,r);if(!n)return y.rsa.stepKeyPairGenerationState(u,0),u.keys;i(u,r,n)},y.setRsaPublicKey=y.rsa.setPublicKey=function(e,t){var r={n:e,e:t};return r.encrypt=function(e,t,a){if("string"==typeof t?t=t.toUpperCase():void 0===t&&(t="RSAES-PKCS1-V1_5"),"RSAES-PKCS1-V1_5"===t)t={encode:function(e,t,r){return n(e,t,2).getBytes()}};else if("RSA-OAEP"===t||"RSAES-OAEP"===t)t={encode:function(e,t){return d.pkcs1.encode_rsa_oaep(t,e,a)}};else if(-1!==["RAW","NONE","NULL",null].indexOf(t))t={encode:function(e){return e}};else if("string"==typeof t)throw new Error('Unsupported encryption scheme: "'+t+'".');var i=t.encode(e,r,!0);return y.rsa.encrypt(i,r,!0)},r.verify=function(e,t,n){"string"==typeof n?n=n.toUpperCase():void 0===n&&(n="RSASSA-PKCS1-V1_5"),"RSASSA-PKCS1-V1_5"===n?n={verify:function(e,t){return t=a(t,r,!0),e===g.fromDer(t).value[1].value}}:"NONE"!==n&&"NULL"!==n&&null!==n||(n={verify:function(e,t){return t=a(t,r,!0),e===t}});var i=y.rsa.decrypt(t,r,!0,!1);return n.verify(e,i,r.n.bitLength())},r},y.setRsaPrivateKey=y.rsa.setPrivateKey=function(e,t,r,n,i,o,u,s){var c={n:e,e:t,d:r,p:n,q:i,dP:o,dQ:u,qInv:s};return c.decrypt=function(e,t,r){"string"==typeof t?t=t.toUpperCase():void 0===t&&(t="RSAES-PKCS1-V1_5");var n=y.rsa.decrypt(e,c,!1,!1);if("RSAES-PKCS1-V1_5"===t)t={decode:a};else if("RSA-OAEP"===t||"RSAES-OAEP"===t)t={decode:function(e,t){return d.pkcs1.decode_rsa_oaep(t,e,r)}};else{if(-1===["RAW","NONE","NULL",null].indexOf(t))throw new Error('Unsupported encryption scheme: "'+t+'".');t={decode:function(e){return e}}}return t.decode(n,c,!1)},c.sign=function(e,t){var r=!1;"string"==typeof t&&(t=t.toUpperCase()),void 0===t||"RSASSA-PKCS1-V1_5"===t?(t={encode:T},r=1):"NONE"!==t&&"NULL"!==t&&null!==t||(t={encode:function(){return e}},r=1);var n=t.encode(e,c.n.bitLength());return y.rsa.encrypt(n,c,r)},c},y.wrapRsaPrivateKey=function(e){return g.create(g.Class.UNIVERSAL,g.Type.SEQUENCE,!0,[g.create(g.Class.UNIVERSAL,g.Type.INTEGER,!1,g.integerToDer(0).getBytes()),g.create(g.Class.UNIVERSAL,g.Type.SEQUENCE,!0,[g.create(g.Class.UNIVERSAL,g.Type.OID,!1,g.oidToDer(y.oids.rsaEncryption).getBytes()),g.create(g.Class.UNIVERSAL,g.Type.NULL,!1,"")]),g.create(g.Class.UNIVERSAL,g.Type.OCTETSTRING,!1,g.toDer(e).getBytes())])},y.privateKeyFromAsn1=function(e){var t={},r=[];if(g.validate(e,b,t,r)&&(e=g.fromDer(d.util.createBuffer(t.privateKey))),t={},r=[],!g.validate(e,C,t,r)){var n=new Error("Cannot read private key. ASN.1 object does not contain an RSAPrivateKey.");throw n.errors=r,n}var a,i,o,u,s,c,f,l;return a=d.util.createBuffer(t.privateKeyModulus).toHex(),i=d.util.createBuffer(t.privateKeyPublicExponent).toHex(),o=d.util.createBuffer(t.privateKeyPrivateExponent).toHex(),u=d.util.createBuffer(t.privateKeyPrime1).toHex(),s=d.util.createBuffer(t.privateKeyPrime2).toHex(),c=d.util.createBuffer(t.privateKeyExponent1).toHex(),f=d.util.createBuffer(t.privateKeyExponent2).toHex(),l=d.util.createBuffer(t.privateKeyCoefficient).toHex(),y.setRsaPrivateKey(new h(a,16),new h(i,16),new h(o,16),new h(u,16),new h(s,16),new h(c,16),new h(f,16),new h(l,16))},y.privateKeyToAsn1=y.privateKeyToRSAPrivateKey=function(e){return g.create(g.Class.UNIVERSAL,g.Type.SEQUENCE,!0,[g.create(g.Class.UNIVERSAL,g.Type.INTEGER,!1,g.integerToDer(0).getBytes()),g.create(g.Class.UNIVERSAL,g.Type.INTEGER,!1,o(e.n)),g.create(g.Class.UNIVERSAL,g.Type.INTEGER,!1,o(e.e)),g.create(g.Class.UNIVERSAL,g.Type.INTEGER,!1,o(e.d)),g.create(g.Class.UNIVERSAL,g.Type.INTEGER,!1,o(e.p)),g.create(g.Class.UNIVERSAL,g.Type.INTEGER,!1,o(e.q)),g.create(g.Class.UNIVERSAL,g.Type.INTEGER,!1,o(e.dP)),g.create(g.Class.UNIVERSAL,g.Type.INTEGER,!1,o(e.dQ)),g.create(g.Class.UNIVERSAL,g.Type.INTEGER,!1,o(e.qInv))])},y.publicKeyFromAsn1=function(e){var t={},r=[];if(g.validate(e,E,t,r)){var n=g.derToOid(t.publicKeyOid);if(n!==y.oids.rsaEncryption){var a=new Error("Cannot read public key. Unknown OID.");throw a.oid=n,a}e=t.rsaPublicKey}if(r=[],!g.validate(e,S,t,r)){var a=new Error("Cannot read public key. ASN.1 object does not contain an RSAPublicKey.");throw a.errors=r,a}var i=d.util.createBuffer(t.publicKeyModulus).toHex(),o=d.util.createBuffer(t.publicKeyExponent).toHex();return y.setRsaPublicKey(new h(i,16),new h(o,16))},y.publicKeyToAsn1=y.publicKeyToSubjectPublicKeyInfo=function(e){return g.create(g.Class.UNIVERSAL,g.Type.SEQUENCE,!0,[g.create(g.Class.UNIVERSAL,g.Type.SEQUENCE,!0,[g.create(g.Class.UNIVERSAL,g.Type.OID,!1,g.oidToDer(y.oids.rsaEncryption).getBytes()),g.create(g.Class.UNIVERSAL,g.Type.NULL,!1,"")]),g.create(g.Class.UNIVERSAL,g.Type.BITSTRING,!1,[y.publicKeyToRSAPublicKey(e)])])},y.publicKeyToRSAPublicKey=function(e){return g.create(g.Class.UNIVERSAL,g.Type.SEQUENCE,!0,[g.create(g.Class.UNIVERSAL,g.Type.INTEGER,!1,o(e.n)),g.create(g.Class.UNIVERSAL,g.Type.INTEGER,!1,o(e.e))])}},function(e,t){var r;r=function(){return this}();try{r=r||Function("return this")()||(0,eval)("this")}catch(e){"object"==typeof window&&(r=window)}e.exports=r},function(e,t,r){var n=r(0);r(1),e.exports=n.cipher=n.cipher||{},n.cipher.algorithms=n.cipher.algorithms||{},n.cipher.createCipher=function(e,t){var r=e;if("string"==typeof r&&(r=n.cipher.getAlgorithm(r))&&(r=r()),!r)throw new Error("Unsupported algorithm: "+e);return new n.cipher.BlockCipher({algorithm:r,key:t,decrypt:!1})},n.cipher.createDecipher=function(e,t){var r=e;if("string"==typeof r&&(r=n.cipher.getAlgorithm(r))&&(r=r()),!r)throw new Error("Unsupported algorithm: "+e);return new n.cipher.BlockCipher({algorithm:r,key:t,decrypt:!0})},n.cipher.registerAlgorithm=function(e,t){e=e.toUpperCase(),n.cipher.algorithms[e]=t},n.cipher.getAlgorithm=function(e){return e=e.toUpperCase(),e in n.cipher.algorithms?n.cipher.algorithms[e]:null};var a=n.cipher.BlockCipher=function(e){this.algorithm=e.algorithm,this.mode=this.algorithm.mode,this.blockSize=this.mode.blockSize,this._finish=!1,this._input=null,this.output=null,this._op=e.decrypt?this.mode.decrypt:this.mode.encrypt,this._decrypt=e.decrypt,this.algorithm.initialize(e)};a.prototype.start=function(e){e=e||{};var t={};for(var r in e)t[r]=e[r];t.decrypt=this._decrypt,this._finish=!1,this._input=n.util.createBuffer(),this.output=e.output||n.util.createBuffer(),this.mode.start(t)},a.prototype.update=function(e){for(e&&this._input.putBuffer(e);!this._op.call(this.mode,this._input,this.output,this._finish)&&!this._finish;);this._input.compact()},a.prototype.finish=function(e){!e||"ECB"!==this.mode.name&&"CBC"!==this.mode.name||(this.mode.pad=function(t){return e(this.blockSize,t,!1)},this.mode.unpad=function(t){return e(this.blockSize,t,!0)});var t={};return t.decrypt=this._decrypt,t.overflow=this._input.length()%this.blockSize,!(!this._decrypt&&this.mode.pad&&!this.mode.pad(this._input,t))&&(this._finish=!0,this.update(),!(this._decrypt&&this.mode.unpad&&!this.mode.unpad(this.output,t))&&!(this.mode.afterFinish&&!this.mode.afterFinish(this.output,t)))}},function(e,t,r){function n(){u=String.fromCharCode(128),u+=i.util.fillString(String.fromCharCode(0),64),s=[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,1,6,11,0,5,10,15,4,9,14,3,8,13,2,7,12,5,8,11,14,1,4,7,10,13,0,3,6,9,12,15,2,0,7,14,5,12,3,10,1,8,15,6,13,4,11,2,9],c=[7,12,17,22,7,12,17,22,7,12,17,22,7,12,17,22,5,9,14,20,5,9,14,20,5,9,14,20,5,9,14,20,4,11,16,23,4,11,16,23,4,11,16,23,4,11,16,23,6,10,15,21,6,10,15,21,6,10,15,21,6,10,15,21],f=new Array(64);for(var e=0;e<64;++e)f[e]=Math.floor(4294967296*Math.abs(Math.sin(e+1)));l=!0}function a(e,t,r){for(var n,a,i,o,u,l,d,h,p=r.length();p>=64;){for(a=e.h0,i=e.h1,o=e.h2,u=e.h3,h=0;h<16;++h)t[h]=r.getInt32Le(),l=u^i&(o^u),n=a+l+f[h]+t[h],d=c[h],a=u,u=o,o=i,i+=n<>>32-d;for(;h<32;++h)l=o^u&(i^o),n=a+l+f[h]+t[s[h]],d=c[h],a=u,u=o,o=i,i+=n<>>32-d;for(;h<48;++h)l=i^o^u,n=a+l+f[h]+t[s[h]],d=c[h],a=u,u=o,o=i,i+=n<>>32-d;for(;h<64;++h)l=o^(i|~u),n=a+l+f[h]+t[s[h]],d=c[h],a=u,u=o,o=i,i+=n<>>32-d;e.h0=e.h0+a|0,e.h1=e.h1+i|0,e.h2=e.h2+o|0,e.h3=e.h3+u|0,p-=64}}var i=r(0);r(4),r(1);var o=e.exports=i.md5=i.md5||{};i.md.md5=i.md.algorithms.md5=o,o.create=function(){l||n();var e=null,t=i.util.createBuffer(),r=new Array(16),o={algorithm:"md5",blockLength:64,digestLength:16,messageLength:0,fullMessageLength:null,messageLengthSize:8};return o.start=function(){o.messageLength=0,o.fullMessageLength=o.messageLength64=[];for(var r=o.messageLengthSize/4,n=0;n>>0,s>>>0];for(var c=o.fullMessageLength.length-1;c>=0;--c)o.fullMessageLength[c]+=s[1],s[1]=s[0]+(o.fullMessageLength[c]/4294967296>>>0),o.fullMessageLength[c]=o.fullMessageLength[c]>>>0,s[0]=s[1]/4294967296>>>0;return t.putBytes(n),a(e,r,t),(t.read>2048||0===t.length())&&t.compact(),o},o.digest=function(){var n=i.util.createBuffer();n.putBytes(t.bytes());var s=o.fullMessageLength[o.fullMessageLength.length-1]+o.messageLengthSize,c=s&o.blockLength-1;n.putBytes(u.substr(0,o.blockLength-c));for(var f,l=0,d=o.fullMessageLength.length-1;d>=0;--d)f=8*o.fullMessageLength[d]+l,l=f/4294967296>>>0,n.putInt32Le(f>>>0);var h={h0:e.h0,h1:e.h1,h2:e.h2,h3:e.h3};a(h,r,n);var p=i.util.createBuffer();return p.putInt32Le(h.h0),p.putInt32Le(h.h1),p.putInt32Le(h.h2),p.putInt32Le(h.h3),p},o};var u=null,s=null,c=null,f=null,l=!1},function(e,t,r){(function(t){var n=r(0);r(8),r(4),r(1);var a,i=n.pkcs5=n.pkcs5||{};n.util.isNodejs&&!n.options.usePureJavaScript&&(a=r(21)),e.exports=n.pbkdf2=i.pbkdf2=function(e,r,i,o,u,s){function c(){if(C>h)return s(null,b);g.start(null,null),g.update(r),g.update(n.util.int32ToBytes(C)),v=m=g.digest().getBytes(),S=2,f()}function f(){if(S<=i)return g.start(null,null),g.update(m),y=g.digest().getBytes(),v=n.util.xorBytes(v,y,l),m=y,++S,n.util.setImmediate(f);b+=C4||!u||"sha1"===u))return"string"!=typeof u&&(u="sha1"),e=new t(e,"binary"),r=new t(r,"binary"),s?4===a.pbkdf2Sync.length?a.pbkdf2(e,r,i,o,function(e,t){if(e)return s(e);s(null,t.toString("binary"))}):a.pbkdf2(e,r,i,o,u,function(e,t){if(e)return s(e);s(null,t.toString("binary"))}):4===a.pbkdf2Sync.length?a.pbkdf2Sync(e,r,i,o).toString("binary"):a.pbkdf2Sync(e,r,i,o,u).toString("binary");if(void 0!==u&&null!==u||(u="sha1"),"string"==typeof u){if(!(u in n.md.algorithms))throw new Error("Unknown hash algorithm: "+u);u=n.md[u].create()}var l=u.digestLength;if(o>4294967295*l){var d=new Error("Derived key is too long.");if(s)return s(d);throw d}var h=Math.ceil(o/l),p=o-(h-1)*l,g=n.hmac.create();g.start(u,e);var v,y,m,b="";if(!s){for(var C=1;C<=h;++C){g.start(null,null),g.update(r),g.update(n.util.int32ToBytes(C)),v=m=g.digest().getBytes();for(var S=2;S<=i;++S)g.start(null,null),g.update(m),y=g.digest().getBytes(),v=n.util.xorBytes(v,y,l),m=y;b+=C>8*l-f&255;return(C=String.fromCharCode(C.charCodeAt(0)&~S)+C.substr(1))+g+String.fromCharCode(188)},s.verify=function(e,i,u){var s,c=u-1,f=Math.ceil(c/8);if(i=i.substr(-f),f>8*f-c&255;if(0!=(d.charCodeAt(0)&p))throw new Error("Bits beyond keysize not zero as expected.");var g=r.generate(h,l),v="";for(s=0;s128)throw new Error('Invalid "nsComment" content.');e.value=l.create(l.Class.UNIVERSAL,l.Type.IA5STRING,!1,e.comment)}else if("subjectKeyIdentifier"===e.name&&t.cert){var v=t.cert.generateSubjectKeyIdentifier();e.subjectKeyIdentifier=v.toHex(),e.value=l.create(l.Class.UNIVERSAL,l.Type.OCTETSTRING,!1,v.getBytes())}else if("authorityKeyIdentifier"===e.name&&t.cert){e.value=l.create(l.Class.UNIVERSAL,l.Type.SEQUENCE,!0,[]);var s=e.value.value;if(e.keyIdentifier){var y=!0===e.keyIdentifier?t.cert.generateSubjectKeyIdentifier().getBytes():e.keyIdentifier;s.push(l.create(l.Class.CONTEXT_SPECIFIC,0,!1,y))}if(e.authorityCertIssuer){var m=[l.create(l.Class.CONTEXT_SPECIFIC,4,!0,[a(!0===e.authorityCertIssuer?t.cert.issuer:e.authorityCertIssuer)])];s.push(l.create(l.Class.CONTEXT_SPECIFIC,1,!0,m))}if(e.serialNumber){var b=f.util.hexToBytes(!0===e.serialNumber?t.cert.serialNumber:e.serialNumber);s.push(l.create(l.Class.CONTEXT_SPECIFIC,2,!1,b))}}else if("cRLDistributionPoints"===e.name){e.value=l.create(l.Class.UNIVERSAL,l.Type.SEQUENCE,!0,[]);for(var p,s=e.value.value,C=l.create(l.Class.UNIVERSAL,l.Type.SEQUENCE,!0,[]),S=l.create(l.Class.CONTEXT_SPECIFIC,0,!0,[]),g=0;g=S&&e2)throw new Error("Cannot read notBefore/notAfter validity times; more than two times were provided in the certificate.");if(p.length<2)throw new Error("Cannot read notBefore/notAfter validity times; they were not provided as either UTCTime or GeneralizedTime.");if(s.validity.notBefore=p[0],s.validity.notAfter=p[1],s.tbsCertificate=r.tbsCertificate,t){if(s.md=null,s.signatureOid in h){var u=h[s.signatureOid];switch(u){case"sha1WithRSAEncryption":s.md=f.md.sha1.create();break;case"md5WithRSAEncryption":s.md=f.md.md5.create();break;case"sha256WithRSAEncryption":s.md=f.md.sha256.create();break;case"sha384WithRSAEncryption":s.md=f.md.sha384.create();break;case"sha512WithRSAEncryption":s.md=f.md.sha512.create();break;case"RSASSA-PSS":s.md=f.md.sha256.create()}}if(null===s.md){var o=new Error("Could not compute certificate digest. Unknown signature OID.");throw o.signatureOid=s.signatureOid,o}var g=l.toDer(s.tbsCertificate);s.md.update(g.getBytes())}var y=f.md.sha1.create();s.issuer.getField=function(e){return n(s.issuer,e)},s.issuer.addField=function(e){i([e]),s.issuer.attributes.push(e)},s.issuer.attributes=d.RDNAttributesAsArray(r.certIssuer,y),r.certIssuerUniqueId&&(s.issuer.uniqueId=r.certIssuerUniqueId),s.issuer.hash=y.digest().toHex();var m=f.md.sha1.create();return s.subject.getField=function(e){return n(s.subject,e)},s.subject.addField=function(e){i([e]),s.subject.attributes.push(e)},s.subject.attributes=d.RDNAttributesAsArray(r.certSubject,m),r.certSubjectUniqueId&&(s.subject.uniqueId=r.certSubjectUniqueId),s.subject.hash=m.digest().toHex(),r.certExtensions?s.extensions=d.certificateExtensionsFromAsn1(r.certExtensions):s.extensions=[],s.publicKey=d.publicKeyFromAsn1(r.subjectPublicKeyInfo),s},d.certificateExtensionsFromAsn1=function(e){for(var t=[],r=0;r1&&(n=r.value.charCodeAt(1),a=r.value.length>2?r.value.charCodeAt(2):0),t.digitalSignature=128==(128&n),t.nonRepudiation=64==(64&n),t.keyEncipherment=32==(32&n),t.dataEncipherment=16==(16&n),t.keyAgreement=8==(8&n),t.keyCertSign=4==(4&n),t.cRLSign=2==(2&n),t.encipherOnly=1==(1&n),t.decipherOnly=128==(128&a)}else if("basicConstraints"===t.name){var r=l.fromDer(t.value);r.value.length>0&&r.value[0].type===l.Type.BOOLEAN?t.cA=0!==r.value[0].value.charCodeAt(0):t.cA=!1;var i=null;r.value.length>0&&r.value[0].type===l.Type.INTEGER?i=r.value[0].value:r.value.length>1&&(i=r.value[1].value),null!==i&&(t.pathLenConstraint=l.derToInteger(i))}else if("extKeyUsage"===t.name)for(var r=l.fromDer(t.value),o=0;o1&&(n=r.value.charCodeAt(1)),t.client=128==(128&n),t.server=64==(64&n),t.email=32==(32&n),t.objsign=16==(16&n),t.reserved=8==(8&n),t.sslCA=4==(4&n),t.emailCA=2==(2&n),t.objCA=1==(1&n)}else if("subjectAltName"===t.name||"issuerAltName"===t.name){t.altNames=[];for(var s,r=l.fromDer(t.value),c=0;c0&&n.value.push(d.certificateExtensionsToAsn1(e.extensions)),n},d.getCertificationRequestInfo=function(e){return l.create(l.Class.UNIVERSAL,l.Type.SEQUENCE,!0,[l.create(l.Class.UNIVERSAL,l.Type.INTEGER,!1,l.integerToDer(e.version).getBytes()),a(e.subject),d.publicKeyToAsn1(e.publicKey),s(e)])},d.distinguishedNameToAsn1=function(e){return a(e)},d.certificateToAsn1=function(e){var t=e.tbsCertificate||d.getTBSCertificate(e);return l.create(l.Class.UNIVERSAL,l.Type.SEQUENCE,!0,[t,l.create(l.Class.UNIVERSAL,l.Type.SEQUENCE,!0,[l.create(l.Class.UNIVERSAL,l.Type.OID,!1,l.oidToDer(e.signatureOid).getBytes()),u(e.signatureOid,e.signatureParameters)]),l.create(l.Class.UNIVERSAL,l.Type.BITSTRING,!1,String.fromCharCode(0)+e.signature)])},d.certificateExtensionsToAsn1=function(e){var t=l.create(l.Class.CONTEXT_SPECIFIC,3,!0,[]),r=l.create(l.Class.UNIVERSAL,l.Type.SEQUENCE,!0,[]);t.value.push(r);for(var n=0;ns.validity.notAfter)&&(o={message:"Certificate is not valid yet or has expired.",error:d.certificateError.certificate_expired,notBefore:s.validity.notBefore,notAfter:s.validity.notAfter,now:a}),null===o){if(c=t[0]||e.getIssuer(s),null===c&&s.isIssuer(s)&&(l=!0,c=s),c){var h=c;f.util.isArray(h)||(h=[h]);for(var p=!1;!p&&h.length>0;){c=h.shift();try{p=c.verify(s)}catch(e){}}p||(o={message:"Certificate signature is invalid.",error:d.certificateError.bad_certificate})}null!==o||c&&!l||e.hasCertificate(s)||(o={message:"Certificate is not trusted.",error:d.certificateError.unknown_ca})}if(null===o&&c&&!s.isIssuer(c)&&(o={message:"Certificate issuer is invalid.",error:d.certificateError.bad_certificate}),null===o)for(var g={keyUsage:!0,basicConstraints:!0},v=0;null===o&&vm.pathLenConstraint&&(o={message:"Certificate basicConstraints pathLenConstraint violated.",error:d.certificateError.bad_certificate})}}var C=null===o||o.error,S=r.verify?r.verify(C,u,n):C;if(!0!==S)throw!0===C&&(o={message:"The application rejected the certificate.",error:d.certificateError.bad_certificate}),(S||0===S)&&("object"!=typeof S||f.util.isArray(S)?"string"==typeof S&&(o.error=S):(S.message&&(o.message=S.message),S.error&&(o.error=S.error))),o;o=null,i=!1,++u}while(t.length>0);return!0}},function(e,t){function r(){throw new Error("setTimeout has not been defined")}function n(){throw new Error("clearTimeout has not been defined")}function a(e){if(f===setTimeout)return setTimeout(e,0);if((f===r||!f)&&setTimeout)return f=setTimeout,setTimeout(e,0);try{return f(e,0)}catch(t){try{return f.call(null,e,0)}catch(t){return f.call(this,e,0)}}}function i(e){if(l===clearTimeout)return clearTimeout(e);if((l===n||!l)&&clearTimeout)return l=clearTimeout,clearTimeout(e);try{return l(e)}catch(t){try{return l.call(null,e)}catch(t){return l.call(this,e)}}}function o(){g&&h&&(g=!1,h.length?p=h.concat(p):v=-1,p.length&&u())}function u(){if(!g){var e=a(o);g=!0;for(var t=p.length;t;){for(h=p,p=[];++v1)for(var r=1;r4){var t=e;e=o.util.createBuffer();for(var r=0;r0))return!0;for(var n=0;n0))return!0;for(var n=0;n0)return!1;var r=e.length(),n=e.at(r-1);return!(n>this.blockSize<<2)&&(e.truncate(n),!0)},u.cbc=function(e){e=e||{},this.name="CBC",this.cipher=e.cipher,this.blockSize=e.blockSize||16,this._ints=this.blockSize/4,this._inBlock=new Array(this._ints),this._outBlock=new Array(this._ints)},u.cbc.prototype.start=function(e){if(null===e.iv){if(!this._prev)throw new Error("Invalid IV parameter.");this._iv=this._prev.slice(0)}else{if(!("iv"in e))throw new Error("Invalid IV parameter.");this._iv=n(e.iv),this._prev=this._iv.slice(0)}},u.cbc.prototype.encrypt=function(e,t,r){if(e.length()0))return!0;for(var n=0;n0))return!0;for(var n=0;n0)return!1;var r=e.length(),n=e.at(r-1);return!(n>this.blockSize<<2)&&(e.truncate(n),!0)},u.cfb=function(e){e=e||{},this.name="CFB",this.cipher=e.cipher,this.blockSize=e.blockSize||16,this._ints=this.blockSize/4,this._inBlock=null,this._outBlock=new Array(this._ints),this._partialBlock=new Array(this._ints),this._partialOutput=o.util.createBuffer(),this._partialBytes=0},u.cfb.prototype.start=function(e){if(!("iv"in e))throw new Error("Invalid IV parameter.");this._iv=n(e.iv),this._inBlock=this._iv.slice(0),this._partialBytes=0},u.cfb.prototype.encrypt=function(e,t,r){var n=e.length();if(0===n)return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),0===this._partialBytes&&n>=this.blockSize)for(var a=0;a0&&(i=this.blockSize-i),this._partialOutput.clear();for(var a=0;a0)e.read-=this.blockSize;else for(var a=0;a0&&this._partialOutput.getBytes(this._partialBytes),i>0&&!r)return t.putBytes(this._partialOutput.getBytes(i-this._partialBytes)),this._partialBytes=i,!0;t.putBytes(this._partialOutput.getBytes(n-this._partialBytes)),this._partialBytes=0}},u.cfb.prototype.decrypt=function(e,t,r){var n=e.length();if(0===n)return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),0===this._partialBytes&&n>=this.blockSize)for(var a=0;a0&&(i=this.blockSize-i),this._partialOutput.clear();for(var a=0;a0)e.read-=this.blockSize;else for(var a=0;a0&&this._partialOutput.getBytes(this._partialBytes),i>0&&!r)return t.putBytes(this._partialOutput.getBytes(i-this._partialBytes)),this._partialBytes=i,!0;t.putBytes(this._partialOutput.getBytes(n-this._partialBytes)),this._partialBytes=0}},u.ofb=function(e){e=e||{},this.name="OFB",this.cipher=e.cipher,this.blockSize=e.blockSize||16,this._ints=this.blockSize/4,this._inBlock=null,this._outBlock=new Array(this._ints),this._partialOutput=o.util.createBuffer(),this._partialBytes=0},u.ofb.prototype.start=function(e){if(!("iv"in e))throw new Error("Invalid IV parameter.");this._iv=n(e.iv),this._inBlock=this._iv.slice(0),this._partialBytes=0},u.ofb.prototype.encrypt=function(e,t,r){var n=e.length();if(0===e.length())return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),0===this._partialBytes&&n>=this.blockSize)for(var a=0;a0&&(i=this.blockSize-i),this._partialOutput.clear();for(var a=0;a0)e.read-=this.blockSize;else for(var a=0;a0&&this._partialOutput.getBytes(this._partialBytes),i>0&&!r)return t.putBytes(this._partialOutput.getBytes(i-this._partialBytes)),this._partialBytes=i,!0;t.putBytes(this._partialOutput.getBytes(n-this._partialBytes)),this._partialBytes=0}},u.ofb.prototype.decrypt=u.ofb.prototype.encrypt,u.ctr=function(e){e=e||{},this.name="CTR",this.cipher=e.cipher,this.blockSize=e.blockSize||16,this._ints=this.blockSize/4,this._inBlock=null,this._outBlock=new Array(this._ints),this._partialOutput=o.util.createBuffer(),this._partialBytes=0},u.ctr.prototype.start=function(e){if(!("iv"in e))throw new Error("Invalid IV parameter.");this._iv=n(e.iv),this._inBlock=this._iv.slice(0),this._partialBytes=0},u.ctr.prototype.encrypt=function(e,t,r){var n=e.length();if(0===n)return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),0===this._partialBytes&&n>=this.blockSize)for(var i=0;i0&&(o=this.blockSize-o),this._partialOutput.clear();for(var i=0;i0&&(e.read-=this.blockSize),this._partialBytes>0&&this._partialOutput.getBytes(this._partialBytes),o>0&&!r)return t.putBytes(this._partialOutput.getBytes(o-this._partialBytes)),this._partialBytes=o,!0;t.putBytes(this._partialOutput.getBytes(n-this._partialBytes)),this._partialBytes=0}a(this._inBlock)},u.ctr.prototype.decrypt=u.ctr.prototype.encrypt,u.gcm=function(e){e=e||{},this.name="GCM",this.cipher=e.cipher,this.blockSize=e.blockSize||16,this._ints=this.blockSize/4,this._inBlock=new Array(this._ints),this._outBlock=new Array(this._ints),this._partialOutput=o.util.createBuffer(),this._partialBytes=0,this._R=3774873600},u.gcm.prototype.start=function(e){if(!("iv"in e))throw new Error("Invalid IV parameter.");var t=o.util.createBuffer(e.iv);this._cipherLength=0;var r;if(r="additionalData"in e?o.util.createBuffer(e.additionalData):o.util.createBuffer(),this._tagLength="tagLength"in e?e.tagLength:128,this._tag=null,e.decrypt&&(this._tag=o.util.createBuffer(e.tag).getBytes(),this._tag.length!==this._tagLength/8))throw new Error("Authentication tag does not match tag length.");this._hashBlock=new Array(this._ints),this.tag=null,this._hashSubkey=new Array(this._ints),this.cipher.encrypt([0,0,0,0],this._hashSubkey),this.componentBits=4,this._m=this.generateHashTable(this._hashSubkey,this.componentBits);var n=t.length();if(12===n)this._j0=[t.getInt32(),t.getInt32(),t.getInt32(),1];else{for(this._j0=[0,0,0,0];t.length()>0;)this._j0=this.ghash(this._hashSubkey,this._j0,[t.getInt32(),t.getInt32(),t.getInt32(),t.getInt32()]);this._j0=this.ghash(this._hashSubkey,this._j0,[0,0].concat(i(8*n)))}this._inBlock=this._j0.slice(0),a(this._inBlock),this._partialBytes=0,r=o.util.createBuffer(r),this._aDataLength=i(8*r.length());var u=r.length()%this.blockSize;for(u&&r.fillWithByte(0,this.blockSize-u),this._s=[0,0,0,0];r.length()>0;)this._s=this.ghash(this._hashSubkey,this._s,[r.getInt32(),r.getInt32(),r.getInt32(),r.getInt32()])},u.gcm.prototype.encrypt=function(e,t,r){var n=e.length();if(0===n)return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),0===this._partialBytes&&n>=this.blockSize){for(var i=0;i0&&(o=this.blockSize-o),this._partialOutput.clear();for(var i=0;i0&&this._partialOutput.getBytes(this._partialBytes),o>0&&!r)return e.read-=this.blockSize,t.putBytes(this._partialOutput.getBytes(o-this._partialBytes)),this._partialBytes=o,!0;t.putBytes(this._partialOutput.getBytes(n-this._partialBytes)),this._partialBytes=0}this._s=this.ghash(this._hashSubkey,this._s,this._outBlock),a(this._inBlock)},u.gcm.prototype.decrypt=function(e,t,r){var n=e.length();if(n0))return!0;this.cipher.encrypt(this._inBlock,this._outBlock),a(this._inBlock),this._hashBlock[0]=e.getInt32(),this._hashBlock[1]=e.getInt32(),this._hashBlock[2]=e.getInt32(),this._hashBlock[3]=e.getInt32(),this._s=this.ghash(this._hashSubkey,this._s,this._hashBlock);for(var i=0;i0;--n)t[n]=e[n]>>>1|(1&e[n-1])<<31;t[0]=e[0]>>>1,r&&(t[0]^=this._R)},u.gcm.prototype.tableMultiply=function(e){for(var t=[0,0,0,0],r=0;r<32;++r){var n=r/8|0,a=e[n]>>>4*(7-r%8)&15,i=this._m[r][a];t[0]^=i[0],t[1]^=i[1],t[2]^=i[2],t[3]^=i[3]}return t},u.gcm.prototype.ghash=function(e,t,r){return t[0]^=r[0],t[1]^=r[1],t[2]^=r[2],t[3]^=r[3],this.tableMultiply(t)},u.gcm.prototype.generateHashTable=function(e,t){for(var r=8/t,n=4*r,a=16*r,i=new Array(a),o=0;o>>1,a=new Array(r);a[n]=e.slice(0);for(var i=n>>>1;i>0;)this.pow(a[2*i],a[i]=[]),i>>=1;for(i=2;i=0;s--)N>>=8,N+=I.at(s)+k.at(s),k.setAt(s,255&N);B.putBuffer(k)}C=B,l.putBuffer(T)}return l.truncate(l.length()-a),l},f.pbe.getCipher=function(e,t,r){switch(e){case f.oids.pkcs5PBES2:return f.pbe.getCipherForPBES2(e,t,r);case f.oids["pbeWithSHAAnd3-KeyTripleDES-CBC"]:case f.oids["pbewithSHAAnd40BitRC2-CBC"]:return f.pbe.getCipherForPKCS12PBE(e,t,r);default:var n=new Error("Cannot read encrypted PBE data block. Unsupported OID.");throw n.oid=e,n.supportedOids=["pkcs5PBES2","pbeWithSHAAnd3-KeyTripleDES-CBC","pbewithSHAAnd40BitRC2-CBC"],n}},f.pbe.getCipherForPBES2=function(e,t,r){var n={},i=[];if(!c.validate(t,h,n,i)){var o=new Error("Cannot read password-based-encryption algorithm parameters. ASN.1 object is not a supported EncryptedPrivateKeyInfo.");throw o.errors=i,o}if((e=c.derToOid(n.kdfOid))!==f.oids.pkcs5PBKDF2){var o=new Error("Cannot read encrypted private key. Unsupported key derivation function OID.");throw o.oid=e,o.supportedOids=["pkcs5PBKDF2"],o}if((e=c.derToOid(n.encOid))!==f.oids["aes128-CBC"]&&e!==f.oids["aes192-CBC"]&&e!==f.oids["aes256-CBC"]&&e!==f.oids["des-EDE3-CBC"]&&e!==f.oids.desCBC){var o=new Error("Cannot read encrypted private key. Unsupported encryption scheme OID.");throw o.oid=e,o.supportedOids=["aes128-CBC","aes192-CBC","aes256-CBC","des-EDE3-CBC","desCBC"],o}var s=n.kdfSalt,l=u.util.createBuffer(n.kdfIterationCount);l=l.getInt(l.length()<<3);var d,p;switch(f.oids[e]){case"aes128-CBC":d=16,p=u.aes.createDecryptionCipher;break;case"aes192-CBC":d=24,p=u.aes.createDecryptionCipher;break;case"aes256-CBC":d=32,p=u.aes.createDecryptionCipher;break;case"des-EDE3-CBC":d=24,p=u.des.createDecryptionCipher;break;case"desCBC":d=8,p=u.des.createDecryptionCipher}var g=a(n.prfOid),v=u.pkcs5.pbkdf2(r,s,l,d,g),y=n.encIv,m=p(v);return m.start(y),m},f.pbe.getCipherForPKCS12PBE=function(e,t,r){var n={},i=[];if(!c.validate(t,p,n,i)){var o=new Error("Cannot read password-based-encryption algorithm parameters. ASN.1 object is not a supported EncryptedPrivateKeyInfo.");throw o.errors=i,o}var s=u.util.createBuffer(n.salt),l=u.util.createBuffer(n.iterations);l=l.getInt(l.length()<<3);var d,h,g;switch(e){case f.oids["pbeWithSHAAnd3-KeyTripleDES-CBC"]:d=24,h=8,g=u.des.startDecrypting;break;case f.oids["pbewithSHAAnd40BitRC2-CBC"]:d=5,h=8,g=function(e,t){var r=u.rc2.createDecryptionCipher(e,40);return r.start(t,null),r};break;default:var o=new Error("Cannot read PKCS #12 PBE data block. Unsupported OID.");throw o.oid=e,o}var v=a(n.prfOid),y=f.pbe.generatePkcs12Key(r,s,1,l,d,v);return v.start(),g(y,f.pbe.generatePkcs12Key(r,s,2,l,h,v))},f.pbe.opensslDeriveBytes=function(e,t,r,a){if(void 0===a||null===a){if(!("md5"in u.md))throw new Error('"md5" hash algorithm unavailable.');a=u.md.md5.create()}null===t&&(t="");for(var i=[n(a,e+t)],o=16,s=1;o>24&255,o>>16&255,o>>8&255,255&o);r.start(),r.update(e+u),n+=r.digest().getBytes()}return n.substring(0,t)}var a=r(0);r(1),r(2),r(9);var i=e.exports=a.pkcs1=a.pkcs1||{};i.encode_rsa_oaep=function(e,t,r){var i,o,u,s;"string"==typeof r?(i=r,o=arguments[3]||void 0,u=arguments[4]||void 0):r&&(i=r.label||void 0,o=r.seed||void 0,u=r.md||void 0,r.mgf1&&r.mgf1.md&&(s=r.mgf1.md)),u?u.start():u=a.md.sha1.create(),s||(s=u);var c=Math.ceil(e.n.bitLength()/8),f=c-2*u.digestLength-2;if(t.length>f){var l=new Error("RSAES-OAEP input message length is too long.");throw l.length=t.length,l.maxLength=f,l}i||(i=""),u.update(i,"raw");for(var d=u.digest(),h="",p=f-t.length,g=0;g=0&&a.push(u):a.push(u))}return a}function a(e){if(e.composed||e.constructed){for(var t=c.util.createBuffer(),r=0;r0&&(a=f.create(f.Class.UNIVERSAL,f.Type.SET,!0,s));var h=[],p=[];null!==t&&(p=c.util.isArray(t)?t:[t]);for(var g=[],v=0;v0){var C=f.create(f.Class.UNIVERSAL,f.Type.SEQUENCE,!0,g),S=f.create(f.Class.UNIVERSAL,f.Type.SEQUENCE,!0,[f.create(f.Class.UNIVERSAL,f.Type.OID,!1,f.oidToDer(l.oids.data).getBytes()),f.create(f.Class.CONTEXT_SPECIFIC,0,!0,[f.create(f.Class.UNIVERSAL,f.Type.OCTETSTRING,!1,f.toDer(C).getBytes())])]);h.push(S)}var E=null;if(null!==e){var T=l.wrapRsaPrivateKey(l.privateKeyToAsn1(e));E=null===r?f.create(f.Class.UNIVERSAL,f.Type.SEQUENCE,!0,[f.create(f.Class.UNIVERSAL,f.Type.OID,!1,f.oidToDer(l.oids.keyBag).getBytes()),f.create(f.Class.CONTEXT_SPECIFIC,0,!0,[T]),a]):f.create(f.Class.UNIVERSAL,f.Type.SEQUENCE,!0,[f.create(f.Class.UNIVERSAL,f.Type.OID,!1,f.oidToDer(l.oids.pkcs8ShroudedKeyBag).getBytes()),f.create(f.Class.CONTEXT_SPECIFIC,0,!0,[l.encryptPrivateKeyInfo(T,r,n)]),a]);var w=f.create(f.Class.UNIVERSAL,f.Type.SEQUENCE,!0,[E]),I=f.create(f.Class.UNIVERSAL,f.Type.SEQUENCE,!0,[f.create(f.Class.UNIVERSAL,f.Type.OID,!1,f.oidToDer(l.oids.data).getBytes()),f.create(f.Class.CONTEXT_SPECIFIC,0,!0,[f.create(f.Class.UNIVERSAL,f.Type.OCTETSTRING,!1,f.toDer(w).getBytes())])]);h.push(I)}var A,B=f.create(f.Class.UNIVERSAL,f.Type.SEQUENCE,!0,h);if(n.useMac){var u=c.md.sha1.create(),k=new c.util.ByteBuffer(c.random.getBytes(n.saltSize)),N=n.count,e=d.generateKey(r,k,3,N,20),R=c.hmac.create();R.start(u,e),R.update(f.toDer(B).getBytes());var $=R.getMac();A=f.create(f.Class.UNIVERSAL,f.Type.SEQUENCE,!0,[f.create(f.Class.UNIVERSAL,f.Type.SEQUENCE,!0,[f.create(f.Class.UNIVERSAL,f.Type.SEQUENCE,!0,[f.create(f.Class.UNIVERSAL,f.Type.OID,!1,f.oidToDer(l.oids.sha1).getBytes()),f.create(f.Class.UNIVERSAL,f.Type.NULL,!1,"")]),f.create(f.Class.UNIVERSAL,f.Type.OCTETSTRING,!1,$.getBytes())]),f.create(f.Class.UNIVERSAL,f.Type.OCTETSTRING,!1,k.getBytes()),f.create(f.Class.UNIVERSAL,f.Type.INTEGER,!1,f.integerToDer(N).getBytes())])}return f.create(f.Class.UNIVERSAL,f.Type.SEQUENCE,!0,[f.create(f.Class.UNIVERSAL,f.Type.INTEGER,!1,f.integerToDer(3).getBytes()),f.create(f.Class.UNIVERSAL,f.Type.SEQUENCE,!0,[f.create(f.Class.UNIVERSAL,f.Type.OID,!1,f.oidToDer(l.oids.data).getBytes()),f.create(f.Class.CONTEXT_SPECIFIC,0,!0,[f.create(f.Class.UNIVERSAL,f.Type.OCTETSTRING,!1,f.toDer(B).getBytes())])]),A])},d.generateKey=c.pbe.generatePkcs12Key},function(e,t,r){var n=r(0);r(3),r(1);var a=n.asn1,i=e.exports=n.pkcs7asn1=n.pkcs7asn1||{};n.pkcs7=n.pkcs7||{},n.pkcs7.asn1=i;var o={name:"ContentInfo",tagClass:a.Class.UNIVERSAL,type:a.Type.SEQUENCE,constructed:!0,value:[{name:"ContentInfo.ContentType",tagClass:a.Class.UNIVERSAL,type:a.Type.OID,constructed:!1,capture:"contentType"},{name:"ContentInfo.content",tagClass:a.Class.CONTEXT_SPECIFIC,type:0,constructed:!0,optional:!0,captureAsn1:"content"}]};i.contentInfoValidator=o;var u={name:"EncryptedContentInfo",tagClass:a.Class.UNIVERSAL,type:a.Type.SEQUENCE,constructed:!0,value:[{name:"EncryptedContentInfo.contentType",tagClass:a.Class.UNIVERSAL,type:a.Type.OID,constructed:!1,capture:"contentType"},{name:"EncryptedContentInfo.contentEncryptionAlgorithm",tagClass:a.Class.UNIVERSAL,type:a.Type.SEQUENCE,constructed:!0,value:[{name:"EncryptedContentInfo.contentEncryptionAlgorithm.algorithm",tagClass:a.Class.UNIVERSAL,type:a.Type.OID,constructed:!1,capture:"encAlgorithm"},{name:"EncryptedContentInfo.contentEncryptionAlgorithm.parameter",tagClass:a.Class.UNIVERSAL,captureAsn1:"encParameter"}]},{name:"EncryptedContentInfo.encryptedContent",tagClass:a.Class.CONTEXT_SPECIFIC,type:0,capture:"encryptedContent",captureAsn1:"encryptedContentAsn1"}]};i.envelopedDataValidator={name:"EnvelopedData",tagClass:a.Class.UNIVERSAL,type:a.Type.SEQUENCE,constructed:!0,value:[{name:"EnvelopedData.Version",tagClass:a.Class.UNIVERSAL,type:a.Type.INTEGER,constructed:!1,capture:"version"},{name:"EnvelopedData.RecipientInfos",tagClass:a.Class.UNIVERSAL,type:a.Type.SET,constructed:!0,captureAsn1:"recipientInfos"}].concat(u)},i.encryptedDataValidator={name:"EncryptedData",tagClass:a.Class.UNIVERSAL,type:a.Type.SEQUENCE,constructed:!0,value:[{name:"EncryptedData.Version",tagClass:a.Class.UNIVERSAL,type:a.Type.INTEGER,constructed:!1,capture:"version"}].concat(u)};var s={name:"SignerInfo",tagClass:a.Class.UNIVERSAL,type:a.Type.SEQUENCE,constructed:!0,value:[{name:"SignerInfo.version",tagClass:a.Class.UNIVERSAL,type:a.Type.INTEGER,constructed:!1},{name:"SignerInfo.issuerAndSerialNumber",tagClass:a.Class.UNIVERSAL,type:a.Type.SEQUENCE,constructed:!0,value:[{name:"SignerInfo.issuerAndSerialNumber.issuer",tagClass:a.Class.UNIVERSAL,type:a.Type.SEQUENCE,constructed:!0,captureAsn1:"issuer"},{name:"SignerInfo.issuerAndSerialNumber.serialNumber",tagClass:a.Class.UNIVERSAL,type:a.Type.INTEGER,constructed:!1,capture:"serial"}]},{name:"SignerInfo.digestAlgorithm",tagClass:a.Class.UNIVERSAL,type:a.Type.SEQUENCE,constructed:!0,value:[{name:"SignerInfo.digestAlgorithm.algorithm",tagClass:a.Class.UNIVERSAL,type:a.Type.OID,constructed:!1,capture:"digestAlgorithm"},{name:"SignerInfo.digestAlgorithm.parameter",tagClass:a.Class.UNIVERSAL,constructed:!1,captureAsn1:"digestParameter",optional:!0}]},{name:"SignerInfo.authenticatedAttributes",tagClass:a.Class.CONTEXT_SPECIFIC,type:0,constructed:!0,optional:!0,capture:"authenticatedAttributes"},{name:"SignerInfo.digestEncryptionAlgorithm",tagClass:a.Class.UNIVERSAL,type:a.Type.SEQUENCE,constructed:!0,capture:"signatureAlgorithm"},{name:"SignerInfo.encryptedDigest",tagClass:a.Class.UNIVERSAL,type:a.Type.OCTETSTRING,constructed:!1,capture:"signature"},{name:"SignerInfo.unauthenticatedAttributes",tagClass:a.Class.CONTEXT_SPECIFIC,type:1,constructed:!0,optional:!0,capture:"unauthenticatedAttributes"}]};i.signedDataValidator={name:"SignedData",tagClass:a.Class.UNIVERSAL,type:a.Type.SEQUENCE,constructed:!0,value:[{name:"SignedData.Version",tagClass:a.Class.UNIVERSAL,type:a.Type.INTEGER,constructed:!1,capture:"version"},{name:"SignedData.DigestAlgorithms",tagClass:a.Class.UNIVERSAL,type:a.Type.SET,constructed:!0,captureAsn1:"digestAlgorithms"},o,{name:"SignedData.Certificates",tagClass:a.Class.CONTEXT_SPECIFIC,type:0,optional:!0,captureAsn1:"certificates"},{name:"SignedData.CertificateRevocationLists",tagClass:a.Class.CONTEXT_SPECIFIC,type:1,optional:!0,captureAsn1:"crls"},{name:"SignedData.SignerInfos",tagClass:a.Class.UNIVERSAL,type:a.Type.SET,capture:"signerInfos",optional:!0,value:[s]}]},i.recipientInfoValidator={name:"RecipientInfo",tagClass:a.Class.UNIVERSAL,type:a.Type.SEQUENCE,constructed:!0,value:[{name:"RecipientInfo.version",tagClass:a.Class.UNIVERSAL,type:a.Type.INTEGER,constructed:!1,capture:"version"},{name:"RecipientInfo.issuerAndSerial",tagClass:a.Class.UNIVERSAL,type:a.Type.SEQUENCE,constructed:!0,value:[{name:"RecipientInfo.issuerAndSerial.issuer",tagClass:a.Class.UNIVERSAL,type:a.Type.SEQUENCE,constructed:!0,captureAsn1:"issuer"},{name:"RecipientInfo.issuerAndSerial.serialNumber",tagClass:a.Class.UNIVERSAL,type:a.Type.INTEGER,constructed:!1,capture:"serial"}]},{name:"RecipientInfo.keyEncryptionAlgorithm",tagClass:a.Class.UNIVERSAL,type:a.Type.SEQUENCE,constructed:!0,value:[{name:"RecipientInfo.keyEncryptionAlgorithm.algorithm",tagClass:a.Class.UNIVERSAL,type:a.Type.OID,constructed:!1,capture:"encAlgorithm"},{name:"RecipientInfo.keyEncryptionAlgorithm.parameter",tagClass:a.Class.UNIVERSAL,constructed:!1,captureAsn1:"encParameter"}]},{name:"RecipientInfo.encryptedKey",tagClass:a.Class.UNIVERSAL,type:a.Type.OCTETSTRING,constructed:!1,capture:"encKey"}]}},function(e,t,r){var n=r(0);r(3),r(6),r(27),r(7),r(17),r(29),r(18),r(13),r(1),r(19);var a=n.asn1,i=e.exports=n.pki=n.pki||{};i.pemToDer=function(e){var t=n.pem.decode(e)[0];if(t.procType&&"ENCRYPTED"===t.procType.type)throw new Error("Could not convert PEM to DER; PEM is encrypted.");return n.util.createBuffer(t.body)},i.privateKeyFromPem=function(e){var t=n.pem.decode(e)[0];if("PRIVATE KEY"!==t.type&&"RSA PRIVATE KEY"!==t.type){var r=new Error('Could not convert private key from PEM; PEM header type is not "PRIVATE KEY" or "RSA PRIVATE KEY".');throw r.headerType=t.type,r}if(t.procType&&"ENCRYPTED"===t.procType.type)throw new Error("Could not convert private key from PEM; PEM is encrypted.");var o=a.fromDer(t.body);return i.privateKeyFromAsn1(o)},i.privateKeyToPem=function(e,t){var r={type:"RSA PRIVATE KEY",body:a.toDer(i.privateKeyToAsn1(e)).getBytes()};return n.pem.encode(r,{maxline:t})},i.privateKeyInfoToPem=function(e,t){var r={type:"PRIVATE KEY",body:a.toDer(e).getBytes()};return n.pem.encode(r,{maxline:t})}},function(e,t,r){var n=r(0);r(1),r(12),r(2),function(){function t(e,t,n,a){return"workers"in n?i(e,t,n,a):r(e,t,n,a)}function r(e,t,r,n){var i=o(e,t),s=u(i.bitLength());"millerRabinTests"in r&&(s=r.millerRabinTests);var c=10;"maxBlockTime"in r&&(c=r.maxBlockTime),a(i,e,t,0,s,c,n)}function a(e,t,r,i,u,s,c){var l=+new Date;do{if(e.bitLength()>t&&(e=o(t,r)),e.isProbablePrime(u))return c(null,e);e.dAddOffset(f[i++%8],0)}while(s<0||+new Date-le&&(s=o(e,t));var h=s.toString(16);r.target.postMessage({hex:h,workLoad:l}),s.dAddOffset(d,0)}}f=Math.max(1,f);for(var n=[],a=0;a=32)return i(),e();var t=32-u.pools[0].messageLength<<5;u.seedFile(t,function(t,r){if(t)return e(t);u.collect(r),i(),e()})}function r(){if(u.pools[0].messageLength>=32)return i();var e=32-u.pools[0].messageLength<<5;u.collect(u.seedFileSync(e)),i()}function i(){u.reseeds=4294967295===u.reseeds?0:u.reseeds+1;var e=u.plugin.md.create();e.update(u.keyBytes);for(var t=1,r=0;r<32;++r)u.reseeds%t==0&&(e.update(u.pools[r].digest().getBytes()),u.pools[r].start()),t<<=1;u.keyBytes=e.digest().getBytes(),e.start(),e.update(u.keyBytes);var n=e.digest().getBytes();u.key=u.plugin.formatKey(u.keyBytes),u.seed=u.plugin.formatSeed(n),u.generated=0}function o(e){var t=null,r=n.util.globalScope,a=r.crypto||r.msCrypto;a&&a.getRandomValues&&(t=function(e){return a.getRandomValues(e)});var i=n.util.createBuffer();if(t)for(;i.length()>16),f+=(32767&c)<<16,f+=c>>15,f=(2147483647&f)+(f>>31),d=4294967295&f;for(var s=0;s<3;++s)l=d>>>(s<<3),l^=Math.floor(256*Math.random()),i.putByte(String.fromCharCode(255&l))}return i.getBytes(e)}for(var u={plugin:e,key:null,seed:null,time:null,reseeds:0,generated:0,keyBytes:""},s=e.md,c=new Array(32),f=0;f<32;++f)c[f]=s.create();return u.pools=c,u.pool=0,u.generate=function(e,r){function a(l){if(l)return r(l);if(f.length()>=e)return r(null,f.getBytes(e));if(u.generated>1048575&&(u.key=null),null===u.key)return n.util.nextTick(function(){t(a)});var d=i(u.key,u.seed);u.generated+=d.length,f.putBytes(d),u.key=s(i(u.key,o(u.seed))),u.seed=c(i(u.key,u.seed)),n.util.setImmediate(a)}if(!r)return u.generateSync(e);var i=u.plugin.cipher,o=u.plugin.increment,s=u.plugin.formatKey,c=u.plugin.formatSeed,f=n.util.createBuffer();u.key=null,a()},u.generateSync=function(e){var t=u.plugin.cipher,a=u.plugin.increment,i=u.plugin.formatKey,o=u.plugin.formatSeed;u.key=null;for(var s=n.util.createBuffer();s.length()1048575&&(u.key=null),null===u.key&&r();var c=t(u.key,u.seed);u.generated+=c.length,s.putBytes(c),u.key=i(t(u.key,a(u.seed))),u.seed=o(t(u.key,u.seed))}return s.getBytes(e)},a?(u.seedFile=function(e,t){a.randomBytes(e,function(e,r){if(e)return t(e);t(null,r.toString())})},u.seedFileSync=function(e){return a.randomBytes(e).toString()}):(u.seedFile=function(e,t){try{t(null,o(e))}catch(e){t(e)}},u.seedFileSync=o),u.collect=function(e){for(var t=e.length,r=0;r>n&255);u.collect(r)},u.registerWorker=function(e){if(e===self)u.seedFile=function(e,t){function r(e){var n=e.data;n.forge&&n.forge.prng&&(self.removeEventListener("message",r),t(n.forge.prng.err,n.forge.prng.bytes))}self.addEventListener("message",r),self.postMessage({forge:{prng:{needed:e}}})};else{var t=function(t){var r=t.data;r.forge&&r.forge.prng&&u.seedFile(r.forge.prng.needed,function(t,r){e.postMessage({forge:{prng:{err:t,bytes:r}}})})};e.addEventListener("message",t)}},u}}).call(t,r(20))},function(e,t,r){var n=r(0);r(1);var a=[217,120,249,196,25,221,181,237,40,233,253,121,74,160,216,157,198,126,55,131,43,118,83,142,98,76,100,136,68,139,251,162,23,154,89,245,135,179,79,19,97,69,109,141,9,129,125,50,189,143,64,235,134,183,123,11,240,149,33,34,92,107,78,130,84,214,101,147,206,96,178,28,115,86,192,20,167,140,241,220,18,117,202,31,59,190,228,209,66,61,212,48,163,60,182,38,111,191,14,218,70,105,7,87,39,242,29,155,188,148,67,3,248,17,199,246,144,239,62,231,6,195,213,47,200,102,30,215,8,232,234,222,128,82,238,247,132,170,114,172,53,77,106,42,150,26,210,113,90,21,73,116,75,159,208,94,4,24,164,236,194,224,65,110,15,81,203,204,36,145,175,80,161,244,112,57,153,124,58,133,35,184,180,122,252,2,54,91,37,85,151,49,45,93,250,152,227,138,146,174,5,223,41,16,103,108,186,201,211,0,230,207,225,158,168,44,99,22,1,63,88,226,137,169,13,56,52,27,171,51,255,176,187,72,12,95,185,177,205,46,197,243,219,71,229,165,156,119,10,166,32,104,254,127,193,173],i=[1,2,3,5],o=function(e,t){return e<>16-t},u=function(e,t){return(65535&e)>>t|e<<16-t&65535};e.exports=n.rc2=n.rc2||{},n.rc2.expandKey=function(e,t){"string"==typeof e&&(e=n.util.createBuffer(e)),t=t||128;var r,i=e,o=e.length(),u=t,s=Math.ceil(u/8),c=255>>(7&u);for(r=o;r<128;r++)i.putByte(a[i.at(r-1)+i.at(r-o)&255]);for(i.setAt(128-s,a[i.at(128-s)&c]),r=127-s;r>=0;r--)i.setAt(r,a[i.at(r+1)^i.at(r+s)]);return i};var s=function(e,t,r){var a,s,c,f,l=!1,d=null,h=null,p=null,g=[];for(e=n.rc2.expandKey(e,t),c=0;c<64;c++)g.push(e.getInt16Le());r?(a=function(e){for(c=0;c<4;c++)e[c]+=g[f]+(e[(c+3)%4]&e[(c+2)%4])+(~e[(c+3)%4]&e[(c+1)%4]),e[c]=o(e[c],i[c]),f++},s=function(e){for(c=0;c<4;c++)e[c]+=g[63&e[(c+3)%4]]}):(a=function(e){for(c=3;c>=0;c--)e[c]=u(e[c],i[c]),e[c]-=g[f]+(e[(c+3)%4]&e[(c+2)%4])+(~e[(c+3)%4]&e[(c+1)%4]),f--},s=function(e){for(c=3;c>=0;c--)e[c]-=g[63&e[(c+3)%4]]});var v=function(e){var t=[];for(c=0;c<4;c++){var n=d.getInt16Le();null!==p&&(r?n^=p.getInt16Le():p.putInt16Le(n)),t.push(65535&n)}f=r?0:63;for(var a=0;a=8;)v([[5,a],[1,s],[6,a],[1,s],[5,a]])},finish:function(e){var t=!0;if(r)if(e)t=e(8,d,!r);else{var n=8===d.length()?8:8-d.length();d.fillWithByte(n,n)}if(t&&(l=!0,y.update()),!r&&(t=0===d.length()))if(e)t=e(8,h,!r);else{var a=h.length(),i=h.at(a-1);i>a?t=!1:h.truncate(i)}return t}}};n.rc2.startEncrypting=function(e,t,r){var a=n.rc2.createEncryptionCipher(e,128);return a.start(t,r),a},n.rc2.createEncryptionCipher=function(e,t){return s(e,t,!0)},n.rc2.startDecrypting=function(e,t,r){var a=n.rc2.createDecryptionCipher(e,128);return a.start(t,r),a},n.rc2.createDecryptionCipher=function(e,t){return s(e,t,!1)}},function(e,t,r){function n(){u=String.fromCharCode(128),u+=i.util.fillString(String.fromCharCode(0),64),c=[1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298],s=!0}function a(e,t,r){for(var n,a,i,o,u,s,f,l,d,h,p,g,v,y,m,b=r.length();b>=64;){for(f=0;f<16;++f)t[f]=r.getInt32();for(;f<64;++f)n=t[f-2],n=(n>>>17|n<<15)^(n>>>19|n<<13)^n>>>10,a=t[f-15],a=(a>>>7|a<<25)^(a>>>18|a<<14)^a>>>3,t[f]=n+t[f-7]+a+t[f-16]|0;for(l=e.h0,d=e.h1,h=e.h2,p=e.h3,g=e.h4,v=e.h5,y=e.h6,m=e.h7,f=0;f<64;++f)o=(g>>>6|g<<26)^(g>>>11|g<<21)^(g>>>25|g<<7),u=y^g&(v^y),i=(l>>>2|l<<30)^(l>>>13|l<<19)^(l>>>22|l<<10),s=l&d|h&(l^d),n=m+o+u+c[f]+t[f],a=i+s,m=y,y=v,v=g,g=p+n>>>0,p=h,h=d,d=l,l=n+a>>>0;e.h0=e.h0+l|0,e.h1=e.h1+d|0,e.h2=e.h2+h|0,e.h3=e.h3+p|0,e.h4=e.h4+g|0,e.h5=e.h5+v|0,e.h6=e.h6+y|0,e.h7=e.h7+m|0,b-=64}}var i=r(0);r(4),r(1);var o=e.exports=i.sha256=i.sha256||{};i.md.sha256=i.md.algorithms.sha256=o,o.create=function(){s||n();var e=null,t=i.util.createBuffer(),r=new Array(64),o={algorithm:"sha256",blockLength:64,digestLength:32,messageLength:0,fullMessageLength:null,messageLengthSize:8};return o.start=function(){o.messageLength=0,o.fullMessageLength=o.messageLength64=[];for(var r=o.messageLengthSize/4,n=0;n>>0,s>>>0];for(var c=o.fullMessageLength.length-1;c>=0;--c)o.fullMessageLength[c]+=s[1],s[1]=s[0]+(o.fullMessageLength[c]/4294967296>>>0),o.fullMessageLength[c]=o.fullMessageLength[c]>>>0,s[0]=s[1]/4294967296>>>0;return t.putBytes(n),a(e,r,t),(t.read>2048||0===t.length())&&t.compact(),o},o.digest=function(){var n=i.util.createBuffer();n.putBytes(t.bytes());var s=o.fullMessageLength[o.fullMessageLength.length-1]+o.messageLengthSize,c=s&o.blockLength-1;n.putBytes(u.substr(0,o.blockLength-c));for(var f,l,d=8*o.fullMessageLength[0],h=0;h>>0,d+=l,n.putInt32(d>>>0),d=f>>>0;n.putInt32(d);var p={h0:e.h0,h1:e.h1,h2:e.h2,h3:e.h3,h4:e.h4,h5:e.h5,h6:e.h6,h7:e.h7};a(p,r,n);var g=i.util.createBuffer();return g.putInt32(p.h0),g.putInt32(p.h1),g.putInt32(p.h2),g.putInt32(p.h3),g.putInt32(p.h4),g.putInt32(p.h5),g.putInt32(p.h6),g.putInt32(p.h7),g},o};var u=null,s=!1,c=null},function(e,t,r){function n(){s=String.fromCharCode(128),s+=i.util.fillString(String.fromCharCode(0),128),f=[[1116352408,3609767458],[1899447441,602891725],[3049323471,3964484399],[3921009573,2173295548],[961987163,4081628472],[1508970993,3053834265],[2453635748,2937671579],[2870763221,3664609560],[3624381080,2734883394],[310598401,1164996542],[607225278,1323610764],[1426881987,3590304994],[1925078388,4068182383],[2162078206,991336113],[2614888103,633803317],[3248222580,3479774868],[3835390401,2666613458],[4022224774,944711139],[264347078,2341262773],[604807628,2007800933],[770255983,1495990901],[1249150122,1856431235],[1555081692,3175218132],[1996064986,2198950837],[2554220882,3999719339],[2821834349,766784016],[2952996808,2566594879],[3210313671,3203337956],[3336571891,1034457026],[3584528711,2466948901],[113926993,3758326383],[338241895,168717936],[666307205,1188179964],[773529912,1546045734],[1294757372,1522805485],[1396182291,2643833823],[1695183700,2343527390],[1986661051,1014477480],[2177026350,1206759142],[2456956037,344077627],[2730485921,1290863460],[2820302411,3158454273],[3259730800,3505952657],[3345764771,106217008],[3516065817,3606008344],[3600352804,1432725776],[4094571909,1467031594],[275423344,851169720],[430227734,3100823752],[506948616,1363258195],[659060556,3750685593],[883997877,3785050280],[958139571,3318307427],[1322822218,3812723403],[1537002063,2003034995],[1747873779,3602036899],[1955562222,1575990012],[2024104815,1125592928],[2227730452,2716904306],[2361852424,442776044],[2428436474,593698344],[2756734187,3733110249],[3204031479,2999351573],[3329325298,3815920427],[3391569614,3928383900],[3515267271,566280711],[3940187606,3454069534],[4118630271,4000239992],[116418474,1914138554],[174292421,2731055270],[289380356,3203993006],[460393269,320620315],[685471733,587496836],[852142971,1086792851],[1017036298,365543100],[1126000580,2618297676],[1288033470,3409855158],[1501505948,4234509866],[1607167915,987167468],[1816402316,1246189591]],l={},l["SHA-512"]=[[1779033703,4089235720],[3144134277,2227873595],[1013904242,4271175723],[2773480762,1595750129],[1359893119,2917565137],[2600822924,725511199],[528734635,4215389547],[1541459225,327033209]],l["SHA-384"]=[[3418070365,3238371032],[1654270250,914150663],[2438529370,812702999],[355462360,4144912697],[1731405415,4290775857],[2394180231,1750603025],[3675008525,1694076839],[1203062813,3204075428]],l["SHA-512/256"]=[[573645204,4230739756],[2673172387,3360449730],[596883563,1867755857],[2520282905,1497426621],[2519219938,2827943907],[3193839141,1401305490],[721525244,746961066],[246885852,2177182882]],l["SHA-512/224"]=[[2352822216,424955298],[1944164710,2312950998],[502970286,855612546],[1738396948,1479516111],[258812777,2077511080],[2011393907,79989058],[1067287976,1780299464],[286451373,2446758561]],c=!0}function a(e,t,r){for(var n,a,i,o,u,s,c,l,d,h,p,g,v,y,m,b,C,S,E,T,w,I,A,B,k,N,R,$,x,_,L,P,D,U,O,M=r.length();M>=128;){for(x=0;x<16;++x)t[x][0]=r.getInt32()>>>0,t[x][1]=r.getInt32()>>>0;for(;x<80;++x)P=t[x-2],_=P[0],L=P[1],n=((_>>>19|L<<13)^(L>>>29|_<<3)^_>>>6)>>>0,a=((_<<13|L>>>19)^(L<<3|_>>>29)^(_<<26|L>>>6))>>>0,U=t[x-15],_=U[0],L=U[1],i=((_>>>1|L<<31)^(_>>>8|L<<24)^_>>>7)>>>0,o=((_<<31|L>>>1)^(_<<24|L>>>8)^(_<<25|L>>>7))>>>0,D=t[x-7],O=t[x-16],L=a+D[1]+o+O[1],t[x][0]=n+D[0]+i+O[0]+(L/4294967296>>>0)>>>0,t[x][1]=L>>>0;for(v=e[0][0],y=e[0][1],m=e[1][0],b=e[1][1],C=e[2][0],S=e[2][1],E=e[3][0],T=e[3][1],w=e[4][0],I=e[4][1],A=e[5][0],B=e[5][1],k=e[6][0],N=e[6][1],R=e[7][0],$=e[7][1],x=0;x<80;++x)c=((w>>>14|I<<18)^(w>>>18|I<<14)^(I>>>9|w<<23))>>>0,l=((w<<18|I>>>14)^(w<<14|I>>>18)^(I<<23|w>>>9))>>>0,d=(k^w&(A^k))>>>0,h=(N^I&(B^N))>>>0,u=((v>>>28|y<<4)^(y>>>2|v<<30)^(y>>>7|v<<25))>>>0,s=((v<<4|y>>>28)^(y<<30|v>>>2)^(y<<25|v>>>7))>>>0,p=(v&m|C&(v^m))>>>0,g=(y&b|S&(y^b))>>>0,L=$+l+h+f[x][1]+t[x][1],n=R+c+d+f[x][0]+t[x][0]+(L/4294967296>>>0)>>>0,a=L>>>0,L=s+g,i=u+p+(L/4294967296>>>0)>>>0,o=L>>>0,R=k,$=N,k=A,N=B,A=w,B=I,L=T+a,w=E+n+(L/4294967296>>>0)>>>0,I=L>>>0,E=C,T=S,C=m,S=b,m=v,b=y,L=a+o,v=n+i+(L/4294967296>>>0)>>>0,y=L>>>0;L=e[0][1]+y,e[0][0]=e[0][0]+v+(L/4294967296>>>0)>>>0,e[0][1]=L>>>0,L=e[1][1]+b,e[1][0]=e[1][0]+m+(L/4294967296>>>0)>>>0,e[1][1]=L>>>0,L=e[2][1]+S,e[2][0]=e[2][0]+C+(L/4294967296>>>0)>>>0,e[2][1]=L>>>0,L=e[3][1]+T,e[3][0]=e[3][0]+E+(L/4294967296>>>0)>>>0,e[3][1]=L>>>0,L=e[4][1]+I,e[4][0]=e[4][0]+w+(L/4294967296>>>0)>>>0,e[4][1]=L>>>0,L=e[5][1]+B,e[5][0]=e[5][0]+A+(L/4294967296>>>0)>>>0,e[5][1]=L>>>0,L=e[6][1]+N,e[6][0]=e[6][0]+k+(L/4294967296>>>0)>>>0,e[6][1]=L>>>0,L=e[7][1]+$,e[7][0]=e[7][0]+R+(L/4294967296>>>0)>>>0,e[7][1]=L>>>0,M-=128}}var i=r(0);r(4),r(1);var o=e.exports=i.sha512=i.sha512||{};i.md.sha512=i.md.algorithms.sha512=o;var u=i.sha384=i.sha512.sha384=i.sha512.sha384||{};u.create=function(){return o.create("SHA-384")},i.md.sha384=i.md.algorithms.sha384=u,i.sha512.sha256=i.sha512.sha256||{create:function(){return o.create("SHA-512/256")}},i.md["sha512/256"]=i.md.algorithms["sha512/256"]=i.sha512.sha256,i.sha512.sha224=i.sha512.sha224||{create:function(){return o.create("SHA-512/224")}},i.md["sha512/224"]=i.md.algorithms["sha512/224"]=i.sha512.sha224,o.create=function(e){if(c||n(),void 0===e&&(e="SHA-512"),!(e in l))throw new Error("Invalid SHA-512 algorithm: "+e);for(var t=l[e],r=null,o=i.util.createBuffer(),u=new Array(80),f=0;f<80;++f)u[f]=new Array(2);var d=64;switch(e){case"SHA-384":d=48;break;case"SHA-512/256":d=32;break;case"SHA-512/224":d=28}var h={algorithm:e.replace("-","").toLowerCase(),blockLength:128,digestLength:d,messageLength:0,fullMessageLength:null,messageLengthSize:16};return h.start=function(){h.messageLength=0,h.fullMessageLength=h.messageLength128=[];for(var e=h.messageLengthSize/4,n=0;n>>0,n>>>0];for(var s=h.fullMessageLength.length-1;s>=0;--s)h.fullMessageLength[s]+=n[1],n[1]=n[0]+(h.fullMessageLength[s]/4294967296>>>0),h.fullMessageLength[s]=h.fullMessageLength[s]>>>0,n[0]=n[1]/4294967296>>>0;return o.putBytes(e),a(r,u,o),(o.read>2048||0===o.length())&&o.compact(),h},h.digest=function(){var t=i.util.createBuffer();t.putBytes(o.bytes());var n=h.fullMessageLength[h.fullMessageLength.length-1]+h.messageLengthSize,c=n&h.blockLength-1;t.putBytes(s.substr(0,h.blockLength-c));for(var f,l,d=8*h.fullMessageLength[0],p=0;p>>0,d+=l,t.putInt32(d>>>0),d=f>>>0;t.putInt32(d);for(var g=new Array(r.length),p=0;p>1,u=o+(1&e.length),s=e.substr(0,u),c=e.substr(o,u),f=n.util.createBuffer(),l=n.hmac.create();r=t+r;var d=Math.ceil(a/16),h=Math.ceil(a/20);l.start("MD5",s);var p=n.util.createBuffer();f.putBytes(r);for(var g=0;g0&&(f.queue(e,f.createAlert(e,{level:f.Alert.Level.warning,description:f.Alert.Description.no_renegotiation})),f.flush(e)),e.process()},f.parseHelloMessage=function(e,t,r){var a=null,i=e.entity===f.ConnectionEnd.client;if(r<38)e.error(e,{message:i?"Invalid ServerHello message. Message too short.":"Invalid ClientHello message. Message too short.",send:!0,alert:{level:f.Alert.Level.fatal,description:f.Alert.Description.illegal_parameter}});else{var o=t.fragment,u=o.length();if(a={version:{major:o.getByte(),minor:o.getByte()},random:n.util.createBuffer(o.getBytes(32)),session_id:s(o,1),extensions:[]},i?(a.cipher_suite=o.getBytes(2),a.compression_method=o.getByte()):(a.cipher_suites=s(o,2),a.compression_methods=s(o,1)),(u=r-(u-o.length()))>0){for(var c=s(o,2);c.length()>0;)a.extensions.push({type:[c.getByte(),c.getByte()],data:s(c,2)});if(!i)for(var l=0;l0;){var p=h.getByte();if(0!==p)break;e.session.extensions.server_name.serverNameList.push(s(h,2).getBytes())}}}if(e.session.version&&(a.version.major!==e.session.version.major||a.version.minor!==e.session.version.minor))return e.error(e,{message:"TLS version change is disallowed during renegotiation.",send:!0,alert:{level:f.Alert.Level.fatal,description:f.Alert.Description.protocol_version}});if(i)e.session.cipherSuite=f.getCipherSuite(a.cipher_suite);else for(var g=n.util.createBuffer(a.cipher_suites.bytes());g.length()>0&&(e.session.cipherSuite=f.getCipherSuite(g.getBytes(2)),null===e.session.cipherSuite););if(null===e.session.cipherSuite)return e.error(e,{message:"No cipher suites in common.",send:!0,alert:{level:f.Alert.Level.fatal,description:f.Alert.Description.handshake_failure},cipherSuite:n.util.bytesToHex(a.cipher_suite)});e.session.compressionMethod=i?a.compression_method:f.CompressionMethod.none}return a},f.createSecurityParameters=function(e,t){var r=e.entity===f.ConnectionEnd.client,n=t.random.bytes(),a=r?e.session.sp.client_random:n,i=r?n:f.createRandom().getBytes();e.session.sp={entity:e.entity,prf_algorithm:f.PRFAlgorithm.tls_prf_sha256,bulk_cipher_algorithm:null,cipher_type:null,enc_key_length:null,block_length:null,fixed_iv_length:null,record_iv_length:null,mac_algorithm:null,mac_length:null,mac_key_length:null,compression_algorithm:e.session.compressionMethod,pre_master_secret:null,master_secret:null,client_random:a,server_random:i}},f.handleServerHello=function(e,t,r){var n=f.parseHelloMessage(e,t,r);if(!e.fail){if(!(n.version.minor<=e.version.minor))return e.error(e,{message:"Incompatible TLS version.",send:!0,alert:{level:f.Alert.Level.fatal,description:f.Alert.Description.protocol_version}});e.version.minor=n.version.minor,e.session.version=e.version;var a=n.session_id.bytes();a.length>0&&a===e.session.id?(e.expect=g,e.session.resuming=!0,e.session.sp.server_random=n.random.bytes()):(e.expect=l,e.session.resuming=!1,f.createSecurityParameters(e,n)),e.session.id=a,e.process()}},f.handleClientHello=function(e,t,r){var a=f.parseHelloMessage(e,t,r);if(!e.fail){var i=a.session_id.bytes(),o=null;if(e.sessionCache&&(o=e.sessionCache.getSession(i),null===o?i="":(o.version.major!==a.version.major||o.version.minor>a.version.minor)&&(o=null,i="")),0===i.length&&(i=n.random.getBytes(32)),e.session.id=i,e.session.clientHelloVersion=a.version,e.session.sp={},o)e.version=e.session.version=o.version,e.session.sp=o.sp;else{for(var u,s=1;s0;)a=s(u.certificate_list,3),i=n.asn1.fromDer(a),a=n.pki.certificateFromAsn1(i,!0),c.push(a)}catch(t){return e.error(e,{message:"Could not parse certificate list.",cause:t,send:!0,alert:{level:f.Alert.Level.fatal,description:f.Alert.Description.bad_certificate}})}var l=e.entity===f.ConnectionEnd.client;!l&&!0!==e.verifyClient||0!==c.length?0===c.length?e.expect=l?d:C:(l?e.session.serverCertificate=c[0]:e.session.clientCertificate=c[0],f.verifyCertificateChain(e,c)&&(e.expect=l?d:C)):e.error(e,{message:l?"No server certificate provided.":"No client certificate provided.",send:!0,alert:{level:f.Alert.Level.fatal,description:f.Alert.Description.illegal_parameter}}),e.process()},f.handleServerKeyExchange=function(e,t,r){if(r>0)return e.error(e,{message:"Invalid key parameters. Only RSA is supported.",send:!0,alert:{level:f.Alert.Level.fatal,description:f.Alert.Description.unsupported_certificate}});e.expect=h,e.process()},f.handleClientKeyExchange=function(e,t,r){if(r<48)return e.error(e,{message:"Invalid key parameters. Only RSA is supported.",send:!0,alert:{level:f.Alert.Level.fatal,description:f.Alert.Description.unsupported_certificate}});var a=t.fragment,i={enc_pre_master_secret:s(a,2).getBytes()},o=null;if(e.getPrivateKey)try{o=e.getPrivateKey(e,e.session.serverCertificate),o=n.pki.privateKeyFromPem(o)}catch(t){e.error(e,{message:"Could not get private key.",cause:t,send:!0,alert:{level:f.Alert.Level.fatal,description:f.Alert.Description.internal_error}})}if(null===o)return e.error(e,{message:"No private key set.",send:!0,alert:{level:f.Alert.Level.fatal,description:f.Alert.Description.internal_error}});try{var u=e.session.sp;u.pre_master_secret=o.decrypt(i.enc_pre_master_secret);var c=e.session.clientHelloVersion;if(c.major!==u.pre_master_secret.charCodeAt(0)||c.minor!==u.pre_master_secret.charCodeAt(1))throw new Error("TLS version rollback attack detected.")}catch(e){u.pre_master_secret=n.random.getBytes(48)}e.expect=E,null!==e.session.clientCertificate&&(e.expect=S),e.process()},f.handleCertificateRequest=function(e,t,r){if(r<3)return e.error(e,{message:"Invalid CertificateRequest. Message too short.",send:!0,alert:{level:f.Alert.Level.fatal,description:f.Alert.Description.illegal_parameter}});var n=t.fragment,a={certificate_types:s(n,1),certificate_authorities:s(n,2)};e.session.certificateRequest=a,e.expect=p,e.process()},f.handleCertificateVerify=function(e,t,r){if(r<2)return e.error(e,{message:"Invalid CertificateVerify. Message too short.",send:!0,alert:{level:f.Alert.Level.fatal,description:f.Alert.Description.illegal_parameter}});var a=t.fragment;a.read-=4;var i=a.bytes();a.read+=4;var o={signature:s(a,2).getBytes()},u=n.util.createBuffer();u.putBuffer(e.session.md5.digest()),u.putBuffer(e.session.sha1.digest()),u=u.getBytes();try{if(!e.session.clientCertificate.publicKey.verify(u,o.signature,"NONE"))throw new Error("CertificateVerify signature does not match.");e.session.md5.update(i),e.session.sha1.update(i)}catch(t){return e.error(e,{message:"Bad signature in CertificateVerify.",send:!0,alert:{level:f.Alert.Level.fatal,description:f.Alert.Description.handshake_failure}})}e.expect=E,e.process()},f.handleServerHelloDone=function(e,t,r){if(r>0)return e.error(e,{message:"Invalid ServerHelloDone message. Invalid length.",send:!0,alert:{level:f.Alert.Level.fatal,description:f.Alert.Description.record_overflow}});if(null===e.serverCertificate){var a={message:"No server certificate provided. Not enough security.",send:!0,alert:{level:f.Alert.Level.fatal,description:f.Alert.Description.insufficient_security}},i=e.verify(e,a.alert.description,0,[]);if(!0!==i)return(i||0===i)&&("object"!=typeof i||n.util.isArray(i)?"number"==typeof i&&(a.alert.description=i):(i.message&&(a.message=i.message),i.alert&&(a.alert.description=i.alert))),e.error(e,a)}null!==e.session.certificateRequest&&(t=f.createRecord(e,{type:f.ContentType.handshake,data:f.createCertificate(e)}),f.queue(e,t)),t=f.createRecord(e,{type:f.ContentType.handshake,data:f.createClientKeyExchange(e)}),f.queue(e,t),e.expect=m;var o=function(e,t){null!==e.session.certificateRequest&&null!==e.session.clientCertificate&&f.queue(e,f.createRecord(e,{type:f.ContentType.handshake,data:f.createCertificateVerify(e,t)})),f.queue(e,f.createRecord(e,{type:f.ContentType.change_cipher_spec,data:f.createChangeCipherSpec()})),e.state.pending=f.createConnectionState(e),e.state.current.write=e.state.pending.write,f.queue(e,f.createRecord(e,{type:f.ContentType.handshake,data:f.createFinished(e)})),e.expect=g,f.flush(e),e.process()};if(null===e.session.certificateRequest||null===e.session.clientCertificate)return o(e,null);f.getClientSignature(e,o)},f.handleChangeCipherSpec=function(e,t){if(1!==t.fragment.getByte())return e.error(e,{message:"Invalid ChangeCipherSpec message received.",send:!0,alert:{level:f.Alert.Level.fatal,description:f.Alert.Description.illegal_parameter}});var r=e.entity===f.ConnectionEnd.client;(e.session.resuming&&r||!e.session.resuming&&!r)&&(e.state.pending=f.createConnectionState(e)),e.state.current.read=e.state.pending.read,(!e.session.resuming&&r||e.session.resuming&&!r)&&(e.state.pending=null),e.expect=r?v:T,e.process()},f.handleFinished=function(e,t,r){var i=t.fragment;i.read-=4;var o=i.bytes();i.read+=4;var u=t.fragment.getBytes();i=n.util.createBuffer(),i.putBuffer(e.session.md5.digest()),i.putBuffer(e.session.sha1.digest());var s=e.entity===f.ConnectionEnd.client,c=s?"server finished":"client finished",l=e.session.sp;if(i=a(l.master_secret,c,i.getBytes(),12),i.getBytes()!==u)return e.error(e,{message:"Invalid verify_data in Finished message.",send:!0,alert:{level:f.Alert.Level.fatal,description:f.Alert.Description.decrypt_error}});e.session.md5.update(o),e.session.sha1.update(o),(e.session.resuming&&s||!e.session.resuming&&!s)&&(f.queue(e,f.createRecord(e,{type:f.ContentType.change_cipher_spec,data:f.createChangeCipherSpec()})),e.state.current.write=e.state.pending.write,e.state.pending=null,f.queue(e,f.createRecord(e,{type:f.ContentType.handshake,data:f.createFinished(e)}))),e.expect=s?y:w,e.handshaking=!1,++e.handshakes,e.peerCertificate=s?e.session.serverCertificate:e.session.clientCertificate,f.flush(e),e.isConnected=!0,e.connected(e),e.process()},f.handleAlert=function(e,t){var r,n=t.fragment,a={level:n.getByte(),description:n.getByte()};switch(a.description){case f.Alert.Description.close_notify:r="Connection closed.";break;case f.Alert.Description.unexpected_message:r="Unexpected message.";break;case f.Alert.Description.bad_record_mac:r="Bad record MAC.";break;case f.Alert.Description.decryption_failed:r="Decryption failed.";break;case f.Alert.Description.record_overflow:r="Record overflow.";break;case f.Alert.Description.decompression_failure:r="Decompression failed.";break;case f.Alert.Description.handshake_failure:r="Handshake failure.";break;case f.Alert.Description.bad_certificate:r="Bad certificate.";break;case f.Alert.Description.unsupported_certificate:r="Unsupported certificate.";break;case f.Alert.Description.certificate_revoked:r="Certificate revoked.";break;case f.Alert.Description.certificate_expired:r="Certificate expired.";break;case f.Alert.Description.certificate_unknown:r="Certificate unknown.";break;case f.Alert.Description.illegal_parameter:r="Illegal parameter.";break;case f.Alert.Description.unknown_ca:r="Unknown certificate authority.";break;case f.Alert.Description.access_denied:r="Access denied.";break;case f.Alert.Description.decode_error:r="Decode error.";break;case f.Alert.Description.decrypt_error:r="Decrypt error.";break;case f.Alert.Description.export_restriction:r="Export restriction.";break;case f.Alert.Description.protocol_version:r="Unsupported protocol version.";break;case f.Alert.Description.insufficient_security:r="Insufficient security.";break;case f.Alert.Description.internal_error:r="Internal error.";break;case f.Alert.Description.user_canceled:r="User canceled.";break;case f.Alert.Description.no_renegotiation:r="Renegotiation not supported.";break;default:r="Unknown error."}if(a.description===f.Alert.Description.close_notify)return e.close();e.error(e,{message:r,send:!1,origin:e.entity===f.ConnectionEnd.client?"server":"client",alert:a}),e.process()},f.handleHandshake=function(e,t){var r=t.fragment,a=r.getByte(),i=r.getInt24();if(i>r.length())return e.fragmented=t,t.fragment=n.util.createBuffer(),r.read-=4,e.process();e.fragmented=null,r.read-=4;var o=r.bytes(i+4);r.read+=4,a in M[e.entity][e.expect]?(e.entity!==f.ConnectionEnd.server||e.open||e.fail||(e.handshaking=!0,e.session={version:null,extensions:{server_name:{serverNameList:[]}},cipherSuite:null,compressionMethod:null,serverCertificate:null,clientCertificate:null,md5:n.md.md5.create(),sha1:n.md.sha1.create()}),a!==f.HandshakeType.hello_request&&a!==f.HandshakeType.certificate_verify&&a!==f.HandshakeType.finished&&(e.session.md5.update(o),e.session.sha1.update(o)),M[e.entity][e.expect][a](e,t,i)):f.handleUnexpected(e,t)},f.handleApplicationData=function(e,t){e.data.putBuffer(t.fragment),e.dataReady(e),e.process()},f.handleHeartbeat=function(e,t){var r=t.fragment,a=r.getByte(),i=r.getInt16(),o=r.getBytes(i);if(a===f.HeartbeatMessageType.heartbeat_request){if(e.handshaking||i>o.length)return e.process();f.queue(e,f.createRecord(e,{type:f.ContentType.heartbeat,data:f.createHeartbeat(f.HeartbeatMessageType.heartbeat_response,o)})),f.flush(e)}else if(a===f.HeartbeatMessageType.heartbeat_response){if(o!==e.expectedHeartbeatPayload)return e.process();e.heartbeatReceived&&e.heartbeatReceived(e,n.util.createBuffer(o))}e.process()};var l=1,d=2,h=3,p=4,g=5,v=6,y=7,m=8,b=1,C=2,S=3,E=4,T=5,w=6,I=f.handleUnexpected,A=f.handleChangeCipherSpec,B=f.handleAlert,k=f.handleHandshake,N=f.handleApplicationData,R=f.handleHeartbeat,$=[];$[f.ConnectionEnd.client]=[[I,B,k,I,R],[I,B,k,I,R],[I,B,k,I,R],[I,B,k,I,R],[I,B,k,I,R],[A,B,I,I,R],[I,B,k,I,R],[I,B,k,N,R],[I,B,k,I,R]],$[f.ConnectionEnd.server]=[[I,B,k,I,R],[I,B,k,I,R],[I,B,k,I,R],[I,B,k,I,R],[A,B,I,I,R],[I,B,k,I,R],[I,B,k,N,R],[I,B,k,I,R]];var x=f.handleHelloRequest,_=f.handleServerHello,L=f.handleCertificate,P=f.handleServerKeyExchange,D=f.handleCertificateRequest,U=f.handleServerHelloDone,O=f.handleFinished,M=[];M[f.ConnectionEnd.client]=[[I,I,_,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I],[x,I,I,I,I,I,I,I,I,I,I,L,P,D,U,I,I,I,I,I,I],[x,I,I,I,I,I,I,I,I,I,I,I,P,D,U,I,I,I,I,I,I],[x,I,I,I,I,I,I,I,I,I,I,I,I,D,U,I,I,I,I,I,I],[x,I,I,I,I,I,I,I,I,I,I,I,I,I,U,I,I,I,I,I,I],[x,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I],[x,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,O],[x,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I],[x,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I]];var F=f.handleClientHello,V=f.handleClientKeyExchange,K=f.handleCertificateVerify;M[f.ConnectionEnd.server]=[[I,F,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I],[I,I,I,I,I,I,I,I,I,I,I,L,I,I,I,I,I,I,I,I,I],[I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,V,I,I,I,I],[I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,K,I,I,I,I,I],[I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I],[I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,O],[I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I],[I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I]],f.generateKeys=function(e,t){var r=a,n=t.client_random+t.server_random;e.session.resuming||(t.master_secret=r(t.pre_master_secret,"master secret",n,48).bytes(),t.pre_master_secret=null),n=t.server_random+t.client_random;var i=2*t.mac_key_length+2*t.enc_key_length,o=e.version.major===f.Versions.TLS_1_0.major&&e.version.minor===f.Versions.TLS_1_0.minor;o&&(i+=2*t.fixed_iv_length);var u=r(t.master_secret,"key expansion",n,i),s={client_write_MAC_key:u.getBytes(t.mac_key_length),server_write_MAC_key:u.getBytes(t.mac_key_length),client_write_key:u.getBytes(t.enc_key_length),server_write_key:u.getBytes(t.enc_key_length)};return o&&(s.client_write_IV=u.getBytes(t.fixed_iv_length),s.server_write_IV=u.getBytes(t.fixed_iv_length)),s},f.createConnectionState=function(e){var t=e.entity===f.ConnectionEnd.client,r=function(){var e={sequenceNumber:[0,0],macKey:null,macLength:0,macFunction:null,cipherState:null,cipherFunction:function(e){return!0},compressionState:null,compressFunction:function(e){return!0},updateSequenceNumber:function(){4294967295===e.sequenceNumber[1]?(e.sequenceNumber[1]=0,++e.sequenceNumber[0]):++e.sequenceNumber[1]}};return e},n={read:r(),write:r()};if(n.read.update=function(e,t){return n.read.cipherFunction(t,n.read)?n.read.compressFunction(e,t,n.read)||e.error(e,{message:"Could not decompress record.",send:!0,alert:{level:f.Alert.Level.fatal,description:f.Alert.Description.decompression_failure}}):e.error(e,{message:"Could not decrypt record or bad MAC.",send:!0,alert:{level:f.Alert.Level.fatal,description:f.Alert.Description.bad_record_mac}}),!e.fail},n.write.update=function(e,t){return n.write.compressFunction(e,t,n.write)?n.write.cipherFunction(t,n.write)||e.error(e,{message:"Could not encrypt record.",send:!1,alert:{level:f.Alert.Level.fatal,description:f.Alert.Description.internal_error}}):e.error(e,{message:"Could not compress record.",send:!1,alert:{level:f.Alert.Level.fatal,description:f.Alert.Description.internal_error}}),!e.fail},e.session){var a=e.session.sp;switch(e.session.cipherSuite.initSecurityParameters(a),a.keys=f.generateKeys(e,a),n.read.macKey=t?a.keys.server_write_MAC_key:a.keys.client_write_MAC_key,n.write.macKey=t?a.keys.client_write_MAC_key:a.keys.server_write_MAC_key,e.session.cipherSuite.initConnectionState(n,e,a),a.compression_algorithm){case f.CompressionMethod.none:break;case f.CompressionMethod.deflate:n.read.compressFunction=u,n.write.compressFunction=o;break;default:throw new Error("Unsupported compression algorithm.")}}return n},f.createRandom=function(){var e=new Date,t=+e+6e4*e.getTimezoneOffset(),r=n.util.createBuffer();return r.putInt32(t),r.putBytes(n.random.getBytes(28)),r},f.createRecord=function(e,t){return t.data?{type:t.type,version:{major:e.version.major,minor:e.version.minor},length:t.data.length(),fragment:t.data}:null},f.createAlert=function(e,t){var r=n.util.createBuffer();return r.putByte(t.level),r.putByte(t.description),f.createRecord(e,{type:f.ContentType.alert,data:r})},f.createClientHello=function(e){e.session.clientHelloVersion={major:e.version.major,minor:e.version.minor};for(var t=n.util.createBuffer(),r=0;r0&&(p+=2);var g=e.session.id,v=g.length+1+2+4+28+2+i+1+u+p,y=n.util.createBuffer();return y.putByte(f.HandshakeType.client_hello),y.putInt24(v),y.putByte(e.version.major),y.putByte(e.version.minor),y.putBytes(e.session.sp.client_random),c(y,1,n.util.createBuffer(g)),c(y,2,t),c(y,1,o),p>0&&c(y,2,s),y},f.createServerHello=function(e){var t=e.session.id,r=t.length+1+2+4+28+2+1,a=n.util.createBuffer();return a.putByte(f.HandshakeType.server_hello),a.putInt24(r),a.putByte(e.version.major),a.putByte(e.version.minor),a.putBytes(e.session.sp.server_random),c(a,1,n.util.createBuffer(t)),a.putByte(e.session.cipherSuite.id[0]),a.putByte(e.session.cipherSuite.id[1]),a.putByte(e.session.compressionMethod),a},f.createCertificate=function(e){var t=e.entity===f.ConnectionEnd.client,r=null;if(e.getCertificate){var a;a=t?e.session.certificateRequest:e.session.extensions.server_name.serverNameList,r=e.getCertificate(e,a)}var i=n.util.createBuffer();if(null!==r)try{n.util.isArray(r)||(r=[r]);for(var o=null,u=0;uf.MaxFragment;)a.push(f.createRecord(e,{type:t.type,data:n.util.createBuffer(i.slice(0,f.MaxFragment))})),i=i.slice(f.MaxFragment);i.length>0&&a.push(f.createRecord(e,{type:t.type,data:n.util.createBuffer(i)}))}for(var o=0;o0&&(a=r.order[0]),null!==a&&a in r.cache){t=r.cache[a],delete r.cache[a];for(var i in r.order)if(r.order[i]===a){r.order.splice(i,1);break}}return t},r.setSession=function(e,t){if(r.order.length===r.capacity){var a=r.order.shift();delete r.cache[a]}var a=n.util.bytesToHex(e);r.order.push(a),r.cache[a]=t}}return r},f.createConnection=function(e){var t=null;t=e.caStore?n.util.isArray(e.caStore)?n.pki.createCaStore(e.caStore):e.caStore:n.pki.createCaStore();var r=e.cipherSuites||null;if(null===r){r=[];for(var a in f.CipherSuites)r.push(f.CipherSuites[a])}var i=e.server?f.ConnectionEnd.server:f.ConnectionEnd.client,o=e.sessionCache?f.createSessionCache(e.sessionCache):null,u={version:{major:f.Version.major,minor:f.Version.minor},entity:i,sessionId:e.sessionId,caStore:t,sessionCache:o,cipherSuites:r,connected:e.connected,virtualHost:e.virtualHost||null,verifyClient:e.verifyClient||!1,verify:e.verify||function(e,t,r,n){return t},verifyOptions:e.verifyOptions||{},getCertificate:e.getCertificate||null,getPrivateKey:e.getPrivateKey||null,getSignature:e.getSignature||null,input:n.util.createBuffer(),tlsData:n.util.createBuffer(),data:n.util.createBuffer(),tlsDataReady:e.tlsDataReady,dataReady:e.dataReady,heartbeatReceived:e.heartbeatReceived,closed:e.closed,error:function(t,r){r.origin=r.origin||(t.entity===f.ConnectionEnd.client?"client":"server"),r.send&&(f.queue(t,f.createAlert(t,r.alert)),f.flush(t));var n=!1!==r.fatal;n&&(t.fail=!0),e.error(t,r),n&&t.close(!1)},deflate:e.deflate||null,inflate:e.inflate||null};u.reset=function(e){u.version={major:f.Version.major,minor:f.Version.minor},u.record=null,u.session=null,u.peerCertificate=null,u.state={pending:null,current:null},u.expect=(u.entity,f.ConnectionEnd.client,0),u.fragmented=null,u.records=[],u.open=!1,u.handshakes=0,u.handshaking=!1,u.isConnected=!1,u.fail=!(e||void 0===e),u.input.clear(),u.tlsData.clear(),u.data.clear(),u.state.current=f.createConnectionState(u)},u.reset();var s=function(e,t){var r=t.type-f.ContentType.change_cipher_spec,n=$[e.entity][e.expect];r in n?n[r](e,t):f.handleUnexpected(e,t)},c=function(e){var t=0,r=e.input,a=r.length();if(a<5)t=5-a;else{e.record={type:r.getByte(),version:{major:r.getByte(),minor:r.getByte()},length:r.getInt16(),fragment:n.util.createBuffer(),ready:!1};var i=e.record.version.major===e.version.major;i&&e.session&&e.session.version&&(i=e.record.version.minor===e.version.minor),i||e.error(e,{message:"Incompatible TLS version.",send:!0,alert:{level:f.Alert.Level.fatal,description:f.Alert.Description.protocol_version}})}return t},l=function(e){var t=0,r=e.input,n=r.length();if(n0&&(u.sessionCache&&(t=u.sessionCache.getSession(e)),null===t&&(e="")),0===e.length&&u.sessionCache&&null!==(t=u.sessionCache.getSession())&&(e=t.id),u.session={id:e,version:null,cipherSuite:null,compressionMethod:null,serverCertificate:null,certificateRequest:null,clientCertificate:null,sp:{},md5:n.md.md5.create(),sha1:n.md.sha1.create()},t&&(u.version=t.version,u.session.sp=t.sp),u.session.sp.client_random=f.createRandom().getBytes(),u.open=!0,f.queue(u,f.createRecord(u,{type:f.ContentType.handshake,data:f.createClientHello(u)})),f.flush(u)}},u.process=function(e){var t=0;return e&&u.input.putBytes(e),u.fail||(null!==u.record&&u.record.ready&&u.record.fragment.isEmpty()&&(u.record=null),null===u.record&&(t=c(u)),u.fail||null===u.record||u.record.ready||(t=l(u)),!u.fail&&null!==u.record&&u.record.ready&&s(u,u.record)),t},u.prepare=function(e){return f.queue(u,f.createRecord(u,{type:f.ContentType.application_data,data:n.util.createBuffer(e)})),f.flush(u)},u.prepareHeartbeatRequest=function(e,t){return e instanceof n.util.ByteBuffer&&(e=e.bytes()),void 0===t&&(t=e.length),u.expectedHeartbeatPayload=e,f.queue(u,f.createRecord(u,{type:f.ContentType.heartbeat,data:f.createHeartbeat(f.HeartbeatMessageType.heartbeat_request,e,t)})),f.flush(u)},u.close=function(e){if(!u.fail&&u.sessionCache&&u.session){var t={id:u.session.id,version:u.session.version,sp:u.session.sp};t.sp.keys=null,u.sessionCache.setSession(t.id,t)}u.open&&(u.open=!1,u.input.clear(),(u.isConnected||u.handshaking)&&(u.isConnected=u.handshaking=!1,f.queue(u,f.createAlert(u,{level:f.Alert.Level.warning,description:f.Alert.Description.close_notify})),f.flush(u)),u.closed(u)),u.reset(e)},u},e.exports=n.tls=n.tls||{};for(var q in f)"function"!=typeof f[q]&&(n.tls[q]=f[q]);n.tls.prf_tls1=a,n.tls.hmac_sha1=i,n.tls.createSessionCache=f.createSessionCache,n.tls.createConnection=f.createConnection},function(e,t,r){"use strict";var n=function(){var e,t,r,n={};n.startWatching=function(e,n){t=e,r=n,setInterval(a,100)};var a=function(){r.version.getNetwork(function(r,n){r?console.log("error with web3.version.getNetwork: ",r):n!=e&&(t.send(parseInt(n)),e=n)})};return n}();e.exports=n},function(e,t,r){"use strict";function n(e,t){for(;e.length");if("boolean"==typeof t)return T(e,t?"True":"False");if("number"==typeof t)return w(e,t+"");if(t instanceof String)return A(e,"'"+E(t,!0)+"'");if("string"==typeof t)return I(e,'"'+E(t,!1)+'"');if("object"==typeof t&&"$"in t){var r=t.$;if("number"==typeof r)return k(e,"");if("#"===r[0]){var n=[];for(var a in t)"$"!==a&&n.push(S(e,t[a]));return"("+n.join(",")+")"}if("Set_elm_builtin"===r)return T(e,"Set")+B(e,".fromList")+" "+S(e,ja(t));if("RBNode_elm_builtin"===r||"RBEmpty_elm_builtin"===r)return T(e,"Dict")+B(e,".fromList")+" "+S(e,Ka(t));if("Array_elm_builtin"===r)return T(e,"Array")+B(e,".fromList")+" "+S(e,Ma(t));if("::"===r||"[]"===r){var n="[";for(t.b&&(n+=S(e,t.a),t=t.b);t.b;t=t.b)n+=","+S(e,t.a);return n+"]"}var n="";for(var i in t)if("$"!==i){var o=S(e,t[i]),u=o[0],s="{"===u||"("===u||"["===u||"<"===u||'"'===u||o.indexOf(" ")<0;n+=" "+(s?o:"("+o+")")}return T(e,r)+n}if("function"==typeof DataView&&t instanceof DataView)return I(e,"<"+t.byteLength+" bytes>");if("function"==typeof File&&t instanceof File)return k(e,"<"+t.name+">");if("object"==typeof t){var n=[];for(var c in t){var f="_"===c[0]?c.slice(1):c;n.push(B(e,f)+" = "+S(e,t[c]))}return 0===n.length?"{}":"{ "+n.join(", ")+" }"}return k(e,"")}function E(e,t){var r=e.replace(/\\/g,"\\\\").replace(/\n/g,"\\n").replace(/\t/g,"\\t").replace(/\r/g,"\\r").replace(/\v/g,"\\v").replace(/\0/g,"\\0");return t?r.replace(/\'/g,"\\'"):r.replace(/\"/g,'\\"')}function T(e,t){return e?""+t+"":t}function w(e,t){return e?""+t+"":t}function I(e,t){return e?""+t+"":t}function A(e,t){return e?""+t+"":t}function B(e,t){return e?""+t+"":t}function k(e,t){return e?""+t+"":t}function N(e,t,r,n,a){switch(e){case 0:throw new Error('What node should I take over? In JavaScript I need something like:\n\n Elm.Main.init({\n node: document.getElementById("elm-node")\n })\n\nYou need to do this with any Browser.sandbox or Browser.element program.');case 1:throw new Error("Browser.application programs cannot handle URLs like this:\n\n "+document.location.href+"\n\nWhat is the root? The root of your file system? Try looking at this program with `elm reactor` or some other server.");case 2:var i=t;throw new Error("Problem with the flags given to your Elm program on initialization.\n\n"+i);case 3:var o=t;throw new Error("There can only be one port named `"+o+"`, but your program has multiple.");case 4:var o=t,u=r;throw new Error("Trying to send an unexpected type of value through port `"+o+"`:\n"+u);case 5:throw new Error('Trying to use `(==)` on functions.\nThere is no way to know if functions are "the same" in the Elm sense.\nRead more about this at https://package.elm-lang.org/packages/elm/core/latest/Basics#== which describes why it is this way and what the better version will look like.');case 6:var s=t;throw new Error("Your page is loading multiple Elm scripts with a module named "+s+". Maybe a duplicate script is getting loaded accidentally? If not, rename one of them so I know which is which!");case 8:var s=t,c=r,f=n;throw new Error("TODO in module `"+s+"` "+R(c)+"\n\n"+f);case 9:var s=t,c=r,l=n,f=a;throw new Error("TODO in module `"+s+"` from the `case` expression "+R(c)+"\n\nIt received the following value:\n\n "+C(l).replace("\n","\n ")+"\n\nBut the branch that handles it says:\n\n "+f.replace("\n","\n "));case 10:throw new Error("Bug in https://github.com/elm/virtual-dom/issues");case 11:throw new Error("Cannot perform mod 0. Division by zero error.")}}function R(e){return e.start.line===e.end.line?"on line "+e.start.line:"on lines "+e.start.line+" through "+e.end.line}function $(e,t){for(var r,n=[],a=x(e,t,0,n);a&&(r=n.pop());a=x(r.a,r.b,0,n));return a}function x(e,t,r,n){if(r>100)return n.push(L(e,t)),!0;if(e===t)return!0;if("object"!=typeof e||null===e||null===t)return"function"==typeof e&&N(5),!1;"Set_elm_builtin"===e.$&&(e=ja(e),t=ja(t)),"RBNode_elm_builtin"!==e.$&&"RBEmpty_elm_builtin"!==e.$||(e=Ka(e),t=Ka(t));for(var a in e)if(!x(e[a],t[a],r+1,n))return!1;return!0}function _(e,t,r){if("object"!=typeof e)return e===t?0:e=t.length)return ge("a LONGER array. Need index "+a+" but only see "+t.length+" entries",t);var n=le(e.b,t[a]);return Ai(n)?n:wi(f(Ni,a,n.a));case 8:if("object"!=typeof t||null===t||he(t))return ge("an OBJECT",t);var i=mr;for(var o in t)if(t.hasOwnProperty(o)){var n=le(e.b,t[o]);if(!Ai(n))return wi(f(ki,o,n.a));i=M(L(o,n.a),i)}return Ii(Ya(i));case 9:for(var u=e.f,s=e.g,c=0;c=0&&a.splice(t,1)}var a=[],i=gn[e].r,o=_e(0);return gn[e].b=o,gn[e].c=n(function(e,t,r){for(;t.b;t=t.b)for(var n=a,u=be(i(t.a)),s=0;s0&&bt(r,1,n,f));case 4:for(var l=e.j,d=t.j,h=!1,p=e.k;4===p.$;)h=!0,"object"!=typeof l?l=[l,p.j]:l.push(p.j),p=p.k;for(var g=t.k;4===g.$;)h=!0,"object"!=typeof d?d=[d,g.j]:d.push(g.j),g=g.k;return h&&l.length!==d.length?void bt(r,0,n,t):((h?St(l,d):l===d)||bt(r,2,n,d),void Ct(p,g,r,n+1));case 0:return void(e.a!==t.a&&bt(r,3,n,t.a));case 1:return void Et(e,t,r,n,wt);case 2:return void Et(e,t,r,n,It);case 3:if(e.h!==t.h)return void bt(r,0,n,t);var v=Tt(e.d,t.d);v&&bt(r,4,n,v);var y=t.i(e.g,t.g);return void(y&&bt(r,5,n,y))}}}function St(e,t){for(var r=0;ru?bt(r,6,n,{v:u,i:o-u}):o0||o.length>0||k)&&bt(r,8,n,{w:a,x:o,y:k})}function At(e,t,r,n,a,i){var o=e[r];if(!o)return o={c:0,z:n,r:a,s:void 0},i.push({r:a,A:o}),void(e[r]=o);if(1===o.c){i.push({r:a,A:o}),o.c=2;var u=[];return Ct(o.z,n,u,o.r),o.r=a,void(o.s.s={w:u,A:o})}At(e,t,r+Jn,n,a,i)}function Bt(e,t,r,n,a){var i=e[r];if(!i){var o=bt(t,9,a,void 0);return void(e[r]={c:1,z:n,r:a,s:o})}if(0===i.c){i.c=2;var u=[];return Ct(n,i.z,u,a),void bt(t,9,a,{w:u,A:i})}Bt(e,t,r+Jn,n,a)}function kt(e,t,r,n){Nt(e,t,r,0,0,t.b,n)}function Nt(e,t,r,n,a,i,o){for(var u=r[n],s=u.r;s===a;){var c=u.$;if(1===c)kt(e,t.k,u.s,o);else if(8===c){u.t=e,u.u=o;var f=u.s.w;f.length>0&&Nt(e,t,f,0,a,i,o)}else if(9===c){u.t=e,u.u=o;var l=u.s;if(l){l.A.s=e;var f=l.w;f.length>0&&Nt(e,t,f,0,a,i,o)}}else u.t=e,u.u=o;if(n++,!(u=r[n])||(s=u.r)>i)return n}var d=t.$;if(4===d){for(var h=t.k;4===h.$;)h=h.k;return Nt(e,h,r,n,a+1,i,e.elm_event_node_ref)}for(var p=t.e,g=e.childNodes,v=0;vi))return n;a=m}return n}function Rt(e,t,r,n){return 0===r.length?e:(kt(e,t,r,n),$t(e,r))}function $t(e,t){for(var r=0;r0){var o=a.substring(0,i),u=a.substring(i+2);t=l(Dh,o,function(e){return ya(Uh(e)?u+", "+e.a:u)},t)}}return t}function Kt(e,t,r){t.upload.addEventListener("progress",function(n){t.c||Be(f(Mh,e,L(r,qh({sent:n.loaded,size:n.total}))))}),t.addEventListener("progress",function(n){t.c||Be(f(Mh,e,L(r,jh({received:n.loaded,size:n.lengthComputable?ya(n.total):ma}))))})}function Ht(e,t){function r(){n=1===n?0:(aa(r),t(e),1)}t(e);var n=0;return function(a,i){e=a,i?(t(e),2===n&&(n=1)):(0===n&&aa(r),n=2)}}function jt(e){var t=e.onUrlChange,n=e.onUrlRequest,a=function(){a.a(t(qt()))};return na({setup:function(e){return a.a=e,sa.addEventListener("popstate",a),sa.navigator.userAgent.indexOf("Trident")<0||sa.addEventListener("hashchange",a),r(function(t,r){if(!r.ctrlKey&&!r.metaKey&&!r.shiftKey&&r.button<1&&!t.target&&!t.hasAttribute("download")){r.preventDefault();var a=t.href,i=qt(),o=Sg(a).a;e(n(o&&i.protocol===o.protocol&&i.host===o.host&&i.port_.a===o.port_.a?cg(o):sg(a)))}})},init:function(t){return l(e.init,t,qt(),a)},view:e.view,update:e.update,subscriptions:e.subscriptions})}function qt(){return Sg(Dn.location.href).a||N(1)}function Gt(e,t){return Ie(function(r){aa(function(){var n=document.getElementById(e);r(n?Te(t(n)):we(fg(e)))})})}function zt(e){return Ie(function(t){aa(function(){t(Te(e()))})})}function Yt(){return{scene:Wt(),viewport:{x:sa.pageXOffset,y:sa.pageYOffset,width:ua.documentElement.clientWidth,height:ua.documentElement.clientHeight}}}function Wt(){var e=ua.body,t=ua.documentElement;return{width:Math.max(e.scrollWidth,e.offsetWidth,t.scrollWidth,t.offsetWidth,t.clientWidth),height:Math.max(e.scrollHeight,e.offsetHeight,t.scrollHeight,t.offsetHeight,t.clientHeight)}}function Jt(e){return Gt(e,function(e){var t=e.getBoundingClientRect(),r=sa.pageXOffset,n=sa.pageYOffset;return{scene:Wt(),viewport:{x:r,y:n,width:ua.documentElement.clientWidth,height:ua.documentElement.clientHeight},element:{x:r+t.left,y:n+t.top,width:t.width,height:t.height}}})}function Qt(e){return f(dg,lg,Ie(function(t){try{sa.location=e}catch(e){Dn.location.reload(!1)}}))}function Xt(e){try{return ya(decodeURIComponent(e))}catch(e){return ma}}function Zt(){return f($a,tu(ws),f($a,is,Ts))}console.warn("Compiled in DEV mode. Follow the advice at https://elm-lang.org/0.19.0/optimize for better performance and smaller assets.");var er,tr,rr=[],nr=n(function(e,t,r){for(var n=new Array(e),a=0;a=0;n--)t=f(e,r[n],t);return t}),fr=(r(function(e,t){for(var r=t.length,n=new Array(r),a=0;ar.length&&(a=r.length);for(var i=n+a,o=new Array(i),u=0;u0}),r(function(e,t){return _(e,t)>=0}),r(function(e,t){var r=_(e,t);return r<0?Da:r?Fa:Pa})),vr={$:"#0"},yr=r(O),mr={$:"[]"},br=r(M),Cr=n(function(e,t,r){for(var n=[];t.b&&r.b;t=t.b,r=r.b)n.push(f(e,t.a,r.a));return F(n)}),Sr=(a(function(e,t,r,n){for(var a=[];t.b&&r.b&&n.b;t=t.b,r=r.b,n=n.b)a.push(l(e,t.a,r.a,n.a));return F(a)}),i(function(e,t,r,n,a){for(var i=[];t.b&&r.b&&n.b&&a.b;t=t.b,r=r.b,n=n.b,a=a.b)i.push(d(e,t.a,r.a,n.a,a.a));return F(i)}),o(function(e,t,r,n,a,i){for(var o=[];t.b&&r.b&&n.b&&a.b&&i.b;t=t.b,r=r.b,n=n.b,a=a.b,i=i.b)o.push(h(e,t.a,r.a,n.a,a.a,i.a));return F(o)}),r(function(e,t){return F(V(t).sort(function(t,r){return _(e(t),e(r))}))})),Er=r(function(e,t){return F(V(t).sort(function(t,r){var n=f(e,t,r);return n===Pa?0:n===Da?-1:1}))}),Tr=r(function(e,t){return e+t}),wr=r(function(e,t){return e-t}),Ir=r(function(e,t){return e*t}),Ar=(r(function(e,t){return e/t}),r(function(e,t){return e/t|0}),r(Math.pow)),Br=(r(function(e,t){return t%e}),r(function(e,t){var r=t%e;return 0===e?N(11):r>0&&e<0||r<0&&e>0?r+e:r})),kr=Math.PI,Nr=(Math.E,Math.cos),Rr=Math.sin,$r=(Math.tan,Math.acos,Math.asin,Math.atan,r(Math.atan2),Math.ceil),xr=Math.floor,_r=Math.round,Lr=(Math.sqrt,Math.log),Pr=(isNaN,r(function(e,t){return e&&t}),r(function(e,t){return e||t}),r(function(e,t){return e!==t}),r(function(e,t){return e+t})),Dr=r(function(e,t){return e+t}),Ur=(r(function(e,t){for(var r=t.length,n=new Array(r),a=0;a-1}),jr=r(function(e,t){return 0===t.indexOf(e)}),qr=r(function(e,t){return t.length>=e.length&&t.lastIndexOf(e)===t.length-e.length}),Gr=r(function(e,t){var r=e.length;if(r<1)return mr;for(var n=0,a=[];(n=t.indexOf(e,n))>-1;)a.push(n),n+=r;return F(a)}),zr=oe(function(e){return"number"!=typeof e?ge("an INT",e):-2147483647>e}),r(function(e,t){return t>>>e}),r(function(e,t){return Ie(function(r){r(Te(1===new Uint8Array(new Uint32Array([1]))[0]?e:t))})}),n(function(e,t,r){return e.setInt8(t,r),t+1})),wn=a(function(e,t,r,n){return e.setInt16(t,r,n),t+2}),In=a(function(e,t,r,n){return e.setInt32(t,r,n),t+4}),An=n(function(e,t,r){return e.setUint8(t,r),t+1}),Bn=a(function(e,t,r,n){return e.setUint16(t,r,n),t+2}),kn=a(function(e,t,r,n){return e.setUint32(t,r,n),t+4}),Nn=a(function(e,t,r,n){return e.setFloat32(t,r,n),t+4}),Rn=a(function(e,t,r,n){return e.setFloat64(t,r,n),t+8}),$n=n(function(e,t,r){for(var n=0,a=r.byteLength,i=a-4;n<=i;n+=4)e.setUint32(t+n,r.getUint32(n));for(;n>>6&31)<<8|63&a),2):a<55296||56319>>12&15)<<8|a>>>6&63),e.setUint8(t+2,128|63&a),3):(a=1024*(a-55296)+r.charCodeAt(++n)-56320+65536,e.setUint32(t,4034953344|(a>>>18&7)<<24|(a>>>12&63)<<16|(a>>>6&63)<<8|63&a),4)}return t}),_n=r(function(e,t){try{return ya(f(e,t,0).b)}catch(e){return ma}}),Ln=(r(function(e,t){return L(t+1,e.getInt8(t))}),n(function(e,t,r){return L(r+2,t.getInt16(r,e))}),n(function(e,t,r){return L(r+4,t.getInt32(r,e))}),r(function(e,t){return L(t+1,e.getUint8(t))})),Pn=(n(function(e,t,r){return L(r+2,t.getUint16(r,e))}),n(function(e,t,r){return L(r+4,t.getUint32(r,e))}),n(function(e,t,r){return L(r+4,t.getFloat32(r,e))}),n(function(e,t,r){return L(r+8,t.getFloat64(r,e))}),n(function(e,t,r){return L(r+e,new DataView(t.buffer,t.byteOffset+r,e))})),Dn=(n(function(e,t,r){for(var n="",a=r+e;r0;){var l=n[c];f[--c]=l?ya(l):ma}a.push(d(pd,n[0],n.index,i,F(f))),s=t.lastIndex}return t.lastIndex=u,F(a)}),a(function(e,t,r,n){function a(t){if(i++>=e)return t;for(var n=arguments.length-3,a=new Array(n);n>0;){var o=arguments[n];a[--n]=o?ya(o):ma}return r(d(pd,t,arguments[arguments.length-2],i,F(a)))}var i=0;return n.replace(t,a)}),n(function(e,t,r){for(var n=r,a=[],i=t.lastIndex,o=t.lastIndex;e--;){var u=t.exec(n);if(!u)break;a.push(n.slice(i,u.index)),i=t.lastIndex}return a.push(n.slice(i)),t.lastIndex=o,F(a)}),n(function(e,t,r){return Ie(function(n){function a(e){n(t(r.expect.a(e)))}var i=new XMLHttpRequest;i.addEventListener("error",function(){a(Hh)}),i.addEventListener("timeout",function(){a(Gh)}),i.addEventListener("load",function(){a(Mt(r.expect.b,i))}),Uh(r.tracker)&&Kt(e,i,r.tracker.a);try{i.open(r.method,r.url,!0)}catch(e){return a(Vh(r.url))}return Ot(i,r),r.body.a&&i.setRequestHeader("Content-Type",r.body.a),i.send(r.body.b),function(){i.c=!0,i.abort()}})})),ta=n(function(e,t,r){return{$:0,d:e,b:t,a:r}}),ra=(r(function(e,t){return{$:0,d:t.d,b:t.b,a:function(r){return e(t.a(r))}}}),r(function(e,t){return{$:0,a:e,b:t}})),na=(r(function(e,t){return new Blob([t],{type:e})}),a(function(e,t,r,n){return Le(t,n,e.init,e.update,e.subscriptions,function(t,r){var a=e.view,i=n&&n.node?n.node:N(0),o=Dt(i);return Ht(r,function(e){var r=a(e),n=mt(o,r);i=Rt(i,o,n,t),o=r})})}),a(function(e,t,r,n){return Le(t,n,e.init,e.update,e.subscriptions,function(t,r){var n=e.setup&&e.setup(t),a=e.view,i=Dn.title,o=Dn.body,u=Dt(o);return Ht(r,function(e){er=n;var r=a(e),s=On("body")(mr)(r.body),c=mt(u,s);o=Rt(o,u,c,t),u=s,er=0,i!==r.title&&(Dn.title=i=r.title)})})})),aa=("undefined"!=typeof cancelAnimationFrame&&cancelAnimationFrame,"undefined"!=typeof requestAnimationFrame?requestAnimationFrame:function(e){return setTimeout(e,1e3/60)}),ia=(r(function(e,t){return f(dg,lg,Ie(function(){t&&history.go(t),e()}))}),r(function(e,t){return f(dg,lg,Ie(function(){history.pushState({},"",t),e()}))})),oa=(r(function(e,t){return f(dg,lg,Ie(function(){history.replaceState({},"",t),e()}))}),{addEventListener:function(){},removeEventListener:function(){}}),ua="undefined"!=typeof document?document:oa,sa="undefined"!=typeof window?window:oa,ca=(n(function(e,t,r){return ke(Ie(function(n){function a(e){Be(r(e))}return e.addEventListener(t,a,tr&&{passive:!0}),function(){e.removeEventListener(t,a)}}))}),r(function(e,t){var r=le(e,t);return Ai(r)?ya(r.a):ma}),r(function(e,t){return Gt(t,function(t){return t[e](),vr})}),r(function(e,t){return zt(function(){return sa.scroll(e,t),vr})})),fa=(n(function(e,t,r){return Gt(e,function(e){return e.scrollLeft=t,e.scrollTop=r,vr})}),r(function(e,t){return Ie(function(r){var n=setInterval(function(){Be(t)},e);return function(){clearInterval(n)}})})),la=function(e){return{$:"Native",a:e}},da={$:"XDai"},ha={$:"EthDai"},pa={$:"KovanDai"},ga=function(e){return{$:"Token",a:e}},va=r(function(e,t){return e(t)}),ya=function(e){return{$:"Just",a:e}},ma={$:"Nothing"},ba=function(e){e:for(;;)switch(e.$){case"Mainnet":return ya(ga(ha));case"Kovan":return ya(ga(pa));case"Private":if(100===e.a)return ya(la(da));break e;default:break e}return ma},Ca={$:"ETCMain"},Sa={$:"ETCTest"},Ea={$:"Expanse"},Ta={$:"Kovan"},wa={$:"Mainnet"},Ia=function(e){return{$:"Private",a:e}},Aa={$:"Rinkeby"},Ba={$:"Ropsten"},ka={$:"RskMain"},Na={$:"RskTest"},Ra=function(e){switch(e){case 1:return wa;case 2:return Ea;case 3:return Ba;case 4:return Aa;case 30:return ka;case 31:return Na;case 42:return Ta;case 41:return Ca;case 62:return Sa;default:return Ia(e)}},$a=n(function(e,t,r){return t(e(r))}),xa=f($a,Ra,ba),_a=n(function(e,t,r){return{factoryType:e,httpProvider:t,wsProvider:r}}),La=function(e){if("Token"===e.$){if("EthDai"===e.a.$){e.a;return l(_a,e,"https://mainnet.infura.io/v3/e3eef0e2435349bf9164e6f465bd7cf9","wss://mainnet.infura.io/ws")}e.a;return l(_a,e,"https://kovan.infura.io/v3/e3eef0e2435349bf9164e6f465bd7cf9","wss://kovan.infura.io/ws")}switch(e.a.$){case"Eth":e.a;return l(_a,e,"https://mainnet.infura.io/v3/e3eef0e2435349bf9164e6f465bd7cf9","wss://mainnet.infura.io/ws");case"Kovan":e.a;return l(_a,e,"https://kovan.infura.io/v3/e3eef0e2435349bf9164e6f465bd7cf9","wss://kovan.infura.io/ws");default:e.a;return l(_a,e,"https://dai.poa.network","")}},Pa={$:"EQ"},Da={$:"LT"},Ua=cr,Oa=n(function(e,t,n){var a=n.c,i=n.d,o=r(function(t,r){if("SubTree"===t.$){var n=t.a;return l(Ua,o,r,n)}var a=t.a;return l(Ua,e,r,a)});return l(Ua,o,l(Ua,e,t,i),a)}),Ma=function(e){return l(Oa,qa,mr,e)},Fa={$:"GT"},Va=n(function(e,t,r){for(;;){if("RBEmpty_elm_builtin"===r.$)return t;var n=r.b,a=r.c,i=r.d,o=r.e,u=e,s=l(e,n,a,l(Va,e,t,o)),c=i;e=u,t=s,r=c}}),Ka=function(e){return l(Va,n(function(e,t,r){return f(qa,L(e,t),r)}),mr,e)},Ha=function(e){return l(Va,n(function(e,t,r){return f(qa,e,r)}),mr,e)},ja=function(e){var t=e.a;return Ha(t)},qa=br,Ga=Tr,za=n(function(e,t,r){for(;;){if(!r.b)return t;var n=r.a,a=r.b,i=e,o=f(e,n,t),u=a;e=i,t=o,r=u}}),Ya=function(e){return l(za,qa,mr,e)},Wa=a(function(e,t,r,n){if(n.b){var a=n.a,i=n.b;if(i.b){var o=i.a,u=i.b;if(u.b){var s=u.a,c=u.b;if(c.b){var h=c.a,p=c.b;return f(e,a,f(e,o,f(e,s,f(e,h,r>500?l(za,e,t,Ya(p)):d(Wa,e,t,r+1,p)))))}return f(e,a,f(e,o,f(e,s,t)))}return f(e,a,f(e,o,t))}return f(e,a,t)}return t}),Ja=n(function(e,t,r){return d(Wa,e,t,0,r)}),Qa=r(function(e,t){return t.b?l(Ja,qa,t,e):e}),Xa=r(function(e,t){return U(t,{userNotices:f(Qa,t.userNotices,F([e]))})}),Za=r(function(e,t){return l(za,Xa,t,e)}),ei=a(function(e,t,r,n){return{$:"Array_elm_builtin",a:e,b:t,c:r,d:n}}),ti=$r,ri=r(function(e,t){return Lr(t)/Lr(e)}),ni=K,ai=ti(f(ri,2,32)),ii=rr,oi=d(ei,0,ai,ii,ii),ui=function(e){return{$:"Leaf",a:e}},si=function(e){return{$:"SubTree",a:e}},ci=ar,fi=r(function(e,t){for(;;){var r=f(ci,32,e),n=r.a,a=r.b,i=f(qa,si(n),t);if(!a.b)return Ya(i);var o=a,u=i;e=o,t=u}}),li=r(function(e,t){return t(e)}),di=hr,hi=function(e){return e.a},pi=r(function(e,t){for(;;){var r=ti(t/32);if(1===r)return f(ci,32,e).a;var n=f(fi,e,mr),a=r;e=n,t=a}}),gi=xr,vi=r(function(e,t){return _(e,t)>0?e:t}),yi=Ir,mi=wr,bi=m,Ci=r(function(e,t){if(t.nodeListSize){var r=32*t.nodeListSize,n=gi(f(ri,32,r-1)),a=e?Ya(t.nodeList):t.nodeList,i=f(pi,a,t.nodeListSize);return d(ei,bi(t.tail)+r,f(vi,5,n*ai),i,t.tail)}return d(ei,bi(t.tail),ai,ii,t.tail)}),Si=nr,Ei=i(function(e,t,r,n,a){for(;;){if(t<0)return f(Ci,!1,{nodeList:n,nodeListSize:r/32|0,tail:a});var i=ui(l(Si,32,t,e)),o=e,u=t-32,s=r,c=f(qa,i,n),d=a;e=o,t=u,r=s,n=c,a=d}}),Ti=r(function(e,t){if(e<=0)return oi;var r=e%32,n=l(Si,r,e-r,t);return h(Ei,t,e-r-32,e,mr,n)}),wi=function(e){return{$:"Err",a:e}},Ii=function(e){return{$:"Ok",a:e}},Ai=function(e){return"Ok"===e.$},Bi=r(function(e,t){return{$:"Failure",a:e,b:t}}),ki=r(function(e,t){return{$:"Field",a:e,b:t}}),Ni=r(function(e,t){return{$:"Index",a:e,b:t}}),Ri=function(e){return{$:"OneOf",a:e}},$i=yr,xi=j,_i=function(e){var t=xi(e);return 97<=t&&t<=122},Li=function(e){var t=xi(e);return t<=90&&65<=t},Pi=function(e){return _i(e)||Li(e)},Di=function(e){var t=xi(e);return t<=57&&48<=t},Ui=function(e){return _i(e)||Li(e)||Di(e)},Oi=function(e){return l(za,r(function(e,t){return t+1}),0,e)},Mi=Cr,Fi=n(function(e,t,r){for(;;){if(!(_(e,t)<1))return r;var n=e,a=t-1,i=f(qa,t,r);e=n,t=a,r=i}}),Vi=r(function(e,t){return l(Fi,e,t,mr)}),Ki=r(function(e,t){return l(Mi,e,f(Vi,0,Oi(t)-1),t)}),Hi=Kr,ji=Z,qi=r(function(e,t){return f(Fr,e,V(t))}),Gi=z,zi=r(function(e,t){return F(f(Mr,e,t))}),Yi=function(e){return f(qi,"\n ",f(zi,"\n",e))},Wi=on,Ji=r(function(e,t){return"\n\n("+ji(e+1)+") "+Yi(Qi(t))}),Qi=function(e){return f(Xi,e,mr)},Xi=r(function(e,t){e:for(;;)switch(e.$){case"Field":var r=e.a,n=e.b,a=function(){var e=Gi(r);if("Nothing"===e.$)return!1;var t=e.a,n=t.a,a=t.b;return Pi(n)&&f(Hi,Ui,a)}(),i=a?"."+r:"['"+r+"']",o=n,u=f(qa,i,t);e=o,t=u;continue e;case"Index":var s=e.a,n=e.b,c="["+ji(s)+"]",o=n,u=f(qa,c,t);e=o,t=u;continue e;case"OneOf":var l=e.a;if(l.b){if(l.b.b){var d=function(){return t.b?"The Json.Decode.oneOf at json"+f(qi,"",Ya(t)):"Json.Decode.oneOf"}(),h=d+" failed in the following "+ji(Oi(l))+" ways:";return f(qi,"\n\n",f(qa,h,f(Ki,Ji,l)))}var n=l.a,o=n,u=t;e=o,t=u;continue e}return"Ran into a Json.Decode.oneOf with no possibilities"+function(){return t.b?" at json"+f(qi,"",Ya(t)):"!"}();default:var p=e.a,g=e.b,h=function(){return t.b?"Problem with the value at json"+f(qi,"",Ya(t))+":\n\n ":"Problem with the given value:\n\n"}();return h+(Yi(f(Wi,4,g))+"\n\n")+p}}),Zi=Wr,eo=ze("txIn",Zi),to=function(e){return e},ro=qe("txOut",to),no={$:"Open"},ao=Me,io=ao(mr),oo=a(function(e,t,r,n){return L({agentAddress:t,agentRole:r,userInfo:n,viewPhase:no,web3Context:e},io)}),uo=a(function(e,t,r,n){return{appCmds:n,chainCmd:r,cmd:t,model:e}}),so={$:"None"},co=so,fo=function(e){return d(uo,e,io,co,mr)},lo=function(e){return{$:"GotoRoute",a:e}},ho=function(e){return{$:"AbiDecoder",a:e}},po=r(function(e,t){return{$:"Tape",a:e,b:t}}),go=Y,vo=Vr,yo=r(function(e,t){return e<1?t:l(vo,e,go(t),t)}),mo=yo(64),bo=n(function(e,t,r){return L(f(po,e,mo(t)),r)}),Co=r(function(e,t){return e<1?"":l(vo,0,e,t)}),So=Co(64),Eo=r(function(e,t){if("Ok"===t.$){var r=t.a;return Ii(e(r))}var n=t.a;return wi(n)}),To=function(e){return-e},wo=r(function(e,t){return e<1?"":l(vo,-e,go(t),t)}),Io=function(){var e=function(e){if(!f(Hi,di(D("0")),f(Co,63,e)))return wi("Boolean decode error. "+e+" is not 1 or 0.");switch(f(wo,1,e)){case"0":return Ii(!1);case"1":return Ii(!0);default:return wi("Boolean decode error. "+e+" is not 1 or 0.")}};return ho(function(t){var r=t.a,n=t.b;return f(Eo,f(bo,r,n),e(So(n)))})}(),Ao=jr,Bo=function(e){return f(Ao,"0x",e)||f(Ao,"0X",e)?f(yo,2,e):e},ko=function(e){return e.b},No=r(function(e,t){var r=e.a;return f(Eo,ko,r(function(e){return f(po,e,e)}(Bo(t))))}),Ro=Zr,$o=ie,xo=Jr,_o=ae,Lo=function(e){return f(Ro,function(t){var r=e(t);if("Ok"===r.$){var n=r.a;return _o(n)}var a=r.a;return $o(a)},xo)},Po=f($a,No,Lo),Do=function(e){return{$:"Magnitude",a:e}},Uo=function(e){return{$:"Pos",a:e}},Oo=r(function(e,t){return{$:"BigIntNotNormalised",a:e,b:t}}),Mo=function(e){return{$:"MagnitudeNotNormalised",a:e}},Fo=function(e){e:for(;;){if(e.b){if(e.b.b){var t=e.b,r=t;e=r;continue e}var n=e.a;return ya(n)}return ma}},Vo=function(e){var t=Fo(e);return"Nothing"!==t.$&&t.a<0},Ko=function(e){return{$:"Neg",a:e}},Ho={$:"Zer"},jo=function(e){return!e.b},qo=r(function(e,t){var r=t.a;if(jo(r))return Ho;switch(e.$){case"Zero":return Ho;case"Positive":return Uo(t);default:return Ko(t)}}),Go=r(function(e,t){return f(Oo,e,Mo(t))}),zo=function(e){return f(Ja,r(function(t,r){return e(t)&&jo(r)?mr:f(qa,t,r)}),mr)}(di(0)),Yo=Ar,Wo=-1+f(Yo,10,7),Jo=Wo+1,Qo=r(function(e,t){var r=t.a,n=t.b;return L(e(r),n)}),Xo=function(e){return e<0?f(Qo,Ga(-1),Xo(e+Jo)):L(e/Jo|0,e%Jo)},Zo=r(function(e,t){for(;;){if(t.b){var r=t.a,n=t.b,a=Xo(r+e),i=a.a,o=a.b;return f(qa,o,f(Zo,i,n))}{if(!(_(e,Jo)>0))return F([e]);var u=F([e]);e=0,t=u}}}),eu=function(e){var t=e.a;return Do(zo(f(Zo,0,t)))},tu=r(function(e,t){return l(Ja,r(function(t,r){return f(qa,e(t),r)}),mr,t)}),ru=tu(To),nu={$:"Negative"},au={$:"Positive"},iu={$:"Zero"},ou=function(e){switch(e.$){case"Positive":return nu;case"Negative":return au;default:return iu}},uu=function(e){for(;;){var t=e.a,r=e.b,n=eu(r),a=n.a;if(!Vo(a))return f(qo,t,Do(a));e=f(Go,ou(t),ru(a))}},su=gr,cu=function(e){switch(f(su,e,0).$){case"LT":return nu;case"GT":return au;default:return iu}},fu=function(e){return e<0?-e:e},lu=function(e){return uu(f(Oo,cu(e),Mo(F([fu(e)]))))},du=function(e){e:for(;;)switch(e.$){case"Zer":return 0;case"Pos":if(e.a.a.b){if(e.a.a.b.b){if(e.a.a.b.b.b)break e;var t=e.a.a,r=t.a,n=t.b,a=n.a;return a*f(Yo,10,7)+r}var i=e.a.a,r=i.a;return r}break e;default:break e}return 42},hu=function(e){switch(e.$){case"Zer":return Ho;case"Neg":var t=e.a;return Uo(t);default:return e}},pu=function(e){return{$:"MagnitudePair",a:e}},gu=r(function(e,t){var r=L(e,t);if(r.a.b){if(r.b.b){var n=r.a,a=n.a,i=n.b,o=r.b,u=o.a,s=o.b;return f(qa,L(a,u),f(gu,i,s))}var c=r.a,a=c.a,i=c.b;return f(qa,L(a,0),f(gu,i,mr))}if(r.b.b){var l=r.b,u=l.a,s=l.b;return f(qa,L(0,u),f(gu,mr,s))}return mr}),vu=r(function(e,t){var r=e.a,n=t.a;return pu(f(gu,r,n))}),yu=function(e){switch(e.$){case"Zer":return f(Go,iu,mr);case"Neg":var t=e.a.a;return f(Go,au,ru(t));default:var t=e.a.a;return f(Go,au,t)}},mu=r(function(e,t){var r=yu(t),n=r.b,a=yu(e),i=a.b,o=f(vu,i,n),u=o.a,s=f(tu,function(e){return e.a+e.b},u);return uu(f(Oo,au,Mo(s)))}),bu=a(function(e,t,r,n){e:for(;;){var a=L(r,n);if(a.a.b){if(a.b.b){var i=a.a,o=i.a,u=i.b,s=a.b,c=s.a,l=s.b;if($(o,c)){var d=e,h=t,p=u,g=l;e=d,t=h,r=p,n=g;continue e}var d=o,h=c,p=u,g=l;e=d,t=h,r=p,n=g;continue e}return Fa}return a.b.b?Da:f(su,e,t)}}),Cu=function(e){switch(e.$){case"LT":return Fa;case"EQ":return Pa;default:return Da}},Su=r(function(e,t){var r=L(e,t);switch(r.a.$){case"Pos":if("Pos"===r.b.$){var n=r.a.a.a,a=r.b.a.a;return d(bu,0,0,n,a)}return Fa;case"Neg":if("Neg"===r.b.$){var n=r.a.a.a,a=r.b.a.a;return Cu(d(bu,0,0,n,a))}return Da;default:switch(r.b.$){case"Pos":r.a;return Da;case"Zer":r.a,r.b;return Pa;default:r.a;return Fa}}}),Eu=r(function(e,t){return $(f(Su,e,t),Fa)}),Tu=H,wu=r(function(e,t){return!f(Eu,e,t)}),Iu=function(e){switch(e.$){case"Zer":return Do(mr);case"Pos":default:var t=e.a;return t}},Au=r(function(e,t){var r=e.a;return eu(Mo(f(tu,yi(t),r)))}),Bu=r(function(e,t){var r=e.a,n=t.a;if(r.b){if(r.b.b){var a=r.a,i=r.b,o=f(Au,Do(n),a),u=f(Bu,Do(i),Do(n)),s=u.a,c=f(mu,f(qo,au,o),f(qo,au,Do(f(qa,0,s))));return Iu(c)}var a=r.a;return f(Au,Do(n),a)}return Do(mr)}),ku=function(e){switch(e.$){case"Zer":return iu;case"Pos":return au;default:return nu}},Nu=r(function(e,t){return $(e,iu)||$(t,iu)?iu:$(e,t)?au:nu}),Ru=r(function(e,t){return f(qo,f(Nu,ku(e),ku(t)),f(Bu,Iu(e),Iu(t)))}),$u=function(e){switch(e.$){case"Zer":return Ho;case"Pos":var t=e.a;return Ko(t);default:var t=e.a;return Uo(t)}},xu=r(function(e,t){return f(mu,e,$u(t))}),_u=lu(0),Lu=a(function(e,t,r,n){if(e){var a=lu(e),i=f(Ru,f(Ru,a,n),t),o=f(wu,i,r)?L(f(Ru,a,t),f(xu,r,i)):L(_u,r),u=o.a,s=o.b,c=d(Lu,e/2|0,t,s,n),l=c.a,h=c.b;return L(f(mu,u,l),h)}return L(_u,r)}),Pu=ti(f(ri,2,Wo)),Du=n(function(e,t,r){return d(Lu,f(Yo,2,Pu),e,t,r)}),Uu=lu(1),Ou=r(function(e,t){return e}),Mu=n(function(e,t,r){return l(za,Ou(e),t,f(Vi,1,r))}),Fu=function(e){return l(Mu,Ru(lu(Jo)),Uu,e)},Vu=n(function(e,t,r){if(e){var n=l(Du,Fu(e),t,r),a=n.a,i=n.b,o=l(Vu,e-1,i,r),u=o.a,s=o.b;return L(f(mu,a,u),s)}return l(Du,Fu(e),t,r)}),Ku=function(e){switch(e.$){case"Zer":return mr;case"Pos":default:var t=e.a.a;return t}},Hu=r(function(e,t){if($(t,_u))return ma;var r=Oi(Ku(e))-Oi(Ku(t))+1,n=l(Vu,f(vi,0,r),hu(e),hu(t)),a=n.a,i=n.b;return ya(L(f(qo,f(Nu,ku(e),ku(t)),Iu(a)),f(qo,ku(e),Iu(i))))}),ju=f(Ru,lu(2),lu(2147483648)),qu=Pr,Gu=function(e){return f(qu,e,"")},zu=Sn,Yu=n(function(e,t,r){return e<=0?r:l(Yu,e>>1,O(t,t),1&e?O(r,t):r)}),Wu=r(function(e,t){return l(Yu,e,t,"")}),Ju=n(function(e,t,r){return O(f(Wu,e-go(r),Gu(t)),r)}),Qu=re,Xu=Br,Zu=function(e){e:for(;;)switch(e){case 0:return D("0");case 1:return D("1");case 2:return D("2");case 3:return D("3");case 4:return D("4");case 5:return D("5");case 6:return D("6");case 7:return D("7");case 8:return D("8");case 9:return D("9");case 10:return D("a");case 11:return D("b");case 12:return D("c");case 13:return D("d");case 14:return D("e");case 15:return D("f");default:var t=e;e=t;continue e}},es=r(function(e,t){for(;;){if(t<16)return f(qa,Zu(t),e);var r=f(qa,Zu(f(Xu,16,t)),e),n=t/16|0;e=r,t=n}}),ts=function(e){return Qu(e<0?f(qa,D("-"),f(es,mr,-e)):f(es,mr,e))},rs=function(e){var t=f(Hu,e,ju);if("Nothing"===t.$)return"Failure converting BigInt to hex string. Should be impossible. Open up issue on the elm-bigint repo.";var r=t.a,n=r.a,a=r.b,i=ts(du(a));return $(n,lu(0))?i:O(rs(n),l(Ju,8,D("0"),i))},ns=function(e){switch(e.$){case"Zer":return"0";case"Pos":var t=e.a;return $(t,Do(mr))?"0":rs(Uo(t));default:var t=e.a;return"-"+ns(f(Ru,lu(-1),e))}},as=function(e){return l(Ju,64,D("0"),e)},is=function(e){var t=r(function(e,t){var r=e.a,n=e.b,a=t.a,i=t.b,o=t.c;if("Just"===r.$){var u=r.a,s=as(ts(a)),c=function(e){return O(e,n)}(as(ts(u)));return P(a+32+(go(n)/2|0),O(i,s),O(o,c))}return P(a,O(i,n),o)});return function(e){return O(e.b,e.c)}(l(za,t,P(32*Oi(e),"",""),e))},os=Ur,us=n(function(e,t,r){return t<128?f(e,t,r):t<2048?f(e,128|63&t,f(e,192|t>>>6,r)):t<65536?f(e,128|63&t,f(e,128|63&t>>>6,f(e,224|t>>>12,r))):f(e,128|63&t,f(e,128|63&t>>>6,f(e,128|63&t>>>12,f(e,240|t>>>18,r))))}),ss=n(function(e,t,n){return l(os,r(function(t,r){return l(us,e,xi(t),r)}),t,n)}),cs=function(e){return Ya(l(ss,qa,mr,e))},fs=function(e){return f(qi,"",f(tu,f($a,ts,f(Ju,2,D("0"))),cs(e)))},ls=function(e){return 64-f(Xu,64,e)},ds=function(e){return O(e,f(Wu,ls(go(e)),"0"))},hs=function(e){return L(ya(go(e)/2|0),ds(e))},ps=function(e){return L(ma,as(e))},gs=function(e){switch(e){case"0000":return D("0");case"0001":return D("1");case"0010":return D("2");case"0011":return D("3");case"0100":return D("4");case"0101":return D("5");case"0110":return D("6");case"0111":return D("7");case"1000":return D("8");case"1001":return D("9");case"1010":return D("a");case"1011":return D("b");case"1100":return D("c");case"1101":return D("d");case"1110":return D("e");case"1111":return D("f");default:return D("!")}},vs=function(e){switch(e.valueOf()){case"0":return"0000";case"1":return"0001";case"2":return"0010";case"3":return"0011";case"4":return"0100";case"5":return"0101";case"6":return"0110";case"7":return"0111";case"8":return"1000";case"9":return"1001";case"a":return"1010";case"b":return"1011";case"c":return"1100";case"d":return"1101";case"e":return"1110";case"f":return"1111";default:return"error converting hex to binary"}},ys=Or,ms=function(e){var t=r(function(e,t){var r=t.a,n=t.b,a=L(e,n);e:for(;;)if(a.b)switch(a.a.valueOf()){case"0":return L(f(qu,D("1"),r),!0);case"1":return L(f(qu,D("0"),r),!0);default:break e}else switch(a.a.valueOf()){case"0":return L(f(qu,D("0"),r),!1);case"1":return L(f(qu,D("1"),r),!0);default:break e}return L(r,!0)});return l(ys,t,L("",!1),e).a},bs=function(e){return l(ys,qa,mr,e)},Cs=n(function(e,t,r){for(;;){if(""===t)return Ya(r);var n=e,a=f(yo,e,t),i=f(qa,l(vo,0,e,t),r);e=n,t=a,r=i}}),Ss=r(function(e,t){return e&&""!==t?l(Cs,e,t,mr):F([t])}),Es=function(e){var t=function(){var t=bs(ns(e));if(t.b&&"-"===t.a.valueOf()){var r=t.b;return L(r,f($a,ms,f(Ju,256,D("1"))))}var r=t;return L(r,f(Ju,256,D("0")))}(),r=t.a,n=t.b;return Qu(f(tu,gs,f(Ss,4,n(f(qi,"",f(tu,vs,r))))))},Ts=function(e){return{$:"Hex",a:e}},ws=function(e){switch(e.$){case"AddressE":var t=e.a.a;return ps(t);case"UintE":var r=e.a;return ps(ns(r));case"IntE":var n=e.a;return ps(Es(n));case"BoolE":return ps(e.a?"1":"0");case"DBytesE":var a=e.a.a;return hs(a);case"BytesE":var a=e.a.a;return ps(Bo(a));case"StringE":var i=e.a;return hs(fs(i));case"ListE":var o=e.a;return function(e){var t=e.a;return hs(t)}(Zt()(o));default:var i=e.a;return ps(Bo(i))}};try{var Is=Zt();Zt=function(){return Is}}catch(e){throw"Some top-level definitions from `Abi.Encode` are causing infinite recursion:\n\n ┌─────┐\n │ abiEncodeList\n │ ↓\n │ lowLevelEncode\n └─────┘\n\nThese errors are very tricky, so read https://elm-lang.org/0.19.0/halting-problem to learn how to fix it!"}var As=Dr,Bs=function(e){return 1===go(e)?f(As,"0",e):e},ks=n(function(e,t,r){for(;;){if(e<=0)return r;{if(!t.b)return r;var n=t.a,a=t.b,i=e-1,o=a,u=f(qa,n,r);e=i,t=o,r=u}}}),Ns=r(function(e,t){return Ya(l(ks,e,t,mr))}),Rs=n(function(e,t,r){if(t<=0)return mr;var n=L(t,r);e:for(;;){t:for(;;){if(!n.b.b)return r;if(!n.b.b.b){if(1===n.a)break e;break t}switch(n.a){case 1:break e;case 2:var a=n.b,i=a.a,o=a.b,u=o.a;return F([i,u]);case 3:if(n.b.b.b.b){var s=n.b,i=s.a,c=s.b,u=c.a,d=c.b,h=d.a;return F([i,u,h])}break t;default:if(n.b.b.b.b&&n.b.b.b.b.b){var p=n.b,i=p.a,g=p.b,u=g.a,v=g.b,h=v.a,y=v.b,m=y.a,b=y.b;return e>1e3?f(qa,i,f(qa,u,f(qa,h,f(qa,m,f(Ns,t-4,b))))):f(qa,i,f(qa,u,f(qa,h,f(qa,m,l(Rs,e+1,t-4,b)))))}break t}}return r}var C=n.b,i=C.a;return F([i])}),$s=r(function(e,t){return l(Rs,0,e,t)}),xs=function(e){return{$:"KC",a:e}}({capacity:512,delSuffix:1,outputLen:32,rate:1088}),_s=function(e){switch(e.$){case"I8":return 1;case"I16":return 2;case"I32":return 4;case"U8":return 1;case"U16":return 2;case"U32":case"F32":return 4;case"F64":return 8;case"Seq":case"Utf8":var t=e.a;return t;default:return Qe(e.a)}},Ls={$:"LE"},Ps=n(function(e,t,r){switch(e.$){case"I8":var n=e.a;return l(Tn,t,r,n);case"I16":var a=e.a,n=e.b;return d(wn,t,r,n,$(a,Ls));case"I32":var a=e.a,n=e.b;return d(In,t,r,n,$(a,Ls));case"U8":var n=e.a;return l(An,t,r,n);case"U16":var a=e.a,n=e.b;return d(Bn,t,r,n,$(a,Ls));case"U32":var a=e.a,n=e.b;return d(kn,t,r,n,$(a,Ls));case"F32":var a=e.a,n=e.b;return d(Nn,t,r,n,$(a,Ls));case"F64":var a=e.a,n=e.b;return d(Rn,t,r,n,$(a,Ls));case"Seq":var i=e.b;return l(Ds,i,t,r);case"Utf8":var o=e.b;return l(xn,t,r,o);default:var i=e.a;return l($n,t,r,i)}}),Ds=n(function(e,t,r){for(;;){if(!e.b)return r;var n=e.a,a=e.b,i=a,o=t,u=l(Ps,n,t,r);e=i,t=o,r=u}}),Us=Xe,Os=r(function(e,t){return{$:"Seq",a:e,b:t}}),Ms=r(function(e,t){for(;;){if(!t.b)return e;var r=t.a,n=t.b,a=e+_s(r),i=n;e=a,t=i}}),Fs=function(e){return f(Os,f(Ms,0,e),e)},Vs=function(e){return{$:"U8",a:e}},Ks=Vs,Hs=r(function(e,t){return _(e,t)<0?e:t}),js=pr,qs=function(e){return{$:"Bytes",a:e}},Gs=qs,zs=function(e){return Us(Fs(f(tu,Gs,Ya(e))))},Ys=Qe,Ws=r(function(e,t){var r=e.a;return f(_n,r,t)}),Js=function(e){return{$:"Decoder",a:e}},Qs=a(function(e,t,r,n){for(;;){var a=t(e),i=a.a,o=f(i,r,n),u=o.a,s=o.b;if("Loop"!==s.$){return L(u,s.a)}var c=s.a,l=c,d=t,h=r,p=u;e=l,t=d,r=h,n=p}}),Xs=r(function(e,t){return Js(f(Qs,e,t))}),Zs=Js(Ln),ec=r(function(e,t){if("Just"===t.$){return t.a}return e}),tc=function(e){return{$:"Done",a:e}},rc=function(e){return{$:"Loop",a:e}},nc=r(function(e,t){var n=t.a;return Js(r(function(t,r){var a=f(n,t,r),i=a.a,o=a.b;return L(i,e(o))}))}),ac=function(e){return Js(r(function(t,r){return L(r,e)}))},ic=r(function(e,t){var r=t.a,n=t.b;return r<=0?ac(tc(Ya(n))):f(nc,function(e){return rc(L(r-1,f(qa,e,n)))},e)}),oc=function(e){return f(ec,mr,f(Ws,f(Xs,L(Ys(e),mr),ic(Zs)),e))},uc=n(function(e,t,r){var n=t.a,a=t.b,i=r.a,o=r.b;return L(f(e,n,i),f(e,a,o))}),sc=r(function(e,t){return l(uc,zu,e,t)}),cc=f(Vi,0,4),fc=r(function(e,t){var r=t.d0,n=t.d1,a=t.d2,i=t.d3,o=t.d4;switch(e){case 0:return r;case 1:return n;case 2:return a;case 3:return i;default:return o}}),lc=Je,dc=r(function(e,t){var r=t.a,n=t.b;return L(e(r),e(n))}),hc=function(e){return f(dc,f($a,lc,zu(4294967295)),e)},pc=r(function(e,t){return 5*t+e}),gc=4294967295>>>32-ai,vc=ir,yc=n(function(e,t,r){for(;;){var n=gc&t>>>e,a=f(vc,n,r);if("SubTree"!==a.$){var i=a.a;return f(vc,gc&t,i)}var o=a.a,u=e-ai,s=t,c=o;e=u,t=s,r=c}}),mc=function(e){return e>>>5<<5},bc=r(function(e,t){var r=t.a,n=t.b,a=t.c,i=t.d;return e<0||_(e,r)>-1?ma:ya(_(e,mc(r))>-1?f(vc,gc&e,i):l(yc,n,e,a))}),Cc=r(function(e,t){var r=f(bc,e,t);if("Just"===r.$){return r.a}return L(0,0)}),Sc=n(function(e,t,r){var n=f(pc,e,t);return f(Cc,n,r)}),Ec=or,Tc=a(function(e,t,r,n){var a=gc&t>>>e,i=f(vc,a,n);if("SubTree"===i.$){var o=i.a,u=d(Tc,e-ai,t,r,o);return l(Ec,a,si(u),n)}var s=i.a,c=l(Ec,gc&t,r,s);return l(Ec,a,ui(c),n)}),wc=n(function(e,t,r){var n=r.a,a=r.b,i=r.c,o=r.d;return e<0||_(e,n)>-1?r:_(e,mc(n))>-1?d(ei,n,a,i,l(Ec,gc&e,t,o)):d(ei,n,a,d(Tc,a,e,t,i),o)}),Ic=n(function(e,t,r){return l(wc,e,t,r)}),Ac=a(function(e,t,r,n){var a=f(pc,e,t);return l(Ic,a,r,n)}),Bc=En,kc=r(function(e,t){return l(uc,Bc,e,t)}),Nc=function(e){var t=l(Ja,r(function(t,n){var a={d0:l(Sc,0,t,e.state),d1:l(Sc,1,t,e.state),d2:l(Sc,2,t,e.state),d3:l(Sc,3,t,e.state),d4:l(Sc,4,t,e.state)},i=r(function(e,r){return d(Ac,e,t,f(kc,f(fc,e,a),f(sc,hc(f(fc,f(Xu,5,e+1),a)),f(fc,f(Xu,5,e+2),a))),r)});return f(i,4,f(i,3,f(i,2,f(i,1,f(i,0,n)))))}),e.state,cc);return U(e,{state:t})},Rc=L(0,0),$c=function(e){return{current:Rc,lfsrstate:1,state:e,x:1,y:0}},xc=function(e){var t=1&e;return 128&e?L(t,e<<1^113):L(t,e<<1)},_c=L(1,0),Lc=r(function(e,t){var r=t.a,n=t.b;return e?L(n,r):L(r,n)}),Pc=r(function(e,t){if(e){var n=f(Lc,1,t);return l(uc,r(function(t,r){return 4294967295&(t<>>32-e)}),t,n)}return t}),Dc=r(function(e,t){var r=f(Xu,32,e/32|0),n=f(Lc,r,t),a=f(Xu,32,e);return f(Pc,a,n)}),Uc=n(function(e,t,r){var n=f(bc,e,r);if("Nothing"===n.$)return r;var a=n.a;return l(wc,e,t(a),r)}),Oc=n(function(e,t,r){return l(Uc,e,kc(t),r)}),Mc=a(function(e,t,r,n){var a=f(pc,e,t);return l(Oc,a,r,n)}),Fc=function(e){return l(za,r(function(e,t){var r=(1<>r}),Yc=n(function(e,t,r){return t?L(0,r<0))return t;var a=f(Hs,n,r),i=f(tu,function(e){return f(zc,e,g)},f(Vi,0,a)),o=Gc(e),u=O(t,i),s=n-a;e=o,t=u,n=s}});return f($s,i.outputLen,l(v,g,mr,i.outputLen))},Xc=function(e){return{$:"KS",a:e}},Zc=function(e){var t=e.a;return Xc({config:t,inputLength:0,partial:mr,state:f(Ti,25,Ou(Rc))})},ef=function(e){return Js(Pn(e))},tf=Us(Fs(mr)),rf=r(function(e,t){var n=t.a;return Js(r(function(t,r){var a=f(n,t,r),i=a.a,o=a.b;return f(e(o).a,t,i)}))}),nf=r(function(e,t){return f(rf,function(e){return ef(t)},ef(e))}),af=r(function(e,t){return f(ec,tf,f(Ws,f(nf,e,Ys(t)-e),t))}),of=r(function(e,t){for(;;){var n=t.a,a=n.config.rate/8|0,i=Ys(e)?f(qa,e,n.partial):n.partial;if(!(_(l(za,r(function(e,t){return t+Ys(e)}),0,i),a)>-1))return Xc(U(n,{inputLength:Ys(e)+n.inputLength,partial:i}));var o=zs(i),u=f(ec,tf,f(Ws,ef(a),o)),s=oc(u),c=f(Jc,s,n.state),d=Gc(c),h=f(af,a,o),p=tf,g=Xc(U(n,{inputLength:Ys(e)+n.inputLength,partial:F([h]),state:d}));e=p,t=g}}),uf=r(function(e,t){return Qc(f(of,Us(Fs(f(tu,Ks,t))),Zc(e)))}),sf=uf(xs),cf=function(e){return Ts(f(qi,"",f(tu,f($a,ts,Bs),f($s,4,sf(f(tu,xi,bs(e)))))))},ff=function(e){return f(Ao,"0x",e)||f(Ao,"0X",e)?e:"0x"+e},lf=function(e){var t=e.a;return ff(t)},df=r(function(e,t){var r=is(f(tu,ws,t)),n=function(e){return O(e,r)}(Bo(lf(cf(e))));return Ts(n)}),hf=function(e){return{data:ya(f(df,"poke()",mr)),decoder:Po(Io),from:ma,gas:ma,gasPrice:ma,nonce:ma,to:ya(e),value:ma}},pf=r(function(e,t){return{$:"CustomSend",a:e,b:t}}),gf=r(function(e,t){return f(pf,e,t)}),vf=r(function(e,t){return{$:"AgentHistory",a:e,b:t}}),yf=function(e){return{$:"Trade",a:e}},mf=function(e){return{data:e.data,from:e.from,gas:e.gas,gasPrice:e.gasPrice,nonce:e.nonce,to:e.to,value:e.value}},bf=r(function(e,t){switch(e.$){case"ViewUserRoleChanged":var r=e.a;return d(uo,t,io,co,F([lo(f(vf,t.agentAddress,r))]));case"ViewPhaseChanged":var n=e.a;return d(uo,U(t,{viewPhase:n}),io,co,mr);case"Poke":var a=e.a,i=mf(hf(a)),o={onBroadcast:ma,onMined:ma,onSign:ma},u=f(gf,o,i);return d(uo,t,io,u,mr);case"TradeClicked":var s=e.a;return d(uo,t,io,co,F([lo(yf(s))]));default:return fo(t)}}),Cf=function(e){return{$:"GTag",a:e}},Sf=function(e){return{$:"UserNotice",a:e}},Ef={$:"Web3Connect"},Tf=n(function(e,t,r){return{align:r,mainParagraphs:t,noticeType:e}}),wf=n(function(e,t,r){return e(t(r))}),If=en,Af=tn,Bf=function(e){switch(e.$){case"Normal":return 0;case"MayStopPropagation":return 1;case"MayPreventDefault":return 2;default:return 3}},kf=Vn,Nf={$:"Empty"},Rf=function(e){return{$:"Styled",a:e}},$f=function(e){return{$:"Text",a:e}},xf=function(e){return{$:"Unstyled",a:e}},_f=r(function(e,t){switch(t.$){case"Styled":var n=t.a;return Rf({html:r(function(t,r){return f(kf,e,f(n.html,t,r))}),styles:n.styles});case"Unstyled":var a=t.a;return xf(f(wf,kf(e),a));case"Text":var i=t.a;return $f(i);default:return Nf}}),Lf=_f,Pf=r(function(e,t){return l(Tf,t.noticeType,f(tu,tu(Lf(e)),t.mainParagraphs),t.align)}),Df=r(function(e,t){switch(t.$){case"UserNotice":var r=t.a;return Sf(f(Pf,e,r));case"Web3Connect":return Ef;case"GotoRoute":var n=t.a;return lo(n);default:var a=t.a;return Cf(a)}}),Uf=r(function(e,t){return f(tu,Df(e),t)}),Of={$:"Seller"},Mf=function(e){return{$:"Posix",a:e}},Ff=Mf,Vf={autoabortInterval:Ff(0),autorecallInterval:Ff(0),autoreleaseInterval:Ff(0),daiAmount:"",fiatAmount:"",fiatType:"USD",paymentMethod:"",userRole:Of},Kf=function(e){return{$:"TokenValue",a:e}},Hf=function(e){return e.a},jf=r(function(e,t){if("Just"===t.$){var r=t.a;return ya(e(r))}return ma}),qf=r(function(e,t){return f(ec,_u,f(jf,hi,f(Hu,e,t)))}),Gf=r(function(e,t){return Kf(f(qf,Hf(e),lu(t)))}),zf=function(e){return f(Gf,e,12)},Yf=function(e){return f(Gf,e,3)},Wf=Kf(lu(0)),Jf=r(function(e,t){var r=Wf;return{abortPunishment:zf(t.tradeAmount),autoabortInterval:t.autoabortInterval,autorecallInterval:t.autorecallInterval,autoreleaseInterval:t.autoreleaseInterval,buyerDeposit:Yf(t.tradeAmount),initiatorAddress:e.address,initiatorCommPubkey:e.commPubkey,initiatorRole:t.initiatorRole,paymentMethods:t.paymentMethods,pokeReward:r,price:t.price,tradeAmount:t.tradeAmount}}),Qf=function(e){if("Token"===e.$){if("EthDai"===e.a.$){e.a;return"Dai"}e.a;return"Dai"}switch(e.a.$){case"Eth":e.a;return"ETH";case"Kovan":e.a;return"ETH";default:e.a;return"xDai"}},Xf=function(e){if(e.b){var t=e.a;e.b;return ya(t)}return ma},Zf=Gr,el=function(e){var t=Xf(f(Zf,".",e));if("Nothing"===t.$)return L(e,0);var r=t.a,n=go(e)-1-r;return L(O(f(Co,r,e),f(yo,r+1,e)),n)},tl=r(function(e,t){e:for(;;){if(t.b){var r=t.a,n=t.b;if(e(r)){var a=e,i=n;e=a,t=i;continue e}return t}return mr}}),rl=function(e){var t=e.a,r=f(tl,di(0),t);return Do(r.b?t:mr)},nl=ee,al=r(function(e,t){for(;;){if(e<=0)return t;{if(!t.b)return t;var r=(t.a,t.b),n=e-1,a=r;e=n,t=a}}}),il=n(function(e,t,r){var n=f(al,t,r),a=Oi(r)>0;return e>0&&t>0&&a?f(qa,f($s,e,r),l(il,e,t,n)):mr}),ol=r(function(e,t){return l(il,e,e,t)}),ul=function(e){var t=r(function(t,r){var n=e(t);if("Nothing"===n.$)return ma;var a=n.a;return f(jf,qa(a),r)});return f(Ja,t,ya(mr))}(to),sl=function(e){return f(jf,f(wf,rl,Do),ul(f(tu,f($a,Ya,f($a,Qu,nl)),f(ol,7,Ya(e)))))},cl=X,fl=function(e){var t=bs(cl(e));if(!t.b)return ma;switch(t.a.valueOf()){case"-":if(t.b.b){var r=t.b;return f(jf,qo(nu),sl(r))}return ma;case"+":if(t.b.b){var r=t.b;return f(jf,qo(au),sl(r))}return ma;default:var r=t;return f(jf,qo(au),sl(r))}},ll=function(e){var t=function(e){return!f(Xu,2,e)};switch(e.$){case"Zer":return!0;case"Pos":default:var r=e.a.a;return t(f(ec,0,Xf(r)))}},dl=function(e){return f(Ru,e,e)},hl=lu(2),pl=n(function(e,t,r){e:for(;;)switch(r.$){case"Zer":return Uu;case"Neg":return Ho;default:if($(r,Uu))return f(Ru,e,t);if(ll(r)){var n=e,a=dl(t),i=f(qf,r,hl);e=n,t=a,r=i;continue e}var n=f(Ru,t,e),a=dl(t),i=f(qf,f(xu,r,Uu),hl);e=n,t=a,r=i;continue e}}),gl=r(function(e,t){return l(pl,Uu,e,t)}),vl=function(e){if(""===e)return ma;var t=el(e),r=t.a,n=t.b,a=fl(r),i=18-n;if(i<0)return ma;if("Nothing"===a.$)return ma;var o=a.a,u=f(Ru,o,f(gl,lu(10),lu(i)));return ya(u)},yl=function(e){return f(jf,Kf,vl(e))},ml=qr,bl=function(e){for(;;){if(f(ml,".",e))return l(vo,0,-1,e);{if(!f(ml,"0",e))return""===e?"0":e;e=l(vo,0,-1,e)}}},Cl=f(wf,f(Ju,7,D("0")),ji),Sl=function(e){return f(qi,"",e)},El=function(e){var t=e.a,r=Ya(t);if(r.b){var n=r.a,a=r.b;return Sl(f(qa,ji(n),f(tu,Cl,a)))}return"0"},Tl=function(e){switch(e.$){case"Zer":return"0";case"Pos":var t=e.a;return El(t);default:var t=e.a;return"-"+El(t)}},wl=r(function(e,t){return e<1?t:l(vo,0,-e,t)}),Il=function(e){var t=l(Ju,18,D("0"),Tl(e)),r=f(wl,18,t)+"."+f(wo,18,t);return function(e){return""===e?"0":e}(bl(r))},Al=r(function(e,t){var r=Il(t),n=Xf(f(Zf,".",r));if("Nothing"===n.$)return r;var a=n.a;return e?f(Co,a+1+e,r):f(Co,a,r)}),Bl=r(function(e,t){if("Nothing"===e.$)return Il(Hf(t));var r=e.a;return f(Al,r,Hf(t))}),kl=dr,Nl=te,Rl=function(e){var t=Nl(f(Bl,ma,e));if("Just"===t.$){return t.a}f(kl,"Error converting tokenValue to float: string -> float failed",e);return 0},$l=r(function(e,t){if(""===t)return wi("You must specify a trade amount.");var r=yl(t);if("Nothing"===r.$)return wi("I don't understand this number.");var n=r.a;return Rl(n)<1?wi("Trade amount must be a least 1 "+Qf(e)+"."):Ii(n)}),xl=function(e){if(""===e)return wi("You must specify a fiat price.");var t=fl(e);if("Nothing"===t.$){var r=Nl(e);return wi("Just"===r.$?"Fractional fiat amounts (i.e. $1.20) are not supported. Use a whole number.":"I don't understand this number.")}var n=t.a;return Ii(n)},_l=r(function(e,t){if("Just"===t.$){var r=t.a;return Ii(r)}return wi(e)}),Ll=function(e){return""===e},Pl=function(e){return Ll(e)?ma:ya(e)},Dl=function(e){return f(_l,"You must specify a fiat type.",Pl(e))},Ul=function(e){return""===e?wi("Must specify a payment method."):Ii(e)},Ol=u(function(e,t,r,n,a,i,o){return{autoabortInterval:i,autorecallInterval:a,autoreleaseInterval:o,daiAmount:e,fiatAmount:t,fiatType:r,paymentMethod:n}}),Ml=g(Ol,ma,ma,ma,ma,ma,ma,ma),Fl=function(e){var t=e.a,r=e.b,n=e.c,a=P(t,r,n);if("Ok"===a.a.$){if("Ok"===a.b.$){if("Ok"===a.c.$){var i=a.a.a,o=a.b.a,u=a.c.a;return Ii(P(i,o,u))}var s=a.c.a;return wi(s)}var c=a.b.a;return wi(c)}var f=a.a.a;return wi(f)},Vl=a(function(e,t,r,n){var a=n.a,i=n.b,o=n.c;return P(e(a),t(i),r(o))}),Kl={$:"Custom"},Hl=r(function(e,t){return{info:t,type_:e}}),jl=o(function(e,t,r,n,a,i){if("Err"===t.$){var o=t.a;return wi(o)}var u=t.a;if("Err"===r.$){var o=r.a;return wi(o)}var s=r.a;if("Err"===n.$){var o=n.a;return wi(o)}var c=n.a;if("Err"===a.$){var o=a.a;return wi(o)}var f=a.a;if("Err"===i.$){var o=i.a;return wi(o)}var l=i.a;return Ii(h(e,u,s,c,f,l))}),ql=r(function(e,t){if("Ok"===t.$){var r=t.a;return Ii(r)}var n=t.a;return wi(e(n))}),Gl=function(e){return e.a},zl=r(function(e,t){return p(jl,i(function(e,r,n,a,i){var o=i.a;return{autoabortInterval:i.b,autorecallInterval:o,autoreleaseInterval:i.c,initiatorRole:t.userRole,paymentMethods:F([f(Hl,Kl,a)]),price:{amount:r,fiatType:n},tradeAmount:e}}),f(ql,function(e){return U(Ml,{daiAmount:ya(e)})},f($l,e,t.daiAmount)),f(ql,function(e){return U(Ml,{fiatAmount:ya(e)})},xl(t.fiatAmount)),f(ql,function(e){return U(Ml,{fiatType:ya(e)})},Dl(t.fiatType)),f(ql,function(e){return U(Ml,{paymentMethod:ya(e)})},Ul(t.paymentMethod)),Fl(d(Vl,function(e){return Gl(e)>0?Ii(e):wi(U(Ml,{autorecallInterval:ya("Must specify a non-zero time for this window")}))},function(e){return Gl(e)>0?Ii(e):wi(U(Ml,{autoabortInterval:ya("Must specify a non-zero time for this window")}))},function(e){return Gl(e)>0?Ii(e):wi(U(Ml,{autoreleaseInterval:ya("Must specify a non-zero time for this window")}))},P(t.autorecallInterval,t.autoabortInterval,t.autoreleaseInterval))))}),Yl=n(function(e,t,r){if("Nothing"===t.$)return ma;var n=t.a;if("Nothing"===r.$)return ma;var a=r.a;return ya(f(e,n,a))}),Wl=function(e){if("Ok"===e.$){var t=e.a;return ya(t)}return ma},Jl=function(e){var t=f(zl,e.web3Context.factoryType,e.inputs),r=function(){return $(e.errors,Ml)?Ml:"Ok"===t.$?Ml:t.a}();return U(e,{createParameters:l(Yl,Jf,e.userInfo,Wl(t)),errors:r})},Ql=r(function(e,t){return Jl(U(t,{inputs:e}))}),Xl=a(function(e,t,r,n){return{appCmds:n,chainCmd:r,cmd:t,model:e}}),Zl=r(function(e,t){return d(Xl,f(Ql,Vf,{allowance:ma,createParameters:ma,depositAmount:ma,errors:Ml,inputs:Vf,showFiatTypeDropdown:!1,txChainStatus:ma,userInfo:t,web3Context:e}),io,co,mr)}),ed=function(e){return{$:"Address",a:e}},td=f($a,Bo,f($a,cl,ed)),rd=function(e){if("Token"===e.$){if("EthDai"===e.a.$){e.a;return td("0x5677CFbA35a0Db0469d3d56020d556B942E9ce90")}e.a;return td("0xbC69Aff9d93C5EA4a841166C46C68518D02aF818")}switch(e.a.$){case"Eth":e.a;return td("0xD3b1e8F2bDe0a2DdfC9F6e2EB6e2589e5Ba955b6");case"Kovan":e.a;return td("0xA30773FD520cdf845E1a00441aB09cE39B31F676");default:e.a;return td("0x7E370099a7a789dC28810a72381bcd7Be834Ad74")}},nd=function(e){return td("EthDai"===e.$?"0x89d24A6b4CcB1B6fAA2625fE562bDD9a23260359":"0xC4375B7De8af5a38a93548eb8453a498222C4fF2")},ad=function(e){return{$:"AddressE",a:e}},id=ad,od=function(e){return{$:"UintE",a:e}},ud=od,sd=n(function(e,t,r){return{data:ya(f(df,"approve(address,uint256)",F([id(t),ud(r)]))),decoder:Po(Io),from:ma,gas:ma,gasPrice:ma,nonce:ma,to:ya(e),value:ma}}),cd=function(e){return f(Gf,e,200)},fd=r(function(e,t){return Kf(f(mu,Hf(e),Hf(t)))}),ld=function(e){var t=f(Gf,e.tradeAmount,200);return f(fd,e.pokeReward,f(fd,cd(e.tradeAmount),f(fd,t,function(){return"Buyer"===e.initiatorRole.$?Yf(e.tradeAmount):e.tradeAmount}())))},dd=Af(li),hd=n(function(e,t,r){return{id:e,initiator:r,tradeAddress:t}}),pd=a(function(e,t,r,n){return{index:t,match:e,number:r,submatches:n}}),gd=Zn,vd=Xn,yd=function(e){return f(vd,{caseInsensitive:!1,multiline:!1},e)},md=Qn,bd=gd(f(ec,md,yd("^((0[Xx]){1})?[0-9A-Fa-f]{40}$"))),Cd=r(function(e,t){for(;;){if(!t.b)return!1;var r=t.a,n=t.b;if(e(r))return!0;var a=e,i=n;e=a,t=i}}),Sd=r(function(e,t){return!f(Cd,f(wf,Tu,e),t)}),Ed=Sd(to),Td=G,wd=r(function(e,t){if("Ok"===t.$){return t.a}return e}),Id=n(function(e,t,r){if("Err"===t.$){var n=t.a;return wi(n)}var a=t.a;if("Err"===r.$){var n=r.a;return wi(n)}var i=r.a;return Ii(f(e,a,i))}),Ad=f(Ja,Id(qa),Ii(mr)),Bd=function(e){if(e.b){var t=(e.a,e.b);return ya(t)}return ma},kd=n(function(e,t,r){e:for(;;){if(!t.b)return Ii(r);var n=t.a,a=t.b;switch(n.valueOf()){case"0":var i=e-1,o=a,u=r;e=i,t=o,r=u;continue e;case"1":var i=e-1,o=a,u=r+f(Yo,16,e);e=i,t=o,r=u;continue e;case"2":var i=e-1,o=a,u=r+2*f(Yo,16,e);e=i,t=o,r=u;continue e;case"3":var i=e-1,o=a,u=r+3*f(Yo,16,e);e=i,t=o,r=u;continue e;case"4":var i=e-1,o=a,u=r+4*f(Yo,16,e);e=i,t=o,r=u;continue e;case"5":var i=e-1,o=a,u=r+5*f(Yo,16,e);e=i,t=o,r=u;continue e;case"6":var i=e-1,o=a,u=r+6*f(Yo,16,e);e=i,t=o,r=u;continue e;case"7":var i=e-1,o=a,u=r+7*f(Yo,16,e);e=i,t=o,r=u;continue e;case"8":var i=e-1,o=a,u=r+8*f(Yo,16,e);e=i,t=o,r=u;continue e;case"9":var i=e-1,o=a,u=r+9*f(Yo,16,e);e=i,t=o,r=u;continue e;case"a":var i=e-1,o=a,u=r+10*f(Yo,16,e);e=i,t=o,r=u;continue e;case"b":var i=e-1,o=a,u=r+11*f(Yo,16,e);e=i,t=o,r=u;continue e;case"c":var i=e-1,o=a,u=r+12*f(Yo,16,e);e=i,t=o,r=u;continue e;case"d":var i=e-1,o=a,u=r+13*f(Yo,16,e);e=i,t=o,r=u;continue e;case"e":var i=e-1,o=a,u=r+14*f(Yo,16,e);e=i,t=o,r=u;continue e;case"f":var i=e-1,o=a,u=r+15*f(Yo,16,e);e=i,t=o,r=u;continue e;default:var s=n;return wi(Gu(s)+" is not a valid hexadecimal character.")}}}),Nd=function(e){if(Ll(e))return wi("Empty strings are not valid hexadecimal strings.");var t=function(){if(f(Ao,"-",e)){var t=f(ec,mr,Bd(bs(e)));return f(Eo,To,l(kd,Oi(t)-1,t,0))}return l(kd,go(e)-1,bs(e),0)}();return f(ql,function(t){return f(qi," ",F(['"'+e+'"',"is not a valid hexadecimal string because",t]))},t)},Rd=function(e){var t=bs(e);return function(e){return L(t,e)}(f(wd,mr,Ad(f(tu,Nd,f(zi,"",f(qi,"",f(tu,f($a,ts,Bs),f($s,20,sf(f(tu,f($a,Td,xi),t))))))))))},$d=function(e){var t=r(function(e,t){return!(t>=8&&_i(e)||t<8&&Li(e))}),n=Rd(Bo(e)),a=n.a,i=n.b,o=l(Mi,t,a,i);return!!bd(e)&&Ed(o)},xd=gd(f(ec,md,yd("^((0[Xx]){1})?[0-9a-f]{40}$"))),_d=gd(f(ec,md,yd("^((0[Xx]){1})?[0-9A-F]{40}$"))),Ld=function(e){return'"'+e+'"'},Pd=function(e){var t=Bo(e),r=f(Co,24,t),n=f(wo,40,e);return 64===go(t)&&f(Hi,di(D("0")),r)?_d(n)||xd(n)?Ii(ed(n)):$d(n)?Ii(ed(n)):wi("Given address "+Ld(e)+" failed the EIP-55 checksum test."):40!==go(t)?wi("Given address "+Ld(e)+" is not the correct length."):bd(t)?_d(t)||xd(t)?Ii(ed(t)):$d(t)?Ii(ed(t)):wi("Given address "+Ld(e)+" failed the EIP-55 checksum test."):wi("Given address "+Ld(e)+" contains invalid hex characters.")},Dd=ho(function(e){var t=e.a,r=e.b;return f(Eo,f(bo,t,r),Pd(So(r)))}),Ud=r(function(e,t){var r=t.a;return ho(function(t){var n=t.a,a=t.b;return r(f(po,n,f(yo,64*e,a)))})}),Od=Qr,Md=r(function(e,t){return f(Od,"data",Po(f(Ud,e,t)))}),Fd=Xr,Vd=r(function(e,t){return f(Od,"topics",f(Fd,e,Po(t)))}),Kd=function(e){return f(jf,f($a,Ya,f(za,r(function(e,t){return f(mu,lu(e),f(Ru,t,ju))}),_u)),ul(f(tu,f($a,Ya,f($a,Qu,f($a,Nd,Wl))),f(ol,8,Ya(e)))))},Hd=function(e){var t=bs(cl(e));e:for(;;){if(!t.b)return ma;switch(t.a.valueOf()){case"-":if(t.b.b){if("0"===t.b.a.valueOf()&&t.b.b.b&&"x"===t.b.b.a.valueOf()){if(t.b.b.b.b){var r=t.b,n=r.b,a=n.b;return f(jf,Ru(lu(-1)),Kd(a))}var i=t.b;i.b;return ma}var a=t.b;return f(jf,Ru(lu(-1)),Kd(a))}return ma;case"+":if(t.b.b){var a=t.b;return Kd(a)}return ma;case"0":if(t.b.b&&"x"===t.b.a.valueOf()){if(t.b.b.b){var o=t.b,a=o.b;return Kd(a)}t.b;return ma}break e;default:break e}}var a=t;return Kd(a)},jd=ho(function(e){var t=e.a,r=e.b;return f(Eo,f(bo,t,r),f(_l,"Error Decoding Uint into BigInt",Hd(ff(So(r)))))}),qd=f(dd,f(Vd,1,Dd),f(dd,f(Md,1,Dd),f(dd,f(Md,0,jd),_o(hd)))),Gd=me,zd=f($a,lf,Gd),Yd=an,Wd=r(function(e,t){return me(l(za,Ee(e),Ce(),t))}),Jd=function(e){return me(l(za,r(function(e,t){var r=e.a,n=e.b;return l(un,r,n,t)}),Se(),e))},Qd=r(function(e,t){return{address:t.address,blockHash:t.blockHash,blockNumber:t.blockNumber,data:t.data,logIndex:t.logIndex,removed:t.removed,returnData:f(Yd,e,Jd(F([L("data",Gd(t.data)),L("topics",f(Wd,zd,t.topics))]))),topics:t.topics,transactionHash:t.transactionHash,transactionIndex:t.transactionIndex}}),Xd=function(e){var t=e.a;return ff(t)},Zd=r(function(e,t){return l(Ja,r(function(t,r){return e(t)?f(qa,t,r):r}),mr,t)}),eh=r(function(e,t){if("Ok"===t.$){return e(t.a)}var r=t.a;return wi(r)}),th=r(function(e,t){return f(Eo,function(e){return e.id},f(eh,function(e){return f(ql,Qi,f(Qd,qd,e).returnData)},f(_l,"No log found from that factoryAddress in that txReceipt",Xf(f(Zd,function(t){return $(f($a,Xd,cl)(t.address),f($a,Xd,cl)(rd(e)))},t.logs)))))}),rh=n(function(e,t,r){return{data:ya(f(df,"allowance(address,address)",F([id(t),id(r)]))),decoder:Po(jd),from:ma,gas:ma,gasPrice:ma,nonce:ma,to:ya(e),value:ma}}),nh=function(e){switch(e.$){case"BlockNum":var t=e.a;return Gd(ff(ts(t)));case"EarliestBlock":return Gd("earliest");case"LatestBlock":return Gd("latest");default:return Gd("pending")}},ah=f($a,Xd,Gd),ih=f($a,ns,f($a,ff,Gd)),oh=f($a,ts,f($a,ff,Gd)),uh=sn,sh=function(e){return Jd(f(tu,function(e){var t=e.a,r=e.b;return L(t,f(ec,uh,r))},f(Zd,function(e){e.a;return!$(e.b,ma)},e)))},ch=function(e){var t=e.to,r=e.from,n=e.gas,a=e.gasPrice,i=e.value,o=e.data;return sh(F([L("to",f(jf,ah,t)),L("from",f(jf,ah,r)),L("gas",f(jf,oh,n)),L("gasPrice",f(jf,ih,a)),L("value",f(jf,ih,i)),L("data",f(jf,zd,o))]))},fh=function(e){return{$:"BadBody",a:e}},lh=function(e){return{$:"BadStatus",a:e}},dh=function(e){return{$:"BadUrl",a:e}},hh={$:"NetworkError"},ph={$:"Timeout"},gh=nn,vh=r(function(e,t){switch(t.$){case"BadUrl_":var r=t.a;return wi(dh(r));case"Timeout_":return wi(ph);case"NetworkError_":return wi(hh);case"BadStatus_":var n=t.a,a=t.b;return wi(lh(n.statusCode));default:var n=t.a,a=t.b,i=f(gh,f(Od,"result",e),a);if("Ok"===i.$){var o=i.a;return Ii(o)}var u=i.a;return wi(fh(Qi(u)))}}),yh=me,mh=n(function(e,t,r){return Jd(F([L("id",yh(e)),L("jsonrpc",Gd("2.0")),L("method",Gd(t)),L("params",f(Wd,to,r))]))}),bh={$:"RBEmpty_elm_builtin"},Ch=bh,Sh=r(function(e,t){e:for(;;){if("RBEmpty_elm_builtin"===t.$)return ma;var r=t.b,n=t.c,a=t.d,i=t.e,o=f(su,e,r);switch(o.$){case"LT":var u=e,s=a;e=u,t=s;continue e;case"EQ":return ya(n);default:var u=e,s=i;e=u,t=s;continue e}}}),Eh={$:"Black"},Th=i(function(e,t,r,n,a){return{$:"RBNode_elm_builtin",a:e,b:t,c:r,d:n,e:a}}),wh={$:"Red"},Ih=i(function(e,t,r,n,a){if("RBNode_elm_builtin"===a.$&&"Red"===a.a.$){var i=(a.a,a.b),o=a.c,u=a.d,s=a.e;if("RBNode_elm_builtin"===n.$&&"Red"===n.a.$){var c=(n.a,n.b),f=n.c,l=n.d,d=n.e;return h(Th,wh,t,r,h(Th,Eh,c,f,l,d),h(Th,Eh,i,o,u,s))}return h(Th,e,i,o,h(Th,wh,t,r,n,u),s)}if("RBNode_elm_builtin"===n.$&&"Red"===n.a.$&&"RBNode_elm_builtin"===n.d.$&&"Red"===n.d.a.$){var c=(n.a,n.b),f=n.c,p=n.d,g=(p.a,p.b),v=p.c,y=p.d,m=p.e,d=n.e;return h(Th,wh,c,f,h(Th,Eh,g,v,y,m),h(Th,Eh,t,r,d,a))}return h(Th,e,t,r,n,a)}),Ah=n(function(e,t,r){if("RBEmpty_elm_builtin"===r.$)return h(Th,wh,e,t,bh,bh);var n=r.a,a=r.b,i=r.c,o=r.d,u=r.e;switch(f(su,e,a).$){case"LT":return h(Ih,n,a,i,l(Ah,e,t,o),u);case"EQ":return h(Th,n,a,t,o,u);default:return h(Ih,n,a,i,o,l(Ah,e,t,u))}}),Bh=n(function(e,t,r){var n=l(Ah,e,t,r);if("RBNode_elm_builtin"===n.$&&"Red"===n.a.$){var a=(n.a,n.b),i=n.c,o=n.d,u=n.e;return h(Th,Eh,a,i,o,u)}return n}),kh=function(e){for(;;){if("RBNode_elm_builtin"!==e.$||"RBNode_elm_builtin"!==e.d.$)return e;e=e.d}},Nh=function(e){if("RBNode_elm_builtin"===e.$&&"RBNode_elm_builtin"===e.d.$&&"RBNode_elm_builtin"===e.e.$){if("RBNode_elm_builtin"===e.e.d.$&&"Red"===e.e.d.a.$){var t=e.a,r=e.b,n=e.c,a=e.d,i=(a.a,a.b),o=a.c,u=a.d,s=a.e,c=e.e,f=(c.a,c.b),l=c.c,d=c.d,p=(d.a,d.b),g=d.c,v=d.d,y=d.e,m=c.e;return h(Th,wh,p,g,h(Th,Eh,r,n,h(Th,wh,i,o,u,s),v),h(Th,Eh,f,l,y,m))}var t=e.a,r=e.b,n=e.c,b=e.d,i=(b.a,b.b),o=b.c,u=b.d,s=b.e,C=e.e,f=(C.a,C.b),l=C.c,d=C.d,m=C.e;return t.$,h(Th,Eh,r,n,h(Th,wh,i,o,u,s),h(Th,wh,f,l,d,m))}return e},Rh=function(e){if("RBNode_elm_builtin"===e.$&&"RBNode_elm_builtin"===e.d.$&&"RBNode_elm_builtin"===e.e.$){if("RBNode_elm_builtin"===e.d.d.$&&"Red"===e.d.d.a.$){var t=e.a,r=e.b,n=e.c,a=e.d,i=(a.a,a.b),o=a.c,u=a.d,s=(u.a,u.b),c=u.c,f=u.d,l=u.e,d=a.e,p=e.e,g=(p.a,p.b),v=p.c,y=p.d,m=p.e;return h(Th,wh,i,o,h(Th,Eh,s,c,f,l),h(Th,Eh,r,n,d,h(Th,wh,g,v,y,m)))}var t=e.a,r=e.b,n=e.c,b=e.d,i=(b.a,b.b),o=b.c,C=b.d,d=b.e,S=e.e,g=(S.a,S.b),v=S.c,y=S.d,m=S.e;return t.$,h(Th,Eh,r,n,h(Th,wh,i,o,C,d),h(Th,wh,g,v,y,m))}return e},$h=u(function(e,t,r,n,a,i,o){if("RBNode_elm_builtin"===i.$&&"Red"===i.a.$){var u=(i.a,i.b),s=i.c,c=i.d,f=i.e;return h(Th,r,u,s,c,h(Th,wh,n,a,f,o))}e:for(;;){if("RBNode_elm_builtin"===o.$&&"Black"===o.a.$){if("RBNode_elm_builtin"===o.d.$){if("Black"===o.d.a.$){var l=(o.a,o.d);l.a;return Rh(t)}break e}o.a,o.d;return Rh(t)}break e}return t}),xh=function(e){if("RBNode_elm_builtin"===e.$&&"RBNode_elm_builtin"===e.d.$){var t=e.a,r=e.b,n=e.c,a=e.d,i=a.a,o=a.d,u=e.e;if("Black"===i.$){if("RBNode_elm_builtin"===o.$&&"Red"===o.a.$){o.a;return h(Th,t,r,n,xh(a),u)}var s=Nh(e);if("RBNode_elm_builtin"===s.$){var c=s.a,f=s.b,l=s.c,d=s.d,p=s.e;return h(Ih,c,f,l,xh(d),p)}return bh}return h(Th,t,r,n,xh(a),u)}return bh},_h=r(function(e,t){if("RBEmpty_elm_builtin"===t.$)return bh;var r=t.a,n=t.b,a=t.c,i=t.d,o=t.e;if(_(e,n)<0){if("RBNode_elm_builtin"===i.$&&"Black"===i.a.$){var u=(i.a,i.d);if("RBNode_elm_builtin"===u.$&&"Red"===u.a.$){u.a;return h(Th,r,n,a,f(_h,e,i),o)}var s=Nh(t);if("RBNode_elm_builtin"===s.$){var c=s.a,l=s.b,d=s.c,p=s.d,v=s.e;return h(Ih,c,l,d,f(_h,e,p),v)}return bh}return h(Th,r,n,a,f(_h,e,i),o)}return f(Lh,e,g($h,e,t,r,n,a,i,o))}),Lh=r(function(e,t){if("RBNode_elm_builtin"===t.$){var r=t.a,n=t.b,a=t.c,i=t.d,o=t.e;if($(e,n)){var u=kh(o);if("RBNode_elm_builtin"===u.$){var s=u.b,c=u.c;return h(Ih,r,s,c,i,xh(o))}return bh}return h(Ih,r,n,a,i,f(_h,e,o))}return bh}),Ph=r(function(e,t){var r=f(_h,e,t);if("RBNode_elm_builtin"===r.$&&"Red"===r.a.$){var n=(r.a,r.b),a=r.c,i=r.d,o=r.e;return h(Th,Eh,n,a,i,o)}return r}),Dh=n(function(e,t,r){var n=t(f(Sh,e,r));if("Just"===n.$){var a=n.a;return l(Bh,e,a,r)}return f(Ph,e,r)}),Uh=function(e){return"Just"===e.$},Oh=vn,Mh=yn,Fh=r(function(e,t){return{$:"BadStatus_",a:e,b:t}}),Vh=function(e){return{$:"BadUrl_",a:e}},Kh=r(function(e,t){return{$:"GoodStatus_",a:e,b:t}}),Hh={$:"NetworkError_"},jh=function(e){return{$:"Receiving",a:e}},qh=function(e){return{$:"Sending",a:e}},Gh={$:"Timeout_"},zh=function(e){return f(ra,"application/json",f(Wi,0,e))},Yh=n(function(e,t,r){return zh(l(mh,e,t,r))}),Wh=f(ta,"",to),Jh=we,Qh=Te,Xh=function(e){if("Ok"===e.$){var t=e.a;return Qh(t)}var r=e.a;return Jh(r)},Zh=function(e){return l(ea,vr,Xh,{allowCookiesFromOtherDomains:!1,body:e.body,expect:e.resolver,headers:e.headers,method:e.method,timeout:e.timeout,tracker:ma,url:e.url})},ep=function(e){var t=e.url,r=e.method,n=e.params,a=e.decoder;return Zh({body:l(Yh,1,r,n),headers:mr,method:"POST",resolver:Wh(vh(a)),timeout:ma,url:t})},tp=n(function(e,t,r){return ep({decoder:t.decoder,method:"eth_call",params:F([ch(t),nh(r)]),url:e})}),rp={$:"LatestBlock"},np=r(function(e,t){return l(tp,e,t,rp)}),ap=function(e){return{$:"Perform",a:e}},ip=cn,op=Qh(vr),up=r(function(e,t){return f(ip,function(t){return Qh(e(t))},t)}),sp=n(function(e,t,r){return f(ip,function(t){return f(ip,function(r){return Qh(f(e,t,r))},r)},t)}),cp=function(e){return l(Ja,sp(qa),Qh(mr),e)},fp=r(function(e,t){var r=t.a;return ke(f(ip,Oh(e),r))}),lp=n(function(e,t,r){return f(up,function(e){return vr},cp(f(tu,fp(e),t)))}),dp=n(function(e,t,r){return Qh(vr)}),hp=r(function(e,t){var r=t.a;return ap(f(up,e,r))});gn.Task=De(op,lp,dp,hp);var pp=Oe("Task"),gp=fn,vp=r(function(e,t){return pp(ap(f(gp,f(wf,f(wf,Qh,e),wi),f(ip,f(wf,f(wf,Qh,e),Ii),t))))}),yp=i(function(e,t,r,n,a){return f(vp,a,f(np,e.httpProvider,l(rh,nd(t),r,n)))}),mp=function(e){if("Token"===e.$){if("EthDai"===e.a.$){e.a;return td("0x61F399ED1D5AEC3Bc9d4B026352d5764181d6b35")}e.a;return td("0xF59ed429f9753B0498436DE1a3559AEC7a0c2a21")}switch(e.a.$){case"Eth":e.a;return td("0x61F399ED1D5AEC3Bc9d4B026352d5764181d6b35");case"Kovan":e.a;return td("0xF59ed429f9753B0498436DE1a3559AEC7a0c2a21");default:e.a;return td("0x092110996699c3E06e998d89F0f4586026e44F0F")}},bp=function(e){return{$:"BoolE",a:e}},Cp=bp,Sp=function(e){return{$:"StringE",a:e}},Ep=Sp,Tp=function(e){return function(t){return function(r){return function(n){return function(a){return function(i){return function(o){return function(u){return function(s){return function(c){return function(l){return function(d){return function(h){return function(p){return{data:ya(f(df,"createOpenTrade(address[2],bool,uint256[8],string,string)",F([id(t),id(r),Cp(n),ud(a),ud(i),ud(o),ud(u),ud(s),ud(c),ud(l),ud(d),Ep(h),Ep(p)]))),decoder:Po(Dd),from:ma,gas:ma,gasPrice:ma,nonce:ma,to:ya(e),value:ma}}}}}}}}}}}}}}},wp=function(e){return function(t){return function(r){return function(n){return function(a){return function(i){return function(o){return function(u){return function(s){return function(c){return function(l){return function(d){return function(h){return function(p){return{data:ya(f(df,"createOpenTrade(address[2],bool,uint256[8],string,string)",F([id(t),id(r),Cp(n),ud(a),ud(i),ud(o),ud(u),ud(s),ud(c),ud(l),ud(d),Ep(h),Ep(p)]))),decoder:Po(Dd),from:ma,gas:ma,gasPrice:ma,nonce:ma,to:ya(e),value:ma}}}}}}}}}}}}}}},Ip=r(function(e,t){return{paymentMethods:t,price:e}}),Ap=function(e){return Gd(Tl(e))},Bp=function(e){return f(Wd,to,F([Gd(e.fiatType),Ap(e.amount)]))},kp=function(e){switch(e.$){case"Cash":return"cash";case"Bank":return"bank";default:return"custom"}},Np=function(e){return Jd(F([L("type",Gd(kp(e.type_))),L("info",Gd(e.info))]))},Rp=function(e){var t=Bp(e.price),r=f(Wd,Np,e.paymentMethods);return f(Wi,0,Jd(F([L("paymentmethods",r),L("price",t)])))},$p=r(function(e,t){return U(t,{value:ya(e)})}),xp=function(e){return lu(Gl(e))},_p=function(e){return f(qf,xp(e),lu(1e3))},Lp=r(function(e,t){var r=function(){return"Token"===e.$?Tp:wp}();return function(){return"Native"===e.$?$p(Hf(ld(t))):to}()(r(rd(e))(t.initiatorAddress)(mp(e))($(t.initiatorRole,Of))(Hf(t.tradeAmount))(Hf(Yf(t.tradeAmount)))(Hf(zf(t.tradeAmount)))(Hf(t.pokeReward))(_p(t.autorecallInterval))(_p(t.autoabortInterval))(_p(t.autoreleaseInterval))(Hf(cd(t.tradeAmount)))(Rp(f(Ip,t.price,t.paymentMethods)))(t.initiatorCommPubkey))}),Pp=function(e){return{$:"CreateMined",a:e}},Dp={$:"CreateNeedsSig"},Up=function(e){return{$:"CreateSigned",a:e}},Op=r(function(e,t){var r=mf(f(Lp,e,t)),n={onBroadcast:ma,onMined:ya(L(Pp,ma)),onSign:ya(Up)};return L(ya(Dp),f(gf,n,r))}),Mp=function(e){return{$:"AllowanceFetched",a:e}},Fp=r(function(e,t){return{$:"ApproveMining",a:e,b:t}}),Vp={$:"ApproveNeedsSig"},Kp=r(function(e,t){return{$:"ApproveSigned",a:e,b:t}}),Hp=function(e){return{$:"Confirm",a:e}},jp=function(e){return{$:"CreateMining",a:e}},qp={$:"NoOp"},Gp=function(e){return{appCmds:mr,chainCmd:co,cmd:io,model:e}},zp=function(e){return nl(Tl(e))},Yp={$:"BottomRight"},Wp={$:"ShouldBeImpossible"},Jp=function(e){return $f(e)},Qp=r(function(e,t){f(kl,e,t);return{align:Yp,mainParagraphs:F([F([Jp(e)])]),noticeType:Wp}}),Xp={$:"Error"},Zp=r(function(e,t){f(kl,e+" fetch error",t);return{align:Yp,mainParagraphs:F([F([Jp('Failed to fetch "'+e+'". See console output for more info.')])]),noticeType:Xp}}),eg=r(function(e,t){return{align:Yp,mainParagraphs:F([F([Jp('Error mining "'+e+'" transaction: '+t)])]),noticeType:Xp}}),tg={$:"Caution"},rg=r(function(e,t){return{align:Yp,mainParagraphs:F([F([Jp('Error signing "'+e+'" transaction: '+t)])]),noticeType:tg}}),ng=r(function(e,t){if("Just"===t.$){return e(t.a)}return ma}),ag=r(function(e,t){return 1-e(1-t)}),ig=function(e){return f(Yo,e,5)},og=ag(ig),ug={easing:og,offset:12,speed:200},sg=function(e){return{$:"External",a:e}},cg=function(e){return{$:"Internal",a:e}},fg=function(e){return{$:"NotFound",a:e}},lg=function(e){for(;;){e=e.a}},dg=r(function(e,t){return pp(ap(f(up,e,t)))}),hg={$:"Http"},pg={$:"Https"},gg=Hr,vg=o(function(e,t,r,n,a,i){return{fragment:i,host:t,path:n,port_:r,protocol:e,query:a}}),yg=i(function(e,t,r,n,a){if(Ll(a)||f(gg,"@",a))return ma;var i=f(Zf,":",a);if(i.b){if(i.b.b)return ma;var o=i.a,u=nl(f(yo,o+1,a));if("Nothing"===u.$)return ma;var s=u;return ya(p(vg,e,f(Co,o,a),s,t,r,n))}return ya(p(vg,e,a,ma,t,r,n))}),mg=a(function(e,t,r,n){if(Ll(n))return ma;var a=f(Zf,"/",n);if(a.b){var i=a.a;return h(yg,e,f(yo,i,n),t,r,f(Co,i,n))}return h(yg,e,"/",t,r,n)}),bg=n(function(e,t,r){if(Ll(r))return ma;var n=f(Zf,"?",r);if(n.b){var a=n.a;return d(mg,e,ya(f(yo,a+1,r)),t,f(Co,a,r))}return d(mg,e,ma,t,r)}),Cg=r(function(e,t){if(Ll(t))return ma;var r=f(Zf,"#",t);if(r.b){var n=r.a;return l(bg,e,ya(f(yo,n+1,t)),f(Co,n,t))}return l(bg,e,ma,t)}),Sg=function(e){return f(Ao,"http://",e)?f(Cg,hg,f(yo,7,e)):f(Ao,"https://",e)?f(Cg,pg,f(yo,8,e)):ma},Eg=Jt,Tg=zt(Yt),wg=ca,Ig=r(function(e,t){return L(e,t)}),Ag=_r,Bg=a(function(e,t,r,n){var a=_(r,n)>0?mi:Ga,i=fu(r-n),o=f(vi,1,Ag(i)/e|0),u=o,s=f(tu,function(e){return t(e/u)},f(Vi,0,o));return e<=0||$(r,n)?mr:f(tu,function(e){return f(a,r,e*i)},s)}),kg=r(function(e,t){var n=r(function(t,r){return cp(f(tu,wg(0),d(Bg,e.speed,e.easing,t,r-e.offset)))});return f(ip,function(e){var t=e.a.viewport,r=e.b.element;return f(n,t.y,r.y)},l(sp,Ig,Tg,Eg(t)))}),Ng=r(function(e,t){switch(e.$){case"Refresh":var r=(e.a,L(t.userInfo,t.web3Context.factoryType));if("Just"===r.a.$&&"Token"===r.b.$){var n=r.a.a,a=r.b.a,i=h(yp,t.web3Context,a,n.address,rd(t.web3Context.factoryType),Mp);return d(Xl,t,i,co,mr)}return Gp(t);case"ChangeRole":var o=e.a,u=t.inputs;return Gp(U(t,{inputs:U(u,{userRole:o})}));case"TradeAmountChanged":var s=e.a,u=t.inputs;return Gp(f(Ql,U(u,{daiAmount:s}),t));case"FiatAmountChanged":var s=e.a,u=t.inputs;return Gp(f(Ql,U(u,{fiatAmount:s}),t));case"FiatTypeChanged":var c=e.a,u=t.inputs;return Gp(f(Ql,U(u,{fiatType:c}),t));case"FiatTypeLostFocus":return Gp(U(t,{showFiatTypeDropdown:!1}));case"ChangePaymentMethodText":var p=e.a,u=t.inputs;return Gp(f(Ql,U(u,{paymentMethod:p}),t));case"AutorecallIntervalChanged":var g=e.a,u=t.inputs;return Gp(f(Ql,U(u,{autorecallInterval:g}),t));case"AutoabortIntervalChanged":var g=e.a,u=t.inputs;return Gp(f(Ql,U(u,{autoabortInterval:g}),t));case"AutoreleaseIntervalChanged":var g=e.a,u=t.inputs;return Gp(f(Ql,U(u,{autoreleaseInterval:g}),t));case"ShowCurrencyDropdown":var v=e.a,u=t.inputs;return Gp((v?Ql(U(u,{fiatType:""})):to)(U(t,{showFiatTypeDropdown:v})));case"CreateClicked":var n=e.a,y=f(zl,t.web3Context.factoryType,t.inputs);if("Ok"===y.$){var m=y.a,b=f(Jf,n,m);return Gp(U(t,{depositAmount:ya(Hf(ld(b))),txChainStatus:ya(Hp(b))}))}var C=y.a;return d(Xl,U(t,{errors:C}),f(vp,Ou(qp),function(){return f(kg,U(ug,{offset:60}),"inputError")}()),co,mr);case"AbortCreate":return Gp(U(t,{txChainStatus:ma}));case"ConfirmCreate":var b=e.a,S=e.b,E=function(){var e=t.web3Context.factoryType;if("Native"===e.$)return f(Op,t.web3Context.factoryType,b);var r=e.a,n=function(){var e=mf(l(sd,nd(r),rd(t.web3Context.factoryType),S)),n={onBroadcast:ma,onMined:ma,onSign:ya(Kp(b))};return f(gf,n,e)}(),a=t.allowance;if("Just"===a.$){var i=a.a;return $(f(Su,i,S),Da)?L(ya(Vp),n):f(Op,t.web3Context.factoryType,b)}return L(ya(Vp),n)}(),T=E.a,w=E.b;return d(Xl,U(t,{txChainStatus:T}),io,w,mr);case"ApproveSigned":var b=e.a,I=e.b;if("Ok"===I.$){var A=I.a;return Gp(U(t,{txChainStatus:ya(f(Fp,b,A))}))}var B=I.a;return d(Xl,U(t,{txChainStatus:ma}),io,co,F([Sf(f(rg,"appove",B))]));case"AllowanceFetched":var k=e.a;if("Ok"===k.$){var N=k.a,R=U(t,{allowance:ya(N)}),x=L(R.txChainStatus,R.depositAmount);if("Just"===x.a.$&&"ApproveMining"===x.a.a.$&&"Just"===x.b.$){var _=x.a.a,b=_.a,P=x.b.a;if($(f(Su,N,P),Da))return Gp(R);var D=f(Op,R.web3Context.factoryType,b),T=D.a,w=D.b;return d(Xl,U(R,{txChainStatus:T}),io,w,mr)}return Gp(R)}var O=k.a;return d(Xl,t,io,co,F([Sf(f(Zp,"allowance",O))]));case"CreateSigned":var I=e.a;if("Ok"===I.$){var A=I.a;return Gp(U(t,{txChainStatus:ya(jp(A))}))}var B=I.a;return d(Xl,U(t,{txChainStatus:ma}),io,co,F([Sf(f(rg,"create",B))]));case"CreateMined":if("Err"===e.a.$){var B=e.a.a;return d(Xl,t,io,co,F([Sf(f(eg,"create",B))]))}var M=e.a.a,V=f(ng,zp,Wl(f(th,t.web3Context.factoryType,M)));if("Just"===V.$){var K=V.a;return d(Xl,t,io,co,F([lo(yf(K))]))}return d(Xl,t,io,co,F([Sf(f(Qp,'Error getting the ID of the created offer. Check the "My Trades" page for your open offer.',M))]));case"Web3Connect":return d(Xl,t,io,co,F([Ef]));default:return Gp(t)}}),Rg=function(e){return sh(F([L("to",f(jf,ah,e.to)),L("from",f(jf,ah,e.from)),L("gas",f(jf,oh,e.gas)),L("gasPrice",f(jf,ih,e.gasPrice)),L("value",f(jf,ih,e.value)),L("data",f(jf,zd,e.data)),L("nonce",f(jf,oh,e.nonce))]))},$g=function(e){return{$:"TxSentry",a:e}},xg=r(function(e,t){return Jd(F([L("ref",yh(e)),L("txParams",t)]))}),_g=function(e){return{$:"Signing",a:e}},Lg=r(function(e,t){var r=t.onSign;return{onBroadcastTagger:t.onBroadcast,onMinedTagger:t.onMined,onSignedTagger:r,params:e,status:_g(e)}}),Pg=mn,Dg=n(function(e,t,r){var n=e.a,a=Rg(r),i=l(Bh,n.ref,f(Lg,r,t),n.txs);return L($g(U(n,{ref:n.ref+1,txs:i})),f(Pg,n.tagger,n.outPort(f(xg,n.ref,a))))}),Ug=Dg,Og=r(function(e,t){if("None"===t.$)return L(e,io);var r=t.a,n=t.b;return l(Ug,e,r,n)}),Mg=n(function(e,t,r){return{onBroadcast:t,onMined:r,onSign:e}}),Fg=r(function(e,t){if("None"===t.$)return so;var r=t.a,n=t.b,a=l(Mg,f(jf,wf(e),r.onSign),f(jf,wf(e),r.onBroadcast),f(jf,function(t){var r=t.a,n=t.b;return L(f($a,r,e),f(jf,function(t){return{confirmations:t.confirmations,toMsg:f($a,t.toMsg,e)}},n))},r.onMined));return f(pf,a,n)}),Vg=function(e){if("Token"===e.$){if("EthDai"===e.a.$){e.a;return wa}e.a;return Ta}switch(e.a.$){case"Eth":e.a;return wa;case"Kovan":e.a;return Ta;default:e.a;return Ia(100)}},Kg=r(function(e,t){return f(su,Gl(e),Gl(t))}),Hg=r(function(e,t){return $(t.state.phase,no)&&$(f(Kg,t.derived.phaseEndTime,e),Fa)}),jg=function(e){if(""===e)return Ii(ma);var t=yl(e);if("Nothing"===t.$)return wi("I can't interpret this number");var r=t.a;return Ii(ya(r))},qg=function(e){if(""===e)return Ii(ma);var t=fl(e);if("Nothing"===t.$)return wi("I don't understand this number.");var r=t.a;return Ii(ya(r))},Gg=a(function(e,t,r,n){return{maxDai:t,maxFiat:n,minDai:e,minFiat:r}}),zg=d(Gg,ma,ma,ma,ma),Yg=i(function(e,t,r,n,a){if("Err"===t.$){var i=t.a;return wi(i)}var o=t.a;if("Err"===r.$){var i=r.a;return wi(i)}var u=r.a;if("Err"===n.$){var i=n.a;return wi(i)}var s=n.a;if("Err"===a.$){var i=a.a;return wi(i)}var c=a.a;return Ii(d(e,o,u,s,c))}),Wg=function(e){return h(Yg,a(function(t,r,n,a){return{dai:{max:r,min:t},fiat:f(jf,function(e){return{max:a,min:n,type_:e}},Pl(e.fiatType)),paymentMethodTerms:e.paymentMethodTerms}}),f(ql,function(e){return U(zg,{minDai:ya(e)})},jg(e.minDai)),f(ql,function(e){return U(zg,{maxDai:ya(e)})},jg(e.maxDai)),f(ql,function(e){return U(zg,{minFiat:ya(e)})},qg(e.minFiat)),f(ql,function(e){return U(zg,{maxFiat:ya(e)})},qg(e.maxFiat)))},Jg=r(function(e,t){var r=function(t){return f(Sd,function(e){return f(gg,cl(e),cl(t))},e)};return f(Cd,function(e){return r(e.info)},t)}),Qg=r(function(e,t){return U(t,{paymentMethod:e})}),Xg=r(function(e,t){return U(t,{paymentMethodTerms:e})}),Zg=r(function(e,t){return f(Su,Hf(e),Hf(t))}),ev=function(e){if(""===e.inputs.paymentMethod)return e;var t=e.inputs.paymentMethod,r=f(Qa,e.inputs.paymentMethodTerms,F([t]));return tv(U(e,{inputs:f(Xg,r,f(Qg,"",e.inputs))}))},tv=function(e){var t=ev(e),n=Wg(t.inputs);if("Err"===n.$){return U(e,{errors:n.a})}var a=n.a,i=r(function(e,t){var r=a.paymentMethodTerms;if(r.b){return f(Jg,r,t.terms.paymentMethods)}return!0}),o=function(e){var t=a.fiat;if("Nothing"===t.$)return!0;var r=t.a;return $(e.terms.price.fiatType,r.type_)&&function(){var t=r.min;if("Nothing"===t.$)return!0;var n=t.a;return!$(f(Su,e.terms.price.amount,n),Da)}()&&function(){var t=r.max;if("Nothing"===t.$)return!0;var n=t.a;return!$(f(Su,e.terms.price.amount,n),Fa)}()},u=function(e){return function(){var t=a.dai.min;if("Nothing"===t.$)return!0;var r=t.a;return!$(f(Zg,e.parameters.tradeAmount,r),Da)}()&&function(){var t=a.dai.max;if("Nothing"===t.$)return!0;var r=t.a;return!$(f(Zg,e.parameters.tradeAmount,r),Fa)}()},s=r(function(e,r){return f(Hg,e,r)&&!$(r.parameters.initiatorRole,t.browsingRole)&&f(i,e,r)&&u(r)&&o(r)});return U(t,{filterFunc:s})},rv={fiatType:"",maxDai:"",maxFiat:"",minDai:"",minFiat:"",paymentMethod:"",paymentMethodTerms:mr},nv=r(function(e,t){return f(su,e.creationInfo.blocknum,t.creationInfo.blocknum)}),av=n(function(e,t,r){return L(tv({browsingRole:t,errors:zg,filterFunc:Hg,inputs:rv,showCurrencyDropdown:!1,sortFunc:nv,userInfo:r,web3Context:e}),io)}),iv=r(function(e,t){return f(Su,e.amount,t.amount)}),ov=r(function(e,t){var r=f(Zd,js(e),t.inputs.paymentMethodTerms);return tv(U(t,{inputs:f(Xg,r,t.inputs)}))}),uv=function(e){return U(e,{filterFunc:Hg,inputs:rv,sortFunc:nv})},sv={$:"Ascending"},cv=n(function(e,t,r){return{appCmds:r,cmd:t,model:e}}),fv=function(e){return l(cv,e,io,mr)},lv=r(function(e,t){return U(t,{fiatType:e})}),dv=r(function(e,t){return U(t,{maxDai:e})}),hv=r(function(e,t){return U(t,{maxFiat:e})}),pv=r(function(e,t){return U(t,{minDai:e})}),gv=r(function(e,t){return U(t,{minFiat:e})}),vv=n(function(e,t,r){return f(e,r,t)}),yv=r(function(e,t){switch(e.$){case"MinDaiChanged":var n=e.a;return l(cv,U(t,{inputs:f(pv,n,t.inputs)}),io,mr);case"MaxDaiChanged":var n=e.a;return l(cv,U(t,{inputs:f(dv,n,t.inputs)}),io,mr);case"MinFiatChanged":var n=e.a;return l(cv,U(t,{inputs:f(gv,n,t.inputs)}),io,mr);case"MaxFiatChanged":var n=e.a;return l(cv,U(t,{inputs:f(hv,n,t.inputs)}),io,mr);case"FiatTypeInputChanged":var n=e.a;return l(cv,U(t,{inputs:f(lv,n,t.inputs)}),io,mr);case"ShowCurrencyDropdown":var a=e.a;t.inputs;return l(cv,U(t,{inputs:(a?lv(""):to)(t.inputs),showCurrencyDropdown:a}),io,mr);case"FiatTypeLostFocus":return l(cv,U(t,{showCurrencyDropdown:!1}),io,mr);case"PaymentMethodInputChanged":var n=e.a;return l(cv,U(t,{inputs:f(Qg,n,t.inputs)}),io,mr);case"AddSearchTerm":return l(cv,ev(t),io,mr);case"RemoveTerm":var i=e.a;return l(cv,f(ov,i,t),io,mr);case"ApplyInputs":return l(cv,tv(t),io,mr);case"ResetSearch":return l(cv,uv(t),io,mr);case"TradeClicked":var o=e.a;return l(cv,t,io,F([lo(yf(o))]));case"SortBy":var u=e.a,s=e.b,c=($(s,sv)?vv:to)(r(function(e,t){switch(u.$){case"Expiring":return f(Kg,e.derived.phaseEndTime,t.derived.phaseEndTime);case"TradeAmount":return f(Zg,e.parameters.tradeAmount,t.parameters.tradeAmount);case"Fiat":return f(iv,e.terms.price,t.terms.price);case"Margin":return f(ec,Pa,l(Yl,r(function(e,t){return f(su,e,t)}),e.derived.margin,t.derived.margin));case"PaymentMethods":return f(nv,e,t);case"AutoabortWindow":return f(Kg,e.parameters.autoabortInterval,t.parameters.autoabortInterval);default:return f(Kg,e.parameters.autoreleaseInterval,t.parameters.autoreleaseInterval)}}));return l(cv,U(t,{sortFunc:c}),io,mr);default:return fv(t)}}),mv=n(function(e,t,r){var n=e.factoryType;if("Token"===n.$){var a=n.a;return h(yp,e,a,t.address,rd(e.factoryType),r)}return io}),bv=function(e){return{$:"AllowanceFetched",a:e}},Cv=function(e){return{$:"Menu",a:e}},Sv={$:"NoneStarted"},Ev=a(function(e,t,r,n){return{appCmds:n,chainCmd:r,cmd:t,model:e}}),Tv=r(function(e,t){var r={state:Cv(Sv),textInput:"",tokenAllowance:ma,userInfo:t,web3Context:e},n=function(){if("Just"===t.$){var e=t.a;return l(mv,r.web3Context,e,bv)}return io}();return d(Ev,r,n,co,mr)}),wv=function(e){return{$:"ApproveSigned",a:e}},Iv=r(function(e,t){var r=mf(l(sd,nd(e),rd(ga(e)),Hf(t))),n={onBroadcast:ma,onMined:ma,onSign:ya(wv)};return f(gf,n,r)}),Av=function(e){return{$:"OpenMined",a:e}},Bv=function(e){return{$:"OpenSigned",a:e}},kv=r(function(e,t){var r=mf(f(Lp,e,t)),n={onBroadcast:ma,onMined:ya(L(Av,ma)),onSign:ya(Bv)};return f(gf,n,r)}),Nv=function(e){return{$:"ApproveMining",a:e}},Rv=function(e){return{$:"ApproveNeedsSig",a:e}},$v={$:"OpenMining"},xv={$:"OpenNeedsSig"},_v={$:"ReadyToOpen"},Lv=r(function(e,t){return{$:"Spec",a:e,b:t}}),Pv=function(e){return{$:"StartPrompt",a:e}},Dv=r(function(e,t){return Kf(f(Ru,Hf(e),lu(t)))}),Uv=function(e){var t=function(){return"Buyer"===e.initiatorRole.$?3:1}();return f(Gf,f(Dv,e.daiAmountIn,100*t),100+t)},Ov=n(function(e,t,r){var n=t.intervals,a=n.a,i=n.b,o=n.c;return f(Jf,e,{autoabortInterval:i,autorecallInterval:a,autoreleaseInterval:o,initiatorRole:t.initiatorRole,paymentMethods:F([f(Hl,Kl,r)]),price:t.fiatValue,tradeAmount:Uv(t)})}),Mv=function(e){return{appCmds:mr,chainCmd:co,cmd:io,model:e}},Fv=function(e){return Kf(e)},Vv=r(function(e,t){switch(e.$){case"Refresh":var r=(e.a,L(t.userInfo,t.web3Context.factoryType));if("Just"===r.a.$&&"Token"===r.b.$){var n=r.a.a,a=r.b.a,i=h(yp,t.web3Context,a,n.address,rd(t.web3Context.factoryType),bv);return d(Ev,t,i,co,mr)}return Mv(t);case"StartClicked":var o=e.a;if("Token"===t.web3Context.factoryType.$){var u=function(){var e=t.tokenAllowance;if("Just"===e.$){var r=e.a;return $(f(Zg,r,o.daiAmountIn),Da)?Cv(Pv(o)):f(Lv,o,_v)}return Cv(Pv(o))}();return Mv(U(t,{state:u}))}return Mv(U(t,{state:f(Lv,o,_v)}));case"ApproveClicked":var o=e.a,s=t.web3Context.factoryType;if("Token"===s.$){var a=s.a,c=f(Iv,a,o.daiAmountIn);return d(Ev,U(t,{state:Cv(Rv(o))}),io,c,mr)}return d(Ev,t,io,co,F([Sf(f(Qp,"Approve Clicked msg received, but factoryType is not a token factory!",o))]));case"ApproveSigned":var p=e.a,g=L(p,t.state);if("Ok"===g.a.$){if("Menu"===g.b.$&&"ApproveNeedsSig"===g.b.a.$){var v=g.a.a,o=g.b.a.a;return Mv(U(t,{state:f(Lv,o,Nv(v))}))}return d(Ev,t,io,co,F([Sf(f(Qp,"Approve signed, but factoryType is not a token factory!",p))]))}var y=g.a.a;return d(Ev,t,io,co,F([Sf(f(rg,"ERC20 approve",y))]));case"AllowanceFetched":var m=e.a,b=L(m,t.state);if("Ok"===b.a.$){if("Spec"===b.b.$&&"ApproveMining"===b.b.b.$){var C=b.a.a,S=b.b,o=S.a;return Mv($(f(Su,C,Hf(o.daiAmountIn)),Da)?U(t,{tokenAllowance:ya(Fv(C))}):U(t,{state:f(Lv,o,_v),tokenAllowance:ya(Fv(C))}))}return Mv(t)}var E=b.a.a;return d(Ev,t,io,co,F([Sf(f(Zp,"token allowance",E))]));case"OpenClicked":var n=e.a,T=e.b,w=l(Ov,n,T,t.textInput),c=f(kv,t.web3Context.factoryType,w);return d(Ev,U(t,{state:f(Lv,T,xv)}),io,c,mr);case"OpenSigned":var p=e.a,I=L(p,t.state);if("Ok"===I.a.$){if("Spec"===I.b.$){var v=I.a.a,A=I.b,w=A.a;return Mv(U(t,{state:f(Lv,w,$v)}))}return d(Ev,t,io,co,F([Sf(f(Qp,"Open signed, but factoryType is not a token factory!",p))]))}var y=I.a.a;return d(Ev,t,io,co,F([Sf(f(rg,"Open trade",y))]));case"OpenMined":var B=e.a;if("Ok"===B.$){var k=B.a,N=f(ng,zp,Wl(f(th,t.web3Context.factoryType,k)));if("Just"===N.$){var R=N.a;return d(Ev,t,io,co,F([lo(yf(R))]))}return d(Ev,t,io,co,F([Sf(f(Qp,'Error getting the ID of the created offer. Check the "My Trades" page for your open offer.',k))]))}var y=B.a;return d(Ev,t,io,co,F([Sf(f(eg,"Open trade",y))]));case"TextInputChanged":var x=e.a;return Mv(U(t,{textInput:x}));case"ChangeState":var u=e.a;return Mv(U(t,{state:u}));case"AbortCreate":return Mv(U(t,{state:Cv(Sv)}));case"NoOp":return Mv(t);default:return d(Ev,t,io,co,F([Ef]))}}),Kv=function(e){return"Buyer"===e.$?"buyer":"seller"},Hv=function(e){return e.a+"="+e.b},jv=function(e){return e.b?"?"+f(qi,"&",f(tu,Hv,e)):""},qv=r(function(e,t){return"/"+(f(qi,"/",e)+jv(t))}),Gv=function(e){switch(e.$){case"Home":return f(qv,F(["DAIHard"]),mr);case"QuickCreate":return f(qv,F(["DAIHard","quickcreate"]),mr);case"Create":return f(qv,F(["DAIHard","create"]),mr);case"Trade":var t=e.a;return f(qv,F(["DAIHard","trade",ji(t)]),mr);case"Marketplace":var r=e.a;return f(qv,F(["DAIHard","marketplace",Kv(r)]),mr);case"AgentHistory":var n=e.a,r=e.b;return f(qv,F(["DAIHard","history",Xd(n),function(){return"Buyer"===r.$?"buyer":"seller"}()]),mr);default:return f(qv,mr,mr)}},zv={$:"NotFound"},Yv={$:"Create"},Wv={$:"Home"},Jv=function(e){return{$:"Marketplace",a:e}},Qv={$:"QuickCreate"},Xv=function(e){return{$:"Parser",a:e}},Zv=i(function(e,t,r,n,a){return{frag:n,params:r,unvisited:t,value:a,visited:e}}),ey=r(function(e,t){return Xv(function(e){var r=e.visited,n=e.unvisited,a=e.params,i=e.frag,o=e.value;if(n.b){var u=n.a,s=n.b,c=t(u);if("Just"===c.$){var l=c.a;return F([h(Zv,f(qa,u,r),s,a,i,o(l))])}return mr}return mr})}),ty=f(ey,"ADDRESS",f($a,Pd,Wl)),ry={$:"Buyer"},ny=f(ey,"BUYERORSELLER",function(e){switch(e){case"buyer":return ya(ry);case"seller":return ya(Of);default:return ma}}),ay=f(ey,"NUMBER",nl),iy=r(function(e,t){var r=t.visited,n=t.unvisited,a=t.params,i=t.frag,o=t.value;return h(Zv,r,n,a,i,e(o))}),oy=r(function(e,t){var r=t.a;return Xv(function(t){var n=t.visited,a=t.unvisited,i=t.params,o=t.frag,u=t.value;return f(tu,iy(u),r(h(Zv,n,a,i,o,e)))})}),uy=function(e){return l(Ja,Qa,mr,e)},sy=r(function(e,t){return uy(f(tu,e,t))}),cy=function(e){return Xv(function(t){var r=t.visited,n=t.unvisited,a=t.params,i=t.frag,o=t.value;if(n.b){var u=n.a,s=n.b;return $(u,e)?F([h(Zv,f(qa,u,r),s,a,i,o)]):mr}return mr})},fy=r(function(e,t){var r=e.a,n=t.a;return Xv(function(e){return f(sy,n,r(e))})}),ly=Xv(function(e){return F([e])}),dy=f(fy,cy("DAIHard"),function(e){return Xv(function(t){return f(sy,function(e){return(0,e.a)(t)},e)})}(F([f(oy,Wv,ly),f(oy,Qv,cy("quickcreate")),f(oy,Yv,cy("create")),f(oy,yf,f(fy,cy("trade"),ay)),f(oy,Jv,f(fy,cy("marketplace"),ny)),f(oy,vf,f(fy,cy("history"),f(fy,ty,ny))),f(oy,function(e){return f(vf,e,Of)},f(fy,cy("history"),ty))]))),hy=function(e){e:for(;;){if(e.b){var t=e.a,r=e.b,n=t.unvisited;if(n.b){if(""!==n.a||n.b.b){var a=r;e=a;continue e}return ya(t.value)}return ya(t.value)}return ma}},py=function(e){if(e.b){if(""!==e.a||e.b.b){var t=e.a,r=e.b;return f(qa,t,py(r))}return mr}return mr},gy=function(e){var t=f(zi,"/",e);if(t.b&&""===t.a){var r=t.b;return py(r)}var r=t;return py(r)},vy=Xt,yy=r(function(e,t){if("Nothing"===t.$)return ya(F([e]));var r=t.a;return ya(f(qa,e,r))}),my=r(function(e,t){var r=f(zi,"=",e);if(r.b&&r.b.b&&!r.b.b.b){var n=r.a,a=r.b,i=a.a,o=vy(n);if("Nothing"===o.$)return t;var u=o.a,s=vy(i);if("Nothing"===s.$)return t;var c=s.a;return l(Dh,u,yy(c),t)}return t}),by=function(e){if("Nothing"===e.$)return Ch;var t=e.a;return l(Ja,my,Ch,f(zi,"&",t))},Cy=r(function(e,t){var r=e.a;return hy(r(h(Zv,mr,gy(t.path),by(t.query),t.fragment,to)))}),Sy=function(e){return f(ec,zv,f(Cy,dy,e))},Ey=ia,Ty=r(function(e,t){return f(Ey,e,Gv(t))}),wy=qe("connectToWeb3",function(e){return uh}),Iy=function(e){return Jd(F([L("event",Gd(e.event)),L("category",Gd(e.category)),L("label",Gd(e.label)),L("value",yh(e.value))]))},Ay=r(function(e,t){return Jd(F([L("address",Gd(Xd(e))),L("signSeedMsg",Gd(t))]))}),By=qe("gTagOut",to),ky=qe("genPrivkey",to),Ny=r(function(e,t){return U(t,{userInfo:e})}),Ry=r(function(e,t){return L(f(Ql,t.inputs,U(t,{userInfo:e})),function(){var r=L(e,t.web3Context.factoryType);if("Just"===r.a.$&&"Token"===r.b.$){var n=r.a.a,a=r.b.a;return h(yp,t.web3Context,a,n.address,rd(t.web3Context.factoryType),Mp)}return io}())}),$y=r(function(e,t){return U(t,{userInfo:e})}),xy=r(function(e,t){return L(U(t,{userInfo:e}),function(){if("Just"===e.$){var r=e.a;return l(mv,t.web3Context,r,bv)}return io}())}),_y=function(e){return{$:"AllowanceFetched",a:e}},Ly=r(function(e,t){return L(U(t,{userInfo:e}),function(){var r=P(e,t.trade,t.web3Context.factoryType);if("Just"===r.a.$&&"LoadedTrade"===r.b.$&&"Token"===r.c.$){var n=r.a.a,a=r.b.a,i=r.c.a;return h(yp,t.web3Context,i,n.address,a.creationInfo.address,_y)}return io}())}),Py=function(e){return{$:"AgentHistoryModel",a:e}},Dy=function(e){return{$:"CreateModel",a:e}},Uy=function(e){return{$:"CreateMsg",a:e}},Oy=function(e){return{$:"MarketplaceModel",a:e}},My=function(e){return{$:"QuickCreateModel",a:e}},Fy=function(e){return{$:"QuickCreateMsg",a:e}},Vy=function(e){return{$:"TradeModel",a:e}},Ky=function(e){return{$:"TradeMsg",a:e}},Hy=r(function(e,t){switch(t.$){case"BetaLandingPage":return L(t,io);case"CreateModel":var r=t.a,n=f(Ry,e,r),a=n.a,i=n.b;return L(Dy(a),f(Pg,Uy,i));case"QuickCreateModel":var o=t.a,u=f(xy,e,o),s=u.a,c=u.b;return L(My(s),f(Pg,Fy,c));case"TradeModel":var l=t.a,d=f(Ly,e,l),h=d.a,p=d.b;return L(Vy(h),f(Pg,Ky,p));case"MarketplaceModel":var g=t.a;return L(Oy(f($y,e,g)),io);default:var v=t.a;return L(Py(f(Ny,e,v)),io)}}),jy=r(function(e,t){return U(t,{web3Context:e})}),qy=r(function(e,t){return U(t,{web3Context:e})}),Gy=r(function(e,t){return U(t,{web3Context:e})}),zy=r(function(e,t){return U(t,{web3Context:e})}),Yy=r(function(e,t){switch(t.$){case"BetaLandingPage":return P(t,io,ma);case"CreateModel":var r=t.a;return P(Dy(f(qy,e,r)),io,ma);case"QuickCreateModel":var n=t.a;return P(My(f(zy,e,n)),io,ma);case"TradeModel":t.a;return P(t,io,ya(Jv(ry)));case"MarketplaceModel":var a=t.a;return P(Oy(f(Gy,e,a)),io,ma);default:var i=t.a;return P(Py(f(jy,e,i)),io,ma)}}),Wy=o(function(e,t,r,n,a,i){return{creationInfo:t,id:e,parameters:r,phaseStartInfo:i,state:n,terms:a}}),Jy=function(e){return{$:"PartiallyLoadedTrade",a:e}},Qy=function(e){return Jy(p(Wy,e,ma,ma,ma,ma,ma))},Xy=r(function(e,t){return{initiatorPubkey:e,responderPubkey:t}}),Zy=function(e){return{$:"PartiallyLoadedCommInfo",a:e}},em=Zy(f(Xy,ma,ma)),tm=r(function(e,t){return{address_:e,blocknum:t}}),rm=function(e){return ho(function(t){return Ii(L(t,e))})},nm=r(function(e,t){return L(t.a,e(t.b))}),am=n(function(e,t,r){var n=t.a,a=r.a;return ho(function(t){return f(eh,function(t){var r=t.a,n=t.b;return f(Eo,nm(e(n)),a(r))},n(t))})}),im=r(function(e,t){return l(am,r(function(e,t){return e(t)}),t,e)}),om=Po(f(im,jd,f(im,Dd,rm(tm)))),um=r(function(e,t){return{data:ya(f(df,"createdTrades(uint256)",F([ud(t)]))),decoder:om,from:ma,gas:ma,gasPrice:ma,nonce:ma,to:ya(e),value:ma}}),sm=n(function(e,t,r){return f(vp,r,f(np,e.httpProvider,f(um,rd(e.factoryType),t)))}),cm=function(e){return{$:"CreationInfoFetched",a:e}},fm=r(function(e,t){return l(sm,e,lu(t),cm)}),lm=function(e){return{$:"EventSentryMsg",a:e}},dm=a(function(e,t,r,n){return{appCmds:n,chainCmd:r,cmd:t,model:e}}),hm=Lo(f($a,Bo,Nd)),pm=function(e){return ep({decoder:hm,method:"eth_blockNumber",params:mr,url:e})},gm=function(e){return{$:"BlockNumber",a:e}},vm=function(e){return{$:"EventSentry",a:e}},ym=function(e){return{$:"Set_elm_builtin",a:e}},mm=ym(Ch),bm=r(function(e,t){return L(vm({blockNumber:ma,errors:mr,nodePath:t,pending:mm,ref:1,requests:Ch,tagger:e,watching:mm}),f(vp,f($a,gm,e),pm(t)))}),Cm=n(function(e,t,r){var n=f(fm,e,r),a=f(bm,lm,e.httpProvider),i=a.a,o=a.b;return d(dm,{allowance:ma,chatHistoryModel:ma,eventSentry:i,eventsWaitingForChatHistory:mr,expandedPhase:no,secureCommInfo:em,showChatHistory:!1,showStatsModal:!1,trade:Qy(r),txChainStatus:ma,userInfo:t,web3Context:e},ao(F([n,o])),co,mr)}),Sm=function(e){return{data:ya(f(df,"abort()",mr)),decoder:_o(vr),from:ma,gas:ma,gasPrice:ma,nonce:ma,to:ya(e),value:ma}},Em=function(e){return{data:ya(f(df,"burn()",mr)),decoder:_o(vr),from:ma,gas:ma,gasPrice:ma,nonce:ma,to:ya(e),value:ma}},Tm=function(e){return{data:ya(f(df,"claim()",mr)),decoder:_o(vr),from:ma,gas:ma,gasPrice:ma,nonce:ma,to:ya(e),value:ma}},wm=r(function(e,t){return{data:ya(f(df,"initiatorStatement(string)",F([Ep(t)]))),decoder:_o(vr),from:ma,gas:ma,gasPrice:ma,nonce:ma,to:ya(e),value:ma}}),Im=function(e){return{data:ya(f(df,"recall()",mr)),decoder:_o(vr),from:ma,gas:ma,gasPrice:ma,nonce:ma,to:ya(e),value:ma}},Am=function(e){return{data:ya(f(df,"release()",mr)),decoder:_o(vr),from:ma,gas:ma,gasPrice:ma,nonce:ma,to:ya(e),value:ma}},Bm=r(function(e,t){return{data:ya(f(df,"responderStatement(string)",F([Ep(t)]))),decoder:_o(vr),from:ma,gas:ma,gasPrice:ma,nonce:ma,to:ya(e),value:ma}}),km=r(function(e,t){return{amount:t,fiatType:e}}),Nm=f(Ro,function(e){var t=fl(e);if("Just"===t.$){var r=t.a;return _o(r)}return $o("Can't convert that to a BigInt")},xo),Rm=l(Af,km,f(Fd,0,xo),f(Fd,1,Nm)),$m={$:"Bank"},xm={$:"Cash"},_m=function(e){switch(e){case"cash":return ya(xm);case"bank":return ya($m);case"custom":return ya(Kl);default:return ma}},Lm=f(Ro,function(e){var t=_m(e);if("Just"===t.$){var r=t.a;return _o(r)}return $o("")},xo),Pm=l(Af,Hl,f(Od,"type",Lm),f(Od,"info",xo)),Dm=ue,Um=function(e){var t=l(Af,Ip,f(Od,"price",Rm),f(Od,"paymentmethods",Dm(Pm)));return f(gh,t,e)},Om=r(function(e,t){return{commPubkey:t,responder:e}}),Mm=r(function(e,t){var n=r(function(t,r){return l(vo,t,t+2*r,e)}),a=f($a,Nd,Eo(yi(2)));return f(eh,function(t){return f(Eo,function(e){return f(n,t+64,e)},Nd(l(vo,t,t+64,e)))},a(t))}),Fm=n(function(e,t,r){var n=r.a,a=r.b,i=r.c,o=function(e){return 63&e|n<<6};return a?1===a?P(0,0,f(e,o(t),i)):P(o(t),a-1,i):128&t?192==(224&t)?P(31&t,1,i):224==(240&t)?P(15&t,2,i):P(7&t,3,i):P(0,0,f(e,t,i))}),Vm=n(function(e,t,r){var n=l(za,Fm(e),P(0,0,t),r);if(n.b)return wi("invalid UTF-8 sequence");var a=n.c;return Ii(a)}),Km=q,Hm=function(e){return Gu(Km(e))},jm=function(e){return l(Vm,r(function(e,t){return O(t,Hm(e))}),"",e)},qm=ho(function(e){var t=e.a,r=e.b;return f(Eo,f(bo,t,r),f(eh,jm,f(eh,f($a,tu(Nd),Ad),f(Eo,Zd(f($a,Ll,Tu)),f(Eo,Ss(2),f(Mm,t,So(r)))))))}),Gm=f(dd,f(Md,1,qm),f(dd,f(Md,0,Dd),_o(Om))),zm=r(function(e,t){return{commPubkey:t,terms:e}}),Ym=f(dd,f(Md,1,qm),f(dd,f(Md,0,qm),_o(zm))),Wm=function(e){return{statement:e}},Jm=f(dd,f(Md,0,qm),_o(Wm)),Qm=function(e){return{statement:e}},Xm=f(dd,f(Md,0,qm),_o(Qm)),Zm={$:"AbortedEvent"},eb={$:"BurnedEvent"},tb={$:"ClaimedEvent"},rb=function(e){return{$:"CommittedEvent",a:e}},nb=function(e){return{$:"InitiatedEvent",a:e}},ab=function(e){return{$:"InitiatorStatementLogEvent",a:e}},ib={$:"PokeEvent"},ob={$:"RecalledEvent"},ub={$:"ReleasedEvent"},sb=function(e){return{$:"ResponderStatementLogEvent",a:e}},cb=gd(f(ec,md,yd("^((0[Xx]){1})?[0-9a-fA-F]+$"))),fb=function(e){return cb(e)?Ii(Ts(Bo(e))):wi("Something in here is not very hexy: "+Ld(e))},lb=Lo(fb),db=f(Od,"topics",f(Fd,0,lb)),hb=function(e){return Ts(f(qi,"",f(tu,f($a,ts,Bs),sf(f(tu,xi,bs(e))))))},pb=f(Ro,function(e){return $(e,hb("Initiated(string,string)"))?f(If,nb,Ym):$(e,hb("Committed(address,string)"))?f(If,rb,Gm):$(e,hb("Recalled()"))?_o(ob):$(e,hb("Claimed()"))?_o(tb):$(e,hb("Aborted()"))?_o(Zm):$(e,hb("Released()"))?_o(ub):$(e,hb("Burned()"))?_o(eb):$(e,hb("InitiatorStatementLog(string)"))?f(If,ab,Jm):$(e,hb("ResponderStatementLog(string)"))?f(If,sb,Xm):$(e,hb("Poke()"))?_o(ib):$o("Unrecognized topic hash")},db),gb={$:"Initiator"},vb={$:"Responder"},yb=r(function(e,t){return $(t,e.parameters.initiatorAddress)?ya(gb):f(ng,function(e){return $(t,e)?ya(vb):ma},e.state.responder)}),mb=function(e){return"Buyer"===e.initiatorRole.$?e.tradeAmount:e.buyerDeposit},bb=function(e){return $(e.buyerDeposit,Yf(e.tradeAmount))&&$(e.abortPunishment,zf(e.tradeAmount))},Cb={$:"Invalid"},Sb=u(function(e,t,r,n,a,i,o){return{creationInfo:t,derived:o,id:e,parameters:r,phaseStartInfo:i,state:n,terms:a}}),Eb=function(e){return{$:"LoadedTrade",a:e}},Tb=r(function(e,t){return Ff(Gl(t)+Gl(e))}),wb=function(e){var t=Nl(Tl(e.amount));if("Just"===t.$){return t.a}f(kl,"Error converting FiatValue to float--string -> float failed!",e);return 0},Ib=r(function(e,t){return(t-e)/e}),Ab=r(function(e,t){var r=wb(t),n=Rl(e);return"USD"===t.fiatType?ya(f(Ib,n,r)):ma}),Bb=n(function(e,t,r){var n=function(){switch(t.phase.$){case"Open":return e.autorecallInterval;case"Committed":return e.autoabortInterval;case"Judgment":return e.autoreleaseInterval;default:return Ff(0)}}();return{margin:f(Ab,e.tradeAmount,r.price),phaseEndTime:f(Tb,t.phaseStartTime,n)}}),kb=function(e){var t=P(L(e.creationInfo,e.parameters),L(e.state,e.terms),e.phaseStartInfo);if("Just"===t.a.a.$&&"Just"===t.a.b.$&&"Just"===t.b.a.$&&"Just"===t.b.b.$&&"Just"===t.c.$){var r=t.a,n=r.a.a,a=r.b.a,i=t.b,o=i.a.a,u=i.b.a,s=t.c.a;return Eb(g(Sb,e.id,n,a,o,u,s,l(Bb,a,o,u)))}return Jy(e)},Nb=r(function(e,t){switch(t.$){case"PartiallyLoadedTrade":var r=t.a;return kb(U(r,{creationInfo:ya(e)}));case"LoadedTrade":f(kl,"Trying to update creation info on a trade that's already fully loaded!","");return t;default:return Cb}}),Rb=r(function(e,t){switch(t.$){case"PartiallyLoadedTrade":var r=t.a;return kb(U(r,{parameters:ya(e)}));case"LoadedTrade":t.a,f(kl,"Trying to update parameters on a trade that's already fully loaded!","");return t;default:return Cb}}),$b=r(function(e,t){switch(t.$){case"PartiallyLoadedTrade":var r=t.a;return kb(U(r,{phaseStartInfo:ya(e)}));case"LoadedTrade":t.a,f(kl,"Trying to update phaseStartInfo on a trade that's already fully loaded!","");return t;default:return Cb}}),xb=r(function(e,t){switch(t.$){case"PartiallyLoadedTrade":var r=t.a;return kb(U(r,{state:ya(e)}));case"LoadedTrade":var n=t.a;return Eb(U(n,{state:e}));default:return Cb}}),_b=r(function(e,t){switch(t.$){case"PartiallyLoadedTrade":var r=t.a;return kb(U(r,{terms:ya(e)}));case"LoadedTrade":t.a,f(kl,"Trying to update terms on a trade that's already fully loaded!","");return t;default:return Cb}}),Lb=c(function(e,t,r,n,a,i,o,u,s){return{abortPunishment:a,autoabortInterval:o,autorecallInterval:i,autoreleaseInterval:u,beneficiaryDeposit:n,initiatedByCustodian:t,initiator:e,pokeReward:s,tradeAmount:r}}),Pb=Po(f(im,jd,f(im,jd,f(im,jd,f(im,jd,f(im,jd,f(im,jd,f(im,jd,f(im,Io,f(im,Dd,rm(Lb))))))))))),Db=function(e){return{data:ya(f(df,"getParameters()",mr)),decoder:Pb,from:ma,gas:ma,gasPrice:ma,nonce:ma,to:ya(e),value:ma}},Ub=function(e){return f(jf,function(e){return Ff(1e3*e)},nl(Tl(e)))},Ob=a(function(e,t,r,n){if("Err"===t.$){var a=t.a;return wi(a)}var i=t.a;if("Err"===r.$){var a=r.a;return wi(a)}var o=r.a;if("Err"===n.$){var a=n.a;return wi(a)}var u=n.a;return Ii(l(e,i,o,u))}),Mb=function(e){var t=f(_l,"error converting BigInt to Time.Posix",Ub(e.autoabortInterval)),r=f(_l,"error converting BigInt to Time.Posix",Ub(e.autoreleaseInterval)),a=f(_l,"error converting BigInt to Time.Posix",Ub(e.autorecallInterval));return d(Ob,n(function(t,r,n){return{abortPunishment:Fv(e.abortPunishment),autoabortInterval:r,autorecallInterval:t,autoreleaseInterval:n,buyerDeposit:Fv(e.beneficiaryDeposit),initiatorAddress:e.initiator,initiatorRole:e.initiatedByCustodian?Of:ry,pokeReward:Fv(e.pokeReward),tradeAmount:Fv(e.tradeAmount)}}),a,t,r)},Fb=n(function(e,t,r){return f(vp,r,f(up,Mb,f(np,e.httpProvider,Db(t))))}),Vb=function(e){return function(t){return function(r){return function(n){return function(a){return function(i){return function(o){return function(u){return function(s){return function(c){return{v0:e,v1:t,v2:r,v3:n,v4:a,v5:i,v6:o,v7:u,v8:s,v9:c}}}}}}}}}}},Kb=Po(f(im,jd,f(im,jd,f(im,jd,f(im,jd,f(im,jd,f(im,jd,f(im,jd,f(im,jd,f(im,jd,f(im,jd,rm(Vb)))))))))))),Hb=function(e){return{data:ya(f(df,"getPhaseStartInfo()",mr)),decoder:Kb,from:ma,gas:ma,gasPrice:ma,nonce:ma,to:ya(e),value:ma}},jb=i(function(e,t,r,n,a){if("Nothing"===t.$)return ma;var i=t.a;if("Nothing"===r.$)return ma;var o=r.a;if("Nothing"===n.$)return ma;var u=n.a;if("Nothing"===a.$)return ma;var s=a.a;return ya(d(e,i,o,u,s))}),qb=function(e){return h(jb,a(function(t,r,n,a){return{claimedBlock:e.v3,claimedTime:n,closedBlock:e.v4,closedTime:a,committedBlock:e.v2,committedTime:r,openedBlock:e.v1,openedTime:t}}),Ub(e.v6),Ub(e.v7),Ub(e.v8),Ub(e.v9))},Gb=n(function(e,t,r){return f(vp,r,f(up,qb,f(np,e.httpProvider,Hb(t))))}),zb=i(function(e,t,r,n,a){return{balance:e,closedReason:a,phase:t,phaseStartTimestamp:r,responder:n}}),Yb=Po(f(im,jd,f(im,Dd,f(im,jd,f(im,jd,f(im,jd,rm(zb))))))),Wb=function(e){return{data:ya(f(df,"getState()",mr)),decoder:Yb,from:ma,gas:ma,gasPrice:ma,nonce:ma,to:ya(e),value:ma}},Jb={$:"Aborted"},Qb={$:"Burned"},Xb={$:"NotClosed"},Zb={$:"Recalled"},eC={$:"Released"},tC=function(e){switch(f(ec,99,nl(Tl(e)))){case 0:return ya(Xb);case 1:return ya(Zb);case 2:return ya(Jb);case 3:return ya(eC);case 4:return ya(Qb);default:return ma}},rC={$:"Closed"},nC={$:"Committed"},aC={$:"Judgment"},iC=function(e){switch(f(ec,99,nl(Tl(e)))){case 1:return ya(no);case 2:return ya(nC);case 3:return ya(aC);case 4:return ya(rC);default:return ma}},oC=function(e){return $(e,td("0x0000000000000000000000000000000000000000"))?ma:ya(e)},uC=a(function(e,t,r,n){if("Nothing"===t.$)return ma;var a=t.a;if("Nothing"===r.$)return ma;var i=r.a;if("Nothing"===n.$)return ma;var o=n.a;return ya(l(e,a,i,o))}),sC=function(e){var t=Ub(e.phaseStartTimestamp),r=iC(e.phase),a=tC(e.closedReason);return d(uC,n(function(t,r,n){return{balance:Fv(e.balance),closedReason:n,phase:t,phaseStartTime:r,responder:oC(e.responder)}}),r,t,a)},cC=n(function(e,t,r){return f(vp,r,f(up,sC,f(np,e.httpProvider,Wb(t))))}),fC=i(function(e,t,r,n,a){return ao(F([l(Fb,e,t,r),l(cC,e,t,n),l(Gb,e,t,a)]))}),lC=function(e){var t=zp(e);if("Just"===t.$){return t.a}f(kl,"Warning! BigInt to Int conversion failed!",Tl(e));return 0},dC=a(function(e,t,r,n){return{encapsulatedKey:e,iv:t,message:n,tag:r}}),hC=n(function(e,t,r){for(;;){var n=f(ci,32,e),a=n.a,i=n.b;if(_(bi(a),32)<0)return f(Ci,!0,{nodeList:t,nodeListSize:r,tail:a});var o=i,u=f(qa,ui(a),t),s=r+1;e=o,t=u,r=s}}),pC=function(e){return e.b?l(hC,e,mr,0):oi},gC=rn,vC=function(e){var t=h(gC,dC,f(Od,"encapsulation",xo),f(Od,"iv",xo),f(Od,"tag",xo),f(Od,"encrypted",xo)),r=Dm(t),n=f(Yd,r,e);if("Err"===n.$){var a=n.a;return wi(Qi(a))}var i=n.a;return function(e){var t=L(f(bc,0,e),f(bc,1,e));if("Just"===t.a.$&&"Just"===t.b.$){var r=t.a.a,n=t.b.a;return Ii(L(r,n))}return wi("Decoded list has less than 2 items.")}(pC(i))},yC=function(e){var t=function(e){var t=go(e);return t>1114111?wi("string is too long"):Ii(f(qu,Km(t),e))};return f(Eo,qi(""),Ad(f(tu,t,e)))},mC=function(e){var t=e.a,r=e.b;return yC(F([t.encapsulatedKey,t.iv,t.tag,t.message,r.encapsulatedKey,r.iv,r.tag,r.message]))},bC=r(function(e,t){return Jd(F([L("message",Gd(e)),L("pubkeyHexStrings",f(Wd,Gd,F([t.initiatorPubkey,t.responderPubkey])))]))}),CC=function(e){return{$:"LoadedCommInfo",a:e}},SC=r(function(e,t){return{initiatorPubkey:e,responderPubkey:t}}),EC=function(e){var t=L(e.initiatorPubkey,e.responderPubkey);if("Just"===t.a.$&&"Just"===t.b.$){var r=t.a.a,n=t.b.a;return CC(f(SC,r,n))}return Zy(e)},TC=r(function(e,t){if("PartiallyLoadedCommInfo"===t.$){var r=t.a;return EC(U(r,{initiatorPubkey:ya(e)}))}var n=t.a;return CC(U(n,{initiatorPubkey:e}))}),wC=r(function(e,t){if("PartiallyLoadedCommInfo"===t.$){var r=t.a;return EC(U(r,{responderPubkey:ya(e)}))}var n=t.a;return CC(U(n,{responderPubkey:e}))}),IC=r(function(e,t){var r=L(t,e);if("Initiator"===r.a.$){if("Buyer"===r.b.$){r.a,r.b;return ry}r.a,r.b;return Of}if("Buyer"===r.b.$){r.a,r.b;return Of}r.a,r.b;return ry}),AC=r(function(e,t){for(;;){if(!e.b)return t;var r=e.a,n=e.b,a=xi(r),i=f(al,a,n),o=Qu(f($s,a,n)),u=O(t,F([o])),s=i,c=u;e=s,t=c}}),BC=function(e){var t=pC(f(AC,bs(e),mr));return l(Yl,Ig,h(jb,dC,f(bc,0,t),f(bc,1,t),f(bc,2,t),f(bc,3,t)),h(jb,dC,f(bc,4,t),f(bc,5,t),f(bc,6,t),f(bc,7,t)))},kC={$:"Aborted"},NC={$:"Burned"},RC={$:"Claimed"},$C=function(e){return{$:"Committed",a:e}},xC=function(e){return{$:"Encrypted",a:e}},_C={$:"FailedDecode"},LC={$:"Initiated"},PC={$:"Recalled"},DC={$:"Released"},UC=function(e){return{$:"StateChange",a:e}},OC=function(e){return{$:"Statement",a:e}},MC=lr,FC=fr,VC=r(function(e,t){var r=bi(e),n=32-bi(t.tail)-r,a=l(MC,32,t.tail,e);return n<0?{nodeList:f(qa,ui(a),t.nodeList),nodeListSize:t.nodeListSize+1,tail:l(FC,n,r,e)}:n?{nodeList:t.nodeList,nodeListSize:t.nodeListSize,tail:a}:{nodeList:f(qa,ui(a),t.nodeList),nodeListSize:t.nodeListSize+1,tail:ii}}),KC=ur,HC=y,jC=a(function(e,t,r,n){var a=gc&t>>>e;if(_(a,bi(n))>-1){if(5===e)return f(KC,ui(r),n);var i=si(d(jC,e-ai,t,r,ii));return f(KC,i,n)}var o=f(vc,a,n);if("SubTree"===o.$){var u=o.a,i=si(d(jC,e-ai,t,r,u));return l(Ec,a,i,n)}var i=si(d(jC,e-ai,t,r,HC(o)));return l(Ec,a,i,n)}),qC=r(function(e,t){var r=t.a,n=t.b,a=t.c,i=t.d,o=bi(i),u=bi(e),s=r+(u-o);if($(u,32)){if(_(s>>>ai,1<0){var c=n+ai,f=d(jC,c,r,e,HC(si(a)));return d(ei,s,c,f,ii)}return d(ei,s,n,d(jC,n,r,e,a),ii)}return d(ei,s,n,a,e)}),GC=r(function(e,t){var r=(t.a,t.c,t.d),n=bi(e),a=32-bi(r)-n,i=l(MC,32,r,e),o=f(qC,i,t);if(a<0){var u=l(FC,a,n,e);return f(qC,u,o)}return o}),zC=sr,YC=function(e){var t=e.a,n=e.c,a=e.d,i=r(function(e,t){if("SubTree"===e.$){var r=e.a;return l(zC,i,t,r)}return f(qa,e,t)});return{nodeList:l(zC,i,mr,n),nodeListSize:t/32|0,tail:a}},WC=r(function(e,t){var n=(e.d,t.a),a=t.c,i=t.d;if(_(n,128)<1){var o=r(function(e,t){if("SubTree"===e.$){var r=e.a;return l(zC,o,t,r)}var n=e.a;return f(GC,n,t)});return f(GC,i,l(zC,o,e,a))}var o=r(function(e,t){if("SubTree"===e.$){var r=e.a;return l(zC,o,t,r)}var n=e.a;return f(VC,n,t)});return f(Ci,!0,f(VC,i,l(zC,o,YC(e),a)))}),JC=r(function(e,t){if("Nothing"===e.$)return t;var r=e.a;return f(qa,r,t)}),QC=f(Ja,JC,mr),XC=n(function(e,t,r){var n=IC(r.initiatorRole),a=function(){switch(t.$){case"InitiatedEvent":return ya(UC(LC));case"CommittedEvent":var r=t.a;return ya(UC($C(r.responder)));case"RecalledEvent":return ya(UC(PC));case"ClaimedEvent":return ya(UC(RC));case"AbortedEvent":return ya(UC(kC));case"ReleasedEvent":return ya(UC(DC));case"BurnedEvent":return ya(UC(NC));case"InitiatorStatementLogEvent":var r=t.a;return ya(OC({blocknum:e,message:function(){var e=BC(r.statement);if("Just"===e.$){var t=e.a;return xC(t)}return _C}(),who:n(gb)}));case"ResponderStatementLogEvent":var r=t.a;return ya(OC({blocknum:e,message:function(){var e=BC(r.statement);if("Just"===e.$){var t=e.a;return xC(t)}return _C}(),who:n(vb)}));default:return ma}}(),i=f(jf,function(t){return{blocknum:e,eventInfo:t,time:ma}},a);return L(U(r,{history:f(WC,r.history,pC(QC(F([i]))))}),function(){return"Just"===a.$&&"Statement"===a.a.$}())}),ZC=zr,eS=function(e){var t=l(Af,Ig,f(Od,"id",ZC),f(Od,"message",xo));return f(ql,Qi,f(Yd,t,e))},tS=function(e){return{$:"Decrypted",a:e}},rS=a(function(e,t,r,n){return{appCmds:n,maybeMessageSubmit:r,model:e,shouldCallDecrypt:t}}),nS=r(function(e,t){switch(e.$){case"NewEvent":var r=e.a,n=r.a,a=r.b,i=l(XC,n,a,t),o=i.a,u=i.b;return d(rS,o,u,ma,mr);case"MessageInputChanged":var s=e.a;return d(rS,U(t,{messageInput:s}),!1,ma,mr);case"MessageSubmit":return d(rS,U(t,{messageInput:""}),!1,ya(t.messageInput),mr);default:var c=e.a,h=eS(c);if("Ok"===h.$){var p=h.a,g=p.a,v=p.b,y=f(bc,g,t.history);if("Just"===y.$){var m=y.a,b=m.eventInfo;if("Statement"===b.$){var C=b.a,S=U(C,{message:tS(v)}),E=U(m,{eventInfo:OC(S)}),T=l(wc,g,E,t.history);return d(rS,U(t,{history:T}),!1,ma,mr)}return d(rS,t,!1,ma,F([Sf(f(Qp,"got a decryption result, but for an event that is not a message!",m))]))}return d(rS,t,!1,ma,F([Sf(f(Qp,"got a decryption result, but for an id out of bounds!",L(g,t.history)))]))}var w=h.a;return d(rS,t,!1,ma,F([Sf(f(Qp,"Error decoding decryption result",w))]))}}),aS=r(function(e,t){return{$:"ActionMined",a:e,b:t}}),iS=r(function(e,t){return{$:"ActionSigned",a:e,b:t}}),oS=function(e){return{onBroadcast:ma,onMined:ya(L(aS(e),ma)),onSign:ya(iS(e))}},uS=qe("encryptToPubkeys",to),sS=n(function(e,t,r){return{data:ya(f(df,"commit(address,string)",F([id(t),Ep(r)]))),decoder:_o(vr),from:ma,gas:ma,gasPrice:ma,nonce:ma,to:ya(e),value:ma}}),cS=n(function(e,t,r){return{data:ya(f(df,"commit(address,string)",F([id(t),Ep(r)]))),decoder:_o(vr),from:ma,gas:ma,gasPrice:ma,nonce:ma,to:ya(e),value:ma}}),fS=function(e){return{$:"CommitMined",a:e}},lS={$:"CommitNeedsSig"},dS=function(e){return{$:"CommitSigned",a:e}},hS=a(function(e,t,r,n){var a=function(){return"Token"===e.factoryType.$?cS:sS}(),i=mf(function(){return"Token"===e.factoryType.$?to:$p(Hf(mb(t.parameters)))}()(l(a,t.creationInfo.address,r,n)));return L(ya(lS),f(gf,{onBroadcast:ma,onMined:ya(L(fS,ma)),onSign:ya(dS)},i))}),pS=r(function(e,t){return Jd(F([L("id",yh(e)),L("encapsulation",Gd(t.encapsulatedKey)),L("iv",Gd(t.iv)),L("tag",Gd(t.tag)),L("encrypted",Gd(t.message))]))}),gS=qe("decryptMessage",to),vS=function(e){var t=e.a,n=r(function(e,t){var r=t.a,n=t.b;return L(r-1,f(qa,L(r,e),n))});return l(Oa,n,L(t-1,mr),e).b},yS=r(function(e,t){return ao(f(tu,function(e){var r=e.a,n=e.b,a=n.eventInfo;if("Statement"===a.$){var i=a.a,o=i.message;if("Encrypted"===o.$){var u=o.a,s=function(){return"Initiator"===t.$?u.a:u.b}();return gS(f(pS,r,s))}return io}return io},vS(e.history)))}),mS=function(e){if("Just"===e.$){return e.a}return ma},bS=function(e){var t=mS(l(Yl,yb,function(){var t=e.trade;if("LoadedTrade"===t.$){var r=t.a;return ya(r)}return ma}(),f(jf,function(e){return e.address},e.userInfo))),r=L(e.chatHistoryModel,t);if("Just"===r.a.$&&"Just"===r.b.$){var n=r.a.a,a=r.b.a;return f(yS,n,a)}return io},CS=r(function(e,t){return f(jf,function(t){var r=L(t,e.parameters.initiatorRole);if("Initiator"===r.a.$){if("Seller"===r.b.$){r.a,r.b;return Of}r.a,r.b;return ry}if("Seller"===r.b.$){r.a,r.b;return ry}r.a,r.b;return Of},f(yb,e,t))}),SS=r(function(e,t){return f(r(function(e,t){for(;;){var r=t.a,n=t.b;if(!e.b)return L(r,n);var a=e.a,i=a.a,o=a.b,u=e.b,s=l(XC,i,o,r),c=s.a,f=s.b,d=u,h=L(c,n||f);e=d,t=h}}),e,L(t,!1))}),ES=o(function(e,t,r,n,a,i){return{history:a,initiatorRole:n,messageInput:i,userInfo:t,userRole:r,web3Context:e}}),TS=i(function(e,t,r,n,a){return f(SS,a,p(ES,e,t,r,n,oi,""))}),wS=a(function(e,t,r,n){var a=L(t,r);if("LoadedTrade"===a.a.$&&"Just"===a.b.$){var i=a.a.a,o=a.b.a,u=f(CS,i,o.address);if("Just"===u.$){var s=u.a;return f(Qo,ya,h(TS,e,o,s,i.parameters.initiatorRole,n))}return L(ma,!1)}return L(ma,!1)}),IS={$:"Abort"},AS=r(function(e,t){return{$:"ActionMining",a:e,b:t}}),BS=function(e){return{$:"ActionNeedsSig",a:e}},kS=function(e){return{$:"ApproveMining",a:e}},NS={$:"ApproveNeedsSig"},RS=function(e){return{$:"ApproveSigned",a:e}},$S={$:"Burn"},xS=function(e){return{$:"ChatHistoryMsg",a:e}},_S={$:"Claim"},LS=function(e){return{$:"CommitMining",a:e}},PS=function(e){return{$:"ConfirmingAction",a:e}},DS=n(function(e,t,r){return{$:"ConfirmingCommit",a:e,b:t,c:r}}),US=function(e){return{$:"EventLogFetched",a:e}},OS=function(e){return{$:"ParametersFetched",a:e}},MS=function(e){return{$:"PhaseInfoFetched",a:e}},FS={$:"Poke"},VS={$:"Recall"},KS={$:"Release"},HS=function(e){return{$:"StartContractAction",a:e}},jS=function(e){return{$:"StateFetched",a:e}},qS=function(e){switch(e.$){case"Poke":return"poke";case"Recall":return"recall";case"Claim":return"claim";case"Abort":return"abort";case"Release":return"release";default:return"burn"}},GS=function(e){return d(dm,e,io,co,mr)},zS={align:Yp,mainParagraphs:F([F([Jp("Can't find a trade by that ID. I'll try again in half a second.")])]),noticeType:Xp},YS=r(function(e,t){if("Err"===t.$){var r=t.a;return f(Zp,e,r)}if("Nothing"===t.a.$){t.a;return f(Qp,"Couldn't decode the fetched \""+e+'" result.',ma)}return f(Qp,"fromBadFetchResultMaybe being called with an 'OK (Just a)' value",t)}),WS={align:Yp,mainParagraphs:F([F([Jp("Sorry, I'm not yet able to deal with this kind of trade. This must have been created by some other DAIHard interface.")])]),noticeType:Xp},JS=r(function(e,t){return{$:"GetLogs",a:e,b:t}}),QS=n(function(e,t,r){return l(Dh,e,jf(function(e){return U(e,{logCount:Oi(t)+e.logCount})}),r)}),XS=r(function(e,t){var r=t.a;return ym(f(Ph,e,r))}),ZS=n(function(e,t,r){var n=e.a,a=f(Sh,t,n.requests);if("Nothing"===a.$)return L(vm(n),io);var i=a.a,o=L(i.watchOnce,Xf(r));if("Nothing"===o.b.$){o.b;return L(vm(U(n,{requests:l(QS,t,r,n.requests)})),io)}if(o.a){var u=o.b.a;return L(vm(U(n,{requests:l(QS,t,r,n.requests),watching:f(XS,t,n.watching)})),f(dg,i.tagger,Qh(u)))}return L(vm(U(n,{requests:l(QS,t,r,n.requests)})),ao(f(tu,function(e){return f(dg,i.tagger,Qh(e))},r)))}),eE=_e,tE=r(function(e,t){return f(vp,f($a,gm,t),f(ip,function(t){return pm(e)},eE(2e3)))}),rE=se,nE=fe,aE=n(function(e,t,r){var n=function(e){return nE(F([e,rE(r)]))};return f(Ro,function(a){var i=f(Yd,e,a);if("Ok"===i.$){var o=i.a,u=f(Yd,n(t),o);if("Ok"===u.$){var s=u.a;return _o(s)}var c=u.a;return $o(Qi(c))}return _o(r)},Zi)}),iE=a(function(e,t,r,n){return f(dd,l(aE,f(Od,e,Zi),t,r),n)}),oE=n(function(e,t,r){return f(dd,f(Od,e,t),r)}),uE=Lo(Pd),sE=gd(f(ec,md,yd("^((0[Xx]){1})?[0-9a-fA-F]{64}$"))),cE=function(e){return{$:"BlockHash",a:e}},fE=function(e){return sE(e)?Ii(cE(Bo(e))):wi("Given blockHash "+Ld(e)+" is not valid.")},lE=Lo(fE),dE=function(e){return{$:"TxHash",a:e}},hE=function(e){return sE(e)?Ii(dE(Bo(e))):wi("Given txHash "+Ld(e)+" is not valid.")},pE=Lo(hE),gE=c(function(e,t,r,n,a,i,o,u,s){return{address:e,blockHash:u,blockNumber:s,data:t,logIndex:a,removed:n,topics:r,transactionHash:o,transactionIndex:i}}),vE=Yr,yE=l(oE,"blockNumber",hm,l(oE,"blockHash",lE,l(oE,"transactionHash",pE,l(oE,"transactionIndex",hm,l(oE,"logIndex",hm,d(iE,"removed",vE,!1,l(oE,"topics",Dm(lb),l(oE,"data",xo,l(oE,"address",uE,_o(gE)))))))))),mE=function(e){return f(Wd,function(e){if("Just"===e.$){var t=e.a;return Gd(lf(t))}return uh},e)},bE=function(e){return Jd(F([L("fromBlock",nh(e.fromBlock)),L("toBlock",nh(e.toBlock)),L("address",ah(e.address)),L("topics",mE(e.topics))]))},CE=r(function(e,t){return ep({decoder:Dm(yE),method:"eth_getLogs",params:F([bE(t)]),url:e})}),SE=function(e){return{$:"BlockNum",a:e}},EE=n(function(e,t,r){var n=r.a,a=r.b;return"BlockNum"===t.toBlock.$?f(ip,function(r){return f(up,$i(r),f(CE,e,U(t,{fromBlock:SE(n),toBlock:SE(a)})))},f(CE,e,t)):f(CE,e,t)}),TE=n(function(e,t,r){var n=r.a,a=r.b;return f(CE,e,U(t,{fromBlock:SE(n),toBlock:SE(a)}))}),wE=n(function(e,t,r){for(;;){if("RBEmpty_elm_builtin"===r.$)return t;var n=r.b,a=r.c,i=r.d,o=r.e,u=e,s=l(e,n,a,l(wE,e,t,i)),c=o;e=u,t=s,r=c}}),IE=r(function(e,t){return l(wE,Bh,t,e)}),AE=r(function(e,t){var r=e.a,n=t.a;return ym(f(IE,r,n))}),BE=r(function(e,t){var r=t.a;if("BlockNumber"===e.$){if("Ok"===e.a.$){var a=e.a.a,i=n(function(e,t,n){return ao(f(tu,function(t){return f(vp,f($a,JS(t.ref),r.tagger),l(n,r.nodePath,t.logFilter,e))},QC(f(tu,function(e){return f(Sh,e,r.requests)},ja(t)))))}),o=r.blockNumber;if("Just"===o.$){var u=o.a;return a-u?L(vm(U(r,{blockNumber:ya(a)})),ao(F([f(tE,r.nodePath,r.tagger),l(i,L(u+1,a),r.watching,TE)]))):L(t,f(tE,r.nodePath,r.tagger))}return L(vm(U(r,{blockNumber:ya(a),pending:mm,watching:f(AE,r.watching,r.pending)})),ao(F([f(tE,r.nodePath,r.tagger),l(i,L(a,a),r.pending,EE),l(i,L(a,a),r.watching,TE)])))}var s=e.a.a;return L(vm(U(r,{errors:f(qa,s,r.errors)})),f(tE,r.nodePath,r.tagger))}if("Ok"===e.b.$){var c=e.a,d=e.b.a;return l(ZS,t,c,d)}var s=e.b.a;return L(vm(U(r,{errors:f(qa,s,r.errors)})),io)}),kE=r(function(e,t){var r=t.a;return ym(l(Bh,e,vr,r))}),NE=a(function(e,t,r,n){var a=r.a,i={logCount:0,logFilter:n,ref:a.ref,tagger:t,watchOnce:e},o=U(a,{ref:a.ref+1,requests:l(Bh,a.ref,i,a.requests)}),u=a.blockNumber;if("Just"===u.$){var s=u.a;return function(e){return P(vm(U(o,{watching:f(kE,a.ref,o.watching)})),f(vp,f($a,JS(a.ref),a.tagger),e),a.ref)}(l(EE,a.nodePath,n,L(s,s)))}return P(vm(U(o,{pending:f(kE,a.ref,o.pending)})),io,a.ref)}),RE=NE(!1),$E=function(e){return F([e])},xE=r(function(e,t){e:for(;;)switch(e.$){case"Refresh":var r=(e.a,function(){var e=t.trade;if("PartiallyLoadedTrade"===e.$){var r=e.a;return"Nothing"===r.creationInfo.$?f(fm,t.web3Context,r.id):io}return io}()),n=function(){var e=P(t.userInfo,t.trade,t.web3Context.factoryType);if("Just"===e.a.$&&"LoadedTrade"===e.b.$&&"Token"===e.c.$){var r=e.a.a,n=e.b.a,a=e.c.a;return h(yp,t.web3Context,a,r.address,n.creationInfo.address,_y)}return io}(),a=function(){return"Nothing"===t.chatHistoryModel.$?d(wS,t.web3Context,t.trade,t.userInfo,t.eventsWaitingForChatHistory):L(t.chatHistoryModel,!1)}(),i=a.a,o=a.b,u=U(t,{chatHistoryModel:i}),s=o?bS(t):io,c=t.trade;if("LoadedTrade"===c.$){var p=c.a;return d(dm,u,ao(F([l(cC,t.web3Context,p.creationInfo.address,jS),s,r,n])),co,mr)}return GS(u);case"AllowanceFetched":var g=e.a;if("Ok"===g.$){var v=g.a,u=U(t,{allowance:ya(v)}),y=P(u.txChainStatus,u.trade,u.userInfo);if("Just"===y.a.$&&"ApproveMining"===y.a.a.$&&"LoadedTrade"===y.b.$&&"Just"===y.c.$){var m=y.b.a,b=y.c.a;if($(f(Su,v,Hf(mb(m.parameters))),Da))return GS(u);var C=d(hS,t.web3Context,m,b.address,b.commPubkey),S=C.a,E=C.b;return d(dm,U(u,{txChainStatus:S}),io,E,mr)}return GS(u)}var T=g.a;return d(dm,t,io,co,F([Sf(f(Zp,"allowance",T))]));case"CreationInfoFetched":var g=e.a;if("Ok"===g.$){var w=g.a,I={address:w.address_,blocknum:lC(w.blocknum)},A=l(RE,US,t.eventSentry,{address:I.address,fromBlock:SE(I.blocknum),toBlock:rp,topics:mr}),B=A.a,k=A.b,u=U(t,{eventSentry:B,trade:f(Nb,I,t.trade)}),N=ao(F([k,h(fC,u.web3Context,I.address,OS,jS,MS)]));return d(dm,u,N,co,mr)}if("BadBody"===g.a.$){g.a.a;return d(dm,t,io,co,F([Sf(zS)]))}var T=g.a;return d(dm,t,io,co,F([Sf(f(Zp,"trade state",T))]));case"StateFetched":var g=e.a;if("Ok"===g.$&&"Just"===g.a.$){var R=g.a.a,x=function(){var e=t.trade;switch(e.$){case"PartiallyLoadedTrade":return!0;case"LoadedTrade":return!$(e.a.state.phase,R.phase);default:return!1}}(),u=U(t,{expandedPhase:x?R.phase:t.expandedPhase,trade:f(xb,R,t.trade)});return d(dm,u,bS(u),co,mr)}return d(dm,t,io,co,F([Sf(f(YS,"trade state",g))]));case"ParametersFetched":var g=e.a;if("Ok"===g.$){if("Ok"===g.a.$){var _=g.a.a;if(bb(_)){var u=U(t,{trade:f(Rb,_,t.trade)});return d(dm,u,bS(u),co,mr)}return d(dm,t,io,co,F([Sf(WS)]))}var D=g.a.a;return d(dm,t,io,co,F([Sf(f(Qp,"Error decoding fetched trade parameters",D))]))}var M=g.a;return d(dm,t,io,co,F([Sf(f(Zp,"trade parameters",M))]));case"PhaseInfoFetched":var g=e.a;if("Ok"===g.$&&"Just"===g.a.$){var V=g.a.a,u=U(t,{trade:f($b,V,t.trade)});return d(dm,u,bS(u),co,mr)}return d(dm,t,io,co,F([Sf(f(YS,"trade state",g))]));case"EventLogFetched":var K=e.a,H=f(Qd,pb,K),j=H.returnData;if("Err"===j.$){var q=j.a;return d(dm,t,io,co,F([Sf(f(Qp,"Error decoding contract event",q))]))}var G=j.a,z=function(){switch(G.$){case"InitiatedEvent":var e=G.a;return f(TC,e.commPubkey,t.secureCommInfo);case"CommittedEvent":var e=G.a;return f(wC,e.commPubkey,t.secureCommInfo);default:return t.secureCommInfo}}(),Y=function(){if("InitiatedEvent"===G.$){var e=G.a,r=Um(e.terms);if("Ok"===r.$){var n=r.a;return L(f(_b,n,t.trade),ma)}var a=r.a;return L(t.trade,ya(f(Qp,"Couldn't decode payment methods!",a)))}return L(t.trade,ma)}(),W=Y.a,J=Y.b,Q=function(){var e=t.chatHistoryModel;if("Just"===e.$){var r=e.a;return f(Qo,ya,l(XC,H.blockNumber,G,r))}return d(wS,t.web3Context,W,t.userInfo,t.eventsWaitingForChatHistory)}(),i=Q.a,o=Q.b,X=function(){return"Nothing"===i.$?f(Qa,t.eventsWaitingForChatHistory,F([L(H.blockNumber,G)])):mr}(),u=U(t,{chatHistoryModel:i,eventsWaitingForChatHistory:X,secureCommInfo:z,trade:W}),N=o?bS(u):io;return d(dm,u,N,co,f(tu,Sf,QC(F([J]))));case"ExpandPhase":var Z=e.a;return GS(U(t,{expandedPhase:Z}));case"ToggleChat":var ee=!t.showChatHistory;return GS(U(t,{showChatHistory:ee}));case"ToggleStatsModal":var te=!t.showStatsModal;return GS(U(t,{showStatsModal:te}));case"ViewUserHistory":var re=e.a,ne=t.trade;if("LoadedTrade"===ne.$){var m=ne.a;return d(dm,t,io,co,F([lo(f(vf,m.parameters.initiatorAddress,re))]))}return d(dm,t,io,co,F([Sf(f(Qp,"Trying to view a user's history for a not-yet-loaded Trade",t.trade))]));case"CommitClicked":var m=e.a,b=e.b,ae=e.c;return GS(U(t,{txChainStatus:ya(l(DS,m,b,ae))}));case"AbortAction":return GS(U(t,{txChainStatus:ma}));case"ConfirmCommit":var m=e.a,b=e.b,ae=e.c,ie=function(){var e=t.web3Context.factoryType;if("Native"===e.$)return d(hS,t.web3Context,m,b.address,b.commPubkey);var r=e.a,n=function(){var e=mf(l(sd,nd(r),m.creationInfo.address,ae)),t={onBroadcast:ma,onMined:ma,onSign:ya(RS)};return f(gf,t,e)}(),a=t.allowance;if("Just"===a.$){var i=a.a;return $(f(Su,i,Hf(mb(m.parameters))),Da)?L(ya(NS),n):d(hS,t.web3Context,m,b.address,b.commPubkey)}return L(ya(NS),n)}(),S=ie.a,E=ie.b;return d(dm,U(t,{txChainStatus:S}),io,E,mr);case"ContractActionClicked":var oe=e.a;if($(oe,FS)||$(oe,VS)){var ue=HS(oe),se=t;e=ue,t=se;continue e}return GS(U(t,{txChainStatus:ya(PS(oe))}));case"StartContractAction":var ce=e.a,fe=function(){var e=t.trade;if("LoadedTrade"!==e.$){var r=e;return P(t.txChainStatus,co,F([Sf(f(Qp,"Trying to handle StartContractAction msg for a not-yet-loaded Trade",r))]))}var n=e.a;switch(ce.$){case"Recall":var a=mf(Im(n.creationInfo.address));return P(ya(BS(VS)),f(gf,oS(VS),a),mr);case"Claim":var a=mf(Tm(n.creationInfo.address));return P(ya(BS(_S)),f(gf,oS(_S),a),mr);case"Abort":var a=mf(Sm(n.creationInfo.address));return P(ya(BS(IS)),f(gf,oS(IS),a),mr);case"Release":var a=mf(Am(n.creationInfo.address));return P(ya(BS(KS)),f(gf,oS(KS),a),mr);case"Burn":var a=mf(Em(n.creationInfo.address));return P(ya(BS($S)),f(gf,oS($S),a),mr);default:var a=mf(hf(n.creationInfo.address));return P(ya(BS(FS)),f(gf,oS(FS),a),mr)}}(),S=fe.a,E=fe.b,le=fe.c;return d(dm,U(t,{txChainStatus:S}),io,E,le);case"ApproveSigned":var de=e.a;if("Ok"===de.$){var he=de.a;return GS(U(t,{txChainStatus:ya(kS(he))}))}var D=de.a;return d(dm,U(t,{txChainStatus:ma}),io,co,F([Sf(f(rg,"approve",D))]));case"CommitSigned":var de=e.a;if("Ok"===de.$){var he=de.a;return GS(U(t,{txChainStatus:ya(LS(he))}))}var D=de.a;return d(dm,U(t,{txChainStatus:ma}),io,co,F([Sf(f(rg,"commit",D))]));case"CommitMined":return GS(U(t,{txChainStatus:ma}));case"ActionSigned":var oe=e.a,de=e.b;if("Ok"===de.$){var he=de.a;return GS(U(t,{txChainStatus:ya(f(AS,oe,he))}))}var D=de.a;return d(dm,U(t,{txChainStatus:ma}),io,co,F([Sf(f(rg,qS(oe),D))]));case"ActionMined":var oe=e.a;return GS(U(t,{txChainStatus:ma}));case"EventSentryMsg":var pe=e.a,ge=f(BE,pe,t.eventSentry),ve=ge.a,N=ge.b;return d(dm,U(t,{eventSentry:ve}),N,co,mr);case"ChatHistoryMsg":var ye=e.a,me=t.chatHistoryModel;if("Just"===me.$){var be=me.a,Ce=f(nS,ye,be),Se=U(t,{chatHistoryModel:ya(Ce.model)}),s=Ce.shouldCallDecrypt?bS(t):io,Ee=function(){var e=Ce.maybeMessageSubmit;if("Just"===e.$){var r=e.a,n=t.secureCommInfo;if("LoadedCommInfo"===n.$){var a=n.a;return L(uS(f(bC,r,a)),ma)}return L(io,ya(f(Qp,"Trying to encrypt, but commInfo is not loaded",n)))}return L(io,ma)}(),Te=Ee.a,we=Ee.b;return d(dm,Se,ao(F([s,Te])),co,O(f(Uf,xS,Ce.appCmds),f(ec,mr,f(jf,$E,f(jf,Sf,we)))))}return d(dm,t,io,co,F([Sf(f(Qp,"Got a chat history message, but there is no chat history model!",ye))]));case"EncryptionFinished":var Ie=e.a,Ae=f(eh,mC,vC(Ie)),Be=P(t.userInfo,t.trade,Ae);if("Ok"===Be.c.$){if("Just"===Be.a.$&&"LoadedTrade"===Be.b.$){var b=Be.a.a,p=Be.b.a,ke=Be.c.a,Ne=f(yb,p,b.address);if("Nothing"===Ne.$)return d(dm,t,io,co,F([Sf(f(Qp,"Trying to encrypt, but the user is not involved in this trade.",ma))]));var Re=Ne.a,$e=function(){return mf("Initiator"===Re.$?f(wm,p.creationInfo.address,ke):f(Bm,p.creationInfo.address,ke))}();return d(dm,t,io,f(gf,{onBroadcast:ma,onMined:ma,onSign:ma},$e),mr)}var xe=Be.a,_e=Be.b;return d(dm,t,io,co,F([Sf(f(Qp,"Encryption successful, but the user or trade is no longer valid.",L(xe,_e)))]))}var Le=Be.c.a;return d(dm,t,io,co,F([Sf(f(Qp,"Error translating JS encryption result into Elm.",Le))]));case"MessageSubmitMined":if("Ok"===e.a.$){e.a.a;return GS(t)}var D=e.a.a;return d(dm,t,io,co,F([Sf(f(eg,"message",D))]));default:return d(dm,t,io,co,F([Ef]))}}),_E=function(e){return{$:"EventSentryMsg",a:e}},LE=n(function(e,t,r){return{invalid:r,loaded:t,total:e}}),PE=function(e){var t=f(bm,_E,e.httpProvider),r=t.a,n=t.b;return L({dataFetchStatus:l(LE,ma,0,0),eventSentry:r,trades:oi,web3Context:e},n)},DE=function(e){return{data:ya(f(df,"numTrades()",mr)),decoder:Po(jd),from:ma,gas:ma,gasPrice:ma,nonce:ma,to:ya(e),value:ma}},UE=r(function(e,t){return f(vp,t,f(np,e.httpProvider,DE(rd(e.factoryType))))}),OE=function(e){return{$:"InitialNumTradesFetched",a:e}},ME=function(e){return f(UE,e.web3Context,OE)},FE=function(e){var t=PE(e),r=t.a,n=t.b;return L(r,ao(F([n,ME(r)])))},VE=r(function(e,t){return{address:e,blocknum:t}}),KE=n(function(e,t,r){return function(e){return L(e.a,e.b)}(d(NE,!0,e,t,r))}),HE=n(function(e,t,r){var n=function(e){return r(f(Qd,Ym,e).returnData)},a={address:t.address,fromBlock:SE(t.blocknum),toBlock:SE(t.blocknum),topics:F([ya(hb("Initiated(string,string)"))])};return l(KE,n,e,a)}),jE=n(function(e,t,r){var n=e(t);if("Just"===n.$){var a=n.a;return f(qa,a,r)}return r}),qE=r(function(e,t){return l(Ja,jE(e),mr,t)}),GE=function(e){return f(qE,function(e){if("LoadedTrade"===e.$){var t=e.a;return ya(t)}return ma},Ma(e.trades))},zE=function(e){return f(za,r(function(t,r){return e(t)?r+1:r}),0)},YE=function(e){return f(zE,di(Cb),Ma(e.trades))},WE=function(e){return U(e,{dataFetchStatus:U(e.dataFetchStatus,{invalid:YE(e),loaded:Oi(GE(e))})})},JE=n(function(e,t,r){return{appCmds:r,cmd:t,tradeCache:e}}),QE=r(function(e,t){var r=f(bc,e,t.trades);if("Just"===r.$){var n=(r.a,l(wc,e,Cb,t.trades));return l(JE,WE(U(t,{trades:n})),io,mr)}return l(JE,t,io,F([Sf(f(Qp,"markTradeInvalid ran into an out-of-range error",L(e,t.trades)))]))}),XE=n(function(e,t,r){var n=f(bc,e,r.trades);if("Just"===n.$){var a=n.a,i=f(Nb,t,a),o=l(wc,e,i,r.trades);return L(WE(U(r,{trades:o})),mr)}return L(r,F([f(Qp,"updateTradeAddress ran into an out-of-range error",L(e,r.trades))]))}),ZE=n(function(e,t,r){var n=f(bc,e,r.trades);if("Just"===n.$){var a=n.a,i=f(Rb,t,a),o=l(wc,e,i,r.trades);return l(JE,WE(U(r,{trades:o})),io,mr)}return l(JE,r,io,F([Sf(f(Qp,"updateTradeParameters ran into an out-of-range error",L(e,r.trades)))]))}),eT=n(function(e,t,r){var n=f(bc,e,r.trades);if("Just"===n.$){var a=n.a,i=f($b,t,a),o=l(wc,e,i,r.trades);return l(JE,WE(U(r,{trades:o})),io,mr)}return l(JE,r,io,F([Sf(f(Qp,"updateTradePhaseTimeInfo ran into an out-of-range error",L(e,r.trades)))]))}),tT=n(function(e,t,r){var n=f(bc,e,r.trades);if("Just"===n.$){var a=n.a,i=f(xb,t,a),o=l(wc,e,i,r.trades);return l(JE,WE(U(r,{trades:o})),io,mr)}return l(JE,r,io,F([Sf(f(Qp,"updateTradeState ran into an out-of-range error",L(e,r.trades)))]))}),rT=n(function(e,t,r){var n=f(bc,e,r.trades);if("Just"===n.$){var a=n.a,i=f(_b,t,a),o=l(wc,e,i,r.trades);return l(JE,WE(U(r,{trades:o})),io,mr)}return l(JE,r,io,F([Sf(f(Qp,"updateTTPaymentMethods ran into an out-of-range error",L(e,r.trades)))]))}),nT=r(function(e,t){return{$:"CreationInfoFetched",a:e,b:t}}),aT=r(function(e,t){return{$:"InitiatedEventDataFetched",a:e,b:t}}),iT=function(e){return{$:"NumTradesFetchedAgain",a:e}},oT=r(function(e,t){return{$:"ParametersFetched",a:e,b:t}}),uT=r(function(e,t){return{$:"PhaseStartInfoFetched",a:e,b:t}}),sT=r(function(e,t){return{$:"StateFetched",a:e,b:t}}),cT=function(e){return l(JE,e,io,mr)},fT=r(function(e,t){switch(e.$){case"InitialNumTradesFetched":var r=e.a;if("Ok"===r.$){var n=r.a,a=lC(n),i=pC(f(tu,Qy,f(Vi,0,a-1))),o=ao(f(tu,function(e){return l(sm,t.web3Context,lu(e),nT(e))},f(Vi,0,a-1)));return l(JE,U(t,{dataFetchStatus:l(LE,ya(a),0,0),trades:i}),o,mr)}var u=r.a;return l(JE,t,io,F([Sf(f(Zp,"Factory numTrades",u))]));case"CheckForNewTrades":return l(JE,t,f(UE,t.web3Context,iT),mr);case"NumTradesFetchedAgain":var r=e.a,s=L(r,t.dataFetchStatus.total);if("Ok"===s.a.$){if("Just"===s.b.$){var n=s.a.a,c=s.b.a,d=lC(n);if(_(c,d)<0){var p=t.dataFetchStatus,o=ao(f(tu,function(e){return l(sm,t.web3Context,lu(e),nT(e))},f(Vi,c,d-1))),g=pC(f(tu,Qy,f(Vi,c,d-1)));return l(JE,U(t,{dataFetchStatus:U(p,{total:ya(d)}),trades:f(WC,t.trades,g)}),o,mr)}return cT(t)}s.b;return l(JE,t,io,F([Sf(f(Qp,"Trying to fetch additional trades, but there is an unexpected Nothing in the existing numTrades.",""))]))}var u=s.a.a;return l(JE,t,io,F([Sf(f(Zp,"Factory numTrades",u))]));case"CreationInfoFetched":var v=e.a,r=e.b;if("Ok"===r.$){var y=r.a,m=f(VE,y.address_,lC(y.blocknum)),b=l(HE,t.eventSentry,m,aT(v)),C=b.a,S=b.b,E=ao(F([h(fC,t.web3Context,m.address,oT(v),sT(v),uT(v)),S])),T=l(XE,v,m,t),w=T.a,I=T.b;return l(JE,WE(U(w,{eventSentry:C})),E,f(tu,Sf,I))}var u=r.a;return l(JE,t,io,F([Sf(f(Zp,"creationInfo",u))]));case"ParametersFetched":var v=e.a,r=e.b;if("Err"===r.$){var A=r.a;return l(JE,t,io,F([Sf(f(Zp,"parameters",A))]))}if("Ok"===r.a.$){var B=r.a.a;return l(ZE,v,B,t)}var k=r.a.a;return l(JE,t,io,F([Sf(f(Qp,"Can't decode fetched trade parameters",k))]));case"StateFetched":var v=e.a,r=e.b;if("Ok"===r.$&&"Just"===r.a.$){var N=r.a.a;return l(tT,v,N,t)}return l(JE,t,io,F([Sf(f(YS,"state",r))]));case"PhaseStartInfoFetched":var v=e.a,r=e.b;if("Ok"===r.$&&"Just"===r.a.$){var R=r.a.a;return l(eT,v,R,t)}return l(JE,t,io,F([Sf(f(YS,"phaseStartInfo",r))]));case"InitiatedEventDataFetched":var v=e.a,r=e.b;if("Ok"===r.$){var $=r.a,x=Um($.terms);if("Ok"===x.$){var P=x.a;return l(rT,v,P,t)}var D=x.a;return f(QE,v,t)}var D=r.a;return l(JE,t,io,F([Sf(f(Qp,"Error decoding initiated event",D))]));default:var O=e.a,M=f(BE,O,t.eventSentry),V=M.a,E=M.b;return l(JE,U(t,{eventSentry:V}),E,mr)}}),lT=function(e){return{$:"AgentHistoryMsg",a:e}},dT=function(e){return{$:"AppCmd",a:e}},hT={$:"BetaLandingPage"},pT={$:"ConnectToWeb3"},gT=function(e){return{$:"MarketplaceMsg",a:e}},vT=function(e){return{$:"TradeCacheMsg",a:e}},yT=r(function(e,t){return f(jn,e,Gd(t))}),mT=function(e){return f(yT,"href",it(e))},bT=qn("rel"),CT=yT("target"),ST=function(e){return{$:"Height",a:e}},ET=ST,TT={$:"Content"},wT=TT,IT=function(e){return{$:"Width",a:e}},AT=IT,BT=function(e){return{$:"Attr",a:e}},kT=function(e){return{$:"NodeName",a:e}},NT=function(e){return{$:"Unkeyed",a:e}},RT={$:"AsEl"},$T=RT,xT=r(function(e,t){return{$:"Field",a:e,b:t}}),_T=f(xT,0,0),LT={$:"NoNearbyChildren"},PT={above:"a",active:"atv",alignBottom:"ab",alignCenterX:"cx",alignCenterY:"cy",alignContainerBottom:"acb",alignContainerCenterX:"accx",alignContainerCenterY:"accy",alignContainerRight:"acr",alignLeft:"al",alignRight:"ar",alignTop:"at",alignedHorizontally:"ah",alignedVertically:"av",any:"s",behind:"bh",below:"b",bold:"w7",borderDashed:"bd",borderDotted:"bdt",borderNone:"bn",borderSolid:"bs",capturePointerEvents:"cpe",clip:"cp",clipX:"cpx",clipY:"cpy",column:"c",container:"ctr",contentBottom:"cb",contentCenterX:"ccx",contentCenterY:"ccy",contentLeft:"cl",contentRight:"cr",contentTop:"ct",cursorPointer:"cptr",cursorText:"ctxt",focus:"fcs",fullSize:"fs",grid:"g",hasBehind:"hbh",heightContent:"hc",heightFill:"hf",heightFillPortion:"hfp",hover:"hv",imageContainer:"ic",inFront:"fr",inputMultiline:"iml",inputText:"it",italic:"i",nearby:"nb",noTextSelection:"notxt",onLeft:"ol",onRight:"or",opaque:"oq",overflowHidden:"oh",page:"pg",paragraph:"p",passPointerEvents:"ppe",root:"ui",row:"r",scrollbars:"sb",scrollbarsX:"sbx",scrollbarsY:"sby",seButton:"sbt",single:"e",sizeByCapital:"cap",spaceEvenly:"sev",strike:"sk",text:"t",textCenter:"tc",textExtraBold:"w8",textExtraLight:"w2",textHeavy:"w9",textJustify:"tj",textJustifyAll:"tja",textLeft:"tl",textLight:"w3",textMedium:"w5",textNormalWeight:"w4",textRight:"tr",textSemiBold:"w6",textThin:"w1",textUnitalicized:"tun",transition:"ts",transparent:"clr",underline:"u",widthContent:"wc",widthExact:"we",widthFill:"wf",widthFillPortion:"wfp",wrapped:"wrp"},DT=PT.any+" "+PT.column,UT=PT.any+" "+PT.grid,OT=PT.any+" "+PT.page,MT=PT.any+" "+PT.paragraph,FT=PT.any+" "+PT.row,VT=PT.any+" "+PT.single,KT=function(e){switch(e.$){case"AsRow":return FT;case"AsColumn":return DT;case"AsEl":return VT;case"AsGrid":return UT;case"AsParagraph":return MT;default:return OT}},HT=function(e){return{$:"Keyed",a:e}},jT={$:"NoStyleSheet"},qT=r(function(e,t){switch(t.$){case"NoNearbyChildren":return e;case"ChildrenBehind":var r=t.a;return O(r,e);case"ChildrenInFront":var n=t.a;return O(e,n);default:var r=t.a,n=t.b;return O(r,O(e,n))}}),GT=n(function(e,t,r){switch(r.$){case"NoNearbyChildren":return t;case"ChildrenBehind":var n=r.a;return O(f(tu,function(t){return L(e,t)},n),t);case"ChildrenInFront":var a=r.a;return O(t,f(tu,function(t){return L(e,t)},a));default:var n=r.a,a=r.b;return O(f(tu,function(t){return L(e,t)},n),O(t,f(tu,function(t){return L(e,t)},a)))}}),zT={$:"AsParagraph"},YT=zT,WT=On("div"),JT=On("p"),QT=On("s"),XT=On("u"),ZT=yT("className"),ew=function(e){return Fn(rt(e))},tw=function(e){return On(rt(e))},rw=function(e){return{$:"Flag",a:e}},nw=function(e){return{$:"Second",a:e}},aw=function(e){return e>31?nw(1< .ctr > ."+PT.any+" {\n border: 4px dashed rgb(0, 151, 167) !important;\n}\n\n",iI="@media screen and (-ms-high-contrast: active), (-ms-high-contrast: none) {"+Aw(PT.any)+Aw(PT.row)+" > "+Aw(PT.any)+" { flex-basis: auto !important; } "+Aw(PT.any)+Aw(PT.row)+" > "+Aw(PT.any)+Aw(PT.container)+" { flex-basis: auto !important; }}\n\n/* General Input Reset */\ninput[type=range] {\n -webkit-appearance: none; /* Hides the slider so that custom slider can be made */\n /* width: 100%; Specific width is required for Firefox. */\n background: transparent; /* Otherwise white in Chrome */\n position:absolute;\n left:0;\n top:0;\n z-index:10;\n width: 100%;\n outline: dashed 1px;\n height: 100%;\n opacity: 0;\n}\n\n/* Hide all syling for track */\ninput[type=range]::-moz-range-track {\n background: transparent;\n cursor: pointer;\n}\ninput[type=range]::-ms-track {\n background: transparent;\n cursor: pointer;\n}\ninput[type=range]::-webkit-slider-runnable-track {\n background: transparent;\n cursor: pointer;\n}\n\n/* Thumbs */\ninput[type=range]::-webkit-slider-thumb {\n -webkit-appearance: none;\n opacity: 0.5;\n width: 80px;\n height: 80px;\n background-color: black;\n border:none;\n border-radius: 5px;\n}\ninput[type=range]::-moz-range-thumb {\n opacity: 0.5;\n width: 80px;\n height: 80px;\n background-color: black;\n border:none;\n border-radius: 5px;\n}\ninput[type=range]::-ms-thumb {\n opacity: 0.5;\n width: 80px;\n height: 80px;\n background-color: black;\n border:none;\n border-radius: 5px;\n}\ninput[type=range][orient=vertical]{\n writing-mode: bt-lr; /* IE */\n -webkit-appearance: slider-vertical; /* WebKit */\n}\n"+aI,oI=function(e){return{$:"Intermediate",a:e}},uI=r(function(e,t){return oI({closing:t,others:mr,props:mr,selector:e})}),sI=r(function(e,t){var n=e.a,a=r(function(e,t){switch(e.$){case"Prop":var r=e.a,a=e.b;return U(t,{props:f(qa,L(r,a),t.props)});case"Supports":var i=e.a,o=i.a,u=i.b,s=e.b;return U(t,{others:f(qa,oI({closing:"\n}",others:mr,props:s,selector:"@supports ("+o+":"+u+") {"+n.selector}),t.others)});case"Adjacent":var c=e.a,l=e.b;return U(t,{others:f(qa,f(sI,f(uI,n.selector+" + "+c,""),l),t.others)});case"Child":var d=e.a,h=e.b;return U(t,{others:f(qa,f(sI,f(uI,n.selector+" > "+d,""),h),t.others)});case"Descriptor":var p=e.a,g=e.b;return U(t,{others:f(qa,f(sI,f(uI,O(n.selector,p),""),g),t.others)});default:var v=e.a;return U(t,{others:f(qa,f(sI,f(uI,n.selector,""),v),t.others)})}});return oI(l(Ja,a,n,t))}),cI=O(iI,function(e){var t=function(e){return Sl(f(tu,function(e){return e.a+":"+e.b+";"},e))},n=function(e){return e.props.b?e.selector+"{"+t(e.props)+e.closing+"}":""},a=function(e){var t=e.a;return O(n(t),Sl(f(tu,a,t.others)))};return Sl(f(tu,a,l(Ja,r(function(e,t){var r=e.a,n=e.b;return f(qa,f(sI,f(uI,r,""),n),t)}),mr,e)))}(O(tI,nI))),fI=l(tw,"style",mr,F([kw(cI)])),lI=function(e){switch(e.$){case"Serif":return"serif";case"SansSerif":return"sans-serif";case"Monospace":return"monospace";case"Typeface":var t=e.a;return'"'+t+'"';case"ImportFont":var t=e.a;e.b;return'"'+t+'"';default:var t=e.a.name;return'"'+t+'"'}},dI=function(e){switch(e.$){case"VariantActive":var t=e.a;return"smcp"===t;case"VariantOff":var t=e.a;return!1;default:var t=e.a,r=e.b;return"smcp"===t&&1===r}},hI=function(e){if("FontWith"===e.$){var t=e.a;return f(Cd,dI,t.variants)}return!1},pI=n(function(e,t,r){var n=t.a,a=t.b;return e?r+"\n "+n+": "+a+" !important;":r+"\n "+n+": "+a+";"}),gI=r(function(e,t){return e+" {"+f(qi,"",f(tu,function(e){return e.a+": "+e.b+";"},t))+"}"}),vI=n(function(e,t,r){var n=r.a,a=r.b;return F([f(gI,"."+e+"."+t+", ."+e+" ."+t,n),f(gI,"."+e+"."+t+"> ."+PT.text+", ."+e+" ."+t+" > ."+PT.text,a)])}),yI=n(function(e,t,r){var n=t.a,a=t.b,i=$(e,r)?e:r+" ."+e;return f(qi," ",O(l(vI,i,PT.sizeByCapital,a),l(vI,i,PT.fullSize,n)))}),mI=r(function(e,t){var r=$(e,t)?e:t+" ."+e;return f(qi," ",F([f(gI,"."+r+"."+PT.sizeByCapital+", ."+r+" ."+PT.sizeByCapital,F([L("line-height","1")])),f(gI,"."+r+"."+PT.sizeByCapital+"> ."+PT.text+", ."+r+" ."+PT.sizeByCapital+" > ."+PT.text,F([L("vertical-align","0"),L("line-height","1")]))]))}),bI=function(e){if(e.b){var t=e.a,r=e.b;return ya(l(za,vi,t,r))}return ma},CI=function(e){if(e.b){var t=e.a,r=e.b;return ya(l(za,Hs,t,r))}return ma},SI=n(function(e,t,r){return{height:t/e,size:e,vertical:r}}),EI=function(e){var t=F([e.capital,e.baseline,e.descender,e.lowercase]),r=f(ec,e.descender,CI(t)),n=f(ec,e.baseline,CI(f(Zd,function(e){return!$(e,r)},t))),a=f(ec,e.capital,bI(t)),i=1/(a-n),o=1-a,u=1/(a-r),s=1-a;return{capital:l(SI,i,a-n,o),full:l(SI,u,a-r,s)}},TI=function(e){return L(F([L("display","block")]),F([L("display","inline-block"),L("line-height",Tw(e.height)),L("vertical-align",Tw(e.vertical)+"em"),L("font-size",Tw(e.size)+"em")]))},wI=function(e){return l(za,r(function(e,t){if("Nothing"===t.$){if("FontWith"===e.$){var r=e.a,n=r.adjustment;if("Nothing"===n.$)return t;var a=n.a;return ya(L(TI(function(e){return e.full}(EI(a))),TI(function(e){return e.capital}(EI(a)))))}return t}return t}),ma,e)},II=function(e){var t=function(e){if("ImportFont"===e.$){var t=e.b;return ya("@import url('"+t+"');")}return ma},r=function(e){var r=(e.a,e.b);return f(qi,"\n",f(qE,t,r))},n=f(tu,hi,e),a=function(e){var t=e.a,r=e.b,a=wI(r);if("Nothing"===a.$)return f(qi,"",f(tu,mI(t),n));var i=a.a;return f(qi,"",f(tu,f(yI,t,i),n))};return O(f(qi,"\n",f(tu,r,e)),f(qi,"\n",f(tu,a,e)))},AI=function(e){switch(e.$){case"VariantActive":var t=e.a;return'"'+t+'"';case"VariantOff":var t=e.a;return'"'+t+'" 0';default:var t=e.a,r=e.b;return'"'+t+'" '+ji(r)}},BI=function(e){if("FontWith"===e.$){var t=e.a;return ya(f(qi,", ",f(tu,AI,t.variants)))}return ma},kI=function(e){if("FontFamily"===e.$){var t=e.a,r=e.b;return ya(L(t,r))}return ma},NI=function(e){switch(e.$){case"Untransformed":return ma;case"Moved":var t=e.a,r=t.a,n=t.b,a=t.c;return ya("translate3d("+Tw(r)+"px, "+Tw(n)+"px, "+Tw(a)+"px)");default:var i=e.a,o=i.a,u=i.b,s=i.c,c=e.b,f=c.a,l=c.b,d=c.c,h=e.c,p=h.a,g=h.b,v=h.c,y=e.d,m="translate3d("+Tw(o)+"px, "+Tw(u)+"px, "+Tw(s)+"px)",b="scale3d("+Tw(f)+", "+Tw(l)+", "+Tw(d)+")",C="rotate3d("+Tw(p)+", "+Tw(g)+", "+Tw(v)+", "+Tw(y)+"rad)";return ya(m+" "+b+" "+C)}},RI=r(function(e,t){var a=n(function(t,r,n){if("Nothing"===t.$)return r+"{"+l(za,pI(!1),"",n)+"\n}";switch(t.a.$){case"Hover":switch(e.hover.$){case"NoHover":return"";case"ForceHover":return r+"-hv {"+l(za,pI(!0),"",n)+"\n}";default:return r+"-hv:hover {"+l(za,pI(!1),"",n)+"\n}"}case"Focus":var a=l(za,pI(!1),"",n);return f(qi,"\n",F([r+"-fs:focus {"+a+"\n}","."+PT.any+":focus ~ "+r+"-fs:not(.focus) {"+a+"\n}","."+PT.any+":focus "+r+"-fs {"+a+"\n}",".focusable-parent:focus ~ ."+PT.any+" "+r+"-fs {"+a+"\n}"]));default:return r+"-act:active {"+l(za,pI(!1),"",n)+"\n}"}}),i=r(function(e,t){switch(e.$){case"Style":var r=e.a,o=e.b;return l(a,t,r,o);case"Shadows":var u=e.a,s=e.b;return l(a,t,"."+u,F([f(Sw,"box-shadow",s)]));case"Transparency":var u=e.a,c=e.b,d=f(vi,0,f(Hs,1,1-c));return l(a,t,"."+u,F([f(Sw,"opacity",Tw(d))]));case"FontSize":var h=e.a;return l(a,t,".font-size-"+ji(h),F([f(Sw,"font-size",ji(h)+"px")]));case"FontFamily":var u=e.a,p=e.b,g=f(qi,", ",f(qE,BI,p)),v=F([f(Sw,"font-family",f(qi,", ",f(tu,lI,p))),f(Sw,"font-feature-settings",g),f(Sw,"font-variant",f(Cd,hI,p)?"small-caps":"normal")]);return f(qi," ",F([l(a,t,"."+u,v)]));case"Single":var y=e.a,s=e.b,m=e.c;return l(a,t,"."+y,F([f(Sw,s,m)]));case"Colored":var y=e.a,s=e.b,b=e.c;return l(a,t,"."+y,F([f(Sw,s,ww(b))]));case"SpacingStyle":var C=e.a,S=e.b,E=e.c,T=ji(E)+"px",w=ji(S)+"px",I="."+PT.row,A="."+(PT.wrapped+I),B="."+PT.alignRight,k="."+PT.paragraph,N="."+PT.page,R="."+PT.alignLeft,$=Tw(E/2)+"px",x=Tw(S/2)+"px",_="."+PT.column,y="."+C,P="."+PT.any;return Sl(F([l(a,t,y+(I+" > ")+P+" + "+P,F([f(Sw,"margin-left",w)])),l(a,t,y+(A+" > ")+P,F([f(Sw,"margin",$+" "+x)])),l(a,t,y+(_+" > ")+P+" + "+P,F([f(Sw,"margin-top",T)])),l(a,t,y+(N+" > ")+P+" + "+P,F([f(Sw,"margin-top",T)])),l(a,t,y+(N+" > ")+R,F([f(Sw,"margin-right",w)])),l(a,t,y+(N+" > ")+B,F([f(Sw,"margin-left",w)])),l(a,t,O(y,k),F([f(Sw,"line-height","calc(1em + "+ji(E)+"px)")])),l(a,t,"textarea"+y,F([f(Sw,"line-height","calc(1em + "+ji(E)+"px)")])),l(a,t,y+(k+" > ")+R,F([f(Sw,"margin-right",w)])),l(a,t,y+(k+" > ")+B,F([f(Sw,"margin-left",w)])),l(a,t,y+(k+"::after"),F([f(Sw,"content","''"),f(Sw,"display","block"),f(Sw,"height","0"),f(Sw,"width","0"),f(Sw,"margin-top",ji(-1*(E/2|0))+"px")])),l(a,t,y+(k+"::before"),F([f(Sw,"content","''"),f(Sw,"display","block"),f(Sw,"height","0"),f(Sw,"width","0"),f(Sw,"margin-bottom",ji(-1*(E/2|0))+"px")]))]));case"PaddingStyle":var C=e.a,D=e.b,B=e.c,U=e.d,R=e.e,y="."+C;return l(a,t,y,F([f(Sw,"padding",ji(D)+"px "+ji(B)+"px "+ji(U)+"px "+ji(R)+"px")]));case"BorderWidth":var C=e.a,D=e.b,B=e.c,U=e.d,R=e.e,y="."+C;return l(a,t,y,F([f(Sw,"border-width",ji(D)+"px "+ji(B)+"px "+ji(U)+"px "+ji(R)+"px")]));case"GridTemplateStyle":var M=e.a,V=n(function(e,t,r){e:for(;;)switch(r.$){case"Px":var n=r.a;return ji(n)+"px";case"Content":var a=L(e,t);if("Nothing"===a.a.$){if("Nothing"===a.b.$){a.a,a.b;return"max-content"}var i=(a.a,a.b.a);return"minmax(max-content, "+ji(i)+"px)"}if("Nothing"===a.b.$){var o=a.a.a;a.b;return"minmax("+ji(o)+"px, max-content)"}var o=a.a.a,i=a.b.a;return"minmax("+ji(o)+"px, "+ji(i)+"px)";case"Fill":var u=r.a,s=L(e,t);if("Nothing"===s.a.$){if("Nothing"===s.b.$){s.a,s.b;return ji(u)+"fr"}var i=(s.a,s.b.a);return"minmax(max-content, "+ji(i)+"px)"}if("Nothing"===s.b.$){var o=s.a.a;s.b;return"minmax("+ji(o)+"px, "+ji(u)+"frfr)"}var o=s.a.a,i=s.b.a;return"minmax("+ji(o)+"px, "+ji(i)+"px)";case"Min":var c=r.a,f=r.b,l=ya(c),d=t,h=f;e=l,t=d,r=h;continue e;default:var c=r.a,f=r.b,l=e,d=ya(c),h=f;e=l,t=d,r=h;continue e}}),K=function(e){return l(V,ma,ma,e)},H=(K(M.spacing.a),K(M.spacing.b)),j=function(e){return"grid-template-rows: "+e+";"}(f(qi," ",f(tu,K,M.rows))),q=function(e){return"-ms-grid-rows: "+e+";"}(f(qi,H,f(tu,K,M.columns))),G=function(e){return"-ms-grid-columns: "+e+";"}(f(qi,H,f(tu,K,M.columns))),z="grid-row-gap:"+K(M.spacing.b)+";",Y="grid-column-gap:"+K(M.spacing.a)+";",W=function(e){return"grid-template-columns: "+e+";"}(f(qi," ",f(tu,K,M.columns))),y=".grid-rows-"+f(qi,"-",f(tu,vw,M.rows))+"-cols-"+f(qi,"-",f(tu,vw,M.columns))+"-space-x-"+vw(M.spacing.a)+"-space-y-"+vw(M.spacing.b),J=y+"{"+W+j+Y+z+"}",Q="@supports (display:grid) {"+J+"}",X=y+"{"+G+q+"}";return O(X,Q);case"GridPosition":var Z=e.a,ee=f(qi," ",F(["-ms-grid-row: "+ji(Z.row)+";","-ms-grid-row-span: "+ji(Z.height)+";","-ms-grid-column: "+ji(Z.col)+";","-ms-grid-column-span: "+ji(Z.width)+";"])),te=f(qi," ",F(["grid-row: "+ji(Z.row)+" / "+ji(Z.row+Z.height)+";","grid-column: "+ji(Z.col)+" / "+ji(Z.col+Z.width)+";"])),y=".grid-pos-"+ji(Z.row)+"-"+ji(Z.col)+"-"+ji(Z.width)+"-"+ji(Z.height),J=y+"{"+te+"}",Q="@supports (display:grid) {"+J+"}",X=y+"{"+ee+"}";return O(X,Q);case"PseudoSelector":var y=e.a,re=e.b;return f(qi," ",f(tu,function(e){return f(i,e,ya(y))},re));default:var ne=e.a,m=NI(ne),y=mw(ne),ae=L(y,m);if("Just"===ae.a.$&&"Just"===ae.b.$){var C=ae.a.a,ie=ae.b.a;return l(a,t,"."+C,F([f(Sw,"transform",ie)]))}return""}}),o=r(function(e,t){return{rules:O(t.rules,f(i,e,ma)),topLevel:function(){var r=kI(e);if("Nothing"===r.$)return t.topLevel;var n=r.a;return f(qa,n,t.topLevel)}()}}),u=l(za,o,{rules:"",topLevel:mr},t),s=u.topLevel,c=u.rules;return O(II(s),c)}),$I=r(function(e,t){return l(tw,"style",mr,F([kw(f(RI,e,t))]))}),xI=a(function(e,t,r,n){return e?f(qa,L("static-stylesheet",fI),f(qa,L("dynamic-stylesheet",f($I,t,l(za,Cw,L(mm,F([Bw(t.focus)])),r).b)),n)):f(qa,L("dynamic-stylesheet",f($I,t,l(za,Cw,L(mm,F([Bw(t.focus)])),r).b)),n)}),_I=a(function(e,t,r,n){return e?f(qa,fI,f(qa,f($I,t,l(za,Cw,L(mm,F([Bw(t.focus)])),r).b),n)):f(qa,f($I,t,l(za,Cw,L(mm,F([Bw(t.focus)])),r).b),n)}),LI=o(function(e,t,n,a,i,o){var u=r(function(e,t){if("Keyed"===a.$){var r=a.a;return l(ew,e,t,function(){switch(i.$){case"NoStyleSheet":return r;case"OnlyDynamic":var e=i.a,t=i.b;return d(xI,!1,e,t,r);default:var e=i.a,t=i.b;return d(xI,!0,e,t,r)}}())}var n=a.a;return f(function(){switch(e){case"div":return WT;case"p":return JT;default:return tw(e)}}(),t,function(){switch(i.$){case"NoStyleSheet":return n;case"OnlyDynamic":var e=i.a,t=i.b;return d(_I,!1,e,t,n);default:var e=i.a,t=i.b;return d(_I,!0,e,t,n)}}())}),s=function(){switch(t.$){case"Generic":return f(u,"div",n);case"NodeName":var e=t.a;return f(u,e,n);default:var e=t.a,r=t.b;return l(tw,e,n,F([f(u,r,F([ZT(PT.any+" "+PT.single)]))]))}}();switch(o.$){case"AsRow":return f(lw,hw,e)&&!f(lw,dw,e)?s:f(lw,ow,e)?f(XT,F([ZT(f(qi," ",F([PT.any,PT.single,PT.container,PT.contentCenterY,PT.alignContainerRight])))]),F([s])):f(lw,uw,e)?f(QT,F([ZT(f(qi," ",F([PT.any,PT.single,PT.container,PT.contentCenterY,PT.alignContainerCenterX])))]),F([s])):s;case"AsColumn":return f(lw,fw,e)&&!f(lw,cw,e)?s:f(lw,sw,e)?f(QT,F([ZT(f(qi," ",F([PT.any,PT.single,PT.container,PT.alignContainerCenterY])))]),F([s])):f(lw,iw,e)?f(XT,F([ZT(f(qi," ",F([PT.any,PT.single,PT.container,PT.alignContainerBottom])))]),F([s])):s;default:return s}}),PI=kw,DI=function(e){return f(WT,F([ZT(f(qi," ",F([PT.any,PT.text,PT.widthContent,PT.heightContent])))]),F([PI(e)]))},UI=function(e){return l(tw,"div",F([ZT(f(qi," ",F([PT.any,PT.text,PT.widthFill,PT.heightFill])))]),F([kw(e)]))},OI=n(function(e,t,n){var a=r(function(t,r){var n=t.a,a=t.b,i=r.a,o=r.b;switch(a.$){case"Unstyled":var u=a.a;return $(e,YT),L(f(qa,L(n,u(e)),i),o);case"Styled":var s=a.a;return $(e,YT),L(f(qa,L(n,f(s.html,jT,e)),i),jo(o)?s.styles:O(s.styles,o));case"Text":var c=a.a;return L(f(qa,L(n,$(e,$T)?UI(c):DI(c)),i),o);default:return L(i,o)}}),i=r(function(t,r){var n=r.a,a=r.b;switch(t.$){case"Unstyled":var i=t.a;return $(e,YT),L(f(qa,i(e),n),a);case"Styled":var o=t.a;return $(e,YT),L(f(qa,f(o.html,jT,e),n),jo(a)?o.styles:O(o.styles,a));case"Text":var u=t.a;return L(f(qa,$(e,$T)?UI(u):DI(u),n),a);default:return L(n,a)}});if("Keyed"===t.$){var o=t.a,u=l(Ja,a,L(mr,mr),o),s=u.a,c=u.b,p=jo(c)?n.styles:O(n.styles,c);if(p.b){var g=p;return Rf({html:d(LI,n.has,n.node,n.attributes,HT(l(GT,"nearby-element-pls",s,n.children))),styles:g})}return xf(h(LI,n.has,n.node,n.attributes,HT(l(GT,"nearby-element-pls",s,n.children)),jT))}var v=t.a,y=l(Ja,i,L(mr,mr),v),m=y.a,c=y.b,p=jo(c)?n.styles:O(n.styles,c);if(p.b){var g=p;return Rf({html:d(LI,n.has,n.node,n.attributes,NT(f(qT,m,n.children))),styles:g})}return xf(h(LI,n.has,n.node,n.attributes,NT(f(qT,m,n.children)),jT))}),MI=r(function(e,t){return f(qn,nt(e),ot(t))}),FI=r(function(e,t){var r=t.a,n=t.b;if("Flag"===e.$){var a=e.a;return f(xT,a|r,n)}var i=e.a;return f(xT,r,i|n)}),VI=aw(7),KI=aw(36),HI=r(function(e,t){var r=e.a,n=e.b,a=t.a,i=t.b;return f(xT,r|a,n|i)}),jI=aw(6),qI=aw(38),GI=aw(30),zI=aw(29),YI=r(function(e,t){return{$:"Embedded",a:e,b:t}}),WI=n(function(e,t,r){return{$:"Single",a:e,b:t,c:r}}),JI=function(e){return{$:"Transform",a:e}},QI=function(e){return{$:"ChildrenBehind",a:e}},XI=r(function(e,t){return{$:"ChildrenBehindAndInFront",a:e,b:t}}),ZI=function(e){return{$:"ChildrenInFront",a:e}},eA=r(function(e,t){return f(WT,F([ZT(function(){switch(e.$){case"Above":return f(qi," ",F([PT.nearby,PT.single,PT.above]));case"Below":return f(qi," ",F([PT.nearby,PT.single,PT.below]));case"OnRight":return f(qi," ",F([PT.nearby,PT.single,PT.onRight]));case"OnLeft":return f(qi," ",F([PT.nearby,PT.single,PT.onLeft]));case"InFront":return f(qi," ",F([PT.nearby,PT.single,PT.inFront]));default:return f(qi," ",F([PT.nearby,PT.single,PT.behind]))}}())]),F([function(){switch(t.$){case"Empty":return kw("");case"Text":var e=t.a;return DI(e);case"Unstyled":return(0,t.a)($T);default:return f(t.a.html,jT,$T)}}()]))}),tA=n(function(e,t,r){var n=f(eA,e,t);switch(r.$){case"NoNearbyChildren":return"Behind"===e.$?QI(F([n])):ZI(F([n]));case"ChildrenBehind":var a=r.a;return"Behind"===e.$?QI(f(qa,n,a)):f(XI,a,F([n]));case"ChildrenInFront":var i=r.a;return"Behind"===e.$?f(XI,F([n]),i):ZI(f(qa,n,i));default:var a=r.a,i=r.b;return"Behind"===e.$?f(XI,f(qa,n,a),i):f(XI,a,f(qa,n,i))}}),rA=r(function(e,t){switch(t.$){case"Generic":return kT(e);case"NodeName":var r=t.a;return f(YI,r,e);default:var n=t.a,a=t.b;return f(YI,n,a)}}),nA=function(e){switch(e.$){case"Left":return PT.alignedHorizontally+" "+PT.alignLeft;case"Right":return PT.alignedHorizontally+" "+PT.alignRight;default:return PT.alignedHorizontally+" "+PT.alignCenterX}},aA=function(e){switch(e.$){case"Top":return PT.alignedVertically+" "+PT.alignTop;case"Bottom":return PT.alignedVertically+" "+PT.alignBottom;default:return PT.alignedVertically+" "+PT.alignCenterY}},iA=a(function(e,t,r,n){return{$:"FullTransform",a:e,b:t,c:r,d:n}}),oA=function(e){return{$:"Moved",a:e}},uA=r(function(e,t){switch(e.$){case"Untransformed":switch(t.$){case"MoveX":var r=t.a;return oA(P(r,0,0));case"MoveY":var n=t.a;return oA(P(0,n,0));case"MoveZ":var a=t.a;return oA(P(0,0,a));case"MoveXYZ":var i=t.a;return oA(i);case"Rotate":var i=t.a,o=t.b;return d(iA,P(0,0,0),P(1,1,1),i,o);default:var i=t.a;return d(iA,P(0,0,0),i,P(0,0,1),0)}case"Moved":var u=e.a,r=u.a,n=u.b,a=u.c;switch(t.$){case"MoveX":var s=t.a;return oA(P(s,n,a));case"MoveY":var c=t.a;return oA(P(r,c,a));case"MoveZ":var f=t.a;return oA(P(r,n,f));case"MoveXYZ":var i=t.a;return oA(i);case"Rotate":var i=t.a,o=t.b;return d(iA,u,P(1,1,1),i,o);default:var l=t.a;return d(iA,u,l,P(0,0,1),0)}default:var u=e.a,r=u.a,n=u.b,a=u.c,h=e.b,p=e.c,o=e.d;switch(t.$){case"MoveX":var s=t.a;return d(iA,P(s,n,a),h,p,o);case"MoveY":var c=t.a;return d(iA,P(r,c,a),h,p,o);case"MoveZ":var f=t.a;return d(iA,P(r,n,f),h,p,o);case"MoveXYZ":var g=t.a;return d(iA,g,h,p,o);case"Rotate":var v=t.a,y=t.b;return d(iA,u,h,v,y);default:var m=t.a;return d(iA,u,m,p,o)}}}),sA=function(e){switch(e.$){case"Px":var t=e.a,r=ji(t),n="height-px-"+r;return P(_T,n,F([l(WI,n,"height",r+"px")]));case"Content":return P(f(FI,KI,_T),PT.heightContent,mr);case"Fill":var a=e.a;return 1===a?P(f(FI,fw,_T),PT.heightFill,mr):P(f(FI,fw,_T),PT.heightFillPortion+" height-fill-"+ji(a),F([l(WI,PT.any+"."+PT.row+" > "+Aw("height-fill-"+ji(a)),"flex-grow",ji(1e5*a))]));case"Min":var i=e.a,o=e.b,u="min-height-"+ji(i),s=l(WI,u,"min-height",ji(i)+"px"),c=sA(o),d=c.a,h=c.b,p=c.c;return P(f(FI,cw,d),u+" "+h,f(qa,s,p));default:var g=e.a,o=e.b,u="max-height-"+ji(g),s=l(WI,u,"max-height",ji(g)+"px"),v=sA(o),d=v.a,h=v.b,p=v.c;return P(f(FI,cw,d),u+" "+h,f(qa,s,p))}},cA=function(e){switch(e.$){case"Px":var t=e.a;return P(_T,PT.widthExact+" width-px-"+ji(t),F([l(WI,"width-px-"+ji(t),"width",ji(t)+"px")]));case"Content":return P(f(FI,qI,_T),PT.widthContent,mr);case"Fill":var r=e.a;return 1===r?P(f(FI,hw,_T),PT.widthFill,mr):P(f(FI,hw,_T),PT.widthFillPortion+" width-fill-"+ji(r),F([l(WI,PT.any+"."+PT.row+" > "+Aw("width-fill-"+ji(r)),"flex-grow",ji(1e5*r))]));case"Min":var n=e.a,a=e.b,i="min-width-"+ji(n),o=l(WI,i,"min-width",ji(n)+"px"),u=cA(a),s=u.a,c=u.b,d=u.c;return P(f(FI,dw,s),i+" "+c,f(qa,o,d));default:var h=e.a,a=e.b,i="max-width-"+ji(h),o=l(WI,i,"max-width",ji(h)+"px"),p=cA(a),s=p.a,c=p.b,d=p.c;return P(f(FI,dw,s),i+" "+c,f(qa,o,d))}},fA=aw(27),lA=r(function(e,t){if($(e,fA)){if("Single"!==t.$)return!1;switch(t.c){case"0px":case"1px":case"2px":case"3px":case"4px":case"5px":case"6px":return!0;default:return!1}}else switch(t.$){case"FontSize":var r=t.a;return r>=8&&r<=32;case"PaddingStyle":var n=(t.a,t.b),a=t.c,i=t.d,o=t.e;return $(n,i)&&$(n,a)&&$(n,o)&&n>=0&&n<=24;default:return!1}}),dA=s(function(e,t,r,n,a,i,o,u){e:for(;;){if(!u.b){var s=mw(n);if("Nothing"===s.$)return{attributes:f(qa,ZT(e),i),children:o,has:r,node:t,styles:a};var c=s.a;return{attributes:f(qa,ZT(e+" "+c),i),children:o,has:r,node:t,styles:f(qa,JI(n),a)}}var d=u.a,h=u.b;switch(d.$){case"NoAttribute":var p=e,g=t,v=r,y=n,m=a,b=i,C=o,S=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=S;continue e;case"Class":var E=d.a,T=d.b;if(f(lw,E,r)){var p=e,g=t,v=r,y=n,m=a,b=i,C=o,S=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=S;continue e}var p=T+" "+e,g=t,v=f(FI,E,r),y=n,m=a,b=i,C=o,S=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=S;continue e;case"Attr":var w=d.a,p=e,g=t,v=r,y=n,m=a,b=f(qa,w,i),C=o,S=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=S;continue e;case"StyleClass":var E=d.a,I=d.b;if(f(lw,E,r)){var p=e,g=t,v=r,y=n,m=a,b=i,C=o,S=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=S;continue e}if(f(lA,E,I)){var p=bw(I)+" "+e,g=t,v=f(FI,E,r),y=n,m=a,b=i,C=o,S=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=S;continue e}var p=bw(I)+" "+e,g=t,v=f(FI,E,r),y=n,m=f(qa,I,a),b=i,C=o,S=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=S;continue e;case"TransformComponent":var E=d.a,A=d.b,p=e,g=t,v=f(FI,E,r),y=f(uA,n,A),m=a,b=i,C=o,S=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=S;continue e;case"Width":var B=d.a;if(f(lw,jI,r)){var p=e,g=t,v=r,y=n,m=a,b=i,C=o,S=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=S;continue e}switch(B.$){case"Px":var k=B.a,p=PT.widthExact+" width-px-"+ji(k)+" "+e,g=t,v=f(FI,jI,r),y=n,m=f(qa,l(WI,"width-px-"+ji(k),"width",ji(k)+"px"),a),b=i,C=o,S=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=S;continue e;case"Content":var p=e+" "+PT.widthContent,g=t,v=f(FI,qI,f(FI,jI,r)),y=n,m=a,b=i,C=o,S=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=S;continue e;case"Fill":var N=B.a;if(1===N){var p=e+" "+PT.widthFill,g=t,v=f(FI,hw,f(FI,jI,r)),y=n,m=a,b=i,C=o,S=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=S;continue e}var p=e+" "+PT.widthFillPortion+" width-fill-"+ji(N),g=t,v=f(FI,hw,f(FI,jI,r)),y=n,m=f(qa,l(WI,PT.any+"."+PT.row+" > "+Aw("width-fill-"+ji(N)),"flex-grow",ji(1e5*N)),a),b=i,C=o,S=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=S;continue e;default:var R=cA(B),$=R.a,x=R.b,_=R.c,p=e+" "+x,g=t,v=f(HI,$,r),y=n,m=O(_,a),b=i,C=o,S=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=S;continue e}case"Height":var L=d.a;if(f(lw,VI,r)){var p=e,g=t,v=r,y=n,m=a,b=i,C=o,S=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=S;continue e}switch(L.$){case"Px":var k=L.a,P=ji(k)+"px",D="height-px-"+P,p=D+" "+e,g=t,v=f(FI,VI,r),y=n,m=f(qa,l(WI,D,"height ",P),a),b=i,C=o,S=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=S;continue e;case"Content":var p=PT.heightContent+" "+e,g=t,v=f(FI,KI,f(FI,VI,r)),y=n,m=a,b=i,C=o,S=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=S;continue e;case"Fill":var N=L.a;if(1===N){var p=PT.heightFill+" "+e,g=t,v=f(FI,fw,f(FI,VI,r)),y=n,m=a,b=i,C=o,S=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=S;continue e}var p=e+" "+PT.heightFillPortion+" height-fill-"+ji(N),g=t,v=f(FI,fw,f(FI,VI,r)),y=n,m=f(qa,l(WI,PT.any+"."+PT.column+" > "+Aw("height-fill-"+ji(N)),"flex-grow",ji(1e5*N)),a),b=i,C=o,S=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=S;continue e;default:var U=sA(L),$=U.a,x=U.b,_=U.c,p=e+" "+x,g=t,v=f(HI,$,r),y=n,m=O(_,a),b=i,C=o,S=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=S;continue e}case"Describe":var M=d.a;switch(M.$){case"Main":var p=e,g=f(rA,"main",t),v=r,y=n,m=a,b=i,C=o,S=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=S;continue e;case"Navigation":var p=e,g=f(rA,"nav",t),v=r,y=n,m=a,b=i,C=o,S=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=S;continue e;case"ContentInfo":var p=e,g=f(rA,"footer",t),v=r,y=n,m=a,b=i,C=o,S=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=S;continue e;case"Complementary":var p=e,g=f(rA,"aside",t),v=r,y=n,m=a,b=i,C=o,S=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=S;continue e;case"Heading":var F=M.a;if(F<=1){var p=e,g=f(rA,"h1",t),v=r,y=n,m=a,b=i,C=o,S=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=S;continue e}if(F<7){var p=e,g=f(rA,"h"+ji(F),t),v=r,y=n,m=a,b=i,C=o,S=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=S;continue e}var p=e,g=f(rA,"h6",t),v=r,y=n,m=a,b=i,C=o,S=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=S;continue e;case"Paragraph":var V=function(){switch(t.$){case"Generic":return kT("p");case"NodeName":var e=t.a;return kT(e);default:var r=t.a,n=t.b;return f(YI,r,n)}}(),p=e,g=V,v=r,y=n,m=a,b=i,C=o,S=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=S;continue e;case"Button":var p=e,g=t,v=r,y=n,m=a,b=f(qa,f(MI,"role","button"),i),C=o,S=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=S;continue e;case"Label":var K=M.a,p=e,g=t,v=r,y=n,m=a,b=f(qa,f(MI,"aria-label",K),i),C=o,S=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=S;continue e;case"LivePolite":var p=e,g=t,v=r,y=n,m=a,b=f(qa,f(MI,"aria-live","polite"),i),C=o,S=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=S;continue e;default:var p=e,g=t,v=r,y=n,m=a,b=f(qa,f(MI,"aria-live","assertive"),i),C=o,S=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=S;continue e}case"Nearby":var H=d.a,j=d.b,_=function(){switch(j.$){case"Empty":return a;case"Text":j.a;return a;case"Unstyled":j.a;return a;default:var e=j.a;return O(a,e.styles)}}(),p=e,g=t,v=r,y=n,m=_,b=i,C=l(tA,H,j,o),S=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=S;continue e;case"AlignX":var q=d.a;if(f(lw,GI,r)){var p=e,g=t,v=r,y=n,m=a,b=i,C=o,S=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=S;continue e}var p=nA(q)+" "+e,g=t,v=function(e){switch(q.$){case"CenterX":return f(FI,uw,e);case"Right":return f(FI,ow,e);default:return e}}(f(FI,GI,r)),y=n,m=a,b=i,C=o,S=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=S;continue e;default:var G=d.a;if(f(lw,zI,r)){var p=e,g=t,v=r,y=n,m=a,b=i,C=o,S=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=S;continue e}var p=aA(G)+" "+e,g=t,v=function(e){switch(G.$){case"CenterY":return f(FI,sw,e);case"Bottom":return f(FI,iw,e);default:return e}}(f(FI,zI,r)),y=n,m=a,b=i,C=o,S=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=S;continue e}}}),hA={$:"Untransformed"},pA=hA,gA=a(function(e,t,r,n){return l(OI,e,n,v(dA,KT(e),t,_T,pA,mr,mr,LT,Ya(r)))}),vA=function(e){return BT(ZT(e))},yA=r(function(e,t){var r=t.url,n=t.label;return d(gA,$T,kT("a"),f(qa,BT(mT(r)),f(qa,BT(bT("noopener noreferrer")),f(qa,BT(CT("_blank")),f(qa,AT(wT),f(qa,ET(wT),f(qa,vA(PT.contentCenterX+" "+PT.contentCenterY),e)))))),NT(F([n])))}),mA=a(function(e,t,r,n){return{$:"Rgba",a:e,b:t,c:r,d:n}}),bA=n(function(e,t,r){return d(mA,e,t,r,1)}),CA=aw(14),SA=n(function(e,t,r){return{$:"Colored",a:e,b:t,c:r}}),EA=r(function(e,t){return{$:"StyleClass",a:e,b:t}}),TA=function(e){var t=e.a,r=e.b,n=e.c,a=e.d;return yw(t)+"-"+yw(r)+"-"+yw(n)+"-"+yw(a)},wA=function(e){return f(EA,CA,l(SA,"fc-"+TA(e),"color",e))},IA={align:Yp,mainParagraphs:F([F([Jp("You need a web3 provider (such as "),f(yA,F([wA(l(bA,0,0,1))]),{label:Jp("Metamask"),url:"https://metamask.io/"}),Jp(") to Connect.")]),F([Jp("Until you connect, DAIHard will operate in read-only mode.")])]),noticeType:tg},AA={align:Yp,mainParagraphs:F([F([Jp("I don't understand that URL...")]),F([Jp("I'll just set you down here. Maybe check the URL and try again?")])]),noticeType:Xp},BA={align:Yp,mainParagraphs:F([F([Jp("Your wallet is set to an incorrect network.")]),F([Jp("Switch to Ethereum mainnet, Ethereum test, Rootstock, or xDai.")])]),noticeType:Xp},kA=Lo(f($a,ff,f($a,Hd,_l("Error decoding hex to BigInt")))),NA=function(){return Lo(function(e){switch(e){case"0x0":return Ii(!1);case"0x1":return Ii(!0);default:return wi("Error decoding "+e+"as bool.")}})}(),RA=function(e){return function(t){return function(r){return function(n){return function(a){return function(i){return function(o){return function(u){return function(s){return function(c){return function(f){return{blockHash:r,blockNumber:n,contractAddress:o,cumulativeGasUsed:i,gasUsed:a,hash:e,index:t,logs:u,logsBloom:s,root:c,status:f}}}}}}}}}}}},$A=function(e){return nE(F([f(If,ya,e),_o(ma)]))},xA=f(dd,$A(f(Od,"status",NA)),f(dd,$A(f(Od,"root",xo)),l(oE,"logsBloom",xo,l(oE,"logs",Dm(yE),f(dd,$A(f(Od,"contractAddress",uE)),l(oE,"cumulativeGasUsed",kA,l(oE,"gasUsed",kA,l(oE,"blockNumber",hm,l(oE,"blockHash",lE,l(oE,"transactionIndex",hm,l(oE,"transactionHash",pE,_o(RA)))))))))))),_A=function(e){var t=e.a;return ff(t)},LA=f($a,_A,Gd),PA=r(function(e,t){return ep({decoder:xA,method:"eth_getTransactionReceipt",params:F([LA(t)]),url:e})}),DA=n(function(e,t,r){return{$:"TrackTx",a:e,b:t,c:r}}),UA=r(function(e,t){return{$:"TxMined",a:e,b:t}}),OA=r(function(e,t){return{$:"TxSent",a:e,b:t}}),MA=r(function(e,t){return f(jf,function(e){return e.toMsg},f(ng,function(e){return e.b},f(ng,function(e){return e.onMinedTagger},f(Sh,t,e))))}),FA=function(e){return function(t){return function(r){return function(n){return function(a){return function(i){return function(o){return function(u){return function(s){return function(c){return function(f){return{blockHash:r,blockNumber:n,from:i,gas:c,gasPrice:s,hash:e,input:f,nonce:t,to:o,transactionIndex:a,value:u}}}}}}}}}}}},VA=function(e){return nE(F([rE(ma),f(If,ya,e)]))},KA=l(oE,"input",xo,l(oE,"gas",hm,l(oE,"gasPrice",kA,l(oE,"value",kA,l(oE,"to",VA(uE),l(oE,"from",uE,l(oE,"transactionIndex",hm,l(oE,"blockNumber",VA(hm),l(oE,"blockHash",function(e){return f(Ro,function(t){return"0x"===t||"0x0"===t?_o(ma):f(Hi,function(e){return $(e,D("0"))},Bo(t))?_o(ma):f(If,ya,e)},xo)}(lE),l(oE,"nonce",hm,l(oE,"hash",pE,_o(FA)))))))))))),HA=r(function(e,t){return ep({decoder:KA,method:"eth_getTransactionByHash",params:F([LA(t)]),url:e})}),jA=r(function(e,t){return{attempts:e,sleep:t}}),qA=r(function(e,t){var r=e.attempts,n=e.sleep,a=r-1;return f(gp,function(e){return a>0?f(ip,function(e){return f(qA,f(jA,a,n),t)},eE(1e3*n)):Jh(e)},t)}),GA=r(function(e,t){return f(ip,function(r){return f(qA,{attempts:30,sleep:1},f(HA,e,t))},eE(250))}),zA=r(function(e,t){return f(qA,{attempts:60,sleep:5},f(PA,e,t))}),YA=function(e){return{$:"Mined",a:e}},WA=function(e){return jf(function(t){return U(t,{status:YA(e)})})},JA=function(e){return{$:"Sent",a:e}},QA=function(e){return jf(function(t){return U(t,{status:JA(e)})})},XA=function(e){return{$:"Signed",a:e}},ZA=function(e){return jf(function(t){return U(t,{status:XA(e)})})},eB=function(e){return"Nothing"!==e.$},tB=r(function(e,t){var r=t.a;switch(e.$){case"NoOp":return L($g(r),io);case"TxSigned":var n=e.a,a=e.b,i=f(Sh,n,r.txs);if("Just"===i.$){var o=i.a,u=function(){var e=o.onSignedTagger;if("Just"===e.$){var t=e.a;return f(dg,t,Qh(a))}return io}(),s=function(e){var t=P(o.onSignedTagger,o.onBroadcastTagger,o.onMinedTagger);if("Just"===t.a.$)return io;if("Just"===t.b.$){var r=t.b.a;return f(dg,r,Qh(wi(e)))}if("Just"===t.c.$){var n=t.c.a,a=n.a;return f(dg,a,Qh(wi(e)))}t.a,t.b,t.c;return io};if("Ok"===a.$){var c=a.a,d=eB(o.onBroadcastTagger)||eB(o.onMinedTagger)?f(Pg,r.tagger,f(vp,OA(n),f(GA,r.nodePath,c))):io;return L($g(U(r,{txs:l(Dh,n,ZA(c),r.txs)})),ao(F([u,d])))}var h=a.a;return L($g(r),ao(F([u,s(h)])))}return L($g(r),io);case"TxSent":var n=e.a,p=e.b,g=f(Sh,n,r.txs);if("Just"===g.$){var o=g.a;if("Ok"===p.$){var v=p.a,y=function(){return"Just"===o.onMinedTagger.$?f(Pg,r.tagger,f(vp,UA(n),f(zA,r.nodePath,v.hash))):io}(),d=function(){var e=o.onBroadcastTagger;if("Just"===e.$){var t=e.a;return f(dg,t,Qh(Ii(v)))}return io}();return L($g(U(r,{txs:l(Dh,n,QA(v),r.txs)})),ao(F([d,y])))}var h=p.a,s=function(){var e=L(o.onBroadcastTagger,o.onMinedTagger);if("Just"===e.a.$){var t=e.a.a;return f(dg,t,Qh(wi("Error with TxSent stuff")))}if("Just"===e.b.$){var r=e.b.a,n=r.a;return f(dg,n,Qh(wi("Error with TxSent stuff")))}e.a,e.b;return io}();return L($g(r),s)}return L($g(r),io);case"TxMined":var n=e.a,m=e.b,b=f(Sh,n,r.txs);if("Just"===b.$){var o=b.a;if("Ok"===m.$){var C=m.a,S=function(){var e=o.onMinedTagger;if("Just"===e.$){if("Nothing"===e.a.b.$){var t=e.a,a=t.a;t.b;return f(dg,a,Qh(Ii(C)))}var i=e.a,a=i.a,u=i.b.a,s={currentDepth:1,doneWatching:!1,lastCheckedBlock:C.blockNumber,minedInBlock:C.blockNumber,reOrg:!1,stopWatchingAtBlock:C.blockNumber+(u.confirmations-1),txHash:C.hash};return ao(F([f(Pg,r.tagger,f(vp,f(DA,n,s),pm(r.nodePath))),f(dg,a,Qh(Ii(C))),f(dg,u.toMsg,Qh(s))]))}return io}();return L($g(U(r,{txs:l(Dh,n,WA(C),r.txs)})),S)}var h=m.a,E=function(){var e=o.onMinedTagger;if("Just"===e.$){var t=e.a,r=t.a;return f(dg,r,Qh(wi("TxReceipt decoding failure")))}return io}();return L($g(r),E)}return L($g(r),io);case"TrackTx":if("Ok"===e.c.$){var n=e.a,T=e.b,w=e.c.a,I=U(T,{currentDepth:w-T.minedInBlock+1,lastCheckedBlock:w});if($(w,T.stopWatchingAtBlock)){var A=f(MA,r.txs,n);if("Just"===A.$){var B=A.a;return L($g(r),f(dg,B,f(gp,function(e){return Qh(U(I,{doneWatching:!0,reOrg:!0}))},f(ip,function(e){return Qh(U(I,{doneWatching:!0}))},f(PA,r.nodePath,T.txHash)))))}return L($g(r),io)}if($(w,T.lastCheckedBlock))return L($g(r),f(Pg,r.tagger,f(vp,f(DA,n,T),f(ip,function(e){return pm(r.nodePath)},eE(2e3)))));var k=f(MA,r.txs,n);if("Just"===k.$){var B=k.a;return L($g(r),ao(F([f(Pg,r.tagger,f(vp,f(DA,n,I),f(ip,function(e){return pm(r.nodePath)},eE(2e3)))),f(dg,B,Qh(I))])))}return L($g(r),io)}var n=e.a,h=e.c.a;return L($g(r),io);default:var h=e.a;return L($g(r),io)}}),rB=Qt,nB=r(function(e,t){if("Nothing"===e.$)return t;var r=e.a;return t+":"+ji(r)}),aB=n(function(e,t,r){return"Nothing"===t.$?r:O(r,O(e,t.a))}),iB=function(e){var t=function(){return"Http"===e.protocol.$?"http://":"https://"}();return l(aB,"#",e.fragment,l(aB,"?",e.query,O(f(nB,e.port_,O(t,e.host)),e.path)))},oB=r(function(e,t){if(e<0)return t;var r=Bd(f(al,e,t)),n=f($s,e,t);if("Nothing"===r.$)return t;var a=r.a;return f(Qa,n,a)}),uB=r(function(e,t){Gv(t);switch(t.$){case"Home":return L(U(e,{submodel:hT}),io);case"Create":var r=f(Zl,e.web3Context,e.userInfo),n=f(Og,e.txSentry,f(Fg,Uy,r.chainCmd)),a=n.a,i=n.b;return f(cB,f(Uf,Uy,r.appCmds),L(U(e,{submodel:Dy(r.model),txSentry:a}),ao(F([f(Pg,Uy,r.cmd),i]))));case"QuickCreate":var r=f(Tv,e.web3Context,e.userInfo),o=f(Og,e.txSentry,f(Fg,Fy,r.chainCmd)),a=o.a,i=o.b;return f(cB,f(Uf,Fy,r.appCmds),L(U(e,{submodel:My(r.model),txSentry:a}),ao(F([f(Pg,Fy,r.cmd),i]))));case"Trade":var u=t.a,r=l(Cm,e.web3Context,e.userInfo,u),s=f(Og,e.txSentry,f(Fg,Ky,r.chainCmd)),a=s.a,i=s.b;return f(cB,f(Uf,Ky,r.appCmds),L(U(e,{submodel:Vy(r.model),txSentry:a}),ao(F([f(Pg,Ky,r.cmd),i]))));case"Marketplace":var c=t.a,h=l(av,e.web3Context,c,e.userInfo),p=h.a,g=h.b;return L(U(e,{submodel:Oy(p)}),ao(F([f(Pg,gT,g)])));case"AgentHistory":var v=t.a,y=t.b,m=d(oo,e.web3Context,v,y,e.userInfo),b=m.a,C=m.b;return L(U(e,{submodel:Py(b)}),ao(F([f(Pg,lT,C)])));default:return L(f(Xa,AA,e),io)}}),sB=r(function(e,t){var r=t.a,n=t.b,a=f(fB,dT(e),r),i=a.a,o=a.b;return L(i,ao(F([n,o])))}),cB=r(function(e,t){var r=t.a,n=t.b;return l(za,sB,L(r,n),e)}),fB=r(function(e,t){switch(e.$){case"AppCmd":var r=e.a;switch(r.$){case"Web3Connect":return f(fB,pT,t);case"GotoRoute":var n=r.a;return L(t,f(Ty,t.key,n));case"GTag":var a=r.a;return L(t,By(Iy(a)));default:var i=r.a;return L(f(Xa,i,t),io)}case"DismissNotice":var o=e.a;return L(U(t,{userNotices:f(oB,o,t.userNotices)}),io);case"LinkClicked":var u=e.a,s=function(){if("Internal"===u.$){var e=u.a;return f(Ey,t.key,iB(e))}var r=u.a;return rB(r)}();return L(t,s);case"UrlChanged":var c=e.a;return f(lB,c,t);case"GotoRoute":var d=e.a;return L(t,f(Ty,t.key,d));case"Tick":var h=e.a;return L(U(t,{time:h}),io);case"NetworkUpdate":var p=e.a,g=f(Eo,Ra,f(Yd,ZC,p)),v=f(ng,ba,Wl(g)),y=L(g,v);if("Ok"===y.a.$){if("Just"===y.b.$){var m=y.a.a,b=y.b.a;if($(m,Vg(t.web3Context.factoryType)))return L(t,io);var C=La(b),S=FE(C),E=S.a,T=S.b,w=f(Yy,C,t.submodel),I=w.a,A=w.b,B=w.c;return L(U(t,{submodel:I,tradeCache:E,web3Context:C}),ao(F([f(Pg,vT,T),function(){if("Just"===B.$){var e=B.a;return f(Ty,t.key,e)}return A}()])))}y.b;return L(f(Xa,BA,t),io)}var k=y.a.a;return L(l(va,Xa,f(Qp,"Can't decode networkID from Javascript",k),t),io);case"ConnectToWeb3":return"NoWeb3"===t.initialWeb3State.$?L(f(Xa,IA,t),io):L(t,wy(vr));case"WalletStatus":var N=e.a,R=function(){var e=N.account;if("Nothing"===e.$)return io;var t=e.a;return ky(f(Ay,t,"Deriving keypair for encrypted communication on the DAIHard exchange. ONLY SIGN THIS on https://burnable-tech.github.io/DAIHard/. If you sign this elsewhere, you risk revealing any of your encrypted communication on DAIHard to an attacker."))}();return L(U(t,{userAddress:N.account}),R);case"UserPubkeySet":var x=e.a,_=f(Yd,xo,x);if("Ok"===_.$){var P=_.a,D=t.userAddress;if("Just"===D.$){var O=D.a,M=ya({address:O,commPubkey:P}),V=f(Hy,M,t.submodel),I=V.a,s=V.b;return L(U(t,{submodel:I,userInfo:M}),s)}return L(f(Xa,f(Qp,"User pubkey set, but I can no longer find the user address!",ma),t),io)}var K=_.a;return L(l(va,Xa,f(Qp,"error decoding commPubkey from JS",K),t),io);case"CreateMsg":var H=e.a,j=t.submodel;if("CreateModel"===j.$){var q=j.a,G=f(Ng,H,q),z=f(Og,t.txSentry,f(Fg,Uy,G.chainCmd)),Y=z.a,W=z.b;return f(cB,f(Uf,Uy,G.appCmds),L(U(t,{submodel:Dy(G.model),txSentry:Y}),ao(F([f(Pg,Uy,G.cmd),W]))))}return L(t,io);case"QuickCreateMsg":var J=e.a,Q=t.submodel;if("QuickCreateModel"===Q.$){var X=Q.a,G=f(Vv,J,X),Z=f(Og,t.txSentry,f(Fg,Fy,G.chainCmd)),Y=Z.a,W=Z.b;return f(cB,f(Uf,Fy,G.appCmds),L(U(t,{submodel:My(G.model),txSentry:Y}),ao(F([f(Pg,Fy,G.cmd),W]))))}return L(t,io);case"TradeMsg":var ee=e.a,te=t.submodel;if("TradeModel"===te.$){var re=te.a,G=f(xE,ee,re),ne=f(Og,t.txSentry,f(Fg,Ky,G.chainCmd)),Y=ne.a,W=ne.b;return f(cB,f(Uf,Ky,G.appCmds),L(U(t,{submodel:Vy(G.model),txSentry:Y}),ao(F([f(Pg,Ky,G.cmd),W]))))}return L(t,io);case"MarketplaceMsg":var ae=e.a,ie=t.submodel;if("MarketplaceModel"===ie.$){var oe=ie.a,G=f(yv,ae,oe);return f(cB,f(Uf,gT,G.appCmds),L(U(t,{submodel:Oy(G.model)}),f(Pg,gT,G.cmd)))}return L(t,io);case"AgentHistoryMsg":var ue=e.a,se=t.submodel;if("AgentHistoryModel"===se.$){var ce=se.a,G=f(bf,ue,ce),fe=f(Og,t.txSentry,f(Fg,lT,G.chainCmd)),Y=fe.a,W=fe.b;return f(cB,f(Uf,lT,G.appCmds),L(U(t,{submodel:Py(G.model),txSentry:Y}),ao(F([f(Pg,lT,G.cmd),W]))))}return L(t,io);case"TxSentryMsg":var le=e.a,de=f(tB,le,t.txSentry),I=de.a,he=de.b;return L(U(t,{txSentry:I}),he);case"TradeCacheMsg":var pe=e.a,G=f(fT,pe,t.tradeCache);return L(U(t,{tradeCache:G.tradeCache}),f(Pg,vT,G.cmd));case"NoOp":return L(t,io);default:var K=e.a;f(kl,"test",K);return L(t,io)}}),lB=r(function(e,t){return f(uB,t,Sy(e))}),dB={$:"AllGood"},hB={$:"NoWeb3"},pB=function(e){return{$:"TxSentryMsg",a:e}},gB={$:"WrongNetwork"},vB={align:Yp,mainParagraphs:F([F([Jp("No web3 provider detected. Is "),f(yA,F([wA(l(bA,0,0,1))]),{label:Jp("Metamask"),url:"https://metamask.io/"}),Jp(" or some other web3 provider installed and unlocked?")])]),noticeType:tg},yB={$:"TopLeft"},mB={align:yB,mainParagraphs:F([F([Jp("Your screen is quite small--things may be very broken! We will be addressing this soon.")])]),noticeType:tg},bB=n(function(e,t,r){var n=e.a,a=e.b;return $g({inPort:a,nodePath:r,outPort:n,ref:1,tagger:t,txs:Ch})}),CB=n(function(e,t,r){var n=e.width<1024?ya(mB):ma,a=function(){if(e.networkId){var t=xa(e.networkId);if("Nothing"===t.$)return L(la(da),gB);return L(t.a,dB)}return L(la(da),hB)}(),i=a.a,o=a.b,u=La(i),s=FE(u),c=s.a,d=s.b,h=l(bB,L(ro,eo),pB,u.httpProvider),p=function(){switch(o.$){case"NoWeb3":return ya(vB);case"WrongNetwork":return ya(BA);default:return ma}}(),g=QC(F([n,p])),v=f(lB,t,{initialWeb3State:o,key:r,screenWidth:e.width,submodel:hT,time:Ff(0),tradeCache:c,txSentry:h,userAddress:ma,userInfo:ma,userNotices:mr,web3Context:u}),y=v.a,m=v.b;return L(f(Za,g,y),ao(F([f(Pg,vT,d),m])))}),SB=ze("networkSentryPort",Zi),EB=Me,TB=EB(mr),wB=function(e){return TB},IB=function(e){return{$:"Refresh",a:e}},AB=r(function(e,t){return{$:"Every",a:e,b:t}}),BB=r(function(e,t){return{processes:t,taggers:e}}),kB=Qh(f(BB,Ch,Ch)),NB=o(function(e,t,a,i,o,u){var s=n(function(r,n,i){e:for(;;){var o=i.a,u=i.b;if(o.b){var s=o.a,c=s.a,f=s.b,h=o.b;if(_(c,r)<0){var p=r,g=n,v=L(h,l(e,c,f,u));r=p,n=g,i=v;continue e}return _(c,r)>0?L(o,l(a,r,n,u)):L(h,d(t,c,f,n,u))}return L(o,l(a,r,n,u))}}),c=l(wE,s,L(Ka(i),u),o),f=c.a,h=c.b;return l(za,r(function(t,r){var n=t.a,a=t.b;return l(e,n,a,r)}),h,f)}),RB=Re,$B=r(function(e,t){var r=e.a,n=e.b,a=f(Sh,r,t);if("Nothing"===a.$)return l(Bh,r,F([n]),t);var i=a.a;return l(Bh,r,f(qa,n,i),t)}),xB=ke,_B=r(function(e,t){return{$:"Zone",a:e,b:t}}),LB=fa,PB=n(function(e,t,r){if(t.b){var n=t.a,a=t.b,i=xB(f(LB,n,f(Mh,e,n)));return f(ip,function(t){return l(PB,e,a,l(Bh,n,t,r))},i)}return Qh(r)}),DB=n(function(e,t,r){var i=r.processes,o=n(function(e,t,r){var n=r.a,a=r.b,i=r.c;return P(n,a,f(ip,function(e){return i},RB(t)))}),u=l(za,$B,Ch,t),s=n(function(e,t,r){var n=r.a,a=r.b,i=r.c;return P(f(qa,e,n),a,i)}),c=a(function(e,t,r,n){var a=n.a,i=n.b,o=n.c;return P(a,l(Bh,e,r,i),o)}),d=p(NB,s,c,o,u,i,P(mr,Ch,Qh(vr))),h=d.a,g=d.b,v=d.c;return f(ip,function(e){return Qh(f(BB,u,e))},f(ip,function(t){return l(PB,e,h,g)},v))}),UB=function(e){return Ie(function(t){t(Te(e(Date.now())))})}(Ff),OB=n(function(e,t,r){var n=f(Sh,t,r.taggers);if("Nothing"===n.$)return Qh(r);var a=n.a,i=function(t){return cp(f(tu,function(r){return f(Oh,e,r(t))},a))};return f(ip,function(e){return Qh(r)},f(ip,i,UB))}),MB=r(function(e,t){var r=t.a,n=t.b;return f(AB,r,f(wf,e,n))});gn.Time=De(kB,DB,OB,0,MB);var FB=Oe("Time"),VB=r(function(e,t){return FB(f(AB,e,t))}),KB=function(e){return f(VB,2e3,IB)},HB=function(e){return TB},jB=function(e){return{$:"Refresh",a:e}},qB=function(e){return f(VB,2e3,jB)},GB=function(e){return{$:"DecryptionFinished",a:e}},zB=ze("decryptionFinished",Zi),YB=ze("encryptionFinished",Zi),WB=function(e){return{$:"EncryptionFinished",a:e}},JB=function(e){return{$:"Refresh",a:e}},QB=function(e){return EB(F([f(VB,3e3,JB),YB(WB),zB(function(e){return xS(GB(e))})]))},XB=mn,ZB=function(e){var t=e.submodel;switch(t.$){case"BetaLandingPage":return TB;case"CreateModel":t.a;return f(XB,Uy,KB());case"QuickCreateModel":t.a;return f(XB,Fy,qB());case"TradeModel":t.a;return f(XB,Ky,QB());case"MarketplaceModel":t.a;return f(XB,gT,HB());default:t.a;return f(XB,lT,wB())}},ek=ze("userPubkeyResult",Zi),tk=ze("walletSentryPort",Zi),rk={$:"CheckForNewTrades"},nk=function(e){return f(VB,5e3,function(e){return rk})},ak=function(e){return{$:"NetworkUpdate",a:e}},ik=function(e){return{$:"Tick",a:e}},ok=function(e){return{$:"UserPubkeySet",a:e}},uk=function(e){return{$:"WalletStatus",a:e}},sk=function(e){return f(Qp,"Error decoding JS walletSentry: "+e,ma)},ck=function(e){return{$:"ErrorDecoding",a:e}},fk=r(function(e,t){return{$:"TxSigned",a:e,b:t}}),lk=l(Af,r(function(e,t){return{ref:e,txHash:t}}),f(Od,"ref",ZC),f(Od,"txHash",$A(pE))),dk=function(e){var t=f(Yd,lk,e);if("Ok"===t.$){var r=t.a,n=r.txHash;if("Just"===n.$){var a=n.a;return f(fk,r.ref,Ii(a))}return f(fk,r.ref,wi("Problem signing/broadcasting Tx. Ref #"+ji(r.ref)))}t.a;return ck("Error decoding tx data")},hk=function(e){var t=e.a;return f(XB,t.tagger,t.inPort(dk))},pk=f(If,Ra,ZC),gk=Lo(f($a,nl,f($a,_l("Failure decoding stringy int"),Eo(Ra)))),vk=nE(F([gk,pk])),yk=r(function(e,t){return{account:e,networkId:t}}),mk=l(Af,yk,f(Od,"account",$A(uE)),f(Od,"networkId",vk)),bk=n(function(e,t,r){var n=f(Yd,mk,r);if("Err"===n.$){var a=n.a;return e(Qi(a))}return t(n.a)}),Ck=function(e){var t=f($a,sk,f($a,Sf,dT));return EB(O(F([f(VB,1e3,ik),tk(f(bk,t,uk)),hk(e.txSentry),ek(ok),f(XB,vT,nk(e.tradeCache)),SB(ak)]),F([ZB(e)])))},Sk=function(e){return{$:"LinkClicked",a:e}},Ek=function(e){return{$:"UrlChanged",a:e}},Tk=n(function(e,t,r){return d(mA,e/255,t/255,r/255,1)}),wk=l(Tk,10,33,108),Ik={$:"Generic"},Ak=Ik,Bk=r(function(e,t){return d(gA,$T,Ak,f(qa,AT(wT),f(qa,ET(wT),e)),NT(F([t])))}),kk=function(e){return{$:"Fill",a:e}},Nk=kk(1),Rk=Nf,$k=function(e){return{$:"Px",a:e}},xk=$k,_k=aw(8),Lk=function(e){return f(EA,_k,l(SA,"bg-"+TA(e),"background-color",e))},Pk=f(Bk,F([AT(Nk),ET(xk(150)),Lk(wk)]),Rk),Dk=function(e){return{$:"GotoRoute",a:e}},Uk={$:"Active"},Ok={$:"Important"},Mk={$:"Normal"},Fk=l(bA,1,1,1),Vk=aw(2),Kk=i(function(e,t,r,n,a){return{$:"PaddingStyle",a:e,b:t,c:r,d:n,e:a}}),Hk=r(function(e,t){return $(e,t)?f(EA,Vk,h(Kk,"p-"+ji(e),e,e,e,e)):f(EA,Vk,h(Kk,"p-"+ji(e)+"-"+ji(t),t,e,t,e))}),jk=aw(21),qk=r(function(e,t){return{$:"Class",a:e,b:t}}),Gk=f(qk,jk,PT.cursorPointer),zk=aw(17),Yk=function(e){return f(EA,zk,l(WI,"br-"+ji(e),"border-radius",ji(e)+"px"))},Wk=function(e){return{$:"Normal",a:e}},Jk=Kn,Qk=r(function(e,t){return f(Jk,e,Wk(t))}),Xk=function(e){return f(Qk,"click",_o(e))},Zk=f(wf,BT,Xk),eN=aw(13),tN=f(qk,eN,PT.textSemiBold),rN=aw(4),nN=function(e){return{$:"FontSize",a:e}},aN=function(e){return f(EA,rN,nN(e))},iN=n(function(e,t,r){var n=function(){switch(r.$){case"Normal":return mr;case"Active":return F([Yk(4),Lk(l(bA,0,0,1))]);default:return F([Yk(4),Lk(l(bA,.9,0,0))])}}();return f(Bk,O(F([f(Hk,23,12),aN(22),tN,wA(Fk),Gk,Zk(t)]),n),Jp(e))}),oN=l(Tk,244,0,103),uN=function(e){return{$:"AlignX",a:e}},sN={$:"CenterX"},cN=uN(sN),fN=aw(3),lN=n(function(e,t,r){return{$:"SpacingStyle",a:e,b:t,c:r}}),dN=r(function(e,t){return"spacing-"+ji(e)+"-"+ji(t)}),hN=function(e){return f(EA,fN,l(lN,f(dN,e,e),e,e))},pN=function(e){return{$:"Describe",a:e}},gN={$:"Paragraph"},vN=r(function(e,t){return d(gA,YT,Ak,f(qa,pN(gN),f(qa,AT(Nk),f(qa,hN(5),e))),NT(t))}),yN=f(qk,eN,PT.bold),mN=f(Bk,F([aN(29),wA(Fk),yN,cN,Gk,Zk(Dk(Wv))]),f(vN,mr,F([Jp("DAI"),f(Bk,F([wA(oN)]),Jp("Hard"))]))),bN=function(e){var t=e.web3Context.factoryType;if("Native"!==t.$){if("EthDai"===t.a.$){t.a;return"Mainnet Dai"}t.a;return"Testnet Dai"}switch(t.a.$){case"Eth":t.a;return"Mainnet ETH";case"Kovan":t.a;return"Testnet ETH";default:t.a;return"xDai"}},CN=vA(PT.italic),SN=function(e){return f(Bk,F([aN(18),wA(l(bA,.8,.8,1)),tN,CN,cN]),Jp(bN(e)))},EN={$:"Right"},TN=uN(EN),wN={$:"AsColumn"},IN=wN,AN=r(function(e,t){return d(gA,IN,Ak,f(qa,vA(PT.contentTop+" "+PT.contentLeft),f(qa,ET(wT),f(qa,AT(wT),e))),NT(t))}),BN={$:"AsRow"},kN=BN,NN=r(function(e,t){return d(gA,kN,Ak,f(qa,vA(PT.contentLeft+" "+PT.contentCenterY),f(qa,AT(wT),f(qa,ET(wT),e))),NT(t))}),RN=function(e){return f(NN,F([AT(Nk),hN(30),f(Hk,30,17)]),F([l(iN,"Create a New Offer",Dk(Yv),function(){return"CreateModel"===e.submodel.$?Uk:Mk}()),l(iN,"Sell Offers",Dk(Jv(ry)),function(){var t=e.submodel;if("MarketplaceModel"===t.$){return $(t.a.browsingRole,ry)?Uk:Mk}return Mk}()),l(iN,"Buy Offers",Dk(Jv(Of)),function(){var t=e.submodel;if("MarketplaceModel"===t.$){return $(t.a.browsingRole,Of)?Uk:Mk}return Mk}()),function(){var t=e.userInfo;if("Just"===t.$){var r=t.a;return l(iN,"My Trades",Dk(f(vf,r.address,Of)),function(){var t=e.submodel;if("AgentHistoryModel"===t.$){return $(t.a.agentAddress,r.address)?Uk:Mk}return Mk}())}return l(iN,"Connect to Wallet",pT,Ok)}(),f(AN,F([TN,hN(0),f(Hk,8,0)]),F([mN,SN(e)]))]))},$N=function(e){return function(t){return $(t.parameters.initiatorAddress,e.agentAddress)||$(t.state.responder,ya(e.agentAddress))}},xN=function(e){switch(e.$){case"Open":return 1;case"Committed":return 2;case"Judgment":return 3;default:return 4}},_N=function(e){return r(function(e,t){var r=f(su,xN(e.state.phase),xN(t.state.phase));return $(r,Pa)?r:f(Kg,e.derived.phaseEndTime,t.derived.phaseEndTime)})},LN=Er,PN=r(function(e,t){return f($a,Zd(e),LN(t))}),DN=function(e){return{$:"AlignY",a:e}},UN={$:"CenterY"},ON=DN(UN),MN=aw(20),FN=f(qk,MN,PT.clip),VN=kk,KN=function(e){return f(EA,Vk,h(Kk,"p-"+ji(e),e,e,e,e))},HN=function(e){var t=e.a,r=e.b;return f(Bk,F([AT(VN(t)),ET(xk(60)),FN,Lk(Fk)]),f(Bk,F([KN(12),ON,AT(Nk)]),r))},jN=f(qk,eN,PT.textMedium),qN=function(e){return f(Bk,F([jN,aN(17)]),Jp(e))},GN=function(e){return{$:"Poke",a:e}},zN=aw(33),YN={$:"Hover"},WN=r(function(e,t){return{$:"PseudoSelector",a:e,b:t}}),JN=zn,QN=r(function(e,t){return{$:"Nearby",a:e,b:t}}),XN={$:"NoAttribute"},ZN=r(function(e,t){return{$:"TransformComponent",a:e,b:t}}),eR=r(function(e,t){switch(t.$){case"NoAttribute":return XN;case"Describe":var r=t.a;return pN(r);case"AlignX":var n=t.a;return uN(n);case"AlignY":var a=t.a;return DN(a);case"Width":var n=t.a;return IT(n);case"Height":var n=t.a;return ST(n);case"Class":var n=t.a,a=t.b;return f(qk,n,a);case"StyleClass":var i=t.a,o=t.b;return f(EA,i,o);case"Nearby":var u=t.a,s=t.b;return f(QN,u,f(_f,e,s));case"Attr":var c=t.a;return BT(f(JN,e,c));default:var l=t.a,d=t.b;return f(ZN,l,d)}}),tR=function(e){return f(eR,lg,e)},rR=r(function(e,t){var r=t.a,n=t.b,a=tR(e);switch(a.$){case"StyleClass":var i=a.b;return L(f(qa,i,r),n);case"TransformComponent":var o=(a.a,a.b);return L(r,f(uA,n,o));default:return L(r,n)}}),nR=function(e){var t=l(za,rR,L(mr,hA),e),r=t.a,n=t.b;return f(qa,JI(n),r)},aR=function(e){return f(EA,zN,f(WN,YN,nR(e)))},iR=a(function(e,t,r,n){return d(mA,e/255,t/255,r/255,n)}),oR=me,uR=r(function(e,t){return f(jn,e,oR(t))}),sR=uR("disabled"),cR=function(e){return f(qn,"tabIndex",ji(e))},fR=function(e){if("StyleClass"===e.$&&"PseudoSelector"===e.b.$&&"Focus"===e.b.a.$){var t=e.b;t.a;return!0}return!1},lR=function(e){return f(Cd,fR,e)?XN:vA("focusable")},dR=function(e){return{$:"MayPreventDefault",a:e}},hR=r(function(e,t){return f(Jk,e,dR(t))}),pR=r(function(e,t){var r=function(r){return $(r,e)?_o(t):$o("Not the enter key")},n=f(Ro,r,f(Od,"key",xo));return BT(f(hR,"keyup",f(If,function(e){return L(e,!0)},n)))}),gR=function(e){return f(pR,"Enter",e)},vR={$:"Button"},yR=r(function(e,t){var r=t.onPress,n=t.label;return d(gA,$T,Ak,f(qa,AT(wT),f(qa,ET(wT),f(qa,vA(PT.contentCenterX+" "+PT.contentCenterY+" "+PT.seButton+" "+PT.noTextSelection),f(qa,Gk,f(qa,lR(e),f(qa,pN(vR),f(qa,BT(cR(0)),function(){if("Nothing"===r.$)return f(qa,BT(sR(!0)),e);var t=r.a;return f(qa,Zk(t),f(qa,gR(t),e))}()))))))),NT(F([n])))}),mR=function(e){return f(yR,F([Lk(d(iR,16,7,234,.2)),KN(5),Yk(4),AT(Nk),aR(F([Lk(d(iR,16,7,234,.4))]))]),{label:f(Bk,F([cN,wA(l(Tk,16,7,234)),jN,aN(14)]),Jp("Poke")),onPress:ya(GN(e))})},bR=function(e){return{$:"TimeLeft",a:e}},CR=function(e){return{$:"TimeUp",a:e}},SR=r(function(e,t){switch(e.$){case"Open":return t.parameters.autorecallInterval;case"Committed":return t.parameters.autoabortInterval;case"Judgment":return t.parameters.autoreleaseInterval;default:return Ff(0)}}),ER=r(function(e,t){return Ff(Gl(e)-Gl(t))}),TR=r(function(e,t){var r=f(SR,t.state.phase,t),n=f(ER,e,t.state.phaseStartTime),a=f(ER,r,n);return Gl(a)>0?bR(L(a,r)):CR(r)}),wR=function(e){switch(e.$){case"Open":return"Expiring...";case"Committed":return"Aborting...";case"Judgment":return"Releasing...";default:return""}},IR=l(bA,0,0,0),AR=l(Tk,233,237,242),BR={$:"Behind"},kR=function(e){return f(QN,BR,e)},NR=r(function(e,t){var r=Ag(200*e),n=200-r,a=f(Bk,F([AT(VN(n))]),Rk),i=F([ET(xk(3)),Yk(20)]),o=f(Bk,O(i,F([AT(VN(r)),Lk(t)])),Rk),u=f(Bk,O(i,F([AT(Nk),Lk(AR)])),Rk);return f(NN,F([AT(Nk),kR(u)]),F([o,a]))}),RR=l(Tk,51,183,2),$R=function(e){return Gl(e)<0},xR=a(function(e,t,r,n){return{days:e,hours:t,min:r,sec:n}}),_R=function(e){var t=_p(e);return function(e){var t=e.a,r=e.b;return function(e){var r=e.a,n=e.b;return function(e){var n=e.a,a=e.b;return d(xR,lC(t),lC(r),lC(n),lC(a))}(f(ec,L(lu(0),lu(0)),f(Hu,n,lu(60))))}(f(ec,L(lu(0),lu(0)),f(Hu,r,lu(3600))))}(f(ec,L(lu(0),lu(0)),f(Hu,t,lu(86400))))},LR=a(function(e,t,n,a){for(;;){var i=n.a,o=n.b;if(!$R(a)){var u=r(function(e,t){return O(l(Ju,2,D("0"),ji(e)),t)}),s=Gl(a)>0?i:o,c=_R(a),d=c.days||c.hours?i:o,h=c.days?i:o;return f(NN,O(F([hN(5)]),e),F([f(Bk,O(F([wA(h)]),t),Jp(f(u,c.days,"d"))),f(Bk,O(F([wA(d)]),t),Jp(f(u,c.hours,"h"))),f(Bk,O(F([wA(s)]),t),Jp(f(u,c.min,"m")))]))}var p=e,g=t,v=L(i,o),y=Ff(0);e=p,t=g,n=v,a=y}}),PR=l(bA,1,1,0),DR=r(function(e,t){return Gl(e)/Gl(t)}),UR=a(function(e,t,r,n){var a=r.a,i=r.b,o=n.a,u=n.b,s=f(DR,o,u),c=(f(Bk,F([cN]),d(LR,mr,mr,L(a,i),o)),s<.1?oN:s<.2?PR:RR);return f(AN,O(F([hN(5)]),e),F([d(LR,F([cN]),t,L(a,i),o),f(NR,1-s,c)]))}),OR=a(function(e,t,r,n){var a=f(TR,e,t);if("TimeLeft"===a.$){var i=a.a,o=r&&f(DR,i.a,i.b)<.05?oN:IR;return d(UR,F([AT(Nk)]),F([aN(16)]),L(o,AR),i)}return f(AN,F([hN(4),AT(Nk)]),O(F([f(Bk,F([cN,aN(14)]),Jp(wR(t.state.phase)))]),n?F([f(Bk,F([cN]),mR(t.creationInfo.address))]):mr))}),MR=function(e){return{$:"JustImage",a:e}},FR=MR,VR=function(e){return l(za,r(function(e,t){var r=e.a,n=e.b;return l(Bh,r,n,t)}),Ch,e)}(f(tu,function(e){var t=e.a;return L(t,L(e.b,FR({description:t,src:"/DAIHard/static/img/currencies/"+t+".svg"})))},F([L("AUD","$"),L("CLP","$"),L("EUR","€"),L("IDR","Rp"),L("KRW","₩"),L("NZD","$"),L("RUB","₽"),L("TRY","₺"),L("BRL","R$"),L("CNY","¥"),L("GBP","£"),L("ILS","₪"),L("MXN","$"),L("PHP","₱"),L("SEK","kr"),L("TWD","NT$"),L("CAD","$"),L("CZK","Kč"),L("HKD","$"),L("INR","₹"),L("MYR","RM"),L("PKR","₨"),L("SGD","$"),L("USD","$"),L("CHF","Fr"),L("DKK","kr"),L("HUF","Ft"),L("JPY","¥"),L("NOK","kr"),L("PLN","zł"),L("THB","฿"),L("ZAR","R"),L("VND","₫")]))),KR=function(e){return f(ec,"",f(jf,hi,f(Sh,e,VR)))},HR=function(e){return go(e)<=3?e:HR(f(wl,3,e))+","+f(wo,3,e)},jR=function(e){return HR(Tl(e))},qR=function(e){return O(KR(e.fiatType),jR(e.amount))},GR=yT("alt"),zR=function(e){return f(yT,"src",ot(e))},YR=r(function(e,t){var r=t.src,n=t.description,a=f(Zd,function(e){switch(e.$){case"Width":case"Height":return!0;default:return!1}},e);return d(gA,$T,Ak,f(qa,vA(PT.imageContainer),e),NT(F([d(gA,$T,kT("img"),O(F([BT(zR(r)),BT(GR(n))]),a),NT(mr))])))}),WR=r(function(e,t){if("None"===t.$)return Rk;var r=t.a;return f(YR,e,r)}),JR=mA,QR=function(e){var t=function(){var t=f(Sh,e.fiatType,VR);if("Nothing"===t.$)return Rk;var r=t.a,n=(r.a,r.b);return f(WR,F([ET(xk(26))]),n)}();return f(NN,F([hN(4)]),F([t,f(Bk,F([wA(d(JR,0,0,0,.5)),jN,AT(xk(50))]),Jp(e.fiatType)),Jp(qR(e))]))},XR=function(e){return QR(e)},ZR=function(e){return f(Bk,F([AT(Nk),ET(Nk),FN]),f(vN,F([aN(12)]),F([Jp(e.info)])))},e$=function(e){return f(ec,Rk,f(jf,ZR,Xf(e)))},t$=MR({description:"DAI",src:"/DAIHard/static/img/dai-symbol.png"}),r$=function(e){return f(WR,f(qa,ET(xk(26)),e),t$)},n$=function(e){var t=Il(Hf(e)),r=f(Zf,".",t);if(!r.b)return t;if(r.b.b){kl("Error interpreting evmValueToString result. More than one decimal??");return"???"}switch(r.a){case 0:return"0"+f(Co,3,t);case 1:return f(Co,4,f(ec,t,f(jf,Tw,f(jf,function(e){return e/100},f(jf,ni,f(jf,Ag,f(jf,yi(100),Nl(t))))))));default:var n=r.a;return f(ec,f(Co,n,t),f(jf,ji,f(jf,Ag,Nl(t))))}},a$=function(e){var t=n$(e);return f(NN,F([hN(4)]),F([r$(mr),f(Bk,F([aN(16)]),Jp(t))]))},i$=function(e){return a$(e)},o$=function(e){return{$:"TradeClicked",a:e}},u$=function(e){return f(yR,F([Lk(d(iR,16,7,234,.2)),KN(11),Yk(4),AT(Nk),aR(F([Lk(d(iR,16,7,234,.4))]))]),{label:f(Bk,F([cN,wA(l(Tk,16,7,234)),jN]),Jp("View Offer")),onPress:ya(o$(e))})},s$=i(function(e,t,r,n,a){return f(NN,F([AT(Nk),hN(1)]),F([function(){switch(n.$){case"Open":return HN(L(2,d(OR,e,a,!1,t)));case"Committed":return HN(L(2,d(OR,e,a,$(r,ry),t)));case"Judgment":return HN(L(2,d(OR,e,a,$(r,Of),t)));default:return Rk}}(),HN(L(1,i$(a.parameters.tradeAmount))),HN(L(2,XR(a.terms.price))),HN(L(6,e$(a.terms.paymentMethods))),HN(L(2,u$(a.id)))]))}),c$=aw(28),f$=function(e){return f(EA,c$,l(SA,"bc-"+TA(e),"border-color",e))},l$=i(function(e,t,r,n,a){return{$:"BorderWidth",a:e,b:t,c:r,d:n,e:a}}),d$=function(e){return f(EA,fA,h(l$,"b-"+ji(e),e,e,e,e))},h$=n(function(e,t,r){var n=function(){switch(r.viewPhase.$){case"Open":return"Expires in";case"Committed":return"Payment Due";case"Judgment":return"Auto-Release";default:return""}}(),a=function(){return"Buyer"===r.agentRole.$?"Buying":"Selling"}();return f(AN,F([AT(Nk),ET(Nk),f(Hk,30,10),hN(5)]),F([f(NN,F([AT(Nk)]),F([$(r.viewPhase,rC)?Rk:HN(L(2,qN(n))),HN(L(1,qN(a))),HN(L(2,qN("For Fiat"))),HN(L(6,qN("Payment Methods"))),HN(L(2,Rk))])),f(AN,F([AT(Nk),d$(1),Yk(8),f$(AR),hN(1),Lk(AR),FN]),f(tu,d(s$,e,!$(r.userInfo,ma),r.agentRole,r.viewPhase),t))]))}),p$=n(function(e,t,r){return $(f(CS,e,r),ya(t))}),g$=l(Tk,150,150,150),v$=function(e){return f(Zd,function(e){return bb(e.parameters)},GE(e))},y$=n(function(e,t,r){var n=l(PN,$N(r),_N(),v$(t)),a=f(Zd,function(e){return l(p$,e,r.agentRole,r.agentAddress)&&$(e.state.phase,r.viewPhase)},n),i=function(e){return f(Bk,F([aN(24),tN,wA(g$),cN,KN(20)]),Jp(e))},o=L(t.dataFetchStatus.total,a);if("Nothing"===o.a.$){o.a;return i("Querying Factory contract...")}if(o.a.a){if(o.b.b){var u=o.a.a;return l(h$,e,a,r)}var u=o.a.a;return i(_(t.dataFetchStatus.loaded,u-t.dataFetchStatus.invalid)<0?"Searching for user trades...":"No matching trades found.")}return i("No trades found.")}),m$=r(function(e,t){return f(Bk,F([Yk(4),Lk(d(JR,0,0,1,.1)),wA(l(Tk,16,7,234)),aN(e),tN,f(Hk,15,13)]),Jp(Xd(t)))}),b$=a(function(e,t,r,n){return"pad-"+ji(e)+"-"+ji(t)+"-"+ji(r)+"-"+ji(n)}),C$=function(e){var t=e.top,r=e.right,n=e.bottom,a=e.left;return $(t,r)&&$(t,n)&&$(t,a)?f(EA,Vk,h(Kk,"p-"+ji(t),t,t,t,t)):f(EA,Vk,h(Kk,d(b$,t,r,n,a),t,r,n,a))},S$=function(e){return function(){var t=e.userInfo;return"Nothing"!==t.$&&$(t.a.address,e.agentAddress)}()?f(Bk,F([f(Hk,30,10),aN(24),tN]),Jp("Your Trades")):f(NN,F([hN(10),C$({bottom:30,left:30,right:30,top:10})]),F([f(Bk,F([aN(24),tN]),Jp("Trade History for User")),f(m$,18,e.agentAddress)]))},E$=function(e){return{$:"ViewPhaseChanged",a:e}},T$=l(bA,0,0,1),w$=function(e){var t=F([aN(20),yN,Gk]),r=function(e){return e?O(t,F([wA(T$)])):t};return f(NN,F([hN(30)]),F([f(Bk,O(F([Zk(E$(no))]),r($(e,no))),Jp("Open")),f(Bk,O(F([Zk(E$(nC))]),r($(e,nC))),Jp("Payment Due")),f(Bk,O(F([Zk(E$(aC))]),r($(e,aC))),Jp("Release Due")),f(Bk,O(F([Zk(E$(rC))]),r($(e,rC))),Jp("Closed"))]))},I$=function(e){return f(Bk,F([f(Hk,30,10)]),w$(e.viewPhase))},A$=function(e){return{$:"ViewUserRoleChanged",a:e}},B$=d(iR,1,31,52,.13),k$=function(e){var t=F([aN(24),tN,Gk]),r=function(){return"Buyer"===e.$?L(t,O(t,F([wA(B$)]))):L(O(t,F([wA(B$)])),t)}(),n=r.a,a=r.b;return f(NN,F([hN(20)]),F([f(Bk,O(F([Zk(A$(Of))]),a),Jp("As the Seller")),f(Bk,O(F([Zk(A$(ry))]),n),Jp("As the Buyer"))]))},N$=function(e){return f(Bk,F([f(Hk,30,10)]),k$(e.agentRole))},R$=n(function(e,t,r){return f(AN,F([Yk(5),Lk(Fk),AT(Nk),ET(Nk),f(Hk,0,20)]),F([S$(r),N$(r),I$(r),l(y$,e,t,r)]))}),$$=function(e){return{$:"ShowCurrencyDropdown",a:e}},x$={$:"AbortCreate"},_$=r(function(e,t){return{$:"ConfirmCreate",a:e,b:t}}),L$=function(e){return f(tu,function(e){return F([f(Bk,F([wA(oN)]),Jp("Caution! ")),Jp(e)])},QC(F([$(f(Kg,e.autoreleaseInterval,Ff(12e5)),Da)?ya(function(){return"Buyer"===e.initiatorRole.$?"That Burn/Release Window time is quite small! It might take a while to find a committed Seller.":"That Burn/Release Window time is quite small! This may attract scammers. Only create this trade if you know what you're doing."}()):ma,$(f(Kg,e.autoabortInterval,Ff(36e5)),Da)?ya(function(){return"Buyer"===e.initiatorRole.$?'That Payment Window time is quite small! If you fail to to 1. make the payment and 2. click "confirm" before this time is up, the trade will automatically abort, incurring the abort punishments on both parties.':'That Payment Window time is quite small! If the Buyer fails to to 1. make the payment and 2. click "confirm" before this time is up, the trade will automatically abort, incurring the abort punishments on both parties.'}()):ma])))},P$=function(e){return f(Bk,F([C$({bottom:5,left:5,right:5,top:0}),Zk(e),Yk(30),Lk(d(JR,1,1,1,.4)),d$(1),f$(d(JR,0,0,0,.3)),Gk,aN(14)]),f(Bk,F([wA(d(JR,0,0,0,.7))]),Jp("x")))},D$=Hn,U$=D$,O$=BT,M$=r(function(e,t){return f(Bk,F([kR(f(Bk,F([Lk(e),O$(f(U$,"position","fixed")),O$(f(U$,"z-index","1000")),O$(f(U$,"top","0")),O$(f(U$,"left","0")),O$(f(U$,"width","100%")),O$(f(U$,"height","100%"))]),Rk)),AT(Nk),ET(Nk)]),t)}),F$={$:"Top"},V$=DN(F$),K$={$:"InFront"},H$=function(e){return f(QN,K$,e)},j$=r(function(e,t){return{$:"Max",a:e,b:t}}),q$=r(function(e,t){return f(j$,e,t)}),G$=n(function(e,t,r){return l(va,M$,d(JR,0,0,.3,.6),f(Bk,O(F([cN,ON,AT(f(q$,500,wT)),Lk(Fk),Yk(8),H$(f(Bk,F([TN,V$]),P$(r)))]),e),t))}),z$=r(function(e,t){if("Nothing"===t.$)return Rk;var r=t.a;return f(Bk,O(F([Yk(5),f$(l(bA,.9,0,0)),d$(1),Lk(l(bA,1,.4,.4)),KN(5),cN,ON,AT(f(q$,200,wT)),aN(14)]),e),f(vN,mr,F([Jp(r)])))}),Y$={$:"Above"},W$=function(e){return f(QN,Y$,e)},J$=aw(26),Q$=function(e){return{$:"MoveY",a:e}},X$=function(e){return f(ZN,J$,Q$(-e))},Z$=r(function(e,t){return f(Bk,F([Yk(4),f(Hk,25,17),aN(18),tN,Lk(AR),W$(f(z$,F([X$(5)]),t))]),Jp(e))}),ex=d(iR,1,31,52,.64),tx=aw(32),rx={$:"Active"},nx=function(e){return f(EA,tx,f(WN,rx,nR(e)))},ax=a(function(e,t,r,n){var a=e.a,i=e.b,o=e.c;return f(Bk,F([Yk(4),Gk,Zk(n),f(Hk,25,17),wA(t),aN(18),tN,Lk(a),nx(F([Lk(o)])),aR(F([Lk(i)]))]),Jp(r))}),ix=r(function(e,t){return d(ax,P(d(JR,1,0,0,1),d(JR,1,0,0,.8),d(JR,1,0,0,.6)),Fk,e,t)}),ox=aw(12),ux=f(qk,ox,PT.textCenter),sx=function(e){return M$(d(JR,0,0,.3,.6))(f(AN,F([hN(10),cN,ON,Lk(d(JR,0,0,0,.5)),Yk(8),KN(20)]),f(tu,function(e){return f(vN,F([cN,ON,aN(20),tN,wA(Fk),ux]),F([e]))},e)))},cx=r(function(e,t){if("Token"===e.$){if("EthDai"===e.a.$){e.a;return"https://etherscan.io/tx/"+_A(t)}e.a;return"https://kovan.etherscan.io/tx/"+_A(t)}switch(e.a.$){case"Eth":e.a;return"https://etherscan.io/tx/"+_A(t);case"Kovan":e.a;return"https://kovan.etherscan.io/tx/"+_A(t);default:e.a;return"https://blockscout.com/poa/dai/tx/"+_A(t)}}),fx={$:"Bottom"},lx=DN(fx),dx=vA(PT.underline),hx=r(function(e,t){switch(e.$){case"Confirm":var r=e.a,n=Qf(t.web3Context.factoryType),a=function(){var e=t.depositAmount;if("Just"===e.$){var n=e.a;return L(Jp(n$(Fv(n))),f(ix,"Yes, I definitely want to open this trade.",f(_$,r,n)))}return L(Jp("??"),f(Z$,"(loading exact fees...)",ma))}(),i=a.a,o=a.b;return l(G$,mr,f(AN,F([hN(20),KN(20),cN,ET(Nk),ux]),F([f(Bk,F([aN(26),tN,cN,ON]),Jp("Just to Confirm...")),f(AN,F([hN(20),cN,ON]),f(tu,vN(F([cN,aN(18),jN,wA(ex)])),O(L$(r),O(F([F([Jp("You will deposit "),i,Jp(" "+n+" (including the 1% dev fee) to open this trade.")])]),function(){return"Token"===t.web3Context.factoryType.$?F([F([Jp("This ususally requires two Metamask signatures. Your "+n+" will not be deposited until the final transaction has been mined.")])]):mr}())))),f(Bk,F([lx,cN]),o)])),x$);case"ApproveNeedsSig":return sx(F([Jp("Waiting for user signature for the approve call."),Jp("(check Metamask!)"),Jp("Note that there will be a second transaction to sign after this.")]));case"ApproveMining":var r=e.a,u=e.b;return sx(F([Jp("Mining the initial approve transaction..."),f(yA,F([dx,wA(T$)]),{label:Jp("See the transaction on Etherscan"),url:f(cx,t.web3Context.factoryType,u)}),Jp("Funds will not leave your wallet until you sign the next transaction.")]));case"CreateNeedsSig":return sx(F([Jp("Waiting for user signature for the create call."),Jp("(check Metamask!)")]));default:var u=e.a;return sx(F([Jp("Mining the final create call..."),f(yA,F([dx,wA(T$)]),{label:Jp("See the transaction on Etherscan"),url:f(cx,t.web3Context.factoryType,u)}),Jp("You will be redirected when it's mined.")]))}}),px=function(e){var t=e.txChainStatus;if("Nothing"===t.$)return Rk;var r=t.a;return f(hx,r,e)},gx=function(e){return{$:"TradeAmountChanged",a:e}},vx=yT("id"),yx=O$(vx("inputError")),mx=l(Tk,109,127,138),bx=function(e){return f(NN,F([hN(4)]),F([r$(mr),f(Bk,F([aN(24),jN,wA(mx)]),Jp(Qf(e)))]))},Cx={$:"Left"},Sx=uN(Cx),Ex=function(e){return{$:"HiddenLabel",a:e}},Tx=Ex,wx=yT("type"),Ix=function(e){return L(e,!0)},Ax=function(e){return{$:"MayStopPropagation",a:e}},Bx=r(function(e,t){return f(Jk,e,Ax(t))}),kx=r(function(e,t){return l(Ja,Od,t,e)}),Nx=f(kx,F(["target","value"]),xo),Rx=function(e){return f(Bx,"input",f(If,Ix,f(If,e,Nx)))},$x=aw(0),xx=r(function(e,t){return{$:"Transparency",a:e,b:t}}),_x=function(e){var t=function(e){return 1-e}(f(Hs,1,f(vi,0,e)));return f(EA,$x,f(xx,"transparency-"+yw(t),t))},Lx=a(function(e,t,r,n){return{$:"Padding",a:e,b:t,c:r,d:n}}),Px=n(function(e,t,r){if("HiddenLabel"===t.$){t.a;return d(gA,IN,kT("label"),e,NT(F([r])))}var n=t.a,a=t.b,i=t.c,o=d(gA,$T,Ak,a,NT(F([i])));switch(n.$){case"Above":return d(gA,IN,kT("label"),e,NT(F([o,r])));case"Below":return d(gA,IN,kT("label"),e,NT(F([r,o])));case"OnRight":return d(gA,kN,kT("label"),e,NT(F([r,o])));default:return d(gA,kN,kT("label"),e,NT(F([o,r])))}}),Dx=MI,Ux=f(wf,BT,Dx("autocomplete")),Ox=l(bA,136/255,138/255,133/255),Mx=l(bA,186/255,189/255,182/255),Fx=f(Hk,12,12),Vx=l(bA,1,1,1),Kx=F([Fx,Yk(3),f$(Mx),Lk(Vx),d$(1),hN(3),AT(Nk)]),Hx=function(e){return{$:"Label",a:e}},jx=function(e){if("HiddenLabel"===e.$){var t=e.a;return pN(Hx(t))}return XN},qx=function(e){e:for(;;){if("StyleClass"!==e.$)break e;switch(e.b.$){case"PaddingStyle":e.b;return!0;case"BorderWidth":e.b;return!0;case"Transform":return!0;default:break e}}return!1},Gx=function(e){return"HiddenLabel"===e.$},zx=uR("spellcheck"),Yx=f(wf,BT,zx),Wx=J,Jx=aw(47),Qx=a(function(e,t,r,n){var a=function(e){return e.a+e.c},i=function(e){return e<1?1:e}(Oi(Wx(e))),o=(i-1)*t+f(ec,0,f(jf,a,r))+f(ec,0,f(jf,a,n));return f(EA,Jx,l(WI,"textarea-height-"+ji(i),"height",function(e){return"calc("+ji(e)+"em + "+ji(o)+"px) !important"}(i)))}),Xx=yT("value"),Zx=f(wf,BT,Xx),e_={$:"LivePolite"},t_=pN(e_),r_=function(e){return l(Ja,r(function(e,t){var r=t.a,n=t.b;switch(e.$){case"NoAttribute":return L(r,n);case"Class":e.a;return L(f(qa,e,r),n);case"Attr":e.a;return L(f(qa,e,r),n);case"StyleClass":e.b;return L(f(qa,e,r),n);case"Width":e.a;return f(gw,"width",n)?L(r,n):L(f(qa,e,r),f(kE,"width",n));case"Height":e.a;return f(gw,"height",n)?L(r,n):L(f(qa,e,r),f(kE,"height",n));case"Describe":e.a;return f(gw,"described",n)?L(r,n):L(f(qa,e,r),f(kE,"described",n));case"Nearby":e.a,e.b;return L(f(qa,e,r),n);case"AlignX":return f(gw,"align-x",n)?L(r,n):L(f(qa,e,r),f(kE,"align-x",n));case"AlignY":return f(gw,"align-y",n)?L(r,n):L(f(qa,e,r),f(kE,"align-y",n));default:return f(gw,"transform",n)?L(r,n):L(f(qa,e,r),f(kE,"transform",n))}}),L(mr,mm),e).a},n_=r(function(e,t){return l(Ja,r(function(e,r){return t(e)?f(qa,e,r):r}),mr,r_(e))}),a_=function(e){e:for(;;)switch(e.$){case"Content":return!0;case"Max":case"Min":var t=e.b,r=t;e=r;continue e;default:return!1}},i_=f(wf,xf,Ou),o_=n(function(e,t,n){var a=function(e){return"Nearby"===e.$},i=F([BT(Rx(n.onChange))]),o=O(Kx,t),u=f(n_,o,function(e){e:for(;;)switch(e.$){case"Width":case"Height":if("Fill"===e.a.$)return!0;break e;case"AlignX":case"AlignY":return!0;case"StyleClass":switch(e.b.$){case"SpacingStyle":e.b;return!0;case"FontSize":return!0;case"FontFamily":e.b;return!0;default:break e}default:break e}return!1}),s=f(Zd,qx,o),c=f(n_,o,function(e){return"Height"===e.$&&"Fill"===e.a.$}),h=(f(n_,o,function(e){if("StyleClass"===e.$&&"PaddingStyle"===e.b.$){e.b;return!0}return!1}),f(n_,o,function(e){return"Nearby"===e.$})),p=f(Zd,f(wf,Tu,a),o),g=function(){var t=e.type_;if("TextInputNode"===t.$){var a=t.a;return P("input",O(F([Zx(n.text),BT(wx(a)),Yx(e.spellchecked),vA(PT.inputText),function(){var t=e.autofill;if("Nothing"===t.$)return XN;var r=t.a;return Ux(r)}()]),p),mr)}var i=l(Ja,r(function(e,t){e:for(;;)switch(e.$){case"Describe":return t;case"Height":var r=e.a,n=t.heightContent;return"Nothing"===n.$?U(t,{adjustedAttributes:f(qa,e,t.adjustedAttributes),heightContent:ya(a_(r))}):t;case"StyleClass":switch(e.b.$){case"BorderWidth":var a=e.b,i=a.b,o=a.c,u=a.d,s=a.e,c=t.maybeBorder;return"Nothing"===c.$?U(t,{adjustedAttributes:f(qa,e,t.adjustedAttributes),maybeBorder:ya(d(Lx,i,o,u,s))}):t;case"PaddingStyle":var l=e.b,i=l.b,o=l.c,u=l.d,s=l.e,h=t.maybePadding;return"Nothing"===h.$?U(t,{adjustedAttributes:t.adjustedAttributes,maybePadding:ya(d(Lx,i,o,u,s))}):t;case"SpacingStyle":var p=e.b,g=(p.b,p.c),v=t.maybeSpacing;return"Nothing"===v.$?U(t,{adjustedAttributes:f(qa,e,t.adjustedAttributes),maybeSpacing:ya(g)}):t;default:break e}default:break e}return U(t,{adjustedAttributes:f(qa,e,t.adjustedAttributes)})}),{adjustedAttributes:mr,heightContent:ma,maybeBorder:ma,maybePadding:ma,maybeSpacing:ma},o),u=i.maybePadding,s=i.heightContent,c=i.maybeSpacing,h=i.adjustedAttributes,g=i.maybeBorder,v=f(ec,5,c);return P("textarea",O(F([Yx(e.spellchecked),vA(PT.inputMultiline),f(ec,XN,f(jf,Ux,e.autofill)),function(){if("Nothing"===u.$)return XN;var e=u.a,t=e.a,r=e.b,n=e.c,a=e.d;return C$({bottom:f(vi,0,n-(v/2|0)),left:a,right:r,top:f(vi,0,t-(v/2|0))})}(),function(){return"Nothing"===s.$?XN:s.a?d(Qx,n.text,v,u,g):XN}()]),h),F([i_(PI(n.text))]))}(),v=g.a,y=g.b,m=g.c,b=d(gA,$T,Ak,f(qa,AT(Nk),uy(F([h,c,function(){var e=n.placeholder;if("Nothing"===e.$)return mr;var t=e.a,r=t.a,a=t.b;return F([H$(f(Bk,f(qa,Fx,O(s,O(F([wA(Ox),vA(PT.noTextSelection+" "+PT.passPointerEvents),f$(d(JR,0,0,0,0)),Lk(d(JR,0,0,0,0)),ET(Nk),AT(Nk),_x(""===n.text?1:0)]),r))),a))])}()]))),NT(F([d(gA,$T,kT(v),uy(F([F([lR(t),jx(n.label)]),y,i])),NT(m))])));return l(Px,f(qa,f(qk,jk,PT.cursorText),f(qa,Gx(n.label)?XN:hN(5),f(qa,t_,u))),n.label,b)}),u_=o_({autofill:ma,spellchecked:!1,type_:function(e){return{$:"TextInputNode",a:e}}("text")}),s_=o(function(e,t,r,n,a,i){var o=t.a,u=t.b,s=f(u_,F([AT(Nk),ET(xk(40)),d$(0)]),{label:Tx(r),onChange:i,placeholder:n,text:a});return f(NN,O(F([hN(5)]),e),QC(F([f(jf,Bk(F([Sx])),o),ya(s),f(jf,Bk(F([TN])),u)])))}),c_={$:"Below"},f_=function(e){return f(QN,c_,e)},l_=function(e){return f(ZN,J$,Q$(e))},d_=n(function(e,t,r){return p(s_,F([AT(xk(150)),jN,aN(24),f_(f(z$,F([yx,l_(5)]),r))]),L(ma,ya(bx(e))),"dai input",ma,t,gx)}),h_=r(function(e,t){return f(EA,fA,h(l$,"b-"+ji(e)+"-"+ji(t),t,e,t,e))}),p_=function(e){var t=e.bottom,r=e.top,n=e.left,a=e.right;return $(r,t)&&$(n,a)?$(r,a)?d$(r):f(h_,n,r):f(EA,fA,h(l$,"b-"+ji(r)+"-"+ji(a)+"-"+ji(t)+"-"+ji(n),r,a,t,n))},g_=Bk(F([f$(AR),p_({bottom:2,left:0,right:0,top:0})])),v_=r(function(e,t){return f(AN,F([hN(10)]),F([f(Bk,F([aN(17),tN]),Jp(e)),t]))}),y_=function(e){return g_(f(v_,function(){return"Buyer"===e.inputs.userRole.$?"You're buying":"You're selling"}(),l(d_,e.web3Context.factoryType,e.inputs.daiAmount,e.errors.daiAmount)))},m_=function(e){var t=function(){var t=yl(e.inputs.daiAmount);if("Just"===t.$){var r=t.a;return"There is a 1% fee of "+n$(f(Gf,r,100))+" "+Qf(e.web3Context.factoryType)+"."}return"There is a 1% fee."}();return f(NN,F([cN,f(Hk,20,10),Lk(l(Tk,10,33,108)),Yk(8),hN(5)]),F([f(Bk,F([aN(18),wA(l(Tk,0,226,255)),tN]),Jp(t)),f(Bk,F([aN(17),wA(Fk),jN]),Jp("We only collect this fee when trades resolve successfully."))]))},b_=function(e){return{$:"FiatAmountChanged",a:e}},C_=function(e){return{$:"FiatTypeChanged",a:e}},S_=r(function(e,t){return l(wE,n(function(t,r,n){return f(e,t,r)?l(Bh,t,r,n):n}),Ch,t)}),E_=function(e){return f(S_,r(function(t,r){return f(gg,e,t)}),VR)},T_=MR({description:"",src:"/DAIHard/static/img/qmark-circle.svg"}),w_=function(e){return f(WR,F([ET(xk(26))]),f(ec,T_,f(jf,ko,f(Sh,e,VR))))},I_=function(e){return O$(f(Bx,"click",_o(L(e,!0))))},A_=i_,B_=function(e){return{$:"AppendProperty",a:e}},k_=r(function(e,t){return B_(e+":"+t)}),N_=r(function(e,t){return f(k_,e,t.value)}),R_=N_("cursor"),$_={$:"Compatible"},x_={cursor:$_,value:"default"},__=r(function(e,t){return{$:"ExtendSelector",a:e,b:t}}),L_=function(e){return{$:"PseudoClassSelector",a:e}},P_=function(e){return __(L_(e))}("hover"),D_=n(function(e,t,r){return{$:"Node",a:e,b:t,c:r}}),U_=D_,O_=U_,M_=O_("span"),F_=r(function(e,t){return f(jn,at(e),ot(t))}),V_=n(function(e,t,r){return{$:"Attribute",a:e,b:t,c:r}}),K_=a(function(e,t,r,n){return{charsProcessed:n,hash:r,seed:t,shift:e}}),H_=r(function(e,t){return(65535&t)*e+(((t>>>16)*e&65535)<<16)}),j_=r(function(e,t){return t<>>32-e}),q_=function(e){var t=e.hash?e.seed^f(H_,461845907,f(j_,15,f(H_,3432918353,e.hash))):e.seed,r=t^e.charsProcessed,n=f(H_,2246822507,r^r>>>16),a=f(H_,3266489909,n^n>>>13);return(a^a>>>16)>>>0},G_=r(function(e,t){return f(H_,5,f(j_,13,e^f(H_,461845907,f(j_,15,f(H_,3432918353,t)))))+3864292196}),z_=r(function(e,t){var r=t.hash|(255&xi(e))<";default:return""}},tP=function(e){switch(e.$){case"ClassSelector":var t=e.a;return"."+t;case"IdSelector":var t=e.a;return"#"+t;case"PseudoClassSelector":var t=e.a;return":"+t;default:var t=e.a;return"["+t+"]"}},rP=function(e){switch(e.$){case"TypeSelectorSequence":var t=e.a.a,r=e.b;return f(qi,"",f(qa,t,f(tu,tP,r)));case"UniversalSelectorSequence":var r=e.a;return jo(r)?"*":f(qi,"",f(tu,tP,r));default:var t=e.a,r=e.b;return f(qi,"",f(qa,t,f(tu,tP,r)))}},nP=function(e){var t=e.a,r=e.b;return f(qi," ",F([eP(t),rP(r)]))},aP=function(e){var t=e.a,r=e.b,n=e.c,a=f(qa,rP(t),f(tu,nP,r)),i=f(qi,"",F([f(ec,"",f(jf,ZL,n))]));return f(As,f(qi," ",f(Zd,f(wf,Tu,Ll),a)),i)},iP=r(function(e,t){var r=t.a,n=t.b,a=t.c,i=f(qi,", ",f(tu,aP,f(qa,r,n)));return f(qi,"",F([i," {\n",e,XL(a),"\n",e,"}"]))}),oP=function(e){switch(e.$){case"StyleBlockDeclaration":var t=e.a;return f(iP,"",t);case"MediaRule":var r=e.a,n=e.b;return"@media "+f(qi,",\n",f(tu,GL,r))+" {\n"+f(qi,"\n\n",f(tu,f(wf,JL,iP(" ")),n))+"\n}";case"SupportsRule":case"DocumentRule":case"PageRule":case"FontFace":return"TODO";case"Keyframes":return"@keyframes "+e.a.name+" {\n"+e.a.declaration+"\n}";case"Viewport":case"CounterStyle":default:return"TODO"}},uP=function(e){var t=e.charset,r=e.imports,n=e.namespaces,a=e.declarations;return f(qi,"\n\n",f(Zd,f(wf,Tu,Ll),F([HL(t),f(qi,"\n",f(tu,YL,r)),f(qi,"\n",f(tu,WL,n)),f(qi,"\n\n",f(tu,oP,a))])))},sP=function(e){return uP(KL(ML(e)))},cP=function(e){return f(qi,"\n\n",f(tu,sP,e))},fP=function(e){return{$:"Snippet",a:e}},lP=n(function(e,t,r){return{$:"StyleBlock",a:e,b:t,c:r}}),dP=function(e){return{$:"StyleBlockDeclaration",a:e}},hP=r(function(e,t){var r=l(dL,t,mr,ma);return fP(F([dP(l(lP,r,mr,e))]))}),pP=function(e){return jo(e)?"unstyled":f(qu,D("_"),ts(f(Y_,15739,cP($E(W_($E(f(hP,e,wL(mr)))))))))},gP=function(e){var t=pP(e),r=f(F_,"className",Gd(t));return l(V_,r,e,t)},vP=a(function(e,t,r,n){return f(e,f(qa,gP(t),r),n)}),yP=function(e){return{$:"Unstyled",a:e}},mP=function(e){return yP(kw(e))},bP=mP,CP=r(function(e,t){return f(Mn,e,rt(t))}),SP=function(e){return Un(rt(e))},EP=r(function(e,t){var r=e.b,n=e.c;return jo(r)?t:l(Bh,n,r,t)}),TP=function(e){return e.a},wP=r(function(e,t){var r=e.a,n=e.b,a=t.a,i=t.b;switch(n.$){case"Unstyled":var o=n.a;return L(f(qa,L(r,o),a),i);case"Node":var u=n.a,s=n.b,c=n.c,h=l(za,EP,i,s),p=l(za,IP,L(mr,h),c),g=p.a,v=p.b,o=l(tw,u,f(tu,TP,s),Ya(g));return L(f(qa,L(r,o),a),v);case"NodeNS":var y=n.a,u=n.b,s=n.c,c=n.d,h=l(za,EP,i,s),m=l(za,IP,L(mr,h),c),g=m.a,v=m.b,o=d(SP,y,u,f(tu,TP,s),Ya(g));return L(f(qa,L(r,o),a),v);case"KeyedNode":var u=n.a,s=n.b,c=n.c,h=l(za,EP,i,s),b=l(za,wP,L(mr,h),c),g=b.a,v=b.b,o=l(ew,u,f(tu,TP,s),Ya(g));return L(f(qa,L(r,o),a),v);default:var y=n.a,u=n.b,s=n.c,c=n.d,h=l(za,EP,i,s),C=l(za,wP,L(mr,h),c),g=C.a,v=C.b,o=d(CP,y,u,f(tu,TP,s),Ya(g));return L(f(qa,L(r,o),a),v)}}),IP=r(function(e,t){var r=t.a,n=t.b;switch(e.$){case"Unstyled":var a=e.a;return L(f(qa,a,r),n);case"Node":var i=e.a,o=e.b,u=e.c,s=l(za,EP,n,o),c=l(za,IP,L(mr,s),u),h=c.a,p=c.b,a=l(tw,i,f(tu,TP,o),Ya(h));return L(f(qa,a,r),p);case"NodeNS":var g=e.a,i=e.b,o=e.c,u=e.d,s=l(za,EP,n,o),v=l(za,IP,L(mr,s),u),h=v.a,p=v.b,a=d(SP,g,i,f(tu,TP,o),Ya(h));return L(f(qa,a,r),p);case"KeyedNode":var i=e.a,o=e.b,u=e.c,s=l(za,EP,n,o),y=l(za,wP,L(mr,s),u),h=y.a,p=y.b,a=l(ew,i,f(tu,TP,o),Ya(h));return L(f(qa,a,r),p);default:var g=e.a,i=e.b,o=e.c,u=e.d,s=l(za,EP,n,o),m=l(za,wP,L(mr,s),u),h=m.a,p=m.b,a=d(CP,g,i,f(tu,TP,o),Ya(h));return L(f(qa,a,r),p)}}),AP=r(function(e,t){return h(Th,Eh,e,t,bh,bh)}),BP=r(function(e,t){for(;;){if(!t.b)return e;var r=t.a,n=r.b,a=r.c,i=t.b;if(Ll(a)){var o=e,u=i;e=o,t=u}else{var o=ya(L(a,n)),u=i;e=o,t=u}}}),kP=function(e){var t=f(BP,ma,e);if("Nothing"===t.$)return Ch;var r=t.a,n=r.a,a=r.b;return f(AP,n,a)},NP=function(e){return{$:"ClassSelector",a:e}},RP=function(e){var t=e.a,r=e.b;return f(hP,r,wL(F([NP(t)])))},$P=function(e){return cP($E(W_(f(tu,RP,Ka(e)))))},xP=function(e){return l(tw,"style",mr,$E(kw($P(e))))},_P=n(function(e,t,r){var n=f(tu,TP,t),a=kP(t),i=l(za,IP,L(mr,a),r),o=i.a,u=i.b,s=xP(u);return l(tw,e,n,f(qa,s,Ya(o)))}),LP=r(function(e,t){for(;;){if(!t.b)return!1;var r=t.a,n=r.a,a=t.b;if($(e,n))return!0;var i=e,o=a;e=i,t=o}}),PP=r(function(e,t){e:for(;;){if(t.b){var r=t.a,n=r.a,a=t.b,i="_"+n;if(f(LP,i,a)){var o=i,u=a;e=o,t=u;continue e}return i}return e}}),DP=r(function(e,t){return L(f(PP,"_",t),xP(e))}),UP=n(function(e,t,r){var n=f(tu,TP,t),a=kP(t),i=l(za,wP,L(mr,a),r),o=i.a,u=i.b,s=f(DP,u,o);return l(ew,e,n,f(qa,s,Ya(o)))}),OP=a(function(e,t,r,n){var a=f(tu,TP,r),i=kP(r),o=l(za,wP,L(mr,i),n),u=o.a,s=o.b,c=f(DP,s,u);return d(CP,e,t,a,f(qa,c,Ya(u)))}),MP=a(function(e,t,r,n){var a=f(tu,TP,r),i=kP(r),o=l(za,IP,L(mr,i),n),u=o.a,s=o.b,c=xP(s);return d(SP,e,t,a,f(qa,c,Ya(u)))}),FP=function(e){switch(e.$){case"Unstyled":return e.a;case"Node":var t=e.a,r=e.b,n=e.c;return l(_P,t,r,n);case"NodeNS":var a=e.a,t=e.b,r=e.c,n=e.d;return d(MP,a,t,r,n);case"KeyedNode":var t=e.a,r=e.b,n=e.c;return l(UP,t,r,n);default:var a=e.a,t=e.b,r=e.c,n=e.d;return d(OP,a,t,r,n)}},VP=FP,KP=function(e){return A_(VP(d(vP,M_,F([P_(F([R_(x_)]))]),mr,F([bP(e)]))))},HP=Q,jP=i(function(e,t,r,n,a){return{$:"Padding",a:e,b:t,c:r,d:n,e:a}}),qP=n(function(e,t,r){return{$:"Spaced",a:e,b:t,c:r}}),GP=function(e){return l(Ja,r(function(e,t){var r=t.a,n=t.b;return L(function(){if("Just"===r.$){r.a;return r}if("StyleClass"===e.$&&"PaddingStyle"===e.b.$){var t=e.b,n=t.a,a=t.b,i=t.c,o=t.d,u=t.e;return ya(h(jP,n,a,i,o,u))}return ma}(),function(){if("Just"===n.$){var t=n.a;return n}if("StyleClass"===e.$&&"SpacingStyle"===e.b.$){var r=e.b,a=r.a,t=r.b,i=r.c;return ya(l(qP,a,t,i))}return ma}())}),L(ma,ma),e)},zP=r(function(e,t){var r=GP(e),n=r.a,a=r.b;if("Nothing"===a.$)return d(gA,kN,Ak,f(qa,vA(PT.contentLeft+" "+PT.contentCenterY+" "+PT.wrapped),f(qa,AT(wT),f(qa,ET(wT),e))),NT(t));var i=a.a,o=i.a,u=i.b,s=i.c,c=function(){if("Just"===n.$){var e=n.a,t=(e.a,e.b),r=e.c,a=e.d,i=e.e;return _(r,u/2|0)>-1&&_(a,s/2|0)>-1?ya(C$({bottom:a-(s/2|0),left:i-(u/2|0),right:r-(u/2|0),top:t-(s/2|0)})):ma}return ma}();if("Just"===c.$){var h=c.a;return d(gA,kN,Ak,f(qa,vA(PT.contentLeft+" "+PT.contentCenterY+" "+PT.wrapped),f(qa,AT(wT),f(qa,ET(wT),O(e,F([h]))))),NT(t))}var p=-s/2,g=-u/2;return d(gA,$T,Ak,e,NT(F([d(gA,kN,Ak,f(qa,vA(PT.contentLeft+" "+PT.contentCenterY+" "+PT.wrapped),f(qa,BT(f(U$,"margin",Tw(p)+"px "+Tw(g)+"px")),f(qa,BT(f(U$,"width","calc(100% + "+ji(u)+"px)")),f(qa,BT(f(U$,"height","calc(100% + "+ji(s)+"px)")),f(qa,f(EA,fN,l(lN,o,u,s)),mr))))),NT(t))])))}),YP=a(function(e,t,r,n){var a=f(u_,F([AT(xk(80)),ET(xk(40)),aN(24),jN,f$(AR),I_(r)]),{label:Tx("currency type"),onChange:f($a,HP,n),placeholder:ma,text:t}),i=f(Sh,t,VR),o=function(){var r=L(e,i);if(r.a){if("Just"===r.b.$)return Rk;r.b;return f(zP,F([AT(xk(350)),f$(IR),d$(1),Lk(Fk),KN(10),cN]),f(tu,function(e){var t=e.a,r=e.b,a=r.b;return f(NN,F([AT(xk(80)),hN(9),f(Hk,0,5),I_(n(t)),aR(F([Lk(l(bA,.8,.8,1))]))]),F([f(WR,F([ET(xk(26))]),a),f(Bk,F([aN(16),tN]),KP(t))]))},Ka(E_(t))))}return Rk}();return f(NN,F([hN(4),f_(o)]),F([w_(t),a]))}),WP=i(function(e,t,r,n,a){var i=Jp(KR(e)),o=f(Bk,F([f_(f(z$,F([yx,l_(5)]),a))]),d(YP,r,e,$$(!0),C_));return p(s_,F([AT(xk(250)),jN,aN(24),f_(f(z$,F([yx,l_(5)]),n))]),L(ya(i),ya(o)),"fiat input",ma,t,b_)}),JP=function(e){return g_(f(v_,"For fiat",h(WP,e.inputs.fiatType,e.inputs.fiatAmount,e.showFiatTypeDropdown,e.errors.fiatAmount,e.errors.fiatType)))},QP=function(e){return{$:"ChangeRole",a:e}},XP=r(function(e,t){var r=F([aN(24),jN,Gk]),n=function(){return"Buyer"===t.$?L(r,O(r,F([wA(B$)]))):L(O(r,F([wA(B$)])),r)}(),a=n.a,i=n.b;return f(NN,F([hN(20)]),F([f(Bk,O(F([Zk(QP(Of))]),i),Jp("Sell "+Qf(e))),f(Bk,O(F([Zk(QP(ry))]),a),Jp("Buy "+Qf(e)))]))}),ZP=function(e){return f(v_,"Trade Type",f(XP,e.web3Context.factoryType,e.inputs.userRole))},eD=aw(19),tD=function(e){return Sl(F([e.inset?"box-inset":"box-",Tw(e.offset.a)+"px",Tw(e.offset.b)+"px",Tw(e.blur)+"px",Tw(e.size)+"px",TA(e.color)]))},rD=function(e){var t={blur:e.blur,color:e.color,inset:!1,offset:e.offset,size:e.size};return f(EA,eD,l(WI,tD(t),"box-shadow",Iw(t)))},nD=rD({blur:20,color:d(iR,0,0,0,.04),offset:L(0,3),size:0}),aD=f(qk,fN,PT.spaceEvenly),iD=function(e){return f(AN,F([AT(Nk),hN(20),Lk(Fk),Yk(5),KN(20),nD]),F([f(NN,F([AT(Nk),aD]),F([ZP(e),y_(e),JP(e)])),m_(e)]))},oD=function(e){return{$:"CreateClicked",a:e}},uD={$:"Web3Connect"},sD=function(e){return f(Bk,F([cN]),function(){if("Just"===e.$){var t=e.a;return f(ix,"Open Trade",oD(t))}return f(ix,"Connect to Wallet",uD)}())},cD=function(e){return{$:"AutoabortIntervalChanged",a:e}},fD=function(e){return{$:"ChangePaymentMethodText",a:e}},lD=r(function(e,t){return{$:"Placeholder",a:e,b:t}}),dD=lD,hD=function(e){return f(dD,F([wA(d(JR,0,0,0,.2))]),function(){return Jp("Seller"===e.$?"Some examples:\n\nI can accept transfers to a Schwab bank account (routing 121202211)\nI can meet in person to accept cash in London, weekdays after 6, with a day of notice.\nHide the cash in Hume Park, Bulawayo, and tell me the location over chat.":"Some examples:\n\nI can deliver cash anywhere within an hour drive of Phoneix, AZ, with 2 days of notice.\nTransferWise\nInterac e-Transfer\n")}())},pD={$:"TextArea"},gD=r(function(e,t){return l(o_,{autofill:ma,spellchecked:t.spellcheck,type_:pD},e,{label:t.label,onChange:t.onChange,placeholder:t.placeholder,text:t.text})}),vD=n(function(e,t,r){var n=f(Bk,F([aN(22),tN]),Jp("Payment Method")),a=f(gD,F([AT(Nk),ET(xk(150)),Lk(d(iR,155,203,255,.2)),d$(0)]),{label:Tx("payment method"),onChange:fD,placeholder:""===r?ya(hD(t)):ma,spellcheck:!0,text:r});return f(AN,F([hN(20),C$({bottom:15,left:45,right:45,top:0}),AT(Nk),W$(f(z$,F([yx,l_(30),KN(10),aN(20),AT(xk(400))]),e))]),F([n,a]))}),yD=function(e){return"Buyer"===e.$?"After committing, you and the Seller have this long to complete the fiat payment, using one of your payment methods indicated below. If you fail to confirm payment within this window, 1/4 of your deposit is burned from both parties and the rest is refunded.":"After committing, you and the Buyer have this long to complete the fiat payment, using one of your payment methods indicated below. If the Buyer aborts or fails to confirm within this window, 1/12 of the trade amount is burned from both parties and the rest is refunded."},mD=a(function(e,t,r,n){var a=l(Ju,e,D("0"),ji(n));return f(Bk,F([aN(22),wA(t)]),Jp(O(a,r)))}),bD=function(e){return Gl(e)<0?Ff(0):e},CD=MR({description:"down",src:"/DAIHard/static/img/arrow-down.svg"}),SD=MR({description:"up",src:"/DAIHard/static/img/arrow-up.svg"}),ED=n(function(e,t,n){var a=r(function(e,r){return f(AN,F([hN(4)]),F([f(Bk,F([KN(4),Gk,Zk(n(f(Tb,t,e)))]),f(WR,F([ET(xk(10))]),SD)),r,f(Bk,F([KN(4),Gk,Zk(n(function(e){return Gl(e)?e:Ff(3e5)}(bD(f(ER,t,e)))))]),f(WR,F([ET(xk(10))]),CD))]))}),i=_R(t);return f(NN,F([aD,hN(10)]),F([f(a,Ff(864e5),d(mD,3,e," days",i.days)),f(a,Ff(36e5),d(mD,2,e," hours",i.hours)),f(a,Ff(3e5),d(mD,2,e," min",i.min))]))}),TD=o(function(e,t,r,n,a,i){var o=f(Bk,F([Lk(d(iR,155,203,255,.2)),Yk(5),KN(15),W$(f(z$,F([yx]),a))]),l(ED,IR,n,i)),u=f(NN,F([hN(30)]),F([f(WR,F([ET(xk(40))]),e),f(Bk,F([aN(22),tN]),Jp(t))])),s=f(vN,F([aN(17),jN,wA(ex)]),F([Jp(r)]));return f(AN,F([AT(Nk),Yk(10),Lk(l(Tk,237,237,237)),hN(2)]),f(tu,Bk(F([Lk(Fk),f(Hk,45,18),AT(Nk)])),F([u,f(NN,F([AT(Nk),hN(25),Lk(Fk)]),F([o,s]))])))}),wD=MR({description:"fiat",src:"/DAIHard/static/img/fiat-bag-white.svg"}),ID=f(qk,MN,PT.clipX),AD=f(qk,MN,PT.clipY),BD=i(function(e,t,r,n,a){return f(AN,F([hN(15),Yk(8),ID,AD,Lk(Fk)]),F([p(TD,wD,"Payment Window",yD(a),r,n,cD),l(vD,t,a,e)]))}),kD=function(e){return{$:"AutoreleaseIntervalChanged",a:e}},ND=function(e){return"Buyer"===e.$?"Once you confirm payment, the Seller has this time window to decide whether to release the funds to you or burn everything. If he doesn't decide before the time is up, funds are released to you by default.":"Once the Buyer confirms payment, you have this long to decide whether to release the funds to the Buyer or, in the case of an attempted scam, burn everything. If you don't decide before the time is up, funds are released to the Buyer by default."},RD=MR({description:"",src:"/DAIHard/static/img/release-window-icon.svg"}),$D=n(function(e,t,r){return f(Bk,F([Yk(8),ID,AD,Lk(Fk)]),p(TD,RD,"Burn/Release Window",ND(r),e,t,kD))}),xD=function(e){return{$:"AutorecallIntervalChanged",a:e}},_D=function(e){var t=function(){return"Buyer"===e.$?"Seller":"Buyer"}();return"The offer will expire by this time window if a "+t+" does not commit to the trade, returning the balance and the 1% fee to your wallet. This can also be manually triggered anytime before a "+t+" commits."},LD=MR({description:"",src:"/DAIHard/static/img/open-window-icon.svg"}),PD=n(function(e,t,r){return f(Bk,F([Yk(8),Lk(Fk),ID,AD]),p(TD,LD,"Open Window",_D(r),e,t,xD))}),DD=function(e){return f(AN,F([AT(Nk),hN(20)]),F([l(PD,e.inputs.autorecallInterval,e.errors.autorecallInterval,e.inputs.userRole),h(BD,e.inputs.paymentMethod,e.errors.paymentMethod,e.inputs.autoabortInterval,e.errors.autoabortInterval,e.inputs.userRole),l($D,e.inputs.autoreleaseInterval,e.errors.autoreleaseInterval,e.inputs.userRole)]))},UD=function(e){return f(AN,F([AT(f(q$,1e3,Nk)),cN,hN(20),C$({bottom:30,left:40,right:40,top:0}),Zk($$(!1)),H$(px(e))]),F([iD(e),DD(e),sD(e.userInfo)]))},OD=Gu(Km(8226)),MD=r(function(e,t){if(t.b){var n=t.a,a=t.b,i=r(function(t,r){return f(qa,e,f(qa,t,r))}),o=l(Ja,i,mr,a);return f(qa,n,o)}return mr}),FD=r(function(e,t){return l(za,qa,t,e)}),VD=n(function(e,t,r){for(;;){if(!(t>0))return e;var n=f(FD,r,e),a=t-1,i=r;e=n,t=a,r=i}}),KD=r(function(e,t){var r=Oi(t);return!r||$(r,e)?t:_(r,e)<0?Ya(f(FD,f($s,e%r,t),l(VD,mr,e/r|0,t))):f($s,e,t)}),HD=a(function(e,t,r,n){for(;;){if(!r.b)return Ya(n);var a=r.a,i=r.b,o=e(a);if(f(gw,o,t)){var u=e,s=t,c=i,l=n;e=u,t=s,r=c,n=l}else{var u=e,s=f(kE,o,t),c=i,l=f(qa,a,n);e=u,t=s,r=c,n=l}}}),jD=function(e){return d(HD,to,mm,e,mr)},qD=r(function(e,t){return f(Bk,F([AT(Nk),H$(f(NN,F([hN(3),AT(VN(100)),AT(t),FN]),f(MD,f(Bk,F([wA(d(JR,0,0,0,.1)),aN(14)]),Jp(OD)),f(tu,f(wf,Bk(F([wA(d(JR,0,0,0,.2))])),Jp),f(KD,100,(e?Ya:to)(jD(f(tu,f($a,ko,hi),Ka(VR)))))))))]),Jp(" "))}),GD=function(e){return f(AN,F([AT(Nk),ET(Nk),Lk(Fk),Yk(6),rD({blur:20,color:d(iR,0,0,0,.1),offset:L(0,3),size:0}),Yk(10),aD,KN(20)]),F([f(qD,!1,Nk),f(AN,F([cN,hN(15),AT(f(q$,700,Nk))]),f(tu,vN(F([AT(Nk),aN(17),jN,wA(ex),ux])),F([F([f(Bk,F([aN(22),wA(IR)]),Jp("Hold on a second!"))]),F([Jp("This version of DAIHard is live and functional, but a Factory upgrade is coming soon.")]),F([Jp("When that upgrade hits, all current trades will be hidden in the new interface. So feel free to play around here if you want, but don't use the tool seriously in its current state.")]),F([Jp("If you'd like to keep up to date with our upgrades and progress, join our "),f(yA,F([wA(T$),dx]),{label:Jp("Telegram group"),url:"https://t.me/daihardexchange_group"}),Jp(".")])]))),f(Bk,F([cN,Zk(dT(Cf({category:"landing-page",event:"lets-go-clicked",label:'"Let\'s Go" clicked',value:0})))]),f(ix,"Okay, got it. let's go!",e)),f(qD,!0,Nk)]))},zD=function(e){return{$:"ShowCurrencyDropdown",a:e}},YD=n(function(e,t,r){return f($a,Zd(t(e)),LN(r))}),WD={$:"AutoabortWindow"},JD={$:"AutoreleaseWindow"},QD={$:"Expiring"},XD={$:"Fiat"},ZD={$:"Margin"},eU={$:"TradeAmount"},tU=function(e){var t=e.a,r=e.b;return f(Bk,F([AT(VN(t)),ET(xk(60)),FN,Lk(Fk)]),f(Bk,F([KN(12),ON,AT(Nk)]),r))},rU={$:"Descending"},nU=r(function(e,t){return{$:"SortBy",a:e,b:t}}),aU=function(e){return f(Bk,F([jN,aN(17)]),Jp(e))},iU=n(function(e,t,r){return f(NN,F([hN(8)]),F([aU(e),f(AN,F([hN(2)]),F([f(Bk,F([KN(4),Gk,Zk(f(nU,t,sv))]),f(WR,F([AT(xk(8)),cN,ON]),SD)),f(Bk,F([KN(4),Gk,Zk(f(nU,t,rU))]),f(WR,F([AT(xk(8)),cN,ON]),CD))]))]))}),oU=r(function(e,t){var r=function(){return"Buyer"===e.$?oN:RR}(),n=_(Gl(t.parameters.autoabortInterval),216e5)<0?r:IR;return d(LR,mr,mr,L(n,AR),t.parameters.autoabortInterval)}),uU=r(function(e,t){var r=function(){return"Buyer"===e.$?RR:oN}(),n=_(Gl(t.parameters.autoabortInterval),216e5)<0?r:IR;return d(LR,mr,mr,L(n,AR),t.parameters.autoreleaseInterval)}),sU=r(function(e,t){var r=f(TR,e,t);if("TimeLeft"===r.$){var n=r.a,a=f(DR,n.a,n.b)<.05?oN:IR;return d(UR,F([AT(Nk)]),F([aN(16)]),L(a,AR),n)}var i=r.a;return d(UR,F([AT(Nk)]),F([aN(16)]),L(oN,AR),L(Ff(0),i))}),cU=function(e){return QR(e.terms.price)},fU=function(e){var t=fu(100*e),r=t-gi(t),n=ji(gi(t)),a=f(vi,0,3-go(n));return n+(function(){if(a){return f(Co,a+1,f(yo,1,Tw(r)))}return""}()+"%")},lU=r(function(e,t){return MR({description:"",src:function(){var r=L(e,t);if(r.a){if("Just"===r.b.$)return r.b.a?"/DAIHard/static/img/margin-up-green.svg":"/DAIHard/static/img/margin-up-red.svg";r.b;return"/DAIHard/static/img/margin-up.svg"}if("Just"===r.b.$)return r.b.a?"/DAIHard/static/img/margin-down-green.svg":"/DAIHard/static/img/margin-down-red.svg";r.b;return"/DAIHard/static/img/margin-down.svg"}()})}),dU=n(function(e,t,r){return f(WR,f(qa,ET(xk(34)),e),f(lU,t,r))}),hU=r(function(e,t){var r=fU(t);if("0%"===r)return f(Bk,F([aN(16)]),Jp("0%"));var n=r,a=t>=0,i=!(a!==e),o=i?RR:oN;return f(NN,F([hN(4)]),F([l(dU,mr,a,ya(i)),f(Bk,F([wA(o),aN(16)]),Jp(n))]))}),pU=r(function(e,t){return f(ec,Rk,f(jf,hU(t),e.derived.margin))}),gU=function(e){return f(ec,Rk,f(jf,ZR,Xf(e)))},vU=function(e){return a$(e.parameters.tradeAmount)},yU=function(e){return{$:"TradeClicked",a:e}},mU=function(e){return f(yR,F([Lk(d(iR,16,7,234,.2)),KN(11),Yk(4),AT(Nk),aR(F([Lk(d(iR,16,7,234,.4))]))]),{label:f(Bk,F([cN,wA(l(Tk,16,7,234)),jN]),Jp("View Offer")),onPress:ya(yU(e))})},bU=n(function(e,t,r){return f(NN,F([AT(Nk),hN(1),Lk(AR)]),F([f(AN,F([AT(Nk),hN(1),AT(VN(7))]),F([f(NN,F([AT(VN(6)),hN(1)]),f(tu,tU,F([L(2,f(sU,e,r)),L(1,vU(r)),L(2,cU(r)),L(1,f(pU,r,!$(t,ry))),L(2,f(oU,t,r)),L(2,f(uU,t,r))]))),tU(L(1,gU(r.terms.paymentMethods)))])),f(Bk,F([AT(VN(1)),ET(Nk),FN,Lk(Fk)]),f(Bk,F([cN,ON]),mU(r.id)))]))}),CU=n(function(e,t,r){var n=function(){return"Buyer"===r.browsingRole.$?"Selling":"Buying"}();return f(AN,F([AT(Nk),ET(Nk),KN(30),hN(5)]),F([f(NN,F([AT(Nk)]),F([f(NN,F([AT(VN(7))]),F([tU(L(2,l(iU,"Expires",QD,ma))),tU(L(1,l(iU,n,eU,ma))),tU(L(2,l(iU,"For Fiat",XD,ma))),tU(L(1,l(iU,"Margin",ZD,ma))),tU(L(2,l(iU,"Payment Window",WD,ma))),tU(L(2,l(iU,"Auto-Release",JD,ma)))])),f(Bk,F([AT(VN(1))]),Rk)])),f(AN,F([AT(Nk),d$(2),Yk(8),f$(g$),hN(1),Lk(g$),FN]),f(tu,f(bU,e,r.browsingRole),t))]))}),SU=n(function(e,t,r){var n=d(YD,e,r.filterFunc,r.sortFunc,v$(t)),a=function(e){return f(Bk,F([aN(24),tN,wA(g$),cN,KN(20)]),Jp(e))},i=L(t.dataFetchStatus.total,n);if("Nothing"===i.a.$){i.a;return a("Querying Factory contract...")}if(i.a.a){if(i.b.b){var o=i.a.a;return l(CU,e,n,r)}var o=i.a.a;return a(_(t.dataFetchStatus.loaded,o-t.dataFetchStatus.invalid)<0?"Searching trades for Open offers...":"No open offers found.")}return a("No trades found.")}),EU={$:"ApplyInputs"},TU=f(yR,F([Lk(T$),KN(10),Yk(5)]),{label:f(Bk,F([wA(Fk),cN,ON]),Jp("Apply")),onPress:ya(EU)}),wU=function(e){var t=e.topLeft,r=e.topRight,n=e.bottomLeft,a=e.bottomRight;return f(EA,zk,l(WI,"br-"+ji(t)+"-"+ji(r)+ji(n)+"-"+ji(a),"border-radius",ji(t)+"px "+ji(r)+"px "+ji(a)+"px "+ji(n)+"px"))},IU=function(e){return f(Qk,"focus",_o(e))},AU=f(wf,BT,IU),BU=s(function(e,t,r,n,a,i,o,u){var s=function(){if("Nothing"===o.$)return mr;var e=o.a;return F([AU(e(!0)),I_(e(!0))])}();return f(NN,O(e,F([ET(xk(40)),rD({blur:20,color:d(iR,233,237,242,.05),offset:L(0,3),size:0})])),F([f(Bk,F([Lk(AR),ET(xk(40)),wU({bottomLeft:4,bottomRight:0,topLeft:4,topRight:0})]),f(Bk,F([ON,f(Hk,10,0)]),r)),f(u_,O(s,O(t,F([AT(xk(100)),ET(xk(40)),f$(AR),wU({bottomLeft:0,bottomRight:4,topLeft:0,topRight:4}),p_({bottom:1,left:0,right:1,top:1})]))),{label:Tx(n),onChange:u,placeholder:i,text:a})]))}),kU=function(e){return{$:"MaxDaiChanged",a:e}},NU=function(e){return{$:"MinDaiChanged",a:e}},RU=r(function(e,t){return f(AN,F([AT(Nk),hN(8)]),F([f(Bk,F([aN(17),jN]),Jp(e)),t]))}),$U=aw(25),xU=function(e){return{$:"MoveX",a:e}},_U=function(e){return f(ZN,$U,xU(-e))},LU={$:"OnLeft"},PU=function(e){return f(QN,LU,e)},DU=a(function(e,t,r,n){var a=r$(F([ON])),i=f(NN,F([hN(8),ON,AT(xk(60))]),F([a,f(Bk,F([aN(16),ON]),Jp("max"))])),o=f(NN,F([hN(8),ON,AT(xk(60))]),F([a,f(Bk,F([aN(16),ON]),Jp("min"))]));return f(RU,Qf(e)+" Range",f(AN,F([hN(5),AT(xk(200))]),F([v(BU,F([PU(f(z$,F([_U(5),AT(xk(200))]),n.minDai))]),F([AU(zD(!1))]),o,"min "+Qf(e),t,ma,ma,NU),v(BU,F([PU(f(z$,F([_U(5),AT(xk(200))]),n.maxDai))]),F([AU(zD(!1))]),i,"max "+Qf(e),r,ma,ma,kU)])))}),UU=function(e){var t=f(Sh,e,VR);if("Nothing"===t.$)return Jp("*");var r=t.a,n=r.b;return f(WR,F([ET(xk(26))]),n)},OU=function(e){return{$:"FiatTypeInputChanged",a:e}},MU=function(e){return{$:"MaxFiatChanged",a:e}},FU=function(e){return{$:"MinFiatChanged",a:e}},VU=i(function(e,t,r,n,a){var i=UU(t),o=f(NN,F([hN(8),ON,AT(xk(60))]),F([i,f(Bk,F([aN(16),ON]),Jp("max"))])),u=f(NN,F([hN(8),ON,AT(xk(60))]),F([i,f(Bk,F([aN(16),ON]),Jp("min"))]));return f(RU,"Fiat Type",f(NN,F([hN(5),AT(wT)]),F([f(Bk,F([V$,AT(xk(120))]),d(YP,e,t,zD(!0),OU)),f(AN,F([hN(5),V$,AT(xk(200))]),F([v(BU,F([W$(f(z$,F([X$(5),AT(f(q$,200,wT))]),a.minFiat))]),F([AU(zD(!1))]),u,"min",r,ma,ma,FU),v(BU,F([f_(f(z$,F([l_(5),AT(f(q$,200,wT))]),a.maxFiat))]),F([AU(zD(!1))]),o,"max",n,ma,ma,MU)]))])))}),KU={$:"AddSearchTerm"},HU=function(e){return{$:"PaymentMethodInputChanged",a:e}},jU=f(Od,"keyCode",ZC),qU=function(e){return f(Qk,"keyup",f(Ro,function(t){return 13===t?_o(e):$o(ji(t))},jU))},GU=function(e){return f(RU,"Search Payment Methods",f(u_,F([V$,AT(xk(250)),ET(xk(40)),f$(AR),rD({blur:20,color:d(iR,233,237,242,.05),offset:L(0,3),size:0}),O$(qU(KU))]),{label:Tx("payment methods search"),onChange:HU,placeholder:ma,text:e}))},zU={$:"ResetSearch"},YU=f(yR,F([Lk(T$),KN(10),Yk(5)]),{label:f(Bk,F([wA(Fk),cN,ON]),Jp("Reset")),onPress:ya(zU)}),WU=function(e){return{$:"RemoveTerm",a:e}},JU=function(e){return f(Bk,F([KN(3),V$,Gk,Zk(WU(e)),aN(10),wA(oN)]),Jp("x"))},QU=function(e){if(e.b){var t=e;return f(NN,F([AT(Nk),KN(10),hN(10)]),f(tu,function(e){return f(NN,F([Lk(d(iR,16,7,234,.2)),Yk(5),KN(4),hN(3)]),F([Jp(e),JU(e)]))},t))}return Rk},XU=a(function(e,t,r,n){return f(AN,F([hN(10),AT(wT),cN]),F([f(NN,F([AT(wT),hN(10)]),F([f(Bk,F([AT(wT),V$]),d(DU,e,t.minDai,t.maxDai,r)),f(Bk,F([AT(wT),V$]),h(VU,n,t.fiatType,t.minFiat,t.maxFiat,r)),f(AN,F([AT(wT),V$,hN(5)]),F([GU(t.paymentMethod),QU(t.paymentMethodTerms)])),f(RU," ",f(AN,F([hN(5),AT(wT)]),F([TU,YU])))]))]))}),ZU=n(function(e,t,r){return f(AN,F([Yk(5),Lk(Fk),AT(Nk),ET(Nk),Zk(zD(!1))]),F([f(NN,F([AT(Nk),hN(10),KN(30)]),F([d(XU,r.web3Context.factoryType,r.inputs,r.errors,r.showCurrencyDropdown)])),l(SU,e,t,r)]))}),eO=f($a,lu,km("USD")),tO=a(function(e,t,r,n){return{daiAmountIn:t,fiatValue:r,initiatorRole:e,intervals:n}}),rO=function(e){return Fv(f(Ru,f(gl,lu(10),lu(18)),lu(e)))},nO=F([d(tO,Of,rO(5),eO(4),P(Ff(1728e5),Ff(1728e5),Ff(2592e5))),d(tO,ry,rO(2),eO(7),P(Ff(1728e5),Ff(1728e5),Ff(2592e5)))]),aO=function(e){return f(Gf,Uv(e),3)},iO=PR,oO=r(function(e,t){return n$(t)+" "+Qf(e)}),uO=r(function(e,t){return f(Bk,F([wA(iO),aN(20)]),Jp(f(oO,e,t)))}),sO=RR,cO=function(e){return"$"+Tl(e.amount)+" USD"},fO=function(e){return f(Bk,F([wA(sO),aN(20)]),Jp(cO(e)))},lO=function(e){return $(e,Ff(6048e5))?Jp("1 week"):b("QuickCreate.View",{start:{line:132,column:9},end:{line:132,column:19}})("lol bet u forgot about dis. summarizeIntervalElement is a hack! A dirty hack!!")},dO=r(function(e,t){var r=function(){return"Buyer"===t.initiatorRole.$?f(uO,e,f(fd,Uv(t),aO(t))):fO(t.fiatValue)}(),n=function(){return"Buyer"===t.initiatorRole.$?f(AN,F([hN(5)]),F([f(uO,e,t.daiAmountIn),fO(t.fiatValue)])):f(uO,e,t.daiAmountIn)}(),a=lO(function(e){var t=e.a,r=e.b,n=e.c;return f(Tb,n,f(Tb,r,t))}(t.intervals)),i=Jp("---\x3e");return f(AN,F([hN(8)]),F([f(NN,F([hN(4)]),F([n,i,r])),a]))}),hO=r(function(e,t){return d(ax,P(d(JR,0,0,1,1),d(JR,0,0,1,.8),d(JR,0,0,1,.6)),Fk,e,t)}),pO=function(e){return{$:"StartClicked",a:e}},gO=function(e){return f(hO,"Start",pO(e))},vO=n(function(e,t,r){return f(NN,F([hN(40)]),F([f(dO,e,r),t?gO(r):Rk]))}),yO=r(function(e,t){return{$:"OpenClicked",a:e,b:t}}),mO=r(function(e,t){if("Just"!==e.$)return f(Z$,"Can't find userInfo...",ya("You shouldn't be seeing this. Maybe your web3 provider changed something just now?"));var r=e.a;if("Spec"!==t.$)return Rk;var n=t.a,a=t.b;switch(a.$){case"ApproveMining":a.a;return f(Z$,"Mining Prepare tx...",ma);case"ReadyToOpen":return f(ix,"Open Trade",f(yO,r,n));case"OpenNeedsSig":default:return Rk}}),bO=function(e){return{$:"TextInputChanged",a:e}},CO=function(e){return f(dD,mr,f(AN,F([hN(5)]),f(tu,f(wf,vN(mr),$E),function(){return F("Buyer"===e.$?[Jp("Some ideas:"),f(Bk,F([CN]),Jp("I can meet in NYC central park for a cash handoff after 6 pm.")),f(Bk,F([CN]),Jp("I'll send you $7 in Steam credit.")),f(Bk,F([CN]),Jp("TransferWise")),f(Bk,F([CN]),Jp("Cash drop in Hume Park, Bulawayo"))]:[Jp("Some ideas:"),f(Bk,F([CN]),Jp("I accept money orders or cashier checks into my Schwab bank account.")),f(Bk,F([CN]),Jp("Meet me at the Bangkok airport (BKK) on Saturday. I'm coming in on flight I453.")),f(Bk,F([CN]),Jp("Buy Dig Dog on Steam and gift it to me (syriven).")),f(Bk,F([CN]),Jp("Ship me a potato."))])}())))},SO=r(function(e,t){return f(gD,F([AT(Nk),ET(xk(200))]),{label:Tx("payment details"),onChange:bO,placeholder:""===t?ya(CO(e)):ma,spellcheck:!0,text:t})}),EO=r(function(e,t){return f(AN,F([hN(10)]),f(tu,vN(mr),F([function(){return F("Seller"===e.$?[Jp("How must the "),fO(t),Jp(" be paid?")]:[Jp("How can you deliver the "),fO(t),Jp("?")])}(),F([Jp("You will be able to chat with the "),Jp(function(){return"Seller"===e.$?"buyer":"seller"}()),Jp(" to coordinate further once the trade is in progress.")])])))}),TO=function(e){return{$:"ApproveClicked",a:e}},wO=function(e){return{$:"ChangeState",a:e}},IO={$:"Web3Connect"},AO=n(function(e,t,r){return f(ec,Rk,function(){e:for(;;)if("Menu"===r.$)switch(r.a.$){case"StartPrompt":var n=r.a.a;return ya(l(G$,mr,f(AN,F([hN(15),cN,KN(20)]),F([Jp("Text about approving"),function(){if("Just"===t.$){t.a;return f(hO,"Prepare "+n$(n.daiAmountIn)+" "+Qf(e)+" for deposit",TO(n))}return f(ix,"Connect to Wallet",IO)}()])),wO(Cv(Sv))));case"ApproveNeedsSig":var n=r.a.a;return ya(l(G$,mr,f(AN,F([hN(15),KN(20),cN]),F([Jp("Waiting for sig text")])),wO(Cv(Sv))));default:break e}else switch(r.b.$){case"OpenNeedsSig":var n=r.a;r.b;return ya(l(G$,mr,f(AN,F([hN(15),KN(20),cN]),F([Jp("Text about opening")])),wO(f(Lv,n,_v))));case"OpenMining":var n=r.a;r.b;return ya(l(G$,mr,f(AN,F([hN(15),KN(20),cN]),F([Jp("Opening trade. Note that if you close this modal or navigate away, the transaction could still complete."),Jp("You will be redirected when the trade is finished opening.")])),wO(Cv(Sv))));default:break e}return ma}())}),BO=function(e){return L(function(){var t=e.state;if("Menu"===t.$){t.a;return f(AN,F([hN(10),cN]),f(tu,f(vO,e.web3Context.factoryType,!0),nO))}var r=t.a;t.b;return f(AN,F([hN(20),cN]),F([l(vO,e.web3Context.factoryType,!1,r),f(AN,F([hN(10),cN]),F([f(EO,r.initiatorRole,r.fiatValue),f(SO,r.initiatorRole,e.textInput),f(mO,e.userInfo,e.state)]))]))}(),F([l(AO,e.web3Context.factoryType,e.userInfo,e.state)]))},kO=function(e){return{$:"MessageInputChanged",a:e}},NO={$:"MessageSubmit"},RO=function(e){return f(AN,F([AT(Nk),hN(10)]),F([f(gD,F([AT(Nk),ET(xk(100))]),{label:Tx("messageInput"),onChange:kO,placeholder:ma,spellcheck:!1,text:e.messageInput}),f(yR,F([cN,aN(24)]),{label:Jp("Submit"),onPress:ya(NO)})]))},$O=f(qk,MN,PT.scrollbarsY),xO=r(function(e,t){return f(Bk,F([ET(Nk),AT(Nk)]),f(Bk,O(F([O$(f(U$,"position","absolute")),O$(f(U$,"top","0")),O$(f(U$,"right","0")),O$(f(U$,"bottom","0")),O$(f(U$,"left","0")),$O]),e),t))}),_O=l(Tk,200,205,210),LO=n(function(e,t,r){var n=F([TN,Lk(T$),wA(Fk),wU({bottomLeft:15,bottomRight:0,topLeft:15,topRight:15})]),a=F([Sx,Lk(_O),wA(IR),wU({bottomLeft:0,bottomRight:15,topLeft:15,topRight:15})]),i=r.eventInfo;if("Statement"===i.$){var o=i.a,u=$(o.who,t)?n:a;return f(Bk,O(F([KN(7)]),u),f(vN,mr,F([Jp(O(function(){return"Buyer"===o.who.$?"B: ":"S: "}(),function(){var e=o.message;switch(e.$){case"FailedDecode":return"DECODE FAILED";case"Encrypted":return"(encrypted data)";case"FailedDecrypt":return"DECRYPT FAILED";default:return e.a}}()))])))}var s=i.a,c=function(){switch(s.$){case"Initiated":return ya(P(l(bA,0,0,1),Fk,"Initiator opened the trade"));case"Recalled":return ya(P(l(bA,0,0,1),Fk,"Initiator recalled the trade"));case"Committed":var t=s.a,r=f(Co,8,Xd(t))+"..";return ya(P(l(bA,1,0,1),Fk,r+" committed to the trade"));case"Aborted":return ya(P(l(bA,1,0,0),Fk,"Buyer aborted the trade"));case"Claimed":return ya(P(l(bA,0,1,0),Fk,"Buyer marked the fiat transfer complete"));case"Released":return ya(P(l(bA,0,0,1),Fk,"Seller released the "+Qf(e)+" and closed the contract"));default:return ya(P(l(bA,0,0,1),Fk,"Seller burned the "+Qf(e)+" and closed the contract"))}}();if("Nothing"===c.$)return Rk;var d=c.a,h=d.a,p=d.b,g=d.c;return f(Bk,F([Yk(3),d$(1),f$(l(bA,1,0,1)),cN,Lk(h)]),f(vN,F([wA(p)]),F([Jp(g)])))}),PO=n(function(e,t,r){if(r.b){var n=r;return f(xO,F([AT(Nk),ET(Nk),Yk(5),d$(1),f$(IR),KN(10)]),f(AN,F([AT(Nk),ET(Nk),hN(10)]),f(tu,f(LO,e,t),n)))}return f(Bk,F([AT(Nk),ET(Nk),Yk(5),d$(1),f$(IR),cN,wA(l(bA,.5,.5,.5)),CN]),Jp("no messages found."))}),DO=Sr,UO=function(e){return f(AN,F([AT(Nk),ET(Nk),hN(10),d$(1),Yk(5),KN(20)]),F([l(PO,e.web3Context.factoryType,e.userRole,f(DO,function(e){return e.blocknum},Ma(e.history))),RO(e)]))},OO=function(e){return f(Bk,F([Lk(Fk),Yk(8),nD,AT(Nk),ET(Nk)]),UO(e))},MO={$:"ToggleChat"},FO=function(e){if(e.showChatHistory){var t=f(ec,Rk,f(jf,OO,e.chatHistoryModel));return f(Bk,F([ET(Nk),AT(xk(500)),KN(20),TN]),l(G$,F([ET(Nk),AT(Nk)]),f(Lf,xS,t),MO))}return Rk},VO=function(e){return"Buyer"===e.initiatorRole.$?Of:ry},KO=function(e){return qR(e)+" "+e.fiatType},HO={$:"AbortAction"},jO=n(function(e,t,r){return{$:"ConfirmCommit",a:e,b:t,c:r}}),qO=function(e){var t=e.txChainStatus;if("Nothing"===t.$)return Rk;switch(t.a.$){case"ConfirmingCommit":var r=t.a,n=r.a,a=r.b,i=r.c,o=KO(n.terms.price),u=n$(Fv(i)),s=n$(n.parameters.tradeAmount)+" "+Qf(e.web3Context.factoryType),c=function(){return"Buyer"===VO(n.parameters).$?L(f(Bk,F([jN,wA(IR)]),Jp("buyer")),F([Jp("pay the seller "),f(Bk,F([wA(T$)]),Jp(o)),Jp(" in exchange for the "),f(Bk,F([wA(T$)]),Jp(s)),Jp(" held in this contract.")])):L(f(Bk,F([jN,wA(IR)]),Jp("seller")),F([Jp("accept "),f(Bk,F([wA(T$)]),Jp(o)),Jp(" from the buyer in exchange for the "),f(Bk,F([wA(T$)]),Jp(s)),Jp(" held in this contract.")]))}(),d=c.a,h=c.b;return l(G$,mr,f(AN,F([hN(20),KN(20),cN,ET(Nk),ux]),F([f(Bk,F([aN(26),tN,cN,ON]),Jp("Just to Confirm...")),f(AN,F([hN(20),cN,ON]),f(tu,vN(F([cN,aN(18),jN,wA(ex)])),O(F([O(F([Jp("You will deposit "),f(Bk,F([wA(T$)]),Jp(u+" "+Qf(e.web3Context.factoryType))),Jp(", thereby becoming the "),d,Jp(" of this trade. By doing so, you are agreeing to ")]),h)]),function(){return"Token"===e.web3Context.factoryType.$?F([F([Jp("(This ususally requires two Metamask signatures. Your "+Qf(e.web3Context.factoryType)+" will not be deposited until the second transaction has been mined.)")])]):mr}()))),f(Bk,F([lx,cN]),f(ix,"Yes, I definitely want to commit to this trade.",l(jO,n,a,i)))])),HO);case"ApproveNeedsSig":t.a;return sx(F([Jp("Waiting for user signature for the approve call."),Jp("(check Metamask!)"),Jp("Note that there will be a second transaction to sign after this.")]));case"ApproveMining":var p=t.a.a;return sx(F([Jp("Mining the initial approve transaction..."),f(yA,F([dx,wA(T$)]),{label:Jp("See the transaction on Etherscan"),url:f(cx,e.web3Context.factoryType,p)}),Jp("Funds will not leave your wallet until you sign the next transaction.")]));case"CommitNeedsSig":t.a;return sx(F([Jp("Waiting for user signature for the final commit call."),Jp("(check Metamask!)"),Jp("This will make the deposit and commit you to the trade.")]));case"CommitMining":var p=t.a.a;return sx(F([Jp("Mining the final commit transaction..."),f(yA,F([dx,wA(T$)]),{label:Jp("See the transaction"),url:f(cx,e.web3Context.factoryType,p)})]));case"ConfirmingAction":var g=t.a.a;return l(G$,mr,f(AN,F([hN(20),KN(20),cN,ET(Nk),ux]),F([f(Bk,F([aN(26),tN,cN,ON]),Jp("Just to Confirm...")),f(AN,F([hN(20),cN,ON]),f(tu,vN(F([cN,aN(18),jN,wA(ex)])),function(){switch(g.$){case"Poke":case"Recall":return mr;case"Claim":return F([F([Jp('By clicking "Confirm Payment", you are claiming that you\'ve paid the Seller in a way they can verify. Only do this if you are sure the Seller will agree that they have the money--otherwise they may burn the '+Qf(e.web3Context.factoryType)+" rather than release it to you.")])]);case"Abort":return F([F([Jp("Aborting will incur a small penalty on both parties, and refund the rest of the "+Qf(e.web3Context.factoryType)+".")])]);case"Release":return F([F([Jp("Releasing the payment will irreversibly send the trade's balance to the Buyer. Only do this if you are certain you've received the full agreed-upon payment.")])]);default:return F([F([Jp("This will destroy the "+Qf(e.web3Context.factoryType)+" in the payment. Only do this if the Buyer has attempted to scam you, is nonresponsive, or for some reason has failed the payment.")])])}}())),f(Bk,F([lx,cN]),function(e){return f(ix,e,HS(g))}(function(){switch(g.$){case"Poke":return"Poke";case"Recall":return"Recall";case"Claim":return"I understand. Confirm Payment";case"Abort":return"I understand. Abort the trade.";case"Release":return"I understand. Release the "+Qf(e.web3Context.factoryType)+".";default:return"I understand. Burn the "+Qf(e.web3Context.factoryType)+"."}}()))])),HO);case"ActionNeedsSig":var g=t.a.a;return sx(F([Jp("Waiting for user signature for the "+qS(g)+" call."),Jp("(check Metamask!)")]));default:var v=t.a,g=v.a,p=v.b;return Rk}},GO=NN(F([AT(Nk),Lk(Fk),Yk(5),KN(20),aD,nD])),zO=function(e){return f(NN,F([hN(8)]),F([f(WR,mr,t$),f(Bk,F([aN(24),jN]),Jp(n$(e)))]))},YO=r(function(e,t){var r=f(ng,yb(e),f(jf,function(e){return e.address},t));return f(v_,function(){var t=L(e.parameters.initiatorRole,r);if("Buyer"===t.a.$){if("Just"===t.b.$&&"Initiator"===t.b.a.$){t.a,t.b.a;return"You're Buying"}t.a;return"Buying"}if("Just"===t.b.$&&"Initiator"===t.b.a.$){t.a,t.b.a;return"You're Selling"}t.a;return"Selling"}(),zO(e.parameters.tradeAmount))}),WO=function(e){return f(NN,F([hN(5)]),F([w_(e.fiatType),f(Bk,F([aN(24),jN]),Jp(KO(e)))]))},JO=function(e){return f(v_,"For Fiat",WO(e.terms.price))},QO=function(e){return"Buyer"===e.$?"Buyer":"Seller"},XO=l(Tk,250,165,22),ZO=l(Tk,255,0,0),eM=l(Tk,0,255,0),tM=MR({description:"aborted",src:"/DAIHard/static/img/aborted.svg"}),rM=MR({description:"burned",src:"/DAIHard/static/img/burned.svg"}),nM=MR({description:"released",src:"/DAIHard/static/img/released.svg"}),aM={$:"ToggleStatsModal"},iM=function(e){return f(DO,to,e)},oM=n(function(e,t,n){var a=f(Zd,function(e){return $(f(CS,e,n),ya(t))},f(qE,function(e){if("LoadedTrade"===e.$){var t=e.a;return ya(t)}return ma},Ma(e.trades))),i=Oi(a),o=l(za,r(function(e,t){switch(e.state.closedReason.$){case"Released":return U(t,{amountReleased:f(fd,t.amountReleased,e.parameters.tradeAmount),numReleases:t.numReleases+1});case"Burned":return U(t,{amountBurned:f(fd,t.amountBurned,e.parameters.tradeAmount),numBurns:t.numBurns+1});case"Aborted":return U(t,{numAborts:t.numAborts+1});default:return t}}),{amountBurned:Wf,amountReleased:Wf,numAborts:0,numBurns:0,numReleases:0},a),u=f(jf,Ff,Xf(iM(f(qE,function(e){return function(e){return e?ya(e):ma}(Gl(e.phaseStartInfo.committedTime))},a))));return{amountBurned:o.amountBurned,amountReleased:o.amountReleased,asRole:t,firstTrade:u,numAborts:o.numAborts,numBurns:o.numBurns,numReleases:o.numReleases,numTrades:i}}),uM=function(e){return{$:"ViewUserHistory",a:e}},sM=f(_B,0,mr),cM=f(qk,eN,PT.textNormalWeight),fM=r(function(e,t){return gi(e/t)}),lM=n(function(e,t,r){for(;;){if(!r.b)return t+e;var n=r.a,a=r.b;if(_(n.start,t)<0)return t+n.offset;var i=e,o=t,u=a;e=i,t=o,r=u}}),dM=r(function(e,t){var r=e.a,n=e.b;return l(lM,r,f(fM,Gl(t),6e4),n)}),hM=r(function(e,t){return f(Xu,24,f(fM,f(dM,e,t),60))}),pM=r(function(e,t){return f(Xu,1e3,Gl(t))}),gM=r(function(e,t){return f(Xu,60,f(dM,e,t))}),vM={$:"Apr"},yM={$:"Aug"},mM={$:"Dec"},bM={$:"Feb"},CM={$:"Jan"},SM={$:"Jul"},EM={$:"Jun"},TM={$:"Mar"},wM={$:"May"},IM={$:"Nov"},AM={$:"Oct"},BM={$:"Sep"},kM=function(e){var t=f(fM,e,1440)+719468,r=(t>=0?t:t-146096)/146097|0,n=t-146097*r,a=(n-(n/1460|0)+(n/36524|0)-(n/146096|0))/365|0,i=n-(365*a+(a/4|0)-(a/100|0)),o=(5*i+2)/153|0,u=o+(o<10?3:-9);return{day:i-((153*o+2)/5|0)+1,month:u,year:a+400*r+(u<=2?1:0)}},NM=r(function(e,t){switch(kM(f(dM,e,t)).month){case 1:return CM;case 2:return bM;case 3:return TM;case 4:return vM;case 5:return wM;case 6:return EM;case 7:return SM;case 8:return yM;case 9:return BM;case 10:return AM;case 11:return IM;default:return mM}}),RM=r(function(e,t){return f(Xu,60,f(fM,Gl(t),1e3))}),$M={$:"Fri"},xM={$:"Mon"},_M={$:"Sat"},LM={$:"Sun"},PM={$:"Thu"},DM={$:"Tue"},UM={$:"Wed"},OM=r(function(e,t){switch(f(Xu,7,f(fM,f(dM,e,t),1440))){case 0:return PM;case 1:return $M;case 2:return _M;case 3:return LM;case 4:return xM;case 5:return DM;default:return UM}}),MM=n(function(e,t,r){return e.toAmPm(f(hM,t,r))}),FM=r(function(e,t){return kM(f(dM,e,t)).day}),VM=FM,KM=F([LM,xM,DM,UM,PM,$M,_M]),HM=r(function(e,t){return function(e){return e.a}(f(ec,L(0,LM),Xf(f(Zd,function(r){return $(r.b,f(OM,e,t))},f(Ki,r(function(e,t){return L(e,t)}),KM)))))}),jM=function(e){return l(za,Ga,0,e)},qM=r(function(e,t){return kM(f(dM,e,t)).year}),GM=function(e){return!f(Xu,4,e)&&(!!f(Xu,100,e)||!f(Xu,400,e))},zM=r(function(e,t){switch(t.$){case"Jan":return 31;case"Feb":return GM(e)?29:28;case"Mar":return 31;case"Apr":return 30;case"May":return 31;case"Jun":return 30;case"Jul":case"Aug":return 31;case"Sep":return 30;case"Oct":return 31;case"Nov":return 30;default:return 31}}),YM=F([CM,bM,TM,vM,wM,EM,SM,yM,BM,AM,IM,mM]),WM=r(function(e,t){return f(ec,L(0,CM),Xf(f(Zd,function(r){r.a;return $(r.b,f(NM,e,t))},f(Ki,r(function(e,t){return L(e,t)}),YM))))}),JM=r(function(e,t){return 1+function(e){var t=e.a;e.b;return t}(f(WM,e,t))}),QM=r(function(e,t){var r=f($s,f(JM,e,t)-1,YM);return jM(f(tu,zM(f(qM,e,t)),r))+f(VM,e,t)}),XM=r(function(e,t){return f(JM,e,t)/4|0}),ZM=r(function(e,t){var r=ji(t),n=e-go(r);return O(f(qi,"",f(tu,function(e){return"0"},f(Vi,1,n))),r)}),eF=function(e){return e?e<=12?e:e-12:12},tF=Ag(315576e5),rF=r(function(e,t){return Ff(tF*f(qM,e,t))}),nF=r(function(e,t){var r=f(rF,e,t),n=f(HM,e,r);return 1+((f(QM,e,t)+n)/7|0)}),aF=r(function(e,t){return ji(f(qM,e,t))}),iF=a(function(e,t,r,n){switch(n.$){case"MonthNumber":return ji(f(JM,t,r));case"MonthSuffix":return function(t){return O(ji(t),e.toOrdinalSuffix(t))}(f(JM,t,r));case"MonthFixed":return f(ZM,2,f(JM,t,r));case"MonthNameAbbreviated":return e.toMonthAbbreviation(f(NM,t,r));case"MonthNameFull":return e.toMonthName(f(NM,t,r));case"QuarterNumber":return ji(1+f(XM,t,r));case"QuarterSuffix":return function(t){return O(ji(t),e.toOrdinalSuffix(t))}(1+f(XM,t,r));case"DayOfMonthNumber":return ji(f(VM,t,r));case"DayOfMonthSuffix":return function(t){return O(ji(t),e.toOrdinalSuffix(t))}(f(VM,t,r));case"DayOfMonthFixed":return f(ZM,2,f(VM,t,r));case"DayOfYearNumber":return ji(f(QM,t,r));case"DayOfYearSuffix":return function(t){return O(ji(t),e.toOrdinalSuffix(t))}(f(QM,t,r));case"DayOfYearFixed":return f(ZM,3,f(QM,t,r));case"DayOfWeekNumber":return ji(f(HM,t,r));case"DayOfWeekSuffix":return function(t){return O(ji(t),e.toOrdinalSuffix(t))}(f(HM,t,r));case"DayOfWeekNameAbbreviated":return e.toWeekdayAbbreviation(f(OM,t,r));case"DayOfWeekNameFull":return e.toWeekdayName(f(OM,t,r));case"WeekOfYearNumber":return ji(f(nF,t,r));case"WeekOfYearSuffix":return function(t){return O(ji(t),e.toOrdinalSuffix(t))}(f(nF,t,r));case"WeekOfYearFixed":return f(ZM,2,f(nF,t,r));case"YearNumberLastTwo":return f(wo,2,f(aF,t,r));case"YearNumber":return f(aF,t,r);case"AmPmUppercase":return HP(l(MM,e,t,r));case"AmPmLowercase":return cl(l(MM,e,t,r));case"HourMilitaryNumber":return ji(f(hM,t,r));case"HourMilitaryFixed":return f(ZM,2,f(hM,t,r));case"HourNumber":return ji(eF(f(hM,t,r)));case"HourFixed":return f(ZM,2,eF(f(hM,t,r)));case"HourMilitaryFromOneNumber":return ji(1+f(hM,t,r));case"HourMilitaryFromOneFixed":return f(ZM,2,1+f(hM,t,r));case"MinuteNumber":return ji(f(gM,t,r));case"MinuteFixed":return f(ZM,2,f(gM,t,r));case"SecondNumber":return ji(f(RM,t,r));case"SecondFixed":return f(ZM,2,f(RM,t,r));case"MillisecondNumber":return ji(f(pM,t,r));case"MillisecondFixed":return f(ZM,3,f(pM,t,r));default:return n.a}}),oF=a(function(e,t,r,n){return f(qi,"",f(tu,l(iF,e,r,n),t))}),uF=o(function(e,t,r,n,a,i){return{toAmPm:a,toMonthAbbreviation:t,toMonthName:e,toOrdinalSuffix:i,toWeekdayAbbreviation:n,toWeekdayName:r}}),sF=function(e){return e>11?"pm":"am"},cF=function(e){switch(e.$){case"Jan":return"January";case"Feb":return"February";case"Mar":return"March";case"Apr":return"April";case"May":return"May";case"Jun":return"June";case"Jul":return"July";case"Aug":return"August";case"Sep":return"September";case"Oct":return"October";case"Nov":return"November";default:return"December"}},fF=function(e){switch(f(Xu,100,e)){case 11:case 12:case 13:return"th";default:switch(f(Xu,10,e)){case 1:return"st";case 2:return"nd";case 3:return"rd";default:return"th"}}},lF=function(e){switch(e.$){case"Mon":return"Monday";case"Tue":return"Tuesday";case"Wed":return"Wednesday";case"Thu":return"Thursday";case"Fri":return"Friday";case"Sat":return"Saturday";default:return"Sunday"}},dF=p(uF,cF,f($a,cF,Co(3)),lF,f($a,lF,Co(3)),sF,fF),hF=oF(dF),pF={$:"MonthNameFull"},gF=pF,vF=function(e){return{$:"Text",a:e}},yF=vF,mF={$:"YearNumber"},bF=mF,CF=n(function(e,t,n){var a=r(function(e,t){return f(AN,F([aN(18),hN(6)]),F([f(Bk,F([yN]),Jp(e)),f(Bk,F([cM]),Jp(t))]))}),i=hF(F([gF,yF(", "),bF])),o=f(AN,F([hN(23),AT(Nk)]),O(f(tu,function(e){var t=e.a,r=e.b;return f(a,t,r)},F([L("First Trade",function(){var e=n.firstTrade;if("Just"===e.$){var t=e.a;return f(i,sM,t)}return"No Committed Trades yet!"}()),L("Release Outcomes",ji(n.numReleases)+" trades / "+n$(n.amountReleased)+" "+Qf(e)+" Released"),L("Abort Outcomes",ji(n.numAborts)+" trades"),L("Burn Outcomes",ji(n.numBurns)+" trades / "+n$(n.amountBurned)+" "+Qf(e)+" Burned")])),F([f(Bk,F([cN]),f(hO,"View User History",uM(n.asRole)))])));return f(AN,F([Yk(8),ID,AD,Lk(AR),hN(1),rD({blur:20,color:d(JR,0,0,0,.08),offset:L(0,0),size:0})]),F([f(Bk,F([AT(Nk),Lk(Fk),KN(17)]),f(m$,18,t)),f(Bk,F([AT(Nk),Lk(Fk),KN(17)]),o)]))}),SF=a(function(e,t,r,n){var a=l(oM,r,t.parameters.initiatorRole,t.parameters.initiatorAddress),i=QO(t.parameters.initiatorRole)+" Stats";return f(Bk,n?F([f_(f(Bk,F([l_(30),TN]),l(CF,e,t.parameters.initiatorAddress,a)))]):mr,f(v_,i,f(NN,F([AT(Nk),hN(20),Gk,Zk(aM)]),f(tu,NN(F([hN(5)])),F([F([f(WR,F([ET(xk(28))]),nM),f(Bk,F([aN(24),jN,wA(eM)]),Jp(l(Ju,2,D("0"),ji(a.numReleases))))]),F([f(WR,F([ET(xk(28))]),tM),f(Bk,F([aN(24),jN,wA(XO)]),Jp(l(Ju,2,D("0"),ji(a.numAborts))))]),F([f(WR,F([ET(xk(28))]),rM),f(Bk,F([aN(24),jN,wA(ZO)]),Jp(l(Ju,2,D("0"),ji(a.numBurns))))])])))))}),EF=r(function(e,t){if("Token"===e.$){if("EthDai"===e.a.$){e.a;return"https://etherscan.io/address/"+Xd(t)}e.a;return"https://kovan.etherscan.io/address/"+Xd(t)}switch(e.a.$){case"Eth":e.a;return"https://etherscan.io/address/"+Xd(t);case"Kovan":e.a;return"https://kovan.etherscan.io/address/"+Xd(t);default:e.a;return"https://blockscout.com/poa/dai/address/"+Xd(t)}}),TF=n(function(e,t,r){return f(yA,e,{label:Jp(Xd(r)),url:f(EF,t,r)})}),wF=r(function(e,t){return f(v_,"Trade Status",f(AN,F([aN(24),jN,hN(8)]),F([Jp(function(){switch(e.state.phase.$){case"Open":return"Buyer"===e.parameters.initiatorRole.$?"Open Buy Offer":"Open Sell Offer";case"Committed":return"Committed";case"Judgment":return"Judgment";default:return"Closed"}}()),l(TF,F([aN(12),wA(T$),dx]),t,e.creationInfo.address)])))}),IF=o(function(e,t,r,n,a,i){return GO(F([f(wF,t,n),f(YO,t,r),JO(t),d(SF,n,t,a,i)]))}),AF=l(Tk,9,32,107),BF=MR({description:"chat",src:"/DAIHard/static/img/chat.svg"}),kF=f(Bk,F([Yk(4),Gk,Zk(MO),KN(5),Lk(l(Tk,22,0,255))]),f(WR,F([AT(xk(42))]),BF)),NF=function(e){switch(e.$){case"NotClosed":return"";case"Recalled":return"Recalled";case"Aborted":return"Aborted";case"Released":return"Released";default:return"Burned"}},RF=function(e){return f(AN,F([Yk(12),Lk(AR),KN(15),hN(15)]),F([f(Bk,F([aN(24),tN,CN]),Jp("Fiat Payment Method")),f(vN,F([aN(18),ET(wT),Lk(Fk),rD({blur:5,color:d(JR,0,0,0,.2),offset:L(-3,3),size:0}),Yk(3),KN(5)]),F([f(ec,f(Bk,F([wA(B$),CN]),Jp("No payment methods found.")),f(jf,Jp,f(jf,function(e){return e.info},Xf(e))))]))]))},$F={$:"Active"},xF=function(e){return{$:"ExpandPhase",a:e}},_F=F([Lk(AF),wA(Fk)]),LF=r(function(e,t){return{$:"Min",a:e,b:t}}),PF=r(function(e,t){return f(LF,e,t)}),DF=function(e){return F(e?[Yk(12),V$,ET(f(PF,380,wT))]:[Yk(12),cN])},UF=F([Lk(Fk)]),OF=MR({description:"flame",src:"/DAIHard/static/img/flame.png"}),MF=r(function(e,t){return Kf(f(xu,Hf(e),Hf(t)))}),FF=r(function(e,t){return d(ax,P(d(JR,1,.6,.2,1),d(JR,1,.6,.2,.8),d(JR,1,.6,.2,.6)),Fk,e,t)}),VF=n(function(e,t,r){return{$:"CommitClicked",a:e,b:t,c:r}}),KF=function(e){return{$:"ContractActionClicked",a:e}},HF={$:"Web3Connect"},jF=n(function(e,t,r){if("Just"===r.$){var n=r.a;return"TimeUp"===f(TR,e,t).$?Rk:f(NN,F([hN(8)]),function(){var e=P(t.state.phase,f(yb,t,n.address),f(CS,t,n.address));e:for(;;)switch(e.a.$){case"Open":if("Just"===e.b.$){if("Initiator"===e.b.a.$){e.a,e.b.a;return F([f(Lf,HS,f(hO,"Remove and Refund this Trade",VS))])}break e}var r=(e.a,e.b,Hf(mb(t.parameters)));return F([f(ix,"Deposit and Commit to Trade",l(VF,t,n,r))]);case"Committed":if("Just"===e.c.$){if("Buyer"===e.c.a.$){e.a,e.c.a;return F([f(Lf,KF,f(FF,"Abort Trade",IS)),f(Lf,KF,f(ix,"Confirm Payment",_S)),kF])}e.a,e.c.a;return F([kF])}break e;case"Judgment":if("Just"===e.c.$){if("Seller"===e.c.a.$){e.a,e.c.a;return F([f(Lf,KF,f(ix,"Burn it All!",$S)),f(Lf,KF,f(hO,"Release Everything",KS)),kF])}e.a,e.c.a;return F([kF])}break e;default:break e}return mr}())}return f(ix,"Connect to Wallet",HF)}),qF={$:"Finished"},GF={$:"NotStarted"},zF=r(function(e,t){var r=L(xN(t),xN(e.state.phase)),n=r.a,a=r.b;return _(n,a)>0?GF:$(n,a)?$F:qF}),YF=n(function(e,t,r){for(;;){if(t<=0)return e;var n=f(qa,r,e),a=t-1,i=r;e=n,t=a,r=i}}),WF=r(function(e,t){return l(YF,mr,e,t)}),JF=i(function(e,t,r,n,a){var i=n$(f(fd,n.parameters.tradeAmount,n.parameters.buyerDeposit))+" "+Qf(e),o=n$(n.parameters.tradeAmount)+" "+Qf(e),u=f(NN,mr,f(WF,3,f(WR,F([ET(xk(18))]),OF))),s=f(wf,Bk(F([wA(l(bA,1,0,0))])),Jp),c=$(t,n.state.phase),d=f(ng,CS(n),f(jf,function(e){return e.address},a)),h=c?Fk:IR,p=vN(F([wA(h),aN(18),tN])),g=KO(n.terms.price),v=c?l(Tk,0,226,255):l(Tk,16,7,234),y=f(wf,Bk(F([wA(v)])),Jp),m=n$(n.parameters.buyerDeposit)+" "+Qf(e),b=n.parameters.abortPunishment,C=n$(b)+" "+Qf(e),S=n$(f(MF,n.parameters.buyerDeposit,b))+" "+Qf(e),E=n$(f(MF,n.parameters.tradeAmount,b))+" "+Qf(e),T=function(){var r=L(t,d);if("Just"===r.b.$)switch(r.a.$){case"Open":var a=(r.a,r.b.a);return L("And Now, We Wait",function(){return"Buyer"===a.$?f(tu,p,F([F([Jp("Your "),s("burnable deposit"),Jp(" of "),y(m),Jp(" is now held in this contract, and your offer to buy "),y(o),Jp(" for "),y(g),Jp(" is now listed in the marketplace.")]),F([Jp("If another user likes your offer, they can become the Seller by depositing the full "),y(o),Jp(" into this contract.")]),F([Jp("If no one commits within the Open Window, your offer will expire, refunding the "),y(m),Jp(" to you.")])])):f(tu,p,F([F([Jp("Your offer to sell the "),y(o),Jp(" held in this contract for "),y(g),Jp(" is now listed in the marketplace.")]),F([Jp("If another user likes your offer, they can become the Buyer by depositing a "),s("burnable deposit"),Jp(" of 1/3 of the trade amount "),y("("+m+")"),Jp(" into this contract.")]),F([Jp("If no one commits within the Open Window, your offer will expire, refunding the "),y(o),Jp(" to you.")])]))}());case"Committed":if("Buyer"===r.b.a.$){r.a,r.b.a;return L("Time to Pay Up",f(tu,p,F([F([Jp("You must now pay the Seller "),y(g),Jp(" via the Fiat Payment Method, "),f(Bk,F([tN]),Jp("and then click ")),s("Confirm Payment"),Jp(" before the payment window runs out. Use the chat to coordinate.")]),F([Jp("If you abort the trade, or do not confirm payment before this time is up, "),y(C),Jp(" (1/4 of the "),s("burnable deposit"),Jp(") will be "),s("burned"),Jp(" from both parties, while the remainder of each party's deposit is refunded ("),y(E),Jp(" to the Seller, "),y(S),Jp(" to you).")]),F([Jp("This may be your last chance to clear up any ambiguity before Judgement. Do not confirm unless you're sure the "),y(g),Jp(" has been unmistakably transferred.")])])))}r.a,r.b.a;return L("Time to Get Paid",f(tu,p,F([F([Jp("Work and communicate with the Buyer to receive "),y(g),Jp(" as described in Fiat Payment Method. Then, the Buyer should confirm the payment, moving the trade to the final phase.")]),F([Jp("If the Buyer aborts the trade, or doesn't confirm payment before this time is up, "),y(C),Jp(" (1/4 of the "),s("burnable deposit"),Jp(") will be "),s("burned"),Jp(" from both parties, while the remainder of each party's deposit is refunded ("),y(E),Jp(" to you, "),y(S),Jp(" to the Buyer).")])])));case"Judgment":if("Buyer"===r.b.a.$){r.a,r.b.a;return L("Judgement",f(tu,p,F([F([Jp("If the Seller confirms receipt of payment, or fails to decide within the Burn/Release Window, the combined balance of "),y(i),Jp(" will be released to you.")]),F([Jp("If they cannot confirm they've received payment from you, they will probably instead "),s("burn the contract's balance of "),y(i),s("."),Jp(" In this case the "),y(i),Jp(" will be lost to both parties.")]),F([Jp("These are the only options the Seller has. So, fingers crossed!")])])))}r.a,r.b.a;return L("Judgement",f(tu,p,F([F([Jp("By pushing the contract to the final stage, the Buyer has indicated that the transfer has taken place, and awaits your judgement.")]),F([Jp("So, have you recieved the "),y(g),Jp("? If so, you can click "),y("Release Everything"),Jp(".")]),F([Jp("If not, the Buyer is probably trying to scam you, and you should probably "),s("burn it all"),Jp(". You're not getting it back either way, and you wouldn't want the other guy to get it, would you?")]),F([Jp("If you don't decide within the Burn/Release Window, the balance will be automatically released.")])])));default:r.a;return L("Contract closed.",F([p(F([Jp("Check the chat log for the full history.")]))]))}else switch(r.a.$){case"Open":r.a,r.b;return L("Get it while it's hot",function(){return"Seller"===n.parameters.initiatorRole.$?f(tu,p,F([F([Jp("The Seller has deposited "),y(o),Jp(" into this contract, and offers to sell it for "),y(g),Jp(". To become the Buyer, you must deposit 1/3 of the trade amount "),y("("+m+")"),Jp(" into this contract by clicking "),s("Deposit and Commit to Trade"),Jp(".")]),F([Jp("If the trade is successful, the combined "+Qf(e)+" balance "),y("("+i+")"),Jp(" will be released to you. If anything goes wrong, there are "),s("burnable punishments "),u,Jp(" for both parties (see Payment Window for more on this).")]),F([Jp("Don't commit unless you can fulfil one of the seller’s accepted payment methods below for "),y(g),Jp(" within the payment window.")])])):f(tu,p,F([F([Jp("The Buyer is offering to buy "),y(o),Jp(" for "),y(g),Jp(", and has deposited "),y(m),Jp(" into this contract as a "),s("burnable deposit"),Jp(". To become the Seller, deposit "),y(o),Jp(" into this contract by clicking "),s("Deposit and Commit to Trade"),Jp(".")]),F([Jp("When you receive the "),y(g),Jp(" from the Buyer, the combined "+Qf(e)+" balance "),y("("+i+")"),Jp(" will be released to the Buyer. If anything goes wrong, there are "),s("burnable punishments "),u,Jp(" for both parties (see Payment Window for more on this).")]),F([Jp("Don't commit unless you can receive "),y(g),Jp(" via one of the Buyer's payment methods below, within the payment window.")])]))}());case"Committed":r.a,r.b;return L("Making the Payment",f(tu,p,F([F([Jp("During this phase, the Buyer is expected to transfer "),y(g),Jp(" to the Seller, as described in Fiat Payment Method, "),f(Bk,F([tN]),Jp("and ")),s("Confirm the Payment "),Jp(" before the payment window runs out. This would move the trade to the final phase.")]),F([Jp("If the Buyer aborts the trade, or doesn't confirm payment before this time is up, "),y(C),Jp(" (1/4 of the "),s("burnable deposit"),Jp(" amount) will be "),s("burned"),Jp(" from both parties, while the remainder of each party's deposit is refunded ("),y(E),Jp(" to the Seller, "),y(S),Jp(" to the Buyer).")])])));case"Judgment":r.a,r.b;return L("Judgement",f(tu,p,F([F([Jp("The Buyer has indicated that the transfer has taken place, and awaits the Seller's judgement on the fact of the matter.")]),F([Jp("If the Seller can verify he has received the "),y(g),Jp(", he will probably release the total balance of "),y(o),Jp(" to the Buyer. If he cannot verify payment, he will probably instead "),s("burn it all"),Jp(".")]),F([Jp("If the Seller has not made a decision before the Burn/Release Window expires, the "),y(o),Jp(" will be automaticall released.")])])));default:r.a,r.b;return L("Contract closed.",mr)}}(),w=T.a,I=T.b;return f(AN,F([AT(Nk),ET(Nk),KN(20),hN(30)]),F([f(NN,F([AT(Nk)]),F([f(Bk,F([aN(24),tN,wA(v),Sx]),Jp(w))])),f(AN,F([AT(Nk),ON,hN(13)]),I),f(Bk,F([TN]),function(){switch(f(zF,n,t).$){case"Active":return l(jF,r,n,a);case"NotStarted":return f(Bk,F([aN(20),tN,CN,wA(g$)]),Jp("Phase not yet started."));default:return f(Bk,F([aN(20),tN,CN]),Jp("Phase no longer active."))}}())]))}),QF=MR({description:"committed phase",src:"/DAIHard/static/img/phase-committed.svg"}),XF=MR({description:"judgment phase",src:"/DAIHard/static/img/time-clock-fire.svg"}),ZF={$:"None"},eV=ZF,tV=MR({description:"open phase",src:"/DAIHard/static/img/diamond-give-white.svg"}),rV=function(e){switch(e.$){case"Open":return tV;case"Committed":return QF;case"Judgment":return XF;default:return eV}},nV=a(function(e,t,r,n){return{$:"RgbaSpace",a:e,b:t,c:r,d:n}}),aV=a(function(e,t,r,n){return d(nV,e,t,r,n)}),iV=function(e){var t=e.a,r=e.b,n=e.c;return{alpha:e.d,blue:n,green:r,red:t}},oV=function(e){return function(e){return d(aV,e.red,e.green,e.blue,e.alpha)}(iV(e))},uV=function(e){return{$:"Circle",a:e}},sV=uV,cV=d(nV,0,0,0,1),fV={$:"Flat"},lV={$:"Sharp"},dV=function(e){return{$:"Uniform",a:e}},hV=dV,pV={cap:fV,dashPattern:mr,dashPhase:0,fill:hV(cV),join:lV,thickness:2},gV=n(function(e,t,r){return U(pV,{dashPattern:e,fill:r,thickness:t})}),vV=gV(mr),yV={$:"Transparent"},mV=yV,bV=f(vV,0,mV),CV=r(function(e,t){return{$:"Shape",a:e,b:t}}),SV=function(e){return{basic:e,handlers:mr,name:ma,opacity:1,rotation:0,scale:L(1,1),shift:L(0,0)}},EV=function(e){return f(wf,SV,CV(e))},TV=function(e){return EV(L(e,bV))},wV=function(e){return L(-e.a,-e.b)},IV=r(function(e,t){var r=e.a,n=e.b,a=t.shift;return U(t,{shift:L(a.a+r,a.b+n)})}),AV=r(function(e,t){return f(IV,wV(e(t)),t)}),BV=function(e){var t=r(function(e,t){var r=e.a,n=e.b,a=t.a,i=t.b;return L(f(qa,r,a),f(qa,n,i))});return l(Ja,t,L(mr,mr),e)},kV=r(function(e,t){return{$:"Path",a:e,b:t}}),NV=Nr,RV=Rr,$V=function(e){var t=e.shift,r=e.scale,n=e.rotation,a=function(e){var t=e.a,r=e.b,a=RV(n),i=NV(n);return L(i*t-a*r,a*t+i*r)},i=r,o=i.a,u=i.b,s=function(e){var t=e.a,r=e.b;return L(o*t,u*r)},c=t,l=c.a,d=c.b;return f(wf,f(wf,function(e){var t=e.a,r=e.b;return L(t+l,r+d)},s),a)},xV=function(e){return tu(function(t){var r=t.a,n=t.b,a=e/2;return L(r<0?r-a:r+a,n<0?n-a:n+a)})},_V=r(function(e,t){var r=t.a,n=t.b,a=n/2,i=r/2;return f(xV,e,F([L(-i,-a),L(i,-a),L(i,a),L(-i,a)]))}),LV=function(e){var t=e.toTop,r=e.toBottom,n=e.toRight,a=e.toLeft;return F([L(-a,-r),L(n,-r),L(n,t),L(-a,t)])},PV=function(e){var t=DV(e.basic),r=BV(f(tu,$V(e),t)),n=r.a,a=r.b;return{toBottom:-f(ec,0,CI(a)),toLeft:-f(ec,0,CI(n)),toRight:f(ec,0,bI(n)),toTop:f(ec,0,bI(a))}},DV=function(e){e:for(;;)switch(e.$){case"Shape":switch(e.b.$){case"Circle":var t=e.a,r=t.b.thickness,n=e.b.a,a=2*n;return f(_V,r,L(a,a));case"Ellipse":var i=e.a,r=i.b.thickness,o=e.b,u=o.a,s=o.b;return f(_V,r,L(2*u,2*s));case"Rectangle":var c=e.a,r=c.b.thickness,l=e.b,d=l.a,h=l.b;return f(_V,r,L(d,h));case"Polygon":var p=e.a,r=p.b.thickness,g=e.b.a;return f(xV,r,g);default:var v=e.a,y=v.b,m=e.b.a,b=f(kV,y,m);e=b;continue e}case"Path":var r=e.a.thickness,C=e.a.cap,g=e.b.a;return f(xV,$(C,fV)?0:r,g);case"Text":case"Image":case"Html":var S=e.a;return f(_V,0,S);case"Group":var E=e.a;return f(xV,0,uy(f(tu,f($a,PV,LV),E)));default:var T=e.b;return f(xV,0,LV(PV(T)))}},UV=function(e){var t=PV(e);return t.toTop+t.toBottom},OV=function(e){var t=PV(e);return L(-t.toLeft,t.toTop)},MV=function(e){var t=PV(e);return t.toLeft+t.toRight},FV=Un("http://www.w3.org/2000/svg"),VV=FV("svg"),KV=qn("height"),HV=qn("version"),jV=qn("width"),qV=FV("circle"),GV=FV("ellipse"),zV=FV("foreignObject"),YV=FV("g"),WV=FV("image"),JV=FV("polygon"),QV=FV("polyline"),XV=FV("rect"),ZV=kw,eK=FV("text"),tK=qn("id"),rK=qn("points"),nK=qn("r"),aK=qn("rx"),iK=qn("ry"),oK=function(e){return l(Gn,"http://www.w3.org/1999/xlink","xlink:href",it(e))},uK=function(e){return{$:"Group",a:e}},sK=qn("dominant-baseline"),cK=qn("fill"),fK=qn("fill-opacity"),lK=qn("font-family"),dK=qn("font-size"),hK=qn("font-style"),pK=qn("font-variant"),gK=qn("font-weight"),vK=qn("opacity"),yK=qn("stroke"),mK=qn("stroke-dasharray"),bK=qn("stroke-dashoffset"),CK=qn("stroke-linecap"),SK=qn("stroke-linejoin"),EK=qn("stroke-opacity"),TK=qn("stroke-width"),wK=qn("text-anchor"),IK=qn("text-decoration"),AK=qn("transform"),BK=function(e){switch(e.$){case"Round":return"round";case"Padded":return"square";default:return"butt"}},kK=function(e){return f(qi," ",f(tu,function(e){var t=e.a,r=e.b;return f(qi,",",F([ji(t),ji(r)]))},e))},NK=n(function(e,t,r){return d(nV,e,t,r,1)}),RK=function(e){var t=e.a,r=e.b,n=e.c,a=e.d,i=function(e){return Ag(1e4*e)/100};return Sl(F(["rgba(",Tw(i(t)),"%,",Tw(i(r)),"%,",Tw(i(n)),"%,",Tw(function(e){return Ag(1e3*e)/1e3}(a)),")"]))},$K=function(e){var t=e.a,r=e.b,n=e.c;return{alpha:e.d,blue:n,green:r,red:t}},xK=function(e){var t=$K(e),r=t.red,n=t.green,a=t.blue;return RK(l(NK,r,n,a))},_K=function(e){if("Uniform"===e.$){var t=e.a;return xK(t)}return"none"},LK=function(e){var t=$K(e),r=t.alpha;return Tw(r)},PK=function(e){if("Uniform"===e.$){var t=e.a;return LK(t)}return"0"},DK=function(e){switch(e.$){case"Smooth":return"round";case"Sharp":return"miter";default:return"bevel"}},UK=kr,OK=function(e){var t=Tw(e.scale.b),r=Tw(e.scale.a),n=Tw(-e.rotation/2/UK*360),a=Tw(-e.shift.b),i=Tw(e.shift.a);return Sl(F(["translate(",i,",",a,") scale(",r,",",t,") rotate(",n,")"]))},MK=function(e){var t=e.basic;switch(t.$){case"Path":var r=t.a;return F([yK(_K(r.fill)),EK(PK(r.fill)),TK(Tw(r.thickness)),CK(BK(r.cap)),SK(DK(r.join)),cK("none"),vK(Tw(e.opacity)),AK(OK(e)),bK(ji(r.dashPhase)),mK(kK(r.dashPattern))]);case"Shape":var n=t.a,a=n.a,r=n.b;return F([cK(_K(a)),fK(PK(a)),yK(_K(r.fill)),EK(PK(r.fill)),TK(Tw(r.thickness)),CK(BK(r.cap)),SK(DK(r.join)),vK(Tw(e.opacity)),AK(OK(e)),bK(ji(r.dashPhase)),mK(kK(r.dashPattern))]);case"Text":var i=t.b,o=i.a;i.b;return F([cK(_K(dV(o.color))),lK(function(){var e=o.typeface;switch(e.$){case"Serif":return"serif";case"Sansserif":return"sans-serif";case"Monospace":return"monospace";default:return e.a}}()),dK(ji(o.size)),gK(function(){switch(o.weight.$){case"Thin":return"200";case"Light":return"300";case"Regular":return"normal";case"Medium":return"500";case"SemiBold":return"600";case"Bold":return"bold";default:return"800"}}()),hK(function(){switch(o.shape.$){case"Upright":case"SmallCaps":return"normal";case"Slanted":return"oblique";default:return"italic"}}()),pK(function(){return"SmallCaps"===o.shape.$?"small-caps":"normal"}()),IK(function(){switch(o.line.$){case"None":return"none";case"Under":return"underline";case"Over":return"overline";default:return"line-through"}}()),wK("middle"),sK("middle"),AK(OK(e))]);default:return F([AK(OK(e))])}},FK=qn("x"),VK=qn("y"),KK=r(function(e,t){return F([jV(Tw(e)),KV(Tw(t)),FK(Tw(-e/2)),VK(Tw(-t/2))])}),HK=function(e){return f(qi," ",f(tu,function(e){var t=e.a,r=e.b;return f(qi,",",F([Tw(t),Tw(-r)]))},e))},jK=Qk,qK=r(function(e,t){return f(e,t.a,t.b)}),GK=function(e){return f(tu,qK(jK),e)},zK=function(e){e:for(;;){var t=f(ec,"_unnamed_",e.name),n=e.basic;switch(n.$){case"Path":var a=(n.a,n.b),i=a.a;return f(QV,O(F([tK(t),rK(HK(i))]),O(MK(e),GK(e.handlers))),mr);case"Shape":var o=n.a,u=(o.a,o.b),s=n.b;switch(s.$){case"Polygon":var i=s.a;return f(JV,O(F([tK(t),rK(HK(i))]),O(MK(e),GK(e.handlers))),mr);case"Circle":var c=s.a;return f(qV,O(F([tK(t),nK(Tw(c))]),O(MK(e),GK(e.handlers))),mr);case"Ellipse":var d=s.a,h=s.b;return f(GV,O(F([tK(t),aK(Tw(d)),iK(Tw(h))]),O(MK(e),GK(e.handlers))),mr);case"Rectangle":var p=s.a,g=s.b,c=s.c;return f(XV,O(F([tK(t),aK(Tw(c)),iK(Tw(c))]),O(f(KK,p,g),O(MK(e),GK(e.handlers)))),mr);default:var a=s.a,v=U(e,{basic:f(kV,u,a)});e=v;continue e}case"Text":var y=n.b,m=(y.a,y.b);return f(eK,O(F([tK(t)]),O(MK(e),GK(e.handlers))),F([ZV(m)]));case"Image":var b=n.a,p=b.a,g=b.b,C=n.b;return f(WV,O(F([tK(t),oK(C)]),O(f(KK,p,g),O(MK(e),GK(e.handlers)))),mr);case"Html":var S=n.a,p=S.a,g=S.b,E=n.b;return f(zV,O(F([tK(t)]),O(f(KK,p,g),O(MK(e),GK(e.handlers)))),F([E]));case"Group":var T=n.a;return f(YV,f(qa,tK(t),O(MK(e),GK(e.handlers))),l(za,r(function(e,t){return f(qa,zK(e),t)}),mr,T));default:var w=n.a,I=n.b,v=U(e,{basic:uK(F([w,I]))});e=v;continue e}}},YK=r(function(e,t){var r=e.a,n=e.b,a=Tw(r),i=Tw(n);return f(WT,mr,F([f(VV,F([jV(a),KV(i),HV("1.1")]),F([zK(t)]))]))}),WK=function(e){return f(YK,L(MV(e),UV(e)),f(AV,OV,e))},JK=r(function(e,t){var r=rV(e),n=function(){switch(t.$){case"NotStarted":return l(Tk,10,33,108);case"Active":return l(Tk,0,100,170);default:return l(Tk,1,129,104)}}(),a=A_(WK(f(TV,hV(oV(n)),sV(50))));return f(Bk,F([cN,H$(f(WR,F([cN,ON,ET(xk(50))]),r))]),a)}),QK=function(e){var t=F([CN,tN,aN(20)]);switch(e.$){case"Active":return f(Bk,O(t,F([wA(oN)])),Jp("Active"));case"NotStarted":return f(Bk,O(t,F([wA(g$)])),Jp("Not Started"));default:return f(Bk,t,Jp("Finished"))}},XK=n(function(e,t,r){var n=f(zF,t,e),a=function(){return"Active"===n.$?l(Tk,0,226,255):IR}(),i=f(Bk,F([wA(a),aN(20),tN,cN]),Jp(function(){switch(e.$){case"Open":return"Open Window";case"Committed":return"Payment Window";case"Judgment":return"Burn/Release Window";default:return"Closed"}}())),o=function(){if("Closed"===e.$)return Rk;switch(n.$){case"NotStarted":return d(LR,F([cN]),F([aN(22),jN]),L(IR,AR),f(SR,e,t));case"Active":var a=f(TR,r,t);if("TimeLeft"===a.$){var i=a.a;return d(UR,F([cN]),F([aN(22),jN]),L(Fk,AR),i)}return f(AN,F([cN,hN(10)]),F([f(Bk,F([cN]),Jp(wR(e))),f(hO,"Poke",HS(FS))]));default:return f(Bk,F([ET(xk(1))]),Rk)}}();return f(AN,F([KN(20),hN(10),ET(Nk)]),F([f(Bk,F([V$,cN]),i),f(Bk,F([ET(Nk),cN]),f(Bk,F([ON]),f(JK,e,n))),f(AN,F([hN(10),lx,cN]),F([f(Bk,F([cN]),QK(n)),o]))]))}),ZK=u(function(e,t,r,n,a,i,o){var u=f(zF,n,r),s=f(Bk,F([KN(10),AT(Nk),ET(Nk)]),h(JF,t,r,o,n,a)),c=function(){switch(r.$){case"Open":return n.parameters.autorecallInterval;case"Committed":return n.parameters.autoabortInterval;case"Judgment":return n.parameters.autoreleaseInterval;default:return Ff(0)}}(),d=l(XK,r,n,o),p=(function(){switch(u.$){case"NotStarted":return c;case"Active":return f(ER,f(Tb,n.state.phaseStartTime,c),o);default:Ff(0)}}(),f(Bk,F([ET(Nk),AT(xk(1)),Lk(function(){return"Active"===u.$?l(bA,0,0,1):AR}())]),Rk)),g=i?f(NN,O(DF(e),O($(u,$F)?_F:UF,F([AT(Nk)]))),F([d,p,s])):f(NN,O(DF(e),O($(u,$F)?_F:UF,F([Gk,Zk(xF(r))]))),F([d]));return!e&&$(u,$F)?f(AN,F([AT(Nk),hN(20),C$({bottom:20,left:0,right:0,top:0})]),F([g,RF(n.terms.paymentMethods)])):g}),eH=o(function(e,t,r,n,a,i){return"Closed"===r.state.phase.$?f(NN,F([cN,Yk(12),KN(30),hN(10),Lk(AF),aN(24),tN,wA(Fk)]),F([Jp("Trade "+NF(r.state.closedReason)),kF])):e?f(AN,F([AT(Nk),hN(10)]),F([f(NN,F([AT(Nk),ET(wT),hN(20)]),F([g(ZK,e,t,no,r,a,$(n,no),i),g(ZK,e,t,nC,r,a,$(n,nC),i),g(ZK,e,t,aC,r,a,$(n,aC),i)])),RF(r.terms.paymentMethods)])):f(AN,F([AT(Nk),ET(wT),hN(20)]),F([g(ZK,e,t,no,r,a,$(n,no),i),g(ZK,e,t,nC,r,a,$(n,nC),i),g(ZK,e,t,aC,r,a,$(n,aC),i)]))}),tH=a(function(e,t,r,n){var a=e>1300;return L(function(){var e=n.trade;switch(e.$){case"LoadedTrade":var i=e.a;return f(AN,F([AT(Nk),ET(Nk),hN(40)]),F([p(IF,t,i,n.userInfo,n.web3Context.factoryType,r,n.showStatsModal),f(Bk,F([AT(Nk),f(Hk,40,0),hN(40)]),p(eH,a,n.web3Context.factoryType,i,n.expandedPhase,n.userInfo,t))]));case"PartiallyLoadedTrade":e.a;return f(Bk,F([cN,ON,aN(30)]),Jp("Loading trade info..."));default:return f(Bk,F([cN,ON,aN(30)]),Jp("Invalid trade"))}}(),F([FO(n),qO(n)]))}),rH=n(function(e,t,r){var n=r.a,a=r.b;return L(e(n),t(a))}),nH=r(function(e,t){var r=function(){var r=t.submodel;switch(r.$){case"BetaLandingPage":return L(GD(Dk(Jv(ry))),mr);case"CreateModel":var n=r.a;return L(f(Lf,Uy,UD(n)),mr);case"QuickCreateModel":var a=r.a;return l(rH,Lf(Fy),tu(Lf(Fy)),BO(a));case"TradeModel":var i=r.a;return l(rH,Lf(Ky),tu(Lf(Ky)),d(tH,e,t.time,t.tradeCache,i));case"MarketplaceModel":var o=r.a;return L(f(Lf,gT,l(ZU,t.time,t.tradeCache,o)),mr);default:var u=r.a;return L(f(Lf,lT,l(R$,t.time,t.tradeCache,u)),mr)}}(),n=r.a,a=r.b;return L(f(Bk,F([AT(Nk),ET(Nk),Yk(10)]),n),a)}),aH=function(e){return{$:"DismissNotice",a:e}},iH=function(e){return f(ZN,$U,xU(e))},oH=function(e){var t=e.a,n=e.b,a=function(){return"Error"===n.noticeType.$?l(bA,1,1,1):l(bA,0,0,0)}(),i=function(){switch(n.noticeType.$){case"Update":return l(Tk,100,200,255);case"Caution":return l(Tk,255,188,0);case"Error":return l(Tk,255,70,70);default:return l(Tk,200,200,200)}}(),o=f(Bk,F([TN,V$,X$(5),iH(5)]),P$(aH(t)));return f(Bk,F([Lk(i),Yk(10),KN(8),AT(Nk),d$(1),f$(d(JR,0,0,0,.15)),nD]),f(AN,F([hN(4),AT(Nk)]),f(Ki,r(function(e,t){return f(vN,F([AT(Nk),wA(a)]),e?t:f(qa,o,t))}),n.mainParagraphs)))},uH=function(e){return $(e,mr)?mr:F([f(AN,F([_U(20),X$(20),hN(10),TN,lx,AT(xk(300)),aN(15)]),f(tu,oH,f(Zd,function(e){return $(e.b.align,Yp)},f(Ki,r(function(e,t){return L(e,t)}),e)))),f(AN,F([iH(20),l_(100),hN(10),Sx,V$,AT(xk(300)),aN(15)]),f(tu,oH,f(Zd,function(e){return $(e.b.align,yB)},f(Ki,r(function(e,t){return L(e,t)}),e))))])},sH=r(function(e,t){var r=f(nH,e,t),n=r.a,a=r.b;return L(f(AN,F([kR(Pk),H$(RN(t)),AT(Nk),ET(Nk),KN(30)]),F([f(Bk,F([ET(xk(50))]),Rk),n])),O(a,uH(t.userNotices)))}),cH=r(function(e,t){return{$:"OnlyDynamic",a:e,b:t}}),fH=r(function(e,t){return{$:"StaticRootAndDynamic",a:e,b:t}}),lH={$:"AllowHover"},dH={$:"Layout"},hH={backgroundColor:ma,borderColor:ma,shadow:ya({blur:3,color:d(mA,155/255,203/255,1,1),offset:L(0,0),size:3})},pH=function(e){var t=r(function(e,t){switch(e.$){case"HoverOption":var r=e.a;return"Nothing"===t.hover.$?U(t,{hover:ya(r)}):t;case"FocusStyleOption":var n=e.a;return"Nothing"===t.focus.$?U(t,{focus:ya(n)}):t;default:var a=e.a;return"Nothing"===t.mode.$?U(t,{mode:ya(a)}):t}});return function(e){return{focus:function(){var t=e.focus;return"Nothing"===t.$?hH:t.a}(),hover:function(){var t=e.hover;return"Nothing"===t.$?lH:t.a}(),mode:function(){var t=e.mode;return"Nothing"===t.$?dH:t.a}()}}(l(Ja,t,{focus:ma,hover:ma,mode:ma},e))},gH=r(function(e,t){switch(t.$){case"Unstyled":var r=t.a;return r($T);case"Styled":var n=t.a.styles,r=t.a.html;return f(r,e(n),$T);case"Text":var a=t.a;return DI(a);default:return DI("")}}),vH=n(function(e,t,r){var n=pH(e),a=function(){return"NoStaticStyleSheet"===n.mode.$?cH(n):fH(n)}();return f(gH,a,d(gA,$T,Ak,t,NT(F([r]))))}),yH=aw(5),mH=r(function(e,t){return{$:"FontFamily",a:e,b:t}}),bH={$:"SansSerif"},CH=function(e){return{$:"Typeface",a:e}},SH=W,EH=r(function(e,t){return O(t,function(){switch(e.$){case"Serif":return"serif";case"SansSerif":return"sans-serif";case"Monospace":return"monospace";case"Typeface":var t=e.a;return f(qi,"-",SH(cl(t)));case"ImportFont":var t=e.a;e.b;return f(qi,"-",SH(cl(t)));default:var t=e.a.name;return f(qi,"-",SH(cl(t)))}}())}),TH=function(){var e=F([CH("Open Sans"),CH("Helvetica"),CH("Verdana"),bH]);return F([f(EA,_k,l(SA,"bg-color-"+TA(d(mA,1,1,1,0)),"background-color",d(mA,1,1,1,0))),f(EA,CA,l(SA,"font-color-"+TA(d(mA,0,0,0,1)),"color",d(mA,0,0,0,1))),f(EA,rN,nN(20)),f(EA,yH,f(mH,l(za,EH,"font-",e),e))])}(),wH=n(function(e,t,r){var n=e.options;return l(vH,n,f(qa,vA(f(qi," ",F([PT.root,PT.any,PT.single]))),O(TH,t)),r)}),IH=wH({options:mr}),AH=function(e){return f(EA,yH,f(mH,l(za,EH,"ff-",e),e))},BH=bH,kH=CH,NH=function(e){return{body:F([function(){var t=f(sH,e.screenWidth,e),r=t.a,n=t.b,a=O(F([AT(Nk),ET(Nk),AH(F([kH("Soleil"),BH]))]),f(tu,H$,n));return f(IH,a,r)}()]),title:"DAIHard"}},RH=jt,$H=RH({init:CB,onUrlChange:Ek,onUrlRequest:Sk,subscriptions:Ck,update:fB,view:NH});!function(t){e.Elm?We("Elm",e.Elm,t):e.Elm=t}({App:{init:$H(f(Ro,function(e){return f(Ro,function(t){return f(Ro,function(r){return _o({height:r,networkId:t,width:e})},f(Od,"height",ZC))},f(Od,"networkId",ZC))},f(Od,"width",ZC)))(0)}})}(this)},function(e,t,r){"use strict";function n(){"undefined"!=typeof web3?(window.ethereum&&(window.ethereum.autoRefreshOnNetworkChange=!1),web3.version.getNetwork(function(e,t){var r;e?(console.log("Error initializing web3: "+e),r=0):r=parseInt(t),window.app=s.Elm.App.init({node:document.getElementById("elm"),flags:{networkId:r,width:window.innerWidth,height:window.innerHeight}}),a(app),i(app,web3)})):(window.app=s.Elm.App.init({node:document.getElementById("elm"),flags:{networkId:0,width:window.innerWidth,height:window.innerHeight}}),a(app),console.log("Metamask not detected."))}function a(e){e.ports.gTagOut.subscribe(function(e){gtag("event",e.event,{event_category:e.category,event_label:e.label,value:e.value})})}function i(e,t){o(e,t),t.eth.getAccounts(function(r,n){n&&n.length>0&&u(e,t)})}function o(e,t){l.startWatching(e.ports.networkSentryPort,t),e.ports.connectToWeb3.subscribe(function(r){u(e,t)})}function u(e,t){window.ethereum&&!window.web3Connected&&(window.web3=new Web3(ethereum)),c.txSentry(e.ports.txOut,e.ports.txIn,t),c.walletSentry(e.ports.walletSentryPort,t),l.startWatching(e.ports.networkSentryPort,t),e.ports.genPrivkey.subscribe(function(t){f.prepareKeypair(t.signSeedMsg,t.address,function(t,r){console.log("pubkey: ",r),e.ports.userPubkeyResult.send(r)})}),e.ports.encryptToPubkeys.subscribe(function(t){var r=f.encryptToPubkeys(t.message,t.pubkeyHexStrings);e.ports.encryptionFinished.send(r)}),e.ports.decryptMessage.subscribe(function(t){var r=t.id,n=f.decryptForUser(t.encapsulation,t.iv,t.tag,t.encrypted);n||console.log("Uh oh! Decryption didn't work..."),e.ports.decryptionFinished.send({id:r,message:n})}),window.ethereum&&!window.web3Connected&&(ethereum.enable(),window.web3Connected=!0)}Object.defineProperty(t,"__esModule",{value:!0});var s=r(41),c=(r.n(s),r(40)),f=r(39),l=r(38);window.forge=r(22),window.web3Connected=!1,window.addEventListener("load",function(){n()})},function(e,t,r){"use strict";function n(e){var t=e.length;if(t%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var r=e.indexOf("=");return-1===r&&(r=t),[r,r===t?0:4-r%4]}function a(e){var t=n(e),r=t[0],a=t[1];return 3*(r+a)/4-a}function i(e,t,r){return 3*(t+r)/4-r}function o(e){for(var t,r=n(e),a=r[0],o=r[1],u=new d(i(e,a,o)),s=0,c=o>0?a-4:a,f=0;f>16&255,u[s++]=t>>8&255,u[s++]=255&t;return 2===o&&(t=l[e.charCodeAt(f)]<<2|l[e.charCodeAt(f+1)]>>4,u[s++]=255&t),1===o&&(t=l[e.charCodeAt(f)]<<10|l[e.charCodeAt(f+1)]<<4|l[e.charCodeAt(f+2)]>>2,u[s++]=t>>8&255,u[s++]=255&t),u}function u(e){return f[e>>18&63]+f[e>>12&63]+f[e>>6&63]+f[63&e]}function s(e,t,r){for(var n,a=[],i=t;io?o:i+16383));return 1===n?(t=e[r-1],a.push(f[t>>2]+f[t<<4&63]+"==")):2===n&&(t=(e[r-2]<<8)+e[r-1],a.push(f[t>>10]+f[t>>4&63]+f[t<<2&63]+"=")),a.join("")}t.byteLength=a,t.toByteArray=o,t.fromByteArray=c;for(var f=[],l=[],d="undefined"!=typeof Uint8Array?Uint8Array:Array,h="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",p=0,g=h.length;p>1,f=-7,l=r?a-1:0,d=r?-1:1,h=e[t+l];for(l+=d,i=h&(1<<-f)-1,h>>=-f,f+=u;f>0;i=256*i+e[t+l],l+=d,f-=8);for(o=i&(1<<-f)-1,i>>=-f,f+=n;f>0;o=256*o+e[t+l],l+=d,f-=8);if(0===i)i=1-c;else{if(i===s)return o?NaN:1/0*(h?-1:1);o+=Math.pow(2,n),i-=c}return(h?-1:1)*o*Math.pow(2,i-n)},t.write=function(e,t,r,n,a,i){var o,u,s,c=8*i-a-1,f=(1<>1,d=23===a?Math.pow(2,-24)-Math.pow(2,-77):0,h=n?0:i-1,p=n?1:-1,g=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(u=isNaN(t)?1:0,o=f):(o=Math.floor(Math.log(t)/Math.LN2),t*(s=Math.pow(2,-o))<1&&(o--,s*=2),t+=o+l>=1?d/s:d*Math.pow(2,1-l),t*s>=2&&(o++,s/=2),o+l>=f?(u=0,o=f):o+l>=1?(u=(t*s-1)*Math.pow(2,a),o+=l):(u=t*Math.pow(2,l-1)*Math.pow(2,a),o=0));a>=8;e[r+h]=255&u,h+=p,u/=256,a-=8);for(o=o<0;e[r+h]=255&o,h+=p,o/=256,c-=8);e[r+h-p]|=128*g}},function(e,t){var r={}.toString;e.exports=Array.isArray||function(e){return"[object Array]"==r.call(e)}},function(e,t,r){function n(e,t,r){var n=t.entity===c.tls.ConnectionEnd.client;e.read.cipherState={init:!1,cipher:c.cipher.createDecipher("AES-CBC",n?r.keys.server_write_key:r.keys.client_write_key),iv:n?r.keys.server_write_IV:r.keys.client_write_IV},e.write.cipherState={init:!1,cipher:c.cipher.createCipher("AES-CBC",n?r.keys.client_write_key:r.keys.server_write_key),iv:n?r.keys.client_write_IV:r.keys.server_write_IV},e.read.cipherFunction=u,e.write.cipherFunction=a,e.read.macLength=e.write.macLength=r.mac_length,e.read.macFunction=e.write.macFunction=f.hmac_sha1}function a(e,t){var r=!1,n=t.macFunction(t.macKey,t.sequenceNumber,e);e.fragment.putBytes(n),t.updateSequenceNumber();var a;a=e.version.minor===f.Versions.TLS_1_0.minor?t.cipherState.init?null:t.cipherState.iv:c.random.getBytesSync(16),t.cipherState.init=!0;var o=t.cipherState.cipher;return o.start({iv:a}),e.version.minor>=f.Versions.TLS_1_1.minor&&o.output.putBytes(a),o.update(e.fragment),o.finish(i)&&(e.fragment=o.output,e.length=e.fragment.length(),r=!0),r}function i(e,t,r){if(!r){var n=e-t.length()%e;t.fillWithByte(n-1,n)}return!0}function o(e,t,r){var n=!0;if(r){for(var a=t.length(),i=t.last(),o=a-1-i;o=i?(e.fragment=a.output.getBytes(d-i),u=a.output.getBytes(i)):e.fragment=a.output.getBytes(),e.fragment=c.util.createBuffer(e.fragment),e.length=e.fragment.length();var h=t.macFunction(t.macKey,t.sequenceNumber,e);return t.updateSequenceNumber(),r=s(t.macKey,u,h)&&r}function s(e,t,r){var n=c.hmac.create();return n.start("SHA1",e),n.update(t),t=n.digest().getBytes(),n.start(null,null),n.update(r),r=n.digest().getBytes(),t===r}var c=r(0);r(5),r(37);var f=e.exports=c.tls;f.CipherSuites.TLS_RSA_WITH_AES_128_CBC_SHA={id:[0,47],name:"TLS_RSA_WITH_AES_128_CBC_SHA",initSecurityParameters:function(e){e.bulk_cipher_algorithm=f.BulkCipherAlgorithm.aes,e.cipher_type=f.CipherType.block,e.enc_key_length=16,e.block_length=16,e.fixed_iv_length=16,e.record_iv_length=16,e.mac_algorithm=f.MACAlgorithm.hmac_sha1,e.mac_length=20,e.mac_key_length=20},initConnectionState:n},f.CipherSuites.TLS_RSA_WITH_AES_256_CBC_SHA={id:[0,53],name:"TLS_RSA_WITH_AES_256_CBC_SHA",initSecurityParameters:function(e){e.bulk_cipher_algorithm=f.BulkCipherAlgorithm.aes,e.cipher_type=f.CipherType.block,e.enc_key_length=32,e.block_length=16,e.fixed_iv_length=16,e.record_iv_length=16,e.mac_algorithm=f.MACAlgorithm.hmac_sha1,e.mac_length=20,e.mac_key_length=20},initConnectionState:n};var l=0},function(e,t,r){(function(t){function r(e,t){var r=0,n=t.length,a=t.charAt(0),i=[0];for(r=0;r0;)i.push(u%n),u=u/n|0}var s="";for(r=0;0===e.at(r)&&r=0;--r)s+=t[i[r]];return s}var n={};e.exports=n;var a={};n.encode=function(e,t,n){if("string"!=typeof t)throw new TypeError('"alphabet" must be a string.');if(void 0!==n&&"number"!=typeof n)throw new TypeError('"maxline" must be a number.');var a="";if(e instanceof Uint8Array){var i=0,o=t.length,u=t.charAt(0),s=[0];for(i=0;i0;)s.push(f%o),f=f/o|0}for(i=0;0===e[i]&&i=0;--i)a+=t[s[i]]}else a=r(e,t);if(n){var l=new RegExp(".{1,"+n+"}","g");a=a.match(l).join("\r\n")}return a},n.decode=function(e,r){if("string"!=typeof e)throw new TypeError('"input" must be a string.');if("string"!=typeof r)throw new TypeError('"alphabet" must be a string.');var n=a[r];if(!n){n=a[r]=[];for(var i=0;i>=8;for(;l>0;)s.push(255&l),l>>=8}for(var d=0;e[d]===u&&d=32;--n){for(r=0,a=n-32,i=n-12;a>8,t[a]-=256*r;t[a]+=r,t[n]=0}for(r=0,a=0;a<32;++a)t[a]+=r-(t[31]>>4)*H[a],r=t[a]>>8,t[a]&=255;for(a=0;a<32;++a)t[a]-=r*H[a];for(n=0;n<32;++n)t[n+1]+=t[n]>>8,e[n]=255&t[n]}function c(e){for(var t=new Float64Array(64),r=0;r<64;++r)t[r]=e[r],e[r]=0;s(e,t)}function f(e,t){var r=B(),n=B(),a=B(),i=B(),o=B(),u=B(),s=B(),c=B(),f=B();N(r,e[1],e[0]),N(f,t[1],t[0]),$(r,r,f),k(n,e[0],e[1]),k(f,t[0],t[1]),$(n,n,f),$(a,e[3],t[3]),$(a,a,F),$(i,e[2],t[2]),k(i,i,i),N(o,n,r),N(u,i,a),k(s,i,a),k(c,n,r),$(e[0],o,u),$(e[1],c,s),$(e[2],s,u),$(e[3],o,c)}function l(e,t,r){for(var n=0;n<4;++n)A(e[n],t[n],r)}function d(e,t){var r=B(),n=B(),a=B();w(a,t[2]),$(r,t[0],a),$(n,t[1],a),h(e,n),e[31]^=C(r)<<7}function h(e,t){var r,n,a,i=B(),o=B();for(r=0;r<16;++r)o[r]=t[r];for(I(o),I(o),I(o),n=0;n<2;++n){for(i[0]=o[0]-65517,r=1;r<15;++r)i[r]=o[r]-65535-(i[r-1]>>16&1),i[r-1]&=65535;i[15]=o[15]-32767-(i[14]>>16&1),a=i[15]>>16&1,i[14]&=65535,A(o,i,1-a)}for(r=0;r<16;r++)e[2*r]=255&o[r],e[2*r+1]=o[r]>>8}function p(e,t){var r=B(),n=B(),a=B(),i=B(),o=B(),u=B(),s=B();return T(e[2],O),g(e[1],t),R(a,e[1]),$(i,a,M),N(a,a,e[2]),k(i,e[2],i),R(o,i),R(u,o),$(s,u,o),$(r,s,a),$(r,r,i),v(r,r),$(r,r,a),$(r,r,i),$(r,r,i),$(e[0],r,i),R(n,e[0]),$(n,n,i),y(n,a)&&$(e[0],e[0],j),R(n,e[0]),$(n,n,i),y(n,a)?-1:(C(e[0])===t[31]>>7&&N(e[0],U,e[0]),$(e[3],e[0],e[1]),0)}function g(e,t){var r;for(r=0;r<16;++r)e[r]=t[2*r]+(t[2*r+1]<<8);e[15]&=32767}function v(e,t){var r,n=B();for(r=0;r<16;++r)n[r]=t[r];for(r=250;r>=0;--r)R(n,n),1!==r&&$(n,n,t);for(r=0;r<16;++r)e[r]=n[r]}function y(e,t){var r=new P(32),n=new P(32);return h(r,e),h(n,t),m(r,0,n,0)}function m(e,t,r,n){return b(e,t,r,n,32)}function b(e,t,r,n,a){var i,o=0;for(i=0;i>>8)-1}function C(e){var t=new P(32);return h(t,e),1&t[0]}function S(e,t,r){var n,a;for(T(e[0],U),T(e[1],O),T(e[2],O),T(e[3],U),a=255;a>=0;--a)n=r[a/8|0]>>(7&a)&1,l(e,t,n),f(t,e),f(e,e),l(e,t,n)}function E(e,t){var r=[B(),B(),B(),B()];T(r[0],V),T(r[1],K),T(r[2],O),$(r[3],V,K),S(e,r,t)}function T(e,t){var r;for(r=0;r<16;r++)e[r]=0|t[r]}function w(e,t){var r,n=B();for(r=0;r<16;++r)n[r]=t[r];for(r=253;r>=0;--r)R(n,n),2!==r&&4!==r&&$(n,n,t);for(r=0;r<16;++r)e[r]=n[r]}function I(e){var t,r,n=1;for(t=0;t<16;++t)r=e[t]+n+65535,n=Math.floor(r/65536),e[t]=r-65536*n;e[0]+=n-1+37*(n-1)}function A(e,t,r){for(var n,a=~(r-1),i=0;i<16;++i)n=a&(e[i]^t[i]),e[i]^=n,t[i]^=n}function B(e){var t,r=new Float64Array(16);if(e)for(t=0;t=0};var U=B(),O=B([1]),M=B([30883,4953,19914,30187,55467,16705,2637,112,59544,30585,16505,36039,65139,11119,27886,20995]),F=B([61785,9906,39828,60374,45398,33411,5274,224,53552,61171,33010,6542,64743,22239,55772,9222]),V=B([54554,36645,11616,51542,42930,38181,51040,26924,56412,64982,57905,49316,21502,52590,14035,8553]),K=B([26200,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214]),H=new Float64Array([237,211,245,92,26,99,18,88,214,156,247,162,222,249,222,20,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,16]),j=B([41136,18958,6951,50414,58488,44335,6150,12099,55207,15867,153,11085,57099,20417,9344,11139])}).call(t,r(10).Buffer)},function(e,t,r){function n(e,t,r,n){e.generate=function(e,i){for(var o=new a.util.ByteBuffer,u=Math.ceil(i/n)+r,s=new a.util.ByteBuffer,c=r;c0&&(o=a.util.fillString(String.fromCharCode(0),s)+o),{encapsulation:t.encrypt(o,"NONE"),key:e.generate(o,n)}},n.decrypt=function(t,r,n){var a=t.decrypt(r,"NONE");return e.generate(a,n)},n},a.kem.kdf1=function(e,t){n(this,e,0,t||e.digestLength)},a.kem.kdf2=function(e,t){n(this,e,1,t||e.digestLength)}},function(e,t,r){e.exports=r(4),r(16),r(9),r(35),r(36)},function(e,t,r){var n=r(0);r(26),e.exports=n.mgf=n.mgf||{},n.mgf.mgf1=n.mgf1},function(e,t,r){function n(e){var t={},r=[];if(!p.validate(e,g.asn1.recipientInfoValidator,t,r)){var n=new Error("Cannot read PKCS#7 RecipientInfo. ASN.1 object is not an PKCS#7 RecipientInfo.");throw n.errors=r,n}return{version:t.version.charCodeAt(0),issuer:h.pki.RDNAttributesAsArray(t.issuer),serialNumber:h.util.createBuffer(t.serial).toHex(),encryptedContent:{algorithm:p.derToOid(t.encAlgorithm),parameter:t.encParameter.value,content:t.encKey}}}function a(e){return p.create(p.Class.UNIVERSAL,p.Type.SEQUENCE,!0,[p.create(p.Class.UNIVERSAL,p.Type.INTEGER,!1,p.integerToDer(e.version).getBytes()),p.create(p.Class.UNIVERSAL,p.Type.SEQUENCE,!0,[h.pki.distinguishedNameToAsn1({attributes:e.issuer}),p.create(p.Class.UNIVERSAL,p.Type.INTEGER,!1,h.util.hexToBytes(e.serialNumber))]),p.create(p.Class.UNIVERSAL,p.Type.SEQUENCE,!0,[p.create(p.Class.UNIVERSAL,p.Type.OID,!1,p.oidToDer(e.encryptedContent.algorithm).getBytes()),p.create(p.Class.UNIVERSAL,p.Type.NULL,!1,"")]),p.create(p.Class.UNIVERSAL,p.Type.OCTETSTRING,!1,e.encryptedContent.content)])}function i(e){for(var t=[],r=0;r0){for(var r=p.create(p.Class.CONTEXT_SPECIFIC,1,!0,[]),n=0;n=r&&a0&&a.value[0].value.push(p.create(p.Class.CONTEXT_SPECIFIC,0,!0,e)),n.length>0&&a.value[0].value.push(p.create(p.Class.CONTEXT_SPECIFIC,1,!0,n)),a.value[0].value.push(p.create(p.Class.UNIVERSAL,p.Type.SET,!0,r.signerInfos)),p.create(p.Class.UNIVERSAL,p.Type.SEQUENCE,!0,[p.create(p.Class.UNIVERSAL,p.Type.OID,!1,p.oidToDer(r.type).getBytes()),a])},addSigner:function(e){var t=e.issuer,n=e.serialNumber;if(e.certificate){var a=e.certificate;"string"==typeof a&&(a=h.pki.certificateFromPem(a)),t=a.issuer.attributes,n=a.serialNumber}var i=e.key;if(!i)throw new Error("Could not add PKCS#7 signer; no private key specified.");"string"==typeof i&&(i=h.pki.privateKeyFromPem(i));var o=e.digestAlgorithm||h.pki.oids.sha1;switch(o){case h.pki.oids.sha1:case h.pki.oids.sha256:case h.pki.oids.sha384:case h.pki.oids.sha512:case h.pki.oids.md5:break;default:throw new Error("Could not add PKCS#7 signer; unknown message digest algorithm: "+o)}var u=e.authenticatedAttributes||[];if(u.length>0){for(var s=!1,c=!1,f=0;f="8"&&(r="00"+r);var n=o.util.hexToBytes(r);e.putInt32(n.length),e.putBytes(n)}function a(e,t){e.putInt32(t.length),e.putString(t)}function i(){for(var e=o.md.sha1.create(),t=arguments.length,r=0;r0&&(this.state=v[this.state].block)},y.prototype.unblock=function(e){return e=void 0===e?1:e,this.blocks-=e,0===this.blocks&&this.state!==d&&(this.state=c,b(this,0)),this.blocks},y.prototype.sleep=function(e){e=void 0===e?0:e,this.state=v[this.state].sleep;var t=this;this.timeoutId=setTimeout(function(){t.timeoutId=null,t.state=c,b(t,0)},e)},y.prototype.wait=function(e){e.wait(this)},y.prototype.wakeup=function(){this.state===l&&(cancelTimeout(this.timeoutId),this.timeoutId=null,this.state=c,b(this,0))},y.prototype.cancel=function(){this.state=v[this.state].cancel,this.permitsNeeded=0,null!==this.timeoutId&&(cancelTimeout(this.timeoutId),this.timeoutId=null),this.subtasks=[]},y.prototype.fail=function(e){if(this.error=!0,C(this,!0),e)e.error=this.error,e.swapTime=this.swapTime,e.userData=this.userData,b(e,0);else{if(null!==this.parent){for(var t=this.parent;null!==t.parent;)t.error=this.error,t.swapTime=this.swapTime,t.userData=this.userData,t=t.parent;C(t,!0)}this.failureCallback&&this.failureCallback(this)}};var m=function(e){e.error=!1,e.state=v[e.state][g],setTimeout(function(){e.state===c&&(e.swapTime=+new Date,e.run(e),b(e,0))},0)},b=function(e,t){var r=t>30||+new Date-e.swapTime>20,n=function(t){if(t++,e.state===c)if(r&&(e.swapTime=+new Date),e.subtasks.length>0){var n=e.subtasks.shift();n.error=e.error,n.swapTime=e.swapTime,n.userData=e.userData,n.run(n),n.error||b(n,t)}else C(e),e.error||null!==e.parent&&(e.parent.error=e.error,e.parent.swapTime=e.swapTime,e.parent.userData=e.userData,b(e.parent,t))};r?setTimeout(n,0):n(t)},C=function(e,t){e.state=d,delete i[e.id],null===e.parent&&(e.type in u?0===u[e.type].length?n.log.error(a,"[%s][%s] task queue empty [%s]",e.id,e.name,e.type):u[e.type][0]!==e?n.log.error(a,"[%s][%s] task not first in queue [%s]",e.id,e.name,e.type):(u[e.type].shift(),0===u[e.type].length?delete u[e.type]:u[e.type][0].start()):n.log.error(a,"[%s][%s] task queue missing [%s]",e.id,e.name,e.type),t||(e.error&&e.failureCallback?e.failureCallback(e):!e.error&&e.successCallback&&e.successCallback(e)))};e.exports=n.task=n.task||{},n.task.start=function(e){var t=new y({run:e.run,name:e.name||"?"});t.type=e.type,t.successCallback=e.success||null,t.failureCallback=e.failure||null,t.type in u?u[e.type].push(t):(u[t.type]=[t],m(t))},n.task.cancel=function(e){e in u&&(u[e]=[u[e][0]])},n.task.createCondition=function(){var e={tasks:{}};return e.wait=function(t){t.id in e.tasks||(t.block(),e.tasks[t.id]=t)},e.notify=function(){var t=e.tasks;e.tasks={};for(var r in t)t[r].unblock()},e}},function(e,t,r){(function(e,t){!function(e,r){"use strict";function n(e){"function"!=typeof e&&(e=new Function(""+e));for(var t=new Array(arguments.length-1),r=0;r=0&&(e._idleTimeoutId=setTimeout(function(){e._onTimeout&&e._onTimeout()},t))},r(55),t.setImmediate="undefined"!=typeof self&&self.setImmediate||void 0!==e&&e.setImmediate||this&&this.setImmediate,t.clearImmediate="undefined"!=typeof self&&self.clearImmediate||void 0!==e&&e.clearImmediate||this&&this.clearImmediate}).call(t,r(14))}]); \ No newline at end of file +var J=r(43),Q=r(44),X=r(45);t.Buffer=i,t.SlowBuffer=g,t.INSPECT_MAX_BYTES=50,i.TYPED_ARRAY_SUPPORT=void 0!==e.TYPED_ARRAY_SUPPORT?e.TYPED_ARRAY_SUPPORT:function(){try{var e=new Uint8Array(1);return e.__proto__={__proto__:Uint8Array.prototype,foo:function(){return 42}},42===e.foo()&&"function"==typeof e.subarray&&0===e.subarray(1,1).byteLength}catch(e){return!1}}(),t.kMaxLength=n(),i.poolSize=8192,i._augment=function(e){return e.__proto__=i.prototype,e},i.from=function(e,t,r){return o(null,e,t,r)},i.TYPED_ARRAY_SUPPORT&&(i.prototype.__proto__=Uint8Array.prototype,i.__proto__=Uint8Array,"undefined"!=typeof Symbol&&Symbol.species&&i[Symbol.species]===i&&Object.defineProperty(i,Symbol.species,{value:null,configurable:!0})),i.alloc=function(e,t,r){return s(null,e,t,r)},i.allocUnsafe=function(e){return c(null,e)},i.allocUnsafeSlow=function(e){return c(null,e)},i.isBuffer=function(e){return!(null==e||!e._isBuffer)},i.compare=function(e,t){if(!i.isBuffer(e)||!i.isBuffer(t))throw new TypeError("Arguments must be Buffers");if(e===t)return 0;for(var r=e.length,n=t.length,a=0,o=Math.min(r,n);a0&&(e=this.toString("hex",0,r).match(/.{2}/g).join(" "),this.length>r&&(e+=" ... ")),""},i.prototype.compare=function(e,t,r,n,a){if(!i.isBuffer(e))throw new TypeError("Argument must be a Buffer");if(void 0===t&&(t=0),void 0===r&&(r=e?e.length:0),void 0===n&&(n=0),void 0===a&&(a=this.length),t<0||r>e.length||n<0||a>this.length)throw new RangeError("out of range index");if(n>=a&&t>=r)return 0;if(n>=a)return-1;if(t>=r)return 1;if(t>>>=0,r>>>=0,n>>>=0,a>>>=0,this===e)return 0;for(var o=a-n,u=r-t,s=Math.min(o,u),c=this.slice(n,a),f=e.slice(t,r),l=0;la)&&(r=a),e.length>0&&(r<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");n||(n="utf8");for(var i=!1;;)switch(n){case"hex":return S(this,e,t,r);case"utf8":case"utf-8":return E(this,e,t,r);case"ascii":return T(this,e,t,r);case"latin1":case"binary":return w(this,e,t,r);case"base64":return I(this,e,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return A(this,e,t,r);default:if(i)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),i=!0}},i.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var Z=4096;i.prototype.slice=function(e,t){var r=this.length;e=~~e,t=void 0===t?r:~~t,e<0?(e+=r)<0&&(e=0):e>r&&(e=r),t<0?(t+=r)<0&&(t=0):t>r&&(t=r),t0&&(a*=256);)n+=this[e+--t]*a;return n},i.prototype.readUInt8=function(e,t){return t||L(e,1,this.length),this[e]},i.prototype.readUInt16LE=function(e,t){return t||L(e,2,this.length),this[e]|this[e+1]<<8},i.prototype.readUInt16BE=function(e,t){return t||L(e,2,this.length),this[e]<<8|this[e+1]},i.prototype.readUInt32LE=function(e,t){return t||L(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},i.prototype.readUInt32BE=function(e,t){return t||L(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},i.prototype.readIntLE=function(e,t,r){e|=0,t|=0,r||L(e,t,this.length);for(var n=this[e],a=1,i=0;++i=a&&(n-=Math.pow(2,8*t)),n},i.prototype.readIntBE=function(e,t,r){e|=0,t|=0,r||L(e,t,this.length);for(var n=t,a=1,i=this[e+--n];n>0&&(a*=256);)i+=this[e+--n]*a;return a*=128,i>=a&&(i-=Math.pow(2,8*t)),i},i.prototype.readInt8=function(e,t){return t||L(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},i.prototype.readInt16LE=function(e,t){t||L(e,2,this.length);var r=this[e]|this[e+1]<<8;return 32768&r?4294901760|r:r},i.prototype.readInt16BE=function(e,t){t||L(e,2,this.length);var r=this[e+1]|this[e]<<8;return 32768&r?4294901760|r:r},i.prototype.readInt32LE=function(e,t){return t||L(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},i.prototype.readInt32BE=function(e,t){return t||L(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},i.prototype.readFloatLE=function(e,t){return t||L(e,4,this.length),Q.read(this,e,!0,23,4)},i.prototype.readFloatBE=function(e,t){return t||L(e,4,this.length),Q.read(this,e,!1,23,4)},i.prototype.readDoubleLE=function(e,t){return t||L(e,8,this.length),Q.read(this,e,!0,52,8)},i.prototype.readDoubleBE=function(e,t){return t||L(e,8,this.length),Q.read(this,e,!1,52,8)},i.prototype.writeUIntLE=function(e,t,r,n){if(e=+e,t|=0,r|=0,!n){P(this,e,t,r,Math.pow(2,8*r)-1,0)}var a=1,i=0;for(this[t]=255&e;++i=0&&(i*=256);)this[t+a]=e/i&255;return t+r},i.prototype.writeUInt8=function(e,t,r){return e=+e,t|=0,r||P(this,e,t,1,255,0),i.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),this[t]=255&e,t+1},i.prototype.writeUInt16LE=function(e,t,r){return e=+e,t|=0,r||P(this,e,t,2,65535,0),i.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):D(this,e,t,!0),t+2},i.prototype.writeUInt16BE=function(e,t,r){return e=+e,t|=0,r||P(this,e,t,2,65535,0),i.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):D(this,e,t,!1),t+2},i.prototype.writeUInt32LE=function(e,t,r){return e=+e,t|=0,r||P(this,e,t,4,4294967295,0),i.TYPED_ARRAY_SUPPORT?(this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e):U(this,e,t,!0),t+4},i.prototype.writeUInt32BE=function(e,t,r){return e=+e,t|=0,r||P(this,e,t,4,4294967295,0),i.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):U(this,e,t,!1),t+4},i.prototype.writeIntLE=function(e,t,r,n){if(e=+e,t|=0,!n){var a=Math.pow(2,8*r-1);P(this,e,t,r,a-1,-a)}var i=0,o=1,u=0;for(this[t]=255&e;++i>0)-u&255;return t+r},i.prototype.writeIntBE=function(e,t,r,n){if(e=+e,t|=0,!n){var a=Math.pow(2,8*r-1);P(this,e,t,r,a-1,-a)}var i=r-1,o=1,u=0;for(this[t+i]=255&e;--i>=0&&(o*=256);)e<0&&0===u&&0!==this[t+i+1]&&(u=1),this[t+i]=(e/o>>0)-u&255;return t+r},i.prototype.writeInt8=function(e,t,r){return e=+e,t|=0,r||P(this,e,t,1,127,-128),i.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),e<0&&(e=255+e+1),this[t]=255&e,t+1},i.prototype.writeInt16LE=function(e,t,r){return e=+e,t|=0,r||P(this,e,t,2,32767,-32768),i.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):D(this,e,t,!0),t+2},i.prototype.writeInt16BE=function(e,t,r){return e=+e,t|=0,r||P(this,e,t,2,32767,-32768),i.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):D(this,e,t,!1),t+2},i.prototype.writeInt32LE=function(e,t,r){return e=+e,t|=0,r||P(this,e,t,4,2147483647,-2147483648),i.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24):U(this,e,t,!0),t+4},i.prototype.writeInt32BE=function(e,t,r){return e=+e,t|=0,r||P(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),i.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):U(this,e,t,!1),t+4},i.prototype.writeFloatLE=function(e,t,r){return M(this,e,t,!0,r)},i.prototype.writeFloatBE=function(e,t,r){return M(this,e,t,!1,r)},i.prototype.writeDoubleLE=function(e,t,r){return F(this,e,t,!0,r)},i.prototype.writeDoubleBE=function(e,t,r){return F(this,e,t,!1,r)},i.prototype.copy=function(e,t,r,n){if(r||(r=0),n||0===n||(n=this.length),t>=e.length&&(t=e.length),t||(t=0),n>0&&n=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),e.length-t=0;--a)e[a+t]=this[a+r];else if(o<1e3||!i.TYPED_ARRAY_SUPPORT)for(a=0;a>>=0,r=void 0===r?this.length:r>>>0,e||(e=0);var o;if("number"==typeof e)for(o=t;o8?3:1,y=[],m=[0,0,1,1,1,1,1,1,0,1,1,1,1,1,1,0],b=0,C=0;C>>4^E),E^=t,S^=t<<4,t=65535&(E>>>-16^S),S^=t,E^=t<<-16,t=858993459&(S>>>2^E),E^=t,S^=t<<2,t=65535&(E>>>-16^S),S^=t,E^=t<<-16,t=1431655765&(S>>>1^E),E^=t,S^=t<<1,t=16711935&(E>>>8^S),S^=t,E^=t<<8,t=1431655765&(S>>>1^E),E^=t,S^=t<<1,t=S<<8|E>>>20&240,S=E<<24|E<<8&16711680|E>>>8&65280|E>>>24&240,E=t;for(var T=0;T>>26,E=E<<2|E>>>26):(S=S<<1|S>>>27,E=E<<1|E>>>27),S&=-15,E&=-15;var w=r[S>>>28]|n[S>>>24&15]|a[S>>>20&15]|i[S>>>16&15]|o[S>>>12&15]|u[S>>>8&15]|s[S>>>4&15],I=c[E>>>28]|f[E>>>24&15]|l[E>>>20&15]|d[E>>>16&15]|h[E>>>12&15]|p[E>>>8&15]|g[E>>>4&15];t=65535&(I>>>16^w),y[b++]=w^t,y[b++]=I^t<<16}}return y}function i(e,t,r,n){var a,i=32===e.length?3:9;a=3===i?n?[30,-2,-2]:[0,32,2]:n?[94,62,-2,32,64,2,30,-2,-2]:[0,32,2,62,30,-2,64,96,2];var o,u=t[0],v=t[1];o=252645135&(u>>>4^v),v^=o,u^=o<<4,o=65535&(u>>>16^v),v^=o,u^=o<<16,o=858993459&(v>>>2^u),u^=o,v^=o<<2,o=16711935&(v>>>8^u),u^=o,v^=o<<8,o=1431655765&(u>>>1^v),v^=o,u^=o<<1,u=u<<1|u>>>31,v=v<<1|v>>>31;for(var y=0;y>>4|v<<28)^e[C+1];o=u,u=v,v=o^(c[S>>>24&63]|l[S>>>16&63]|h[S>>>8&63]|g[63&S]|s[E>>>24&63]|f[E>>>16&63]|d[E>>>8&63]|p[63&E])}o=u,u=v,v=o}u=u>>>1|u<<31,v=v>>>1|v<<31,o=1431655765&(u>>>1^v),v^=o,u^=o<<1,o=16711935&(v>>>8^u),u^=o,v^=o<<8,o=858993459&(v>>>2^u),u^=o,v^=o<<2,o=65535&(u>>>16^v),v^=o,u^=o<<16,o=252645135&(u>>>4^v),v^=o,u^=o<<4,r[0]=u,r[1]=v}function o(e){e=e||{};var t,r=(e.mode||"CBC").toUpperCase(),n="DES-"+r;t=e.decrypt?u.cipher.createDecipher(n,e.key):u.cipher.createCipher(n,e.key);var a=t.start;return t.start=function(e,r){var n=null;r instanceof u.util.ByteBuffer&&(n=r,r={}),r=r||{},r.output=n,r.iv=e,a.call(t,r)},t}var u=r(0);r(15),r(23),r(1),e.exports=u.des=u.des||{},u.des.startEncrypting=function(e,t,r,n){var a=o({key:e,output:r,decrypt:!1,mode:n||(null===t?"ECB":"CBC")});return a.start(t),a},u.des.createEncryptionCipher=function(e,t){return o({key:e,output:null,decrypt:!1,mode:t})},u.des.startDecrypting=function(e,t,r,n){var a=o({key:e,output:r,decrypt:!0,mode:n||(null===t?"ECB":"CBC")});return a.start(t),a},u.des.createDecryptionCipher=function(e,t){return o({key:e,output:null,decrypt:!0,mode:t})},u.des.Algorithm=function(e,t){var r=this;r.name=e,r.mode=new t({blockSize:8,cipher:{encrypt:function(e,t){return i(r._keys,e,t,!1)},decrypt:function(e,t){return i(r._keys,e,t,!0)}}}),r._init=!1},u.des.Algorithm.prototype.initialize=function(e){if(!this._init){var t=u.util.createBuffer(e.key);if(0===this.name.indexOf("3DES")&&24!==t.length())throw new Error("Invalid Triple-DES key size: "+8*t.length());this._keys=a(t),this._init=!0}},n("DES-ECB",u.cipher.modes.ecb),n("DES-CBC",u.cipher.modes.cbc),n("DES-CFB",u.cipher.modes.cfb),n("DES-OFB",u.cipher.modes.ofb),n("DES-CTR",u.cipher.modes.ctr),n("3DES-ECB",u.cipher.modes.ecb),n("3DES-CBC",u.cipher.modes.cbc),n("3DES-CFB",u.cipher.modes.cfb),n("3DES-OFB",u.cipher.modes.ofb),n("3DES-CTR",u.cipher.modes.ctr);var s=[16843776,0,65536,16843780,16842756,66564,4,65536,1024,16843776,16843780,1024,16778244,16842756,16777216,4,1028,16778240,16778240,66560,66560,16842752,16842752,16778244,65540,16777220,16777220,65540,0,1028,66564,16777216,65536,16843780,4,16842752,16843776,16777216,16777216,1024,16842756,65536,66560,16777220,1024,4,16778244,66564,16843780,65540,16842752,16778244,16777220,1028,66564,16843776,1028,16778240,16778240,0,65540,66560,0,16842756],c=[-2146402272,-2147450880,32768,1081376,1048576,32,-2146435040,-2147450848,-2147483616,-2146402272,-2146402304,-2147483648,-2147450880,1048576,32,-2146435040,1081344,1048608,-2147450848,0,-2147483648,32768,1081376,-2146435072,1048608,-2147483616,0,1081344,32800,-2146402304,-2146435072,32800,0,1081376,-2146435040,1048576,-2147450848,-2146435072,-2146402304,32768,-2146435072,-2147450880,32,-2146402272,1081376,32,32768,-2147483648,32800,-2146402304,1048576,-2147483616,1048608,-2147450848,-2147483616,1048608,1081344,0,-2147450880,32800,-2147483648,-2146435040,-2146402272,1081344],f=[520,134349312,0,134348808,134218240,0,131592,134218240,131080,134217736,134217736,131072,134349320,131080,134348800,520,134217728,8,134349312,512,131584,134348800,134348808,131592,134218248,131584,131072,134218248,8,134349320,512,134217728,134349312,134217728,131080,520,131072,134349312,134218240,0,512,131080,134349320,134218240,134217736,512,0,134348808,134218248,131072,134217728,134349320,8,131592,131584,134217736,134348800,134218248,520,134348800,131592,8,134348808,131584],l=[8396801,8321,8321,128,8396928,8388737,8388609,8193,0,8396800,8396800,8396929,129,0,8388736,8388609,1,8192,8388608,8396801,128,8388608,8193,8320,8388737,1,8320,8388736,8192,8396928,8396929,129,8388736,8388609,8396800,8396929,129,0,0,8396800,8320,8388736,8388737,1,8396801,8321,8321,128,8396929,129,1,8192,8388609,8193,8396928,8388737,8193,8320,8388608,8396801,128,8388608,8192,8396928],d=[256,34078976,34078720,1107296512,524288,256,1073741824,34078720,1074266368,524288,33554688,1074266368,1107296512,1107820544,524544,1073741824,33554432,1074266112,1074266112,0,1073742080,1107820800,1107820800,33554688,1107820544,1073742080,0,1107296256,34078976,33554432,1107296256,524544,524288,1107296512,256,33554432,1073741824,34078720,1107296512,1074266368,33554688,1073741824,1107820544,34078976,1074266368,256,33554432,1107820544,1107820800,524544,1107296256,1107820800,34078720,0,1074266112,1107296256,524544,33554688,1073742080,524288,0,1074266112,34078976,1073742080],h=[536870928,541065216,16384,541081616,541065216,16,541081616,4194304,536887296,4210704,4194304,536870928,4194320,536887296,536870912,16400,0,4194320,536887312,16384,4210688,536887312,16,541065232,541065232,0,4210704,541081600,16400,4210688,541081600,536870912,536887296,16,541065232,4210688,541081616,4194304,16400,536870928,4194304,536887296,536870912,16400,536870928,541081616,4210688,541065216,4210704,541081600,0,541065232,16,16384,541065216,4210704,16384,4194320,536887312,0,541081600,536870912,4194320,536887312],p=[2097152,69206018,67110914,0,2048,67110914,2099202,69208064,69208066,2097152,0,67108866,2,67108864,69206018,2050,67110912,2099202,2097154,67110912,67108866,69206016,69208064,2097154,69206016,2048,2050,69208066,2099200,2,67108864,2099200,67108864,2099200,2097152,67110914,67110914,69206018,69206018,2,2097154,67108864,67110912,2097152,69208064,2050,2099202,69208064,2050,67108866,69208066,69206016,2099200,0,2,69208066,0,2099202,69206016,2048,67108866,67110912,2048,2097154],g=[268439616,4096,262144,268701760,268435456,268439616,64,268435456,262208,268697600,268701760,266240,268701696,266304,4096,64,268697600,268435520,268439552,4160,266240,262208,268697664,268701696,4160,0,0,268697664,268435520,268439552,266304,262144,266304,262144,268701696,4096,64,268697664,4096,266304,268439552,64,268435520,268697600,268697664,268435456,262144,268439616,0,268701760,262208,268435520,268697600,268439552,268439616,0,268701760,266240,266240,4160,4160,262208,268435456,268701696]},function(e,t,r){function n(e,t,r){this.data=[],null!=e&&("number"==typeof e?this.fromNumber(e,t,r):null==t&&"string"!=typeof e?this.fromString(e,256):this.fromString(e,t))}function a(){return new n(null)}function i(e,t,r,n,a,i){for(;--i>=0;){var o=t*this.data[e++]+r.data[n]+a;a=Math.floor(o/67108864),r.data[n++]=67108863&o}return a}function o(e,t,r,n,a,i){for(var o=32767&t,u=t>>15;--i>=0;){var s=32767&this.data[e],c=this.data[e++]>>15,f=u*s+c*o;s=o*s+((32767&f)<<15)+r.data[n]+(1073741823&a),a=(s>>>30)+(f>>>15)+u*c+(a>>>30),r.data[n++]=1073741823&s}return a}function u(e,t,r,n,a,i){for(var o=16383&t,u=t>>14;--i>=0;){var s=16383&this.data[e],c=this.data[e++]>>14,f=u*s+c*o;s=o*s+((16383&f)<<14)+r.data[n]+a,a=(s>>28)+(f>>14)+u*c,r.data[n++]=268435455&s}return a}function s(e){return it.charAt(e)}function c(e,t){var r=ot[e.charCodeAt(t)];return null==r?-1:r}function f(e){for(var t=this.t-1;t>=0;--t)e.data[t]=this.data[t];e.t=this.t,e.s=this.s}function l(e){this.t=1,this.s=e<0?-1:0,e>0?this.data[0]=e:e<-1?this.data[0]=e+this.DV:this.t=0}function d(e){var t=a();return t.fromInt(e),t}function h(e,t){var r;if(16==t)r=4;else if(8==t)r=3;else if(256==t)r=8;else if(2==t)r=1;else if(32==t)r=5;else{if(4!=t)return void this.fromRadix(e,t);r=2}this.t=0,this.s=0;for(var a=e.length,i=!1,o=0;--a>=0;){var u=8==r?255&e[a]:c(e,a);u<0?"-"==e.charAt(a)&&(i=!0):(i=!1,0==o?this.data[this.t++]=u:o+r>this.DB?(this.data[this.t-1]|=(u&(1<>this.DB-o):this.data[this.t-1]|=u<=this.DB&&(o-=this.DB))}8==r&&0!=(128&e[0])&&(this.s=-1,o>0&&(this.data[this.t-1]|=(1<0&&this.data[this.t-1]==e;)--this.t}function g(e){if(this.s<0)return"-"+this.negate().toString(e);var t;if(16==e)t=4;else if(8==e)t=3;else if(2==e)t=1;else if(32==e)t=5;else{if(4!=e)return this.toRadix(e);t=2}var r,n=(1<0)for(u>u)>0&&(a=!0,i=s(r));o>=0;)u>(u+=this.DB-t)):(r=this.data[o]>>(u-=t)&n,u<=0&&(u+=this.DB,--o)),r>0&&(a=!0),a&&(i+=s(r));return a?i:"0"}function v(){var e=a();return n.ZERO.subTo(this,e),e}function y(){return this.s<0?this.negate():this}function m(e){var t=this.s-e.s;if(0!=t)return t;var r=this.t;if(0!=(t=r-e.t))return this.s<0?-t:t;for(;--r>=0;)if(0!=(t=this.data[r]-e.data[r]))return t;return 0}function b(e){var t,r=1;return 0!=(t=e>>>16)&&(e=t,r+=16),0!=(t=e>>8)&&(e=t,r+=8),0!=(t=e>>4)&&(e=t,r+=4),0!=(t=e>>2)&&(e=t,r+=2),0!=(t=e>>1)&&(e=t,r+=1),r}function C(){return this.t<=0?0:this.DB*(this.t-1)+b(this.data[this.t-1]^this.s&this.DM)}function S(e,t){var r;for(r=this.t-1;r>=0;--r)t.data[r+e]=this.data[r];for(r=e-1;r>=0;--r)t.data[r]=0;t.t=this.t+e,t.s=this.s}function E(e,t){for(var r=e;r=0;--r)t.data[r+o+1]=this.data[r]>>a|u,u=(this.data[r]&i)<=0;--r)t.data[r]=0;t.data[o]=u,t.t=this.t+o+1,t.s=this.s,t.clamp()}function w(e,t){t.s=this.s;var r=Math.floor(e/this.DB);if(r>=this.t)return void(t.t=0);var n=e%this.DB,a=this.DB-n,i=(1<>n;for(var o=r+1;o>n;n>0&&(t.data[this.t-r-1]|=(this.s&i)<>=this.DB;if(e.t>=this.DB;n+=this.s}else{for(n+=this.s;r>=this.DB;n-=e.s}t.s=n<0?-1:0,n<-1?t.data[r++]=this.DV+n:n>0&&(t.data[r++]=n),t.t=r,t.clamp()}function A(e,t){var r=this.abs(),a=e.abs(),i=r.t;for(t.t=i+a.t;--i>=0;)t.data[i]=0;for(i=0;i=0;)e.data[r]=0;for(r=0;r=t.DV&&(e.data[r+t.t]-=t.DV,e.data[r+t.t+1]=1)}e.t>0&&(e.data[e.t-1]+=t.am(r,t.data[r],e,2*r,0,1)),e.s=0,e.clamp()}function k(e,t,r){var i=e.abs();if(!(i.t<=0)){var o=this.abs();if(o.t0?(i.lShiftTo(f,u),o.lShiftTo(f,r)):(i.copyTo(u),o.copyTo(r));var l=u.t,d=u.data[l-1];if(0!=d){var h=d*(1<1?u.data[l-2]>>this.F2:0),p=this.FV/h,g=(1<=0&&(r.data[r.t++]=1,r.subTo(C,r)),n.ONE.dlShiftTo(l,C),C.subTo(u,u);u.t=0;){var S=r.data[--y]==d?this.DM:Math.floor(r.data[y]*p+(r.data[y-1]+v)*g);if((r.data[y]+=u.am(0,S,r,m,0,l))0&&r.rShiftTo(f,r),s<0&&n.ZERO.subTo(r,r)}}}function N(e){var t=a();return this.abs().divRemTo(e,null,t),this.s<0&&t.compareTo(n.ZERO)>0&&e.subTo(t,t),t}function R(e){this.m=e}function $(e){return e.s<0||e.compareTo(this.m)>=0?e.mod(this.m):e}function x(e){return e}function _(e){e.divRemTo(this.m,null,e)}function L(e,t,r){e.multiplyTo(t,r),this.reduce(r)}function P(e,t){e.squareTo(t),this.reduce(t)}function D(){if(this.t<1)return 0;var e=this.data[0];if(0==(1&e))return 0;var t=3&e;return t=t*(2-(15&e)*t)&15,t=t*(2-(255&e)*t)&255,t=t*(2-((65535&e)*t&65535))&65535,t=t*(2-e*t%this.DV)%this.DV,t>0?this.DV-t:-t}function U(e){this.m=e,this.mp=e.invDigit(),this.mpl=32767&this.mp,this.mph=this.mp>>15,this.um=(1<0&&this.m.subTo(t,t),t}function M(e){var t=a();return e.copyTo(t),this.reduce(t),t}function F(e){for(;e.t<=this.mt2;)e.data[e.t++]=0;for(var t=0;t>15)*this.mpl&this.um)<<15)&e.DM;for(r=t+this.m.t,e.data[r]+=this.m.am(0,n,e,t,0,this.m.t);e.data[r]>=e.DV;)e.data[r]-=e.DV,e.data[++r]++}e.clamp(),e.drShiftTo(this.m.t,e),e.compareTo(this.m)>=0&&e.subTo(this.m,e)}function V(e,t){e.squareTo(t),this.reduce(t)}function K(e,t,r){e.multiplyTo(t,r),this.reduce(r)}function H(){return 0==(this.t>0?1&this.data[0]:this.s)}function j(e,t){if(e>4294967295||e<1)return n.ONE;var r=a(),i=a(),o=t.convert(this),u=b(e)-1;for(o.copyTo(r);--u>=0;)if(t.sqrTo(r,i),(e&1<0)t.mulTo(i,o,r);else{var s=r;r=i,i=s}return t.revert(r)}function q(e,t){var r;return r=e<256||t.isEven()?new R(t):new U(t),this.exp(e,r)}function G(){var e=a();return this.copyTo(e),e}function z(){if(this.s<0){if(1==this.t)return this.data[0]-this.DV;if(0==this.t)return-1}else{if(1==this.t)return this.data[0];if(0==this.t)return 0}return(this.data[1]&(1<<32-this.DB)-1)<>24}function W(){return 0==this.t?this.s:this.data[0]<<16>>16}function J(e){return Math.floor(Math.LN2*this.DB/Math.log(e))}function Q(){return this.s<0?-1:this.t<=0||1==this.t&&this.data[0]<=0?0:1}function X(e){if(null==e&&(e=10),0==this.signum()||e<2||e>36)return"0";var t=this.chunkSize(e),r=Math.pow(e,t),n=d(r),i=a(),o=a(),u="";for(this.divRemTo(n,i,o);i.signum()>0;)u=(r+o.intValue()).toString(e).substr(1)+u,i.divRemTo(n,i,o);return o.intValue().toString(e)+u}function Z(e,t){this.fromInt(0),null==t&&(t=10);for(var r=this.chunkSize(t),a=Math.pow(t,r),i=!1,o=0,u=0,s=0;s=r&&(this.dMultiply(a),this.dAddOffset(u,0),o=0,u=0))}o>0&&(this.dMultiply(Math.pow(t,o)),this.dAddOffset(u,0)),i&&n.ZERO.subTo(this,this)}function ee(e,t,r){if("number"==typeof t)if(e<2)this.fromInt(1);else for(this.fromNumber(e,r),this.testBit(e-1)||this.bitwiseTo(n.ONE.shiftLeft(e-1),se,this),this.isEven()&&this.dAddOffset(1,0);!this.isProbablePrime(t);)this.dAddOffset(2,0),this.bitLength()>e&&this.subTo(n.ONE.shiftLeft(e-1),this);else{var a=new Array,i=7&e;a.length=1+(e>>3),t.nextBytes(a),i>0?a[0]&=(1<0)for(n>n)!=(this.s&this.DM)>>n&&(t[a++]=r|this.s<=0;)n<8?(r=(this.data[e]&(1<>(n+=this.DB-8)):(r=this.data[e]>>(n-=8)&255,n<=0&&(n+=this.DB,--e)),0!=(128&r)&&(r|=-256),0==a&&(128&this.s)!=(128&r)&&++a,(a>0||r!=this.s)&&(t[a++]=r);return t}function re(e){return 0==this.compareTo(e)}function ne(e){return this.compareTo(e)<0?this:e}function ae(e){return this.compareTo(e)>0?this:e}function ie(e,t,r){var n,a,i=Math.min(e.t,this.t);for(n=0;n>=16,t+=16),0==(255&e)&&(e>>=8,t+=8),0==(15&e)&&(e>>=4,t+=4),0==(3&e)&&(e>>=2,t+=2),0==(1&e)&&++t,t}function me(){for(var e=0;e=this.t?0!=this.s:0!=(this.data[t]&1<>=this.DB;if(e.t>=this.DB;n+=this.s}else{for(n+=this.s;r>=this.DB;n+=e.s}t.s=n<0?-1:0,n>0?t.data[r++]=n:n<-1&&(t.data[r++]=this.DV+n),t.t=r,t.clamp()}function Be(e){var t=a();return this.addTo(e,t),t}function ke(e){var t=a();return this.subTo(e,t),t}function Ne(e){var t=a();return this.multiplyTo(e,t),t}function Re(e){var t=a();return this.divRemTo(e,t,null),t}function $e(e){var t=a();return this.divRemTo(e,null,t),t}function xe(e){var t=a(),r=a();return this.divRemTo(e,t,r),new Array(t,r)}function _e(e){this.data[this.t]=this.am(0,e-1,this,0,0,this.t),++this.t,this.clamp()}function Le(e,t){if(0!=e){for(;this.t<=t;)this.data[this.t++]=0;for(this.data[t]+=e;this.data[t]>=this.DV;)this.data[t]-=this.DV,++t>=this.t&&(this.data[this.t++]=0),++this.data[t]}}function Pe(){}function De(e){return e}function Ue(e,t,r){e.multiplyTo(t,r)}function Oe(e,t){e.squareTo(t)}function Me(e){return this.exp(e,new Pe)}function Fe(e,t,r){var n=Math.min(this.t+e.t,t);for(r.s=0,r.t=n;n>0;)r.data[--n]=0;var a;for(a=r.t-this.t;n=0;)r.data[n]=0;for(n=Math.max(t-this.t,0);n2*this.m.t)return e.mod(this.m);if(e.compareTo(this.m)<0)return e;var t=a();return e.copyTo(t),this.reduce(t),t}function je(e){return e}function qe(e){for(e.drShiftTo(this.m.t-1,this.r2),e.t>this.m.t+1&&(e.t=this.m.t+1,e.clamp()),this.mu.multiplyUpperTo(this.r2,this.m.t+1,this.q3),this.m.multiplyLowerTo(this.q3,this.m.t+1,this.r2);e.compareTo(this.r2)<0;)e.dAddOffset(1,this.m.t+1);for(e.subTo(this.r2,e);e.compareTo(this.m)>=0;)e.subTo(this.m,e)}function Ge(e,t){e.squareTo(t),this.reduce(t)}function ze(e,t,r){e.multiplyTo(t,r),this.reduce(r)}function Ye(e,t){var r,n,i=e.bitLength(),o=d(1);if(i<=0)return o;r=i<18?1:i<48?3:i<144?4:i<768?5:6,n=i<8?new R(t):t.isEven()?new Ke(t):new U(t);var u=new Array,s=3,c=r-1,f=(1<1){var l=a();for(n.sqrTo(u[1],l);s<=f;)u[s]=a(),n.mulTo(l,u[s-2],u[s]),s+=2}var h,p,g=e.t-1,v=!0,y=a();for(i=b(e.data[g])-1;g>=0;){for(i>=c?h=e.data[g]>>i-c&f:(h=(e.data[g]&(1<0&&(h|=e.data[g-1]>>this.DB+i-c)),s=r;0==(1&h);)h>>=1,--s;if((i-=s)<0&&(i+=this.DB,--g),v)u[h].copyTo(o),v=!1;else{for(;s>1;)n.sqrTo(o,y),n.sqrTo(y,o),s-=2;s>0?n.sqrTo(o,y):(p=o,o=y,y=p),n.mulTo(y,u[h],o)}for(;g>=0&&0==(e.data[g]&1<0&&(t.rShiftTo(i,t),r.rShiftTo(i,r));t.signum()>0;)(a=t.getLowestSetBit())>0&&t.rShiftTo(a,t),(a=r.getLowestSetBit())>0&&r.rShiftTo(a,r),t.compareTo(r)>=0?(t.subTo(r,t),t.rShiftTo(1,t)):(r.subTo(t,r),r.rShiftTo(1,r));return i>0&&r.lShiftTo(i,r),r}function Je(e){if(e<=0)return 0;var t=this.DV%e,r=this.s<0?e-1:0;if(this.t>0)if(0==t)r=this.data[0]%e;else for(var n=this.t-1;n>=0;--n)r=(t*r+this.data[n])%e;return r}function Qe(e){var t=e.isEven();if(this.isEven()&&t||0==e.signum())return n.ZERO;for(var r=e.clone(),a=this.clone(),i=d(1),o=d(0),u=d(0),s=d(1);0!=r.signum();){for(;r.isEven();)r.rShiftTo(1,r),t?(i.isEven()&&o.isEven()||(i.addTo(this,i),o.subTo(e,o)),i.rShiftTo(1,i)):o.isEven()||o.subTo(e,o),o.rShiftTo(1,o);for(;a.isEven();)a.rShiftTo(1,a),t?(u.isEven()&&s.isEven()||(u.addTo(this,u),s.subTo(e,s)),u.rShiftTo(1,u)):s.isEven()||s.subTo(e,s),s.rShiftTo(1,s);r.compareTo(a)>=0?(r.subTo(a,r),t&&i.subTo(u,i),o.subTo(s,o)):(a.subTo(r,a),t&&u.subTo(i,u),s.subTo(o,s))}return 0!=a.compareTo(n.ONE)?n.ZERO:s.compareTo(e)>=0?s.subtract(e):s.signum()<0?(s.addTo(e,s),s.signum()<0?s.add(e):s):s}function Xe(e){var t,r=this.abs();if(1==r.t&&r.data[0]<=ut[ut.length-1]){for(t=0;t=0);var s=a.modPow(i,this);if(0!=s.compareTo(n.ONE)&&0!=s.compareTo(t)){for(var c=1;c++a-11){var i=new Error("Message is too long for PKCS#1 v1.5 padding.");throw i.length=e.length,i.max=a-11,i}n.putByte(0),n.putByte(r);var o,u=a-3-e.length;if(0===r||1===r){o=0===r?0:255;for(var s=0;s0;){for(var c=0,f=d.random.getBytes(u),s=0;s1;){if(255!==i.getByte()){--i.read;break}++s}else if(2===u)for(s=0;i.length()>1;){if(0===i.getByte()){--i.read;break}++s}if(0!==i.getByte()||s!==a-3-i.length())throw new Error("Encryption block is invalid.");return i.getBytes()}function i(e,t,r){function n(){a(e.pBits,function(t,n){return t?r(t):(e.p=n,null!==e.q?i(t,e.q):void a(e.qBits,i))})}function a(e,t){d.prime.generateProbablePrime(e,o,t)}function i(t,o){if(t)return r(t);if(e.q=o,e.p.compareTo(e.q)<0){var u=e.p;e.p=e.q,e.q=u}if(0!==e.p.subtract(h.ONE).gcd(e.e).compareTo(h.ONE))return e.p=null,void n();if(0!==e.q.subtract(h.ONE).gcd(e.e).compareTo(h.ONE))return e.q=null,void a(e.qBits,i);if(e.p1=e.p.subtract(h.ONE),e.q1=e.q.subtract(h.ONE),e.phi=e.p1.multiply(e.q1),0!==e.phi.gcd(e.e).compareTo(h.ONE))return e.p=e.q=null,void n();if(e.n=e.p.multiply(e.q),e.n.bitLength()!==e.bits)return e.q=null,void a(e.qBits,i);var s=e.e.modInverse(e.phi);e.keys={privateKey:y.rsa.setPrivateKey(e.n,e.e,s,e.p,e.q,s.mod(e.p1),s.mod(e.q1),e.q.modInverse(e.p)),publicKey:y.rsa.setPublicKey(e.n,e.e)},r(null,e.keys)}"function"==typeof t&&(r=t,t={}),t=t||{};var o={algorithm:{name:t.algorithm||"PRIMEINC",options:{workers:t.workers||2,workLoad:t.workLoad||100,workerScript:t.workerScript}}};"prng"in t&&(o.prng=t.prng),n()}function o(e){var t=e.toString(16);t[0]>="8"&&(t="00"+t);var r=d.util.hexToBytes(t);return r.length>1&&(0===r.charCodeAt(0)&&0==(128&r.charCodeAt(1))||255===r.charCodeAt(0)&&128==(128&r.charCodeAt(1)))?r.substr(1):r}function u(e){return e<=100?27:e<=150?18:e<=200?15:e<=250?12:e<=300?9:e<=350?8:e<=400?7:e<=500?6:e<=600?5:e<=800?4:e<=1250?3:2}function s(e){return d.util.isNodejs&&"function"==typeof p[e]}function c(e){return void 0!==v.globalScope&&"object"==typeof v.globalScope.crypto&&"object"==typeof v.globalScope.crypto.subtle&&"function"==typeof v.globalScope.crypto.subtle[e]}function f(e){return void 0!==v.globalScope&&"object"==typeof v.globalScope.msCrypto&&"object"==typeof v.globalScope.msCrypto.subtle&&"function"==typeof v.globalScope.msCrypto.subtle[e]}function l(e){for(var t=d.util.hexToBytes(e.toString(16)),r=new Uint8Array(t.length),n=0;n=0||!n.gcd(t.n).equals(h.ONE));e=e.multiply(n.modPow(t.e,t.n)).mod(t.n);for(var a=e.mod(t.p).modPow(t.dP,t.p),i=e.mod(t.q).modPow(t.dQ,t.q);a.compareTo(i)<0;)a=a.add(t.p);var o=a.subtract(i).multiply(t.qInv).mod(t.p).multiply(t.q).add(i);return o=o.multiply(n.modInverse(t.n)).mod(t.n)};y.rsa.encrypt=function(e,t,r){var a,i=r,o=Math.ceil(t.n.bitLength()/8);!1!==r&&!0!==r?(i=2===r,a=n(e,t,r)):(a=d.util.createBuffer(),a.putBytes(e));for(var u=new h(a.toHex(),16),s=w(u,t,i),c=s.toString(16),f=d.util.createBuffer(),l=o-Math.ceil(c.length/2);l>0;)f.putByte(0),--l;return f.putBytes(d.util.hexToBytes(c)),f.getBytes()},y.rsa.decrypt=function(e,t,r,n){var i=Math.ceil(t.n.bitLength()/8);if(e.length!==i){var o=new Error("Encrypted message length is invalid.");throw o.length=e.length,o.expected=i,o}var u=new h(d.util.createBuffer(e).toHex(),16);if(u.compareTo(t.n)>=0)throw new Error("Encrypted message is invalid.");for(var s=w(u,t,r),c=s.toString(16),f=d.util.createBuffer(),l=i-Math.ceil(c.length/2);l>0;)f.putByte(0),--l;return f.putBytes(d.util.hexToBytes(c)),!1!==n?a(f.getBytes(),t,r):f.getBytes()},y.rsa.createKeyPairGenerationState=function(e,t,r){"string"==typeof e&&(e=parseInt(e,10)),e=e||2048,r=r||{};var n,a=r.prng||d.random,i={nextBytes:function(e){for(var t=a.getBytesSync(e.length),r=0;r>1,pBits:e-(e>>1),pqState:0,num:null,keys:null},n.e.fromInt(n.eInt),n},y.rsa.stepKeyPairGenerationState=function(e,t){"algorithm"in e||(e.algorithm="PRIMEINC");var r=new h(null);r.fromInt(30);for(var n,a=0,i=function(e,t){return e|t},o=+new Date,s=0;null===e.keys&&(t<=0||sc?e.pqState=0:e.num.isProbablePrime(u(e.num.bitLength()))?++e.pqState:e.num.dAddOffset(m[a++%8],0):2===e.pqState?e.pqState=0===e.num.subtract(h.ONE).gcd(e.e).compareTo(h.ONE)?3:0:3===e.pqState&&(e.pqState=0,null===e.p?e.p=e.num:e.q=e.num,null!==e.p&&null!==e.q&&++e.state,e.num=null)}else if(1===e.state)e.p.compareTo(e.q)<0&&(e.num=e.p,e.p=e.q,e.q=e.num),++e.state;else if(2===e.state)e.p1=e.p.subtract(h.ONE),e.q1=e.q.subtract(h.ONE),e.phi=e.p1.multiply(e.q1),++e.state;else if(3===e.state)0===e.phi.gcd(e.e).compareTo(h.ONE)?++e.state:(e.p=null,e.q=null,e.state=0);else if(4===e.state)e.n=e.p.multiply(e.q),e.n.bitLength()===e.bits?++e.state:(e.q=null,e.state=0);else if(5===e.state){var l=e.e.modInverse(e.phi);e.keys={privateKey:y.rsa.setPrivateKey(e.n,e.e,l,e.p,e.q,l.mod(e.p1),l.mod(e.q1),e.q.modInverse(e.p)),publicKey:y.rsa.setPublicKey(e.n,e.e)}}n=+new Date,s+=n-o,o=n}return null!==e.keys},y.rsa.generateKeyPair=function(e,t,r,n){if(1===arguments.length?"object"==typeof e?(r=e,e=void 0):"function"==typeof e&&(n=e,e=void 0):2===arguments.length?"number"==typeof e?"function"==typeof t?(n=t,t=void 0):"number"!=typeof t&&(r=t,t=void 0):(r=e,n=t,e=void 0,t=void 0):3===arguments.length&&("number"==typeof t?"function"==typeof r&&(n=r,r=void 0):(n=r,r=t,t=void 0)),r=r||{},void 0===e&&(e=r.bits||2048),void 0===t&&(t=r.e||65537),!d.options.usePureJavaScript&&!r.prng&&e>=256&&e<=16384&&(65537===t||3===t))if(n){if(s("generateKeyPair"))return p.generateKeyPair("rsa",{modulusLength:e,publicExponent:t,publicKeyEncoding:{type:"spki",format:"pem"},privateKeyEncoding:{type:"pkcs8",format:"pem"}},function(e,t,r){if(e)return n(e);n(null,{privateKey:y.privateKeyFromPem(r),publicKey:y.publicKeyFromPem(t)})});if(c("generateKey")&&c("exportKey"))return v.globalScope.crypto.subtle.generateKey({name:"RSASSA-PKCS1-v1_5",modulusLength:e,publicExponent:l(t),hash:{name:"SHA-256"}},!0,["sign","verify"]).then(function(e){return v.globalScope.crypto.subtle.exportKey("pkcs8",e.privateKey)}).then(void 0,function(e){n(e)}).then(function(e){if(e){var t=y.privateKeyFromAsn1(g.fromDer(d.util.createBuffer(e)));n(null,{privateKey:t,publicKey:y.setRsaPublicKey(t.n,t.e)})}});if(f("generateKey")&&f("exportKey")){var a=v.globalScope.msCrypto.subtle.generateKey({name:"RSASSA-PKCS1-v1_5",modulusLength:e,publicExponent:l(t),hash:{name:"SHA-256"}},!0,["sign","verify"]);return a.oncomplete=function(e){var t=e.target.result,r=v.globalScope.msCrypto.subtle.exportKey("pkcs8",t.privateKey);r.oncomplete=function(e){var t=e.target.result,r=y.privateKeyFromAsn1(g.fromDer(d.util.createBuffer(t)));n(null,{privateKey:r,publicKey:y.setRsaPublicKey(r.n,r.e)})},r.onerror=function(e){n(e)}},void(a.onerror=function(e){n(e)})}}else if(s("generateKeyPairSync")){var o=p.generateKeyPairSync("rsa",{modulusLength:e,publicExponent:t,publicKeyEncoding:{type:"spki",format:"pem"},privateKeyEncoding:{type:"pkcs8",format:"pem"}});return{privateKey:y.privateKeyFromPem(o.privateKey),publicKey:y.publicKeyFromPem(o.publicKey)}}var u=y.rsa.createKeyPairGenerationState(e,t,r);if(!n)return y.rsa.stepKeyPairGenerationState(u,0),u.keys;i(u,r,n)},y.setRsaPublicKey=y.rsa.setPublicKey=function(e,t){var r={n:e,e:t};return r.encrypt=function(e,t,a){if("string"==typeof t?t=t.toUpperCase():void 0===t&&(t="RSAES-PKCS1-V1_5"),"RSAES-PKCS1-V1_5"===t)t={encode:function(e,t,r){return n(e,t,2).getBytes()}};else if("RSA-OAEP"===t||"RSAES-OAEP"===t)t={encode:function(e,t){return d.pkcs1.encode_rsa_oaep(t,e,a)}};else if(-1!==["RAW","NONE","NULL",null].indexOf(t))t={encode:function(e){return e}};else if("string"==typeof t)throw new Error('Unsupported encryption scheme: "'+t+'".');var i=t.encode(e,r,!0);return y.rsa.encrypt(i,r,!0)},r.verify=function(e,t,n){"string"==typeof n?n=n.toUpperCase():void 0===n&&(n="RSASSA-PKCS1-V1_5"),"RSASSA-PKCS1-V1_5"===n?n={verify:function(e,t){return t=a(t,r,!0),e===g.fromDer(t).value[1].value}}:"NONE"!==n&&"NULL"!==n&&null!==n||(n={verify:function(e,t){return t=a(t,r,!0),e===t}});var i=y.rsa.decrypt(t,r,!0,!1);return n.verify(e,i,r.n.bitLength())},r},y.setRsaPrivateKey=y.rsa.setPrivateKey=function(e,t,r,n,i,o,u,s){var c={n:e,e:t,d:r,p:n,q:i,dP:o,dQ:u,qInv:s};return c.decrypt=function(e,t,r){"string"==typeof t?t=t.toUpperCase():void 0===t&&(t="RSAES-PKCS1-V1_5");var n=y.rsa.decrypt(e,c,!1,!1);if("RSAES-PKCS1-V1_5"===t)t={decode:a};else if("RSA-OAEP"===t||"RSAES-OAEP"===t)t={decode:function(e,t){return d.pkcs1.decode_rsa_oaep(t,e,r)}};else{if(-1===["RAW","NONE","NULL",null].indexOf(t))throw new Error('Unsupported encryption scheme: "'+t+'".');t={decode:function(e){return e}}}return t.decode(n,c,!1)},c.sign=function(e,t){var r=!1;"string"==typeof t&&(t=t.toUpperCase()),void 0===t||"RSASSA-PKCS1-V1_5"===t?(t={encode:T},r=1):"NONE"!==t&&"NULL"!==t&&null!==t||(t={encode:function(){return e}},r=1);var n=t.encode(e,c.n.bitLength());return y.rsa.encrypt(n,c,r)},c},y.wrapRsaPrivateKey=function(e){return g.create(g.Class.UNIVERSAL,g.Type.SEQUENCE,!0,[g.create(g.Class.UNIVERSAL,g.Type.INTEGER,!1,g.integerToDer(0).getBytes()),g.create(g.Class.UNIVERSAL,g.Type.SEQUENCE,!0,[g.create(g.Class.UNIVERSAL,g.Type.OID,!1,g.oidToDer(y.oids.rsaEncryption).getBytes()),g.create(g.Class.UNIVERSAL,g.Type.NULL,!1,"")]),g.create(g.Class.UNIVERSAL,g.Type.OCTETSTRING,!1,g.toDer(e).getBytes())])},y.privateKeyFromAsn1=function(e){var t={},r=[];if(g.validate(e,b,t,r)&&(e=g.fromDer(d.util.createBuffer(t.privateKey))),t={},r=[],!g.validate(e,C,t,r)){var n=new Error("Cannot read private key. ASN.1 object does not contain an RSAPrivateKey.");throw n.errors=r,n}var a,i,o,u,s,c,f,l;return a=d.util.createBuffer(t.privateKeyModulus).toHex(),i=d.util.createBuffer(t.privateKeyPublicExponent).toHex(),o=d.util.createBuffer(t.privateKeyPrivateExponent).toHex(),u=d.util.createBuffer(t.privateKeyPrime1).toHex(),s=d.util.createBuffer(t.privateKeyPrime2).toHex(),c=d.util.createBuffer(t.privateKeyExponent1).toHex(),f=d.util.createBuffer(t.privateKeyExponent2).toHex(),l=d.util.createBuffer(t.privateKeyCoefficient).toHex(),y.setRsaPrivateKey(new h(a,16),new h(i,16),new h(o,16),new h(u,16),new h(s,16),new h(c,16),new h(f,16),new h(l,16))},y.privateKeyToAsn1=y.privateKeyToRSAPrivateKey=function(e){return g.create(g.Class.UNIVERSAL,g.Type.SEQUENCE,!0,[g.create(g.Class.UNIVERSAL,g.Type.INTEGER,!1,g.integerToDer(0).getBytes()),g.create(g.Class.UNIVERSAL,g.Type.INTEGER,!1,o(e.n)),g.create(g.Class.UNIVERSAL,g.Type.INTEGER,!1,o(e.e)),g.create(g.Class.UNIVERSAL,g.Type.INTEGER,!1,o(e.d)),g.create(g.Class.UNIVERSAL,g.Type.INTEGER,!1,o(e.p)),g.create(g.Class.UNIVERSAL,g.Type.INTEGER,!1,o(e.q)),g.create(g.Class.UNIVERSAL,g.Type.INTEGER,!1,o(e.dP)),g.create(g.Class.UNIVERSAL,g.Type.INTEGER,!1,o(e.dQ)),g.create(g.Class.UNIVERSAL,g.Type.INTEGER,!1,o(e.qInv))])},y.publicKeyFromAsn1=function(e){var t={},r=[];if(g.validate(e,E,t,r)){var n=g.derToOid(t.publicKeyOid);if(n!==y.oids.rsaEncryption){var a=new Error("Cannot read public key. Unknown OID.");throw a.oid=n,a}e=t.rsaPublicKey}if(r=[],!g.validate(e,S,t,r)){var a=new Error("Cannot read public key. ASN.1 object does not contain an RSAPublicKey.");throw a.errors=r,a}var i=d.util.createBuffer(t.publicKeyModulus).toHex(),o=d.util.createBuffer(t.publicKeyExponent).toHex();return y.setRsaPublicKey(new h(i,16),new h(o,16))},y.publicKeyToAsn1=y.publicKeyToSubjectPublicKeyInfo=function(e){return g.create(g.Class.UNIVERSAL,g.Type.SEQUENCE,!0,[g.create(g.Class.UNIVERSAL,g.Type.SEQUENCE,!0,[g.create(g.Class.UNIVERSAL,g.Type.OID,!1,g.oidToDer(y.oids.rsaEncryption).getBytes()),g.create(g.Class.UNIVERSAL,g.Type.NULL,!1,"")]),g.create(g.Class.UNIVERSAL,g.Type.BITSTRING,!1,[y.publicKeyToRSAPublicKey(e)])])},y.publicKeyToRSAPublicKey=function(e){return g.create(g.Class.UNIVERSAL,g.Type.SEQUENCE,!0,[g.create(g.Class.UNIVERSAL,g.Type.INTEGER,!1,o(e.n)),g.create(g.Class.UNIVERSAL,g.Type.INTEGER,!1,o(e.e))])}},function(e,t){var r;r=function(){return this}();try{r=r||Function("return this")()||(0,eval)("this")}catch(e){"object"==typeof window&&(r=window)}e.exports=r},function(e,t,r){var n=r(0);r(1),e.exports=n.cipher=n.cipher||{},n.cipher.algorithms=n.cipher.algorithms||{},n.cipher.createCipher=function(e,t){var r=e;if("string"==typeof r&&(r=n.cipher.getAlgorithm(r))&&(r=r()),!r)throw new Error("Unsupported algorithm: "+e);return new n.cipher.BlockCipher({algorithm:r,key:t,decrypt:!1})},n.cipher.createDecipher=function(e,t){var r=e;if("string"==typeof r&&(r=n.cipher.getAlgorithm(r))&&(r=r()),!r)throw new Error("Unsupported algorithm: "+e);return new n.cipher.BlockCipher({algorithm:r,key:t,decrypt:!0})},n.cipher.registerAlgorithm=function(e,t){e=e.toUpperCase(),n.cipher.algorithms[e]=t},n.cipher.getAlgorithm=function(e){return e=e.toUpperCase(),e in n.cipher.algorithms?n.cipher.algorithms[e]:null};var a=n.cipher.BlockCipher=function(e){this.algorithm=e.algorithm,this.mode=this.algorithm.mode,this.blockSize=this.mode.blockSize,this._finish=!1,this._input=null,this.output=null,this._op=e.decrypt?this.mode.decrypt:this.mode.encrypt,this._decrypt=e.decrypt,this.algorithm.initialize(e)};a.prototype.start=function(e){e=e||{};var t={};for(var r in e)t[r]=e[r];t.decrypt=this._decrypt,this._finish=!1,this._input=n.util.createBuffer(),this.output=e.output||n.util.createBuffer(),this.mode.start(t)},a.prototype.update=function(e){for(e&&this._input.putBuffer(e);!this._op.call(this.mode,this._input,this.output,this._finish)&&!this._finish;);this._input.compact()},a.prototype.finish=function(e){!e||"ECB"!==this.mode.name&&"CBC"!==this.mode.name||(this.mode.pad=function(t){return e(this.blockSize,t,!1)},this.mode.unpad=function(t){return e(this.blockSize,t,!0)});var t={};return t.decrypt=this._decrypt,t.overflow=this._input.length()%this.blockSize,!(!this._decrypt&&this.mode.pad&&!this.mode.pad(this._input,t))&&(this._finish=!0,this.update(),!(this._decrypt&&this.mode.unpad&&!this.mode.unpad(this.output,t))&&!(this.mode.afterFinish&&!this.mode.afterFinish(this.output,t)))}},function(e,t,r){function n(){u=String.fromCharCode(128),u+=i.util.fillString(String.fromCharCode(0),64),s=[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,1,6,11,0,5,10,15,4,9,14,3,8,13,2,7,12,5,8,11,14,1,4,7,10,13,0,3,6,9,12,15,2,0,7,14,5,12,3,10,1,8,15,6,13,4,11,2,9],c=[7,12,17,22,7,12,17,22,7,12,17,22,7,12,17,22,5,9,14,20,5,9,14,20,5,9,14,20,5,9,14,20,4,11,16,23,4,11,16,23,4,11,16,23,4,11,16,23,6,10,15,21,6,10,15,21,6,10,15,21,6,10,15,21],f=new Array(64);for(var e=0;e<64;++e)f[e]=Math.floor(4294967296*Math.abs(Math.sin(e+1)));l=!0}function a(e,t,r){for(var n,a,i,o,u,l,d,h,p=r.length();p>=64;){for(a=e.h0,i=e.h1,o=e.h2,u=e.h3,h=0;h<16;++h)t[h]=r.getInt32Le(),l=u^i&(o^u),n=a+l+f[h]+t[h],d=c[h],a=u,u=o,o=i,i+=n<>>32-d;for(;h<32;++h)l=o^u&(i^o),n=a+l+f[h]+t[s[h]],d=c[h],a=u,u=o,o=i,i+=n<>>32-d;for(;h<48;++h)l=i^o^u,n=a+l+f[h]+t[s[h]],d=c[h],a=u,u=o,o=i,i+=n<>>32-d;for(;h<64;++h)l=o^(i|~u),n=a+l+f[h]+t[s[h]],d=c[h],a=u,u=o,o=i,i+=n<>>32-d;e.h0=e.h0+a|0,e.h1=e.h1+i|0,e.h2=e.h2+o|0,e.h3=e.h3+u|0,p-=64}}var i=r(0);r(4),r(1);var o=e.exports=i.md5=i.md5||{};i.md.md5=i.md.algorithms.md5=o,o.create=function(){l||n();var e=null,t=i.util.createBuffer(),r=new Array(16),o={algorithm:"md5",blockLength:64,digestLength:16,messageLength:0,fullMessageLength:null,messageLengthSize:8};return o.start=function(){o.messageLength=0,o.fullMessageLength=o.messageLength64=[];for(var r=o.messageLengthSize/4,n=0;n>>0,s>>>0];for(var c=o.fullMessageLength.length-1;c>=0;--c)o.fullMessageLength[c]+=s[1],s[1]=s[0]+(o.fullMessageLength[c]/4294967296>>>0),o.fullMessageLength[c]=o.fullMessageLength[c]>>>0,s[0]=s[1]/4294967296>>>0;return t.putBytes(n),a(e,r,t),(t.read>2048||0===t.length())&&t.compact(),o},o.digest=function(){var n=i.util.createBuffer();n.putBytes(t.bytes());var s=o.fullMessageLength[o.fullMessageLength.length-1]+o.messageLengthSize,c=s&o.blockLength-1;n.putBytes(u.substr(0,o.blockLength-c));for(var f,l=0,d=o.fullMessageLength.length-1;d>=0;--d)f=8*o.fullMessageLength[d]+l,l=f/4294967296>>>0,n.putInt32Le(f>>>0);var h={h0:e.h0,h1:e.h1,h2:e.h2,h3:e.h3};a(h,r,n);var p=i.util.createBuffer();return p.putInt32Le(h.h0),p.putInt32Le(h.h1),p.putInt32Le(h.h2),p.putInt32Le(h.h3),p},o};var u=null,s=null,c=null,f=null,l=!1},function(e,t,r){(function(t){var n=r(0);r(8),r(4),r(1);var a,i=n.pkcs5=n.pkcs5||{};n.util.isNodejs&&!n.options.usePureJavaScript&&(a=r(21)),e.exports=n.pbkdf2=i.pbkdf2=function(e,r,i,o,u,s){function c(){if(C>h)return s(null,b);g.start(null,null),g.update(r),g.update(n.util.int32ToBytes(C)),v=m=g.digest().getBytes(),S=2,f()}function f(){if(S<=i)return g.start(null,null),g.update(m),y=g.digest().getBytes(),v=n.util.xorBytes(v,y,l),m=y,++S,n.util.setImmediate(f);b+=C4||!u||"sha1"===u))return"string"!=typeof u&&(u="sha1"),e=new t(e,"binary"),r=new t(r,"binary"),s?4===a.pbkdf2Sync.length?a.pbkdf2(e,r,i,o,function(e,t){if(e)return s(e);s(null,t.toString("binary"))}):a.pbkdf2(e,r,i,o,u,function(e,t){if(e)return s(e);s(null,t.toString("binary"))}):4===a.pbkdf2Sync.length?a.pbkdf2Sync(e,r,i,o).toString("binary"):a.pbkdf2Sync(e,r,i,o,u).toString("binary");if(void 0!==u&&null!==u||(u="sha1"),"string"==typeof u){if(!(u in n.md.algorithms))throw new Error("Unknown hash algorithm: "+u);u=n.md[u].create()}var l=u.digestLength;if(o>4294967295*l){var d=new Error("Derived key is too long.");if(s)return s(d);throw d}var h=Math.ceil(o/l),p=o-(h-1)*l,g=n.hmac.create();g.start(u,e);var v,y,m,b="";if(!s){for(var C=1;C<=h;++C){g.start(null,null),g.update(r),g.update(n.util.int32ToBytes(C)),v=m=g.digest().getBytes();for(var S=2;S<=i;++S)g.start(null,null),g.update(m),y=g.digest().getBytes(),v=n.util.xorBytes(v,y,l),m=y;b+=C>8*l-f&255;return(C=String.fromCharCode(C.charCodeAt(0)&~S)+C.substr(1))+g+String.fromCharCode(188)},s.verify=function(e,i,u){var s,c=u-1,f=Math.ceil(c/8);if(i=i.substr(-f),f>8*f-c&255;if(0!=(d.charCodeAt(0)&p))throw new Error("Bits beyond keysize not zero as expected.");var g=r.generate(h,l),v="";for(s=0;s128)throw new Error('Invalid "nsComment" content.');e.value=l.create(l.Class.UNIVERSAL,l.Type.IA5STRING,!1,e.comment)}else if("subjectKeyIdentifier"===e.name&&t.cert){var v=t.cert.generateSubjectKeyIdentifier();e.subjectKeyIdentifier=v.toHex(),e.value=l.create(l.Class.UNIVERSAL,l.Type.OCTETSTRING,!1,v.getBytes())}else if("authorityKeyIdentifier"===e.name&&t.cert){e.value=l.create(l.Class.UNIVERSAL,l.Type.SEQUENCE,!0,[]);var s=e.value.value;if(e.keyIdentifier){var y=!0===e.keyIdentifier?t.cert.generateSubjectKeyIdentifier().getBytes():e.keyIdentifier;s.push(l.create(l.Class.CONTEXT_SPECIFIC,0,!1,y))}if(e.authorityCertIssuer){var m=[l.create(l.Class.CONTEXT_SPECIFIC,4,!0,[a(!0===e.authorityCertIssuer?t.cert.issuer:e.authorityCertIssuer)])];s.push(l.create(l.Class.CONTEXT_SPECIFIC,1,!0,m))}if(e.serialNumber){var b=f.util.hexToBytes(!0===e.serialNumber?t.cert.serialNumber:e.serialNumber);s.push(l.create(l.Class.CONTEXT_SPECIFIC,2,!1,b))}}else if("cRLDistributionPoints"===e.name){e.value=l.create(l.Class.UNIVERSAL,l.Type.SEQUENCE,!0,[]);for(var p,s=e.value.value,C=l.create(l.Class.UNIVERSAL,l.Type.SEQUENCE,!0,[]),S=l.create(l.Class.CONTEXT_SPECIFIC,0,!0,[]),g=0;g=S&&e2)throw new Error("Cannot read notBefore/notAfter validity times; more than two times were provided in the certificate.");if(p.length<2)throw new Error("Cannot read notBefore/notAfter validity times; they were not provided as either UTCTime or GeneralizedTime.");if(s.validity.notBefore=p[0],s.validity.notAfter=p[1],s.tbsCertificate=r.tbsCertificate,t){if(s.md=null,s.signatureOid in h){var u=h[s.signatureOid];switch(u){case"sha1WithRSAEncryption":s.md=f.md.sha1.create();break;case"md5WithRSAEncryption":s.md=f.md.md5.create();break;case"sha256WithRSAEncryption":s.md=f.md.sha256.create();break;case"sha384WithRSAEncryption":s.md=f.md.sha384.create();break;case"sha512WithRSAEncryption":s.md=f.md.sha512.create();break;case"RSASSA-PSS":s.md=f.md.sha256.create()}}if(null===s.md){var o=new Error("Could not compute certificate digest. Unknown signature OID.");throw o.signatureOid=s.signatureOid,o}var g=l.toDer(s.tbsCertificate);s.md.update(g.getBytes())}var y=f.md.sha1.create();s.issuer.getField=function(e){return n(s.issuer,e)},s.issuer.addField=function(e){i([e]),s.issuer.attributes.push(e)},s.issuer.attributes=d.RDNAttributesAsArray(r.certIssuer,y),r.certIssuerUniqueId&&(s.issuer.uniqueId=r.certIssuerUniqueId),s.issuer.hash=y.digest().toHex();var m=f.md.sha1.create();return s.subject.getField=function(e){return n(s.subject,e)},s.subject.addField=function(e){i([e]),s.subject.attributes.push(e)},s.subject.attributes=d.RDNAttributesAsArray(r.certSubject,m),r.certSubjectUniqueId&&(s.subject.uniqueId=r.certSubjectUniqueId),s.subject.hash=m.digest().toHex(),r.certExtensions?s.extensions=d.certificateExtensionsFromAsn1(r.certExtensions):s.extensions=[],s.publicKey=d.publicKeyFromAsn1(r.subjectPublicKeyInfo),s},d.certificateExtensionsFromAsn1=function(e){for(var t=[],r=0;r1&&(n=r.value.charCodeAt(1),a=r.value.length>2?r.value.charCodeAt(2):0),t.digitalSignature=128==(128&n),t.nonRepudiation=64==(64&n),t.keyEncipherment=32==(32&n),t.dataEncipherment=16==(16&n),t.keyAgreement=8==(8&n),t.keyCertSign=4==(4&n),t.cRLSign=2==(2&n),t.encipherOnly=1==(1&n),t.decipherOnly=128==(128&a)}else if("basicConstraints"===t.name){var r=l.fromDer(t.value);r.value.length>0&&r.value[0].type===l.Type.BOOLEAN?t.cA=0!==r.value[0].value.charCodeAt(0):t.cA=!1;var i=null;r.value.length>0&&r.value[0].type===l.Type.INTEGER?i=r.value[0].value:r.value.length>1&&(i=r.value[1].value),null!==i&&(t.pathLenConstraint=l.derToInteger(i))}else if("extKeyUsage"===t.name)for(var r=l.fromDer(t.value),o=0;o1&&(n=r.value.charCodeAt(1)),t.client=128==(128&n),t.server=64==(64&n),t.email=32==(32&n),t.objsign=16==(16&n),t.reserved=8==(8&n),t.sslCA=4==(4&n),t.emailCA=2==(2&n),t.objCA=1==(1&n)}else if("subjectAltName"===t.name||"issuerAltName"===t.name){t.altNames=[];for(var s,r=l.fromDer(t.value),c=0;c0&&n.value.push(d.certificateExtensionsToAsn1(e.extensions)),n},d.getCertificationRequestInfo=function(e){return l.create(l.Class.UNIVERSAL,l.Type.SEQUENCE,!0,[l.create(l.Class.UNIVERSAL,l.Type.INTEGER,!1,l.integerToDer(e.version).getBytes()),a(e.subject),d.publicKeyToAsn1(e.publicKey),s(e)])},d.distinguishedNameToAsn1=function(e){return a(e)},d.certificateToAsn1=function(e){var t=e.tbsCertificate||d.getTBSCertificate(e);return l.create(l.Class.UNIVERSAL,l.Type.SEQUENCE,!0,[t,l.create(l.Class.UNIVERSAL,l.Type.SEQUENCE,!0,[l.create(l.Class.UNIVERSAL,l.Type.OID,!1,l.oidToDer(e.signatureOid).getBytes()),u(e.signatureOid,e.signatureParameters)]),l.create(l.Class.UNIVERSAL,l.Type.BITSTRING,!1,String.fromCharCode(0)+e.signature)])},d.certificateExtensionsToAsn1=function(e){var t=l.create(l.Class.CONTEXT_SPECIFIC,3,!0,[]),r=l.create(l.Class.UNIVERSAL,l.Type.SEQUENCE,!0,[]);t.value.push(r);for(var n=0;ns.validity.notAfter)&&(o={message:"Certificate is not valid yet or has expired.",error:d.certificateError.certificate_expired,notBefore:s.validity.notBefore,notAfter:s.validity.notAfter,now:a}),null===o){if(c=t[0]||e.getIssuer(s),null===c&&s.isIssuer(s)&&(l=!0,c=s),c){var h=c;f.util.isArray(h)||(h=[h]);for(var p=!1;!p&&h.length>0;){c=h.shift();try{p=c.verify(s)}catch(e){}}p||(o={message:"Certificate signature is invalid.",error:d.certificateError.bad_certificate})}null!==o||c&&!l||e.hasCertificate(s)||(o={message:"Certificate is not trusted.",error:d.certificateError.unknown_ca})}if(null===o&&c&&!s.isIssuer(c)&&(o={message:"Certificate issuer is invalid.",error:d.certificateError.bad_certificate}),null===o)for(var g={keyUsage:!0,basicConstraints:!0},v=0;null===o&&vm.pathLenConstraint&&(o={message:"Certificate basicConstraints pathLenConstraint violated.",error:d.certificateError.bad_certificate})}}var C=null===o||o.error,S=r.verify?r.verify(C,u,n):C;if(!0!==S)throw!0===C&&(o={message:"The application rejected the certificate.",error:d.certificateError.bad_certificate}),(S||0===S)&&("object"!=typeof S||f.util.isArray(S)?"string"==typeof S&&(o.error=S):(S.message&&(o.message=S.message),S.error&&(o.error=S.error))),o;o=null,i=!1,++u}while(t.length>0);return!0}},function(e,t){function r(){throw new Error("setTimeout has not been defined")}function n(){throw new Error("clearTimeout has not been defined")}function a(e){if(f===setTimeout)return setTimeout(e,0);if((f===r||!f)&&setTimeout)return f=setTimeout,setTimeout(e,0);try{return f(e,0)}catch(t){try{return f.call(null,e,0)}catch(t){return f.call(this,e,0)}}}function i(e){if(l===clearTimeout)return clearTimeout(e);if((l===n||!l)&&clearTimeout)return l=clearTimeout,clearTimeout(e);try{return l(e)}catch(t){try{return l.call(null,e)}catch(t){return l.call(this,e)}}}function o(){g&&h&&(g=!1,h.length?p=h.concat(p):v=-1,p.length&&u())}function u(){if(!g){var e=a(o);g=!0;for(var t=p.length;t;){for(h=p,p=[];++v1)for(var r=1;r4){var t=e;e=o.util.createBuffer();for(var r=0;r0))return!0;for(var n=0;n0))return!0;for(var n=0;n0)return!1;var r=e.length(),n=e.at(r-1);return!(n>this.blockSize<<2)&&(e.truncate(n),!0)},u.cbc=function(e){e=e||{},this.name="CBC",this.cipher=e.cipher,this.blockSize=e.blockSize||16,this._ints=this.blockSize/4,this._inBlock=new Array(this._ints),this._outBlock=new Array(this._ints)},u.cbc.prototype.start=function(e){if(null===e.iv){if(!this._prev)throw new Error("Invalid IV parameter.");this._iv=this._prev.slice(0)}else{if(!("iv"in e))throw new Error("Invalid IV parameter.");this._iv=n(e.iv),this._prev=this._iv.slice(0)}},u.cbc.prototype.encrypt=function(e,t,r){if(e.length()0))return!0;for(var n=0;n0))return!0;for(var n=0;n0)return!1;var r=e.length(),n=e.at(r-1);return!(n>this.blockSize<<2)&&(e.truncate(n),!0)},u.cfb=function(e){e=e||{},this.name="CFB",this.cipher=e.cipher,this.blockSize=e.blockSize||16,this._ints=this.blockSize/4,this._inBlock=null,this._outBlock=new Array(this._ints),this._partialBlock=new Array(this._ints),this._partialOutput=o.util.createBuffer(),this._partialBytes=0},u.cfb.prototype.start=function(e){if(!("iv"in e))throw new Error("Invalid IV parameter.");this._iv=n(e.iv),this._inBlock=this._iv.slice(0),this._partialBytes=0},u.cfb.prototype.encrypt=function(e,t,r){var n=e.length();if(0===n)return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),0===this._partialBytes&&n>=this.blockSize)for(var a=0;a0&&(i=this.blockSize-i),this._partialOutput.clear();for(var a=0;a0)e.read-=this.blockSize;else for(var a=0;a0&&this._partialOutput.getBytes(this._partialBytes),i>0&&!r)return t.putBytes(this._partialOutput.getBytes(i-this._partialBytes)),this._partialBytes=i,!0;t.putBytes(this._partialOutput.getBytes(n-this._partialBytes)),this._partialBytes=0}},u.cfb.prototype.decrypt=function(e,t,r){var n=e.length();if(0===n)return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),0===this._partialBytes&&n>=this.blockSize)for(var a=0;a0&&(i=this.blockSize-i),this._partialOutput.clear();for(var a=0;a0)e.read-=this.blockSize;else for(var a=0;a0&&this._partialOutput.getBytes(this._partialBytes),i>0&&!r)return t.putBytes(this._partialOutput.getBytes(i-this._partialBytes)),this._partialBytes=i,!0;t.putBytes(this._partialOutput.getBytes(n-this._partialBytes)),this._partialBytes=0}},u.ofb=function(e){e=e||{},this.name="OFB",this.cipher=e.cipher,this.blockSize=e.blockSize||16,this._ints=this.blockSize/4,this._inBlock=null,this._outBlock=new Array(this._ints),this._partialOutput=o.util.createBuffer(),this._partialBytes=0},u.ofb.prototype.start=function(e){if(!("iv"in e))throw new Error("Invalid IV parameter.");this._iv=n(e.iv),this._inBlock=this._iv.slice(0),this._partialBytes=0},u.ofb.prototype.encrypt=function(e,t,r){var n=e.length();if(0===e.length())return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),0===this._partialBytes&&n>=this.blockSize)for(var a=0;a0&&(i=this.blockSize-i),this._partialOutput.clear();for(var a=0;a0)e.read-=this.blockSize;else for(var a=0;a0&&this._partialOutput.getBytes(this._partialBytes),i>0&&!r)return t.putBytes(this._partialOutput.getBytes(i-this._partialBytes)),this._partialBytes=i,!0;t.putBytes(this._partialOutput.getBytes(n-this._partialBytes)),this._partialBytes=0}},u.ofb.prototype.decrypt=u.ofb.prototype.encrypt,u.ctr=function(e){e=e||{},this.name="CTR",this.cipher=e.cipher,this.blockSize=e.blockSize||16,this._ints=this.blockSize/4,this._inBlock=null,this._outBlock=new Array(this._ints),this._partialOutput=o.util.createBuffer(),this._partialBytes=0},u.ctr.prototype.start=function(e){if(!("iv"in e))throw new Error("Invalid IV parameter.");this._iv=n(e.iv),this._inBlock=this._iv.slice(0),this._partialBytes=0},u.ctr.prototype.encrypt=function(e,t,r){var n=e.length();if(0===n)return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),0===this._partialBytes&&n>=this.blockSize)for(var i=0;i0&&(o=this.blockSize-o),this._partialOutput.clear();for(var i=0;i0&&(e.read-=this.blockSize),this._partialBytes>0&&this._partialOutput.getBytes(this._partialBytes),o>0&&!r)return t.putBytes(this._partialOutput.getBytes(o-this._partialBytes)),this._partialBytes=o,!0;t.putBytes(this._partialOutput.getBytes(n-this._partialBytes)),this._partialBytes=0}a(this._inBlock)},u.ctr.prototype.decrypt=u.ctr.prototype.encrypt,u.gcm=function(e){e=e||{},this.name="GCM",this.cipher=e.cipher,this.blockSize=e.blockSize||16,this._ints=this.blockSize/4,this._inBlock=new Array(this._ints),this._outBlock=new Array(this._ints),this._partialOutput=o.util.createBuffer(),this._partialBytes=0,this._R=3774873600},u.gcm.prototype.start=function(e){if(!("iv"in e))throw new Error("Invalid IV parameter.");var t=o.util.createBuffer(e.iv);this._cipherLength=0;var r;if(r="additionalData"in e?o.util.createBuffer(e.additionalData):o.util.createBuffer(),this._tagLength="tagLength"in e?e.tagLength:128,this._tag=null,e.decrypt&&(this._tag=o.util.createBuffer(e.tag).getBytes(),this._tag.length!==this._tagLength/8))throw new Error("Authentication tag does not match tag length.");this._hashBlock=new Array(this._ints),this.tag=null,this._hashSubkey=new Array(this._ints),this.cipher.encrypt([0,0,0,0],this._hashSubkey),this.componentBits=4,this._m=this.generateHashTable(this._hashSubkey,this.componentBits);var n=t.length();if(12===n)this._j0=[t.getInt32(),t.getInt32(),t.getInt32(),1];else{for(this._j0=[0,0,0,0];t.length()>0;)this._j0=this.ghash(this._hashSubkey,this._j0,[t.getInt32(),t.getInt32(),t.getInt32(),t.getInt32()]);this._j0=this.ghash(this._hashSubkey,this._j0,[0,0].concat(i(8*n)))}this._inBlock=this._j0.slice(0),a(this._inBlock),this._partialBytes=0,r=o.util.createBuffer(r),this._aDataLength=i(8*r.length());var u=r.length()%this.blockSize;for(u&&r.fillWithByte(0,this.blockSize-u),this._s=[0,0,0,0];r.length()>0;)this._s=this.ghash(this._hashSubkey,this._s,[r.getInt32(),r.getInt32(),r.getInt32(),r.getInt32()])},u.gcm.prototype.encrypt=function(e,t,r){var n=e.length();if(0===n)return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),0===this._partialBytes&&n>=this.blockSize){for(var i=0;i0&&(o=this.blockSize-o),this._partialOutput.clear();for(var i=0;i0&&this._partialOutput.getBytes(this._partialBytes),o>0&&!r)return e.read-=this.blockSize,t.putBytes(this._partialOutput.getBytes(o-this._partialBytes)),this._partialBytes=o,!0;t.putBytes(this._partialOutput.getBytes(n-this._partialBytes)),this._partialBytes=0}this._s=this.ghash(this._hashSubkey,this._s,this._outBlock),a(this._inBlock)},u.gcm.prototype.decrypt=function(e,t,r){var n=e.length();if(n0))return!0;this.cipher.encrypt(this._inBlock,this._outBlock),a(this._inBlock),this._hashBlock[0]=e.getInt32(),this._hashBlock[1]=e.getInt32(),this._hashBlock[2]=e.getInt32(),this._hashBlock[3]=e.getInt32(),this._s=this.ghash(this._hashSubkey,this._s,this._hashBlock);for(var i=0;i0;--n)t[n]=e[n]>>>1|(1&e[n-1])<<31;t[0]=e[0]>>>1,r&&(t[0]^=this._R)},u.gcm.prototype.tableMultiply=function(e){for(var t=[0,0,0,0],r=0;r<32;++r){var n=r/8|0,a=e[n]>>>4*(7-r%8)&15,i=this._m[r][a];t[0]^=i[0],t[1]^=i[1],t[2]^=i[2],t[3]^=i[3]}return t},u.gcm.prototype.ghash=function(e,t,r){return t[0]^=r[0],t[1]^=r[1],t[2]^=r[2],t[3]^=r[3],this.tableMultiply(t)},u.gcm.prototype.generateHashTable=function(e,t){for(var r=8/t,n=4*r,a=16*r,i=new Array(a),o=0;o>>1,a=new Array(r);a[n]=e.slice(0);for(var i=n>>>1;i>0;)this.pow(a[2*i],a[i]=[]),i>>=1;for(i=2;i=0;s--)N>>=8,N+=I.at(s)+k.at(s),k.setAt(s,255&N);B.putBuffer(k)}C=B,l.putBuffer(T)}return l.truncate(l.length()-a),l},f.pbe.getCipher=function(e,t,r){switch(e){case f.oids.pkcs5PBES2:return f.pbe.getCipherForPBES2(e,t,r);case f.oids["pbeWithSHAAnd3-KeyTripleDES-CBC"]:case f.oids["pbewithSHAAnd40BitRC2-CBC"]:return f.pbe.getCipherForPKCS12PBE(e,t,r);default:var n=new Error("Cannot read encrypted PBE data block. Unsupported OID.");throw n.oid=e,n.supportedOids=["pkcs5PBES2","pbeWithSHAAnd3-KeyTripleDES-CBC","pbewithSHAAnd40BitRC2-CBC"],n}},f.pbe.getCipherForPBES2=function(e,t,r){var n={},i=[];if(!c.validate(t,h,n,i)){var o=new Error("Cannot read password-based-encryption algorithm parameters. ASN.1 object is not a supported EncryptedPrivateKeyInfo.");throw o.errors=i,o}if((e=c.derToOid(n.kdfOid))!==f.oids.pkcs5PBKDF2){var o=new Error("Cannot read encrypted private key. Unsupported key derivation function OID.");throw o.oid=e,o.supportedOids=["pkcs5PBKDF2"],o}if((e=c.derToOid(n.encOid))!==f.oids["aes128-CBC"]&&e!==f.oids["aes192-CBC"]&&e!==f.oids["aes256-CBC"]&&e!==f.oids["des-EDE3-CBC"]&&e!==f.oids.desCBC){var o=new Error("Cannot read encrypted private key. Unsupported encryption scheme OID.");throw o.oid=e,o.supportedOids=["aes128-CBC","aes192-CBC","aes256-CBC","des-EDE3-CBC","desCBC"],o}var s=n.kdfSalt,l=u.util.createBuffer(n.kdfIterationCount);l=l.getInt(l.length()<<3);var d,p;switch(f.oids[e]){case"aes128-CBC":d=16,p=u.aes.createDecryptionCipher;break;case"aes192-CBC":d=24,p=u.aes.createDecryptionCipher;break;case"aes256-CBC":d=32,p=u.aes.createDecryptionCipher;break;case"des-EDE3-CBC":d=24,p=u.des.createDecryptionCipher;break;case"desCBC":d=8,p=u.des.createDecryptionCipher}var g=a(n.prfOid),v=u.pkcs5.pbkdf2(r,s,l,d,g),y=n.encIv,m=p(v);return m.start(y),m},f.pbe.getCipherForPKCS12PBE=function(e,t,r){var n={},i=[];if(!c.validate(t,p,n,i)){var o=new Error("Cannot read password-based-encryption algorithm parameters. ASN.1 object is not a supported EncryptedPrivateKeyInfo.");throw o.errors=i,o}var s=u.util.createBuffer(n.salt),l=u.util.createBuffer(n.iterations);l=l.getInt(l.length()<<3);var d,h,g;switch(e){case f.oids["pbeWithSHAAnd3-KeyTripleDES-CBC"]:d=24,h=8,g=u.des.startDecrypting;break;case f.oids["pbewithSHAAnd40BitRC2-CBC"]:d=5,h=8,g=function(e,t){var r=u.rc2.createDecryptionCipher(e,40);return r.start(t,null),r};break;default:var o=new Error("Cannot read PKCS #12 PBE data block. Unsupported OID.");throw o.oid=e,o}var v=a(n.prfOid),y=f.pbe.generatePkcs12Key(r,s,1,l,d,v);return v.start(),g(y,f.pbe.generatePkcs12Key(r,s,2,l,h,v))},f.pbe.opensslDeriveBytes=function(e,t,r,a){if(void 0===a||null===a){if(!("md5"in u.md))throw new Error('"md5" hash algorithm unavailable.');a=u.md.md5.create()}null===t&&(t="");for(var i=[n(a,e+t)],o=16,s=1;o>24&255,o>>16&255,o>>8&255,255&o);r.start(),r.update(e+u),n+=r.digest().getBytes()}return n.substring(0,t)}var a=r(0);r(1),r(2),r(9);var i=e.exports=a.pkcs1=a.pkcs1||{};i.encode_rsa_oaep=function(e,t,r){var i,o,u,s;"string"==typeof r?(i=r,o=arguments[3]||void 0,u=arguments[4]||void 0):r&&(i=r.label||void 0,o=r.seed||void 0,u=r.md||void 0,r.mgf1&&r.mgf1.md&&(s=r.mgf1.md)),u?u.start():u=a.md.sha1.create(),s||(s=u);var c=Math.ceil(e.n.bitLength()/8),f=c-2*u.digestLength-2;if(t.length>f){var l=new Error("RSAES-OAEP input message length is too long.");throw l.length=t.length,l.maxLength=f,l}i||(i=""),u.update(i,"raw");for(var d=u.digest(),h="",p=f-t.length,g=0;g=0&&a.push(u):a.push(u))}return a}function a(e){if(e.composed||e.constructed){for(var t=c.util.createBuffer(),r=0;r0&&(a=f.create(f.Class.UNIVERSAL,f.Type.SET,!0,s));var h=[],p=[];null!==t&&(p=c.util.isArray(t)?t:[t]);for(var g=[],v=0;v0){var C=f.create(f.Class.UNIVERSAL,f.Type.SEQUENCE,!0,g),S=f.create(f.Class.UNIVERSAL,f.Type.SEQUENCE,!0,[f.create(f.Class.UNIVERSAL,f.Type.OID,!1,f.oidToDer(l.oids.data).getBytes()),f.create(f.Class.CONTEXT_SPECIFIC,0,!0,[f.create(f.Class.UNIVERSAL,f.Type.OCTETSTRING,!1,f.toDer(C).getBytes())])]);h.push(S)}var E=null;if(null!==e){var T=l.wrapRsaPrivateKey(l.privateKeyToAsn1(e));E=null===r?f.create(f.Class.UNIVERSAL,f.Type.SEQUENCE,!0,[f.create(f.Class.UNIVERSAL,f.Type.OID,!1,f.oidToDer(l.oids.keyBag).getBytes()),f.create(f.Class.CONTEXT_SPECIFIC,0,!0,[T]),a]):f.create(f.Class.UNIVERSAL,f.Type.SEQUENCE,!0,[f.create(f.Class.UNIVERSAL,f.Type.OID,!1,f.oidToDer(l.oids.pkcs8ShroudedKeyBag).getBytes()),f.create(f.Class.CONTEXT_SPECIFIC,0,!0,[l.encryptPrivateKeyInfo(T,r,n)]),a]);var w=f.create(f.Class.UNIVERSAL,f.Type.SEQUENCE,!0,[E]),I=f.create(f.Class.UNIVERSAL,f.Type.SEQUENCE,!0,[f.create(f.Class.UNIVERSAL,f.Type.OID,!1,f.oidToDer(l.oids.data).getBytes()),f.create(f.Class.CONTEXT_SPECIFIC,0,!0,[f.create(f.Class.UNIVERSAL,f.Type.OCTETSTRING,!1,f.toDer(w).getBytes())])]);h.push(I)}var A,B=f.create(f.Class.UNIVERSAL,f.Type.SEQUENCE,!0,h);if(n.useMac){var u=c.md.sha1.create(),k=new c.util.ByteBuffer(c.random.getBytes(n.saltSize)),N=n.count,e=d.generateKey(r,k,3,N,20),R=c.hmac.create();R.start(u,e),R.update(f.toDer(B).getBytes());var $=R.getMac();A=f.create(f.Class.UNIVERSAL,f.Type.SEQUENCE,!0,[f.create(f.Class.UNIVERSAL,f.Type.SEQUENCE,!0,[f.create(f.Class.UNIVERSAL,f.Type.SEQUENCE,!0,[f.create(f.Class.UNIVERSAL,f.Type.OID,!1,f.oidToDer(l.oids.sha1).getBytes()),f.create(f.Class.UNIVERSAL,f.Type.NULL,!1,"")]),f.create(f.Class.UNIVERSAL,f.Type.OCTETSTRING,!1,$.getBytes())]),f.create(f.Class.UNIVERSAL,f.Type.OCTETSTRING,!1,k.getBytes()),f.create(f.Class.UNIVERSAL,f.Type.INTEGER,!1,f.integerToDer(N).getBytes())])}return f.create(f.Class.UNIVERSAL,f.Type.SEQUENCE,!0,[f.create(f.Class.UNIVERSAL,f.Type.INTEGER,!1,f.integerToDer(3).getBytes()),f.create(f.Class.UNIVERSAL,f.Type.SEQUENCE,!0,[f.create(f.Class.UNIVERSAL,f.Type.OID,!1,f.oidToDer(l.oids.data).getBytes()),f.create(f.Class.CONTEXT_SPECIFIC,0,!0,[f.create(f.Class.UNIVERSAL,f.Type.OCTETSTRING,!1,f.toDer(B).getBytes())])]),A])},d.generateKey=c.pbe.generatePkcs12Key},function(e,t,r){var n=r(0);r(3),r(1);var a=n.asn1,i=e.exports=n.pkcs7asn1=n.pkcs7asn1||{};n.pkcs7=n.pkcs7||{},n.pkcs7.asn1=i;var o={name:"ContentInfo",tagClass:a.Class.UNIVERSAL,type:a.Type.SEQUENCE,constructed:!0,value:[{name:"ContentInfo.ContentType",tagClass:a.Class.UNIVERSAL,type:a.Type.OID,constructed:!1,capture:"contentType"},{name:"ContentInfo.content",tagClass:a.Class.CONTEXT_SPECIFIC,type:0,constructed:!0,optional:!0,captureAsn1:"content"}]};i.contentInfoValidator=o;var u={name:"EncryptedContentInfo",tagClass:a.Class.UNIVERSAL,type:a.Type.SEQUENCE,constructed:!0,value:[{name:"EncryptedContentInfo.contentType",tagClass:a.Class.UNIVERSAL,type:a.Type.OID,constructed:!1,capture:"contentType"},{name:"EncryptedContentInfo.contentEncryptionAlgorithm",tagClass:a.Class.UNIVERSAL,type:a.Type.SEQUENCE,constructed:!0,value:[{name:"EncryptedContentInfo.contentEncryptionAlgorithm.algorithm",tagClass:a.Class.UNIVERSAL,type:a.Type.OID,constructed:!1,capture:"encAlgorithm"},{name:"EncryptedContentInfo.contentEncryptionAlgorithm.parameter",tagClass:a.Class.UNIVERSAL,captureAsn1:"encParameter"}]},{name:"EncryptedContentInfo.encryptedContent",tagClass:a.Class.CONTEXT_SPECIFIC,type:0,capture:"encryptedContent",captureAsn1:"encryptedContentAsn1"}]};i.envelopedDataValidator={name:"EnvelopedData",tagClass:a.Class.UNIVERSAL,type:a.Type.SEQUENCE,constructed:!0,value:[{name:"EnvelopedData.Version",tagClass:a.Class.UNIVERSAL,type:a.Type.INTEGER,constructed:!1,capture:"version"},{name:"EnvelopedData.RecipientInfos",tagClass:a.Class.UNIVERSAL,type:a.Type.SET,constructed:!0,captureAsn1:"recipientInfos"}].concat(u)},i.encryptedDataValidator={name:"EncryptedData",tagClass:a.Class.UNIVERSAL,type:a.Type.SEQUENCE,constructed:!0,value:[{name:"EncryptedData.Version",tagClass:a.Class.UNIVERSAL,type:a.Type.INTEGER,constructed:!1,capture:"version"}].concat(u)};var s={name:"SignerInfo",tagClass:a.Class.UNIVERSAL,type:a.Type.SEQUENCE,constructed:!0,value:[{name:"SignerInfo.version",tagClass:a.Class.UNIVERSAL,type:a.Type.INTEGER,constructed:!1},{name:"SignerInfo.issuerAndSerialNumber",tagClass:a.Class.UNIVERSAL,type:a.Type.SEQUENCE,constructed:!0,value:[{name:"SignerInfo.issuerAndSerialNumber.issuer",tagClass:a.Class.UNIVERSAL,type:a.Type.SEQUENCE,constructed:!0,captureAsn1:"issuer"},{name:"SignerInfo.issuerAndSerialNumber.serialNumber",tagClass:a.Class.UNIVERSAL,type:a.Type.INTEGER,constructed:!1,capture:"serial"}]},{name:"SignerInfo.digestAlgorithm",tagClass:a.Class.UNIVERSAL,type:a.Type.SEQUENCE,constructed:!0,value:[{name:"SignerInfo.digestAlgorithm.algorithm",tagClass:a.Class.UNIVERSAL,type:a.Type.OID,constructed:!1,capture:"digestAlgorithm"},{name:"SignerInfo.digestAlgorithm.parameter",tagClass:a.Class.UNIVERSAL,constructed:!1,captureAsn1:"digestParameter",optional:!0}]},{name:"SignerInfo.authenticatedAttributes",tagClass:a.Class.CONTEXT_SPECIFIC,type:0,constructed:!0,optional:!0,capture:"authenticatedAttributes"},{name:"SignerInfo.digestEncryptionAlgorithm",tagClass:a.Class.UNIVERSAL,type:a.Type.SEQUENCE,constructed:!0,capture:"signatureAlgorithm"},{name:"SignerInfo.encryptedDigest",tagClass:a.Class.UNIVERSAL,type:a.Type.OCTETSTRING,constructed:!1,capture:"signature"},{name:"SignerInfo.unauthenticatedAttributes",tagClass:a.Class.CONTEXT_SPECIFIC,type:1,constructed:!0,optional:!0,capture:"unauthenticatedAttributes"}]};i.signedDataValidator={name:"SignedData",tagClass:a.Class.UNIVERSAL,type:a.Type.SEQUENCE,constructed:!0,value:[{name:"SignedData.Version",tagClass:a.Class.UNIVERSAL,type:a.Type.INTEGER,constructed:!1,capture:"version"},{name:"SignedData.DigestAlgorithms",tagClass:a.Class.UNIVERSAL,type:a.Type.SET,constructed:!0,captureAsn1:"digestAlgorithms"},o,{name:"SignedData.Certificates",tagClass:a.Class.CONTEXT_SPECIFIC,type:0,optional:!0,captureAsn1:"certificates"},{name:"SignedData.CertificateRevocationLists",tagClass:a.Class.CONTEXT_SPECIFIC,type:1,optional:!0,captureAsn1:"crls"},{name:"SignedData.SignerInfos",tagClass:a.Class.UNIVERSAL,type:a.Type.SET,capture:"signerInfos",optional:!0,value:[s]}]},i.recipientInfoValidator={name:"RecipientInfo",tagClass:a.Class.UNIVERSAL,type:a.Type.SEQUENCE,constructed:!0,value:[{name:"RecipientInfo.version",tagClass:a.Class.UNIVERSAL,type:a.Type.INTEGER,constructed:!1,capture:"version"},{name:"RecipientInfo.issuerAndSerial",tagClass:a.Class.UNIVERSAL,type:a.Type.SEQUENCE,constructed:!0,value:[{name:"RecipientInfo.issuerAndSerial.issuer",tagClass:a.Class.UNIVERSAL,type:a.Type.SEQUENCE,constructed:!0,captureAsn1:"issuer"},{name:"RecipientInfo.issuerAndSerial.serialNumber",tagClass:a.Class.UNIVERSAL,type:a.Type.INTEGER,constructed:!1,capture:"serial"}]},{name:"RecipientInfo.keyEncryptionAlgorithm",tagClass:a.Class.UNIVERSAL,type:a.Type.SEQUENCE,constructed:!0,value:[{name:"RecipientInfo.keyEncryptionAlgorithm.algorithm",tagClass:a.Class.UNIVERSAL,type:a.Type.OID,constructed:!1,capture:"encAlgorithm"},{name:"RecipientInfo.keyEncryptionAlgorithm.parameter",tagClass:a.Class.UNIVERSAL,constructed:!1,captureAsn1:"encParameter"}]},{name:"RecipientInfo.encryptedKey",tagClass:a.Class.UNIVERSAL,type:a.Type.OCTETSTRING,constructed:!1,capture:"encKey"}]}},function(e,t,r){var n=r(0);r(3),r(6),r(27),r(7),r(17),r(29),r(18),r(13),r(1),r(19);var a=n.asn1,i=e.exports=n.pki=n.pki||{};i.pemToDer=function(e){var t=n.pem.decode(e)[0];if(t.procType&&"ENCRYPTED"===t.procType.type)throw new Error("Could not convert PEM to DER; PEM is encrypted.");return n.util.createBuffer(t.body)},i.privateKeyFromPem=function(e){var t=n.pem.decode(e)[0];if("PRIVATE KEY"!==t.type&&"RSA PRIVATE KEY"!==t.type){var r=new Error('Could not convert private key from PEM; PEM header type is not "PRIVATE KEY" or "RSA PRIVATE KEY".');throw r.headerType=t.type,r}if(t.procType&&"ENCRYPTED"===t.procType.type)throw new Error("Could not convert private key from PEM; PEM is encrypted.");var o=a.fromDer(t.body);return i.privateKeyFromAsn1(o)},i.privateKeyToPem=function(e,t){var r={type:"RSA PRIVATE KEY",body:a.toDer(i.privateKeyToAsn1(e)).getBytes()};return n.pem.encode(r,{maxline:t})},i.privateKeyInfoToPem=function(e,t){var r={type:"PRIVATE KEY",body:a.toDer(e).getBytes()};return n.pem.encode(r,{maxline:t})}},function(e,t,r){var n=r(0);r(1),r(12),r(2),function(){function t(e,t,n,a){return"workers"in n?i(e,t,n,a):r(e,t,n,a)}function r(e,t,r,n){var i=o(e,t),s=u(i.bitLength());"millerRabinTests"in r&&(s=r.millerRabinTests);var c=10;"maxBlockTime"in r&&(c=r.maxBlockTime),a(i,e,t,0,s,c,n)}function a(e,t,r,i,u,s,c){var l=+new Date;do{if(e.bitLength()>t&&(e=o(t,r)),e.isProbablePrime(u))return c(null,e);e.dAddOffset(f[i++%8],0)}while(s<0||+new Date-le&&(s=o(e,t));var h=s.toString(16);r.target.postMessage({hex:h,workLoad:l}),s.dAddOffset(d,0)}}f=Math.max(1,f);for(var n=[],a=0;a=32)return i(),e();var t=32-u.pools[0].messageLength<<5;u.seedFile(t,function(t,r){if(t)return e(t);u.collect(r),i(),e()})}function r(){if(u.pools[0].messageLength>=32)return i();var e=32-u.pools[0].messageLength<<5;u.collect(u.seedFileSync(e)),i()}function i(){u.reseeds=4294967295===u.reseeds?0:u.reseeds+1;var e=u.plugin.md.create();e.update(u.keyBytes);for(var t=1,r=0;r<32;++r)u.reseeds%t==0&&(e.update(u.pools[r].digest().getBytes()),u.pools[r].start()),t<<=1;u.keyBytes=e.digest().getBytes(),e.start(),e.update(u.keyBytes);var n=e.digest().getBytes();u.key=u.plugin.formatKey(u.keyBytes),u.seed=u.plugin.formatSeed(n),u.generated=0}function o(e){var t=null,r=n.util.globalScope,a=r.crypto||r.msCrypto;a&&a.getRandomValues&&(t=function(e){return a.getRandomValues(e)});var i=n.util.createBuffer();if(t)for(;i.length()>16),f+=(32767&c)<<16,f+=c>>15,f=(2147483647&f)+(f>>31),d=4294967295&f;for(var s=0;s<3;++s)l=d>>>(s<<3),l^=Math.floor(256*Math.random()),i.putByte(String.fromCharCode(255&l))}return i.getBytes(e)}for(var u={plugin:e,key:null,seed:null,time:null,reseeds:0,generated:0,keyBytes:""},s=e.md,c=new Array(32),f=0;f<32;++f)c[f]=s.create();return u.pools=c,u.pool=0,u.generate=function(e,r){function a(l){if(l)return r(l);if(f.length()>=e)return r(null,f.getBytes(e));if(u.generated>1048575&&(u.key=null),null===u.key)return n.util.nextTick(function(){t(a)});var d=i(u.key,u.seed);u.generated+=d.length,f.putBytes(d),u.key=s(i(u.key,o(u.seed))),u.seed=c(i(u.key,u.seed)),n.util.setImmediate(a)}if(!r)return u.generateSync(e);var i=u.plugin.cipher,o=u.plugin.increment,s=u.plugin.formatKey,c=u.plugin.formatSeed,f=n.util.createBuffer();u.key=null,a()},u.generateSync=function(e){var t=u.plugin.cipher,a=u.plugin.increment,i=u.plugin.formatKey,o=u.plugin.formatSeed;u.key=null;for(var s=n.util.createBuffer();s.length()1048575&&(u.key=null),null===u.key&&r();var c=t(u.key,u.seed);u.generated+=c.length,s.putBytes(c),u.key=i(t(u.key,a(u.seed))),u.seed=o(t(u.key,u.seed))}return s.getBytes(e)},a?(u.seedFile=function(e,t){a.randomBytes(e,function(e,r){if(e)return t(e);t(null,r.toString())})},u.seedFileSync=function(e){return a.randomBytes(e).toString()}):(u.seedFile=function(e,t){try{t(null,o(e))}catch(e){t(e)}},u.seedFileSync=o),u.collect=function(e){for(var t=e.length,r=0;r>n&255);u.collect(r)},u.registerWorker=function(e){if(e===self)u.seedFile=function(e,t){function r(e){var n=e.data;n.forge&&n.forge.prng&&(self.removeEventListener("message",r),t(n.forge.prng.err,n.forge.prng.bytes))}self.addEventListener("message",r),self.postMessage({forge:{prng:{needed:e}}})};else{var t=function(t){var r=t.data;r.forge&&r.forge.prng&&u.seedFile(r.forge.prng.needed,function(t,r){e.postMessage({forge:{prng:{err:t,bytes:r}}})})};e.addEventListener("message",t)}},u}}).call(t,r(20))},function(e,t,r){var n=r(0);r(1);var a=[217,120,249,196,25,221,181,237,40,233,253,121,74,160,216,157,198,126,55,131,43,118,83,142,98,76,100,136,68,139,251,162,23,154,89,245,135,179,79,19,97,69,109,141,9,129,125,50,189,143,64,235,134,183,123,11,240,149,33,34,92,107,78,130,84,214,101,147,206,96,178,28,115,86,192,20,167,140,241,220,18,117,202,31,59,190,228,209,66,61,212,48,163,60,182,38,111,191,14,218,70,105,7,87,39,242,29,155,188,148,67,3,248,17,199,246,144,239,62,231,6,195,213,47,200,102,30,215,8,232,234,222,128,82,238,247,132,170,114,172,53,77,106,42,150,26,210,113,90,21,73,116,75,159,208,94,4,24,164,236,194,224,65,110,15,81,203,204,36,145,175,80,161,244,112,57,153,124,58,133,35,184,180,122,252,2,54,91,37,85,151,49,45,93,250,152,227,138,146,174,5,223,41,16,103,108,186,201,211,0,230,207,225,158,168,44,99,22,1,63,88,226,137,169,13,56,52,27,171,51,255,176,187,72,12,95,185,177,205,46,197,243,219,71,229,165,156,119,10,166,32,104,254,127,193,173],i=[1,2,3,5],o=function(e,t){return e<>16-t},u=function(e,t){return(65535&e)>>t|e<<16-t&65535};e.exports=n.rc2=n.rc2||{},n.rc2.expandKey=function(e,t){"string"==typeof e&&(e=n.util.createBuffer(e)),t=t||128;var r,i=e,o=e.length(),u=t,s=Math.ceil(u/8),c=255>>(7&u);for(r=o;r<128;r++)i.putByte(a[i.at(r-1)+i.at(r-o)&255]);for(i.setAt(128-s,a[i.at(128-s)&c]),r=127-s;r>=0;r--)i.setAt(r,a[i.at(r+1)^i.at(r+s)]);return i};var s=function(e,t,r){var a,s,c,f,l=!1,d=null,h=null,p=null,g=[];for(e=n.rc2.expandKey(e,t),c=0;c<64;c++)g.push(e.getInt16Le());r?(a=function(e){for(c=0;c<4;c++)e[c]+=g[f]+(e[(c+3)%4]&e[(c+2)%4])+(~e[(c+3)%4]&e[(c+1)%4]),e[c]=o(e[c],i[c]),f++},s=function(e){for(c=0;c<4;c++)e[c]+=g[63&e[(c+3)%4]]}):(a=function(e){for(c=3;c>=0;c--)e[c]=u(e[c],i[c]),e[c]-=g[f]+(e[(c+3)%4]&e[(c+2)%4])+(~e[(c+3)%4]&e[(c+1)%4]),f--},s=function(e){for(c=3;c>=0;c--)e[c]-=g[63&e[(c+3)%4]]});var v=function(e){var t=[];for(c=0;c<4;c++){var n=d.getInt16Le();null!==p&&(r?n^=p.getInt16Le():p.putInt16Le(n)),t.push(65535&n)}f=r?0:63;for(var a=0;a=8;)v([[5,a],[1,s],[6,a],[1,s],[5,a]])},finish:function(e){var t=!0;if(r)if(e)t=e(8,d,!r);else{var n=8===d.length()?8:8-d.length();d.fillWithByte(n,n)}if(t&&(l=!0,y.update()),!r&&(t=0===d.length()))if(e)t=e(8,h,!r);else{var a=h.length(),i=h.at(a-1);i>a?t=!1:h.truncate(i)}return t}}};n.rc2.startEncrypting=function(e,t,r){var a=n.rc2.createEncryptionCipher(e,128);return a.start(t,r),a},n.rc2.createEncryptionCipher=function(e,t){return s(e,t,!0)},n.rc2.startDecrypting=function(e,t,r){var a=n.rc2.createDecryptionCipher(e,128);return a.start(t,r),a},n.rc2.createDecryptionCipher=function(e,t){return s(e,t,!1)}},function(e,t,r){function n(){u=String.fromCharCode(128),u+=i.util.fillString(String.fromCharCode(0),64),c=[1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298],s=!0}function a(e,t,r){for(var n,a,i,o,u,s,f,l,d,h,p,g,v,y,m,b=r.length();b>=64;){for(f=0;f<16;++f)t[f]=r.getInt32();for(;f<64;++f)n=t[f-2],n=(n>>>17|n<<15)^(n>>>19|n<<13)^n>>>10,a=t[f-15],a=(a>>>7|a<<25)^(a>>>18|a<<14)^a>>>3,t[f]=n+t[f-7]+a+t[f-16]|0;for(l=e.h0,d=e.h1,h=e.h2,p=e.h3,g=e.h4,v=e.h5,y=e.h6,m=e.h7,f=0;f<64;++f)o=(g>>>6|g<<26)^(g>>>11|g<<21)^(g>>>25|g<<7),u=y^g&(v^y),i=(l>>>2|l<<30)^(l>>>13|l<<19)^(l>>>22|l<<10),s=l&d|h&(l^d),n=m+o+u+c[f]+t[f],a=i+s,m=y,y=v,v=g,g=p+n>>>0,p=h,h=d,d=l,l=n+a>>>0;e.h0=e.h0+l|0,e.h1=e.h1+d|0,e.h2=e.h2+h|0,e.h3=e.h3+p|0,e.h4=e.h4+g|0,e.h5=e.h5+v|0,e.h6=e.h6+y|0,e.h7=e.h7+m|0,b-=64}}var i=r(0);r(4),r(1);var o=e.exports=i.sha256=i.sha256||{};i.md.sha256=i.md.algorithms.sha256=o,o.create=function(){s||n();var e=null,t=i.util.createBuffer(),r=new Array(64),o={algorithm:"sha256",blockLength:64,digestLength:32,messageLength:0,fullMessageLength:null,messageLengthSize:8};return o.start=function(){o.messageLength=0,o.fullMessageLength=o.messageLength64=[];for(var r=o.messageLengthSize/4,n=0;n>>0,s>>>0];for(var c=o.fullMessageLength.length-1;c>=0;--c)o.fullMessageLength[c]+=s[1],s[1]=s[0]+(o.fullMessageLength[c]/4294967296>>>0),o.fullMessageLength[c]=o.fullMessageLength[c]>>>0,s[0]=s[1]/4294967296>>>0;return t.putBytes(n),a(e,r,t),(t.read>2048||0===t.length())&&t.compact(),o},o.digest=function(){var n=i.util.createBuffer();n.putBytes(t.bytes());var s=o.fullMessageLength[o.fullMessageLength.length-1]+o.messageLengthSize,c=s&o.blockLength-1;n.putBytes(u.substr(0,o.blockLength-c));for(var f,l,d=8*o.fullMessageLength[0],h=0;h>>0,d+=l,n.putInt32(d>>>0),d=f>>>0;n.putInt32(d);var p={h0:e.h0,h1:e.h1,h2:e.h2,h3:e.h3,h4:e.h4,h5:e.h5,h6:e.h6,h7:e.h7};a(p,r,n);var g=i.util.createBuffer();return g.putInt32(p.h0),g.putInt32(p.h1),g.putInt32(p.h2),g.putInt32(p.h3),g.putInt32(p.h4),g.putInt32(p.h5),g.putInt32(p.h6),g.putInt32(p.h7),g},o};var u=null,s=!1,c=null},function(e,t,r){function n(){s=String.fromCharCode(128),s+=i.util.fillString(String.fromCharCode(0),128),f=[[1116352408,3609767458],[1899447441,602891725],[3049323471,3964484399],[3921009573,2173295548],[961987163,4081628472],[1508970993,3053834265],[2453635748,2937671579],[2870763221,3664609560],[3624381080,2734883394],[310598401,1164996542],[607225278,1323610764],[1426881987,3590304994],[1925078388,4068182383],[2162078206,991336113],[2614888103,633803317],[3248222580,3479774868],[3835390401,2666613458],[4022224774,944711139],[264347078,2341262773],[604807628,2007800933],[770255983,1495990901],[1249150122,1856431235],[1555081692,3175218132],[1996064986,2198950837],[2554220882,3999719339],[2821834349,766784016],[2952996808,2566594879],[3210313671,3203337956],[3336571891,1034457026],[3584528711,2466948901],[113926993,3758326383],[338241895,168717936],[666307205,1188179964],[773529912,1546045734],[1294757372,1522805485],[1396182291,2643833823],[1695183700,2343527390],[1986661051,1014477480],[2177026350,1206759142],[2456956037,344077627],[2730485921,1290863460],[2820302411,3158454273],[3259730800,3505952657],[3345764771,106217008],[3516065817,3606008344],[3600352804,1432725776],[4094571909,1467031594],[275423344,851169720],[430227734,3100823752],[506948616,1363258195],[659060556,3750685593],[883997877,3785050280],[958139571,3318307427],[1322822218,3812723403],[1537002063,2003034995],[1747873779,3602036899],[1955562222,1575990012],[2024104815,1125592928],[2227730452,2716904306],[2361852424,442776044],[2428436474,593698344],[2756734187,3733110249],[3204031479,2999351573],[3329325298,3815920427],[3391569614,3928383900],[3515267271,566280711],[3940187606,3454069534],[4118630271,4000239992],[116418474,1914138554],[174292421,2731055270],[289380356,3203993006],[460393269,320620315],[685471733,587496836],[852142971,1086792851],[1017036298,365543100],[1126000580,2618297676],[1288033470,3409855158],[1501505948,4234509866],[1607167915,987167468],[1816402316,1246189591]],l={},l["SHA-512"]=[[1779033703,4089235720],[3144134277,2227873595],[1013904242,4271175723],[2773480762,1595750129],[1359893119,2917565137],[2600822924,725511199],[528734635,4215389547],[1541459225,327033209]],l["SHA-384"]=[[3418070365,3238371032],[1654270250,914150663],[2438529370,812702999],[355462360,4144912697],[1731405415,4290775857],[2394180231,1750603025],[3675008525,1694076839],[1203062813,3204075428]],l["SHA-512/256"]=[[573645204,4230739756],[2673172387,3360449730],[596883563,1867755857],[2520282905,1497426621],[2519219938,2827943907],[3193839141,1401305490],[721525244,746961066],[246885852,2177182882]],l["SHA-512/224"]=[[2352822216,424955298],[1944164710,2312950998],[502970286,855612546],[1738396948,1479516111],[258812777,2077511080],[2011393907,79989058],[1067287976,1780299464],[286451373,2446758561]],c=!0}function a(e,t,r){for(var n,a,i,o,u,s,c,l,d,h,p,g,v,y,m,b,C,S,E,T,w,I,A,B,k,N,R,$,x,_,L,P,D,U,O,M=r.length();M>=128;){for(x=0;x<16;++x)t[x][0]=r.getInt32()>>>0,t[x][1]=r.getInt32()>>>0;for(;x<80;++x)P=t[x-2],_=P[0],L=P[1],n=((_>>>19|L<<13)^(L>>>29|_<<3)^_>>>6)>>>0,a=((_<<13|L>>>19)^(L<<3|_>>>29)^(_<<26|L>>>6))>>>0,U=t[x-15],_=U[0],L=U[1],i=((_>>>1|L<<31)^(_>>>8|L<<24)^_>>>7)>>>0,o=((_<<31|L>>>1)^(_<<24|L>>>8)^(_<<25|L>>>7))>>>0,D=t[x-7],O=t[x-16],L=a+D[1]+o+O[1],t[x][0]=n+D[0]+i+O[0]+(L/4294967296>>>0)>>>0,t[x][1]=L>>>0;for(v=e[0][0],y=e[0][1],m=e[1][0],b=e[1][1],C=e[2][0],S=e[2][1],E=e[3][0],T=e[3][1],w=e[4][0],I=e[4][1],A=e[5][0],B=e[5][1],k=e[6][0],N=e[6][1],R=e[7][0],$=e[7][1],x=0;x<80;++x)c=((w>>>14|I<<18)^(w>>>18|I<<14)^(I>>>9|w<<23))>>>0,l=((w<<18|I>>>14)^(w<<14|I>>>18)^(I<<23|w>>>9))>>>0,d=(k^w&(A^k))>>>0,h=(N^I&(B^N))>>>0,u=((v>>>28|y<<4)^(y>>>2|v<<30)^(y>>>7|v<<25))>>>0,s=((v<<4|y>>>28)^(y<<30|v>>>2)^(y<<25|v>>>7))>>>0,p=(v&m|C&(v^m))>>>0,g=(y&b|S&(y^b))>>>0,L=$+l+h+f[x][1]+t[x][1],n=R+c+d+f[x][0]+t[x][0]+(L/4294967296>>>0)>>>0,a=L>>>0,L=s+g,i=u+p+(L/4294967296>>>0)>>>0,o=L>>>0,R=k,$=N,k=A,N=B,A=w,B=I,L=T+a,w=E+n+(L/4294967296>>>0)>>>0,I=L>>>0,E=C,T=S,C=m,S=b,m=v,b=y,L=a+o,v=n+i+(L/4294967296>>>0)>>>0,y=L>>>0;L=e[0][1]+y,e[0][0]=e[0][0]+v+(L/4294967296>>>0)>>>0,e[0][1]=L>>>0,L=e[1][1]+b,e[1][0]=e[1][0]+m+(L/4294967296>>>0)>>>0,e[1][1]=L>>>0,L=e[2][1]+S,e[2][0]=e[2][0]+C+(L/4294967296>>>0)>>>0,e[2][1]=L>>>0,L=e[3][1]+T,e[3][0]=e[3][0]+E+(L/4294967296>>>0)>>>0,e[3][1]=L>>>0,L=e[4][1]+I,e[4][0]=e[4][0]+w+(L/4294967296>>>0)>>>0,e[4][1]=L>>>0,L=e[5][1]+B,e[5][0]=e[5][0]+A+(L/4294967296>>>0)>>>0,e[5][1]=L>>>0,L=e[6][1]+N,e[6][0]=e[6][0]+k+(L/4294967296>>>0)>>>0,e[6][1]=L>>>0,L=e[7][1]+$,e[7][0]=e[7][0]+R+(L/4294967296>>>0)>>>0,e[7][1]=L>>>0,M-=128}}var i=r(0);r(4),r(1);var o=e.exports=i.sha512=i.sha512||{};i.md.sha512=i.md.algorithms.sha512=o;var u=i.sha384=i.sha512.sha384=i.sha512.sha384||{};u.create=function(){return o.create("SHA-384")},i.md.sha384=i.md.algorithms.sha384=u,i.sha512.sha256=i.sha512.sha256||{create:function(){return o.create("SHA-512/256")}},i.md["sha512/256"]=i.md.algorithms["sha512/256"]=i.sha512.sha256,i.sha512.sha224=i.sha512.sha224||{create:function(){return o.create("SHA-512/224")}},i.md["sha512/224"]=i.md.algorithms["sha512/224"]=i.sha512.sha224,o.create=function(e){if(c||n(),void 0===e&&(e="SHA-512"),!(e in l))throw new Error("Invalid SHA-512 algorithm: "+e);for(var t=l[e],r=null,o=i.util.createBuffer(),u=new Array(80),f=0;f<80;++f)u[f]=new Array(2);var d=64;switch(e){case"SHA-384":d=48;break;case"SHA-512/256":d=32;break;case"SHA-512/224":d=28}var h={algorithm:e.replace("-","").toLowerCase(),blockLength:128,digestLength:d,messageLength:0,fullMessageLength:null,messageLengthSize:16};return h.start=function(){h.messageLength=0,h.fullMessageLength=h.messageLength128=[];for(var e=h.messageLengthSize/4,n=0;n>>0,n>>>0];for(var s=h.fullMessageLength.length-1;s>=0;--s)h.fullMessageLength[s]+=n[1],n[1]=n[0]+(h.fullMessageLength[s]/4294967296>>>0),h.fullMessageLength[s]=h.fullMessageLength[s]>>>0,n[0]=n[1]/4294967296>>>0;return o.putBytes(e),a(r,u,o),(o.read>2048||0===o.length())&&o.compact(),h},h.digest=function(){var t=i.util.createBuffer();t.putBytes(o.bytes());var n=h.fullMessageLength[h.fullMessageLength.length-1]+h.messageLengthSize,c=n&h.blockLength-1;t.putBytes(s.substr(0,h.blockLength-c));for(var f,l,d=8*h.fullMessageLength[0],p=0;p>>0,d+=l,t.putInt32(d>>>0),d=f>>>0;t.putInt32(d);for(var g=new Array(r.length),p=0;p>1,u=o+(1&e.length),s=e.substr(0,u),c=e.substr(o,u),f=n.util.createBuffer(),l=n.hmac.create();r=t+r;var d=Math.ceil(a/16),h=Math.ceil(a/20);l.start("MD5",s);var p=n.util.createBuffer();f.putBytes(r);for(var g=0;g0&&(f.queue(e,f.createAlert(e,{level:f.Alert.Level.warning,description:f.Alert.Description.no_renegotiation})),f.flush(e)),e.process()},f.parseHelloMessage=function(e,t,r){var a=null,i=e.entity===f.ConnectionEnd.client;if(r<38)e.error(e,{message:i?"Invalid ServerHello message. Message too short.":"Invalid ClientHello message. Message too short.",send:!0,alert:{level:f.Alert.Level.fatal,description:f.Alert.Description.illegal_parameter}});else{var o=t.fragment,u=o.length();if(a={version:{major:o.getByte(),minor:o.getByte()},random:n.util.createBuffer(o.getBytes(32)),session_id:s(o,1),extensions:[]},i?(a.cipher_suite=o.getBytes(2),a.compression_method=o.getByte()):(a.cipher_suites=s(o,2),a.compression_methods=s(o,1)),(u=r-(u-o.length()))>0){for(var c=s(o,2);c.length()>0;)a.extensions.push({type:[c.getByte(),c.getByte()],data:s(c,2)});if(!i)for(var l=0;l0;){var p=h.getByte();if(0!==p)break;e.session.extensions.server_name.serverNameList.push(s(h,2).getBytes())}}}if(e.session.version&&(a.version.major!==e.session.version.major||a.version.minor!==e.session.version.minor))return e.error(e,{message:"TLS version change is disallowed during renegotiation.",send:!0,alert:{level:f.Alert.Level.fatal,description:f.Alert.Description.protocol_version}});if(i)e.session.cipherSuite=f.getCipherSuite(a.cipher_suite);else for(var g=n.util.createBuffer(a.cipher_suites.bytes());g.length()>0&&(e.session.cipherSuite=f.getCipherSuite(g.getBytes(2)),null===e.session.cipherSuite););if(null===e.session.cipherSuite)return e.error(e,{message:"No cipher suites in common.",send:!0,alert:{level:f.Alert.Level.fatal,description:f.Alert.Description.handshake_failure},cipherSuite:n.util.bytesToHex(a.cipher_suite)});e.session.compressionMethod=i?a.compression_method:f.CompressionMethod.none}return a},f.createSecurityParameters=function(e,t){var r=e.entity===f.ConnectionEnd.client,n=t.random.bytes(),a=r?e.session.sp.client_random:n,i=r?n:f.createRandom().getBytes();e.session.sp={entity:e.entity,prf_algorithm:f.PRFAlgorithm.tls_prf_sha256,bulk_cipher_algorithm:null,cipher_type:null,enc_key_length:null,block_length:null,fixed_iv_length:null,record_iv_length:null,mac_algorithm:null,mac_length:null,mac_key_length:null,compression_algorithm:e.session.compressionMethod,pre_master_secret:null,master_secret:null,client_random:a,server_random:i}},f.handleServerHello=function(e,t,r){var n=f.parseHelloMessage(e,t,r);if(!e.fail){if(!(n.version.minor<=e.version.minor))return e.error(e,{message:"Incompatible TLS version.",send:!0,alert:{level:f.Alert.Level.fatal,description:f.Alert.Description.protocol_version}});e.version.minor=n.version.minor,e.session.version=e.version;var a=n.session_id.bytes();a.length>0&&a===e.session.id?(e.expect=g,e.session.resuming=!0,e.session.sp.server_random=n.random.bytes()):(e.expect=l,e.session.resuming=!1,f.createSecurityParameters(e,n)),e.session.id=a,e.process()}},f.handleClientHello=function(e,t,r){var a=f.parseHelloMessage(e,t,r);if(!e.fail){var i=a.session_id.bytes(),o=null;if(e.sessionCache&&(o=e.sessionCache.getSession(i),null===o?i="":(o.version.major!==a.version.major||o.version.minor>a.version.minor)&&(o=null,i="")),0===i.length&&(i=n.random.getBytes(32)),e.session.id=i,e.session.clientHelloVersion=a.version,e.session.sp={},o)e.version=e.session.version=o.version,e.session.sp=o.sp;else{for(var u,s=1;s0;)a=s(u.certificate_list,3),i=n.asn1.fromDer(a),a=n.pki.certificateFromAsn1(i,!0),c.push(a)}catch(t){return e.error(e,{message:"Could not parse certificate list.",cause:t,send:!0,alert:{level:f.Alert.Level.fatal,description:f.Alert.Description.bad_certificate}})}var l=e.entity===f.ConnectionEnd.client;!l&&!0!==e.verifyClient||0!==c.length?0===c.length?e.expect=l?d:C:(l?e.session.serverCertificate=c[0]:e.session.clientCertificate=c[0],f.verifyCertificateChain(e,c)&&(e.expect=l?d:C)):e.error(e,{message:l?"No server certificate provided.":"No client certificate provided.",send:!0,alert:{level:f.Alert.Level.fatal,description:f.Alert.Description.illegal_parameter}}),e.process()},f.handleServerKeyExchange=function(e,t,r){if(r>0)return e.error(e,{message:"Invalid key parameters. Only RSA is supported.",send:!0,alert:{level:f.Alert.Level.fatal,description:f.Alert.Description.unsupported_certificate}});e.expect=h,e.process()},f.handleClientKeyExchange=function(e,t,r){if(r<48)return e.error(e,{message:"Invalid key parameters. Only RSA is supported.",send:!0,alert:{level:f.Alert.Level.fatal,description:f.Alert.Description.unsupported_certificate}});var a=t.fragment,i={enc_pre_master_secret:s(a,2).getBytes()},o=null;if(e.getPrivateKey)try{o=e.getPrivateKey(e,e.session.serverCertificate),o=n.pki.privateKeyFromPem(o)}catch(t){e.error(e,{message:"Could not get private key.",cause:t,send:!0,alert:{level:f.Alert.Level.fatal,description:f.Alert.Description.internal_error}})}if(null===o)return e.error(e,{message:"No private key set.",send:!0,alert:{level:f.Alert.Level.fatal,description:f.Alert.Description.internal_error}});try{var u=e.session.sp;u.pre_master_secret=o.decrypt(i.enc_pre_master_secret);var c=e.session.clientHelloVersion;if(c.major!==u.pre_master_secret.charCodeAt(0)||c.minor!==u.pre_master_secret.charCodeAt(1))throw new Error("TLS version rollback attack detected.")}catch(e){u.pre_master_secret=n.random.getBytes(48)}e.expect=E,null!==e.session.clientCertificate&&(e.expect=S),e.process()},f.handleCertificateRequest=function(e,t,r){if(r<3)return e.error(e,{message:"Invalid CertificateRequest. Message too short.",send:!0,alert:{level:f.Alert.Level.fatal,description:f.Alert.Description.illegal_parameter}});var n=t.fragment,a={certificate_types:s(n,1),certificate_authorities:s(n,2)};e.session.certificateRequest=a,e.expect=p,e.process()},f.handleCertificateVerify=function(e,t,r){if(r<2)return e.error(e,{message:"Invalid CertificateVerify. Message too short.",send:!0,alert:{level:f.Alert.Level.fatal,description:f.Alert.Description.illegal_parameter}});var a=t.fragment;a.read-=4;var i=a.bytes();a.read+=4;var o={signature:s(a,2).getBytes()},u=n.util.createBuffer();u.putBuffer(e.session.md5.digest()),u.putBuffer(e.session.sha1.digest()),u=u.getBytes();try{if(!e.session.clientCertificate.publicKey.verify(u,o.signature,"NONE"))throw new Error("CertificateVerify signature does not match.");e.session.md5.update(i),e.session.sha1.update(i)}catch(t){return e.error(e,{message:"Bad signature in CertificateVerify.",send:!0,alert:{level:f.Alert.Level.fatal,description:f.Alert.Description.handshake_failure}})}e.expect=E,e.process()},f.handleServerHelloDone=function(e,t,r){if(r>0)return e.error(e,{message:"Invalid ServerHelloDone message. Invalid length.",send:!0,alert:{level:f.Alert.Level.fatal,description:f.Alert.Description.record_overflow}});if(null===e.serverCertificate){var a={message:"No server certificate provided. Not enough security.",send:!0,alert:{level:f.Alert.Level.fatal,description:f.Alert.Description.insufficient_security}},i=e.verify(e,a.alert.description,0,[]);if(!0!==i)return(i||0===i)&&("object"!=typeof i||n.util.isArray(i)?"number"==typeof i&&(a.alert.description=i):(i.message&&(a.message=i.message),i.alert&&(a.alert.description=i.alert))),e.error(e,a)}null!==e.session.certificateRequest&&(t=f.createRecord(e,{type:f.ContentType.handshake,data:f.createCertificate(e)}),f.queue(e,t)),t=f.createRecord(e,{type:f.ContentType.handshake,data:f.createClientKeyExchange(e)}),f.queue(e,t),e.expect=m;var o=function(e,t){null!==e.session.certificateRequest&&null!==e.session.clientCertificate&&f.queue(e,f.createRecord(e,{type:f.ContentType.handshake,data:f.createCertificateVerify(e,t)})),f.queue(e,f.createRecord(e,{type:f.ContentType.change_cipher_spec,data:f.createChangeCipherSpec()})),e.state.pending=f.createConnectionState(e),e.state.current.write=e.state.pending.write,f.queue(e,f.createRecord(e,{type:f.ContentType.handshake,data:f.createFinished(e)})),e.expect=g,f.flush(e),e.process()};if(null===e.session.certificateRequest||null===e.session.clientCertificate)return o(e,null);f.getClientSignature(e,o)},f.handleChangeCipherSpec=function(e,t){if(1!==t.fragment.getByte())return e.error(e,{message:"Invalid ChangeCipherSpec message received.",send:!0,alert:{level:f.Alert.Level.fatal,description:f.Alert.Description.illegal_parameter}});var r=e.entity===f.ConnectionEnd.client;(e.session.resuming&&r||!e.session.resuming&&!r)&&(e.state.pending=f.createConnectionState(e)),e.state.current.read=e.state.pending.read,(!e.session.resuming&&r||e.session.resuming&&!r)&&(e.state.pending=null),e.expect=r?v:T,e.process()},f.handleFinished=function(e,t,r){var i=t.fragment;i.read-=4;var o=i.bytes();i.read+=4;var u=t.fragment.getBytes();i=n.util.createBuffer(),i.putBuffer(e.session.md5.digest()),i.putBuffer(e.session.sha1.digest());var s=e.entity===f.ConnectionEnd.client,c=s?"server finished":"client finished",l=e.session.sp;if(i=a(l.master_secret,c,i.getBytes(),12),i.getBytes()!==u)return e.error(e,{message:"Invalid verify_data in Finished message.",send:!0,alert:{level:f.Alert.Level.fatal,description:f.Alert.Description.decrypt_error}});e.session.md5.update(o),e.session.sha1.update(o),(e.session.resuming&&s||!e.session.resuming&&!s)&&(f.queue(e,f.createRecord(e,{type:f.ContentType.change_cipher_spec,data:f.createChangeCipherSpec()})),e.state.current.write=e.state.pending.write,e.state.pending=null,f.queue(e,f.createRecord(e,{type:f.ContentType.handshake,data:f.createFinished(e)}))),e.expect=s?y:w,e.handshaking=!1,++e.handshakes,e.peerCertificate=s?e.session.serverCertificate:e.session.clientCertificate,f.flush(e),e.isConnected=!0,e.connected(e),e.process()},f.handleAlert=function(e,t){var r,n=t.fragment,a={level:n.getByte(),description:n.getByte()};switch(a.description){case f.Alert.Description.close_notify:r="Connection closed.";break;case f.Alert.Description.unexpected_message:r="Unexpected message.";break;case f.Alert.Description.bad_record_mac:r="Bad record MAC.";break;case f.Alert.Description.decryption_failed:r="Decryption failed.";break;case f.Alert.Description.record_overflow:r="Record overflow.";break;case f.Alert.Description.decompression_failure:r="Decompression failed.";break;case f.Alert.Description.handshake_failure:r="Handshake failure.";break;case f.Alert.Description.bad_certificate:r="Bad certificate.";break;case f.Alert.Description.unsupported_certificate:r="Unsupported certificate.";break;case f.Alert.Description.certificate_revoked:r="Certificate revoked.";break;case f.Alert.Description.certificate_expired:r="Certificate expired.";break;case f.Alert.Description.certificate_unknown:r="Certificate unknown.";break;case f.Alert.Description.illegal_parameter:r="Illegal parameter.";break;case f.Alert.Description.unknown_ca:r="Unknown certificate authority.";break;case f.Alert.Description.access_denied:r="Access denied.";break;case f.Alert.Description.decode_error:r="Decode error.";break;case f.Alert.Description.decrypt_error:r="Decrypt error.";break;case f.Alert.Description.export_restriction:r="Export restriction.";break;case f.Alert.Description.protocol_version:r="Unsupported protocol version.";break;case f.Alert.Description.insufficient_security:r="Insufficient security.";break;case f.Alert.Description.internal_error:r="Internal error.";break;case f.Alert.Description.user_canceled:r="User canceled.";break;case f.Alert.Description.no_renegotiation:r="Renegotiation not supported.";break;default:r="Unknown error."}if(a.description===f.Alert.Description.close_notify)return e.close();e.error(e,{message:r,send:!1,origin:e.entity===f.ConnectionEnd.client?"server":"client",alert:a}),e.process()},f.handleHandshake=function(e,t){var r=t.fragment,a=r.getByte(),i=r.getInt24();if(i>r.length())return e.fragmented=t,t.fragment=n.util.createBuffer(),r.read-=4,e.process();e.fragmented=null,r.read-=4;var o=r.bytes(i+4);r.read+=4,a in M[e.entity][e.expect]?(e.entity!==f.ConnectionEnd.server||e.open||e.fail||(e.handshaking=!0,e.session={version:null,extensions:{server_name:{serverNameList:[]}},cipherSuite:null,compressionMethod:null,serverCertificate:null,clientCertificate:null,md5:n.md.md5.create(),sha1:n.md.sha1.create()}),a!==f.HandshakeType.hello_request&&a!==f.HandshakeType.certificate_verify&&a!==f.HandshakeType.finished&&(e.session.md5.update(o),e.session.sha1.update(o)),M[e.entity][e.expect][a](e,t,i)):f.handleUnexpected(e,t)},f.handleApplicationData=function(e,t){e.data.putBuffer(t.fragment),e.dataReady(e),e.process()},f.handleHeartbeat=function(e,t){var r=t.fragment,a=r.getByte(),i=r.getInt16(),o=r.getBytes(i);if(a===f.HeartbeatMessageType.heartbeat_request){if(e.handshaking||i>o.length)return e.process();f.queue(e,f.createRecord(e,{type:f.ContentType.heartbeat,data:f.createHeartbeat(f.HeartbeatMessageType.heartbeat_response,o)})),f.flush(e)}else if(a===f.HeartbeatMessageType.heartbeat_response){if(o!==e.expectedHeartbeatPayload)return e.process();e.heartbeatReceived&&e.heartbeatReceived(e,n.util.createBuffer(o))}e.process()};var l=1,d=2,h=3,p=4,g=5,v=6,y=7,m=8,b=1,C=2,S=3,E=4,T=5,w=6,I=f.handleUnexpected,A=f.handleChangeCipherSpec,B=f.handleAlert,k=f.handleHandshake,N=f.handleApplicationData,R=f.handleHeartbeat,$=[];$[f.ConnectionEnd.client]=[[I,B,k,I,R],[I,B,k,I,R],[I,B,k,I,R],[I,B,k,I,R],[I,B,k,I,R],[A,B,I,I,R],[I,B,k,I,R],[I,B,k,N,R],[I,B,k,I,R]],$[f.ConnectionEnd.server]=[[I,B,k,I,R],[I,B,k,I,R],[I,B,k,I,R],[I,B,k,I,R],[A,B,I,I,R],[I,B,k,I,R],[I,B,k,N,R],[I,B,k,I,R]];var x=f.handleHelloRequest,_=f.handleServerHello,L=f.handleCertificate,P=f.handleServerKeyExchange,D=f.handleCertificateRequest,U=f.handleServerHelloDone,O=f.handleFinished,M=[];M[f.ConnectionEnd.client]=[[I,I,_,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I],[x,I,I,I,I,I,I,I,I,I,I,L,P,D,U,I,I,I,I,I,I],[x,I,I,I,I,I,I,I,I,I,I,I,P,D,U,I,I,I,I,I,I],[x,I,I,I,I,I,I,I,I,I,I,I,I,D,U,I,I,I,I,I,I],[x,I,I,I,I,I,I,I,I,I,I,I,I,I,U,I,I,I,I,I,I],[x,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I],[x,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,O],[x,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I],[x,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I]];var F=f.handleClientHello,V=f.handleClientKeyExchange,K=f.handleCertificateVerify;M[f.ConnectionEnd.server]=[[I,F,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I],[I,I,I,I,I,I,I,I,I,I,I,L,I,I,I,I,I,I,I,I,I],[I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,V,I,I,I,I],[I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,K,I,I,I,I,I],[I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I],[I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,O],[I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I],[I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I]],f.generateKeys=function(e,t){var r=a,n=t.client_random+t.server_random;e.session.resuming||(t.master_secret=r(t.pre_master_secret,"master secret",n,48).bytes(),t.pre_master_secret=null),n=t.server_random+t.client_random;var i=2*t.mac_key_length+2*t.enc_key_length,o=e.version.major===f.Versions.TLS_1_0.major&&e.version.minor===f.Versions.TLS_1_0.minor;o&&(i+=2*t.fixed_iv_length);var u=r(t.master_secret,"key expansion",n,i),s={client_write_MAC_key:u.getBytes(t.mac_key_length),server_write_MAC_key:u.getBytes(t.mac_key_length),client_write_key:u.getBytes(t.enc_key_length),server_write_key:u.getBytes(t.enc_key_length)};return o&&(s.client_write_IV=u.getBytes(t.fixed_iv_length),s.server_write_IV=u.getBytes(t.fixed_iv_length)),s},f.createConnectionState=function(e){var t=e.entity===f.ConnectionEnd.client,r=function(){var e={sequenceNumber:[0,0],macKey:null,macLength:0,macFunction:null,cipherState:null,cipherFunction:function(e){return!0},compressionState:null,compressFunction:function(e){return!0},updateSequenceNumber:function(){4294967295===e.sequenceNumber[1]?(e.sequenceNumber[1]=0,++e.sequenceNumber[0]):++e.sequenceNumber[1]}};return e},n={read:r(),write:r()};if(n.read.update=function(e,t){return n.read.cipherFunction(t,n.read)?n.read.compressFunction(e,t,n.read)||e.error(e,{message:"Could not decompress record.",send:!0,alert:{level:f.Alert.Level.fatal,description:f.Alert.Description.decompression_failure}}):e.error(e,{message:"Could not decrypt record or bad MAC.",send:!0,alert:{level:f.Alert.Level.fatal,description:f.Alert.Description.bad_record_mac}}),!e.fail},n.write.update=function(e,t){return n.write.compressFunction(e,t,n.write)?n.write.cipherFunction(t,n.write)||e.error(e,{message:"Could not encrypt record.",send:!1,alert:{level:f.Alert.Level.fatal,description:f.Alert.Description.internal_error}}):e.error(e,{message:"Could not compress record.",send:!1,alert:{level:f.Alert.Level.fatal,description:f.Alert.Description.internal_error}}),!e.fail},e.session){var a=e.session.sp;switch(e.session.cipherSuite.initSecurityParameters(a),a.keys=f.generateKeys(e,a),n.read.macKey=t?a.keys.server_write_MAC_key:a.keys.client_write_MAC_key,n.write.macKey=t?a.keys.client_write_MAC_key:a.keys.server_write_MAC_key,e.session.cipherSuite.initConnectionState(n,e,a),a.compression_algorithm){case f.CompressionMethod.none:break;case f.CompressionMethod.deflate:n.read.compressFunction=u,n.write.compressFunction=o;break;default:throw new Error("Unsupported compression algorithm.")}}return n},f.createRandom=function(){var e=new Date,t=+e+6e4*e.getTimezoneOffset(),r=n.util.createBuffer();return r.putInt32(t),r.putBytes(n.random.getBytes(28)),r},f.createRecord=function(e,t){return t.data?{type:t.type,version:{major:e.version.major,minor:e.version.minor},length:t.data.length(),fragment:t.data}:null},f.createAlert=function(e,t){var r=n.util.createBuffer();return r.putByte(t.level),r.putByte(t.description),f.createRecord(e,{type:f.ContentType.alert,data:r})},f.createClientHello=function(e){e.session.clientHelloVersion={major:e.version.major,minor:e.version.minor};for(var t=n.util.createBuffer(),r=0;r0&&(p+=2);var g=e.session.id,v=g.length+1+2+4+28+2+i+1+u+p,y=n.util.createBuffer();return y.putByte(f.HandshakeType.client_hello),y.putInt24(v),y.putByte(e.version.major),y.putByte(e.version.minor),y.putBytes(e.session.sp.client_random),c(y,1,n.util.createBuffer(g)),c(y,2,t),c(y,1,o),p>0&&c(y,2,s),y},f.createServerHello=function(e){var t=e.session.id,r=t.length+1+2+4+28+2+1,a=n.util.createBuffer();return a.putByte(f.HandshakeType.server_hello),a.putInt24(r),a.putByte(e.version.major),a.putByte(e.version.minor),a.putBytes(e.session.sp.server_random),c(a,1,n.util.createBuffer(t)),a.putByte(e.session.cipherSuite.id[0]),a.putByte(e.session.cipherSuite.id[1]),a.putByte(e.session.compressionMethod),a},f.createCertificate=function(e){var t=e.entity===f.ConnectionEnd.client,r=null;if(e.getCertificate){var a;a=t?e.session.certificateRequest:e.session.extensions.server_name.serverNameList,r=e.getCertificate(e,a)}var i=n.util.createBuffer();if(null!==r)try{n.util.isArray(r)||(r=[r]);for(var o=null,u=0;uf.MaxFragment;)a.push(f.createRecord(e,{type:t.type,data:n.util.createBuffer(i.slice(0,f.MaxFragment))})),i=i.slice(f.MaxFragment);i.length>0&&a.push(f.createRecord(e,{type:t.type,data:n.util.createBuffer(i)}))}for(var o=0;o0&&(a=r.order[0]),null!==a&&a in r.cache){t=r.cache[a],delete r.cache[a];for(var i in r.order)if(r.order[i]===a){r.order.splice(i,1);break}}return t},r.setSession=function(e,t){if(r.order.length===r.capacity){var a=r.order.shift();delete r.cache[a]}var a=n.util.bytesToHex(e);r.order.push(a),r.cache[a]=t}}return r},f.createConnection=function(e){var t=null;t=e.caStore?n.util.isArray(e.caStore)?n.pki.createCaStore(e.caStore):e.caStore:n.pki.createCaStore();var r=e.cipherSuites||null;if(null===r){r=[];for(var a in f.CipherSuites)r.push(f.CipherSuites[a])}var i=e.server?f.ConnectionEnd.server:f.ConnectionEnd.client,o=e.sessionCache?f.createSessionCache(e.sessionCache):null,u={version:{major:f.Version.major,minor:f.Version.minor},entity:i,sessionId:e.sessionId,caStore:t,sessionCache:o,cipherSuites:r,connected:e.connected,virtualHost:e.virtualHost||null,verifyClient:e.verifyClient||!1,verify:e.verify||function(e,t,r,n){return t},verifyOptions:e.verifyOptions||{},getCertificate:e.getCertificate||null,getPrivateKey:e.getPrivateKey||null,getSignature:e.getSignature||null,input:n.util.createBuffer(),tlsData:n.util.createBuffer(),data:n.util.createBuffer(),tlsDataReady:e.tlsDataReady,dataReady:e.dataReady,heartbeatReceived:e.heartbeatReceived,closed:e.closed,error:function(t,r){r.origin=r.origin||(t.entity===f.ConnectionEnd.client?"client":"server"),r.send&&(f.queue(t,f.createAlert(t,r.alert)),f.flush(t));var n=!1!==r.fatal;n&&(t.fail=!0),e.error(t,r),n&&t.close(!1)},deflate:e.deflate||null,inflate:e.inflate||null};u.reset=function(e){u.version={major:f.Version.major,minor:f.Version.minor},u.record=null,u.session=null,u.peerCertificate=null,u.state={pending:null,current:null},u.expect=(u.entity,f.ConnectionEnd.client,0),u.fragmented=null,u.records=[],u.open=!1,u.handshakes=0,u.handshaking=!1,u.isConnected=!1,u.fail=!(e||void 0===e),u.input.clear(),u.tlsData.clear(),u.data.clear(),u.state.current=f.createConnectionState(u)},u.reset();var s=function(e,t){var r=t.type-f.ContentType.change_cipher_spec,n=$[e.entity][e.expect];r in n?n[r](e,t):f.handleUnexpected(e,t)},c=function(e){var t=0,r=e.input,a=r.length();if(a<5)t=5-a;else{e.record={type:r.getByte(),version:{major:r.getByte(),minor:r.getByte()},length:r.getInt16(),fragment:n.util.createBuffer(),ready:!1};var i=e.record.version.major===e.version.major;i&&e.session&&e.session.version&&(i=e.record.version.minor===e.version.minor),i||e.error(e,{message:"Incompatible TLS version.",send:!0,alert:{level:f.Alert.Level.fatal,description:f.Alert.Description.protocol_version}})}return t},l=function(e){var t=0,r=e.input,n=r.length();if(n0&&(u.sessionCache&&(t=u.sessionCache.getSession(e)),null===t&&(e="")),0===e.length&&u.sessionCache&&null!==(t=u.sessionCache.getSession())&&(e=t.id),u.session={id:e,version:null,cipherSuite:null,compressionMethod:null,serverCertificate:null,certificateRequest:null,clientCertificate:null,sp:{},md5:n.md.md5.create(),sha1:n.md.sha1.create()},t&&(u.version=t.version,u.session.sp=t.sp),u.session.sp.client_random=f.createRandom().getBytes(),u.open=!0,f.queue(u,f.createRecord(u,{type:f.ContentType.handshake,data:f.createClientHello(u)})),f.flush(u)}},u.process=function(e){var t=0;return e&&u.input.putBytes(e),u.fail||(null!==u.record&&u.record.ready&&u.record.fragment.isEmpty()&&(u.record=null),null===u.record&&(t=c(u)),u.fail||null===u.record||u.record.ready||(t=l(u)),!u.fail&&null!==u.record&&u.record.ready&&s(u,u.record)),t},u.prepare=function(e){return f.queue(u,f.createRecord(u,{type:f.ContentType.application_data,data:n.util.createBuffer(e)})),f.flush(u)},u.prepareHeartbeatRequest=function(e,t){return e instanceof n.util.ByteBuffer&&(e=e.bytes()),void 0===t&&(t=e.length),u.expectedHeartbeatPayload=e,f.queue(u,f.createRecord(u,{type:f.ContentType.heartbeat,data:f.createHeartbeat(f.HeartbeatMessageType.heartbeat_request,e,t)})),f.flush(u)},u.close=function(e){if(!u.fail&&u.sessionCache&&u.session){var t={id:u.session.id,version:u.session.version,sp:u.session.sp};t.sp.keys=null,u.sessionCache.setSession(t.id,t)}u.open&&(u.open=!1,u.input.clear(),(u.isConnected||u.handshaking)&&(u.isConnected=u.handshaking=!1,f.queue(u,f.createAlert(u,{level:f.Alert.Level.warning,description:f.Alert.Description.close_notify})),f.flush(u)),u.closed(u)),u.reset(e)},u},e.exports=n.tls=n.tls||{};for(var q in f)"function"!=typeof f[q]&&(n.tls[q]=f[q]);n.tls.prf_tls1=a,n.tls.hmac_sha1=i,n.tls.createSessionCache=f.createSessionCache,n.tls.createConnection=f.createConnection},function(e,t,r){"use strict";var n=function(){var e,t,r,n={};n.startWatching=function(e,n){t=e,r=n,setInterval(a,100)};var a=function(){r.version.getNetwork(function(r,n){r?console.log("error with web3.version.getNetwork: ",r):n!=e&&(t.send(parseInt(n)),e=n)})};return n}();e.exports=n},function(e,t,r){"use strict";function n(e,t){for(;e.length");if("boolean"==typeof t)return T(e,t?"True":"False");if("number"==typeof t)return w(e,t+"");if(t instanceof String)return A(e,"'"+E(t,!0)+"'");if("string"==typeof t)return I(e,'"'+E(t,!1)+'"');if("object"==typeof t&&"$"in t){var r=t.$;if("number"==typeof r)return k(e,"");if("#"===r[0]){var n=[];for(var a in t)"$"!==a&&n.push(S(e,t[a]));return"("+n.join(",")+")"}if("Set_elm_builtin"===r)return T(e,"Set")+B(e,".fromList")+" "+S(e,ja(t));if("RBNode_elm_builtin"===r||"RBEmpty_elm_builtin"===r)return T(e,"Dict")+B(e,".fromList")+" "+S(e,Ka(t));if("Array_elm_builtin"===r)return T(e,"Array")+B(e,".fromList")+" "+S(e,Ma(t));if("::"===r||"[]"===r){var n="[";for(t.b&&(n+=S(e,t.a),t=t.b);t.b;t=t.b)n+=","+S(e,t.a);return n+"]"}var n="";for(var i in t)if("$"!==i){var o=S(e,t[i]),u=o[0],s="{"===u||"("===u||"["===u||"<"===u||'"'===u||o.indexOf(" ")<0;n+=" "+(s?o:"("+o+")")}return T(e,r)+n}if("function"==typeof DataView&&t instanceof DataView)return I(e,"<"+t.byteLength+" bytes>");if("function"==typeof File&&t instanceof File)return k(e,"<"+t.name+">");if("object"==typeof t){var n=[];for(var c in t){var f="_"===c[0]?c.slice(1):c;n.push(B(e,f)+" = "+S(e,t[c]))}return 0===n.length?"{}":"{ "+n.join(", ")+" }"}return k(e,"")}function E(e,t){var r=e.replace(/\\/g,"\\\\").replace(/\n/g,"\\n").replace(/\t/g,"\\t").replace(/\r/g,"\\r").replace(/\v/g,"\\v").replace(/\0/g,"\\0");return t?r.replace(/\'/g,"\\'"):r.replace(/\"/g,'\\"')}function T(e,t){return e?""+t+"":t}function w(e,t){return e?""+t+"":t}function I(e,t){return e?""+t+"":t}function A(e,t){return e?""+t+"":t}function B(e,t){return e?""+t+"":t}function k(e,t){return e?""+t+"":t}function N(e,t,r,n,a){switch(e){case 0:throw new Error('What node should I take over? In JavaScript I need something like:\n\n Elm.Main.init({\n node: document.getElementById("elm-node")\n })\n\nYou need to do this with any Browser.sandbox or Browser.element program.');case 1:throw new Error("Browser.application programs cannot handle URLs like this:\n\n "+document.location.href+"\n\nWhat is the root? The root of your file system? Try looking at this program with `elm reactor` or some other server.");case 2:var i=t;throw new Error("Problem with the flags given to your Elm program on initialization.\n\n"+i);case 3:var o=t;throw new Error("There can only be one port named `"+o+"`, but your program has multiple.");case 4:var o=t,u=r;throw new Error("Trying to send an unexpected type of value through port `"+o+"`:\n"+u);case 5:throw new Error('Trying to use `(==)` on functions.\nThere is no way to know if functions are "the same" in the Elm sense.\nRead more about this at https://package.elm-lang.org/packages/elm/core/latest/Basics#== which describes why it is this way and what the better version will look like.');case 6:var s=t;throw new Error("Your page is loading multiple Elm scripts with a module named "+s+". Maybe a duplicate script is getting loaded accidentally? If not, rename one of them so I know which is which!");case 8:var s=t,c=r,f=n;throw new Error("TODO in module `"+s+"` "+R(c)+"\n\n"+f);case 9:var s=t,c=r,l=n,f=a;throw new Error("TODO in module `"+s+"` from the `case` expression "+R(c)+"\n\nIt received the following value:\n\n "+C(l).replace("\n","\n ")+"\n\nBut the branch that handles it says:\n\n "+f.replace("\n","\n "));case 10:throw new Error("Bug in https://github.com/elm/virtual-dom/issues");case 11:throw new Error("Cannot perform mod 0. Division by zero error.")}}function R(e){return e.start.line===e.end.line?"on line "+e.start.line:"on lines "+e.start.line+" through "+e.end.line}function $(e,t){for(var r,n=[],a=x(e,t,0,n);a&&(r=n.pop());a=x(r.a,r.b,0,n));return a}function x(e,t,r,n){if(r>100)return n.push(L(e,t)),!0;if(e===t)return!0;if("object"!=typeof e||null===e||null===t)return"function"==typeof e&&N(5),!1;"Set_elm_builtin"===e.$&&(e=ja(e),t=ja(t)),"RBNode_elm_builtin"!==e.$&&"RBEmpty_elm_builtin"!==e.$||(e=Ka(e),t=Ka(t));for(var a in e)if(!x(e[a],t[a],r+1,n))return!1;return!0}function _(e,t,r){if("object"!=typeof e)return e===t?0:e=t.length)return ge("a LONGER array. Need index "+a+" but only see "+t.length+" entries",t);var n=le(e.b,t[a]);return Ai(n)?n:wi(f(Ni,a,n.a));case 8:if("object"!=typeof t||null===t||he(t))return ge("an OBJECT",t);var i=mr;for(var o in t)if(t.hasOwnProperty(o)){var n=le(e.b,t[o]);if(!Ai(n))return wi(f(ki,o,n.a));i=M(L(o,n.a),i)}return Ii(Ya(i));case 9:for(var u=e.f,s=e.g,c=0;c=0&&a.splice(t,1)}var a=[],i=gn[e].r,o=_e(0);return gn[e].b=o,gn[e].c=n(function(e,t,r){for(;t.b;t=t.b)for(var n=a,u=be(i(t.a)),s=0;s0&&bt(r,1,n,f));case 4:for(var l=e.j,d=t.j,h=!1,p=e.k;4===p.$;)h=!0,"object"!=typeof l?l=[l,p.j]:l.push(p.j),p=p.k;for(var g=t.k;4===g.$;)h=!0,"object"!=typeof d?d=[d,g.j]:d.push(g.j),g=g.k;return h&&l.length!==d.length?void bt(r,0,n,t):((h?St(l,d):l===d)||bt(r,2,n,d),void Ct(p,g,r,n+1));case 0:return void(e.a!==t.a&&bt(r,3,n,t.a));case 1:return void Et(e,t,r,n,wt);case 2:return void Et(e,t,r,n,It);case 3:if(e.h!==t.h)return void bt(r,0,n,t);var v=Tt(e.d,t.d);v&&bt(r,4,n,v);var y=t.i(e.g,t.g);return void(y&&bt(r,5,n,y))}}}function St(e,t){for(var r=0;ru?bt(r,6,n,{v:u,i:o-u}):o0||o.length>0||k)&&bt(r,8,n,{w:a,x:o,y:k})}function At(e,t,r,n,a,i){var o=e[r];if(!o)return o={c:0,z:n,r:a,s:void 0},i.push({r:a,A:o}),void(e[r]=o);if(1===o.c){i.push({r:a,A:o}),o.c=2;var u=[];return Ct(o.z,n,u,o.r),o.r=a,void(o.s.s={w:u,A:o})}At(e,t,r+Jn,n,a,i)}function Bt(e,t,r,n,a){var i=e[r];if(!i){var o=bt(t,9,a,void 0);return void(e[r]={c:1,z:n,r:a,s:o})}if(0===i.c){i.c=2;var u=[];return Ct(n,i.z,u,a),void bt(t,9,a,{w:u,A:i})}Bt(e,t,r+Jn,n,a)}function kt(e,t,r,n){Nt(e,t,r,0,0,t.b,n)}function Nt(e,t,r,n,a,i,o){for(var u=r[n],s=u.r;s===a;){var c=u.$;if(1===c)kt(e,t.k,u.s,o);else if(8===c){u.t=e,u.u=o;var f=u.s.w;f.length>0&&Nt(e,t,f,0,a,i,o)}else if(9===c){u.t=e,u.u=o;var l=u.s;if(l){l.A.s=e;var f=l.w;f.length>0&&Nt(e,t,f,0,a,i,o)}}else u.t=e,u.u=o;if(n++,!(u=r[n])||(s=u.r)>i)return n}var d=t.$;if(4===d){for(var h=t.k;4===h.$;)h=h.k;return Nt(e,h,r,n,a+1,i,e.elm_event_node_ref)}for(var p=t.e,g=e.childNodes,v=0;vi))return n;a=m}return n}function Rt(e,t,r,n){return 0===r.length?e:(kt(e,t,r,n),$t(e,r))}function $t(e,t){for(var r=0;r0){var o=a.substring(0,i),u=a.substring(i+2);t=l(Dh,o,function(e){return ya(Uh(e)?u+", "+e.a:u)},t)}}return t}function Kt(e,t,r){t.upload.addEventListener("progress",function(n){t.c||Be(f(Mh,e,L(r,qh({sent:n.loaded,size:n.total}))))}),t.addEventListener("progress",function(n){t.c||Be(f(Mh,e,L(r,jh({received:n.loaded,size:n.lengthComputable?ya(n.total):ma}))))})}function Ht(e,t){function r(){n=1===n?0:(aa(r),t(e),1)}t(e);var n=0;return function(a,i){e=a,i?(t(e),2===n&&(n=1)):(0===n&&aa(r),n=2)}}function jt(e){var t=e.onUrlChange,n=e.onUrlRequest,a=function(){a.a(t(qt()))};return na({setup:function(e){return a.a=e,sa.addEventListener("popstate",a),sa.navigator.userAgent.indexOf("Trident")<0||sa.addEventListener("hashchange",a),r(function(t,r){if(!r.ctrlKey&&!r.metaKey&&!r.shiftKey&&r.button<1&&!t.target&&!t.hasAttribute("download")){r.preventDefault();var a=t.href,i=qt(),o=Sg(a).a;e(n(o&&i.protocol===o.protocol&&i.host===o.host&&i.port_.a===o.port_.a?cg(o):sg(a)))}})},init:function(t){return l(e.init,t,qt(),a)},view:e.view,update:e.update,subscriptions:e.subscriptions})}function qt(){return Sg(Dn.location.href).a||N(1)}function Gt(e,t){return Ie(function(r){aa(function(){var n=document.getElementById(e);r(n?Te(t(n)):we(fg(e)))})})}function zt(e){return Ie(function(t){aa(function(){t(Te(e()))})})}function Yt(){return{scene:Wt(),viewport:{x:sa.pageXOffset,y:sa.pageYOffset,width:ua.documentElement.clientWidth,height:ua.documentElement.clientHeight}}}function Wt(){var e=ua.body,t=ua.documentElement;return{width:Math.max(e.scrollWidth,e.offsetWidth,t.scrollWidth,t.offsetWidth,t.clientWidth),height:Math.max(e.scrollHeight,e.offsetHeight,t.scrollHeight,t.offsetHeight,t.clientHeight)}}function Jt(e){return Gt(e,function(e){var t=e.getBoundingClientRect(),r=sa.pageXOffset,n=sa.pageYOffset;return{scene:Wt(),viewport:{x:r,y:n,width:ua.documentElement.clientWidth,height:ua.documentElement.clientHeight},element:{x:r+t.left,y:n+t.top,width:t.width,height:t.height}}})}function Qt(e){return f(dg,lg,Ie(function(t){try{sa.location=e}catch(e){Dn.location.reload(!1)}}))}function Xt(e){try{return ya(decodeURIComponent(e))}catch(e){return ma}}function Zt(){return f($a,tu(ws),f($a,is,Ts))}console.warn("Compiled in DEV mode. Follow the advice at https://elm-lang.org/0.19.0/optimize for better performance and smaller assets.");var er,tr,rr=[],nr=n(function(e,t,r){for(var n=new Array(e),a=0;a=0;n--)t=f(e,r[n],t);return t}),fr=(r(function(e,t){for(var r=t.length,n=new Array(r),a=0;ar.length&&(a=r.length);for(var i=n+a,o=new Array(i),u=0;u0}),r(function(e,t){return _(e,t)>=0}),r(function(e,t){var r=_(e,t);return r<0?Da:r?Fa:Pa})),vr={$:"#0"},yr=r(O),mr={$:"[]"},br=r(M),Cr=n(function(e,t,r){for(var n=[];t.b&&r.b;t=t.b,r=r.b)n.push(f(e,t.a,r.a));return F(n)}),Sr=(a(function(e,t,r,n){for(var a=[];t.b&&r.b&&n.b;t=t.b,r=r.b,n=n.b)a.push(l(e,t.a,r.a,n.a));return F(a)}),i(function(e,t,r,n,a){for(var i=[];t.b&&r.b&&n.b&&a.b;t=t.b,r=r.b,n=n.b,a=a.b)i.push(d(e,t.a,r.a,n.a,a.a));return F(i)}),o(function(e,t,r,n,a,i){for(var o=[];t.b&&r.b&&n.b&&a.b&&i.b;t=t.b,r=r.b,n=n.b,a=a.b,i=i.b)o.push(h(e,t.a,r.a,n.a,a.a,i.a));return F(o)}),r(function(e,t){return F(V(t).sort(function(t,r){return _(e(t),e(r))}))})),Er=r(function(e,t){return F(V(t).sort(function(t,r){var n=f(e,t,r);return n===Pa?0:n===Da?-1:1}))}),Tr=r(function(e,t){return e+t}),wr=r(function(e,t){return e-t}),Ir=r(function(e,t){return e*t}),Ar=(r(function(e,t){return e/t}),r(function(e,t){return e/t|0}),r(Math.pow)),Br=(r(function(e,t){return t%e}),r(function(e,t){var r=t%e;return 0===e?N(11):r>0&&e<0||r<0&&e>0?r+e:r})),kr=Math.PI,Nr=(Math.E,Math.cos),Rr=Math.sin,$r=(Math.tan,Math.acos,Math.asin,Math.atan,r(Math.atan2),Math.ceil),xr=Math.floor,_r=Math.round,Lr=(Math.sqrt,Math.log),Pr=(isNaN,r(function(e,t){return e&&t}),r(function(e,t){return e||t}),r(function(e,t){return e!==t}),r(function(e,t){return e+t})),Dr=r(function(e,t){return e+t}),Ur=(r(function(e,t){for(var r=t.length,n=new Array(r),a=0;a-1}),jr=r(function(e,t){return 0===t.indexOf(e)}),qr=r(function(e,t){return t.length>=e.length&&t.lastIndexOf(e)===t.length-e.length}),Gr=r(function(e,t){var r=e.length;if(r<1)return mr;for(var n=0,a=[];(n=t.indexOf(e,n))>-1;)a.push(n),n+=r;return F(a)}),zr=oe(function(e){return"number"!=typeof e?ge("an INT",e):-2147483647>e}),r(function(e,t){return t>>>e}),r(function(e,t){return Ie(function(r){r(Te(1===new Uint8Array(new Uint32Array([1]))[0]?e:t))})}),n(function(e,t,r){return e.setInt8(t,r),t+1})),wn=a(function(e,t,r,n){return e.setInt16(t,r,n),t+2}),In=a(function(e,t,r,n){return e.setInt32(t,r,n),t+4}),An=n(function(e,t,r){return e.setUint8(t,r),t+1}),Bn=a(function(e,t,r,n){return e.setUint16(t,r,n),t+2}),kn=a(function(e,t,r,n){return e.setUint32(t,r,n),t+4}),Nn=a(function(e,t,r,n){return e.setFloat32(t,r,n),t+4}),Rn=a(function(e,t,r,n){return e.setFloat64(t,r,n),t+8}),$n=n(function(e,t,r){for(var n=0,a=r.byteLength,i=a-4;n<=i;n+=4)e.setUint32(t+n,r.getUint32(n));for(;n>>6&31)<<8|63&a),2):a<55296||56319>>12&15)<<8|a>>>6&63),e.setUint8(t+2,128|63&a),3):(a=1024*(a-55296)+r.charCodeAt(++n)-56320+65536,e.setUint32(t,4034953344|(a>>>18&7)<<24|(a>>>12&63)<<16|(a>>>6&63)<<8|63&a),4)}return t}),_n=r(function(e,t){try{return ya(f(e,t,0).b)}catch(e){return ma}}),Ln=(r(function(e,t){return L(t+1,e.getInt8(t))}),n(function(e,t,r){return L(r+2,t.getInt16(r,e))}),n(function(e,t,r){return L(r+4,t.getInt32(r,e))}),r(function(e,t){return L(t+1,e.getUint8(t))})),Pn=(n(function(e,t,r){return L(r+2,t.getUint16(r,e))}),n(function(e,t,r){return L(r+4,t.getUint32(r,e))}),n(function(e,t,r){return L(r+4,t.getFloat32(r,e))}),n(function(e,t,r){return L(r+8,t.getFloat64(r,e))}),n(function(e,t,r){return L(r+e,new DataView(t.buffer,t.byteOffset+r,e))})),Dn=(n(function(e,t,r){for(var n="",a=r+e;r0;){var l=n[c];f[--c]=l?ya(l):ma}a.push(d(pd,n[0],n.index,i,F(f))),s=t.lastIndex}return t.lastIndex=u,F(a)}),a(function(e,t,r,n){function a(t){if(i++>=e)return t;for(var n=arguments.length-3,a=new Array(n);n>0;){var o=arguments[n];a[--n]=o?ya(o):ma}return r(d(pd,t,arguments[arguments.length-2],i,F(a)))}var i=0;return n.replace(t,a)}),n(function(e,t,r){for(var n=r,a=[],i=t.lastIndex,o=t.lastIndex;e--;){var u=t.exec(n);if(!u)break;a.push(n.slice(i,u.index)),i=t.lastIndex}return a.push(n.slice(i)),t.lastIndex=o,F(a)}),n(function(e,t,r){return Ie(function(n){function a(e){n(t(r.expect.a(e)))}var i=new XMLHttpRequest;i.addEventListener("error",function(){a(Hh)}),i.addEventListener("timeout",function(){a(Gh)}),i.addEventListener("load",function(){a(Mt(r.expect.b,i))}),Uh(r.tracker)&&Kt(e,i,r.tracker.a);try{i.open(r.method,r.url,!0)}catch(e){return a(Vh(r.url))}return Ot(i,r),r.body.a&&i.setRequestHeader("Content-Type",r.body.a),i.send(r.body.b),function(){i.c=!0,i.abort()}})})),ta=n(function(e,t,r){return{$:0,d:e,b:t,a:r}}),ra=(r(function(e,t){return{$:0,d:t.d,b:t.b,a:function(r){return e(t.a(r))}}}),r(function(e,t){return{$:0,a:e,b:t}})),na=(r(function(e,t){return new Blob([t],{type:e})}),a(function(e,t,r,n){return Le(t,n,e.init,e.update,e.subscriptions,function(t,r){var a=e.view,i=n&&n.node?n.node:N(0),o=Dt(i);return Ht(r,function(e){var r=a(e),n=mt(o,r);i=Rt(i,o,n,t),o=r})})}),a(function(e,t,r,n){return Le(t,n,e.init,e.update,e.subscriptions,function(t,r){var n=e.setup&&e.setup(t),a=e.view,i=Dn.title,o=Dn.body,u=Dt(o);return Ht(r,function(e){er=n;var r=a(e),s=On("body")(mr)(r.body),c=mt(u,s);o=Rt(o,u,c,t),u=s,er=0,i!==r.title&&(Dn.title=i=r.title)})})})),aa=("undefined"!=typeof cancelAnimationFrame&&cancelAnimationFrame,"undefined"!=typeof requestAnimationFrame?requestAnimationFrame:function(e){return setTimeout(e,1e3/60)}),ia=(r(function(e,t){return f(dg,lg,Ie(function(){t&&history.go(t),e()}))}),r(function(e,t){return f(dg,lg,Ie(function(){history.pushState({},"",t),e()}))})),oa=(r(function(e,t){return f(dg,lg,Ie(function(){history.replaceState({},"",t),e()}))}),{addEventListener:function(){},removeEventListener:function(){}}),ua="undefined"!=typeof document?document:oa,sa="undefined"!=typeof window?window:oa,ca=(n(function(e,t,r){return ke(Ie(function(n){function a(e){Be(r(e))}return e.addEventListener(t,a,tr&&{passive:!0}),function(){e.removeEventListener(t,a)}}))}),r(function(e,t){var r=le(e,t);return Ai(r)?ya(r.a):ma}),r(function(e,t){return Gt(t,function(t){return t[e](),vr})}),r(function(e,t){return zt(function(){return sa.scroll(e,t),vr})})),fa=(n(function(e,t,r){return Gt(e,function(e){return e.scrollLeft=t,e.scrollTop=r,vr})}),r(function(e,t){return Ie(function(r){var n=setInterval(function(){Be(t)},e);return function(){clearInterval(n)}})})),la=function(e){return{$:"Native",a:e}},da={$:"XDai"},ha={$:"EthDai"},pa={$:"KovanDai"},ga=function(e){return{$:"Token",a:e}},va=r(function(e,t){return e(t)}),ya=function(e){return{$:"Just",a:e}},ma={$:"Nothing"},ba=function(e){e:for(;;)switch(e.$){case"Mainnet":return ya(ga(ha));case"Kovan":return ya(ga(pa));case"Private":if(100===e.a)return ya(la(da));break e;default:break e}return ma},Ca={$:"ETCMain"},Sa={$:"ETCTest"},Ea={$:"Expanse"},Ta={$:"Kovan"},wa={$:"Mainnet"},Ia=function(e){return{$:"Private",a:e}},Aa={$:"Rinkeby"},Ba={$:"Ropsten"},ka={$:"RskMain"},Na={$:"RskTest"},Ra=function(e){switch(e){case 1:return wa;case 2:return Ea;case 3:return Ba;case 4:return Aa;case 30:return ka;case 31:return Na;case 42:return Ta;case 41:return Ca;case 62:return Sa;default:return Ia(e)}},$a=n(function(e,t,r){return t(e(r))}),xa=f($a,Ra,ba),_a=n(function(e,t,r){return{factoryType:e,httpProvider:t,wsProvider:r}}),La=function(e){if("Token"===e.$){if("EthDai"===e.a.$){e.a;return l(_a,e,"https://mainnet.infura.io/v3/e3eef0e2435349bf9164e6f465bd7cf9","wss://mainnet.infura.io/ws")}e.a;return l(_a,e,"https://kovan.infura.io/v3/e3eef0e2435349bf9164e6f465bd7cf9","wss://kovan.infura.io/ws")}switch(e.a.$){case"Eth":e.a;return l(_a,e,"https://mainnet.infura.io/v3/e3eef0e2435349bf9164e6f465bd7cf9","wss://mainnet.infura.io/ws");case"Kovan":e.a;return l(_a,e,"https://kovan.infura.io/v3/e3eef0e2435349bf9164e6f465bd7cf9","wss://kovan.infura.io/ws");default:e.a;return l(_a,e,"https://dai.poa.network","")}},Pa={$:"EQ"},Da={$:"LT"},Ua=cr,Oa=n(function(e,t,n){var a=n.c,i=n.d,o=r(function(t,r){if("SubTree"===t.$){var n=t.a;return l(Ua,o,r,n)}var a=t.a;return l(Ua,e,r,a)});return l(Ua,o,l(Ua,e,t,i),a)}),Ma=function(e){return l(Oa,qa,mr,e)},Fa={$:"GT"},Va=n(function(e,t,r){for(;;){if("RBEmpty_elm_builtin"===r.$)return t;var n=r.b,a=r.c,i=r.d,o=r.e,u=e,s=l(e,n,a,l(Va,e,t,o)),c=i;e=u,t=s,r=c}}),Ka=function(e){return l(Va,n(function(e,t,r){return f(qa,L(e,t),r)}),mr,e)},Ha=function(e){return l(Va,n(function(e,t,r){return f(qa,e,r)}),mr,e)},ja=function(e){var t=e.a;return Ha(t)},qa=br,Ga=Tr,za=n(function(e,t,r){for(;;){if(!r.b)return t;var n=r.a,a=r.b,i=e,o=f(e,n,t),u=a;e=i,t=o,r=u}}),Ya=function(e){return l(za,qa,mr,e)},Wa=a(function(e,t,r,n){if(n.b){var a=n.a,i=n.b;if(i.b){var o=i.a,u=i.b;if(u.b){var s=u.a,c=u.b;if(c.b){var h=c.a,p=c.b;return f(e,a,f(e,o,f(e,s,f(e,h,r>500?l(za,e,t,Ya(p)):d(Wa,e,t,r+1,p)))))}return f(e,a,f(e,o,f(e,s,t)))}return f(e,a,f(e,o,t))}return f(e,a,t)}return t}),Ja=n(function(e,t,r){return d(Wa,e,t,0,r)}),Qa=r(function(e,t){return t.b?l(Ja,qa,t,e):e}),Xa=r(function(e,t){return U(t,{userNotices:f(Qa,t.userNotices,F([e]))})}),Za=r(function(e,t){return l(za,Xa,t,e)}),ei=a(function(e,t,r,n){return{$:"Array_elm_builtin",a:e,b:t,c:r,d:n}}),ti=$r,ri=r(function(e,t){return Lr(t)/Lr(e)}),ni=K,ai=ti(f(ri,2,32)),ii=rr,oi=d(ei,0,ai,ii,ii),ui=function(e){return{$:"Leaf",a:e}},si=function(e){return{$:"SubTree",a:e}},ci=ar,fi=r(function(e,t){for(;;){var r=f(ci,32,e),n=r.a,a=r.b,i=f(qa,si(n),t);if(!a.b)return Ya(i);var o=a,u=i;e=o,t=u}}),li=r(function(e,t){return t(e)}),di=hr,hi=function(e){return e.a},pi=r(function(e,t){for(;;){var r=ti(t/32);if(1===r)return f(ci,32,e).a;var n=f(fi,e,mr),a=r;e=n,t=a}}),gi=xr,vi=r(function(e,t){return _(e,t)>0?e:t}),yi=Ir,mi=wr,bi=m,Ci=r(function(e,t){if(t.nodeListSize){var r=32*t.nodeListSize,n=gi(f(ri,32,r-1)),a=e?Ya(t.nodeList):t.nodeList,i=f(pi,a,t.nodeListSize);return d(ei,bi(t.tail)+r,f(vi,5,n*ai),i,t.tail)}return d(ei,bi(t.tail),ai,ii,t.tail)}),Si=nr,Ei=i(function(e,t,r,n,a){for(;;){if(t<0)return f(Ci,!1,{nodeList:n,nodeListSize:r/32|0,tail:a});var i=ui(l(Si,32,t,e)),o=e,u=t-32,s=r,c=f(qa,i,n),d=a;e=o,t=u,r=s,n=c,a=d}}),Ti=r(function(e,t){if(e<=0)return oi;var r=e%32,n=l(Si,r,e-r,t);return h(Ei,t,e-r-32,e,mr,n)}),wi=function(e){return{$:"Err",a:e}},Ii=function(e){return{$:"Ok",a:e}},Ai=function(e){return"Ok"===e.$},Bi=r(function(e,t){return{$:"Failure",a:e,b:t}}),ki=r(function(e,t){return{$:"Field",a:e,b:t}}),Ni=r(function(e,t){return{$:"Index",a:e,b:t}}),Ri=function(e){return{$:"OneOf",a:e}},$i=yr,xi=j,_i=function(e){var t=xi(e);return 97<=t&&t<=122},Li=function(e){var t=xi(e);return t<=90&&65<=t},Pi=function(e){return _i(e)||Li(e)},Di=function(e){var t=xi(e);return t<=57&&48<=t},Ui=function(e){return _i(e)||Li(e)||Di(e)},Oi=function(e){return l(za,r(function(e,t){return t+1}),0,e)},Mi=Cr,Fi=n(function(e,t,r){for(;;){if(!(_(e,t)<1))return r;var n=e,a=t-1,i=f(qa,t,r);e=n,t=a,r=i}}),Vi=r(function(e,t){return l(Fi,e,t,mr)}),Ki=r(function(e,t){return l(Mi,e,f(Vi,0,Oi(t)-1),t)}),Hi=Kr,ji=Z,qi=r(function(e,t){return f(Fr,e,V(t))}),Gi=z,zi=r(function(e,t){return F(f(Mr,e,t))}),Yi=function(e){return f(qi,"\n ",f(zi,"\n",e))},Wi=on,Ji=r(function(e,t){return"\n\n("+ji(e+1)+") "+Yi(Qi(t))}),Qi=function(e){return f(Xi,e,mr)},Xi=r(function(e,t){e:for(;;)switch(e.$){case"Field":var r=e.a,n=e.b,a=function(){var e=Gi(r);if("Nothing"===e.$)return!1;var t=e.a,n=t.a,a=t.b;return Pi(n)&&f(Hi,Ui,a)}(),i=a?"."+r:"['"+r+"']",o=n,u=f(qa,i,t);e=o,t=u;continue e;case"Index":var s=e.a,n=e.b,c="["+ji(s)+"]",o=n,u=f(qa,c,t);e=o,t=u;continue e;case"OneOf":var l=e.a;if(l.b){if(l.b.b){var d=function(){return t.b?"The Json.Decode.oneOf at json"+f(qi,"",Ya(t)):"Json.Decode.oneOf"}(),h=d+" failed in the following "+ji(Oi(l))+" ways:";return f(qi,"\n\n",f(qa,h,f(Ki,Ji,l)))}var n=l.a,o=n,u=t;e=o,t=u;continue e}return"Ran into a Json.Decode.oneOf with no possibilities"+function(){return t.b?" at json"+f(qi,"",Ya(t)):"!"}();default:var p=e.a,g=e.b,h=function(){return t.b?"Problem with the value at json"+f(qi,"",Ya(t))+":\n\n ":"Problem with the given value:\n\n"}();return h+(Yi(f(Wi,4,g))+"\n\n")+p}}),Zi=Wr,eo=ze("txIn",Zi),to=function(e){return e},ro=qe("txOut",to),no={$:"Open"},ao=Me,io=ao(mr),oo=a(function(e,t,r,n){return L({agentAddress:t,agentRole:r,userInfo:n,viewPhase:no,web3Context:e},io)}),uo=a(function(e,t,r,n){return{appCmds:n,chainCmd:r,cmd:t,model:e}}),so={$:"None"},co=so,fo=function(e){return d(uo,e,io,co,mr)},lo=function(e){return{$:"GotoRoute",a:e}},ho=function(e){return{$:"AbiDecoder",a:e}},po=r(function(e,t){return{$:"Tape",a:e,b:t}}),go=Y,vo=Vr,yo=r(function(e,t){return e<1?t:l(vo,e,go(t),t)}),mo=yo(64),bo=n(function(e,t,r){return L(f(po,e,mo(t)),r)}),Co=r(function(e,t){return e<1?"":l(vo,0,e,t)}),So=Co(64),Eo=r(function(e,t){if("Ok"===t.$){var r=t.a;return Ii(e(r))}var n=t.a;return wi(n)}),To=function(e){return-e},wo=r(function(e,t){return e<1?"":l(vo,-e,go(t),t)}),Io=function(){var e=function(e){if(!f(Hi,di(D("0")),f(Co,63,e)))return wi("Boolean decode error. "+e+" is not 1 or 0.");switch(f(wo,1,e)){case"0":return Ii(!1);case"1":return Ii(!0);default:return wi("Boolean decode error. "+e+" is not 1 or 0.")}};return ho(function(t){var r=t.a,n=t.b;return f(Eo,f(bo,r,n),e(So(n)))})}(),Ao=jr,Bo=function(e){return f(Ao,"0x",e)||f(Ao,"0X",e)?f(yo,2,e):e},ko=function(e){return e.b},No=r(function(e,t){var r=e.a;return f(Eo,ko,r(function(e){return f(po,e,e)}(Bo(t))))}),Ro=Zr,$o=ie,xo=Jr,_o=ae,Lo=function(e){return f(Ro,function(t){var r=e(t);if("Ok"===r.$){var n=r.a;return _o(n)}var a=r.a;return $o(a)},xo)},Po=f($a,No,Lo),Do=function(e){return{$:"Magnitude",a:e}},Uo=function(e){return{$:"Pos",a:e}},Oo=r(function(e,t){return{$:"BigIntNotNormalised",a:e,b:t}}),Mo=function(e){return{$:"MagnitudeNotNormalised",a:e}},Fo=function(e){e:for(;;){if(e.b){if(e.b.b){var t=e.b,r=t;e=r;continue e}var n=e.a;return ya(n)}return ma}},Vo=function(e){var t=Fo(e);return"Nothing"!==t.$&&t.a<0},Ko=function(e){return{$:"Neg",a:e}},Ho={$:"Zer"},jo=function(e){return!e.b},qo=r(function(e,t){var r=t.a;if(jo(r))return Ho;switch(e.$){case"Zero":return Ho;case"Positive":return Uo(t);default:return Ko(t)}}),Go=r(function(e,t){return f(Oo,e,Mo(t))}),zo=function(e){return f(Ja,r(function(t,r){return e(t)&&jo(r)?mr:f(qa,t,r)}),mr)}(di(0)),Yo=Ar,Wo=-1+f(Yo,10,7),Jo=Wo+1,Qo=r(function(e,t){var r=t.a,n=t.b;return L(e(r),n)}),Xo=function(e){return e<0?f(Qo,Ga(-1),Xo(e+Jo)):L(e/Jo|0,e%Jo)},Zo=r(function(e,t){for(;;){if(t.b){var r=t.a,n=t.b,a=Xo(r+e),i=a.a,o=a.b;return f(qa,o,f(Zo,i,n))}{if(!(_(e,Jo)>0))return F([e]);var u=F([e]);e=0,t=u}}}),eu=function(e){var t=e.a;return Do(zo(f(Zo,0,t)))},tu=r(function(e,t){return l(Ja,r(function(t,r){return f(qa,e(t),r)}),mr,t)}),ru=tu(To),nu={$:"Negative"},au={$:"Positive"},iu={$:"Zero"},ou=function(e){switch(e.$){case"Positive":return nu;case"Negative":return au;default:return iu}},uu=function(e){for(;;){var t=e.a,r=e.b,n=eu(r),a=n.a;if(!Vo(a))return f(qo,t,Do(a));e=f(Go,ou(t),ru(a))}},su=gr,cu=function(e){switch(f(su,e,0).$){case"LT":return nu;case"GT":return au;default:return iu}},fu=function(e){return e<0?-e:e},lu=function(e){return uu(f(Oo,cu(e),Mo(F([fu(e)]))))},du=function(e){e:for(;;)switch(e.$){case"Zer":return 0;case"Pos":if(e.a.a.b){if(e.a.a.b.b){if(e.a.a.b.b.b)break e;var t=e.a.a,r=t.a,n=t.b,a=n.a;return a*f(Yo,10,7)+r}var i=e.a.a,r=i.a;return r}break e;default:break e}return 42},hu=function(e){switch(e.$){case"Zer":return Ho;case"Neg":var t=e.a;return Uo(t);default:return e}},pu=function(e){return{$:"MagnitudePair",a:e}},gu=r(function(e,t){var r=L(e,t);if(r.a.b){if(r.b.b){var n=r.a,a=n.a,i=n.b,o=r.b,u=o.a,s=o.b;return f(qa,L(a,u),f(gu,i,s))}var c=r.a,a=c.a,i=c.b;return f(qa,L(a,0),f(gu,i,mr))}if(r.b.b){var l=r.b,u=l.a,s=l.b;return f(qa,L(0,u),f(gu,mr,s))}return mr}),vu=r(function(e,t){var r=e.a,n=t.a;return pu(f(gu,r,n))}),yu=function(e){switch(e.$){case"Zer":return f(Go,iu,mr);case"Neg":var t=e.a.a;return f(Go,au,ru(t));default:var t=e.a.a;return f(Go,au,t)}},mu=r(function(e,t){var r=yu(t),n=r.b,a=yu(e),i=a.b,o=f(vu,i,n),u=o.a,s=f(tu,function(e){return e.a+e.b},u);return uu(f(Oo,au,Mo(s)))}),bu=a(function(e,t,r,n){e:for(;;){var a=L(r,n);if(a.a.b){if(a.b.b){var i=a.a,o=i.a,u=i.b,s=a.b,c=s.a,l=s.b;if($(o,c)){var d=e,h=t,p=u,g=l;e=d,t=h,r=p,n=g;continue e}var d=o,h=c,p=u,g=l;e=d,t=h,r=p,n=g;continue e}return Fa}return a.b.b?Da:f(su,e,t)}}),Cu=function(e){switch(e.$){case"LT":return Fa;case"EQ":return Pa;default:return Da}},Su=r(function(e,t){var r=L(e,t);switch(r.a.$){case"Pos":if("Pos"===r.b.$){var n=r.a.a.a,a=r.b.a.a;return d(bu,0,0,n,a)}return Fa;case"Neg":if("Neg"===r.b.$){var n=r.a.a.a,a=r.b.a.a;return Cu(d(bu,0,0,n,a))}return Da;default:switch(r.b.$){case"Pos":r.a;return Da;case"Zer":r.a,r.b;return Pa;default:r.a;return Fa}}}),Eu=r(function(e,t){return $(f(Su,e,t),Fa)}),Tu=H,wu=r(function(e,t){return!f(Eu,e,t)}),Iu=function(e){switch(e.$){case"Zer":return Do(mr);case"Pos":default:var t=e.a;return t}},Au=r(function(e,t){var r=e.a;return eu(Mo(f(tu,yi(t),r)))}),Bu=r(function(e,t){var r=e.a,n=t.a;if(r.b){if(r.b.b){var a=r.a,i=r.b,o=f(Au,Do(n),a),u=f(Bu,Do(i),Do(n)),s=u.a,c=f(mu,f(qo,au,o),f(qo,au,Do(f(qa,0,s))));return Iu(c)}var a=r.a;return f(Au,Do(n),a)}return Do(mr)}),ku=function(e){switch(e.$){case"Zer":return iu;case"Pos":return au;default:return nu}},Nu=r(function(e,t){return $(e,iu)||$(t,iu)?iu:$(e,t)?au:nu}),Ru=r(function(e,t){return f(qo,f(Nu,ku(e),ku(t)),f(Bu,Iu(e),Iu(t)))}),$u=function(e){switch(e.$){case"Zer":return Ho;case"Pos":var t=e.a;return Ko(t);default:var t=e.a;return Uo(t)}},xu=r(function(e,t){return f(mu,e,$u(t))}),_u=lu(0),Lu=a(function(e,t,r,n){if(e){var a=lu(e),i=f(Ru,f(Ru,a,n),t),o=f(wu,i,r)?L(f(Ru,a,t),f(xu,r,i)):L(_u,r),u=o.a,s=o.b,c=d(Lu,e/2|0,t,s,n),l=c.a,h=c.b;return L(f(mu,u,l),h)}return L(_u,r)}),Pu=ti(f(ri,2,Wo)),Du=n(function(e,t,r){return d(Lu,f(Yo,2,Pu),e,t,r)}),Uu=lu(1),Ou=r(function(e,t){return e}),Mu=n(function(e,t,r){return l(za,Ou(e),t,f(Vi,1,r))}),Fu=function(e){return l(Mu,Ru(lu(Jo)),Uu,e)},Vu=n(function(e,t,r){if(e){var n=l(Du,Fu(e),t,r),a=n.a,i=n.b,o=l(Vu,e-1,i,r),u=o.a,s=o.b;return L(f(mu,a,u),s)}return l(Du,Fu(e),t,r)}),Ku=function(e){switch(e.$){case"Zer":return mr;case"Pos":default:var t=e.a.a;return t}},Hu=r(function(e,t){if($(t,_u))return ma;var r=Oi(Ku(e))-Oi(Ku(t))+1,n=l(Vu,f(vi,0,r),hu(e),hu(t)),a=n.a,i=n.b;return ya(L(f(qo,f(Nu,ku(e),ku(t)),Iu(a)),f(qo,ku(e),Iu(i))))}),ju=f(Ru,lu(2),lu(2147483648)),qu=Pr,Gu=function(e){return f(qu,e,"")},zu=Sn,Yu=n(function(e,t,r){return e<=0?r:l(Yu,e>>1,O(t,t),1&e?O(r,t):r)}),Wu=r(function(e,t){return l(Yu,e,t,"")}),Ju=n(function(e,t,r){return O(f(Wu,e-go(r),Gu(t)),r)}),Qu=re,Xu=Br,Zu=function(e){e:for(;;)switch(e){case 0:return D("0");case 1:return D("1");case 2:return D("2");case 3:return D("3");case 4:return D("4");case 5:return D("5");case 6:return D("6");case 7:return D("7");case 8:return D("8");case 9:return D("9");case 10:return D("a");case 11:return D("b");case 12:return D("c");case 13:return D("d");case 14:return D("e");case 15:return D("f");default:var t=e;e=t;continue e}},es=r(function(e,t){for(;;){if(t<16)return f(qa,Zu(t),e);var r=f(qa,Zu(f(Xu,16,t)),e),n=t/16|0;e=r,t=n}}),ts=function(e){return Qu(e<0?f(qa,D("-"),f(es,mr,-e)):f(es,mr,e))},rs=function(e){var t=f(Hu,e,ju);if("Nothing"===t.$)return"Failure converting BigInt to hex string. Should be impossible. Open up issue on the elm-bigint repo.";var r=t.a,n=r.a,a=r.b,i=ts(du(a));return $(n,lu(0))?i:O(rs(n),l(Ju,8,D("0"),i))},ns=function(e){switch(e.$){case"Zer":return"0";case"Pos":var t=e.a;return $(t,Do(mr))?"0":rs(Uo(t));default:var t=e.a;return"-"+ns(f(Ru,lu(-1),e))}},as=function(e){return l(Ju,64,D("0"),e)},is=function(e){var t=r(function(e,t){var r=e.a,n=e.b,a=t.a,i=t.b,o=t.c;if("Just"===r.$){var u=r.a,s=as(ts(a)),c=function(e){return O(e,n)}(as(ts(u)));return P(a+32+(go(n)/2|0),O(i,s),O(o,c))}return P(a,O(i,n),o)});return function(e){return O(e.b,e.c)}(l(za,t,P(32*Oi(e),"",""),e))},os=Ur,us=n(function(e,t,r){return t<128?f(e,t,r):t<2048?f(e,128|63&t,f(e,192|t>>>6,r)):t<65536?f(e,128|63&t,f(e,128|63&t>>>6,f(e,224|t>>>12,r))):f(e,128|63&t,f(e,128|63&t>>>6,f(e,128|63&t>>>12,f(e,240|t>>>18,r))))}),ss=n(function(e,t,n){return l(os,r(function(t,r){return l(us,e,xi(t),r)}),t,n)}),cs=function(e){return Ya(l(ss,qa,mr,e))},fs=function(e){return f(qi,"",f(tu,f($a,ts,f(Ju,2,D("0"))),cs(e)))},ls=function(e){return 64-f(Xu,64,e)},ds=function(e){return O(e,f(Wu,ls(go(e)),"0"))},hs=function(e){return L(ya(go(e)/2|0),ds(e))},ps=function(e){return L(ma,as(e))},gs=function(e){switch(e){case"0000":return D("0");case"0001":return D("1");case"0010":return D("2");case"0011":return D("3");case"0100":return D("4");case"0101":return D("5");case"0110":return D("6");case"0111":return D("7");case"1000":return D("8");case"1001":return D("9");case"1010":return D("a");case"1011":return D("b");case"1100":return D("c");case"1101":return D("d");case"1110":return D("e");case"1111":return D("f");default:return D("!")}},vs=function(e){switch(e.valueOf()){case"0":return"0000";case"1":return"0001";case"2":return"0010";case"3":return"0011";case"4":return"0100";case"5":return"0101";case"6":return"0110";case"7":return"0111";case"8":return"1000";case"9":return"1001";case"a":return"1010";case"b":return"1011";case"c":return"1100";case"d":return"1101";case"e":return"1110";case"f":return"1111";default:return"error converting hex to binary"}},ys=Or,ms=function(e){var t=r(function(e,t){var r=t.a,n=t.b,a=L(e,n);e:for(;;)if(a.b)switch(a.a.valueOf()){case"0":return L(f(qu,D("1"),r),!0);case"1":return L(f(qu,D("0"),r),!0);default:break e}else switch(a.a.valueOf()){case"0":return L(f(qu,D("0"),r),!1);case"1":return L(f(qu,D("1"),r),!0);default:break e}return L(r,!0)});return l(ys,t,L("",!1),e).a},bs=function(e){return l(ys,qa,mr,e)},Cs=n(function(e,t,r){for(;;){if(""===t)return Ya(r);var n=e,a=f(yo,e,t),i=f(qa,l(vo,0,e,t),r);e=n,t=a,r=i}}),Ss=r(function(e,t){return e&&""!==t?l(Cs,e,t,mr):F([t])}),Es=function(e){var t=function(){var t=bs(ns(e));if(t.b&&"-"===t.a.valueOf()){var r=t.b;return L(r,f($a,ms,f(Ju,256,D("1"))))}var r=t;return L(r,f(Ju,256,D("0")))}(),r=t.a,n=t.b;return Qu(f(tu,gs,f(Ss,4,n(f(qi,"",f(tu,vs,r))))))},Ts=function(e){return{$:"Hex",a:e}},ws=function(e){switch(e.$){case"AddressE":var t=e.a.a;return ps(t);case"UintE":var r=e.a;return ps(ns(r));case"IntE":var n=e.a;return ps(Es(n));case"BoolE":return ps(e.a?"1":"0");case"DBytesE":var a=e.a.a;return hs(a);case"BytesE":var a=e.a.a;return ps(Bo(a));case"StringE":var i=e.a;return hs(fs(i));case"ListE":var o=e.a;return function(e){var t=e.a;return hs(t)}(Zt()(o));default:var i=e.a;return ps(Bo(i))}};try{var Is=Zt();Zt=function(){return Is}}catch(e){throw"Some top-level definitions from `Abi.Encode` are causing infinite recursion:\n\n ┌─────┐\n │ abiEncodeList\n │ ↓\n │ lowLevelEncode\n └─────┘\n\nThese errors are very tricky, so read https://elm-lang.org/0.19.0/halting-problem to learn how to fix it!"}var As=Dr,Bs=function(e){return 1===go(e)?f(As,"0",e):e},ks=n(function(e,t,r){for(;;){if(e<=0)return r;{if(!t.b)return r;var n=t.a,a=t.b,i=e-1,o=a,u=f(qa,n,r);e=i,t=o,r=u}}}),Ns=r(function(e,t){return Ya(l(ks,e,t,mr))}),Rs=n(function(e,t,r){if(t<=0)return mr;var n=L(t,r);e:for(;;){t:for(;;){if(!n.b.b)return r;if(!n.b.b.b){if(1===n.a)break e;break t}switch(n.a){case 1:break e;case 2:var a=n.b,i=a.a,o=a.b,u=o.a;return F([i,u]);case 3:if(n.b.b.b.b){var s=n.b,i=s.a,c=s.b,u=c.a,d=c.b,h=d.a;return F([i,u,h])}break t;default:if(n.b.b.b.b&&n.b.b.b.b.b){var p=n.b,i=p.a,g=p.b,u=g.a,v=g.b,h=v.a,y=v.b,m=y.a,b=y.b;return e>1e3?f(qa,i,f(qa,u,f(qa,h,f(qa,m,f(Ns,t-4,b))))):f(qa,i,f(qa,u,f(qa,h,f(qa,m,l(Rs,e+1,t-4,b)))))}break t}}return r}var C=n.b,i=C.a;return F([i])}),$s=r(function(e,t){return l(Rs,0,e,t)}),xs=function(e){return{$:"KC",a:e}}({capacity:512,delSuffix:1,outputLen:32,rate:1088}),_s=function(e){switch(e.$){case"I8":return 1;case"I16":return 2;case"I32":return 4;case"U8":return 1;case"U16":return 2;case"U32":case"F32":return 4;case"F64":return 8;case"Seq":case"Utf8":var t=e.a;return t;default:return Qe(e.a)}},Ls={$:"LE"},Ps=n(function(e,t,r){switch(e.$){case"I8":var n=e.a;return l(Tn,t,r,n);case"I16":var a=e.a,n=e.b;return d(wn,t,r,n,$(a,Ls));case"I32":var a=e.a,n=e.b;return d(In,t,r,n,$(a,Ls));case"U8":var n=e.a;return l(An,t,r,n);case"U16":var a=e.a,n=e.b;return d(Bn,t,r,n,$(a,Ls));case"U32":var a=e.a,n=e.b;return d(kn,t,r,n,$(a,Ls));case"F32":var a=e.a,n=e.b;return d(Nn,t,r,n,$(a,Ls));case"F64":var a=e.a,n=e.b;return d(Rn,t,r,n,$(a,Ls));case"Seq":var i=e.b;return l(Ds,i,t,r);case"Utf8":var o=e.b;return l(xn,t,r,o);default:var i=e.a;return l($n,t,r,i)}}),Ds=n(function(e,t,r){for(;;){if(!e.b)return r;var n=e.a,a=e.b,i=a,o=t,u=l(Ps,n,t,r);e=i,t=o,r=u}}),Us=Xe,Os=r(function(e,t){return{$:"Seq",a:e,b:t}}),Ms=r(function(e,t){for(;;){if(!t.b)return e;var r=t.a,n=t.b,a=e+_s(r),i=n;e=a,t=i}}),Fs=function(e){return f(Os,f(Ms,0,e),e)},Vs=function(e){return{$:"U8",a:e}},Ks=Vs,Hs=r(function(e,t){return _(e,t)<0?e:t}),js=pr,qs=function(e){return{$:"Bytes",a:e}},Gs=qs,zs=function(e){return Us(Fs(f(tu,Gs,Ya(e))))},Ys=Qe,Ws=r(function(e,t){var r=e.a;return f(_n,r,t)}),Js=function(e){return{$:"Decoder",a:e}},Qs=a(function(e,t,r,n){for(;;){var a=t(e),i=a.a,o=f(i,r,n),u=o.a,s=o.b;if("Loop"!==s.$){return L(u,s.a)}var c=s.a,l=c,d=t,h=r,p=u;e=l,t=d,r=h,n=p}}),Xs=r(function(e,t){return Js(f(Qs,e,t))}),Zs=Js(Ln),ec=r(function(e,t){if("Just"===t.$){return t.a}return e}),tc=function(e){return{$:"Done",a:e}},rc=function(e){return{$:"Loop",a:e}},nc=r(function(e,t){var n=t.a;return Js(r(function(t,r){var a=f(n,t,r),i=a.a,o=a.b;return L(i,e(o))}))}),ac=function(e){return Js(r(function(t,r){return L(r,e)}))},ic=r(function(e,t){var r=t.a,n=t.b;return r<=0?ac(tc(Ya(n))):f(nc,function(e){return rc(L(r-1,f(qa,e,n)))},e)}),oc=function(e){return f(ec,mr,f(Ws,f(Xs,L(Ys(e),mr),ic(Zs)),e))},uc=n(function(e,t,r){var n=t.a,a=t.b,i=r.a,o=r.b;return L(f(e,n,i),f(e,a,o))}),sc=r(function(e,t){return l(uc,zu,e,t)}),cc=f(Vi,0,4),fc=r(function(e,t){var r=t.d0,n=t.d1,a=t.d2,i=t.d3,o=t.d4;switch(e){case 0:return r;case 1:return n;case 2:return a;case 3:return i;default:return o}}),lc=Je,dc=r(function(e,t){var r=t.a,n=t.b;return L(e(r),e(n))}),hc=function(e){return f(dc,f($a,lc,zu(4294967295)),e)},pc=r(function(e,t){return 5*t+e}),gc=4294967295>>>32-ai,vc=ir,yc=n(function(e,t,r){for(;;){var n=gc&t>>>e,a=f(vc,n,r);if("SubTree"!==a.$){var i=a.a;return f(vc,gc&t,i)}var o=a.a,u=e-ai,s=t,c=o;e=u,t=s,r=c}}),mc=function(e){return e>>>5<<5},bc=r(function(e,t){var r=t.a,n=t.b,a=t.c,i=t.d;return e<0||_(e,r)>-1?ma:ya(_(e,mc(r))>-1?f(vc,gc&e,i):l(yc,n,e,a))}),Cc=r(function(e,t){var r=f(bc,e,t);if("Just"===r.$){return r.a}return L(0,0)}),Sc=n(function(e,t,r){var n=f(pc,e,t);return f(Cc,n,r)}),Ec=or,Tc=a(function(e,t,r,n){var a=gc&t>>>e,i=f(vc,a,n);if("SubTree"===i.$){var o=i.a,u=d(Tc,e-ai,t,r,o);return l(Ec,a,si(u),n)}var s=i.a,c=l(Ec,gc&t,r,s);return l(Ec,a,ui(c),n)}),wc=n(function(e,t,r){var n=r.a,a=r.b,i=r.c,o=r.d;return e<0||_(e,n)>-1?r:_(e,mc(n))>-1?d(ei,n,a,i,l(Ec,gc&e,t,o)):d(ei,n,a,d(Tc,a,e,t,i),o)}),Ic=n(function(e,t,r){return l(wc,e,t,r)}),Ac=a(function(e,t,r,n){var a=f(pc,e,t);return l(Ic,a,r,n)}),Bc=En,kc=r(function(e,t){return l(uc,Bc,e,t)}),Nc=function(e){var t=l(Ja,r(function(t,n){var a={d0:l(Sc,0,t,e.state),d1:l(Sc,1,t,e.state),d2:l(Sc,2,t,e.state),d3:l(Sc,3,t,e.state),d4:l(Sc,4,t,e.state)},i=r(function(e,r){return d(Ac,e,t,f(kc,f(fc,e,a),f(sc,hc(f(fc,f(Xu,5,e+1),a)),f(fc,f(Xu,5,e+2),a))),r)});return f(i,4,f(i,3,f(i,2,f(i,1,f(i,0,n)))))}),e.state,cc);return U(e,{state:t})},Rc=L(0,0),$c=function(e){return{current:Rc,lfsrstate:1,state:e,x:1,y:0}},xc=function(e){var t=1&e;return 128&e?L(t,e<<1^113):L(t,e<<1)},_c=L(1,0),Lc=r(function(e,t){var r=t.a,n=t.b;return e?L(n,r):L(r,n)}),Pc=r(function(e,t){if(e){var n=f(Lc,1,t);return l(uc,r(function(t,r){return 4294967295&(t<>>32-e)}),t,n)}return t}),Dc=r(function(e,t){var r=f(Xu,32,e/32|0),n=f(Lc,r,t),a=f(Xu,32,e);return f(Pc,a,n)}),Uc=n(function(e,t,r){var n=f(bc,e,r);if("Nothing"===n.$)return r;var a=n.a;return l(wc,e,t(a),r)}),Oc=n(function(e,t,r){return l(Uc,e,kc(t),r)}),Mc=a(function(e,t,r,n){var a=f(pc,e,t);return l(Oc,a,r,n)}),Fc=function(e){return l(za,r(function(e,t){var r=(1<>r}),Yc=n(function(e,t,r){return t?L(0,r<0))return t;var a=f(Hs,n,r),i=f(tu,function(e){return f(zc,e,g)},f(Vi,0,a)),o=Gc(e),u=O(t,i),s=n-a;e=o,t=u,n=s}});return f($s,i.outputLen,l(v,g,mr,i.outputLen))},Xc=function(e){return{$:"KS",a:e}},Zc=function(e){var t=e.a;return Xc({config:t,inputLength:0,partial:mr,state:f(Ti,25,Ou(Rc))})},ef=function(e){return Js(Pn(e))},tf=Us(Fs(mr)),rf=r(function(e,t){var n=t.a;return Js(r(function(t,r){var a=f(n,t,r),i=a.a,o=a.b;return f(e(o).a,t,i)}))}),nf=r(function(e,t){return f(rf,function(e){return ef(t)},ef(e))}),af=r(function(e,t){return f(ec,tf,f(Ws,f(nf,e,Ys(t)-e),t))}),of=r(function(e,t){for(;;){var n=t.a,a=n.config.rate/8|0,i=Ys(e)?f(qa,e,n.partial):n.partial;if(!(_(l(za,r(function(e,t){return t+Ys(e)}),0,i),a)>-1))return Xc(U(n,{inputLength:Ys(e)+n.inputLength,partial:i}));var o=zs(i),u=f(ec,tf,f(Ws,ef(a),o)),s=oc(u),c=f(Jc,s,n.state),d=Gc(c),h=f(af,a,o),p=tf,g=Xc(U(n,{inputLength:Ys(e)+n.inputLength,partial:F([h]),state:d}));e=p,t=g}}),uf=r(function(e,t){return Qc(f(of,Us(Fs(f(tu,Ks,t))),Zc(e)))}),sf=uf(xs),cf=function(e){return Ts(f(qi,"",f(tu,f($a,ts,Bs),f($s,4,sf(f(tu,xi,bs(e)))))))},ff=function(e){return f(Ao,"0x",e)||f(Ao,"0X",e)?e:"0x"+e},lf=function(e){var t=e.a;return ff(t)},df=r(function(e,t){var r=is(f(tu,ws,t)),n=function(e){return O(e,r)}(Bo(lf(cf(e))));return Ts(n)}),hf=function(e){return{data:ya(f(df,"poke()",mr)),decoder:Po(Io),from:ma,gas:ma,gasPrice:ma,nonce:ma,to:ya(e),value:ma}},pf=r(function(e,t){return{$:"CustomSend",a:e,b:t}}),gf=r(function(e,t){return f(pf,e,t)}),vf=r(function(e,t){return{$:"AgentHistory",a:e,b:t}}),yf=function(e){return{$:"Trade",a:e}},mf=function(e){return{data:e.data,from:e.from,gas:e.gas,gasPrice:e.gasPrice,nonce:e.nonce,to:e.to,value:e.value}},bf=r(function(e,t){switch(e.$){case"ViewUserRoleChanged":var r=e.a;return d(uo,t,io,co,F([lo(f(vf,t.agentAddress,r))]));case"ViewPhaseChanged":var n=e.a;return d(uo,U(t,{viewPhase:n}),io,co,mr);case"Poke":var a=e.a,i=mf(hf(a)),o={onBroadcast:ma,onMined:ma,onSign:ma},u=f(gf,o,i);return d(uo,t,io,u,mr);case"TradeClicked":var s=e.a;return d(uo,t,io,co,F([lo(yf(s))]));default:return fo(t)}}),Cf=function(e){return{$:"GTag",a:e}},Sf=function(e){return{$:"UserNotice",a:e}},Ef={$:"Web3Connect"},Tf=n(function(e,t,r){return{align:r,mainParagraphs:t,noticeType:e}}),wf=n(function(e,t,r){return e(t(r))}),If=en,Af=tn,Bf=function(e){switch(e.$){case"Normal":return 0;case"MayStopPropagation":return 1;case"MayPreventDefault":return 2;default:return 3}},kf=Vn,Nf={$:"Empty"},Rf=function(e){return{$:"Styled",a:e}},$f=function(e){return{$:"Text",a:e}},xf=function(e){return{$:"Unstyled",a:e}},_f=r(function(e,t){switch(t.$){case"Styled":var n=t.a;return Rf({html:r(function(t,r){return f(kf,e,f(n.html,t,r))}),styles:n.styles});case"Unstyled":var a=t.a;return xf(f(wf,kf(e),a));case"Text":var i=t.a;return $f(i);default:return Nf}}),Lf=_f,Pf=r(function(e,t){return l(Tf,t.noticeType,f(tu,tu(Lf(e)),t.mainParagraphs),t.align)}),Df=r(function(e,t){switch(t.$){case"UserNotice":var r=t.a;return Sf(f(Pf,e,r));case"Web3Connect":return Ef;case"GotoRoute":var n=t.a;return lo(n);default:var a=t.a;return Cf(a)}}),Uf=r(function(e,t){return f(tu,Df(e),t)}),Of={$:"Seller"},Mf=function(e){return{$:"Posix",a:e}},Ff=Mf,Vf={autoabortInterval:Ff(0),autorecallInterval:Ff(0),autoreleaseInterval:Ff(0),daiAmount:"",fiatAmount:"",fiatType:"USD",paymentMethod:"",userRole:Of},Kf=function(e){return{$:"TokenValue",a:e}},Hf=function(e){return e.a},jf=r(function(e,t){if("Just"===t.$){var r=t.a;return ya(e(r))}return ma}),qf=r(function(e,t){return f(ec,_u,f(jf,hi,f(Hu,e,t)))}),Gf=r(function(e,t){return Kf(f(qf,Hf(e),lu(t)))}),zf=function(e){return f(Gf,e,12)},Yf=function(e){return f(Gf,e,3)},Wf=Kf(lu(0)),Jf=r(function(e,t){var r=Wf;return{abortPunishment:zf(t.tradeAmount),autoabortInterval:t.autoabortInterval,autorecallInterval:t.autorecallInterval,autoreleaseInterval:t.autoreleaseInterval,buyerDeposit:Yf(t.tradeAmount),initiatorAddress:e.address,initiatorCommPubkey:e.commPubkey,initiatorRole:t.initiatorRole,paymentMethods:t.paymentMethods,pokeReward:r,price:t.price,tradeAmount:t.tradeAmount}}),Qf=function(e){if("Token"===e.$){if("EthDai"===e.a.$){e.a;return"Dai"}e.a;return"Dai"}switch(e.a.$){case"Eth":e.a;return"ETH";case"Kovan":e.a;return"ETH";default:e.a;return"xDai"}},Xf=function(e){if(e.b){var t=e.a;e.b;return ya(t)}return ma},Zf=Gr,el=function(e){var t=Xf(f(Zf,".",e));if("Nothing"===t.$)return L(e,0);var r=t.a,n=go(e)-1-r;return L(O(f(Co,r,e),f(yo,r+1,e)),n)},tl=r(function(e,t){e:for(;;){if(t.b){var r=t.a,n=t.b;if(e(r)){var a=e,i=n;e=a,t=i;continue e}return t}return mr}}),rl=function(e){var t=e.a,r=f(tl,di(0),t);return Do(r.b?t:mr)},nl=ee,al=r(function(e,t){for(;;){if(e<=0)return t;{if(!t.b)return t;var r=(t.a,t.b),n=e-1,a=r;e=n,t=a}}}),il=n(function(e,t,r){var n=f(al,t,r),a=Oi(r)>0;return e>0&&t>0&&a?f(qa,f($s,e,r),l(il,e,t,n)):mr}),ol=r(function(e,t){return l(il,e,e,t)}),ul=function(e){var t=r(function(t,r){var n=e(t);if("Nothing"===n.$)return ma;var a=n.a;return f(jf,qa(a),r)});return f(Ja,t,ya(mr))}(to),sl=function(e){return f(jf,f(wf,rl,Do),ul(f(tu,f($a,Ya,f($a,Qu,nl)),f(ol,7,Ya(e)))))},cl=X,fl=function(e){var t=bs(cl(e));if(!t.b)return ma;switch(t.a.valueOf()){case"-":if(t.b.b){var r=t.b;return f(jf,qo(nu),sl(r))}return ma;case"+":if(t.b.b){var r=t.b;return f(jf,qo(au),sl(r))}return ma;default:var r=t;return f(jf,qo(au),sl(r))}},ll=function(e){var t=function(e){return!f(Xu,2,e)};switch(e.$){case"Zer":return!0;case"Pos":default:var r=e.a.a;return t(f(ec,0,Xf(r)))}},dl=function(e){return f(Ru,e,e)},hl=lu(2),pl=n(function(e,t,r){e:for(;;)switch(r.$){case"Zer":return Uu;case"Neg":return Ho;default:if($(r,Uu))return f(Ru,e,t);if(ll(r)){var n=e,a=dl(t),i=f(qf,r,hl);e=n,t=a,r=i;continue e}var n=f(Ru,t,e),a=dl(t),i=f(qf,f(xu,r,Uu),hl);e=n,t=a,r=i;continue e}}),gl=r(function(e,t){return l(pl,Uu,e,t)}),vl=function(e){if(""===e)return ma;var t=el(e),r=t.a,n=t.b,a=fl(r),i=18-n;if(i<0)return ma;if("Nothing"===a.$)return ma;var o=a.a,u=f(Ru,o,f(gl,lu(10),lu(i)));return ya(u)},yl=function(e){return f(jf,Kf,vl(e))},ml=qr,bl=function(e){for(;;){if(f(ml,".",e))return l(vo,0,-1,e);{if(!f(ml,"0",e))return""===e?"0":e;e=l(vo,0,-1,e)}}},Cl=f(wf,f(Ju,7,D("0")),ji),Sl=function(e){return f(qi,"",e)},El=function(e){var t=e.a,r=Ya(t);if(r.b){var n=r.a,a=r.b;return Sl(f(qa,ji(n),f(tu,Cl,a)))}return"0"},Tl=function(e){switch(e.$){case"Zer":return"0";case"Pos":var t=e.a;return El(t);default:var t=e.a;return"-"+El(t)}},wl=r(function(e,t){return e<1?t:l(vo,0,-e,t)}),Il=function(e){var t=l(Ju,18,D("0"),Tl(e)),r=f(wl,18,t)+"."+f(wo,18,t);return function(e){return""===e?"0":e}(bl(r))},Al=r(function(e,t){var r=Il(t),n=Xf(f(Zf,".",r));if("Nothing"===n.$)return r;var a=n.a;return e?f(Co,a+1+e,r):f(Co,a,r)}),Bl=r(function(e,t){if("Nothing"===e.$)return Il(Hf(t));var r=e.a;return f(Al,r,Hf(t))}),kl=dr,Nl=te,Rl=function(e){var t=Nl(f(Bl,ma,e));if("Just"===t.$){return t.a}f(kl,"Error converting tokenValue to float: string -> float failed",e);return 0},$l=r(function(e,t){if(""===t)return wi("You must specify a trade amount.");var r=yl(t);if("Nothing"===r.$)return wi("I don't understand this number.");var n=r.a;return Rl(n)<1?wi("Trade amount must be a least 1 "+Qf(e)+"."):Ii(n)}),xl=function(e){if(""===e)return wi("You must specify a fiat price.");var t=fl(e);if("Nothing"===t.$){var r=Nl(e);return wi("Just"===r.$?"Fractional fiat amounts (i.e. $1.20) are not supported. Use a whole number.":"I don't understand this number.")}var n=t.a;return Ii(n)},_l=r(function(e,t){if("Just"===t.$){var r=t.a;return Ii(r)}return wi(e)}),Ll=function(e){return""===e},Pl=function(e){return Ll(e)?ma:ya(e)},Dl=function(e){return f(_l,"You must specify a fiat type.",Pl(e))},Ul=function(e){return""===e?wi("Must specify a payment method."):Ii(e)},Ol=u(function(e,t,r,n,a,i,o){return{autoabortInterval:i,autorecallInterval:a,autoreleaseInterval:o,daiAmount:e,fiatAmount:t,fiatType:r,paymentMethod:n}}),Ml=g(Ol,ma,ma,ma,ma,ma,ma,ma),Fl=function(e){var t=e.a,r=e.b,n=e.c,a=P(t,r,n);if("Ok"===a.a.$){if("Ok"===a.b.$){if("Ok"===a.c.$){var i=a.a.a,o=a.b.a,u=a.c.a;return Ii(P(i,o,u))}var s=a.c.a;return wi(s)}var c=a.b.a;return wi(c)}var f=a.a.a;return wi(f)},Vl=a(function(e,t,r,n){var a=n.a,i=n.b,o=n.c;return P(e(a),t(i),r(o))}),Kl={$:"Custom"},Hl=r(function(e,t){return{info:t,type_:e}}),jl=o(function(e,t,r,n,a,i){if("Err"===t.$){var o=t.a;return wi(o)}var u=t.a;if("Err"===r.$){var o=r.a;return wi(o)}var s=r.a;if("Err"===n.$){var o=n.a;return wi(o)}var c=n.a;if("Err"===a.$){var o=a.a;return wi(o)}var f=a.a;if("Err"===i.$){var o=i.a;return wi(o)}var l=i.a;return Ii(h(e,u,s,c,f,l))}),ql=r(function(e,t){if("Ok"===t.$){var r=t.a;return Ii(r)}var n=t.a;return wi(e(n))}),Gl=function(e){return e.a},zl=r(function(e,t){return p(jl,i(function(e,r,n,a,i){var o=i.a;return{autoabortInterval:i.b,autorecallInterval:o,autoreleaseInterval:i.c,initiatorRole:t.userRole,paymentMethods:F([f(Hl,Kl,a)]),price:{amount:r,fiatType:n},tradeAmount:e}}),f(ql,function(e){return U(Ml,{daiAmount:ya(e)})},f($l,e,t.daiAmount)),f(ql,function(e){return U(Ml,{fiatAmount:ya(e)})},xl(t.fiatAmount)),f(ql,function(e){return U(Ml,{fiatType:ya(e)})},Dl(t.fiatType)),f(ql,function(e){return U(Ml,{paymentMethod:ya(e)})},Ul(t.paymentMethod)),Fl(d(Vl,function(e){return Gl(e)>0?Ii(e):wi(U(Ml,{autorecallInterval:ya("Must specify a non-zero time for this window")}))},function(e){return Gl(e)>0?Ii(e):wi(U(Ml,{autoabortInterval:ya("Must specify a non-zero time for this window")}))},function(e){return Gl(e)>0?Ii(e):wi(U(Ml,{autoreleaseInterval:ya("Must specify a non-zero time for this window")}))},P(t.autorecallInterval,t.autoabortInterval,t.autoreleaseInterval))))}),Yl=n(function(e,t,r){if("Nothing"===t.$)return ma;var n=t.a;if("Nothing"===r.$)return ma;var a=r.a;return ya(f(e,n,a))}),Wl=function(e){if("Ok"===e.$){var t=e.a;return ya(t)}return ma},Jl=function(e){var t=f(zl,e.web3Context.factoryType,e.inputs),r=function(){return $(e.errors,Ml)?Ml:"Ok"===t.$?Ml:t.a}();return U(e,{createParameters:l(Yl,Jf,e.userInfo,Wl(t)),errors:r})},Ql=r(function(e,t){return Jl(U(t,{inputs:e}))}),Xl=a(function(e,t,r,n){return{appCmds:n,chainCmd:r,cmd:t,model:e}}),Zl=r(function(e,t){return d(Xl,f(Ql,Vf,{allowance:ma,createParameters:ma,depositAmount:ma,errors:Ml,inputs:Vf,showFiatTypeDropdown:!1,txChainStatus:ma,userInfo:t,web3Context:e}),io,co,mr)}),ed=function(e){return{$:"Address",a:e}},td=f($a,Bo,f($a,cl,ed)),rd=function(e){if("Token"===e.$){if("EthDai"===e.a.$){e.a;return td("0x5677CFbA35a0Db0469d3d56020d556B942E9ce90")}e.a;return td("0xbC69Aff9d93C5EA4a841166C46C68518D02aF818")}switch(e.a.$){case"Eth":e.a;return td("0xD3b1e8F2bDe0a2DdfC9F6e2EB6e2589e5Ba955b6");case"Kovan":e.a;return td("0xA30773FD520cdf845E1a00441aB09cE39B31F676");default:e.a;return td("0x7E370099a7a789dC28810a72381bcd7Be834Ad74")}},nd=function(e){return td("EthDai"===e.$?"0x89d24A6b4CcB1B6fAA2625fE562bDD9a23260359":"0xC4375B7De8af5a38a93548eb8453a498222C4fF2")},ad=function(e){return{$:"AddressE",a:e}},id=ad,od=function(e){return{$:"UintE",a:e}},ud=od,sd=n(function(e,t,r){return{data:ya(f(df,"approve(address,uint256)",F([id(t),ud(r)]))),decoder:Po(Io),from:ma,gas:ma,gasPrice:ma,nonce:ma,to:ya(e),value:ma}}),cd=function(e){return f(Gf,e,200)},fd=r(function(e,t){return Kf(f(mu,Hf(e),Hf(t)))}),ld=function(e){var t=f(Gf,e.tradeAmount,200);return f(fd,e.pokeReward,f(fd,cd(e.tradeAmount),f(fd,t,function(){return"Buyer"===e.initiatorRole.$?Yf(e.tradeAmount):e.tradeAmount}())))},dd=Af(li),hd=n(function(e,t,r){return{id:e,initiator:r,tradeAddress:t}}),pd=a(function(e,t,r,n){return{index:t,match:e,number:r,submatches:n}}),gd=Zn,vd=Xn,yd=function(e){return f(vd,{caseInsensitive:!1,multiline:!1},e)},md=Qn,bd=gd(f(ec,md,yd("^((0[Xx]){1})?[0-9A-Fa-f]{40}$"))),Cd=r(function(e,t){for(;;){if(!t.b)return!1;var r=t.a,n=t.b;if(e(r))return!0;var a=e,i=n;e=a,t=i}}),Sd=r(function(e,t){return!f(Cd,f(wf,Tu,e),t)}),Ed=Sd(to),Td=G,wd=r(function(e,t){if("Ok"===t.$){return t.a}return e}),Id=n(function(e,t,r){if("Err"===t.$){var n=t.a;return wi(n)}var a=t.a;if("Err"===r.$){var n=r.a;return wi(n)}var i=r.a;return Ii(f(e,a,i))}),Ad=f(Ja,Id(qa),Ii(mr)),Bd=function(e){if(e.b){var t=(e.a,e.b);return ya(t)}return ma},kd=n(function(e,t,r){e:for(;;){if(!t.b)return Ii(r);var n=t.a,a=t.b;switch(n.valueOf()){case"0":var i=e-1,o=a,u=r;e=i,t=o,r=u;continue e;case"1":var i=e-1,o=a,u=r+f(Yo,16,e);e=i,t=o,r=u;continue e;case"2":var i=e-1,o=a,u=r+2*f(Yo,16,e);e=i,t=o,r=u;continue e;case"3":var i=e-1,o=a,u=r+3*f(Yo,16,e);e=i,t=o,r=u;continue e;case"4":var i=e-1,o=a,u=r+4*f(Yo,16,e);e=i,t=o,r=u;continue e;case"5":var i=e-1,o=a,u=r+5*f(Yo,16,e);e=i,t=o,r=u;continue e;case"6":var i=e-1,o=a,u=r+6*f(Yo,16,e);e=i,t=o,r=u;continue e;case"7":var i=e-1,o=a,u=r+7*f(Yo,16,e);e=i,t=o,r=u;continue e;case"8":var i=e-1,o=a,u=r+8*f(Yo,16,e);e=i,t=o,r=u;continue e;case"9":var i=e-1,o=a,u=r+9*f(Yo,16,e);e=i,t=o,r=u;continue e;case"a":var i=e-1,o=a,u=r+10*f(Yo,16,e);e=i,t=o,r=u;continue e;case"b":var i=e-1,o=a,u=r+11*f(Yo,16,e);e=i,t=o,r=u;continue e;case"c":var i=e-1,o=a,u=r+12*f(Yo,16,e);e=i,t=o,r=u;continue e;case"d":var i=e-1,o=a,u=r+13*f(Yo,16,e);e=i,t=o,r=u;continue e;case"e":var i=e-1,o=a,u=r+14*f(Yo,16,e);e=i,t=o,r=u;continue e;case"f":var i=e-1,o=a,u=r+15*f(Yo,16,e);e=i,t=o,r=u;continue e;default:var s=n;return wi(Gu(s)+" is not a valid hexadecimal character.")}}}),Nd=function(e){if(Ll(e))return wi("Empty strings are not valid hexadecimal strings.");var t=function(){if(f(Ao,"-",e)){var t=f(ec,mr,Bd(bs(e)));return f(Eo,To,l(kd,Oi(t)-1,t,0))}return l(kd,go(e)-1,bs(e),0)}();return f(ql,function(t){return f(qi," ",F(['"'+e+'"',"is not a valid hexadecimal string because",t]))},t)},Rd=function(e){var t=bs(e);return function(e){return L(t,e)}(f(wd,mr,Ad(f(tu,Nd,f(zi,"",f(qi,"",f(tu,f($a,ts,Bs),f($s,20,sf(f(tu,f($a,Td,xi),t))))))))))},$d=function(e){var t=r(function(e,t){return!(t>=8&&_i(e)||t<8&&Li(e))}),n=Rd(Bo(e)),a=n.a,i=n.b,o=l(Mi,t,a,i);return!!bd(e)&&Ed(o)},xd=gd(f(ec,md,yd("^((0[Xx]){1})?[0-9a-f]{40}$"))),_d=gd(f(ec,md,yd("^((0[Xx]){1})?[0-9A-F]{40}$"))),Ld=function(e){return'"'+e+'"'},Pd=function(e){var t=Bo(e),r=f(Co,24,t),n=f(wo,40,e);return 64===go(t)&&f(Hi,di(D("0")),r)?_d(n)||xd(n)?Ii(ed(n)):$d(n)?Ii(ed(n)):wi("Given address "+Ld(e)+" failed the EIP-55 checksum test."):40!==go(t)?wi("Given address "+Ld(e)+" is not the correct length."):bd(t)?_d(t)||xd(t)?Ii(ed(t)):$d(t)?Ii(ed(t)):wi("Given address "+Ld(e)+" failed the EIP-55 checksum test."):wi("Given address "+Ld(e)+" contains invalid hex characters.")},Dd=ho(function(e){var t=e.a,r=e.b;return f(Eo,f(bo,t,r),Pd(So(r)))}),Ud=r(function(e,t){var r=t.a;return ho(function(t){var n=t.a,a=t.b;return r(f(po,n,f(yo,64*e,a)))})}),Od=Qr,Md=r(function(e,t){return f(Od,"data",Po(f(Ud,e,t)))}),Fd=Xr,Vd=r(function(e,t){return f(Od,"topics",f(Fd,e,Po(t)))}),Kd=function(e){return f(jf,f($a,Ya,f(za,r(function(e,t){return f(mu,lu(e),f(Ru,t,ju))}),_u)),ul(f(tu,f($a,Ya,f($a,Qu,f($a,Nd,Wl))),f(ol,8,Ya(e)))))},Hd=function(e){var t=bs(cl(e));e:for(;;){if(!t.b)return ma;switch(t.a.valueOf()){case"-":if(t.b.b){if("0"===t.b.a.valueOf()&&t.b.b.b&&"x"===t.b.b.a.valueOf()){if(t.b.b.b.b){var r=t.b,n=r.b,a=n.b;return f(jf,Ru(lu(-1)),Kd(a))}var i=t.b;i.b;return ma}var a=t.b;return f(jf,Ru(lu(-1)),Kd(a))}return ma;case"+":if(t.b.b){var a=t.b;return Kd(a)}return ma;case"0":if(t.b.b&&"x"===t.b.a.valueOf()){if(t.b.b.b){var o=t.b,a=o.b;return Kd(a)}t.b;return ma}break e;default:break e}}var a=t;return Kd(a)},jd=ho(function(e){var t=e.a,r=e.b;return f(Eo,f(bo,t,r),f(_l,"Error Decoding Uint into BigInt",Hd(ff(So(r)))))}),qd=f(dd,f(Vd,1,Dd),f(dd,f(Md,1,Dd),f(dd,f(Md,0,jd),_o(hd)))),Gd=me,zd=f($a,lf,Gd),Yd=an,Wd=r(function(e,t){return me(l(za,Ee(e),Ce(),t))}),Jd=function(e){return me(l(za,r(function(e,t){var r=e.a,n=e.b;return l(un,r,n,t)}),Se(),e))},Qd=r(function(e,t){return{address:t.address,blockHash:t.blockHash,blockNumber:t.blockNumber,data:t.data,logIndex:t.logIndex,removed:t.removed,returnData:f(Yd,e,Jd(F([L("data",Gd(t.data)),L("topics",f(Wd,zd,t.topics))]))),topics:t.topics,transactionHash:t.transactionHash,transactionIndex:t.transactionIndex}}),Xd=function(e){var t=e.a;return ff(t)},Zd=r(function(e,t){return l(Ja,r(function(t,r){return e(t)?f(qa,t,r):r}),mr,t)}),eh=r(function(e,t){if("Ok"===t.$){return e(t.a)}var r=t.a;return wi(r)}),th=r(function(e,t){return f(Eo,function(e){return e.id},f(eh,function(e){return f(ql,Qi,f(Qd,qd,e).returnData)},f(_l,"No log found from that factoryAddress in that txReceipt",Xf(f(Zd,function(t){return $(f($a,Xd,cl)(t.address),f($a,Xd,cl)(rd(e)))},t.logs)))))}),rh=n(function(e,t,r){return{data:ya(f(df,"allowance(address,address)",F([id(t),id(r)]))),decoder:Po(jd),from:ma,gas:ma,gasPrice:ma,nonce:ma,to:ya(e),value:ma}}),nh=function(e){switch(e.$){case"BlockNum":var t=e.a;return Gd(ff(ts(t)));case"EarliestBlock":return Gd("earliest");case"LatestBlock":return Gd("latest");default:return Gd("pending")}},ah=f($a,Xd,Gd),ih=f($a,ns,f($a,ff,Gd)),oh=f($a,ts,f($a,ff,Gd)),uh=sn,sh=function(e){return Jd(f(tu,function(e){var t=e.a,r=e.b;return L(t,f(ec,uh,r))},f(Zd,function(e){e.a;return!$(e.b,ma)},e)))},ch=function(e){var t=e.to,r=e.from,n=e.gas,a=e.gasPrice,i=e.value,o=e.data;return sh(F([L("to",f(jf,ah,t)),L("from",f(jf,ah,r)),L("gas",f(jf,oh,n)),L("gasPrice",f(jf,ih,a)),L("value",f(jf,ih,i)),L("data",f(jf,zd,o))]))},fh=function(e){return{$:"BadBody",a:e}},lh=function(e){return{$:"BadStatus",a:e}},dh=function(e){return{$:"BadUrl",a:e}},hh={$:"NetworkError"},ph={$:"Timeout"},gh=nn,vh=r(function(e,t){switch(t.$){case"BadUrl_":var r=t.a;return wi(dh(r));case"Timeout_":return wi(ph);case"NetworkError_":return wi(hh);case"BadStatus_":var n=t.a,a=t.b;return wi(lh(n.statusCode));default:var n=t.a,a=t.b,i=f(gh,f(Od,"result",e),a);if("Ok"===i.$){var o=i.a;return Ii(o)}var u=i.a;return wi(fh(Qi(u)))}}),yh=me,mh=n(function(e,t,r){return Jd(F([L("id",yh(e)),L("jsonrpc",Gd("2.0")),L("method",Gd(t)),L("params",f(Wd,to,r))]))}),bh={$:"RBEmpty_elm_builtin"},Ch=bh,Sh=r(function(e,t){e:for(;;){if("RBEmpty_elm_builtin"===t.$)return ma;var r=t.b,n=t.c,a=t.d,i=t.e,o=f(su,e,r);switch(o.$){case"LT":var u=e,s=a;e=u,t=s;continue e;case"EQ":return ya(n);default:var u=e,s=i;e=u,t=s;continue e}}}),Eh={$:"Black"},Th=i(function(e,t,r,n,a){return{$:"RBNode_elm_builtin",a:e,b:t,c:r,d:n,e:a}}),wh={$:"Red"},Ih=i(function(e,t,r,n,a){if("RBNode_elm_builtin"===a.$&&"Red"===a.a.$){var i=(a.a,a.b),o=a.c,u=a.d,s=a.e;if("RBNode_elm_builtin"===n.$&&"Red"===n.a.$){var c=(n.a,n.b),f=n.c,l=n.d,d=n.e;return h(Th,wh,t,r,h(Th,Eh,c,f,l,d),h(Th,Eh,i,o,u,s))}return h(Th,e,i,o,h(Th,wh,t,r,n,u),s)}if("RBNode_elm_builtin"===n.$&&"Red"===n.a.$&&"RBNode_elm_builtin"===n.d.$&&"Red"===n.d.a.$){var c=(n.a,n.b),f=n.c,p=n.d,g=(p.a,p.b),v=p.c,y=p.d,m=p.e,d=n.e;return h(Th,wh,c,f,h(Th,Eh,g,v,y,m),h(Th,Eh,t,r,d,a))}return h(Th,e,t,r,n,a)}),Ah=n(function(e,t,r){if("RBEmpty_elm_builtin"===r.$)return h(Th,wh,e,t,bh,bh);var n=r.a,a=r.b,i=r.c,o=r.d,u=r.e;switch(f(su,e,a).$){case"LT":return h(Ih,n,a,i,l(Ah,e,t,o),u);case"EQ":return h(Th,n,a,t,o,u);default:return h(Ih,n,a,i,o,l(Ah,e,t,u))}}),Bh=n(function(e,t,r){var n=l(Ah,e,t,r);if("RBNode_elm_builtin"===n.$&&"Red"===n.a.$){var a=(n.a,n.b),i=n.c,o=n.d,u=n.e;return h(Th,Eh,a,i,o,u)}return n}),kh=function(e){for(;;){if("RBNode_elm_builtin"!==e.$||"RBNode_elm_builtin"!==e.d.$)return e;e=e.d}},Nh=function(e){if("RBNode_elm_builtin"===e.$&&"RBNode_elm_builtin"===e.d.$&&"RBNode_elm_builtin"===e.e.$){if("RBNode_elm_builtin"===e.e.d.$&&"Red"===e.e.d.a.$){var t=e.a,r=e.b,n=e.c,a=e.d,i=(a.a,a.b),o=a.c,u=a.d,s=a.e,c=e.e,f=(c.a,c.b),l=c.c,d=c.d,p=(d.a,d.b),g=d.c,v=d.d,y=d.e,m=c.e;return h(Th,wh,p,g,h(Th,Eh,r,n,h(Th,wh,i,o,u,s),v),h(Th,Eh,f,l,y,m))}var t=e.a,r=e.b,n=e.c,b=e.d,i=(b.a,b.b),o=b.c,u=b.d,s=b.e,C=e.e,f=(C.a,C.b),l=C.c,d=C.d,m=C.e;return t.$,h(Th,Eh,r,n,h(Th,wh,i,o,u,s),h(Th,wh,f,l,d,m))}return e},Rh=function(e){if("RBNode_elm_builtin"===e.$&&"RBNode_elm_builtin"===e.d.$&&"RBNode_elm_builtin"===e.e.$){if("RBNode_elm_builtin"===e.d.d.$&&"Red"===e.d.d.a.$){var t=e.a,r=e.b,n=e.c,a=e.d,i=(a.a,a.b),o=a.c,u=a.d,s=(u.a,u.b),c=u.c,f=u.d,l=u.e,d=a.e,p=e.e,g=(p.a,p.b),v=p.c,y=p.d,m=p.e;return h(Th,wh,i,o,h(Th,Eh,s,c,f,l),h(Th,Eh,r,n,d,h(Th,wh,g,v,y,m)))}var t=e.a,r=e.b,n=e.c,b=e.d,i=(b.a,b.b),o=b.c,C=b.d,d=b.e,S=e.e,g=(S.a,S.b),v=S.c,y=S.d,m=S.e;return t.$,h(Th,Eh,r,n,h(Th,wh,i,o,C,d),h(Th,wh,g,v,y,m))}return e},$h=u(function(e,t,r,n,a,i,o){if("RBNode_elm_builtin"===i.$&&"Red"===i.a.$){var u=(i.a,i.b),s=i.c,c=i.d,f=i.e;return h(Th,r,u,s,c,h(Th,wh,n,a,f,o))}e:for(;;){if("RBNode_elm_builtin"===o.$&&"Black"===o.a.$){if("RBNode_elm_builtin"===o.d.$){if("Black"===o.d.a.$){var l=(o.a,o.d);l.a;return Rh(t)}break e}o.a,o.d;return Rh(t)}break e}return t}),xh=function(e){if("RBNode_elm_builtin"===e.$&&"RBNode_elm_builtin"===e.d.$){var t=e.a,r=e.b,n=e.c,a=e.d,i=a.a,o=a.d,u=e.e;if("Black"===i.$){if("RBNode_elm_builtin"===o.$&&"Red"===o.a.$){o.a;return h(Th,t,r,n,xh(a),u)}var s=Nh(e);if("RBNode_elm_builtin"===s.$){var c=s.a,f=s.b,l=s.c,d=s.d,p=s.e;return h(Ih,c,f,l,xh(d),p)}return bh}return h(Th,t,r,n,xh(a),u)}return bh},_h=r(function(e,t){if("RBEmpty_elm_builtin"===t.$)return bh;var r=t.a,n=t.b,a=t.c,i=t.d,o=t.e;if(_(e,n)<0){if("RBNode_elm_builtin"===i.$&&"Black"===i.a.$){var u=(i.a,i.d);if("RBNode_elm_builtin"===u.$&&"Red"===u.a.$){u.a;return h(Th,r,n,a,f(_h,e,i),o)}var s=Nh(t);if("RBNode_elm_builtin"===s.$){var c=s.a,l=s.b,d=s.c,p=s.d,v=s.e;return h(Ih,c,l,d,f(_h,e,p),v)}return bh}return h(Th,r,n,a,f(_h,e,i),o)}return f(Lh,e,g($h,e,t,r,n,a,i,o))}),Lh=r(function(e,t){if("RBNode_elm_builtin"===t.$){var r=t.a,n=t.b,a=t.c,i=t.d,o=t.e;if($(e,n)){var u=kh(o);if("RBNode_elm_builtin"===u.$){var s=u.b,c=u.c;return h(Ih,r,s,c,i,xh(o))}return bh}return h(Ih,r,n,a,i,f(_h,e,o))}return bh}),Ph=r(function(e,t){var r=f(_h,e,t);if("RBNode_elm_builtin"===r.$&&"Red"===r.a.$){var n=(r.a,r.b),a=r.c,i=r.d,o=r.e;return h(Th,Eh,n,a,i,o)}return r}),Dh=n(function(e,t,r){var n=t(f(Sh,e,r));if("Just"===n.$){var a=n.a;return l(Bh,e,a,r)}return f(Ph,e,r)}),Uh=function(e){return"Just"===e.$},Oh=vn,Mh=yn,Fh=r(function(e,t){return{$:"BadStatus_",a:e,b:t}}),Vh=function(e){return{$:"BadUrl_",a:e}},Kh=r(function(e,t){return{$:"GoodStatus_",a:e,b:t}}),Hh={$:"NetworkError_"},jh=function(e){return{$:"Receiving",a:e}},qh=function(e){return{$:"Sending",a:e}},Gh={$:"Timeout_"},zh=function(e){return f(ra,"application/json",f(Wi,0,e))},Yh=n(function(e,t,r){return zh(l(mh,e,t,r))}),Wh=f(ta,"",to),Jh=we,Qh=Te,Xh=function(e){if("Ok"===e.$){var t=e.a;return Qh(t)}var r=e.a;return Jh(r)},Zh=function(e){return l(ea,vr,Xh,{allowCookiesFromOtherDomains:!1,body:e.body,expect:e.resolver,headers:e.headers,method:e.method,timeout:e.timeout,tracker:ma,url:e.url})},ep=function(e){var t=e.url,r=e.method,n=e.params,a=e.decoder;return Zh({body:l(Yh,1,r,n),headers:mr,method:"POST",resolver:Wh(vh(a)),timeout:ma,url:t})},tp=n(function(e,t,r){return ep({decoder:t.decoder,method:"eth_call",params:F([ch(t),nh(r)]),url:e})}),rp={$:"LatestBlock"},np=r(function(e,t){return l(tp,e,t,rp)}),ap=function(e){return{$:"Perform",a:e}},ip=cn,op=Qh(vr),up=r(function(e,t){return f(ip,function(t){return Qh(e(t))},t)}),sp=n(function(e,t,r){return f(ip,function(t){return f(ip,function(r){return Qh(f(e,t,r))},r)},t)}),cp=function(e){return l(Ja,sp(qa),Qh(mr),e)},fp=r(function(e,t){var r=t.a;return ke(f(ip,Oh(e),r))}),lp=n(function(e,t,r){return f(up,function(e){return vr},cp(f(tu,fp(e),t)))}),dp=n(function(e,t,r){return Qh(vr)}),hp=r(function(e,t){var r=t.a;return ap(f(up,e,r))});gn.Task=De(op,lp,dp,hp);var pp=Oe("Task"),gp=fn,vp=r(function(e,t){return pp(ap(f(gp,f(wf,f(wf,Qh,e),wi),f(ip,f(wf,f(wf,Qh,e),Ii),t))))}),yp=i(function(e,t,r,n,a){return f(vp,a,f(np,e.httpProvider,l(rh,nd(t),r,n)))}),mp=function(e){if("Token"===e.$){if("EthDai"===e.a.$){e.a;return td("0x61F399ED1D5AEC3Bc9d4B026352d5764181d6b35")}e.a;return td("0xF59ed429f9753B0498436DE1a3559AEC7a0c2a21")}switch(e.a.$){case"Eth":e.a;return td("0x61F399ED1D5AEC3Bc9d4B026352d5764181d6b35");case"Kovan":e.a;return td("0xF59ed429f9753B0498436DE1a3559AEC7a0c2a21");default:e.a;return td("0x092110996699c3E06e998d89F0f4586026e44F0F")}},bp=function(e){return{$:"BoolE",a:e}},Cp=bp,Sp=function(e){return{$:"StringE",a:e}},Ep=Sp,Tp=function(e){return function(t){return function(r){return function(n){return function(a){return function(i){return function(o){return function(u){return function(s){return function(c){return function(l){return function(d){return function(h){return function(p){return{data:ya(f(df,"createOpenTrade(address[2],bool,uint256[8],string,string)",F([id(t),id(r),Cp(n),ud(a),ud(i),ud(o),ud(u),ud(s),ud(c),ud(l),ud(d),Ep(h),Ep(p)]))),decoder:Po(Dd),from:ma,gas:ma,gasPrice:ma,nonce:ma,to:ya(e),value:ma}}}}}}}}}}}}}}},wp=function(e){return function(t){return function(r){return function(n){return function(a){return function(i){return function(o){return function(u){return function(s){return function(c){return function(l){return function(d){return function(h){return function(p){return{data:ya(f(df,"createOpenTrade(address[2],bool,uint256[8],string,string)",F([id(t),id(r),Cp(n),ud(a),ud(i),ud(o),ud(u),ud(s),ud(c),ud(l),ud(d),Ep(h),Ep(p)]))),decoder:Po(Dd),from:ma,gas:ma,gasPrice:ma,nonce:ma,to:ya(e),value:ma}}}}}}}}}}}}}}},Ip=r(function(e,t){return{paymentMethods:t,price:e}}),Ap=function(e){return Gd(Tl(e))},Bp=function(e){return f(Wd,to,F([Gd(e.fiatType),Ap(e.amount)]))},kp=function(e){switch(e.$){case"Cash":return"cash";case"Bank":return"bank";default:return"custom"}},Np=function(e){return Jd(F([L("type",Gd(kp(e.type_))),L("info",Gd(e.info))]))},Rp=function(e){var t=Bp(e.price),r=f(Wd,Np,e.paymentMethods);return f(Wi,0,Jd(F([L("paymentmethods",r),L("price",t)])))},$p=r(function(e,t){return U(t,{value:ya(e)})}),xp=function(e){return lu(Gl(e))},_p=function(e){return f(qf,xp(e),lu(1e3))},Lp=r(function(e,t){var r=function(){return"Token"===e.$?Tp:wp}();return function(){return"Native"===e.$?$p(Hf(ld(t))):to}()(r(rd(e))(t.initiatorAddress)(mp(e))($(t.initiatorRole,Of))(Hf(t.tradeAmount))(Hf(Yf(t.tradeAmount)))(Hf(zf(t.tradeAmount)))(Hf(t.pokeReward))(_p(t.autorecallInterval))(_p(t.autoabortInterval))(_p(t.autoreleaseInterval))(Hf(cd(t.tradeAmount)))(Rp(f(Ip,t.price,t.paymentMethods)))(t.initiatorCommPubkey))}),Pp=function(e){return{$:"CreateMined",a:e}},Dp={$:"CreateNeedsSig"},Up=function(e){return{$:"CreateSigned",a:e}},Op=r(function(e,t){var r=mf(f(Lp,e,t)),n={onBroadcast:ma,onMined:ya(L(Pp,ma)),onSign:ya(Up)};return L(ya(Dp),f(gf,n,r))}),Mp=function(e){return{$:"AllowanceFetched",a:e}},Fp=r(function(e,t){return{$:"ApproveMining",a:e,b:t}}),Vp={$:"ApproveNeedsSig"},Kp=r(function(e,t){return{$:"ApproveSigned",a:e,b:t}}),Hp=function(e){return{$:"Confirm",a:e}},jp=function(e){return{$:"CreateMining",a:e}},qp={$:"NoOp"},Gp=function(e){return{appCmds:mr,chainCmd:co,cmd:io,model:e}},zp=function(e){return nl(Tl(e))},Yp={$:"BottomRight"},Wp={$:"ShouldBeImpossible"},Jp=function(e){return $f(e)},Qp=r(function(e,t){f(kl,e,t);return{align:Yp,mainParagraphs:F([F([Jp(e)])]),noticeType:Wp}}),Xp={$:"Error"},Zp=r(function(e,t){f(kl,e+" fetch error",t);return{align:Yp,mainParagraphs:F([F([Jp('Failed to fetch "'+e+'". See console output for more info.')])]),noticeType:Xp}}),eg=r(function(e,t){return{align:Yp,mainParagraphs:F([F([Jp('Error mining "'+e+'" transaction: '+t)])]),noticeType:Xp}}),tg={$:"Caution"},rg=r(function(e,t){return{align:Yp,mainParagraphs:F([F([Jp('Error signing "'+e+'" transaction: '+t)])]),noticeType:tg}}),ng=r(function(e,t){if("Just"===t.$){return e(t.a)}return ma}),ag=r(function(e,t){return 1-e(1-t)}),ig=function(e){return f(Yo,e,5)},og=ag(ig),ug={easing:og,offset:12,speed:200},sg=function(e){return{$:"External",a:e}},cg=function(e){return{$:"Internal",a:e}},fg=function(e){return{$:"NotFound",a:e}},lg=function(e){for(;;){e=e.a}},dg=r(function(e,t){return pp(ap(f(up,e,t)))}),hg={$:"Http"},pg={$:"Https"},gg=Hr,vg=o(function(e,t,r,n,a,i){return{fragment:i,host:t,path:n,port_:r,protocol:e,query:a}}),yg=i(function(e,t,r,n,a){if(Ll(a)||f(gg,"@",a))return ma;var i=f(Zf,":",a);if(i.b){if(i.b.b)return ma;var o=i.a,u=nl(f(yo,o+1,a));if("Nothing"===u.$)return ma;var s=u;return ya(p(vg,e,f(Co,o,a),s,t,r,n))}return ya(p(vg,e,a,ma,t,r,n))}),mg=a(function(e,t,r,n){if(Ll(n))return ma;var a=f(Zf,"/",n);if(a.b){var i=a.a;return h(yg,e,f(yo,i,n),t,r,f(Co,i,n))}return h(yg,e,"/",t,r,n)}),bg=n(function(e,t,r){if(Ll(r))return ma;var n=f(Zf,"?",r);if(n.b){var a=n.a;return d(mg,e,ya(f(yo,a+1,r)),t,f(Co,a,r))}return d(mg,e,ma,t,r)}),Cg=r(function(e,t){if(Ll(t))return ma;var r=f(Zf,"#",t);if(r.b){var n=r.a;return l(bg,e,ya(f(yo,n+1,t)),f(Co,n,t))}return l(bg,e,ma,t)}),Sg=function(e){return f(Ao,"http://",e)?f(Cg,hg,f(yo,7,e)):f(Ao,"https://",e)?f(Cg,pg,f(yo,8,e)):ma},Eg=Jt,Tg=zt(Yt),wg=ca,Ig=r(function(e,t){return L(e,t)}),Ag=_r,Bg=a(function(e,t,r,n){var a=_(r,n)>0?mi:Ga,i=fu(r-n),o=f(vi,1,Ag(i)/e|0),u=o,s=f(tu,function(e){return t(e/u)},f(Vi,0,o));return e<=0||$(r,n)?mr:f(tu,function(e){return f(a,r,e*i)},s)}),kg=r(function(e,t){var n=r(function(t,r){return cp(f(tu,wg(0),d(Bg,e.speed,e.easing,t,r-e.offset)))});return f(ip,function(e){var t=e.a.viewport,r=e.b.element;return f(n,t.y,r.y)},l(sp,Ig,Tg,Eg(t)))}),Ng=r(function(e,t){switch(e.$){case"Refresh":var r=(e.a,L(t.userInfo,t.web3Context.factoryType));if("Just"===r.a.$&&"Token"===r.b.$){var n=r.a.a,a=r.b.a,i=h(yp,t.web3Context,a,n.address,rd(t.web3Context.factoryType),Mp);return d(Xl,t,i,co,mr)}return Gp(t);case"ChangeRole":var o=e.a,u=t.inputs;return Gp(U(t,{inputs:U(u,{userRole:o})}));case"TradeAmountChanged":var s=e.a,u=t.inputs;return Gp(f(Ql,U(u,{daiAmount:s}),t));case"FiatAmountChanged":var s=e.a,u=t.inputs;return Gp(f(Ql,U(u,{fiatAmount:s}),t));case"FiatTypeChanged":var c=e.a,u=t.inputs;return Gp(f(Ql,U(u,{fiatType:c}),t));case"FiatTypeLostFocus":return Gp(U(t,{showFiatTypeDropdown:!1}));case"ChangePaymentMethodText":var p=e.a,u=t.inputs;return Gp(f(Ql,U(u,{paymentMethod:p}),t));case"AutorecallIntervalChanged":var g=e.a,u=t.inputs;return Gp(f(Ql,U(u,{autorecallInterval:g}),t));case"AutoabortIntervalChanged":var g=e.a,u=t.inputs;return Gp(f(Ql,U(u,{autoabortInterval:g}),t));case"AutoreleaseIntervalChanged":var g=e.a,u=t.inputs;return Gp(f(Ql,U(u,{autoreleaseInterval:g}),t));case"ShowCurrencyDropdown":var v=e.a,u=t.inputs;return Gp((v?Ql(U(u,{fiatType:""})):to)(U(t,{showFiatTypeDropdown:v})));case"CreateClicked":var n=e.a,y=f(zl,t.web3Context.factoryType,t.inputs);if("Ok"===y.$){var m=y.a,b=f(Jf,n,m);return Gp(U(t,{depositAmount:ya(Hf(ld(b))),txChainStatus:ya(Hp(b))}))}var C=y.a;return d(Xl,U(t,{errors:C}),f(vp,Ou(qp),function(){return f(kg,U(ug,{offset:60}),"inputError")}()),co,mr);case"AbortCreate":return Gp(U(t,{txChainStatus:ma}));case"ConfirmCreate":var b=e.a,S=e.b,E=function(){var e=t.web3Context.factoryType;if("Native"===e.$)return f(Op,t.web3Context.factoryType,b);var r=e.a,n=function(){var e=mf(l(sd,nd(r),rd(t.web3Context.factoryType),S)),n={onBroadcast:ma,onMined:ma,onSign:ya(Kp(b))};return f(gf,n,e)}(),a=t.allowance;if("Just"===a.$){var i=a.a;return $(f(Su,i,S),Da)?L(ya(Vp),n):f(Op,t.web3Context.factoryType,b)}return L(ya(Vp),n)}(),T=E.a,w=E.b;return d(Xl,U(t,{txChainStatus:T}),io,w,mr);case"ApproveSigned":var b=e.a,I=e.b;if("Ok"===I.$){var A=I.a;return Gp(U(t,{txChainStatus:ya(f(Fp,b,A))}))}var B=I.a;return d(Xl,U(t,{txChainStatus:ma}),io,co,F([Sf(f(rg,"appove",B))]));case"AllowanceFetched":var k=e.a;if("Ok"===k.$){var N=k.a,R=U(t,{allowance:ya(N)}),x=L(R.txChainStatus,R.depositAmount);if("Just"===x.a.$&&"ApproveMining"===x.a.a.$&&"Just"===x.b.$){var _=x.a.a,b=_.a,P=x.b.a;if($(f(Su,N,P),Da))return Gp(R);var D=f(Op,R.web3Context.factoryType,b),T=D.a,w=D.b;return d(Xl,U(R,{txChainStatus:T}),io,w,mr)}return Gp(R)}var O=k.a;return d(Xl,t,io,co,F([Sf(f(Zp,"allowance",O))]));case"CreateSigned":var I=e.a;if("Ok"===I.$){var A=I.a;return Gp(U(t,{txChainStatus:ya(jp(A))}))}var B=I.a;return d(Xl,U(t,{txChainStatus:ma}),io,co,F([Sf(f(rg,"create",B))]));case"CreateMined":if("Err"===e.a.$){var B=e.a.a;return d(Xl,t,io,co,F([Sf(f(eg,"create",B))]))}var M=e.a.a,V=f(ng,zp,Wl(f(th,t.web3Context.factoryType,M)));if("Just"===V.$){var K=V.a;return d(Xl,t,io,co,F([lo(yf(K))]))}return d(Xl,t,io,co,F([Sf(f(Qp,'Error getting the ID of the created offer. Check the "My Trades" page for your open offer.',M))]));case"Web3Connect":return d(Xl,t,io,co,F([Ef]));default:return Gp(t)}}),Rg=function(e){return sh(F([L("to",f(jf,ah,e.to)),L("from",f(jf,ah,e.from)),L("gas",f(jf,oh,e.gas)),L("gasPrice",f(jf,ih,e.gasPrice)),L("value",f(jf,ih,e.value)),L("data",f(jf,zd,e.data)),L("nonce",f(jf,oh,e.nonce))]))},$g=function(e){return{$:"TxSentry",a:e}},xg=r(function(e,t){return Jd(F([L("ref",yh(e)),L("txParams",t)]))}),_g=function(e){return{$:"Signing",a:e}},Lg=r(function(e,t){var r=t.onSign;return{onBroadcastTagger:t.onBroadcast,onMinedTagger:t.onMined,onSignedTagger:r,params:e,status:_g(e)}}),Pg=mn,Dg=n(function(e,t,r){var n=e.a,a=Rg(r),i=l(Bh,n.ref,f(Lg,r,t),n.txs);return L($g(U(n,{ref:n.ref+1,txs:i})),f(Pg,n.tagger,n.outPort(f(xg,n.ref,a))))}),Ug=Dg,Og=r(function(e,t){if("None"===t.$)return L(e,io);var r=t.a,n=t.b;return l(Ug,e,r,n)}),Mg=n(function(e,t,r){return{onBroadcast:t,onMined:r,onSign:e}}),Fg=r(function(e,t){if("None"===t.$)return so;var r=t.a,n=t.b,a=l(Mg,f(jf,wf(e),r.onSign),f(jf,wf(e),r.onBroadcast),f(jf,function(t){var r=t.a,n=t.b;return L(f($a,r,e),f(jf,function(t){return{confirmations:t.confirmations,toMsg:f($a,t.toMsg,e)}},n))},r.onMined));return f(pf,a,n)}),Vg=function(e){if("Token"===e.$){if("EthDai"===e.a.$){e.a;return wa}e.a;return Ta}switch(e.a.$){case"Eth":e.a;return wa;case"Kovan":e.a;return Ta;default:e.a;return Ia(100)}},Kg=r(function(e,t){return f(su,Gl(e),Gl(t))}),Hg=r(function(e,t){return $(t.state.phase,no)&&$(f(Kg,t.derived.phaseEndTime,e),Fa)}),jg=function(e){if(""===e)return Ii(ma);var t=yl(e);if("Nothing"===t.$)return wi("I can't interpret this number");var r=t.a;return Ii(ya(r))},qg=function(e){if(""===e)return Ii(ma);var t=fl(e);if("Nothing"===t.$)return wi("I don't understand this number.");var r=t.a;return Ii(ya(r))},Gg=a(function(e,t,r,n){return{maxDai:t,maxFiat:n,minDai:e,minFiat:r}}),zg=d(Gg,ma,ma,ma,ma),Yg=i(function(e,t,r,n,a){if("Err"===t.$){var i=t.a;return wi(i)}var o=t.a;if("Err"===r.$){var i=r.a;return wi(i)}var u=r.a;if("Err"===n.$){var i=n.a;return wi(i)}var s=n.a;if("Err"===a.$){var i=a.a;return wi(i)}var c=a.a;return Ii(d(e,o,u,s,c))}),Wg=function(e){return h(Yg,a(function(t,r,n,a){return{dai:{max:r,min:t},fiat:f(jf,function(e){return{max:a,min:n,type_:e}},Pl(e.fiatType)),paymentMethodTerms:e.paymentMethodTerms}}),f(ql,function(e){return U(zg,{minDai:ya(e)})},jg(e.minDai)),f(ql,function(e){return U(zg,{maxDai:ya(e)})},jg(e.maxDai)),f(ql,function(e){return U(zg,{minFiat:ya(e)})},qg(e.minFiat)),f(ql,function(e){return U(zg,{maxFiat:ya(e)})},qg(e.maxFiat)))},Jg=r(function(e,t){var r=function(t){return f(Sd,function(e){return f(gg,cl(e),cl(t))},e)};return f(Cd,function(e){return r(e.info)},t)}),Qg=r(function(e,t){return U(t,{paymentMethod:e})}),Xg=r(function(e,t){return U(t,{paymentMethodTerms:e})}),Zg=r(function(e,t){return f(Su,Hf(e),Hf(t))}),ev=function(e){if(""===e.inputs.paymentMethod)return e;var t=e.inputs.paymentMethod,r=f(Qa,e.inputs.paymentMethodTerms,F([t]));return tv(U(e,{inputs:f(Xg,r,f(Qg,"",e.inputs))}))},tv=function(e){var t=ev(e),n=Wg(t.inputs);if("Err"===n.$){return U(e,{errors:n.a})}var a=n.a,i=r(function(e,t){var r=a.paymentMethodTerms;if(r.b){return f(Jg,r,t.terms.paymentMethods)}return!0}),o=function(e){var t=a.fiat;if("Nothing"===t.$)return!0;var r=t.a;return $(e.terms.price.fiatType,r.type_)&&function(){var t=r.min;if("Nothing"===t.$)return!0;var n=t.a;return!$(f(Su,e.terms.price.amount,n),Da)}()&&function(){var t=r.max;if("Nothing"===t.$)return!0;var n=t.a;return!$(f(Su,e.terms.price.amount,n),Fa)}()},u=function(e){return function(){var t=a.dai.min;if("Nothing"===t.$)return!0;var r=t.a;return!$(f(Zg,e.parameters.tradeAmount,r),Da)}()&&function(){var t=a.dai.max;if("Nothing"===t.$)return!0;var r=t.a;return!$(f(Zg,e.parameters.tradeAmount,r),Fa)}()},s=r(function(e,r){return f(Hg,e,r)&&!$(r.parameters.initiatorRole,t.browsingRole)&&f(i,e,r)&&u(r)&&o(r)});return U(t,{filterFunc:s})},rv={fiatType:"",maxDai:"",maxFiat:"",minDai:"",minFiat:"",paymentMethod:"",paymentMethodTerms:mr},nv=r(function(e,t){return f(su,e.creationInfo.blocknum,t.creationInfo.blocknum)}),av=n(function(e,t,r){return L(tv({browsingRole:t,errors:zg,filterFunc:Hg,inputs:rv,showCurrencyDropdown:!1,sortFunc:nv,userInfo:r,web3Context:e}),io)}),iv=r(function(e,t){return f(Su,e.amount,t.amount)}),ov=r(function(e,t){var r=f(Zd,js(e),t.inputs.paymentMethodTerms);return tv(U(t,{inputs:f(Xg,r,t.inputs)}))}),uv=function(e){return U(e,{filterFunc:Hg,inputs:rv,sortFunc:nv})},sv={$:"Ascending"},cv=n(function(e,t,r){return{appCmds:r,cmd:t,model:e}}),fv=function(e){return l(cv,e,io,mr)},lv=r(function(e,t){return U(t,{fiatType:e})}),dv=r(function(e,t){return U(t,{maxDai:e})}),hv=r(function(e,t){return U(t,{maxFiat:e})}),pv=r(function(e,t){return U(t,{minDai:e})}),gv=r(function(e,t){return U(t,{minFiat:e})}),vv=n(function(e,t,r){return f(e,r,t)}),yv=r(function(e,t){switch(e.$){case"MinDaiChanged":var n=e.a;return l(cv,U(t,{inputs:f(pv,n,t.inputs)}),io,mr);case"MaxDaiChanged":var n=e.a;return l(cv,U(t,{inputs:f(dv,n,t.inputs)}),io,mr);case"MinFiatChanged":var n=e.a;return l(cv,U(t,{inputs:f(gv,n,t.inputs)}),io,mr);case"MaxFiatChanged":var n=e.a;return l(cv,U(t,{inputs:f(hv,n,t.inputs)}),io,mr);case"FiatTypeInputChanged":var n=e.a;return l(cv,U(t,{inputs:f(lv,n,t.inputs)}),io,mr);case"ShowCurrencyDropdown":var a=e.a;t.inputs;return l(cv,U(t,{inputs:(a?lv(""):to)(t.inputs),showCurrencyDropdown:a}),io,mr);case"FiatTypeLostFocus":return l(cv,U(t,{showCurrencyDropdown:!1}),io,mr);case"PaymentMethodInputChanged":var n=e.a;return l(cv,U(t,{inputs:f(Qg,n,t.inputs)}),io,mr);case"AddSearchTerm":return l(cv,ev(t),io,mr);case"RemoveTerm":var i=e.a;return l(cv,f(ov,i,t),io,mr);case"ApplyInputs":return l(cv,tv(t),io,mr);case"ResetSearch":return l(cv,uv(t),io,mr);case"TradeClicked":var o=e.a;return l(cv,t,io,F([lo(yf(o))]));case"SortBy":var u=e.a,s=e.b,c=($(s,sv)?vv:to)(r(function(e,t){switch(u.$){case"Expiring":return f(Kg,e.derived.phaseEndTime,t.derived.phaseEndTime);case"TradeAmount":return f(Zg,e.parameters.tradeAmount,t.parameters.tradeAmount);case"Fiat":return f(iv,e.terms.price,t.terms.price);case"Margin":return f(ec,Pa,l(Yl,r(function(e,t){return f(su,e,t)}),e.derived.margin,t.derived.margin));case"PaymentMethods":return f(nv,e,t);case"AutoabortWindow":return f(Kg,e.parameters.autoabortInterval,t.parameters.autoabortInterval);default:return f(Kg,e.parameters.autoreleaseInterval,t.parameters.autoreleaseInterval)}}));return l(cv,U(t,{sortFunc:c}),io,mr);default:return fv(t)}}),mv=n(function(e,t,r){var n=e.factoryType;if("Token"===n.$){var a=n.a;return h(yp,e,a,t.address,rd(e.factoryType),r)}return io}),bv=function(e){return{$:"AllowanceFetched",a:e}},Cv=function(e){return{$:"Menu",a:e}},Sv={$:"NoneStarted"},Ev=a(function(e,t,r,n){return{appCmds:n,chainCmd:r,cmd:t,model:e}}),Tv=r(function(e,t){var r={state:Cv(Sv),textInput:"",tokenAllowance:ma,userInfo:t,web3Context:e},n=function(){if("Just"===t.$){var e=t.a;return l(mv,r.web3Context,e,bv)}return io}();return d(Ev,r,n,co,mr)}),wv=function(e){return{$:"ApproveSigned",a:e}},Iv=r(function(e,t){var r=mf(l(sd,nd(e),rd(ga(e)),Hf(t))),n={onBroadcast:ma,onMined:ma,onSign:ya(wv)};return f(gf,n,r)}),Av=function(e){return{$:"OpenMined",a:e}},Bv=function(e){return{$:"OpenSigned",a:e}},kv=r(function(e,t){var r=mf(f(Lp,e,t)),n={onBroadcast:ma,onMined:ya(L(Av,ma)),onSign:ya(Bv)};return f(gf,n,r)}),Nv=function(e){return{$:"ApproveMining",a:e}},Rv=function(e){return{$:"ApproveNeedsSig",a:e}},$v={$:"OpenMining"},xv={$:"OpenNeedsSig"},_v={$:"ReadyToOpen"},Lv=r(function(e,t){return{$:"Spec",a:e,b:t}}),Pv=function(e){return{$:"StartPrompt",a:e}},Dv=r(function(e,t){return Kf(f(Ru,Hf(e),lu(t)))}),Uv=function(e){var t=function(){return"Buyer"===e.initiatorRole.$?3:1}();return f(Gf,f(Dv,e.daiAmountIn,100*t),100+t)},Ov=n(function(e,t,r){var n=t.intervals,a=n.a,i=n.b,o=n.c;return f(Jf,e,{autoabortInterval:i,autorecallInterval:a,autoreleaseInterval:o,initiatorRole:t.initiatorRole,paymentMethods:F([f(Hl,Kl,r)]),price:t.fiatValue,tradeAmount:Uv(t)})}),Mv=function(e){return{appCmds:mr,chainCmd:co,cmd:io,model:e}},Fv=function(e){return Kf(e)},Vv=r(function(e,t){switch(e.$){case"Refresh":var r=(e.a,L(t.userInfo,t.web3Context.factoryType));if("Just"===r.a.$&&"Token"===r.b.$){var n=r.a.a,a=r.b.a,i=h(yp,t.web3Context,a,n.address,rd(t.web3Context.factoryType),bv);return d(Ev,t,i,co,mr)}return Mv(t);case"StartClicked":var o=e.a;if("Token"===t.web3Context.factoryType.$){var u=function(){var e=t.tokenAllowance;if("Just"===e.$){var r=e.a;return $(f(Zg,r,o.daiAmountIn),Da)?Cv(Pv(o)):f(Lv,o,_v)}return Cv(Pv(o))}();return Mv(U(t,{state:u}))}return Mv(U(t,{state:f(Lv,o,_v)}));case"ApproveClicked":var o=e.a,s=t.web3Context.factoryType;if("Token"===s.$){var a=s.a,c=f(Iv,a,o.daiAmountIn);return d(Ev,U(t,{state:Cv(Rv(o))}),io,c,mr)}return d(Ev,t,io,co,F([Sf(f(Qp,"Approve Clicked msg received, but factoryType is not a token factory!",o))]));case"ApproveSigned":var p=e.a,g=L(p,t.state);if("Ok"===g.a.$){if("Menu"===g.b.$&&"ApproveNeedsSig"===g.b.a.$){var v=g.a.a,o=g.b.a.a;return Mv(U(t,{state:f(Lv,o,Nv(v))}))}return d(Ev,t,io,co,F([Sf(f(Qp,"Approve signed, but factoryType is not a token factory!",p))]))}var y=g.a.a;return d(Ev,t,io,co,F([Sf(f(rg,"ERC20 approve",y))]));case"AllowanceFetched":var m=e.a,b=L(m,t.state);if("Ok"===b.a.$){if("Spec"===b.b.$&&"ApproveMining"===b.b.b.$){var C=b.a.a,S=b.b,o=S.a;return Mv($(f(Su,C,Hf(o.daiAmountIn)),Da)?U(t,{tokenAllowance:ya(Fv(C))}):U(t,{state:f(Lv,o,_v),tokenAllowance:ya(Fv(C))}))}return Mv(t)}var E=b.a.a;return d(Ev,t,io,co,F([Sf(f(Zp,"token allowance",E))]));case"OpenClicked":var n=e.a,T=e.b,w=l(Ov,n,T,t.textInput),c=f(kv,t.web3Context.factoryType,w);return d(Ev,U(t,{state:f(Lv,T,xv)}),io,c,mr);case"OpenSigned":var p=e.a,I=L(p,t.state);if("Ok"===I.a.$){if("Spec"===I.b.$){var v=I.a.a,A=I.b,w=A.a;return Mv(U(t,{state:f(Lv,w,$v)}))}return d(Ev,t,io,co,F([Sf(f(Qp,"Open signed, but factoryType is not a token factory!",p))]))}var y=I.a.a;return d(Ev,t,io,co,F([Sf(f(rg,"Open trade",y))]));case"OpenMined":var B=e.a;if("Ok"===B.$){var k=B.a,N=f(ng,zp,Wl(f(th,t.web3Context.factoryType,k)));if("Just"===N.$){var R=N.a;return d(Ev,t,io,co,F([lo(yf(R))]))}return d(Ev,t,io,co,F([Sf(f(Qp,'Error getting the ID of the created offer. Check the "My Trades" page for your open offer.',k))]))}var y=B.a;return d(Ev,t,io,co,F([Sf(f(eg,"Open trade",y))]));case"TextInputChanged":var x=e.a;return Mv(U(t,{textInput:x}));case"ChangeState":var u=e.a;return Mv(U(t,{state:u}));case"AbortCreate":return Mv(U(t,{state:Cv(Sv)}));case"NoOp":return Mv(t);default:return d(Ev,t,io,co,F([Ef]))}}),Kv=function(e){return"Buyer"===e.$?"buyer":"seller"},Hv=function(e){return e.a+"="+e.b},jv=function(e){return e.b?"?"+f(qi,"&",f(tu,Hv,e)):""},qv=r(function(e,t){return"/"+(f(qi,"/",e)+jv(t))}),Gv=function(e){switch(e.$){case"Home":return f(qv,F(["DAIHard"]),mr);case"QuickCreate":return f(qv,F(["DAIHard","quickcreate"]),mr);case"Create":return f(qv,F(["DAIHard","create"]),mr);case"Trade":var t=e.a;return f(qv,F(["DAIHard","trade",ji(t)]),mr);case"Marketplace":var r=e.a;return f(qv,F(["DAIHard","marketplace",Kv(r)]),mr);case"AgentHistory":var n=e.a,r=e.b;return f(qv,F(["DAIHard","history",Xd(n),function(){return"Buyer"===r.$?"buyer":"seller"}()]),mr);default:return f(qv,mr,mr)}},zv={$:"NotFound"},Yv={$:"Create"},Wv={$:"Home"},Jv=function(e){return{$:"Marketplace",a:e}},Qv={$:"QuickCreate"},Xv=function(e){return{$:"Parser",a:e}},Zv=i(function(e,t,r,n,a){return{frag:n,params:r,unvisited:t,value:a,visited:e}}),ey=r(function(e,t){return Xv(function(e){var r=e.visited,n=e.unvisited,a=e.params,i=e.frag,o=e.value;if(n.b){var u=n.a,s=n.b,c=t(u);if("Just"===c.$){var l=c.a;return F([h(Zv,f(qa,u,r),s,a,i,o(l))])}return mr}return mr})}),ty=f(ey,"ADDRESS",f($a,Pd,Wl)),ry={$:"Buyer"},ny=f(ey,"BUYERORSELLER",function(e){switch(e){case"buyer":return ya(ry);case"seller":return ya(Of);default:return ma}}),ay=f(ey,"NUMBER",nl),iy=r(function(e,t){var r=t.visited,n=t.unvisited,a=t.params,i=t.frag,o=t.value;return h(Zv,r,n,a,i,e(o))}),oy=r(function(e,t){var r=t.a;return Xv(function(t){var n=t.visited,a=t.unvisited,i=t.params,o=t.frag,u=t.value;return f(tu,iy(u),r(h(Zv,n,a,i,o,e)))})}),uy=function(e){return l(Ja,Qa,mr,e)},sy=r(function(e,t){return uy(f(tu,e,t))}),cy=function(e){return Xv(function(t){var r=t.visited,n=t.unvisited,a=t.params,i=t.frag,o=t.value;if(n.b){var u=n.a,s=n.b;return $(u,e)?F([h(Zv,f(qa,u,r),s,a,i,o)]):mr}return mr})},fy=r(function(e,t){var r=e.a,n=t.a;return Xv(function(e){return f(sy,n,r(e))})}),ly=Xv(function(e){return F([e])}),dy=f(fy,cy("DAIHard"),function(e){return Xv(function(t){return f(sy,function(e){return(0,e.a)(t)},e)})}(F([f(oy,Wv,ly),f(oy,Qv,cy("quickcreate")),f(oy,Yv,cy("create")),f(oy,yf,f(fy,cy("trade"),ay)),f(oy,Jv,f(fy,cy("marketplace"),ny)),f(oy,vf,f(fy,cy("history"),f(fy,ty,ny))),f(oy,function(e){return f(vf,e,Of)},f(fy,cy("history"),ty))]))),hy=function(e){e:for(;;){if(e.b){var t=e.a,r=e.b,n=t.unvisited;if(n.b){if(""!==n.a||n.b.b){var a=r;e=a;continue e}return ya(t.value)}return ya(t.value)}return ma}},py=function(e){if(e.b){if(""!==e.a||e.b.b){var t=e.a,r=e.b;return f(qa,t,py(r))}return mr}return mr},gy=function(e){var t=f(zi,"/",e);if(t.b&&""===t.a){var r=t.b;return py(r)}var r=t;return py(r)},vy=Xt,yy=r(function(e,t){if("Nothing"===t.$)return ya(F([e]));var r=t.a;return ya(f(qa,e,r))}),my=r(function(e,t){var r=f(zi,"=",e);if(r.b&&r.b.b&&!r.b.b.b){var n=r.a,a=r.b,i=a.a,o=vy(n);if("Nothing"===o.$)return t;var u=o.a,s=vy(i);if("Nothing"===s.$)return t;var c=s.a;return l(Dh,u,yy(c),t)}return t}),by=function(e){if("Nothing"===e.$)return Ch;var t=e.a;return l(Ja,my,Ch,f(zi,"&",t))},Cy=r(function(e,t){var r=e.a;return hy(r(h(Zv,mr,gy(t.path),by(t.query),t.fragment,to)))}),Sy=function(e){return f(ec,zv,f(Cy,dy,e))},Ey=ia,Ty=r(function(e,t){return f(Ey,e,Gv(t))}),wy=qe("connectToWeb3",function(e){return uh}),Iy=function(e){return Jd(F([L("event",Gd(e.event)),L("category",Gd(e.category)),L("label",Gd(e.label)),L("value",yh(e.value))]))},Ay=r(function(e,t){return Jd(F([L("address",Gd(Xd(e))),L("signSeedMsg",Gd(t))]))}),By=qe("gTagOut",to),ky=qe("genPrivkey",to),Ny=r(function(e,t){return U(t,{userInfo:e})}),Ry=r(function(e,t){return L(f(Ql,t.inputs,U(t,{userInfo:e})),function(){var r=L(e,t.web3Context.factoryType);if("Just"===r.a.$&&"Token"===r.b.$){var n=r.a.a,a=r.b.a;return h(yp,t.web3Context,a,n.address,rd(t.web3Context.factoryType),Mp)}return io}())}),$y=r(function(e,t){return U(t,{userInfo:e})}),xy=r(function(e,t){return L(U(t,{userInfo:e}),function(){if("Just"===e.$){var r=e.a;return l(mv,t.web3Context,r,bv)}return io}())}),_y=function(e){return{$:"AllowanceFetched",a:e}},Ly=r(function(e,t){return L(U(t,{userInfo:e}),function(){var r=P(e,t.trade,t.web3Context.factoryType);if("Just"===r.a.$&&"LoadedTrade"===r.b.$&&"Token"===r.c.$){var n=r.a.a,a=r.b.a,i=r.c.a;return h(yp,t.web3Context,i,n.address,a.creationInfo.address,_y)}return io}())}),Py=function(e){return{$:"AgentHistoryModel",a:e}},Dy=function(e){return{$:"CreateModel",a:e}},Uy=function(e){return{$:"CreateMsg",a:e}},Oy=function(e){return{$:"MarketplaceModel",a:e}},My=function(e){return{$:"QuickCreateModel",a:e}},Fy=function(e){return{$:"QuickCreateMsg",a:e}},Vy=function(e){return{$:"TradeModel",a:e}},Ky=function(e){return{$:"TradeMsg",a:e}},Hy=r(function(e,t){switch(t.$){case"BetaLandingPage":return L(t,io);case"CreateModel":var r=t.a,n=f(Ry,e,r),a=n.a,i=n.b;return L(Dy(a),f(Pg,Uy,i));case"QuickCreateModel":var o=t.a,u=f(xy,e,o),s=u.a,c=u.b;return L(My(s),f(Pg,Fy,c));case"TradeModel":var l=t.a,d=f(Ly,e,l),h=d.a,p=d.b;return L(Vy(h),f(Pg,Ky,p));case"MarketplaceModel":var g=t.a;return L(Oy(f($y,e,g)),io);default:var v=t.a;return L(Py(f(Ny,e,v)),io)}}),jy=r(function(e,t){return U(t,{web3Context:e})}),qy=r(function(e,t){return U(t,{web3Context:e})}),Gy=r(function(e,t){return U(t,{web3Context:e})}),zy=r(function(e,t){return U(t,{web3Context:e})}),Yy=r(function(e,t){switch(t.$){case"BetaLandingPage":return P(t,io,ma);case"CreateModel":var r=t.a;return P(Dy(f(qy,e,r)),io,ma);case"QuickCreateModel":var n=t.a;return P(My(f(zy,e,n)),io,ma);case"TradeModel":t.a;return P(t,io,ya(Jv(ry)));case"MarketplaceModel":var a=t.a;return P(Oy(f(Gy,e,a)),io,ma);default:var i=t.a;return P(Py(f(jy,e,i)),io,ma)}}),Wy=o(function(e,t,r,n,a,i){return{creationInfo:t,id:e,parameters:r,phaseStartInfo:i,state:n,terms:a}}),Jy=function(e){return{$:"PartiallyLoadedTrade",a:e}},Qy=function(e){return Jy(p(Wy,e,ma,ma,ma,ma,ma))},Xy=r(function(e,t){return{initiatorPubkey:e,responderPubkey:t}}),Zy=function(e){return{$:"PartiallyLoadedCommInfo",a:e}},em=Zy(f(Xy,ma,ma)),tm=r(function(e,t){return{address_:e,blocknum:t}}),rm=function(e){return ho(function(t){return Ii(L(t,e))})},nm=r(function(e,t){return L(t.a,e(t.b))}),am=n(function(e,t,r){var n=t.a,a=r.a;return ho(function(t){return f(eh,function(t){var r=t.a,n=t.b;return f(Eo,nm(e(n)),a(r))},n(t))})}),im=r(function(e,t){return l(am,r(function(e,t){return e(t)}),t,e)}),om=Po(f(im,jd,f(im,Dd,rm(tm)))),um=r(function(e,t){return{data:ya(f(df,"createdTrades(uint256)",F([ud(t)]))),decoder:om,from:ma,gas:ma,gasPrice:ma,nonce:ma,to:ya(e),value:ma}}),sm=n(function(e,t,r){return f(vp,r,f(np,e.httpProvider,f(um,rd(e.factoryType),t)))}),cm=function(e){return{$:"CreationInfoFetched",a:e}},fm=r(function(e,t){return l(sm,e,lu(t),cm)}),lm=function(e){return{$:"EventSentryMsg",a:e}},dm=a(function(e,t,r,n){return{appCmds:n,chainCmd:r,cmd:t,model:e}}),hm=Lo(f($a,Bo,Nd)),pm=function(e){return ep({decoder:hm,method:"eth_blockNumber",params:mr,url:e})},gm=function(e){return{$:"BlockNumber",a:e}},vm=function(e){return{$:"EventSentry",a:e}},ym=function(e){return{$:"Set_elm_builtin",a:e}},mm=ym(Ch),bm=r(function(e,t){return L(vm({blockNumber:ma,errors:mr,nodePath:t,pending:mm,ref:1,requests:Ch,tagger:e,watching:mm}),f(vp,f($a,gm,e),pm(t)))}),Cm=n(function(e,t,r){var n=f(fm,e,r),a=f(bm,lm,e.httpProvider),i=a.a,o=a.b;return d(dm,{allowance:ma,chatHistoryModel:ma,eventSentry:i,eventsWaitingForChatHistory:mr,expandedPhase:no,secureCommInfo:em,showChatHistory:!1,showStatsModal:!1,trade:Qy(r),txChainStatus:ma,userInfo:t,web3Context:e},ao(F([n,o])),co,mr)}),Sm=function(e){return{data:ya(f(df,"abort()",mr)),decoder:_o(vr),from:ma,gas:ma,gasPrice:ma,nonce:ma,to:ya(e),value:ma}},Em=function(e){return{data:ya(f(df,"burn()",mr)),decoder:_o(vr),from:ma,gas:ma,gasPrice:ma,nonce:ma,to:ya(e),value:ma}},Tm=function(e){return{data:ya(f(df,"claim()",mr)),decoder:_o(vr),from:ma,gas:ma,gasPrice:ma,nonce:ma,to:ya(e),value:ma}},wm=r(function(e,t){return{data:ya(f(df,"initiatorStatement(string)",F([Ep(t)]))),decoder:_o(vr),from:ma,gas:ma,gasPrice:ma,nonce:ma,to:ya(e),value:ma}}),Im=function(e){return{data:ya(f(df,"recall()",mr)),decoder:_o(vr),from:ma,gas:ma,gasPrice:ma,nonce:ma,to:ya(e),value:ma}},Am=function(e){return{data:ya(f(df,"release()",mr)),decoder:_o(vr),from:ma,gas:ma,gasPrice:ma,nonce:ma,to:ya(e),value:ma}},Bm=r(function(e,t){return{data:ya(f(df,"responderStatement(string)",F([Ep(t)]))),decoder:_o(vr),from:ma,gas:ma,gasPrice:ma,nonce:ma,to:ya(e),value:ma}}),km=r(function(e,t){return{amount:t,fiatType:e}}),Nm=f(Ro,function(e){var t=fl(e);if("Just"===t.$){var r=t.a;return _o(r)}return $o("Can't convert that to a BigInt")},xo),Rm=l(Af,km,f(Fd,0,xo),f(Fd,1,Nm)),$m={$:"Bank"},xm={$:"Cash"},_m=function(e){switch(e){case"cash":return ya(xm);case"bank":return ya($m);case"custom":return ya(Kl);default:return ma}},Lm=f(Ro,function(e){var t=_m(e);if("Just"===t.$){var r=t.a;return _o(r)}return $o("")},xo),Pm=l(Af,Hl,f(Od,"type",Lm),f(Od,"info",xo)),Dm=ue,Um=function(e){var t=l(Af,Ip,f(Od,"price",Rm),f(Od,"paymentmethods",Dm(Pm)));return f(gh,t,e)},Om=r(function(e,t){return{commPubkey:t,responder:e}}),Mm=r(function(e,t){var n=r(function(t,r){return l(vo,t,t+2*r,e)}),a=f($a,Nd,Eo(yi(2)));return f(eh,function(t){return f(Eo,function(e){return f(n,t+64,e)},Nd(l(vo,t,t+64,e)))},a(t))}),Fm=n(function(e,t,r){var n=r.a,a=r.b,i=r.c,o=function(e){return 63&e|n<<6};return a?1===a?P(0,0,f(e,o(t),i)):P(o(t),a-1,i):128&t?192==(224&t)?P(31&t,1,i):224==(240&t)?P(15&t,2,i):P(7&t,3,i):P(0,0,f(e,t,i))}),Vm=n(function(e,t,r){var n=l(za,Fm(e),P(0,0,t),r);if(n.b)return wi("invalid UTF-8 sequence");var a=n.c;return Ii(a)}),Km=q,Hm=function(e){return Gu(Km(e))},jm=function(e){return l(Vm,r(function(e,t){return O(t,Hm(e))}),"",e)},qm=ho(function(e){var t=e.a,r=e.b;return f(Eo,f(bo,t,r),f(eh,jm,f(eh,f($a,tu(Nd),Ad),f(Eo,Zd(f($a,Ll,Tu)),f(Eo,Ss(2),f(Mm,t,So(r)))))))}),Gm=f(dd,f(Md,1,qm),f(dd,f(Md,0,Dd),_o(Om))),zm=r(function(e,t){return{commPubkey:t,terms:e}}),Ym=f(dd,f(Md,1,qm),f(dd,f(Md,0,qm),_o(zm))),Wm=function(e){return{statement:e}},Jm=f(dd,f(Md,0,qm),_o(Wm)),Qm=function(e){return{statement:e}},Xm=f(dd,f(Md,0,qm),_o(Qm)),Zm={$:"AbortedEvent"},eb={$:"BurnedEvent"},tb={$:"ClaimedEvent"},rb=function(e){return{$:"CommittedEvent",a:e}},nb=function(e){return{$:"InitiatedEvent",a:e}},ab=function(e){return{$:"InitiatorStatementLogEvent",a:e}},ib={$:"PokeEvent"},ob={$:"RecalledEvent"},ub={$:"ReleasedEvent"},sb=function(e){return{$:"ResponderStatementLogEvent",a:e}},cb=gd(f(ec,md,yd("^((0[Xx]){1})?[0-9a-fA-F]+$"))),fb=function(e){return cb(e)?Ii(Ts(Bo(e))):wi("Something in here is not very hexy: "+Ld(e))},lb=Lo(fb),db=f(Od,"topics",f(Fd,0,lb)),hb=function(e){return Ts(f(qi,"",f(tu,f($a,ts,Bs),sf(f(tu,xi,bs(e))))))},pb=f(Ro,function(e){return $(e,hb("Initiated(string,string)"))?f(If,nb,Ym):$(e,hb("Committed(address,string)"))?f(If,rb,Gm):$(e,hb("Recalled()"))?_o(ob):$(e,hb("Claimed()"))?_o(tb):$(e,hb("Aborted()"))?_o(Zm):$(e,hb("Released()"))?_o(ub):$(e,hb("Burned()"))?_o(eb):$(e,hb("InitiatorStatementLog(string)"))?f(If,ab,Jm):$(e,hb("ResponderStatementLog(string)"))?f(If,sb,Xm):$(e,hb("Poke()"))?_o(ib):$o("Unrecognized topic hash")},db),gb={$:"Initiator"},vb={$:"Responder"},yb=r(function(e,t){return $(t,e.parameters.initiatorAddress)?ya(gb):f(ng,function(e){return $(t,e)?ya(vb):ma},e.state.responder)}),mb=function(e){return"Buyer"===e.initiatorRole.$?e.tradeAmount:e.buyerDeposit},bb=function(e){return $(e.buyerDeposit,Yf(e.tradeAmount))&&$(e.abortPunishment,zf(e.tradeAmount))},Cb={$:"Invalid"},Sb=u(function(e,t,r,n,a,i,o){return{creationInfo:t,derived:o,id:e,parameters:r,phaseStartInfo:i,state:n,terms:a}}),Eb=function(e){return{$:"LoadedTrade",a:e}},Tb=r(function(e,t){return Ff(Gl(t)+Gl(e))}),wb=function(e){var t=Nl(Tl(e.amount));if("Just"===t.$){return t.a}f(kl,"Error converting FiatValue to float--string -> float failed!",e);return 0},Ib=r(function(e,t){return(t-e)/e}),Ab=r(function(e,t){var r=wb(t),n=Rl(e);return"USD"===t.fiatType?ya(f(Ib,n,r)):ma}),Bb=n(function(e,t,r){var n=function(){switch(t.phase.$){case"Open":return e.autorecallInterval;case"Committed":return e.autoabortInterval;case"Judgment":return e.autoreleaseInterval;default:return Ff(0)}}();return{margin:f(Ab,e.tradeAmount,r.price),phaseEndTime:f(Tb,t.phaseStartTime,n)}}),kb=function(e){var t=P(L(e.creationInfo,e.parameters),L(e.state,e.terms),e.phaseStartInfo);if("Just"===t.a.a.$&&"Just"===t.a.b.$&&"Just"===t.b.a.$&&"Just"===t.b.b.$&&"Just"===t.c.$){var r=t.a,n=r.a.a,a=r.b.a,i=t.b,o=i.a.a,u=i.b.a,s=t.c.a;return Eb(g(Sb,e.id,n,a,o,u,s,l(Bb,a,o,u)))}return Jy(e)},Nb=r(function(e,t){switch(t.$){case"PartiallyLoadedTrade":var r=t.a;return kb(U(r,{creationInfo:ya(e)}));case"LoadedTrade":f(kl,"Trying to update creation info on a trade that's already fully loaded!","");return t;default:return Cb}}),Rb=r(function(e,t){switch(t.$){case"PartiallyLoadedTrade":var r=t.a;return kb(U(r,{parameters:ya(e)}));case"LoadedTrade":t.a,f(kl,"Trying to update parameters on a trade that's already fully loaded!","");return t;default:return Cb}}),$b=r(function(e,t){switch(t.$){case"PartiallyLoadedTrade":var r=t.a;return kb(U(r,{phaseStartInfo:ya(e)}));case"LoadedTrade":t.a,f(kl,"Trying to update phaseStartInfo on a trade that's already fully loaded!","");return t;default:return Cb}}),xb=r(function(e,t){switch(t.$){case"PartiallyLoadedTrade":var r=t.a;return kb(U(r,{state:ya(e)}));case"LoadedTrade":var n=t.a;return Eb(U(n,{state:e}));default:return Cb}}),_b=r(function(e,t){switch(t.$){case"PartiallyLoadedTrade":var r=t.a;return kb(U(r,{terms:ya(e)}));case"LoadedTrade":t.a,f(kl,"Trying to update terms on a trade that's already fully loaded!","");return t;default:return Cb}}),Lb=c(function(e,t,r,n,a,i,o,u,s){return{abortPunishment:a,autoabortInterval:o,autorecallInterval:i,autoreleaseInterval:u,beneficiaryDeposit:n,initiatedByCustodian:t,initiator:e,pokeReward:s,tradeAmount:r}}),Pb=Po(f(im,jd,f(im,jd,f(im,jd,f(im,jd,f(im,jd,f(im,jd,f(im,jd,f(im,Io,f(im,Dd,rm(Lb))))))))))),Db=function(e){return{data:ya(f(df,"getParameters()",mr)),decoder:Pb,from:ma,gas:ma,gasPrice:ma,nonce:ma,to:ya(e),value:ma}},Ub=function(e){return f(jf,function(e){return Ff(1e3*e)},nl(Tl(e)))},Ob=a(function(e,t,r,n){if("Err"===t.$){var a=t.a;return wi(a)}var i=t.a;if("Err"===r.$){var a=r.a;return wi(a)}var o=r.a;if("Err"===n.$){var a=n.a;return wi(a)}var u=n.a;return Ii(l(e,i,o,u))}),Mb=function(e){var t=f(_l,"error converting BigInt to Time.Posix",Ub(e.autoabortInterval)),r=f(_l,"error converting BigInt to Time.Posix",Ub(e.autoreleaseInterval)),a=f(_l,"error converting BigInt to Time.Posix",Ub(e.autorecallInterval));return d(Ob,n(function(t,r,n){return{abortPunishment:Fv(e.abortPunishment),autoabortInterval:r,autorecallInterval:t,autoreleaseInterval:n,buyerDeposit:Fv(e.beneficiaryDeposit),initiatorAddress:e.initiator,initiatorRole:e.initiatedByCustodian?Of:ry,pokeReward:Fv(e.pokeReward),tradeAmount:Fv(e.tradeAmount)}}),a,t,r)},Fb=n(function(e,t,r){return f(vp,r,f(up,Mb,f(np,e.httpProvider,Db(t))))}),Vb=function(e){return function(t){return function(r){return function(n){return function(a){return function(i){return function(o){return function(u){return function(s){return function(c){return{v0:e,v1:t,v2:r,v3:n,v4:a,v5:i,v6:o,v7:u,v8:s,v9:c}}}}}}}}}}},Kb=Po(f(im,jd,f(im,jd,f(im,jd,f(im,jd,f(im,jd,f(im,jd,f(im,jd,f(im,jd,f(im,jd,f(im,jd,rm(Vb)))))))))))),Hb=function(e){return{data:ya(f(df,"getPhaseStartInfo()",mr)),decoder:Kb,from:ma,gas:ma,gasPrice:ma,nonce:ma,to:ya(e),value:ma}},jb=i(function(e,t,r,n,a){if("Nothing"===t.$)return ma;var i=t.a;if("Nothing"===r.$)return ma;var o=r.a;if("Nothing"===n.$)return ma;var u=n.a;if("Nothing"===a.$)return ma;var s=a.a;return ya(d(e,i,o,u,s))}),qb=function(e){return h(jb,a(function(t,r,n,a){return{claimedBlock:e.v3,claimedTime:n,closedBlock:e.v4,closedTime:a,committedBlock:e.v2,committedTime:r,openedBlock:e.v1,openedTime:t}}),Ub(e.v6),Ub(e.v7),Ub(e.v8),Ub(e.v9))},Gb=n(function(e,t,r){return f(vp,r,f(up,qb,f(np,e.httpProvider,Hb(t))))}),zb=i(function(e,t,r,n,a){return{balance:e,closedReason:a,phase:t,phaseStartTimestamp:r,responder:n}}),Yb=Po(f(im,jd,f(im,Dd,f(im,jd,f(im,jd,f(im,jd,rm(zb))))))),Wb=function(e){return{data:ya(f(df,"getState()",mr)),decoder:Yb,from:ma,gas:ma,gasPrice:ma,nonce:ma,to:ya(e),value:ma}},Jb={$:"Aborted"},Qb={$:"Burned"},Xb={$:"NotClosed"},Zb={$:"Recalled"},eC={$:"Released"},tC=function(e){switch(f(ec,99,nl(Tl(e)))){case 0:return ya(Xb);case 1:return ya(Zb);case 2:return ya(Jb);case 3:return ya(eC);case 4:return ya(Qb);default:return ma}},rC={$:"Closed"},nC={$:"Committed"},aC={$:"Judgment"},iC=function(e){switch(f(ec,99,nl(Tl(e)))){case 1:return ya(no);case 2:return ya(nC);case 3:return ya(aC);case 4:return ya(rC);default:return ma}},oC=function(e){return $(e,td("0x0000000000000000000000000000000000000000"))?ma:ya(e)},uC=a(function(e,t,r,n){if("Nothing"===t.$)return ma;var a=t.a;if("Nothing"===r.$)return ma;var i=r.a;if("Nothing"===n.$)return ma;var o=n.a;return ya(l(e,a,i,o))}),sC=function(e){var t=Ub(e.phaseStartTimestamp),r=iC(e.phase),a=tC(e.closedReason);return d(uC,n(function(t,r,n){return{balance:Fv(e.balance),closedReason:n,phase:t,phaseStartTime:r,responder:oC(e.responder)}}),r,t,a)},cC=n(function(e,t,r){return f(vp,r,f(up,sC,f(np,e.httpProvider,Wb(t))))}),fC=i(function(e,t,r,n,a){return ao(F([l(Fb,e,t,r),l(cC,e,t,n),l(Gb,e,t,a)]))}),lC=function(e){var t=zp(e);if("Just"===t.$){return t.a}f(kl,"Warning! BigInt to Int conversion failed!",Tl(e));return 0},dC=a(function(e,t,r,n){return{encapsulatedKey:e,iv:t,message:n,tag:r}}),hC=n(function(e,t,r){for(;;){var n=f(ci,32,e),a=n.a,i=n.b;if(_(bi(a),32)<0)return f(Ci,!0,{nodeList:t,nodeListSize:r,tail:a});var o=i,u=f(qa,ui(a),t),s=r+1;e=o,t=u,r=s}}),pC=function(e){return e.b?l(hC,e,mr,0):oi},gC=rn,vC=function(e){var t=h(gC,dC,f(Od,"encapsulation",xo),f(Od,"iv",xo),f(Od,"tag",xo),f(Od,"encrypted",xo)),r=Dm(t),n=f(Yd,r,e);if("Err"===n.$){var a=n.a;return wi(Qi(a))}var i=n.a;return function(e){var t=L(f(bc,0,e),f(bc,1,e));if("Just"===t.a.$&&"Just"===t.b.$){var r=t.a.a,n=t.b.a;return Ii(L(r,n))}return wi("Decoded list has less than 2 items.")}(pC(i))},yC=function(e){var t=function(e){var t=go(e);return t>1114111?wi("string is too long"):Ii(f(qu,Km(t),e))};return f(Eo,qi(""),Ad(f(tu,t,e)))},mC=function(e){var t=e.a,r=e.b;return yC(F([t.encapsulatedKey,t.iv,t.tag,t.message,r.encapsulatedKey,r.iv,r.tag,r.message]))},bC=r(function(e,t){return Jd(F([L("message",Gd(e)),L("pubkeyHexStrings",f(Wd,Gd,F([t.initiatorPubkey,t.responderPubkey])))]))}),CC=function(e){return{$:"LoadedCommInfo",a:e}},SC=r(function(e,t){return{initiatorPubkey:e,responderPubkey:t}}),EC=function(e){var t=L(e.initiatorPubkey,e.responderPubkey);if("Just"===t.a.$&&"Just"===t.b.$){var r=t.a.a,n=t.b.a;return CC(f(SC,r,n))}return Zy(e)},TC=r(function(e,t){if("PartiallyLoadedCommInfo"===t.$){var r=t.a;return EC(U(r,{initiatorPubkey:ya(e)}))}var n=t.a;return CC(U(n,{initiatorPubkey:e}))}),wC=r(function(e,t){if("PartiallyLoadedCommInfo"===t.$){var r=t.a;return EC(U(r,{responderPubkey:ya(e)}))}var n=t.a;return CC(U(n,{responderPubkey:e}))}),IC=r(function(e,t){var r=L(t,e);if("Initiator"===r.a.$){if("Buyer"===r.b.$){r.a,r.b;return ry}r.a,r.b;return Of}if("Buyer"===r.b.$){r.a,r.b;return Of}r.a,r.b;return ry}),AC=r(function(e,t){for(;;){if(!e.b)return t;var r=e.a,n=e.b,a=xi(r),i=f(al,a,n),o=Qu(f($s,a,n)),u=O(t,F([o])),s=i,c=u;e=s,t=c}}),BC=function(e){var t=pC(f(AC,bs(e),mr));return l(Yl,Ig,h(jb,dC,f(bc,0,t),f(bc,1,t),f(bc,2,t),f(bc,3,t)),h(jb,dC,f(bc,4,t),f(bc,5,t),f(bc,6,t),f(bc,7,t)))},kC={$:"Aborted"},NC={$:"Burned"},RC={$:"Claimed"},$C=function(e){return{$:"Committed",a:e}},xC=function(e){return{$:"Encrypted",a:e}},_C={$:"FailedDecode"},LC={$:"Initiated"},PC={$:"Recalled"},DC={$:"Released"},UC=function(e){return{$:"StateChange",a:e}},OC=function(e){return{$:"Statement",a:e}},MC=lr,FC=fr,VC=r(function(e,t){var r=bi(e),n=32-bi(t.tail)-r,a=l(MC,32,t.tail,e);return n<0?{nodeList:f(qa,ui(a),t.nodeList),nodeListSize:t.nodeListSize+1,tail:l(FC,n,r,e)}:n?{nodeList:t.nodeList,nodeListSize:t.nodeListSize,tail:a}:{nodeList:f(qa,ui(a),t.nodeList),nodeListSize:t.nodeListSize+1,tail:ii}}),KC=ur,HC=y,jC=a(function(e,t,r,n){var a=gc&t>>>e;if(_(a,bi(n))>-1){if(5===e)return f(KC,ui(r),n);var i=si(d(jC,e-ai,t,r,ii));return f(KC,i,n)}var o=f(vc,a,n);if("SubTree"===o.$){var u=o.a,i=si(d(jC,e-ai,t,r,u));return l(Ec,a,i,n)}var i=si(d(jC,e-ai,t,r,HC(o)));return l(Ec,a,i,n)}),qC=r(function(e,t){var r=t.a,n=t.b,a=t.c,i=t.d,o=bi(i),u=bi(e),s=r+(u-o);if($(u,32)){if(_(s>>>ai,1<0){var c=n+ai,f=d(jC,c,r,e,HC(si(a)));return d(ei,s,c,f,ii)}return d(ei,s,n,d(jC,n,r,e,a),ii)}return d(ei,s,n,a,e)}),GC=r(function(e,t){var r=(t.a,t.c,t.d),n=bi(e),a=32-bi(r)-n,i=l(MC,32,r,e),o=f(qC,i,t);if(a<0){var u=l(FC,a,n,e);return f(qC,u,o)}return o}),zC=sr,YC=function(e){var t=e.a,n=e.c,a=e.d,i=r(function(e,t){if("SubTree"===e.$){var r=e.a;return l(zC,i,t,r)}return f(qa,e,t)});return{nodeList:l(zC,i,mr,n),nodeListSize:t/32|0,tail:a}},WC=r(function(e,t){var n=(e.d,t.a),a=t.c,i=t.d;if(_(n,128)<1){var o=r(function(e,t){if("SubTree"===e.$){var r=e.a;return l(zC,o,t,r)}var n=e.a;return f(GC,n,t)});return f(GC,i,l(zC,o,e,a))}var o=r(function(e,t){if("SubTree"===e.$){var r=e.a;return l(zC,o,t,r)}var n=e.a;return f(VC,n,t)});return f(Ci,!0,f(VC,i,l(zC,o,YC(e),a)))}),JC=r(function(e,t){if("Nothing"===e.$)return t;var r=e.a;return f(qa,r,t)}),QC=f(Ja,JC,mr),XC=n(function(e,t,r){var n=IC(r.initiatorRole),a=function(){switch(t.$){case"InitiatedEvent":return ya(UC(LC));case"CommittedEvent":var r=t.a;return ya(UC($C(r.responder)));case"RecalledEvent":return ya(UC(PC));case"ClaimedEvent":return ya(UC(RC));case"AbortedEvent":return ya(UC(kC));case"ReleasedEvent":return ya(UC(DC));case"BurnedEvent":return ya(UC(NC));case"InitiatorStatementLogEvent":var r=t.a;return ya(OC({blocknum:e,message:function(){var e=BC(r.statement);if("Just"===e.$){var t=e.a;return xC(t)}return _C}(),who:n(gb)}));case"ResponderStatementLogEvent":var r=t.a;return ya(OC({blocknum:e,message:function(){var e=BC(r.statement);if("Just"===e.$){var t=e.a;return xC(t)}return _C}(),who:n(vb)}));default:return ma}}(),i=f(jf,function(t){return{blocknum:e,eventInfo:t,time:ma}},a);return L(U(r,{history:f(WC,r.history,pC(QC(F([i]))))}),function(){return"Just"===a.$&&"Statement"===a.a.$}())}),ZC=zr,eS=function(e){var t=l(Af,Ig,f(Od,"id",ZC),f(Od,"message",xo));return f(ql,Qi,f(Yd,t,e))},tS=function(e){return{$:"Decrypted",a:e}},rS=a(function(e,t,r,n){return{appCmds:n,maybeMessageSubmit:r,model:e,shouldCallDecrypt:t}}),nS=r(function(e,t){switch(e.$){case"NewEvent":var r=e.a,n=r.a,a=r.b,i=l(XC,n,a,t),o=i.a,u=i.b;return d(rS,o,u,ma,mr);case"MessageInputChanged":var s=e.a;return d(rS,U(t,{messageInput:s}),!1,ma,mr);case"MessageSubmit":return d(rS,U(t,{messageInput:""}),!1,ya(t.messageInput),mr);default:var c=e.a,h=eS(c);if("Ok"===h.$){var p=h.a,g=p.a,v=p.b,y=f(bc,g,t.history);if("Just"===y.$){var m=y.a,b=m.eventInfo;if("Statement"===b.$){var C=b.a,S=U(C,{message:tS(v)}),E=U(m,{eventInfo:OC(S)}),T=l(wc,g,E,t.history);return d(rS,U(t,{history:T}),!1,ma,mr)}return d(rS,t,!1,ma,F([Sf(f(Qp,"got a decryption result, but for an event that is not a message!",m))]))}return d(rS,t,!1,ma,F([Sf(f(Qp,"got a decryption result, but for an id out of bounds!",L(g,t.history)))]))}var w=h.a;return d(rS,t,!1,ma,F([Sf(f(Qp,"Error decoding decryption result",w))]))}}),aS=r(function(e,t){return{$:"ActionMined",a:e,b:t}}),iS=r(function(e,t){return{$:"ActionSigned",a:e,b:t}}),oS=function(e){return{onBroadcast:ma,onMined:ya(L(aS(e),ma)),onSign:ya(iS(e))}},uS=qe("encryptToPubkeys",to),sS=n(function(e,t,r){return{data:ya(f(df,"commit(address,string)",F([id(t),Ep(r)]))),decoder:_o(vr),from:ma,gas:ma,gasPrice:ma,nonce:ma,to:ya(e),value:ma}}),cS=n(function(e,t,r){return{data:ya(f(df,"commit(address,string)",F([id(t),Ep(r)]))),decoder:_o(vr),from:ma,gas:ma,gasPrice:ma,nonce:ma,to:ya(e),value:ma}}),fS=function(e){return{$:"CommitMined",a:e}},lS={$:"CommitNeedsSig"},dS=function(e){return{$:"CommitSigned",a:e}},hS=a(function(e,t,r,n){var a=function(){return"Token"===e.factoryType.$?cS:sS}(),i=mf(function(){return"Token"===e.factoryType.$?to:$p(Hf(mb(t.parameters)))}()(l(a,t.creationInfo.address,r,n)));return L(ya(lS),f(gf,{onBroadcast:ma,onMined:ya(L(fS,ma)),onSign:ya(dS)},i))}),pS=r(function(e,t){return Jd(F([L("id",yh(e)),L("encapsulation",Gd(t.encapsulatedKey)),L("iv",Gd(t.iv)),L("tag",Gd(t.tag)),L("encrypted",Gd(t.message))]))}),gS=qe("decryptMessage",to),vS=function(e){var t=e.a,n=r(function(e,t){var r=t.a,n=t.b;return L(r-1,f(qa,L(r,e),n))});return l(Oa,n,L(t-1,mr),e).b},yS=r(function(e,t){return ao(f(tu,function(e){var r=e.a,n=e.b,a=n.eventInfo;if("Statement"===a.$){var i=a.a,o=i.message;if("Encrypted"===o.$){var u=o.a,s=function(){return"Initiator"===t.$?u.a:u.b}();return gS(f(pS,r,s))}return io}return io},vS(e.history)))}),mS=function(e){if("Just"===e.$){return e.a}return ma},bS=function(e){var t=mS(l(Yl,yb,function(){var t=e.trade;if("LoadedTrade"===t.$){var r=t.a;return ya(r)}return ma}(),f(jf,function(e){return e.address},e.userInfo))),r=L(e.chatHistoryModel,t);if("Just"===r.a.$&&"Just"===r.b.$){var n=r.a.a,a=r.b.a;return f(yS,n,a)}return io},CS=r(function(e,t){return f(jf,function(t){var r=L(t,e.parameters.initiatorRole);if("Initiator"===r.a.$){if("Seller"===r.b.$){r.a,r.b;return Of}r.a,r.b;return ry}if("Seller"===r.b.$){r.a,r.b;return ry}r.a,r.b;return Of},f(yb,e,t))}),SS=r(function(e,t){return f(r(function(e,t){for(;;){var r=t.a,n=t.b;if(!e.b)return L(r,n);var a=e.a,i=a.a,o=a.b,u=e.b,s=l(XC,i,o,r),c=s.a,f=s.b,d=u,h=L(c,n||f);e=d,t=h}}),e,L(t,!1))}),ES=o(function(e,t,r,n,a,i){return{history:a,initiatorRole:n,messageInput:i,userInfo:t,userRole:r,web3Context:e}}),TS=i(function(e,t,r,n,a){return f(SS,a,p(ES,e,t,r,n,oi,""))}),wS=a(function(e,t,r,n){var a=L(t,r);if("LoadedTrade"===a.a.$&&"Just"===a.b.$){var i=a.a.a,o=a.b.a,u=f(CS,i,o.address);if("Just"===u.$){var s=u.a;return f(Qo,ya,h(TS,e,o,s,i.parameters.initiatorRole,n))}return L(ma,!1)}return L(ma,!1)}),IS={$:"Abort"},AS=r(function(e,t){return{$:"ActionMining",a:e,b:t}}),BS=function(e){return{$:"ActionNeedsSig",a:e}},kS=function(e){return{$:"ApproveMining",a:e}},NS={$:"ApproveNeedsSig"},RS=function(e){return{$:"ApproveSigned",a:e}},$S={$:"Burn"},xS=function(e){return{$:"ChatHistoryMsg",a:e}},_S={$:"Claim"},LS=function(e){return{$:"CommitMining",a:e}},PS=function(e){return{$:"ConfirmingAction",a:e}},DS=n(function(e,t,r){return{$:"ConfirmingCommit",a:e,b:t,c:r}}),US=function(e){return{$:"EventLogFetched",a:e}},OS=function(e){return{$:"ParametersFetched",a:e}},MS=function(e){return{$:"PhaseInfoFetched",a:e}},FS={$:"Poke"},VS={$:"Recall"},KS={$:"Release"},HS=function(e){return{$:"StartContractAction",a:e}},jS=function(e){return{$:"StateFetched",a:e}},qS=function(e){switch(e.$){case"Poke":return"poke";case"Recall":return"recall";case"Claim":return"claim";case"Abort":return"abort";case"Release":return"release";default:return"burn"}},GS=function(e){return d(dm,e,io,co,mr)},zS={align:Yp,mainParagraphs:F([F([Jp("Can't find a trade by that ID. I'll try again in half a second.")])]),noticeType:Xp},YS=r(function(e,t){if("Err"===t.$){var r=t.a;return f(Zp,e,r)}if("Nothing"===t.a.$){t.a;return f(Qp,"Couldn't decode the fetched \""+e+'" result.',ma)}return f(Qp,"fromBadFetchResultMaybe being called with an 'OK (Just a)' value",t)}),WS={align:Yp,mainParagraphs:F([F([Jp("Sorry, I'm not yet able to deal with this kind of trade. This must have been created by some other DAIHard interface.")])]),noticeType:Xp},JS=r(function(e,t){return{$:"GetLogs",a:e,b:t}}),QS=n(function(e,t,r){return l(Dh,e,jf(function(e){return U(e,{logCount:Oi(t)+e.logCount})}),r)}),XS=r(function(e,t){var r=t.a;return ym(f(Ph,e,r))}),ZS=n(function(e,t,r){var n=e.a,a=f(Sh,t,n.requests);if("Nothing"===a.$)return L(vm(n),io);var i=a.a,o=L(i.watchOnce,Xf(r));if("Nothing"===o.b.$){o.b;return L(vm(U(n,{requests:l(QS,t,r,n.requests)})),io)}if(o.a){var u=o.b.a;return L(vm(U(n,{requests:l(QS,t,r,n.requests),watching:f(XS,t,n.watching)})),f(dg,i.tagger,Qh(u)))}return L(vm(U(n,{requests:l(QS,t,r,n.requests)})),ao(f(tu,function(e){return f(dg,i.tagger,Qh(e))},r)))}),eE=_e,tE=r(function(e,t){return f(vp,f($a,gm,t),f(ip,function(t){return pm(e)},eE(2e3)))}),rE=se,nE=fe,aE=n(function(e,t,r){var n=function(e){return nE(F([e,rE(r)]))};return f(Ro,function(a){var i=f(Yd,e,a);if("Ok"===i.$){var o=i.a,u=f(Yd,n(t),o);if("Ok"===u.$){var s=u.a;return _o(s)}var c=u.a;return $o(Qi(c))}return _o(r)},Zi)}),iE=a(function(e,t,r,n){return f(dd,l(aE,f(Od,e,Zi),t,r),n)}),oE=n(function(e,t,r){return f(dd,f(Od,e,t),r)}),uE=Lo(Pd),sE=gd(f(ec,md,yd("^((0[Xx]){1})?[0-9a-fA-F]{64}$"))),cE=function(e){return{$:"BlockHash",a:e}},fE=function(e){return sE(e)?Ii(cE(Bo(e))):wi("Given blockHash "+Ld(e)+" is not valid.")},lE=Lo(fE),dE=function(e){return{$:"TxHash",a:e}},hE=function(e){return sE(e)?Ii(dE(Bo(e))):wi("Given txHash "+Ld(e)+" is not valid.")},pE=Lo(hE),gE=c(function(e,t,r,n,a,i,o,u,s){return{address:e,blockHash:u,blockNumber:s,data:t,logIndex:a,removed:n,topics:r,transactionHash:o,transactionIndex:i}}),vE=Yr,yE=l(oE,"blockNumber",hm,l(oE,"blockHash",lE,l(oE,"transactionHash",pE,l(oE,"transactionIndex",hm,l(oE,"logIndex",hm,d(iE,"removed",vE,!1,l(oE,"topics",Dm(lb),l(oE,"data",xo,l(oE,"address",uE,_o(gE)))))))))),mE=function(e){return f(Wd,function(e){if("Just"===e.$){var t=e.a;return Gd(lf(t))}return uh},e)},bE=function(e){return Jd(F([L("fromBlock",nh(e.fromBlock)),L("toBlock",nh(e.toBlock)),L("address",ah(e.address)),L("topics",mE(e.topics))]))},CE=r(function(e,t){return ep({decoder:Dm(yE),method:"eth_getLogs",params:F([bE(t)]),url:e})}),SE=function(e){return{$:"BlockNum",a:e}},EE=n(function(e,t,r){var n=r.a,a=r.b;return"BlockNum"===t.toBlock.$?f(ip,function(r){return f(up,$i(r),f(CE,e,U(t,{fromBlock:SE(n),toBlock:SE(a)})))},f(CE,e,t)):f(CE,e,t)}),TE=n(function(e,t,r){var n=r.a,a=r.b;return f(CE,e,U(t,{fromBlock:SE(n),toBlock:SE(a)}))}),wE=n(function(e,t,r){for(;;){if("RBEmpty_elm_builtin"===r.$)return t;var n=r.b,a=r.c,i=r.d,o=r.e,u=e,s=l(e,n,a,l(wE,e,t,i)),c=o;e=u,t=s,r=c}}),IE=r(function(e,t){return l(wE,Bh,t,e)}),AE=r(function(e,t){var r=e.a,n=t.a;return ym(f(IE,r,n))}),BE=r(function(e,t){var r=t.a;if("BlockNumber"===e.$){if("Ok"===e.a.$){var a=e.a.a,i=n(function(e,t,n){return ao(f(tu,function(t){return f(vp,f($a,JS(t.ref),r.tagger),l(n,r.nodePath,t.logFilter,e))},QC(f(tu,function(e){return f(Sh,e,r.requests)},ja(t)))))}),o=r.blockNumber;if("Just"===o.$){var u=o.a;return a-u?L(vm(U(r,{blockNumber:ya(a)})),ao(F([f(tE,r.nodePath,r.tagger),l(i,L(u+1,a),r.watching,TE)]))):L(t,f(tE,r.nodePath,r.tagger))}return L(vm(U(r,{blockNumber:ya(a),pending:mm,watching:f(AE,r.watching,r.pending)})),ao(F([f(tE,r.nodePath,r.tagger),l(i,L(a,a),r.pending,EE),l(i,L(a,a),r.watching,TE)])))}var s=e.a.a;return L(vm(U(r,{errors:f(qa,s,r.errors)})),f(tE,r.nodePath,r.tagger))}if("Ok"===e.b.$){var c=e.a,d=e.b.a;return l(ZS,t,c,d)}var s=e.b.a;return L(vm(U(r,{errors:f(qa,s,r.errors)})),io)}),kE=r(function(e,t){var r=t.a;return ym(l(Bh,e,vr,r))}),NE=a(function(e,t,r,n){var a=r.a,i={logCount:0,logFilter:n,ref:a.ref,tagger:t,watchOnce:e},o=U(a,{ref:a.ref+1,requests:l(Bh,a.ref,i,a.requests)}),u=a.blockNumber;if("Just"===u.$){var s=u.a;return function(e){return P(vm(U(o,{watching:f(kE,a.ref,o.watching)})),f(vp,f($a,JS(a.ref),a.tagger),e),a.ref)}(l(EE,a.nodePath,n,L(s,s)))}return P(vm(U(o,{pending:f(kE,a.ref,o.pending)})),io,a.ref)}),RE=NE(!1),$E=function(e){return F([e])},xE=r(function(e,t){e:for(;;)switch(e.$){case"Refresh":var r=(e.a,function(){var e=t.trade;if("PartiallyLoadedTrade"===e.$){var r=e.a;return"Nothing"===r.creationInfo.$?f(fm,t.web3Context,r.id):io}return io}()),n=function(){var e=P(t.userInfo,t.trade,t.web3Context.factoryType);if("Just"===e.a.$&&"LoadedTrade"===e.b.$&&"Token"===e.c.$){var r=e.a.a,n=e.b.a,a=e.c.a;return h(yp,t.web3Context,a,r.address,n.creationInfo.address,_y)}return io}(),a=function(){return"Nothing"===t.chatHistoryModel.$?d(wS,t.web3Context,t.trade,t.userInfo,t.eventsWaitingForChatHistory):L(t.chatHistoryModel,!1)}(),i=a.a,o=a.b,u=U(t,{chatHistoryModel:i}),s=o?bS(t):io,c=t.trade;if("LoadedTrade"===c.$){var p=c.a;return d(dm,u,ao(F([l(cC,t.web3Context,p.creationInfo.address,jS),s,r,n])),co,mr)}return GS(u);case"AllowanceFetched":var g=e.a;if("Ok"===g.$){var v=g.a,u=U(t,{allowance:ya(v)}),y=P(u.txChainStatus,u.trade,u.userInfo);if("Just"===y.a.$&&"ApproveMining"===y.a.a.$&&"LoadedTrade"===y.b.$&&"Just"===y.c.$){var m=y.b.a,b=y.c.a;if($(f(Su,v,Hf(mb(m.parameters))),Da))return GS(u);var C=d(hS,t.web3Context,m,b.address,b.commPubkey),S=C.a,E=C.b;return d(dm,U(u,{txChainStatus:S}),io,E,mr)}return GS(u)}var T=g.a;return d(dm,t,io,co,F([Sf(f(Zp,"allowance",T))]));case"CreationInfoFetched":var g=e.a;if("Ok"===g.$){var w=g.a,I={address:w.address_,blocknum:lC(w.blocknum)},A=l(RE,US,t.eventSentry,{address:I.address,fromBlock:SE(I.blocknum),toBlock:rp,topics:mr}),B=A.a,k=A.b,u=U(t,{eventSentry:B,trade:f(Nb,I,t.trade)}),N=ao(F([k,h(fC,u.web3Context,I.address,OS,jS,MS)]));return d(dm,u,N,co,mr)}if("BadBody"===g.a.$){g.a.a;return d(dm,t,io,co,F([Sf(zS)]))}var T=g.a;return d(dm,t,io,co,F([Sf(f(Zp,"trade state",T))]));case"StateFetched":var g=e.a;if("Ok"===g.$&&"Just"===g.a.$){var R=g.a.a,x=function(){var e=t.trade;switch(e.$){case"PartiallyLoadedTrade":return!0;case"LoadedTrade":return!$(e.a.state.phase,R.phase);default:return!1}}(),u=U(t,{expandedPhase:x?R.phase:t.expandedPhase,trade:f(xb,R,t.trade)});return d(dm,u,bS(u),co,mr)}return d(dm,t,io,co,F([Sf(f(YS,"trade state",g))]));case"ParametersFetched":var g=e.a;if("Ok"===g.$){if("Ok"===g.a.$){var _=g.a.a;if(bb(_)){var u=U(t,{trade:f(Rb,_,t.trade)});return d(dm,u,bS(u),co,mr)}return d(dm,t,io,co,F([Sf(WS)]))}var D=g.a.a;return d(dm,t,io,co,F([Sf(f(Qp,"Error decoding fetched trade parameters",D))]))}var M=g.a;return d(dm,t,io,co,F([Sf(f(Zp,"trade parameters",M))]));case"PhaseInfoFetched":var g=e.a;if("Ok"===g.$&&"Just"===g.a.$){var V=g.a.a,u=U(t,{trade:f($b,V,t.trade)});return d(dm,u,bS(u),co,mr)}return d(dm,t,io,co,F([Sf(f(YS,"trade state",g))]));case"EventLogFetched":var K=e.a,H=f(Qd,pb,K),j=H.returnData;if("Err"===j.$){var q=j.a;return d(dm,t,io,co,F([Sf(f(Qp,"Error decoding contract event",q))]))}var G=j.a,z=function(){switch(G.$){case"InitiatedEvent":var e=G.a;return f(TC,e.commPubkey,t.secureCommInfo);case"CommittedEvent":var e=G.a;return f(wC,e.commPubkey,t.secureCommInfo);default:return t.secureCommInfo}}(),Y=function(){if("InitiatedEvent"===G.$){var e=G.a,r=Um(e.terms);if("Ok"===r.$){var n=r.a;return L(f(_b,n,t.trade),ma)}var a=r.a;return L(t.trade,ya(f(Qp,"Couldn't decode payment methods!",a)))}return L(t.trade,ma)}(),W=Y.a,J=Y.b,Q=function(){var e=t.chatHistoryModel;if("Just"===e.$){var r=e.a;return f(Qo,ya,l(XC,H.blockNumber,G,r))}return d(wS,t.web3Context,W,t.userInfo,t.eventsWaitingForChatHistory)}(),i=Q.a,o=Q.b,X=function(){return"Nothing"===i.$?f(Qa,t.eventsWaitingForChatHistory,F([L(H.blockNumber,G)])):mr}(),u=U(t,{chatHistoryModel:i,eventsWaitingForChatHistory:X,secureCommInfo:z,trade:W}),N=o?bS(u):io;return d(dm,u,N,co,f(tu,Sf,QC(F([J]))));case"ExpandPhase":var Z=e.a;return GS(U(t,{expandedPhase:Z}));case"ToggleChat":var ee=!t.showChatHistory;return GS(U(t,{showChatHistory:ee}));case"ToggleStatsModal":var te=!t.showStatsModal;return GS(U(t,{showStatsModal:te}));case"ViewUserHistory":var re=e.a,ne=t.trade;if("LoadedTrade"===ne.$){var m=ne.a;return d(dm,t,io,co,F([lo(f(vf,m.parameters.initiatorAddress,re))]))}return d(dm,t,io,co,F([Sf(f(Qp,"Trying to view a user's history for a not-yet-loaded Trade",t.trade))]));case"CommitClicked":var m=e.a,b=e.b,ae=e.c;return GS(U(t,{txChainStatus:ya(l(DS,m,b,ae))}));case"AbortAction":return GS(U(t,{txChainStatus:ma}));case"ConfirmCommit":var m=e.a,b=e.b,ae=e.c,ie=function(){var e=t.web3Context.factoryType;if("Native"===e.$)return d(hS,t.web3Context,m,b.address,b.commPubkey);var r=e.a,n=function(){var e=mf(l(sd,nd(r),m.creationInfo.address,ae)),t={onBroadcast:ma,onMined:ma,onSign:ya(RS)};return f(gf,t,e)}(),a=t.allowance;if("Just"===a.$){var i=a.a;return $(f(Su,i,Hf(mb(m.parameters))),Da)?L(ya(NS),n):d(hS,t.web3Context,m,b.address,b.commPubkey)}return L(ya(NS),n)}(),S=ie.a,E=ie.b;return d(dm,U(t,{txChainStatus:S}),io,E,mr);case"ContractActionClicked":var oe=e.a;if($(oe,FS)||$(oe,VS)){var ue=HS(oe),se=t;e=ue,t=se;continue e}return GS(U(t,{txChainStatus:ya(PS(oe))}));case"StartContractAction":var ce=e.a,fe=function(){var e=t.trade;if("LoadedTrade"!==e.$){var r=e;return P(t.txChainStatus,co,F([Sf(f(Qp,"Trying to handle StartContractAction msg for a not-yet-loaded Trade",r))]))}var n=e.a;switch(ce.$){case"Recall":var a=mf(Im(n.creationInfo.address));return P(ya(BS(VS)),f(gf,oS(VS),a),mr);case"Claim":var a=mf(Tm(n.creationInfo.address));return P(ya(BS(_S)),f(gf,oS(_S),a),mr);case"Abort":var a=mf(Sm(n.creationInfo.address));return P(ya(BS(IS)),f(gf,oS(IS),a),mr);case"Release":var a=mf(Am(n.creationInfo.address));return P(ya(BS(KS)),f(gf,oS(KS),a),mr);case"Burn":var a=mf(Em(n.creationInfo.address));return P(ya(BS($S)),f(gf,oS($S),a),mr);default:var a=mf(hf(n.creationInfo.address));return P(ya(BS(FS)),f(gf,oS(FS),a),mr)}}(),S=fe.a,E=fe.b,le=fe.c;return d(dm,U(t,{txChainStatus:S}),io,E,le);case"ApproveSigned":var de=e.a;if("Ok"===de.$){var he=de.a;return GS(U(t,{txChainStatus:ya(kS(he))}))}var D=de.a;return d(dm,U(t,{txChainStatus:ma}),io,co,F([Sf(f(rg,"approve",D))]));case"CommitSigned":var de=e.a;if("Ok"===de.$){var he=de.a;return GS(U(t,{txChainStatus:ya(LS(he))}))}var D=de.a;return d(dm,U(t,{txChainStatus:ma}),io,co,F([Sf(f(rg,"commit",D))]));case"CommitMined":return GS(U(t,{txChainStatus:ma}));case"ActionSigned":var oe=e.a,de=e.b;if("Ok"===de.$){var he=de.a;return GS(U(t,{txChainStatus:ya(f(AS,oe,he))}))}var D=de.a;return d(dm,U(t,{txChainStatus:ma}),io,co,F([Sf(f(rg,qS(oe),D))]));case"ActionMined":var oe=e.a;return GS(U(t,{txChainStatus:ma}));case"EventSentryMsg":var pe=e.a,ge=f(BE,pe,t.eventSentry),ve=ge.a,N=ge.b;return d(dm,U(t,{eventSentry:ve}),N,co,mr);case"ChatHistoryMsg":var ye=e.a,me=t.chatHistoryModel;if("Just"===me.$){var be=me.a,Ce=f(nS,ye,be),Se=U(t,{chatHistoryModel:ya(Ce.model)}),s=Ce.shouldCallDecrypt?bS(t):io,Ee=function(){var e=Ce.maybeMessageSubmit;if("Just"===e.$){var r=e.a,n=t.secureCommInfo;if("LoadedCommInfo"===n.$){var a=n.a;return L(uS(f(bC,r,a)),ma)}return L(io,ya(f(Qp,"Trying to encrypt, but commInfo is not loaded",n)))}return L(io,ma)}(),Te=Ee.a,we=Ee.b;return d(dm,Se,ao(F([s,Te])),co,O(f(Uf,xS,Ce.appCmds),f(ec,mr,f(jf,$E,f(jf,Sf,we)))))}return d(dm,t,io,co,F([Sf(f(Qp,"Got a chat history message, but there is no chat history model!",ye))]));case"EncryptionFinished":var Ie=e.a,Ae=f(eh,mC,vC(Ie)),Be=P(t.userInfo,t.trade,Ae);if("Ok"===Be.c.$){if("Just"===Be.a.$&&"LoadedTrade"===Be.b.$){var b=Be.a.a,p=Be.b.a,ke=Be.c.a,Ne=f(yb,p,b.address);if("Nothing"===Ne.$)return d(dm,t,io,co,F([Sf(f(Qp,"Trying to encrypt, but the user is not involved in this trade.",ma))]));var Re=Ne.a,$e=function(){return mf("Initiator"===Re.$?f(wm,p.creationInfo.address,ke):f(Bm,p.creationInfo.address,ke))}();return d(dm,t,io,f(gf,{onBroadcast:ma,onMined:ma,onSign:ma},$e),mr)}var xe=Be.a,_e=Be.b;return d(dm,t,io,co,F([Sf(f(Qp,"Encryption successful, but the user or trade is no longer valid.",L(xe,_e)))]))}var Le=Be.c.a;return d(dm,t,io,co,F([Sf(f(Qp,"Error translating JS encryption result into Elm.",Le))]));case"MessageSubmitMined":if("Ok"===e.a.$){e.a.a;return GS(t)}var D=e.a.a;return d(dm,t,io,co,F([Sf(f(eg,"message",D))]));default:return d(dm,t,io,co,F([Ef]))}}),_E=function(e){return{$:"EventSentryMsg",a:e}},LE=n(function(e,t,r){return{invalid:r,loaded:t,total:e}}),PE=function(e){var t=f(bm,_E,e.httpProvider),r=t.a,n=t.b;return L({dataFetchStatus:l(LE,ma,0,0),eventSentry:r,trades:oi,web3Context:e},n)},DE=function(e){return{data:ya(f(df,"numTrades()",mr)),decoder:Po(jd),from:ma,gas:ma,gasPrice:ma,nonce:ma,to:ya(e),value:ma}},UE=r(function(e,t){return f(vp,t,f(np,e.httpProvider,DE(rd(e.factoryType))))}),OE=function(e){return{$:"InitialNumTradesFetched",a:e}},ME=function(e){return f(UE,e.web3Context,OE)},FE=function(e){var t=PE(e),r=t.a,n=t.b;return L(r,ao(F([n,ME(r)])))},VE=r(function(e,t){return{address:e,blocknum:t}}),KE=n(function(e,t,r){return function(e){return L(e.a,e.b)}(d(NE,!0,e,t,r))}),HE=n(function(e,t,r){var n=function(e){return r(f(Qd,Ym,e).returnData)},a={address:t.address,fromBlock:SE(t.blocknum),toBlock:SE(t.blocknum),topics:F([ya(hb("Initiated(string,string)"))])};return l(KE,n,e,a)}),jE=n(function(e,t,r){var n=e(t);if("Just"===n.$){var a=n.a;return f(qa,a,r)}return r}),qE=r(function(e,t){return l(Ja,jE(e),mr,t)}),GE=function(e){return f(qE,function(e){if("LoadedTrade"===e.$){var t=e.a;return ya(t)}return ma},Ma(e.trades))},zE=function(e){return f(za,r(function(t,r){return e(t)?r+1:r}),0)},YE=function(e){return f(zE,di(Cb),Ma(e.trades))},WE=function(e){return U(e,{dataFetchStatus:U(e.dataFetchStatus,{invalid:YE(e),loaded:Oi(GE(e))})})},JE=n(function(e,t,r){return{appCmds:r,cmd:t,tradeCache:e}}),QE=r(function(e,t){var r=f(bc,e,t.trades);if("Just"===r.$){var n=(r.a,l(wc,e,Cb,t.trades));return l(JE,WE(U(t,{trades:n})),io,mr)}return l(JE,t,io,F([Sf(f(Qp,"markTradeInvalid ran into an out-of-range error",L(e,t.trades)))]))}),XE=n(function(e,t,r){var n=f(bc,e,r.trades);if("Just"===n.$){var a=n.a,i=f(Nb,t,a),o=l(wc,e,i,r.trades);return L(WE(U(r,{trades:o})),mr)}return L(r,F([f(Qp,"updateTradeAddress ran into an out-of-range error",L(e,r.trades))]))}),ZE=n(function(e,t,r){var n=f(bc,e,r.trades);if("Just"===n.$){var a=n.a,i=f(Rb,t,a),o=l(wc,e,i,r.trades);return l(JE,WE(U(r,{trades:o})),io,mr)}return l(JE,r,io,F([Sf(f(Qp,"updateTradeParameters ran into an out-of-range error",L(e,r.trades)))]))}),eT=n(function(e,t,r){var n=f(bc,e,r.trades);if("Just"===n.$){var a=n.a,i=f($b,t,a),o=l(wc,e,i,r.trades);return l(JE,WE(U(r,{trades:o})),io,mr)}return l(JE,r,io,F([Sf(f(Qp,"updateTradePhaseTimeInfo ran into an out-of-range error",L(e,r.trades)))]))}),tT=n(function(e,t,r){var n=f(bc,e,r.trades);if("Just"===n.$){var a=n.a,i=f(xb,t,a),o=l(wc,e,i,r.trades);return l(JE,WE(U(r,{trades:o})),io,mr)}return l(JE,r,io,F([Sf(f(Qp,"updateTradeState ran into an out-of-range error",L(e,r.trades)))]))}),rT=n(function(e,t,r){var n=f(bc,e,r.trades);if("Just"===n.$){var a=n.a,i=f(_b,t,a),o=l(wc,e,i,r.trades);return l(JE,WE(U(r,{trades:o})),io,mr)}return l(JE,r,io,F([Sf(f(Qp,"updateTTPaymentMethods ran into an out-of-range error",L(e,r.trades)))]))}),nT=r(function(e,t){return{$:"CreationInfoFetched",a:e,b:t}}),aT=r(function(e,t){return{$:"InitiatedEventDataFetched",a:e,b:t}}),iT=function(e){return{$:"NumTradesFetchedAgain",a:e}},oT=r(function(e,t){return{$:"ParametersFetched",a:e,b:t}}),uT=r(function(e,t){return{$:"PhaseStartInfoFetched",a:e,b:t}}),sT=r(function(e,t){return{$:"StateFetched",a:e,b:t}}),cT=function(e){return l(JE,e,io,mr)},fT=r(function(e,t){switch(e.$){case"InitialNumTradesFetched":var r=e.a;if("Ok"===r.$){var n=r.a,a=lC(n),i=pC(f(tu,Qy,f(Vi,0,a-1))),o=ao(f(tu,function(e){return l(sm,t.web3Context,lu(e),nT(e))},f(Vi,0,a-1)));return l(JE,U(t,{dataFetchStatus:l(LE,ya(a),0,0),trades:i}),o,mr)}var u=r.a;return l(JE,t,io,F([Sf(f(Zp,"Factory numTrades",u))]));case"CheckForNewTrades":return l(JE,t,f(UE,t.web3Context,iT),mr);case"NumTradesFetchedAgain":var r=e.a,s=L(r,t.dataFetchStatus.total);if("Ok"===s.a.$){if("Just"===s.b.$){var n=s.a.a,c=s.b.a,d=lC(n);if(_(c,d)<0){var p=t.dataFetchStatus,o=ao(f(tu,function(e){return l(sm,t.web3Context,lu(e),nT(e))},f(Vi,c,d-1))),g=pC(f(tu,Qy,f(Vi,c,d-1)));return l(JE,U(t,{dataFetchStatus:U(p,{total:ya(d)}),trades:f(WC,t.trades,g)}),o,mr)}return cT(t)}s.b;return l(JE,t,io,F([Sf(f(Qp,"Trying to fetch additional trades, but there is an unexpected Nothing in the existing numTrades.",""))]))}var u=s.a.a;return l(JE,t,io,F([Sf(f(Zp,"Factory numTrades",u))]));case"CreationInfoFetched":var v=e.a,r=e.b;if("Ok"===r.$){var y=r.a,m=f(VE,y.address_,lC(y.blocknum)),b=l(HE,t.eventSentry,m,aT(v)),C=b.a,S=b.b,E=ao(F([h(fC,t.web3Context,m.address,oT(v),sT(v),uT(v)),S])),T=l(XE,v,m,t),w=T.a,I=T.b;return l(JE,WE(U(w,{eventSentry:C})),E,f(tu,Sf,I))}var u=r.a;return l(JE,t,io,F([Sf(f(Zp,"creationInfo",u))]));case"ParametersFetched":var v=e.a,r=e.b;if("Err"===r.$){var A=r.a;return l(JE,t,io,F([Sf(f(Zp,"parameters",A))]))}if("Ok"===r.a.$){var B=r.a.a;return l(ZE,v,B,t)}var k=r.a.a;return l(JE,t,io,F([Sf(f(Qp,"Can't decode fetched trade parameters",k))]));case"StateFetched":var v=e.a,r=e.b;if("Ok"===r.$&&"Just"===r.a.$){var N=r.a.a;return l(tT,v,N,t)}return l(JE,t,io,F([Sf(f(YS,"state",r))]));case"PhaseStartInfoFetched":var v=e.a,r=e.b;if("Ok"===r.$&&"Just"===r.a.$){var R=r.a.a;return l(eT,v,R,t)}return l(JE,t,io,F([Sf(f(YS,"phaseStartInfo",r))]));case"InitiatedEventDataFetched":var v=e.a,r=e.b;if("Ok"===r.$){var $=r.a,x=Um($.terms);if("Ok"===x.$){var P=x.a;return l(rT,v,P,t)}var D=x.a;return f(QE,v,t)}var D=r.a;return l(JE,t,io,F([Sf(f(Qp,"Error decoding initiated event",D))]));default:var O=e.a,M=f(BE,O,t.eventSentry),V=M.a,E=M.b;return l(JE,U(t,{eventSentry:V}),E,mr)}}),lT=function(e){return{$:"AgentHistoryMsg",a:e}},dT=function(e){return{$:"AppCmd",a:e}},hT={$:"BetaLandingPage"},pT={$:"ConnectToWeb3"},gT=function(e){return{$:"MarketplaceMsg",a:e}},vT=function(e){return{$:"TradeCacheMsg",a:e}},yT=r(function(e,t){return f(jn,e,Gd(t))}),mT=function(e){return f(yT,"href",it(e))},bT=qn("rel"),CT=yT("target"),ST=function(e){return{$:"Height",a:e}},ET=ST,TT={$:"Content"},wT=TT,IT=function(e){return{$:"Width",a:e}},AT=IT,BT=function(e){return{$:"Attr",a:e}},kT=function(e){return{$:"NodeName",a:e}},NT=function(e){return{$:"Unkeyed",a:e}},RT={$:"AsEl"},$T=RT,xT=r(function(e,t){return{$:"Field",a:e,b:t}}),_T=f(xT,0,0),LT={$:"NoNearbyChildren"},PT={above:"a",active:"atv",alignBottom:"ab",alignCenterX:"cx",alignCenterY:"cy",alignContainerBottom:"acb",alignContainerCenterX:"accx",alignContainerCenterY:"accy",alignContainerRight:"acr",alignLeft:"al",alignRight:"ar",alignTop:"at",alignedHorizontally:"ah",alignedVertically:"av",any:"s",behind:"bh",below:"b",bold:"w7",borderDashed:"bd",borderDotted:"bdt",borderNone:"bn",borderSolid:"bs",capturePointerEvents:"cpe",clip:"cp",clipX:"cpx",clipY:"cpy",column:"c",container:"ctr",contentBottom:"cb",contentCenterX:"ccx",contentCenterY:"ccy",contentLeft:"cl",contentRight:"cr",contentTop:"ct",cursorPointer:"cptr",cursorText:"ctxt",focus:"fcs",fullSize:"fs",grid:"g",hasBehind:"hbh",heightContent:"hc",heightFill:"hf",heightFillPortion:"hfp",hover:"hv",imageContainer:"ic",inFront:"fr",inputMultiline:"iml",inputText:"it",italic:"i",nearby:"nb",noTextSelection:"notxt",onLeft:"ol",onRight:"or",opaque:"oq",overflowHidden:"oh",page:"pg",paragraph:"p",passPointerEvents:"ppe",root:"ui",row:"r",scrollbars:"sb",scrollbarsX:"sbx",scrollbarsY:"sby",seButton:"sbt",single:"e",sizeByCapital:"cap",spaceEvenly:"sev",strike:"sk",text:"t",textCenter:"tc",textExtraBold:"w8",textExtraLight:"w2",textHeavy:"w9",textJustify:"tj",textJustifyAll:"tja",textLeft:"tl",textLight:"w3",textMedium:"w5",textNormalWeight:"w4",textRight:"tr",textSemiBold:"w6",textThin:"w1",textUnitalicized:"tun",transition:"ts",transparent:"clr",underline:"u",widthContent:"wc",widthExact:"we",widthFill:"wf",widthFillPortion:"wfp",wrapped:"wrp"},DT=PT.any+" "+PT.column,UT=PT.any+" "+PT.grid,OT=PT.any+" "+PT.page,MT=PT.any+" "+PT.paragraph,FT=PT.any+" "+PT.row,VT=PT.any+" "+PT.single,KT=function(e){switch(e.$){case"AsRow":return FT;case"AsColumn":return DT;case"AsEl":return VT;case"AsGrid":return UT;case"AsParagraph":return MT;default:return OT}},HT=function(e){return{$:"Keyed",a:e}},jT={$:"NoStyleSheet"},qT=r(function(e,t){switch(t.$){case"NoNearbyChildren":return e;case"ChildrenBehind":var r=t.a;return O(r,e);case"ChildrenInFront":var n=t.a;return O(e,n);default:var r=t.a,n=t.b;return O(r,O(e,n))}}),GT=n(function(e,t,r){switch(r.$){case"NoNearbyChildren":return t;case"ChildrenBehind":var n=r.a;return O(f(tu,function(t){return L(e,t)},n),t);case"ChildrenInFront":var a=r.a;return O(t,f(tu,function(t){return L(e,t)},a));default:var n=r.a,a=r.b;return O(f(tu,function(t){return L(e,t)},n),O(t,f(tu,function(t){return L(e,t)},a)))}}),zT={$:"AsParagraph"},YT=zT,WT=On("div"),JT=On("p"),QT=On("s"),XT=On("u"),ZT=yT("className"),ew=function(e){return Fn(rt(e))},tw=function(e){return On(rt(e))},rw=function(e){return{$:"Flag",a:e}},nw=function(e){return{$:"Second",a:e}},aw=function(e){return e>31?nw(1< .ctr > ."+PT.any+" {\n border: 4px dashed rgb(0, 151, 167) !important;\n}\n\n",iI="@media screen and (-ms-high-contrast: active), (-ms-high-contrast: none) {"+Aw(PT.any)+Aw(PT.row)+" > "+Aw(PT.any)+" { flex-basis: auto !important; } "+Aw(PT.any)+Aw(PT.row)+" > "+Aw(PT.any)+Aw(PT.container)+" { flex-basis: auto !important; }}\n\n/* General Input Reset */\ninput[type=range] {\n -webkit-appearance: none; /* Hides the slider so that custom slider can be made */\n /* width: 100%; Specific width is required for Firefox. */\n background: transparent; /* Otherwise white in Chrome */\n position:absolute;\n left:0;\n top:0;\n z-index:10;\n width: 100%;\n outline: dashed 1px;\n height: 100%;\n opacity: 0;\n}\n\n/* Hide all syling for track */\ninput[type=range]::-moz-range-track {\n background: transparent;\n cursor: pointer;\n}\ninput[type=range]::-ms-track {\n background: transparent;\n cursor: pointer;\n}\ninput[type=range]::-webkit-slider-runnable-track {\n background: transparent;\n cursor: pointer;\n}\n\n/* Thumbs */\ninput[type=range]::-webkit-slider-thumb {\n -webkit-appearance: none;\n opacity: 0.5;\n width: 80px;\n height: 80px;\n background-color: black;\n border:none;\n border-radius: 5px;\n}\ninput[type=range]::-moz-range-thumb {\n opacity: 0.5;\n width: 80px;\n height: 80px;\n background-color: black;\n border:none;\n border-radius: 5px;\n}\ninput[type=range]::-ms-thumb {\n opacity: 0.5;\n width: 80px;\n height: 80px;\n background-color: black;\n border:none;\n border-radius: 5px;\n}\ninput[type=range][orient=vertical]{\n writing-mode: bt-lr; /* IE */\n -webkit-appearance: slider-vertical; /* WebKit */\n}\n"+aI,oI=function(e){return{$:"Intermediate",a:e}},uI=r(function(e,t){return oI({closing:t,others:mr,props:mr,selector:e})}),sI=r(function(e,t){var n=e.a,a=r(function(e,t){switch(e.$){case"Prop":var r=e.a,a=e.b;return U(t,{props:f(qa,L(r,a),t.props)});case"Supports":var i=e.a,o=i.a,u=i.b,s=e.b;return U(t,{others:f(qa,oI({closing:"\n}",others:mr,props:s,selector:"@supports ("+o+":"+u+") {"+n.selector}),t.others)});case"Adjacent":var c=e.a,l=e.b;return U(t,{others:f(qa,f(sI,f(uI,n.selector+" + "+c,""),l),t.others)});case"Child":var d=e.a,h=e.b;return U(t,{others:f(qa,f(sI,f(uI,n.selector+" > "+d,""),h),t.others)});case"Descriptor":var p=e.a,g=e.b;return U(t,{others:f(qa,f(sI,f(uI,O(n.selector,p),""),g),t.others)});default:var v=e.a;return U(t,{others:f(qa,f(sI,f(uI,n.selector,""),v),t.others)})}});return oI(l(Ja,a,n,t))}),cI=O(iI,function(e){var t=function(e){return Sl(f(tu,function(e){return e.a+":"+e.b+";"},e))},n=function(e){return e.props.b?e.selector+"{"+t(e.props)+e.closing+"}":""},a=function(e){var t=e.a;return O(n(t),Sl(f(tu,a,t.others)))};return Sl(f(tu,a,l(Ja,r(function(e,t){var r=e.a,n=e.b;return f(qa,f(sI,f(uI,r,""),n),t)}),mr,e)))}(O(tI,nI))),fI=l(tw,"style",mr,F([kw(cI)])),lI=function(e){switch(e.$){case"Serif":return"serif";case"SansSerif":return"sans-serif";case"Monospace":return"monospace";case"Typeface":var t=e.a;return'"'+t+'"';case"ImportFont":var t=e.a;e.b;return'"'+t+'"';default:var t=e.a.name;return'"'+t+'"'}},dI=function(e){switch(e.$){case"VariantActive":var t=e.a;return"smcp"===t;case"VariantOff":var t=e.a;return!1;default:var t=e.a,r=e.b;return"smcp"===t&&1===r}},hI=function(e){if("FontWith"===e.$){var t=e.a;return f(Cd,dI,t.variants)}return!1},pI=n(function(e,t,r){var n=t.a,a=t.b;return e?r+"\n "+n+": "+a+" !important;":r+"\n "+n+": "+a+";"}),gI=r(function(e,t){return e+" {"+f(qi,"",f(tu,function(e){return e.a+": "+e.b+";"},t))+"}"}),vI=n(function(e,t,r){var n=r.a,a=r.b;return F([f(gI,"."+e+"."+t+", ."+e+" ."+t,n),f(gI,"."+e+"."+t+"> ."+PT.text+", ."+e+" ."+t+" > ."+PT.text,a)])}),yI=n(function(e,t,r){var n=t.a,a=t.b,i=$(e,r)?e:r+" ."+e;return f(qi," ",O(l(vI,i,PT.sizeByCapital,a),l(vI,i,PT.fullSize,n)))}),mI=r(function(e,t){var r=$(e,t)?e:t+" ."+e;return f(qi," ",F([f(gI,"."+r+"."+PT.sizeByCapital+", ."+r+" ."+PT.sizeByCapital,F([L("line-height","1")])),f(gI,"."+r+"."+PT.sizeByCapital+"> ."+PT.text+", ."+r+" ."+PT.sizeByCapital+" > ."+PT.text,F([L("vertical-align","0"),L("line-height","1")]))]))}),bI=function(e){if(e.b){var t=e.a,r=e.b;return ya(l(za,vi,t,r))}return ma},CI=function(e){if(e.b){var t=e.a,r=e.b;return ya(l(za,Hs,t,r))}return ma},SI=n(function(e,t,r){return{height:t/e,size:e,vertical:r}}),EI=function(e){var t=F([e.capital,e.baseline,e.descender,e.lowercase]),r=f(ec,e.descender,CI(t)),n=f(ec,e.baseline,CI(f(Zd,function(e){return!$(e,r)},t))),a=f(ec,e.capital,bI(t)),i=1/(a-n),o=1-a,u=1/(a-r),s=1-a;return{capital:l(SI,i,a-n,o),full:l(SI,u,a-r,s)}},TI=function(e){return L(F([L("display","block")]),F([L("display","inline-block"),L("line-height",Tw(e.height)),L("vertical-align",Tw(e.vertical)+"em"),L("font-size",Tw(e.size)+"em")]))},wI=function(e){return l(za,r(function(e,t){if("Nothing"===t.$){if("FontWith"===e.$){var r=e.a,n=r.adjustment;if("Nothing"===n.$)return t;var a=n.a;return ya(L(TI(function(e){return e.full}(EI(a))),TI(function(e){return e.capital}(EI(a)))))}return t}return t}),ma,e)},II=function(e){var t=function(e){if("ImportFont"===e.$){var t=e.b;return ya("@import url('"+t+"');")}return ma},r=function(e){var r=(e.a,e.b);return f(qi,"\n",f(qE,t,r))},n=f(tu,hi,e),a=function(e){var t=e.a,r=e.b,a=wI(r);if("Nothing"===a.$)return f(qi,"",f(tu,mI(t),n));var i=a.a;return f(qi,"",f(tu,f(yI,t,i),n))};return O(f(qi,"\n",f(tu,r,e)),f(qi,"\n",f(tu,a,e)))},AI=function(e){switch(e.$){case"VariantActive":var t=e.a;return'"'+t+'"';case"VariantOff":var t=e.a;return'"'+t+'" 0';default:var t=e.a,r=e.b;return'"'+t+'" '+ji(r)}},BI=function(e){if("FontWith"===e.$){var t=e.a;return ya(f(qi,", ",f(tu,AI,t.variants)))}return ma},kI=function(e){if("FontFamily"===e.$){var t=e.a,r=e.b;return ya(L(t,r))}return ma},NI=function(e){switch(e.$){case"Untransformed":return ma;case"Moved":var t=e.a,r=t.a,n=t.b,a=t.c;return ya("translate3d("+Tw(r)+"px, "+Tw(n)+"px, "+Tw(a)+"px)");default:var i=e.a,o=i.a,u=i.b,s=i.c,c=e.b,f=c.a,l=c.b,d=c.c,h=e.c,p=h.a,g=h.b,v=h.c,y=e.d,m="translate3d("+Tw(o)+"px, "+Tw(u)+"px, "+Tw(s)+"px)",b="scale3d("+Tw(f)+", "+Tw(l)+", "+Tw(d)+")",C="rotate3d("+Tw(p)+", "+Tw(g)+", "+Tw(v)+", "+Tw(y)+"rad)";return ya(m+" "+b+" "+C)}},RI=r(function(e,t){var a=n(function(t,r,n){if("Nothing"===t.$)return r+"{"+l(za,pI(!1),"",n)+"\n}";switch(t.a.$){case"Hover":switch(e.hover.$){case"NoHover":return"";case"ForceHover":return r+"-hv {"+l(za,pI(!0),"",n)+"\n}";default:return r+"-hv:hover {"+l(za,pI(!1),"",n)+"\n}"}case"Focus":var a=l(za,pI(!1),"",n);return f(qi,"\n",F([r+"-fs:focus {"+a+"\n}","."+PT.any+":focus ~ "+r+"-fs:not(.focus) {"+a+"\n}","."+PT.any+":focus "+r+"-fs {"+a+"\n}",".focusable-parent:focus ~ ."+PT.any+" "+r+"-fs {"+a+"\n}"]));default:return r+"-act:active {"+l(za,pI(!1),"",n)+"\n}"}}),i=r(function(e,t){switch(e.$){case"Style":var r=e.a,o=e.b;return l(a,t,r,o);case"Shadows":var u=e.a,s=e.b;return l(a,t,"."+u,F([f(Sw,"box-shadow",s)]));case"Transparency":var u=e.a,c=e.b,d=f(vi,0,f(Hs,1,1-c));return l(a,t,"."+u,F([f(Sw,"opacity",Tw(d))]));case"FontSize":var h=e.a;return l(a,t,".font-size-"+ji(h),F([f(Sw,"font-size",ji(h)+"px")]));case"FontFamily":var u=e.a,p=e.b,g=f(qi,", ",f(qE,BI,p)),v=F([f(Sw,"font-family",f(qi,", ",f(tu,lI,p))),f(Sw,"font-feature-settings",g),f(Sw,"font-variant",f(Cd,hI,p)?"small-caps":"normal")]);return f(qi," ",F([l(a,t,"."+u,v)]));case"Single":var y=e.a,s=e.b,m=e.c;return l(a,t,"."+y,F([f(Sw,s,m)]));case"Colored":var y=e.a,s=e.b,b=e.c;return l(a,t,"."+y,F([f(Sw,s,ww(b))]));case"SpacingStyle":var C=e.a,S=e.b,E=e.c,T=ji(E)+"px",w=ji(S)+"px",I="."+PT.row,A="."+(PT.wrapped+I),B="."+PT.alignRight,k="."+PT.paragraph,N="."+PT.page,R="."+PT.alignLeft,$=Tw(E/2)+"px",x=Tw(S/2)+"px",_="."+PT.column,y="."+C,P="."+PT.any;return Sl(F([l(a,t,y+(I+" > ")+P+" + "+P,F([f(Sw,"margin-left",w)])),l(a,t,y+(A+" > ")+P,F([f(Sw,"margin",$+" "+x)])),l(a,t,y+(_+" > ")+P+" + "+P,F([f(Sw,"margin-top",T)])),l(a,t,y+(N+" > ")+P+" + "+P,F([f(Sw,"margin-top",T)])),l(a,t,y+(N+" > ")+R,F([f(Sw,"margin-right",w)])),l(a,t,y+(N+" > ")+B,F([f(Sw,"margin-left",w)])),l(a,t,O(y,k),F([f(Sw,"line-height","calc(1em + "+ji(E)+"px)")])),l(a,t,"textarea"+y,F([f(Sw,"line-height","calc(1em + "+ji(E)+"px)")])),l(a,t,y+(k+" > ")+R,F([f(Sw,"margin-right",w)])),l(a,t,y+(k+" > ")+B,F([f(Sw,"margin-left",w)])),l(a,t,y+(k+"::after"),F([f(Sw,"content","''"),f(Sw,"display","block"),f(Sw,"height","0"),f(Sw,"width","0"),f(Sw,"margin-top",ji(-1*(E/2|0))+"px")])),l(a,t,y+(k+"::before"),F([f(Sw,"content","''"),f(Sw,"display","block"),f(Sw,"height","0"),f(Sw,"width","0"),f(Sw,"margin-bottom",ji(-1*(E/2|0))+"px")]))]));case"PaddingStyle":var C=e.a,D=e.b,B=e.c,U=e.d,R=e.e,y="."+C;return l(a,t,y,F([f(Sw,"padding",ji(D)+"px "+ji(B)+"px "+ji(U)+"px "+ji(R)+"px")]));case"BorderWidth":var C=e.a,D=e.b,B=e.c,U=e.d,R=e.e,y="."+C;return l(a,t,y,F([f(Sw,"border-width",ji(D)+"px "+ji(B)+"px "+ji(U)+"px "+ji(R)+"px")]));case"GridTemplateStyle":var M=e.a,V=n(function(e,t,r){e:for(;;)switch(r.$){case"Px":var n=r.a;return ji(n)+"px";case"Content":var a=L(e,t);if("Nothing"===a.a.$){if("Nothing"===a.b.$){a.a,a.b;return"max-content"}var i=(a.a,a.b.a);return"minmax(max-content, "+ji(i)+"px)"}if("Nothing"===a.b.$){var o=a.a.a;a.b;return"minmax("+ji(o)+"px, max-content)"}var o=a.a.a,i=a.b.a;return"minmax("+ji(o)+"px, "+ji(i)+"px)";case"Fill":var u=r.a,s=L(e,t);if("Nothing"===s.a.$){if("Nothing"===s.b.$){s.a,s.b;return ji(u)+"fr"}var i=(s.a,s.b.a);return"minmax(max-content, "+ji(i)+"px)"}if("Nothing"===s.b.$){var o=s.a.a;s.b;return"minmax("+ji(o)+"px, "+ji(u)+"frfr)"}var o=s.a.a,i=s.b.a;return"minmax("+ji(o)+"px, "+ji(i)+"px)";case"Min":var c=r.a,f=r.b,l=ya(c),d=t,h=f;e=l,t=d,r=h;continue e;default:var c=r.a,f=r.b,l=e,d=ya(c),h=f;e=l,t=d,r=h;continue e}}),K=function(e){return l(V,ma,ma,e)},H=(K(M.spacing.a),K(M.spacing.b)),j=function(e){return"grid-template-rows: "+e+";"}(f(qi," ",f(tu,K,M.rows))),q=function(e){return"-ms-grid-rows: "+e+";"}(f(qi,H,f(tu,K,M.columns))),G=function(e){return"-ms-grid-columns: "+e+";"}(f(qi,H,f(tu,K,M.columns))),z="grid-row-gap:"+K(M.spacing.b)+";",Y="grid-column-gap:"+K(M.spacing.a)+";",W=function(e){return"grid-template-columns: "+e+";"}(f(qi," ",f(tu,K,M.columns))),y=".grid-rows-"+f(qi,"-",f(tu,vw,M.rows))+"-cols-"+f(qi,"-",f(tu,vw,M.columns))+"-space-x-"+vw(M.spacing.a)+"-space-y-"+vw(M.spacing.b),J=y+"{"+W+j+Y+z+"}",Q="@supports (display:grid) {"+J+"}",X=y+"{"+G+q+"}";return O(X,Q);case"GridPosition":var Z=e.a,ee=f(qi," ",F(["-ms-grid-row: "+ji(Z.row)+";","-ms-grid-row-span: "+ji(Z.height)+";","-ms-grid-column: "+ji(Z.col)+";","-ms-grid-column-span: "+ji(Z.width)+";"])),te=f(qi," ",F(["grid-row: "+ji(Z.row)+" / "+ji(Z.row+Z.height)+";","grid-column: "+ji(Z.col)+" / "+ji(Z.col+Z.width)+";"])),y=".grid-pos-"+ji(Z.row)+"-"+ji(Z.col)+"-"+ji(Z.width)+"-"+ji(Z.height),J=y+"{"+te+"}",Q="@supports (display:grid) {"+J+"}",X=y+"{"+ee+"}";return O(X,Q);case"PseudoSelector":var y=e.a,re=e.b;return f(qi," ",f(tu,function(e){return f(i,e,ya(y))},re));default:var ne=e.a,m=NI(ne),y=mw(ne),ae=L(y,m);if("Just"===ae.a.$&&"Just"===ae.b.$){var C=ae.a.a,ie=ae.b.a;return l(a,t,"."+C,F([f(Sw,"transform",ie)]))}return""}}),o=r(function(e,t){return{rules:O(t.rules,f(i,e,ma)),topLevel:function(){var r=kI(e);if("Nothing"===r.$)return t.topLevel;var n=r.a;return f(qa,n,t.topLevel)}()}}),u=l(za,o,{rules:"",topLevel:mr},t),s=u.topLevel,c=u.rules;return O(II(s),c)}),$I=r(function(e,t){return l(tw,"style",mr,F([kw(f(RI,e,t))]))}),xI=a(function(e,t,r,n){return e?f(qa,L("static-stylesheet",fI),f(qa,L("dynamic-stylesheet",f($I,t,l(za,Cw,L(mm,F([Bw(t.focus)])),r).b)),n)):f(qa,L("dynamic-stylesheet",f($I,t,l(za,Cw,L(mm,F([Bw(t.focus)])),r).b)),n)}),_I=a(function(e,t,r,n){return e?f(qa,fI,f(qa,f($I,t,l(za,Cw,L(mm,F([Bw(t.focus)])),r).b),n)):f(qa,f($I,t,l(za,Cw,L(mm,F([Bw(t.focus)])),r).b),n)}),LI=o(function(e,t,n,a,i,o){var u=r(function(e,t){if("Keyed"===a.$){var r=a.a;return l(ew,e,t,function(){switch(i.$){case"NoStyleSheet":return r;case"OnlyDynamic":var e=i.a,t=i.b;return d(xI,!1,e,t,r);default:var e=i.a,t=i.b;return d(xI,!0,e,t,r)}}())}var n=a.a;return f(function(){switch(e){case"div":return WT;case"p":return JT;default:return tw(e)}}(),t,function(){switch(i.$){case"NoStyleSheet":return n;case"OnlyDynamic":var e=i.a,t=i.b;return d(_I,!1,e,t,n);default:var e=i.a,t=i.b;return d(_I,!0,e,t,n)}}())}),s=function(){switch(t.$){case"Generic":return f(u,"div",n);case"NodeName":var e=t.a;return f(u,e,n);default:var e=t.a,r=t.b;return l(tw,e,n,F([f(u,r,F([ZT(PT.any+" "+PT.single)]))]))}}();switch(o.$){case"AsRow":return f(lw,hw,e)&&!f(lw,dw,e)?s:f(lw,ow,e)?f(XT,F([ZT(f(qi," ",F([PT.any,PT.single,PT.container,PT.contentCenterY,PT.alignContainerRight])))]),F([s])):f(lw,uw,e)?f(QT,F([ZT(f(qi," ",F([PT.any,PT.single,PT.container,PT.contentCenterY,PT.alignContainerCenterX])))]),F([s])):s;case"AsColumn":return f(lw,fw,e)&&!f(lw,cw,e)?s:f(lw,sw,e)?f(QT,F([ZT(f(qi," ",F([PT.any,PT.single,PT.container,PT.alignContainerCenterY])))]),F([s])):f(lw,iw,e)?f(XT,F([ZT(f(qi," ",F([PT.any,PT.single,PT.container,PT.alignContainerBottom])))]),F([s])):s;default:return s}}),PI=kw,DI=function(e){return f(WT,F([ZT(f(qi," ",F([PT.any,PT.text,PT.widthContent,PT.heightContent])))]),F([PI(e)]))},UI=function(e){return l(tw,"div",F([ZT(f(qi," ",F([PT.any,PT.text,PT.widthFill,PT.heightFill])))]),F([kw(e)]))},OI=n(function(e,t,n){var a=r(function(t,r){var n=t.a,a=t.b,i=r.a,o=r.b;switch(a.$){case"Unstyled":var u=a.a;return $(e,YT),L(f(qa,L(n,u(e)),i),o);case"Styled":var s=a.a;return $(e,YT),L(f(qa,L(n,f(s.html,jT,e)),i),jo(o)?s.styles:O(s.styles,o));case"Text":var c=a.a;return L(f(qa,L(n,$(e,$T)?UI(c):DI(c)),i),o);default:return L(i,o)}}),i=r(function(t,r){var n=r.a,a=r.b;switch(t.$){case"Unstyled":var i=t.a;return $(e,YT),L(f(qa,i(e),n),a);case"Styled":var o=t.a;return $(e,YT),L(f(qa,f(o.html,jT,e),n),jo(a)?o.styles:O(o.styles,a));case"Text":var u=t.a;return L(f(qa,$(e,$T)?UI(u):DI(u),n),a);default:return L(n,a)}});if("Keyed"===t.$){var o=t.a,u=l(Ja,a,L(mr,mr),o),s=u.a,c=u.b,p=jo(c)?n.styles:O(n.styles,c);if(p.b){var g=p;return Rf({html:d(LI,n.has,n.node,n.attributes,HT(l(GT,"nearby-element-pls",s,n.children))),styles:g})}return xf(h(LI,n.has,n.node,n.attributes,HT(l(GT,"nearby-element-pls",s,n.children)),jT))}var v=t.a,y=l(Ja,i,L(mr,mr),v),m=y.a,c=y.b,p=jo(c)?n.styles:O(n.styles,c);if(p.b){var g=p;return Rf({html:d(LI,n.has,n.node,n.attributes,NT(f(qT,m,n.children))),styles:g})}return xf(h(LI,n.has,n.node,n.attributes,NT(f(qT,m,n.children)),jT))}),MI=r(function(e,t){return f(qn,nt(e),ot(t))}),FI=r(function(e,t){var r=t.a,n=t.b;if("Flag"===e.$){var a=e.a;return f(xT,a|r,n)}var i=e.a;return f(xT,r,i|n)}),VI=aw(7),KI=aw(36),HI=r(function(e,t){var r=e.a,n=e.b,a=t.a,i=t.b;return f(xT,r|a,n|i)}),jI=aw(6),qI=aw(38),GI=aw(30),zI=aw(29),YI=r(function(e,t){return{$:"Embedded",a:e,b:t}}),WI=n(function(e,t,r){return{$:"Single",a:e,b:t,c:r}}),JI=function(e){return{$:"Transform",a:e}},QI=function(e){return{$:"ChildrenBehind",a:e}},XI=r(function(e,t){return{$:"ChildrenBehindAndInFront",a:e,b:t}}),ZI=function(e){return{$:"ChildrenInFront",a:e}},eA=r(function(e,t){return f(WT,F([ZT(function(){switch(e.$){case"Above":return f(qi," ",F([PT.nearby,PT.single,PT.above]));case"Below":return f(qi," ",F([PT.nearby,PT.single,PT.below]));case"OnRight":return f(qi," ",F([PT.nearby,PT.single,PT.onRight]));case"OnLeft":return f(qi," ",F([PT.nearby,PT.single,PT.onLeft]));case"InFront":return f(qi," ",F([PT.nearby,PT.single,PT.inFront]));default:return f(qi," ",F([PT.nearby,PT.single,PT.behind]))}}())]),F([function(){switch(t.$){case"Empty":return kw("");case"Text":var e=t.a;return DI(e);case"Unstyled":return(0,t.a)($T);default:return f(t.a.html,jT,$T)}}()]))}),tA=n(function(e,t,r){var n=f(eA,e,t);switch(r.$){case"NoNearbyChildren":return"Behind"===e.$?QI(F([n])):ZI(F([n]));case"ChildrenBehind":var a=r.a;return"Behind"===e.$?QI(f(qa,n,a)):f(XI,a,F([n]));case"ChildrenInFront":var i=r.a;return"Behind"===e.$?f(XI,F([n]),i):ZI(f(qa,n,i));default:var a=r.a,i=r.b;return"Behind"===e.$?f(XI,f(qa,n,a),i):f(XI,a,f(qa,n,i))}}),rA=r(function(e,t){switch(t.$){case"Generic":return kT(e);case"NodeName":var r=t.a;return f(YI,r,e);default:var n=t.a,a=t.b;return f(YI,n,a)}}),nA=function(e){switch(e.$){case"Left":return PT.alignedHorizontally+" "+PT.alignLeft;case"Right":return PT.alignedHorizontally+" "+PT.alignRight;default:return PT.alignedHorizontally+" "+PT.alignCenterX}},aA=function(e){switch(e.$){case"Top":return PT.alignedVertically+" "+PT.alignTop;case"Bottom":return PT.alignedVertically+" "+PT.alignBottom;default:return PT.alignedVertically+" "+PT.alignCenterY}},iA=a(function(e,t,r,n){return{$:"FullTransform",a:e,b:t,c:r,d:n}}),oA=function(e){return{$:"Moved",a:e}},uA=r(function(e,t){switch(e.$){case"Untransformed":switch(t.$){case"MoveX":var r=t.a;return oA(P(r,0,0));case"MoveY":var n=t.a;return oA(P(0,n,0));case"MoveZ":var a=t.a;return oA(P(0,0,a));case"MoveXYZ":var i=t.a;return oA(i);case"Rotate":var i=t.a,o=t.b;return d(iA,P(0,0,0),P(1,1,1),i,o);default:var i=t.a;return d(iA,P(0,0,0),i,P(0,0,1),0)}case"Moved":var u=e.a,r=u.a,n=u.b,a=u.c;switch(t.$){case"MoveX":var s=t.a;return oA(P(s,n,a));case"MoveY":var c=t.a;return oA(P(r,c,a));case"MoveZ":var f=t.a;return oA(P(r,n,f));case"MoveXYZ":var i=t.a;return oA(i);case"Rotate":var i=t.a,o=t.b;return d(iA,u,P(1,1,1),i,o);default:var l=t.a;return d(iA,u,l,P(0,0,1),0)}default:var u=e.a,r=u.a,n=u.b,a=u.c,h=e.b,p=e.c,o=e.d;switch(t.$){case"MoveX":var s=t.a;return d(iA,P(s,n,a),h,p,o);case"MoveY":var c=t.a;return d(iA,P(r,c,a),h,p,o);case"MoveZ":var f=t.a;return d(iA,P(r,n,f),h,p,o);case"MoveXYZ":var g=t.a;return d(iA,g,h,p,o);case"Rotate":var v=t.a,y=t.b;return d(iA,u,h,v,y);default:var m=t.a;return d(iA,u,m,p,o)}}}),sA=function(e){switch(e.$){case"Px":var t=e.a,r=ji(t),n="height-px-"+r;return P(_T,n,F([l(WI,n,"height",r+"px")]));case"Content":return P(f(FI,KI,_T),PT.heightContent,mr);case"Fill":var a=e.a;return 1===a?P(f(FI,fw,_T),PT.heightFill,mr):P(f(FI,fw,_T),PT.heightFillPortion+" height-fill-"+ji(a),F([l(WI,PT.any+"."+PT.row+" > "+Aw("height-fill-"+ji(a)),"flex-grow",ji(1e5*a))]));case"Min":var i=e.a,o=e.b,u="min-height-"+ji(i),s=l(WI,u,"min-height",ji(i)+"px"),c=sA(o),d=c.a,h=c.b,p=c.c;return P(f(FI,cw,d),u+" "+h,f(qa,s,p));default:var g=e.a,o=e.b,u="max-height-"+ji(g),s=l(WI,u,"max-height",ji(g)+"px"),v=sA(o),d=v.a,h=v.b,p=v.c;return P(f(FI,cw,d),u+" "+h,f(qa,s,p))}},cA=function(e){switch(e.$){case"Px":var t=e.a;return P(_T,PT.widthExact+" width-px-"+ji(t),F([l(WI,"width-px-"+ji(t),"width",ji(t)+"px")]));case"Content":return P(f(FI,qI,_T),PT.widthContent,mr);case"Fill":var r=e.a;return 1===r?P(f(FI,hw,_T),PT.widthFill,mr):P(f(FI,hw,_T),PT.widthFillPortion+" width-fill-"+ji(r),F([l(WI,PT.any+"."+PT.row+" > "+Aw("width-fill-"+ji(r)),"flex-grow",ji(1e5*r))]));case"Min":var n=e.a,a=e.b,i="min-width-"+ji(n),o=l(WI,i,"min-width",ji(n)+"px"),u=cA(a),s=u.a,c=u.b,d=u.c;return P(f(FI,dw,s),i+" "+c,f(qa,o,d));default:var h=e.a,a=e.b,i="max-width-"+ji(h),o=l(WI,i,"max-width",ji(h)+"px"),p=cA(a),s=p.a,c=p.b,d=p.c;return P(f(FI,dw,s),i+" "+c,f(qa,o,d))}},fA=aw(27),lA=r(function(e,t){if($(e,fA)){if("Single"!==t.$)return!1;switch(t.c){case"0px":case"1px":case"2px":case"3px":case"4px":case"5px":case"6px":return!0;default:return!1}}else switch(t.$){case"FontSize":var r=t.a;return r>=8&&r<=32;case"PaddingStyle":var n=(t.a,t.b),a=t.c,i=t.d,o=t.e;return $(n,i)&&$(n,a)&&$(n,o)&&n>=0&&n<=24;default:return!1}}),dA=s(function(e,t,r,n,a,i,o,u){e:for(;;){if(!u.b){var s=mw(n);if("Nothing"===s.$)return{attributes:f(qa,ZT(e),i),children:o,has:r,node:t,styles:a};var c=s.a;return{attributes:f(qa,ZT(e+" "+c),i),children:o,has:r,node:t,styles:f(qa,JI(n),a)}}var d=u.a,h=u.b;switch(d.$){case"NoAttribute":var p=e,g=t,v=r,y=n,m=a,b=i,C=o,S=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=S;continue e;case"Class":var E=d.a,T=d.b;if(f(lw,E,r)){var p=e,g=t,v=r,y=n,m=a,b=i,C=o,S=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=S;continue e}var p=T+" "+e,g=t,v=f(FI,E,r),y=n,m=a,b=i,C=o,S=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=S;continue e;case"Attr":var w=d.a,p=e,g=t,v=r,y=n,m=a,b=f(qa,w,i),C=o,S=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=S;continue e;case"StyleClass":var E=d.a,I=d.b;if(f(lw,E,r)){var p=e,g=t,v=r,y=n,m=a,b=i,C=o,S=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=S;continue e}if(f(lA,E,I)){var p=bw(I)+" "+e,g=t,v=f(FI,E,r),y=n,m=a,b=i,C=o,S=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=S;continue e}var p=bw(I)+" "+e,g=t,v=f(FI,E,r),y=n,m=f(qa,I,a),b=i,C=o,S=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=S;continue e;case"TransformComponent":var E=d.a,A=d.b,p=e,g=t,v=f(FI,E,r),y=f(uA,n,A),m=a,b=i,C=o,S=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=S;continue e;case"Width":var B=d.a;if(f(lw,jI,r)){var p=e,g=t,v=r,y=n,m=a,b=i,C=o,S=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=S;continue e}switch(B.$){case"Px":var k=B.a,p=PT.widthExact+" width-px-"+ji(k)+" "+e,g=t,v=f(FI,jI,r),y=n,m=f(qa,l(WI,"width-px-"+ji(k),"width",ji(k)+"px"),a),b=i,C=o,S=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=S;continue e;case"Content":var p=e+" "+PT.widthContent,g=t,v=f(FI,qI,f(FI,jI,r)),y=n,m=a,b=i,C=o,S=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=S;continue e;case"Fill":var N=B.a;if(1===N){var p=e+" "+PT.widthFill,g=t,v=f(FI,hw,f(FI,jI,r)),y=n,m=a,b=i,C=o,S=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=S;continue e}var p=e+" "+PT.widthFillPortion+" width-fill-"+ji(N),g=t,v=f(FI,hw,f(FI,jI,r)),y=n,m=f(qa,l(WI,PT.any+"."+PT.row+" > "+Aw("width-fill-"+ji(N)),"flex-grow",ji(1e5*N)),a),b=i,C=o,S=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=S;continue e;default:var R=cA(B),$=R.a,x=R.b,_=R.c,p=e+" "+x,g=t,v=f(HI,$,r),y=n,m=O(_,a),b=i,C=o,S=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=S;continue e}case"Height":var L=d.a;if(f(lw,VI,r)){var p=e,g=t,v=r,y=n,m=a,b=i,C=o,S=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=S;continue e}switch(L.$){case"Px":var k=L.a,P=ji(k)+"px",D="height-px-"+P,p=D+" "+e,g=t,v=f(FI,VI,r),y=n,m=f(qa,l(WI,D,"height ",P),a),b=i,C=o,S=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=S;continue e;case"Content":var p=PT.heightContent+" "+e,g=t,v=f(FI,KI,f(FI,VI,r)),y=n,m=a,b=i,C=o,S=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=S;continue e;case"Fill":var N=L.a;if(1===N){var p=PT.heightFill+" "+e,g=t,v=f(FI,fw,f(FI,VI,r)),y=n,m=a,b=i,C=o,S=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=S;continue e}var p=e+" "+PT.heightFillPortion+" height-fill-"+ji(N),g=t,v=f(FI,fw,f(FI,VI,r)),y=n,m=f(qa,l(WI,PT.any+"."+PT.column+" > "+Aw("height-fill-"+ji(N)),"flex-grow",ji(1e5*N)),a),b=i,C=o,S=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=S;continue e;default:var U=sA(L),$=U.a,x=U.b,_=U.c,p=e+" "+x,g=t,v=f(HI,$,r),y=n,m=O(_,a),b=i,C=o,S=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=S;continue e}case"Describe":var M=d.a;switch(M.$){case"Main":var p=e,g=f(rA,"main",t),v=r,y=n,m=a,b=i,C=o,S=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=S;continue e;case"Navigation":var p=e,g=f(rA,"nav",t),v=r,y=n,m=a,b=i,C=o,S=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=S;continue e;case"ContentInfo":var p=e,g=f(rA,"footer",t),v=r,y=n,m=a,b=i,C=o,S=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=S;continue e;case"Complementary":var p=e,g=f(rA,"aside",t),v=r,y=n,m=a,b=i,C=o,S=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=S;continue e;case"Heading":var F=M.a;if(F<=1){var p=e,g=f(rA,"h1",t),v=r,y=n,m=a,b=i,C=o,S=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=S;continue e}if(F<7){var p=e,g=f(rA,"h"+ji(F),t),v=r,y=n,m=a,b=i,C=o,S=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=S;continue e}var p=e,g=f(rA,"h6",t),v=r,y=n,m=a,b=i,C=o,S=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=S;continue e;case"Paragraph":var V=function(){switch(t.$){case"Generic":return kT("p");case"NodeName":var e=t.a;return kT(e);default:var r=t.a,n=t.b;return f(YI,r,n)}}(),p=e,g=V,v=r,y=n,m=a,b=i,C=o,S=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=S;continue e;case"Button":var p=e,g=t,v=r,y=n,m=a,b=f(qa,f(MI,"role","button"),i),C=o,S=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=S;continue e;case"Label":var K=M.a,p=e,g=t,v=r,y=n,m=a,b=f(qa,f(MI,"aria-label",K),i),C=o,S=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=S;continue e;case"LivePolite":var p=e,g=t,v=r,y=n,m=a,b=f(qa,f(MI,"aria-live","polite"),i),C=o,S=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=S;continue e;default:var p=e,g=t,v=r,y=n,m=a,b=f(qa,f(MI,"aria-live","assertive"),i),C=o,S=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=S;continue e}case"Nearby":var H=d.a,j=d.b,_=function(){switch(j.$){case"Empty":return a;case"Text":j.a;return a;case"Unstyled":j.a;return a;default:var e=j.a;return O(a,e.styles)}}(),p=e,g=t,v=r,y=n,m=_,b=i,C=l(tA,H,j,o),S=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=S;continue e;case"AlignX":var q=d.a;if(f(lw,GI,r)){var p=e,g=t,v=r,y=n,m=a,b=i,C=o,S=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=S;continue e}var p=nA(q)+" "+e,g=t,v=function(e){switch(q.$){case"CenterX":return f(FI,uw,e);case"Right":return f(FI,ow,e);default:return e}}(f(FI,GI,r)),y=n,m=a,b=i,C=o,S=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=S;continue e;default:var G=d.a;if(f(lw,zI,r)){var p=e,g=t,v=r,y=n,m=a,b=i,C=o,S=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=S;continue e}var p=aA(G)+" "+e,g=t,v=function(e){switch(G.$){case"CenterY":return f(FI,sw,e);case"Bottom":return f(FI,iw,e);default:return e}}(f(FI,zI,r)),y=n,m=a,b=i,C=o,S=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=S;continue e}}}),hA={$:"Untransformed"},pA=hA,gA=a(function(e,t,r,n){return l(OI,e,n,v(dA,KT(e),t,_T,pA,mr,mr,LT,Ya(r)))}),vA=function(e){return BT(ZT(e))},yA=r(function(e,t){var r=t.url,n=t.label;return d(gA,$T,kT("a"),f(qa,BT(mT(r)),f(qa,BT(bT("noopener noreferrer")),f(qa,BT(CT("_blank")),f(qa,AT(wT),f(qa,ET(wT),f(qa,vA(PT.contentCenterX+" "+PT.contentCenterY),e)))))),NT(F([n])))}),mA=a(function(e,t,r,n){return{$:"Rgba",a:e,b:t,c:r,d:n}}),bA=n(function(e,t,r){return d(mA,e,t,r,1)}),CA=aw(14),SA=n(function(e,t,r){return{$:"Colored",a:e,b:t,c:r}}),EA=r(function(e,t){return{$:"StyleClass",a:e,b:t}}),TA=function(e){var t=e.a,r=e.b,n=e.c,a=e.d;return yw(t)+"-"+yw(r)+"-"+yw(n)+"-"+yw(a)},wA=function(e){return f(EA,CA,l(SA,"fc-"+TA(e),"color",e))},IA={align:Yp,mainParagraphs:F([F([Jp("You need a web3 provider (such as "),f(yA,F([wA(l(bA,0,0,1))]),{label:Jp("Metamask"),url:"https://metamask.io/"}),Jp(") to Connect.")]),F([Jp("Until you connect, DAIHard will operate in read-only mode.")])]),noticeType:tg},AA={align:Yp,mainParagraphs:F([F([Jp("I don't understand that URL...")]),F([Jp("I'll just set you down here. Maybe check the URL and try again?")])]),noticeType:Xp},BA={align:Yp,mainParagraphs:F([F([Jp("Your wallet is set to an incorrect network.")]),F([Jp("Switch to Ethereum mainnet, Ethereum test, Rootstock, or xDai.")])]),noticeType:Xp},kA=Lo(f($a,ff,f($a,Hd,_l("Error decoding hex to BigInt")))),NA=function(){return Lo(function(e){switch(e){case"0x0":return Ii(!1);case"0x1":return Ii(!0);default:return wi("Error decoding "+e+"as bool.")}})}(),RA=function(e){return function(t){return function(r){return function(n){return function(a){return function(i){return function(o){return function(u){return function(s){return function(c){return function(f){return{blockHash:r,blockNumber:n,contractAddress:o,cumulativeGasUsed:i,gasUsed:a,hash:e,index:t,logs:u,logsBloom:s,root:c,status:f}}}}}}}}}}}},$A=function(e){return nE(F([f(If,ya,e),_o(ma)]))},xA=f(dd,$A(f(Od,"status",NA)),f(dd,$A(f(Od,"root",xo)),l(oE,"logsBloom",xo,l(oE,"logs",Dm(yE),f(dd,$A(f(Od,"contractAddress",uE)),l(oE,"cumulativeGasUsed",kA,l(oE,"gasUsed",kA,l(oE,"blockNumber",hm,l(oE,"blockHash",lE,l(oE,"transactionIndex",hm,l(oE,"transactionHash",pE,_o(RA)))))))))))),_A=function(e){var t=e.a;return ff(t)},LA=f($a,_A,Gd),PA=r(function(e,t){return ep({decoder:xA,method:"eth_getTransactionReceipt",params:F([LA(t)]),url:e})}),DA=n(function(e,t,r){return{$:"TrackTx",a:e,b:t,c:r}}),UA=r(function(e,t){return{$:"TxMined",a:e,b:t}}),OA=r(function(e,t){return{$:"TxSent",a:e,b:t}}),MA=r(function(e,t){return f(jf,function(e){return e.toMsg},f(ng,function(e){return e.b},f(ng,function(e){return e.onMinedTagger},f(Sh,t,e))))}),FA=function(e){return function(t){return function(r){return function(n){return function(a){return function(i){return function(o){return function(u){return function(s){return function(c){return function(f){return{blockHash:r,blockNumber:n,from:i,gas:c,gasPrice:s,hash:e,input:f,nonce:t,to:o,transactionIndex:a,value:u}}}}}}}}}}}},VA=function(e){return nE(F([rE(ma),f(If,ya,e)]))},KA=l(oE,"input",xo,l(oE,"gas",hm,l(oE,"gasPrice",kA,l(oE,"value",kA,l(oE,"to",VA(uE),l(oE,"from",uE,l(oE,"transactionIndex",hm,l(oE,"blockNumber",VA(hm),l(oE,"blockHash",function(e){return f(Ro,function(t){return"0x"===t||"0x0"===t?_o(ma):f(Hi,function(e){return $(e,D("0"))},Bo(t))?_o(ma):f(If,ya,e)},xo)}(lE),l(oE,"nonce",hm,l(oE,"hash",pE,_o(FA)))))))))))),HA=r(function(e,t){return ep({decoder:KA,method:"eth_getTransactionByHash",params:F([LA(t)]),url:e})}),jA=r(function(e,t){return{attempts:e,sleep:t}}),qA=r(function(e,t){var r=e.attempts,n=e.sleep,a=r-1;return f(gp,function(e){return a>0?f(ip,function(e){return f(qA,f(jA,a,n),t)},eE(1e3*n)):Jh(e)},t)}),GA=r(function(e,t){return f(ip,function(r){return f(qA,{attempts:30,sleep:1},f(HA,e,t))},eE(250))}),zA=r(function(e,t){return f(qA,{attempts:60,sleep:5},f(PA,e,t))}),YA=function(e){return{$:"Mined",a:e}},WA=function(e){return jf(function(t){return U(t,{status:YA(e)})})},JA=function(e){return{$:"Sent",a:e}},QA=function(e){return jf(function(t){return U(t,{status:JA(e)})})},XA=function(e){return{$:"Signed",a:e}},ZA=function(e){return jf(function(t){return U(t,{status:XA(e)})})},eB=function(e){return"Nothing"!==e.$},tB=r(function(e,t){var r=t.a;switch(e.$){case"NoOp":return L($g(r),io);case"TxSigned":var n=e.a,a=e.b,i=f(Sh,n,r.txs);if("Just"===i.$){var o=i.a,u=function(){var e=o.onSignedTagger;if("Just"===e.$){var t=e.a;return f(dg,t,Qh(a))}return io}(),s=function(e){var t=P(o.onSignedTagger,o.onBroadcastTagger,o.onMinedTagger);if("Just"===t.a.$)return io;if("Just"===t.b.$){var r=t.b.a;return f(dg,r,Qh(wi(e)))}if("Just"===t.c.$){var n=t.c.a,a=n.a;return f(dg,a,Qh(wi(e)))}t.a,t.b,t.c;return io};if("Ok"===a.$){var c=a.a,d=eB(o.onBroadcastTagger)||eB(o.onMinedTagger)?f(Pg,r.tagger,f(vp,OA(n),f(GA,r.nodePath,c))):io;return L($g(U(r,{txs:l(Dh,n,ZA(c),r.txs)})),ao(F([u,d])))}var h=a.a;return L($g(r),ao(F([u,s(h)])))}return L($g(r),io);case"TxSent":var n=e.a,p=e.b,g=f(Sh,n,r.txs);if("Just"===g.$){var o=g.a;if("Ok"===p.$){var v=p.a,y=function(){return"Just"===o.onMinedTagger.$?f(Pg,r.tagger,f(vp,UA(n),f(zA,r.nodePath,v.hash))):io}(),d=function(){var e=o.onBroadcastTagger;if("Just"===e.$){var t=e.a;return f(dg,t,Qh(Ii(v)))}return io}();return L($g(U(r,{txs:l(Dh,n,QA(v),r.txs)})),ao(F([d,y])))}var h=p.a,s=function(){var e=L(o.onBroadcastTagger,o.onMinedTagger);if("Just"===e.a.$){var t=e.a.a;return f(dg,t,Qh(wi("Error with TxSent stuff")))}if("Just"===e.b.$){var r=e.b.a,n=r.a;return f(dg,n,Qh(wi("Error with TxSent stuff")))}e.a,e.b;return io}();return L($g(r),s)}return L($g(r),io);case"TxMined":var n=e.a,m=e.b,b=f(Sh,n,r.txs);if("Just"===b.$){var o=b.a;if("Ok"===m.$){var C=m.a,S=function(){var e=o.onMinedTagger;if("Just"===e.$){if("Nothing"===e.a.b.$){var t=e.a,a=t.a;t.b;return f(dg,a,Qh(Ii(C)))}var i=e.a,a=i.a,u=i.b.a,s={currentDepth:1,doneWatching:!1,lastCheckedBlock:C.blockNumber,minedInBlock:C.blockNumber,reOrg:!1,stopWatchingAtBlock:C.blockNumber+(u.confirmations-1),txHash:C.hash};return ao(F([f(Pg,r.tagger,f(vp,f(DA,n,s),pm(r.nodePath))),f(dg,a,Qh(Ii(C))),f(dg,u.toMsg,Qh(s))]))}return io}();return L($g(U(r,{txs:l(Dh,n,WA(C),r.txs)})),S)}var h=m.a,E=function(){var e=o.onMinedTagger;if("Just"===e.$){var t=e.a,r=t.a;return f(dg,r,Qh(wi("TxReceipt decoding failure")))}return io}();return L($g(r),E)}return L($g(r),io);case"TrackTx":if("Ok"===e.c.$){var n=e.a,T=e.b,w=e.c.a,I=U(T,{currentDepth:w-T.minedInBlock+1,lastCheckedBlock:w});if($(w,T.stopWatchingAtBlock)){var A=f(MA,r.txs,n);if("Just"===A.$){var B=A.a;return L($g(r),f(dg,B,f(gp,function(e){return Qh(U(I,{doneWatching:!0,reOrg:!0}))},f(ip,function(e){return Qh(U(I,{doneWatching:!0}))},f(PA,r.nodePath,T.txHash)))))}return L($g(r),io)}if($(w,T.lastCheckedBlock))return L($g(r),f(Pg,r.tagger,f(vp,f(DA,n,T),f(ip,function(e){return pm(r.nodePath)},eE(2e3)))));var k=f(MA,r.txs,n);if("Just"===k.$){var B=k.a;return L($g(r),ao(F([f(Pg,r.tagger,f(vp,f(DA,n,I),f(ip,function(e){return pm(r.nodePath)},eE(2e3)))),f(dg,B,Qh(I))])))}return L($g(r),io)}var n=e.a,h=e.c.a;return L($g(r),io);default:var h=e.a;return L($g(r),io)}}),rB=Qt,nB=r(function(e,t){if("Nothing"===e.$)return t;var r=e.a;return t+":"+ji(r)}),aB=n(function(e,t,r){return"Nothing"===t.$?r:O(r,O(e,t.a))}),iB=function(e){var t=function(){return"Http"===e.protocol.$?"http://":"https://"}();return l(aB,"#",e.fragment,l(aB,"?",e.query,O(f(nB,e.port_,O(t,e.host)),e.path)))},oB=r(function(e,t){if(e<0)return t;var r=Bd(f(al,e,t)),n=f($s,e,t);if("Nothing"===r.$)return t;var a=r.a;return f(Qa,n,a)}),uB=r(function(e,t){Gv(t);switch(t.$){case"Home":return L(U(e,{submodel:hT}),io);case"Create":var r=f(Zl,e.web3Context,e.userInfo),n=f(Og,e.txSentry,f(Fg,Uy,r.chainCmd)),a=n.a,i=n.b;return f(cB,f(Uf,Uy,r.appCmds),L(U(e,{submodel:Dy(r.model),txSentry:a}),ao(F([f(Pg,Uy,r.cmd),i]))));case"QuickCreate":var r=f(Tv,e.web3Context,e.userInfo),o=f(Og,e.txSentry,f(Fg,Fy,r.chainCmd)),a=o.a,i=o.b;return f(cB,f(Uf,Fy,r.appCmds),L(U(e,{submodel:My(r.model),txSentry:a}),ao(F([f(Pg,Fy,r.cmd),i]))));case"Trade":var u=t.a,r=l(Cm,e.web3Context,e.userInfo,u),s=f(Og,e.txSentry,f(Fg,Ky,r.chainCmd)),a=s.a,i=s.b;return f(cB,f(Uf,Ky,r.appCmds),L(U(e,{submodel:Vy(r.model),txSentry:a}),ao(F([f(Pg,Ky,r.cmd),i]))));case"Marketplace":var c=t.a,h=l(av,e.web3Context,c,e.userInfo),p=h.a,g=h.b;return L(U(e,{submodel:Oy(p)}),ao(F([f(Pg,gT,g)])));case"AgentHistory":var v=t.a,y=t.b,m=d(oo,e.web3Context,v,y,e.userInfo),b=m.a,C=m.b;return L(U(e,{submodel:Py(b)}),ao(F([f(Pg,lT,C)])));default:return L(f(Xa,AA,e),io)}}),sB=r(function(e,t){var r=t.a,n=t.b,a=f(fB,dT(e),r),i=a.a,o=a.b;return L(i,ao(F([n,o])))}),cB=r(function(e,t){var r=t.a,n=t.b;return l(za,sB,L(r,n),e)}),fB=r(function(e,t){switch(e.$){case"AppCmd":var r=e.a;switch(r.$){case"Web3Connect":return f(fB,pT,t);case"GotoRoute":var n=r.a;return L(t,f(Ty,t.key,n));case"GTag":var a=r.a;return L(t,By(Iy(a)));default:var i=r.a;return L(f(Xa,i,t),io)}case"DismissNotice":var o=e.a;return L(U(t,{userNotices:f(oB,o,t.userNotices)}),io);case"LinkClicked":var u=e.a,s=function(){if("Internal"===u.$){var e=u.a;return f(Ey,t.key,iB(e))}var r=u.a;return rB(r)}();return L(t,s);case"UrlChanged":var c=e.a;return f(lB,c,t);case"GotoRoute":var d=e.a;return L(t,f(Ty,t.key,d));case"Tick":var h=e.a;return L(U(t,{time:h}),io);case"NetworkUpdate":var p=e.a,g=f(Eo,Ra,f(Yd,ZC,p)),v=f(ng,ba,Wl(g)),y=L(g,v);if("Ok"===y.a.$){if("Just"===y.b.$){var m=y.a.a,b=y.b.a;if($(m,Vg(t.web3Context.factoryType)))return L(t,io);var C=La(b),S=FE(C),E=S.a,T=S.b,w=f(Yy,C,t.submodel),I=w.a,A=w.b,B=w.c;return L(U(t,{submodel:I,tradeCache:E,web3Context:C}),ao(F([f(Pg,vT,T),function(){if("Just"===B.$){var e=B.a;return f(Ty,t.key,e)}return A}()])))}y.b;return L(f(Xa,BA,t),io)}var k=y.a.a;return L(l(va,Xa,f(Qp,"Can't decode networkID from Javascript",k),t),io);case"ConnectToWeb3":return"NoWeb3"===t.initialWeb3State.$?L(f(Xa,IA,t),io):L(t,wy(vr));case"WalletStatus":var N=e.a,R=function(){var e=N.account;if("Nothing"===e.$)return io;var t=e.a;return ky(f(Ay,t,"Deriving keypair for encrypted communication on the DAIHard exchange. ONLY SIGN THIS on https://burnable-tech.github.io/DAIHard/. If you sign this elsewhere, you risk revealing any of your encrypted communication on DAIHard to an attacker."))}();return L(U(t,{userAddress:N.account}),R);case"UserPubkeySet":var x=e.a,_=f(Yd,xo,x);if("Ok"===_.$){var P=_.a,D=t.userAddress;if("Just"===D.$){var O=D.a,M=ya({address:O,commPubkey:P}),V=f(Hy,M,t.submodel),I=V.a,s=V.b;return L(U(t,{submodel:I,userInfo:M}),s)}return L(f(Xa,f(Qp,"User pubkey set, but I can no longer find the user address!",ma),t),io)}var K=_.a;return L(l(va,Xa,f(Qp,"error decoding commPubkey from JS",K),t),io);case"CreateMsg":var H=e.a,j=t.submodel;if("CreateModel"===j.$){var q=j.a,G=f(Ng,H,q),z=f(Og,t.txSentry,f(Fg,Uy,G.chainCmd)),Y=z.a,W=z.b;return f(cB,f(Uf,Uy,G.appCmds),L(U(t,{submodel:Dy(G.model),txSentry:Y}),ao(F([f(Pg,Uy,G.cmd),W]))))}return L(t,io);case"QuickCreateMsg":var J=e.a,Q=t.submodel;if("QuickCreateModel"===Q.$){var X=Q.a,G=f(Vv,J,X),Z=f(Og,t.txSentry,f(Fg,Fy,G.chainCmd)),Y=Z.a,W=Z.b;return f(cB,f(Uf,Fy,G.appCmds),L(U(t,{submodel:My(G.model),txSentry:Y}),ao(F([f(Pg,Fy,G.cmd),W]))))}return L(t,io);case"TradeMsg":var ee=e.a,te=t.submodel;if("TradeModel"===te.$){var re=te.a,G=f(xE,ee,re),ne=f(Og,t.txSentry,f(Fg,Ky,G.chainCmd)),Y=ne.a,W=ne.b;return f(cB,f(Uf,Ky,G.appCmds),L(U(t,{submodel:Vy(G.model),txSentry:Y}),ao(F([f(Pg,Ky,G.cmd),W]))))}return L(t,io);case"MarketplaceMsg":var ae=e.a,ie=t.submodel;if("MarketplaceModel"===ie.$){var oe=ie.a,G=f(yv,ae,oe);return f(cB,f(Uf,gT,G.appCmds),L(U(t,{submodel:Oy(G.model)}),f(Pg,gT,G.cmd)))}return L(t,io);case"AgentHistoryMsg":var ue=e.a,se=t.submodel;if("AgentHistoryModel"===se.$){var ce=se.a,G=f(bf,ue,ce),fe=f(Og,t.txSentry,f(Fg,lT,G.chainCmd)),Y=fe.a,W=fe.b;return f(cB,f(Uf,lT,G.appCmds),L(U(t,{submodel:Py(G.model),txSentry:Y}),ao(F([f(Pg,lT,G.cmd),W]))))}return L(t,io);case"TxSentryMsg":var le=e.a,de=f(tB,le,t.txSentry),I=de.a,he=de.b;return L(U(t,{txSentry:I}),he);case"TradeCacheMsg":var pe=e.a,G=f(fT,pe,t.tradeCache);return L(U(t,{tradeCache:G.tradeCache}),f(Pg,vT,G.cmd));case"NoOp":return L(t,io);default:var K=e.a;f(kl,"test",K);return L(t,io)}}),lB=r(function(e,t){return f(uB,t,Sy(e))}),dB={$:"AllGood"},hB={$:"NoWeb3"},pB=function(e){return{$:"TxSentryMsg",a:e}},gB={$:"WrongNetwork"},vB={align:Yp,mainParagraphs:F([F([Jp("No web3 provider detected. Is "),f(yA,F([wA(l(bA,0,0,1))]),{label:Jp("Metamask"),url:"https://metamask.io/"}),Jp(" or some other web3 provider installed and unlocked?")])]),noticeType:tg},yB={$:"TopLeft"},mB={align:yB,mainParagraphs:F([F([Jp("Your screen is quite small--things may be very broken! We will be addressing this soon.")])]),noticeType:tg},bB=n(function(e,t,r){var n=e.a,a=e.b;return $g({inPort:a,nodePath:r,outPort:n,ref:1,tagger:t,txs:Ch})}),CB=n(function(e,t,r){var n=e.width<1024?ya(mB):ma,a=function(){if(e.networkId){var t=xa(e.networkId);if("Nothing"===t.$)return L(la(da),gB);return L(t.a,dB)}return L(la(da),hB)}(),i=a.a,o=a.b,u=La(i),s=FE(u),c=s.a,d=s.b,h=l(bB,L(ro,eo),pB,u.httpProvider),p=function(){switch(o.$){case"NoWeb3":return ya(vB);case"WrongNetwork":return ya(BA);default:return ma}}(),g=QC(F([n,p])),v=f(lB,t,{initialWeb3State:o,key:r,screenWidth:e.width,submodel:hT,time:Ff(0),tradeCache:c,txSentry:h,userAddress:ma,userInfo:ma,userNotices:mr,web3Context:u}),y=v.a,m=v.b;return L(f(Za,g,y),ao(F([f(Pg,vT,d),m])))}),SB=ze("networkSentryPort",Zi),EB=Me,TB=EB(mr),wB=function(e){return TB},IB=function(e){return{$:"Refresh",a:e}},AB=r(function(e,t){return{$:"Every",a:e,b:t}}),BB=r(function(e,t){return{processes:t,taggers:e}}),kB=Qh(f(BB,Ch,Ch)),NB=o(function(e,t,a,i,o,u){var s=n(function(r,n,i){e:for(;;){var o=i.a,u=i.b;if(o.b){var s=o.a,c=s.a,f=s.b,h=o.b;if(_(c,r)<0){var p=r,g=n,v=L(h,l(e,c,f,u));r=p,n=g,i=v;continue e}return _(c,r)>0?L(o,l(a,r,n,u)):L(h,d(t,c,f,n,u))}return L(o,l(a,r,n,u))}}),c=l(wE,s,L(Ka(i),u),o),f=c.a,h=c.b;return l(za,r(function(t,r){var n=t.a,a=t.b;return l(e,n,a,r)}),h,f)}),RB=Re,$B=r(function(e,t){var r=e.a,n=e.b,a=f(Sh,r,t);if("Nothing"===a.$)return l(Bh,r,F([n]),t);var i=a.a;return l(Bh,r,f(qa,n,i),t)}),xB=ke,_B=r(function(e,t){return{$:"Zone",a:e,b:t}}),LB=fa,PB=n(function(e,t,r){if(t.b){var n=t.a,a=t.b,i=xB(f(LB,n,f(Mh,e,n)));return f(ip,function(t){return l(PB,e,a,l(Bh,n,t,r))},i)}return Qh(r)}),DB=n(function(e,t,r){var i=r.processes,o=n(function(e,t,r){var n=r.a,a=r.b,i=r.c;return P(n,a,f(ip,function(e){return i},RB(t)))}),u=l(za,$B,Ch,t),s=n(function(e,t,r){var n=r.a,a=r.b,i=r.c;return P(f(qa,e,n),a,i)}),c=a(function(e,t,r,n){var a=n.a,i=n.b,o=n.c;return P(a,l(Bh,e,r,i),o)}),d=p(NB,s,c,o,u,i,P(mr,Ch,Qh(vr))),h=d.a,g=d.b,v=d.c;return f(ip,function(e){return Qh(f(BB,u,e))},f(ip,function(t){return l(PB,e,h,g)},v))}),UB=function(e){return Ie(function(t){t(Te(e(Date.now())))})}(Ff),OB=n(function(e,t,r){var n=f(Sh,t,r.taggers);if("Nothing"===n.$)return Qh(r);var a=n.a,i=function(t){return cp(f(tu,function(r){return f(Oh,e,r(t))},a))};return f(ip,function(e){return Qh(r)},f(ip,i,UB))}),MB=r(function(e,t){var r=t.a,n=t.b;return f(AB,r,f(wf,e,n))});gn.Time=De(kB,DB,OB,0,MB);var FB=Oe("Time"),VB=r(function(e,t){return FB(f(AB,e,t))}),KB=function(e){return f(VB,2e3,IB)},HB=function(e){return TB},jB=function(e){return{$:"Refresh",a:e}},qB=function(e){return f(VB,2e3,jB)},GB=function(e){return{$:"DecryptionFinished",a:e}},zB=ze("decryptionFinished",Zi),YB=ze("encryptionFinished",Zi),WB=function(e){return{$:"EncryptionFinished",a:e}},JB=function(e){return{$:"Refresh",a:e}},QB=function(e){return EB(F([f(VB,3e3,JB),YB(WB),zB(function(e){return xS(GB(e))})]))},XB=mn,ZB=function(e){var t=e.submodel;switch(t.$){case"BetaLandingPage":return TB;case"CreateModel":t.a;return f(XB,Uy,KB());case"QuickCreateModel":t.a;return f(XB,Fy,qB());case"TradeModel":t.a;return f(XB,Ky,QB());case"MarketplaceModel":t.a;return f(XB,gT,HB());default:t.a;return f(XB,lT,wB())}},ek=ze("userPubkeyResult",Zi),tk=ze("walletSentryPort",Zi),rk={$:"CheckForNewTrades"},nk=function(e){return f(VB,5e3,function(e){return rk})},ak=function(e){return{$:"NetworkUpdate",a:e}},ik=function(e){return{$:"Tick",a:e}},ok=function(e){return{$:"UserPubkeySet",a:e}},uk=function(e){return{$:"WalletStatus",a:e}},sk=function(e){return f(Qp,"Error decoding JS walletSentry: "+e,ma)},ck=function(e){return{$:"ErrorDecoding",a:e}},fk=r(function(e,t){return{$:"TxSigned",a:e,b:t}}),lk=l(Af,r(function(e,t){return{ref:e,txHash:t}}),f(Od,"ref",ZC),f(Od,"txHash",$A(pE))),dk=function(e){var t=f(Yd,lk,e);if("Ok"===t.$){var r=t.a,n=r.txHash;if("Just"===n.$){var a=n.a;return f(fk,r.ref,Ii(a))}return f(fk,r.ref,wi("Problem signing/broadcasting Tx. Ref #"+ji(r.ref)))}t.a;return ck("Error decoding tx data")},hk=function(e){var t=e.a;return f(XB,t.tagger,t.inPort(dk))},pk=f(If,Ra,ZC),gk=Lo(f($a,nl,f($a,_l("Failure decoding stringy int"),Eo(Ra)))),vk=nE(F([gk,pk])),yk=r(function(e,t){return{account:e,networkId:t}}),mk=l(Af,yk,f(Od,"account",$A(uE)),f(Od,"networkId",vk)),bk=n(function(e,t,r){var n=f(Yd,mk,r);if("Err"===n.$){var a=n.a;return e(Qi(a))}return t(n.a)}),Ck=function(e){var t=f($a,sk,f($a,Sf,dT));return EB(O(F([f(VB,1e3,ik),tk(f(bk,t,uk)),hk(e.txSentry),ek(ok),f(XB,vT,nk(e.tradeCache)),SB(ak)]),F([ZB(e)])))},Sk=function(e){return{$:"LinkClicked",a:e}},Ek=function(e){return{$:"UrlChanged",a:e}},Tk=n(function(e,t,r){return d(mA,e/255,t/255,r/255,1)}),wk=l(Tk,10,33,108),Ik={$:"Generic"},Ak=Ik,Bk=r(function(e,t){return d(gA,$T,Ak,f(qa,AT(wT),f(qa,ET(wT),e)),NT(F([t])))}),kk=function(e){return{$:"Fill",a:e}},Nk=kk(1),Rk=Nf,$k=function(e){return{$:"Px",a:e}},xk=$k,_k=aw(8),Lk=function(e){return f(EA,_k,l(SA,"bg-"+TA(e),"background-color",e))},Pk=f(Bk,F([AT(Nk),ET(xk(150)),Lk(wk)]),Rk),Dk=function(e){return{$:"GotoRoute",a:e}},Uk={$:"Active"},Ok={$:"Important"},Mk={$:"Normal"},Fk=l(bA,1,1,1),Vk=aw(2),Kk=i(function(e,t,r,n,a){return{$:"PaddingStyle",a:e,b:t,c:r,d:n,e:a}}),Hk=r(function(e,t){return $(e,t)?f(EA,Vk,h(Kk,"p-"+ji(e),e,e,e,e)):f(EA,Vk,h(Kk,"p-"+ji(e)+"-"+ji(t),t,e,t,e))}),jk=aw(21),qk=r(function(e,t){return{$:"Class",a:e,b:t}}),Gk=f(qk,jk,PT.cursorPointer),zk=aw(17),Yk=function(e){return f(EA,zk,l(WI,"br-"+ji(e),"border-radius",ji(e)+"px"))},Wk=function(e){return{$:"Normal",a:e}},Jk=Kn,Qk=r(function(e,t){return f(Jk,e,Wk(t))}),Xk=function(e){return f(Qk,"click",_o(e))},Zk=f(wf,BT,Xk),eN=aw(13),tN=f(qk,eN,PT.textSemiBold),rN=aw(4),nN=function(e){return{$:"FontSize",a:e}},aN=function(e){return f(EA,rN,nN(e))},iN=n(function(e,t,r){var n=function(){switch(r.$){case"Normal":return mr;case"Active":return F([Yk(4),Lk(l(bA,0,0,1))]);default:return F([Yk(4),Lk(l(bA,.9,0,0))])}}();return f(Bk,O(F([f(Hk,23,12),aN(22),tN,wA(Fk),Gk,Zk(t)]),n),Jp(e))}),oN=l(Tk,244,0,103),uN=function(e){return{$:"AlignX",a:e}},sN={$:"CenterX"},cN=uN(sN),fN=aw(3),lN=n(function(e,t,r){return{$:"SpacingStyle",a:e,b:t,c:r}}),dN=r(function(e,t){return"spacing-"+ji(e)+"-"+ji(t)}),hN=function(e){return f(EA,fN,l(lN,f(dN,e,e),e,e))},pN=function(e){return{$:"Describe",a:e}},gN={$:"Paragraph"},vN=r(function(e,t){return d(gA,YT,Ak,f(qa,pN(gN),f(qa,AT(Nk),f(qa,hN(5),e))),NT(t))}),yN=f(qk,eN,PT.bold),mN=f(Bk,F([aN(29),wA(Fk),yN,cN,Gk,Zk(Dk(Wv))]),f(vN,mr,F([Jp("DAI"),f(Bk,F([wA(oN)]),Jp("Hard"))]))),bN=function(e){var t=e.web3Context.factoryType;if("Native"!==t.$){if("EthDai"===t.a.$){t.a;return"Mainnet Dai"}t.a;return"Testnet Dai"}switch(t.a.$){case"Eth":t.a;return"Mainnet ETH";case"Kovan":t.a;return"Testnet ETH";default:t.a;return"xDai"}},CN=vA(PT.italic),SN=function(e){return f(Bk,F([aN(18),wA(l(bA,.8,.8,1)),tN,CN,cN]),Jp(bN(e)))},EN={$:"Right"},TN=uN(EN),wN={$:"AsColumn"},IN=wN,AN=r(function(e,t){return d(gA,IN,Ak,f(qa,vA(PT.contentTop+" "+PT.contentLeft),f(qa,ET(wT),f(qa,AT(wT),e))),NT(t))}),BN={$:"AsRow"},kN=BN,NN=r(function(e,t){return d(gA,kN,Ak,f(qa,vA(PT.contentLeft+" "+PT.contentCenterY),f(qa,AT(wT),f(qa,ET(wT),e))),NT(t))}),RN=function(e){return f(NN,F([AT(Nk),hN(30),f(Hk,30,17)]),F([l(iN,"Create a New Offer",Dk(Yv),function(){return"CreateModel"===e.submodel.$?Uk:Mk}()),l(iN,"Sell Offers",Dk(Jv(ry)),function(){var t=e.submodel;if("MarketplaceModel"===t.$){return $(t.a.browsingRole,ry)?Uk:Mk}return Mk}()),l(iN,"Buy Offers",Dk(Jv(Of)),function(){var t=e.submodel;if("MarketplaceModel"===t.$){return $(t.a.browsingRole,Of)?Uk:Mk}return Mk}()),function(){var t=e.userInfo;if("Just"===t.$){var r=t.a;return l(iN,"My Trades",Dk(f(vf,r.address,Of)),function(){var t=e.submodel;if("AgentHistoryModel"===t.$){return $(t.a.agentAddress,r.address)?Uk:Mk}return Mk}())}return l(iN,"Connect to Wallet",pT,Ok)}(),f(AN,F([TN,hN(0),f(Hk,8,0)]),F([mN,SN(e)]))]))},$N=function(e){return function(t){return $(t.parameters.initiatorAddress,e.agentAddress)||$(t.state.responder,ya(e.agentAddress))}},xN=function(e){switch(e.$){case"Open":return 1;case"Committed":return 2;case"Judgment":return 3;default:return 4}},_N=function(e){return r(function(e,t){var r=f(su,xN(e.state.phase),xN(t.state.phase));return $(r,Pa)?r:f(Kg,e.derived.phaseEndTime,t.derived.phaseEndTime)})},LN=Er,PN=r(function(e,t){return f($a,Zd(e),LN(t))}),DN=function(e){return{$:"AlignY",a:e}},UN={$:"CenterY"},ON=DN(UN),MN=aw(20),FN=f(qk,MN,PT.clip),VN=kk,KN=function(e){return f(EA,Vk,h(Kk,"p-"+ji(e),e,e,e,e))},HN=function(e){var t=e.a,r=e.b;return f(Bk,F([AT(VN(t)),ET(xk(60)),FN,Lk(Fk)]),f(Bk,F([KN(12),ON,AT(Nk)]),r))},jN=f(qk,eN,PT.textMedium),qN=function(e){return f(Bk,F([jN,aN(17)]),Jp(e))},GN=function(e){return{$:"Poke",a:e}},zN=aw(33),YN={$:"Hover"},WN=r(function(e,t){return{$:"PseudoSelector",a:e,b:t}}),JN=zn,QN=r(function(e,t){return{$:"Nearby",a:e,b:t}}),XN={$:"NoAttribute"},ZN=r(function(e,t){return{$:"TransformComponent",a:e,b:t}}),eR=r(function(e,t){switch(t.$){case"NoAttribute":return XN;case"Describe":var r=t.a;return pN(r);case"AlignX":var n=t.a;return uN(n);case"AlignY":var a=t.a;return DN(a);case"Width":var n=t.a;return IT(n);case"Height":var n=t.a;return ST(n);case"Class":var n=t.a,a=t.b;return f(qk,n,a);case"StyleClass":var i=t.a,o=t.b;return f(EA,i,o);case"Nearby":var u=t.a,s=t.b;return f(QN,u,f(_f,e,s));case"Attr":var c=t.a;return BT(f(JN,e,c));default:var l=t.a,d=t.b;return f(ZN,l,d)}}),tR=function(e){return f(eR,lg,e)},rR=r(function(e,t){var r=t.a,n=t.b,a=tR(e);switch(a.$){case"StyleClass":var i=a.b;return L(f(qa,i,r),n);case"TransformComponent":var o=(a.a,a.b);return L(r,f(uA,n,o));default:return L(r,n)}}),nR=function(e){var t=l(za,rR,L(mr,hA),e),r=t.a,n=t.b;return f(qa,JI(n),r)},aR=function(e){return f(EA,zN,f(WN,YN,nR(e)))},iR=a(function(e,t,r,n){return d(mA,e/255,t/255,r/255,n)}),oR=me,uR=r(function(e,t){return f(jn,e,oR(t))}),sR=uR("disabled"),cR=function(e){return f(qn,"tabIndex",ji(e))},fR=function(e){if("StyleClass"===e.$&&"PseudoSelector"===e.b.$&&"Focus"===e.b.a.$){var t=e.b;t.a;return!0}return!1},lR=function(e){return f(Cd,fR,e)?XN:vA("focusable")},dR=function(e){return{$:"MayPreventDefault",a:e}},hR=r(function(e,t){return f(Jk,e,dR(t))}),pR=r(function(e,t){var r=function(r){return $(r,e)?_o(t):$o("Not the enter key")},n=f(Ro,r,f(Od,"key",xo));return BT(f(hR,"keyup",f(If,function(e){return L(e,!0)},n)))}),gR=function(e){return f(pR,"Enter",e)},vR={$:"Button"},yR=r(function(e,t){var r=t.onPress,n=t.label;return d(gA,$T,Ak,f(qa,AT(wT),f(qa,ET(wT),f(qa,vA(PT.contentCenterX+" "+PT.contentCenterY+" "+PT.seButton+" "+PT.noTextSelection),f(qa,Gk,f(qa,lR(e),f(qa,pN(vR),f(qa,BT(cR(0)),function(){if("Nothing"===r.$)return f(qa,BT(sR(!0)),e);var t=r.a;return f(qa,Zk(t),f(qa,gR(t),e))}()))))))),NT(F([n])))}),mR=function(e){return f(yR,F([Lk(d(iR,16,7,234,.2)),KN(5),Yk(4),AT(Nk),aR(F([Lk(d(iR,16,7,234,.4))]))]),{label:f(Bk,F([cN,wA(l(Tk,16,7,234)),jN,aN(14)]),Jp("Poke")),onPress:ya(GN(e))})},bR=function(e){return{$:"TimeLeft",a:e}},CR=function(e){return{$:"TimeUp",a:e}},SR=r(function(e,t){switch(e.$){case"Open":return t.parameters.autorecallInterval;case"Committed":return t.parameters.autoabortInterval;case"Judgment":return t.parameters.autoreleaseInterval;default:return Ff(0)}}),ER=r(function(e,t){return Ff(Gl(e)-Gl(t))}),TR=r(function(e,t){var r=f(SR,t.state.phase,t),n=f(ER,e,t.state.phaseStartTime),a=f(ER,r,n);return Gl(a)>0?bR(L(a,r)):CR(r)}),wR=function(e){switch(e.$){case"Open":return"Expiring...";case"Committed":return"Aborting...";case"Judgment":return"Releasing...";default:return""}},IR=l(bA,0,0,0),AR=l(Tk,233,237,242),BR={$:"Behind"},kR=function(e){return f(QN,BR,e)},NR=r(function(e,t){var r=Ag(200*e),n=200-r,a=f(Bk,F([AT(VN(n))]),Rk),i=F([ET(xk(3)),Yk(20)]),o=f(Bk,O(i,F([AT(VN(r)),Lk(t)])),Rk),u=f(Bk,O(i,F([AT(Nk),Lk(AR)])),Rk);return f(NN,F([AT(Nk),kR(u)]),F([o,a]))}),RR=l(Tk,51,183,2),$R=function(e){return Gl(e)<0},xR=a(function(e,t,r,n){return{days:e,hours:t,min:r,sec:n}}),_R=function(e){var t=_p(e);return function(e){var t=e.a,r=e.b;return function(e){var r=e.a,n=e.b;return function(e){var n=e.a,a=e.b;return d(xR,lC(t),lC(r),lC(n),lC(a))}(f(ec,L(lu(0),lu(0)),f(Hu,n,lu(60))))}(f(ec,L(lu(0),lu(0)),f(Hu,r,lu(3600))))}(f(ec,L(lu(0),lu(0)),f(Hu,t,lu(86400))))},LR=a(function(e,t,n,a){for(;;){var i=n.a,o=n.b;if(!$R(a)){var u=r(function(e,t){return O(l(Ju,2,D("0"),ji(e)),t)}),s=Gl(a)>0?i:o,c=_R(a),d=c.days||c.hours?i:o,h=c.days?i:o;return f(NN,O(F([hN(5)]),e),F([f(Bk,O(F([wA(h)]),t),Jp(f(u,c.days,"d"))),f(Bk,O(F([wA(d)]),t),Jp(f(u,c.hours,"h"))),f(Bk,O(F([wA(s)]),t),Jp(f(u,c.min,"m")))]))}var p=e,g=t,v=L(i,o),y=Ff(0);e=p,t=g,n=v,a=y}}),PR=l(bA,1,1,0),DR=r(function(e,t){return Gl(e)/Gl(t)}),UR=a(function(e,t,r,n){var a=r.a,i=r.b,o=n.a,u=n.b,s=f(DR,o,u),c=(f(Bk,F([cN]),d(LR,mr,mr,L(a,i),o)),s<.1?oN:s<.2?PR:RR);return f(AN,O(F([hN(5)]),e),F([d(LR,F([cN]),t,L(a,i),o),f(NR,1-s,c)]))}),OR=a(function(e,t,r,n){var a=f(TR,e,t);if("TimeLeft"===a.$){var i=a.a,o=r&&f(DR,i.a,i.b)<.05?oN:IR;return d(UR,F([AT(Nk)]),F([aN(16)]),L(o,AR),i)}return f(AN,F([hN(4),AT(Nk)]),O(F([f(Bk,F([cN,aN(14)]),Jp(wR(t.state.phase)))]),n?F([f(Bk,F([cN]),mR(t.creationInfo.address))]):mr))}),MR=function(e){return{$:"JustImage",a:e}},FR=MR,VR=function(e){return l(za,r(function(e,t){var r=e.a,n=e.b;return l(Bh,r,n,t)}),Ch,e)}(f(tu,function(e){var t=e.a;return L(t,L(e.b,FR({description:t,src:"/DAIHard/static/img/currencies/"+t+".svg"})))},F([L("AUD","$"),L("CLP","$"),L("EUR","€"),L("IDR","Rp"),L("KRW","₩"),L("NZD","$"),L("RUB","₽"),L("TRY","₺"),L("BRL","R$"),L("CNY","¥"),L("GBP","£"),L("ILS","₪"),L("MXN","$"),L("PHP","₱"),L("SEK","kr"),L("TWD","NT$"),L("CAD","$"),L("CZK","Kč"),L("HKD","$"),L("INR","₹"),L("MYR","RM"),L("PKR","₨"),L("SGD","$"),L("USD","$"),L("CHF","Fr"),L("DKK","kr"),L("HUF","Ft"),L("JPY","¥"),L("NOK","kr"),L("PLN","zł"),L("THB","฿"),L("ZAR","R"),L("VND","₫")]))),KR=function(e){return f(ec,"",f(jf,hi,f(Sh,e,VR)))},HR=function(e){return go(e)<=3?e:HR(f(wl,3,e))+","+f(wo,3,e)},jR=function(e){return HR(Tl(e))},qR=function(e){return O(KR(e.fiatType),jR(e.amount))},GR=yT("alt"),zR=function(e){return f(yT,"src",ot(e))},YR=r(function(e,t){var r=t.src,n=t.description,a=f(Zd,function(e){switch(e.$){case"Width":case"Height":return!0;default:return!1}},e);return d(gA,$T,Ak,f(qa,vA(PT.imageContainer),e),NT(F([d(gA,$T,kT("img"),O(F([BT(zR(r)),BT(GR(n))]),a),NT(mr))])))}),WR=r(function(e,t){if("None"===t.$)return Rk;var r=t.a;return f(YR,e,r)}),JR=mA,QR=function(e){var t=function(){var t=f(Sh,e.fiatType,VR);if("Nothing"===t.$)return Rk;var r=t.a,n=(r.a,r.b);return f(WR,F([ET(xk(26))]),n)}();return f(NN,F([hN(4)]),F([t,f(Bk,F([wA(d(JR,0,0,0,.5)),jN,AT(xk(50))]),Jp(e.fiatType)),Jp(qR(e))]))},XR=function(e){return QR(e)},ZR=function(e){return f(Bk,F([AT(Nk),ET(Nk),FN]),f(vN,F([aN(12)]),F([Jp(e.info)])))},e$=function(e){return f(ec,Rk,f(jf,ZR,Xf(e)))},t$=MR({description:"DAI",src:"/DAIHard/static/img/dai-symbol.png"}),r$=function(e){return f(WR,f(qa,ET(xk(26)),e),t$)},n$=function(e){var t=Il(Hf(e)),r=f(Zf,".",t);if(!r.b)return t;if(r.b.b){kl("Error interpreting evmValueToString result. More than one decimal??");return"???"}switch(r.a){case 0:return"0"+f(Co,3,t);case 1:return f(Co,4,f(ec,t,f(jf,Tw,f(jf,function(e){return e/100},f(jf,ni,f(jf,Ag,f(jf,yi(100),Nl(t))))))));default:var n=r.a;return f(ec,f(Co,n,t),f(jf,ji,f(jf,Ag,Nl(t))))}},a$=function(e){var t=n$(e);return f(NN,F([hN(4)]),F([r$(mr),f(Bk,F([aN(16)]),Jp(t))]))},i$=function(e){return a$(e)},o$=function(e){return{$:"TradeClicked",a:e}},u$=function(e){return f(yR,F([Lk(d(iR,16,7,234,.2)),KN(11),Yk(4),AT(Nk),aR(F([Lk(d(iR,16,7,234,.4))]))]),{label:f(Bk,F([cN,wA(l(Tk,16,7,234)),jN]),Jp("View Offer")),onPress:ya(o$(e))})},s$=i(function(e,t,r,n,a){return f(NN,F([AT(Nk),hN(1)]),F([function(){switch(n.$){case"Open":return HN(L(2,d(OR,e,a,!1,t)));case"Committed":return HN(L(2,d(OR,e,a,$(r,ry),t)));case"Judgment":return HN(L(2,d(OR,e,a,$(r,Of),t)));default:return Rk}}(),HN(L(1,i$(a.parameters.tradeAmount))),HN(L(2,XR(a.terms.price))),HN(L(6,e$(a.terms.paymentMethods))),HN(L(2,u$(a.id)))]))}),c$=aw(28),f$=function(e){return f(EA,c$,l(SA,"bc-"+TA(e),"border-color",e))},l$=i(function(e,t,r,n,a){return{$:"BorderWidth",a:e,b:t,c:r,d:n,e:a}}),d$=function(e){return f(EA,fA,h(l$,"b-"+ji(e),e,e,e,e))},h$=n(function(e,t,r){var n=function(){switch(r.viewPhase.$){case"Open":return"Expires in";case"Committed":return"Payment Due";case"Judgment":return"Auto-Release";default:return""}}(),a=function(){return"Buyer"===r.agentRole.$?"Buying":"Selling"}();return f(AN,F([AT(Nk),ET(Nk),f(Hk,30,10),hN(5)]),F([f(NN,F([AT(Nk)]),F([$(r.viewPhase,rC)?Rk:HN(L(2,qN(n))),HN(L(1,qN(a))),HN(L(2,qN("For Fiat"))),HN(L(6,qN("Payment Methods"))),HN(L(2,Rk))])),f(AN,F([AT(Nk),d$(1),Yk(8),f$(AR),hN(1),Lk(AR),FN]),f(tu,d(s$,e,!$(r.userInfo,ma),r.agentRole,r.viewPhase),t))]))}),p$=n(function(e,t,r){return $(f(CS,e,r),ya(t))}),g$=l(Tk,150,150,150),v$=function(e){return f(Zd,function(e){return bb(e.parameters)},GE(e))},y$=n(function(e,t,r){var n=l(PN,$N(r),_N(),v$(t)),a=f(Zd,function(e){return l(p$,e,r.agentRole,r.agentAddress)&&$(e.state.phase,r.viewPhase)},n),i=function(e){return f(Bk,F([aN(24),tN,wA(g$),cN,KN(20)]),Jp(e))},o=L(t.dataFetchStatus.total,a);if("Nothing"===o.a.$){o.a;return i("Querying Factory contract...")}if(o.a.a){if(o.b.b){var u=o.a.a;return l(h$,e,a,r)}var u=o.a.a;return i(_(t.dataFetchStatus.loaded,u-t.dataFetchStatus.invalid)<0?"Searching for user trades...":"No matching trades found.")}return i("No trades found.")}),m$=r(function(e,t){return f(Bk,F([Yk(4),Lk(d(JR,0,0,1,.1)),wA(l(Tk,16,7,234)),aN(e),tN,f(Hk,15,13)]),Jp(Xd(t)))}),b$=a(function(e,t,r,n){return"pad-"+ji(e)+"-"+ji(t)+"-"+ji(r)+"-"+ji(n)}),C$=function(e){var t=e.top,r=e.right,n=e.bottom,a=e.left;return $(t,r)&&$(t,n)&&$(t,a)?f(EA,Vk,h(Kk,"p-"+ji(t),t,t,t,t)):f(EA,Vk,h(Kk,d(b$,t,r,n,a),t,r,n,a))},S$=function(e){return function(){var t=e.userInfo;return"Nothing"!==t.$&&$(t.a.address,e.agentAddress)}()?f(Bk,F([f(Hk,30,10),aN(24),tN]),Jp("Your Trades")):f(NN,F([hN(10),C$({bottom:30,left:30,right:30,top:10})]),F([f(Bk,F([aN(24),tN]),Jp("Trade History for User")),f(m$,18,e.agentAddress)]))},E$=function(e){return{$:"ViewPhaseChanged",a:e}},T$=l(bA,0,0,1),w$=function(e){var t=F([aN(20),yN,Gk]),r=function(e){return e?O(t,F([wA(T$)])):t};return f(NN,F([hN(30)]),F([f(Bk,O(F([Zk(E$(no))]),r($(e,no))),Jp("Open")),f(Bk,O(F([Zk(E$(nC))]),r($(e,nC))),Jp("Payment Due")),f(Bk,O(F([Zk(E$(aC))]),r($(e,aC))),Jp("Release Due")),f(Bk,O(F([Zk(E$(rC))]),r($(e,rC))),Jp("Closed"))]))},I$=function(e){return f(Bk,F([f(Hk,30,10)]),w$(e.viewPhase))},A$=function(e){return{$:"ViewUserRoleChanged",a:e}},B$=d(iR,1,31,52,.13),k$=function(e){var t=F([aN(24),tN,Gk]),r=function(){return"Buyer"===e.$?L(t,O(t,F([wA(B$)]))):L(O(t,F([wA(B$)])),t)}(),n=r.a,a=r.b;return f(NN,F([hN(20)]),F([f(Bk,O(F([Zk(A$(Of))]),a),Jp("As the Seller")),f(Bk,O(F([Zk(A$(ry))]),n),Jp("As the Buyer"))]))},N$=function(e){return f(Bk,F([f(Hk,30,10)]),k$(e.agentRole))},R$=n(function(e,t,r){return f(AN,F([Yk(5),Lk(Fk),AT(Nk),ET(Nk),f(Hk,0,20)]),F([S$(r),N$(r),I$(r),l(y$,e,t,r)]))}),$$=function(e){return{$:"ShowCurrencyDropdown",a:e}},x$={$:"AbortCreate"},_$=r(function(e,t){return{$:"ConfirmCreate",a:e,b:t}}),L$=function(e){return f(tu,function(e){return F([f(Bk,F([wA(oN)]),Jp("Caution! ")),Jp(e)])},QC(F([$(f(Kg,e.autoreleaseInterval,Ff(12e5)),Da)?ya(function(){return"Buyer"===e.initiatorRole.$?"That Burn/Release Window time is quite small! It might take a while to find a committed Seller.":"That Burn/Release Window time is quite small! This may attract scammers. Only create this trade if you know what you're doing."}()):ma,$(f(Kg,e.autoabortInterval,Ff(36e5)),Da)?ya(function(){return"Buyer"===e.initiatorRole.$?'That Payment Window time is quite small! If you fail to to 1. make the payment and 2. click "confirm" before this time is up, the trade will automatically abort, incurring the abort punishments on both parties.':'That Payment Window time is quite small! If the Buyer fails to to 1. make the payment and 2. click "confirm" before this time is up, the trade will automatically abort, incurring the abort punishments on both parties.'}()):ma])))},P$=function(e){return f(Bk,F([C$({bottom:5,left:5,right:5,top:0}),Zk(e),Yk(30),Lk(d(JR,1,1,1,.4)),d$(1),f$(d(JR,0,0,0,.3)),Gk,aN(14)]),f(Bk,F([wA(d(JR,0,0,0,.7))]),Jp("x")))},D$=Hn,U$=D$,O$=BT,M$=r(function(e,t){return f(Bk,F([kR(f(Bk,F([Lk(e),O$(f(U$,"position","fixed")),O$(f(U$,"z-index","1000")),O$(f(U$,"top","0")),O$(f(U$,"left","0")),O$(f(U$,"width","100%")),O$(f(U$,"height","100%"))]),Rk)),AT(Nk),ET(Nk)]),t)}),F$={$:"Top"},V$=DN(F$),K$={$:"InFront"},H$=function(e){return f(QN,K$,e)},j$=r(function(e,t){return{$:"Max",a:e,b:t}}),q$=r(function(e,t){return f(j$,e,t)}),G$=n(function(e,t,r){return l(va,M$,d(JR,0,0,.3,.6),f(Bk,O(F([cN,ON,AT(f(q$,500,wT)),Lk(Fk),Yk(8),H$(f(Bk,F([TN,V$]),P$(r)))]),e),t))}),z$=r(function(e,t){if("Nothing"===t.$)return Rk;var r=t.a;return f(Bk,O(F([Yk(5),f$(l(bA,.9,0,0)),d$(1),Lk(l(bA,1,.4,.4)),KN(5),cN,ON,AT(f(q$,200,wT)),aN(14)]),e),f(vN,mr,F([Jp(r)])))}),Y$={$:"Above"},W$=function(e){return f(QN,Y$,e)},J$=aw(26),Q$=function(e){return{$:"MoveY",a:e}},X$=function(e){return f(ZN,J$,Q$(-e))},Z$=r(function(e,t){return f(Bk,F([Yk(4),f(Hk,25,17),aN(18),tN,Lk(AR),W$(f(z$,F([X$(5)]),t))]),Jp(e))}),ex=d(iR,1,31,52,.64),tx=aw(32),rx={$:"Active"},nx=function(e){return f(EA,tx,f(WN,rx,nR(e)))},ax=a(function(e,t,r,n){var a=e.a,i=e.b,o=e.c;return f(Bk,F([Yk(4),Gk,Zk(n),f(Hk,25,17),wA(t),aN(18),tN,Lk(a),nx(F([Lk(o)])),aR(F([Lk(i)]))]),Jp(r))}),ix=r(function(e,t){return d(ax,P(d(JR,1,0,0,1),d(JR,1,0,0,.8),d(JR,1,0,0,.6)),Fk,e,t)}),ox=aw(12),ux=f(qk,ox,PT.textCenter),sx=function(e){return M$(d(JR,0,0,.3,.6))(f(AN,F([hN(10),cN,ON,Lk(d(JR,0,0,0,.5)),Yk(8),KN(20)]),f(tu,function(e){return f(vN,F([cN,ON,aN(20),tN,wA(Fk),ux]),F([e]))},e)))},cx=r(function(e,t){if("Token"===e.$){if("EthDai"===e.a.$){e.a;return"https://etherscan.io/tx/"+_A(t)}e.a;return"https://kovan.etherscan.io/tx/"+_A(t)}switch(e.a.$){case"Eth":e.a;return"https://etherscan.io/tx/"+_A(t);case"Kovan":e.a;return"https://kovan.etherscan.io/tx/"+_A(t);default:e.a;return"https://blockscout.com/poa/dai/tx/"+_A(t)}}),fx={$:"Bottom"},lx=DN(fx),dx=vA(PT.underline),hx=r(function(e,t){switch(e.$){case"Confirm":var r=e.a,n=Qf(t.web3Context.factoryType),a=function(){var e=t.depositAmount;if("Just"===e.$){var n=e.a;return L(Jp(n$(Fv(n))),f(ix,"Yes, I definitely want to open this trade.",f(_$,r,n)))}return L(Jp("??"),f(Z$,"(loading exact fees...)",ma))}(),i=a.a,o=a.b;return l(G$,mr,f(AN,F([hN(20),KN(20),cN,ET(Nk),ux]),F([f(Bk,F([aN(26),tN,cN,ON]),Jp("Just to Confirm...")),f(AN,F([hN(20),cN,ON]),f(tu,vN(F([cN,aN(18),jN,wA(ex)])),O(L$(r),O(F([F([Jp("You will deposit "),i,Jp(" "+n+" (including the 1% dev fee) to open this trade.")])]),function(){return"Token"===t.web3Context.factoryType.$?F([F([Jp("This ususally requires two Metamask signatures. Your "+n+" will not be deposited until the final transaction has been mined.")])]):mr}())))),f(Bk,F([lx,cN]),o)])),x$);case"ApproveNeedsSig":return sx(F([Jp("Waiting for user signature for the approve call."),Jp("(check Metamask!)"),Jp("Note that there will be a second transaction to sign after this.")]));case"ApproveMining":var r=e.a,u=e.b;return sx(F([Jp("Mining the initial approve transaction..."),f(yA,F([dx,wA(T$)]),{label:Jp("See the transaction on Etherscan"),url:f(cx,t.web3Context.factoryType,u)}),Jp("Funds will not leave your wallet until you sign the next transaction.")]));case"CreateNeedsSig":return sx(F([Jp("Waiting for user signature for the create call."),Jp("(check Metamask!)")]));default:var u=e.a;return sx(F([Jp("Mining the final create call..."),f(yA,F([dx,wA(T$)]),{label:Jp("See the transaction on Etherscan"),url:f(cx,t.web3Context.factoryType,u)}),Jp("You will be redirected when it's mined.")]))}}),px=function(e){var t=e.txChainStatus;if("Nothing"===t.$)return Rk;var r=t.a;return f(hx,r,e)},gx=function(e){return{$:"TradeAmountChanged",a:e}},vx=yT("id"),yx=O$(vx("inputError")),mx=l(Tk,109,127,138),bx=function(e){return f(NN,F([hN(4)]),F([r$(mr),f(Bk,F([aN(24),jN,wA(mx)]),Jp(Qf(e)))]))},Cx={$:"Left"},Sx=uN(Cx),Ex=function(e){return{$:"HiddenLabel",a:e}},Tx=Ex,wx=yT("type"),Ix=function(e){return L(e,!0)},Ax=function(e){return{$:"MayStopPropagation",a:e}},Bx=r(function(e,t){return f(Jk,e,Ax(t))}),kx=r(function(e,t){return l(Ja,Od,t,e)}),Nx=f(kx,F(["target","value"]),xo),Rx=function(e){return f(Bx,"input",f(If,Ix,f(If,e,Nx)))},$x=aw(0),xx=r(function(e,t){return{$:"Transparency",a:e,b:t}}),_x=function(e){var t=function(e){return 1-e}(f(Hs,1,f(vi,0,e)));return f(EA,$x,f(xx,"transparency-"+yw(t),t))},Lx=a(function(e,t,r,n){return{$:"Padding",a:e,b:t,c:r,d:n}}),Px=n(function(e,t,r){if("HiddenLabel"===t.$){t.a;return d(gA,IN,kT("label"),e,NT(F([r])))}var n=t.a,a=t.b,i=t.c,o=d(gA,$T,Ak,a,NT(F([i])));switch(n.$){case"Above":return d(gA,IN,kT("label"),e,NT(F([o,r])));case"Below":return d(gA,IN,kT("label"),e,NT(F([r,o])));case"OnRight":return d(gA,kN,kT("label"),e,NT(F([r,o])));default:return d(gA,kN,kT("label"),e,NT(F([o,r])))}}),Dx=MI,Ux=f(wf,BT,Dx("autocomplete")),Ox=l(bA,136/255,138/255,133/255),Mx=l(bA,186/255,189/255,182/255),Fx=f(Hk,12,12),Vx=l(bA,1,1,1),Kx=F([Fx,Yk(3),f$(Mx),Lk(Vx),d$(1),hN(3),AT(Nk)]),Hx=function(e){return{$:"Label",a:e}},jx=function(e){if("HiddenLabel"===e.$){var t=e.a;return pN(Hx(t))}return XN},qx=function(e){e:for(;;){if("StyleClass"!==e.$)break e;switch(e.b.$){case"PaddingStyle":e.b;return!0;case"BorderWidth":e.b;return!0;case"Transform":return!0;default:break e}}return!1},Gx=function(e){return"HiddenLabel"===e.$},zx=uR("spellcheck"),Yx=f(wf,BT,zx),Wx=J,Jx=aw(47),Qx=a(function(e,t,r,n){var a=function(e){return e.a+e.c},i=function(e){return e<1?1:e}(Oi(Wx(e))),o=(i-1)*t+f(ec,0,f(jf,a,r))+f(ec,0,f(jf,a,n));return f(EA,Jx,l(WI,"textarea-height-"+ji(i),"height",function(e){return"calc("+ji(e)+"em + "+ji(o)+"px) !important"}(i)))}),Xx=yT("value"),Zx=f(wf,BT,Xx),e_={$:"LivePolite"},t_=pN(e_),r_=function(e){return l(Ja,r(function(e,t){var r=t.a,n=t.b;switch(e.$){case"NoAttribute":return L(r,n);case"Class":e.a;return L(f(qa,e,r),n);case"Attr":e.a;return L(f(qa,e,r),n);case"StyleClass":e.b;return L(f(qa,e,r),n);case"Width":e.a;return f(gw,"width",n)?L(r,n):L(f(qa,e,r),f(kE,"width",n));case"Height":e.a;return f(gw,"height",n)?L(r,n):L(f(qa,e,r),f(kE,"height",n));case"Describe":e.a;return f(gw,"described",n)?L(r,n):L(f(qa,e,r),f(kE,"described",n));case"Nearby":e.a,e.b;return L(f(qa,e,r),n);case"AlignX":return f(gw,"align-x",n)?L(r,n):L(f(qa,e,r),f(kE,"align-x",n));case"AlignY":return f(gw,"align-y",n)?L(r,n):L(f(qa,e,r),f(kE,"align-y",n));default:return f(gw,"transform",n)?L(r,n):L(f(qa,e,r),f(kE,"transform",n))}}),L(mr,mm),e).a},n_=r(function(e,t){return l(Ja,r(function(e,r){return t(e)?f(qa,e,r):r}),mr,r_(e))}),a_=function(e){e:for(;;)switch(e.$){case"Content":return!0;case"Max":case"Min":var t=e.b,r=t;e=r;continue e;default:return!1}},i_=f(wf,xf,Ou),o_=n(function(e,t,n){var a=function(e){return"Nearby"===e.$},i=F([BT(Rx(n.onChange))]),o=O(Kx,t),u=f(n_,o,function(e){e:for(;;)switch(e.$){case"Width":case"Height":if("Fill"===e.a.$)return!0;break e;case"AlignX":case"AlignY":return!0;case"StyleClass":switch(e.b.$){case"SpacingStyle":e.b;return!0;case"FontSize":return!0;case"FontFamily":e.b;return!0;default:break e}default:break e}return!1}),s=f(Zd,qx,o),c=f(n_,o,function(e){return"Height"===e.$&&"Fill"===e.a.$}),h=(f(n_,o,function(e){if("StyleClass"===e.$&&"PaddingStyle"===e.b.$){e.b;return!0}return!1}),f(n_,o,function(e){return"Nearby"===e.$})),p=f(Zd,f(wf,Tu,a),o),g=function(){var t=e.type_;if("TextInputNode"===t.$){var a=t.a;return P("input",O(F([Zx(n.text),BT(wx(a)),Yx(e.spellchecked),vA(PT.inputText),function(){var t=e.autofill;if("Nothing"===t.$)return XN;var r=t.a;return Ux(r)}()]),p),mr)}var i=l(Ja,r(function(e,t){e:for(;;)switch(e.$){case"Describe":return t;case"Height":var r=e.a,n=t.heightContent;return"Nothing"===n.$?U(t,{adjustedAttributes:f(qa,e,t.adjustedAttributes),heightContent:ya(a_(r))}):t;case"StyleClass":switch(e.b.$){case"BorderWidth":var a=e.b,i=a.b,o=a.c,u=a.d,s=a.e,c=t.maybeBorder;return"Nothing"===c.$?U(t,{adjustedAttributes:f(qa,e,t.adjustedAttributes),maybeBorder:ya(d(Lx,i,o,u,s))}):t;case"PaddingStyle":var l=e.b,i=l.b,o=l.c,u=l.d,s=l.e,h=t.maybePadding;return"Nothing"===h.$?U(t,{adjustedAttributes:t.adjustedAttributes,maybePadding:ya(d(Lx,i,o,u,s))}):t;case"SpacingStyle":var p=e.b,g=(p.b,p.c),v=t.maybeSpacing;return"Nothing"===v.$?U(t,{adjustedAttributes:f(qa,e,t.adjustedAttributes),maybeSpacing:ya(g)}):t;default:break e}default:break e}return U(t,{adjustedAttributes:f(qa,e,t.adjustedAttributes)})}),{adjustedAttributes:mr,heightContent:ma,maybeBorder:ma,maybePadding:ma,maybeSpacing:ma},o),u=i.maybePadding,s=i.heightContent,c=i.maybeSpacing,h=i.adjustedAttributes,g=i.maybeBorder,v=f(ec,5,c);return P("textarea",O(F([Yx(e.spellchecked),vA(PT.inputMultiline),f(ec,XN,f(jf,Ux,e.autofill)),function(){if("Nothing"===u.$)return XN;var e=u.a,t=e.a,r=e.b,n=e.c,a=e.d;return C$({bottom:f(vi,0,n-(v/2|0)),left:a,right:r,top:f(vi,0,t-(v/2|0))})}(),function(){return"Nothing"===s.$?XN:s.a?d(Qx,n.text,v,u,g):XN}()]),h),F([i_(PI(n.text))]))}(),v=g.a,y=g.b,m=g.c,b=d(gA,$T,Ak,f(qa,AT(Nk),uy(F([h,c,function(){var e=n.placeholder;if("Nothing"===e.$)return mr;var t=e.a,r=t.a,a=t.b;return F([H$(f(Bk,f(qa,Fx,O(s,O(F([wA(Ox),vA(PT.noTextSelection+" "+PT.passPointerEvents),f$(d(JR,0,0,0,0)),Lk(d(JR,0,0,0,0)),ET(Nk),AT(Nk),_x(""===n.text?1:0)]),r))),a))])}()]))),NT(F([d(gA,$T,kT(v),uy(F([F([lR(t),jx(n.label)]),y,i])),NT(m))])));return l(Px,f(qa,f(qk,jk,PT.cursorText),f(qa,Gx(n.label)?XN:hN(5),f(qa,t_,u))),n.label,b)}),u_=o_({autofill:ma,spellchecked:!1,type_:function(e){return{$:"TextInputNode",a:e}}("text")}),s_=o(function(e,t,r,n,a,i){var o=t.a,u=t.b,s=f(u_,F([AT(Nk),ET(xk(40)),d$(0)]),{label:Tx(r),onChange:i,placeholder:n,text:a});return f(NN,O(F([hN(5)]),e),QC(F([f(jf,Bk(F([Sx])),o),ya(s),f(jf,Bk(F([TN])),u)])))}),c_={$:"Below"},f_=function(e){return f(QN,c_,e)},l_=function(e){return f(ZN,J$,Q$(e))},d_=n(function(e,t,r){return p(s_,F([AT(xk(150)),jN,aN(24),f_(f(z$,F([yx,l_(5)]),r))]),L(ma,ya(bx(e))),"dai input",ma,t,gx)}),h_=r(function(e,t){return f(EA,fA,h(l$,"b-"+ji(e)+"-"+ji(t),t,e,t,e))}),p_=function(e){var t=e.bottom,r=e.top,n=e.left,a=e.right;return $(r,t)&&$(n,a)?$(r,a)?d$(r):f(h_,n,r):f(EA,fA,h(l$,"b-"+ji(r)+"-"+ji(a)+"-"+ji(t)+"-"+ji(n),r,a,t,n))},g_=Bk(F([f$(AR),p_({bottom:2,left:0,right:0,top:0})])),v_=r(function(e,t){return f(AN,F([hN(10)]),F([f(Bk,F([aN(17),tN]),Jp(e)),t]))}),y_=function(e){return g_(f(v_,function(){return"Buyer"===e.inputs.userRole.$?"You're buying":"You're selling"}(),l(d_,e.web3Context.factoryType,e.inputs.daiAmount,e.errors.daiAmount)))},m_=function(e){var t=function(){var t=yl(e.inputs.daiAmount);if("Just"===t.$){var r=t.a;return"There is a 1% fee of "+n$(f(Gf,r,100))+" "+Qf(e.web3Context.factoryType)+"."}return"There is a 1% fee."}();return f(NN,F([cN,f(Hk,20,10),Lk(l(Tk,10,33,108)),Yk(8),hN(5)]),F([f(Bk,F([aN(18),wA(l(Tk,0,226,255)),tN]),Jp(t)),f(Bk,F([aN(17),wA(Fk),jN]),Jp("We only collect this fee when trades resolve successfully."))]))},b_=function(e){return{$:"FiatAmountChanged",a:e}},C_=function(e){return{$:"FiatTypeChanged",a:e}},S_=r(function(e,t){return l(wE,n(function(t,r,n){return f(e,t,r)?l(Bh,t,r,n):n}),Ch,t)}),E_=function(e){return f(S_,r(function(t,r){return f(gg,e,t)}),VR)},T_=MR({description:"",src:"/DAIHard/static/img/qmark-circle.svg"}),w_=function(e){return f(WR,F([ET(xk(26))]),f(ec,T_,f(jf,ko,f(Sh,e,VR))))},I_=function(e){return O$(f(Bx,"click",_o(L(e,!0))))},A_=i_,B_=function(e){return{$:"AppendProperty",a:e}},k_=r(function(e,t){return B_(e+":"+t)}),N_=r(function(e,t){return f(k_,e,t.value)}),R_=N_("cursor"),$_={$:"Compatible"},x_={cursor:$_,value:"default"},__=r(function(e,t){return{$:"ExtendSelector",a:e,b:t}}),L_=function(e){return{$:"PseudoClassSelector",a:e}},P_=function(e){return __(L_(e))}("hover"),D_=n(function(e,t,r){return{$:"Node",a:e,b:t,c:r}}),U_=D_,O_=U_,M_=O_("span"),F_=r(function(e,t){return f(jn,at(e),ot(t))}),V_=n(function(e,t,r){return{$:"Attribute",a:e,b:t,c:r}}),K_=a(function(e,t,r,n){return{charsProcessed:n,hash:r,seed:t,shift:e}}),H_=r(function(e,t){return(65535&t)*e+(((t>>>16)*e&65535)<<16)}),j_=r(function(e,t){return t<>>32-e}),q_=function(e){var t=e.hash?e.seed^f(H_,461845907,f(j_,15,f(H_,3432918353,e.hash))):e.seed,r=t^e.charsProcessed,n=f(H_,2246822507,r^r>>>16),a=f(H_,3266489909,n^n>>>13);return(a^a>>>16)>>>0},G_=r(function(e,t){return f(H_,5,f(j_,13,e^f(H_,461845907,f(j_,15,f(H_,3432918353,t)))))+3864292196}),z_=r(function(e,t){var r=t.hash|(255&xi(e))<";default:return""}},tP=function(e){switch(e.$){case"ClassSelector":var t=e.a;return"."+t;case"IdSelector":var t=e.a;return"#"+t;case"PseudoClassSelector":var t=e.a;return":"+t;default:var t=e.a;return"["+t+"]"}},rP=function(e){switch(e.$){case"TypeSelectorSequence":var t=e.a.a,r=e.b;return f(qi,"",f(qa,t,f(tu,tP,r)));case"UniversalSelectorSequence":var r=e.a;return jo(r)?"*":f(qi,"",f(tu,tP,r));default:var t=e.a,r=e.b;return f(qi,"",f(qa,t,f(tu,tP,r)))}},nP=function(e){var t=e.a,r=e.b;return f(qi," ",F([eP(t),rP(r)]))},aP=function(e){var t=e.a,r=e.b,n=e.c,a=f(qa,rP(t),f(tu,nP,r)),i=f(qi,"",F([f(ec,"",f(jf,ZL,n))]));return f(As,f(qi," ",f(Zd,f(wf,Tu,Ll),a)),i)},iP=r(function(e,t){var r=t.a,n=t.b,a=t.c,i=f(qi,", ",f(tu,aP,f(qa,r,n)));return f(qi,"",F([i," {\n",e,XL(a),"\n",e,"}"]))}),oP=function(e){switch(e.$){case"StyleBlockDeclaration":var t=e.a;return f(iP,"",t);case"MediaRule":var r=e.a,n=e.b;return"@media "+f(qi,",\n",f(tu,GL,r))+" {\n"+f(qi,"\n\n",f(tu,f(wf,JL,iP(" ")),n))+"\n}";case"SupportsRule":case"DocumentRule":case"PageRule":case"FontFace":return"TODO";case"Keyframes":return"@keyframes "+e.a.name+" {\n"+e.a.declaration+"\n}";case"Viewport":case"CounterStyle":default:return"TODO"}},uP=function(e){var t=e.charset,r=e.imports,n=e.namespaces,a=e.declarations;return f(qi,"\n\n",f(Zd,f(wf,Tu,Ll),F([HL(t),f(qi,"\n",f(tu,YL,r)),f(qi,"\n",f(tu,WL,n)),f(qi,"\n\n",f(tu,oP,a))])))},sP=function(e){return uP(KL(ML(e)))},cP=function(e){return f(qi,"\n\n",f(tu,sP,e))},fP=function(e){return{$:"Snippet",a:e}},lP=n(function(e,t,r){return{$:"StyleBlock",a:e,b:t,c:r}}),dP=function(e){return{$:"StyleBlockDeclaration",a:e}},hP=r(function(e,t){var r=l(dL,t,mr,ma);return fP(F([dP(l(lP,r,mr,e))]))}),pP=function(e){return jo(e)?"unstyled":f(qu,D("_"),ts(f(Y_,15739,cP($E(W_($E(f(hP,e,wL(mr)))))))))},gP=function(e){var t=pP(e),r=f(F_,"className",Gd(t));return l(V_,r,e,t)},vP=a(function(e,t,r,n){return f(e,f(qa,gP(t),r),n)}),yP=function(e){return{$:"Unstyled",a:e}},mP=function(e){return yP(kw(e))},bP=mP,CP=r(function(e,t){return f(Mn,e,rt(t))}),SP=function(e){return Un(rt(e))},EP=r(function(e,t){var r=e.b,n=e.c;return jo(r)?t:l(Bh,n,r,t)}),TP=function(e){return e.a},wP=r(function(e,t){var r=e.a,n=e.b,a=t.a,i=t.b;switch(n.$){case"Unstyled":var o=n.a;return L(f(qa,L(r,o),a),i);case"Node":var u=n.a,s=n.b,c=n.c,h=l(za,EP,i,s),p=l(za,IP,L(mr,h),c),g=p.a,v=p.b,o=l(tw,u,f(tu,TP,s),Ya(g));return L(f(qa,L(r,o),a),v);case"NodeNS":var y=n.a,u=n.b,s=n.c,c=n.d,h=l(za,EP,i,s),m=l(za,IP,L(mr,h),c),g=m.a,v=m.b,o=d(SP,y,u,f(tu,TP,s),Ya(g));return L(f(qa,L(r,o),a),v);case"KeyedNode":var u=n.a,s=n.b,c=n.c,h=l(za,EP,i,s),b=l(za,wP,L(mr,h),c),g=b.a,v=b.b,o=l(ew,u,f(tu,TP,s),Ya(g));return L(f(qa,L(r,o),a),v);default:var y=n.a,u=n.b,s=n.c,c=n.d,h=l(za,EP,i,s),C=l(za,wP,L(mr,h),c),g=C.a,v=C.b,o=d(CP,y,u,f(tu,TP,s),Ya(g));return L(f(qa,L(r,o),a),v)}}),IP=r(function(e,t){var r=t.a,n=t.b;switch(e.$){case"Unstyled":var a=e.a;return L(f(qa,a,r),n);case"Node":var i=e.a,o=e.b,u=e.c,s=l(za,EP,n,o),c=l(za,IP,L(mr,s),u),h=c.a,p=c.b,a=l(tw,i,f(tu,TP,o),Ya(h));return L(f(qa,a,r),p);case"NodeNS":var g=e.a,i=e.b,o=e.c,u=e.d,s=l(za,EP,n,o),v=l(za,IP,L(mr,s),u),h=v.a,p=v.b,a=d(SP,g,i,f(tu,TP,o),Ya(h));return L(f(qa,a,r),p);case"KeyedNode":var i=e.a,o=e.b,u=e.c,s=l(za,EP,n,o),y=l(za,wP,L(mr,s),u),h=y.a,p=y.b,a=l(ew,i,f(tu,TP,o),Ya(h));return L(f(qa,a,r),p);default:var g=e.a,i=e.b,o=e.c,u=e.d,s=l(za,EP,n,o),m=l(za,wP,L(mr,s),u),h=m.a,p=m.b,a=d(CP,g,i,f(tu,TP,o),Ya(h));return L(f(qa,a,r),p)}}),AP=r(function(e,t){return h(Th,Eh,e,t,bh,bh)}),BP=r(function(e,t){for(;;){if(!t.b)return e;var r=t.a,n=r.b,a=r.c,i=t.b;if(Ll(a)){var o=e,u=i;e=o,t=u}else{var o=ya(L(a,n)),u=i;e=o,t=u}}}),kP=function(e){var t=f(BP,ma,e);if("Nothing"===t.$)return Ch;var r=t.a,n=r.a,a=r.b;return f(AP,n,a)},NP=function(e){return{$:"ClassSelector",a:e}},RP=function(e){var t=e.a,r=e.b;return f(hP,r,wL(F([NP(t)])))},$P=function(e){return cP($E(W_(f(tu,RP,Ka(e)))))},xP=function(e){return l(tw,"style",mr,$E(kw($P(e))))},_P=n(function(e,t,r){var n=f(tu,TP,t),a=kP(t),i=l(za,IP,L(mr,a),r),o=i.a,u=i.b,s=xP(u);return l(tw,e,n,f(qa,s,Ya(o)))}),LP=r(function(e,t){for(;;){if(!t.b)return!1;var r=t.a,n=r.a,a=t.b;if($(e,n))return!0;var i=e,o=a;e=i,t=o}}),PP=r(function(e,t){e:for(;;){if(t.b){var r=t.a,n=r.a,a=t.b,i="_"+n;if(f(LP,i,a)){var o=i,u=a;e=o,t=u;continue e}return i}return e}}),DP=r(function(e,t){return L(f(PP,"_",t),xP(e))}),UP=n(function(e,t,r){var n=f(tu,TP,t),a=kP(t),i=l(za,wP,L(mr,a),r),o=i.a,u=i.b,s=f(DP,u,o);return l(ew,e,n,f(qa,s,Ya(o)))}),OP=a(function(e,t,r,n){var a=f(tu,TP,r),i=kP(r),o=l(za,wP,L(mr,i),n),u=o.a,s=o.b,c=f(DP,s,u);return d(CP,e,t,a,f(qa,c,Ya(u)))}),MP=a(function(e,t,r,n){var a=f(tu,TP,r),i=kP(r),o=l(za,IP,L(mr,i),n),u=o.a,s=o.b,c=xP(s);return d(SP,e,t,a,f(qa,c,Ya(u)))}),FP=function(e){switch(e.$){case"Unstyled":return e.a;case"Node":var t=e.a,r=e.b,n=e.c;return l(_P,t,r,n);case"NodeNS":var a=e.a,t=e.b,r=e.c,n=e.d;return d(MP,a,t,r,n);case"KeyedNode":var t=e.a,r=e.b,n=e.c;return l(UP,t,r,n);default:var a=e.a,t=e.b,r=e.c,n=e.d;return d(OP,a,t,r,n)}},VP=FP,KP=function(e){return A_(VP(d(vP,M_,F([P_(F([R_(x_)]))]),mr,F([bP(e)]))))},HP=Q,jP=i(function(e,t,r,n,a){return{$:"Padding",a:e,b:t,c:r,d:n,e:a}}),qP=n(function(e,t,r){return{$:"Spaced",a:e,b:t,c:r}}),GP=function(e){return l(Ja,r(function(e,t){var r=t.a,n=t.b;return L(function(){if("Just"===r.$){r.a;return r}if("StyleClass"===e.$&&"PaddingStyle"===e.b.$){var t=e.b,n=t.a,a=t.b,i=t.c,o=t.d,u=t.e;return ya(h(jP,n,a,i,o,u))}return ma}(),function(){if("Just"===n.$){var t=n.a;return n}if("StyleClass"===e.$&&"SpacingStyle"===e.b.$){var r=e.b,a=r.a,t=r.b,i=r.c;return ya(l(qP,a,t,i))}return ma}())}),L(ma,ma),e)},zP=r(function(e,t){var r=GP(e),n=r.a,a=r.b;if("Nothing"===a.$)return d(gA,kN,Ak,f(qa,vA(PT.contentLeft+" "+PT.contentCenterY+" "+PT.wrapped),f(qa,AT(wT),f(qa,ET(wT),e))),NT(t));var i=a.a,o=i.a,u=i.b,s=i.c,c=function(){if("Just"===n.$){var e=n.a,t=(e.a,e.b),r=e.c,a=e.d,i=e.e;return _(r,u/2|0)>-1&&_(a,s/2|0)>-1?ya(C$({bottom:a-(s/2|0),left:i-(u/2|0),right:r-(u/2|0),top:t-(s/2|0)})):ma}return ma}();if("Just"===c.$){var h=c.a;return d(gA,kN,Ak,f(qa,vA(PT.contentLeft+" "+PT.contentCenterY+" "+PT.wrapped),f(qa,AT(wT),f(qa,ET(wT),O(e,F([h]))))),NT(t))}var p=-s/2,g=-u/2;return d(gA,$T,Ak,e,NT(F([d(gA,kN,Ak,f(qa,vA(PT.contentLeft+" "+PT.contentCenterY+" "+PT.wrapped),f(qa,BT(f(U$,"margin",Tw(p)+"px "+Tw(g)+"px")),f(qa,BT(f(U$,"width","calc(100% + "+ji(u)+"px)")),f(qa,BT(f(U$,"height","calc(100% + "+ji(s)+"px)")),f(qa,f(EA,fN,l(lN,o,u,s)),mr))))),NT(t))])))}),YP=a(function(e,t,r,n){var a=f(u_,F([AT(xk(80)),ET(xk(40)),aN(24),jN,f$(AR),I_(r)]),{label:Tx("currency type"),onChange:f($a,HP,n),placeholder:ma,text:t}),i=f(Sh,t,VR),o=function(){var r=L(e,i);if(r.a){if("Just"===r.b.$)return Rk;r.b;return f(zP,F([AT(xk(350)),f$(IR),d$(1),Lk(Fk),KN(10),cN]),f(tu,function(e){var t=e.a,r=e.b,a=r.b;return f(NN,F([AT(xk(80)),hN(9),f(Hk,0,5),I_(n(t)),aR(F([Lk(l(bA,.8,.8,1))]))]),F([f(WR,F([ET(xk(26))]),a),f(Bk,F([aN(16),tN]),KP(t))]))},Ka(E_(t))))}return Rk}();return f(NN,F([hN(4),f_(o)]),F([w_(t),a]))}),WP=i(function(e,t,r,n,a){var i=Jp(KR(e)),o=f(Bk,F([f_(f(z$,F([yx,l_(5)]),a))]),d(YP,r,e,$$(!0),C_));return p(s_,F([AT(xk(250)),jN,aN(24),f_(f(z$,F([yx,l_(5)]),n))]),L(ya(i),ya(o)),"fiat input",ma,t,b_)}),JP=function(e){return g_(f(v_,"For fiat",h(WP,e.inputs.fiatType,e.inputs.fiatAmount,e.showFiatTypeDropdown,e.errors.fiatAmount,e.errors.fiatType)))},QP=function(e){return{$:"ChangeRole",a:e}},XP=r(function(e,t){var r=F([aN(24),jN,Gk]),n=function(){return"Buyer"===t.$?L(r,O(r,F([wA(B$)]))):L(O(r,F([wA(B$)])),r)}(),a=n.a,i=n.b;return f(NN,F([hN(20)]),F([f(Bk,O(F([Zk(QP(Of))]),i),Jp("Sell "+Qf(e))),f(Bk,O(F([Zk(QP(ry))]),a),Jp("Buy "+Qf(e)))]))}),ZP=function(e){return f(v_,"Trade Type",f(XP,e.web3Context.factoryType,e.inputs.userRole))},eD=aw(19),tD=function(e){return Sl(F([e.inset?"box-inset":"box-",Tw(e.offset.a)+"px",Tw(e.offset.b)+"px",Tw(e.blur)+"px",Tw(e.size)+"px",TA(e.color)]))},rD=function(e){var t={blur:e.blur,color:e.color,inset:!1,offset:e.offset,size:e.size};return f(EA,eD,l(WI,tD(t),"box-shadow",Iw(t)))},nD=rD({blur:20,color:d(iR,0,0,0,.04),offset:L(0,3),size:0}),aD=f(qk,fN,PT.spaceEvenly),iD=function(e){return f(AN,F([AT(Nk),hN(20),Lk(Fk),Yk(5),KN(20),nD]),F([f(NN,F([AT(Nk),aD]),F([ZP(e),y_(e),JP(e)])),m_(e)]))},oD=function(e){return{$:"CreateClicked",a:e}},uD={$:"Web3Connect"},sD=function(e){return f(Bk,F([cN]),function(){if("Just"===e.$){var t=e.a;return f(ix,"Open Trade",oD(t))}return f(ix,"Connect to Wallet",uD)}())},cD=function(e){return{$:"AutoabortIntervalChanged",a:e}},fD=function(e){return{$:"ChangePaymentMethodText",a:e}},lD=r(function(e,t){return{$:"Placeholder",a:e,b:t}}),dD=lD,hD=function(e){return f(dD,F([wA(d(JR,0,0,0,.2))]),function(){return Jp("Seller"===e.$?"Some examples:\n\nI can accept transfers to a Schwab bank account (routing 121202211)\nI can meet in person to accept cash in London, weekdays after 6, with a day of notice.\nHide the cash in Hume Park, Bulawayo, and tell me the location over chat.":"Some examples:\n\nI can deliver cash anywhere within an hour drive of Phoneix, AZ, with 2 days of notice.\nTransferWise\nInterac e-Transfer\n")}())},pD={$:"TextArea"},gD=r(function(e,t){return l(o_,{autofill:ma,spellchecked:t.spellcheck,type_:pD},e,{label:t.label,onChange:t.onChange,placeholder:t.placeholder,text:t.text})}),vD=n(function(e,t,r){var n=f(Bk,F([aN(22),tN]),Jp("Payment Method")),a=f(gD,F([AT(Nk),ET(xk(150)),Lk(d(iR,155,203,255,.2)),d$(0)]),{label:Tx("payment method"),onChange:fD,placeholder:""===r?ya(hD(t)):ma,spellcheck:!0,text:r});return f(AN,F([hN(20),C$({bottom:15,left:45,right:45,top:0}),AT(Nk),W$(f(z$,F([yx,l_(30),KN(10),aN(20),AT(xk(400))]),e))]),F([n,a]))}),yD=function(e){return"Buyer"===e.$?"After committing, you and the Seller have this long to complete the fiat payment, using one of your payment methods indicated below. If you fail to confirm payment within this window, 1/4 of your deposit is burned from both parties and the rest is refunded.":"After committing, you and the Buyer have this long to complete the fiat payment, using one of your payment methods indicated below. If the Buyer aborts or fails to confirm within this window, 1/12 of the trade amount is burned from both parties and the rest is refunded."},mD=a(function(e,t,r,n){var a=l(Ju,e,D("0"),ji(n));return f(Bk,F([aN(22),wA(t)]),Jp(O(a,r)))}),bD=function(e){return Gl(e)<0?Ff(0):e},CD=MR({description:"down",src:"/DAIHard/static/img/arrow-down.svg"}),SD=MR({description:"up",src:"/DAIHard/static/img/arrow-up.svg"}),ED=n(function(e,t,n){var a=r(function(e,r){return f(AN,F([hN(4)]),F([f(Bk,F([KN(4),Gk,Zk(n(f(Tb,t,e)))]),f(WR,F([ET(xk(10))]),SD)),r,f(Bk,F([KN(4),Gk,Zk(n(function(e){return Gl(e)?e:Ff(3e5)}(bD(f(ER,t,e)))))]),f(WR,F([ET(xk(10))]),CD))]))}),i=_R(t);return f(NN,F([aD,hN(10)]),F([f(a,Ff(864e5),d(mD,3,e," days",i.days)),f(a,Ff(36e5),d(mD,2,e," hours",i.hours)),f(a,Ff(3e5),d(mD,2,e," min",i.min))]))}),TD=o(function(e,t,r,n,a,i){var o=f(Bk,F([Lk(d(iR,155,203,255,.2)),Yk(5),KN(15),W$(f(z$,F([yx]),a))]),l(ED,IR,n,i)),u=f(NN,F([hN(30)]),F([f(WR,F([ET(xk(40))]),e),f(Bk,F([aN(22),tN]),Jp(t))])),s=f(vN,F([aN(17),jN,wA(ex)]),F([Jp(r)]));return f(AN,F([AT(Nk),Yk(10),Lk(l(Tk,237,237,237)),hN(2)]),f(tu,Bk(F([Lk(Fk),f(Hk,45,18),AT(Nk)])),F([u,f(NN,F([AT(Nk),hN(25),Lk(Fk)]),F([o,s]))])))}),wD=MR({description:"fiat",src:"/DAIHard/static/img/fiat-bag-white.svg"}),ID=f(qk,MN,PT.clipX),AD=f(qk,MN,PT.clipY),BD=i(function(e,t,r,n,a){return f(AN,F([hN(15),Yk(8),ID,AD,Lk(Fk)]),F([p(TD,wD,"Payment Window",yD(a),r,n,cD),l(vD,t,a,e)]))}),kD=function(e){return{$:"AutoreleaseIntervalChanged",a:e}},ND=function(e){return"Buyer"===e.$?"Once you confirm payment, the Seller has this time window to decide whether to release the funds to you or burn everything. If he doesn't decide before the time is up, funds are released to you by default.":"Once the Buyer confirms payment, you have this long to decide whether to release the funds to the Buyer or, in the case of an attempted scam, burn everything. If you don't decide before the time is up, funds are released to the Buyer by default."},RD=MR({description:"",src:"/DAIHard/static/img/release-window-icon.svg"}),$D=n(function(e,t,r){return f(Bk,F([Yk(8),ID,AD,Lk(Fk)]),p(TD,RD,"Burn/Release Window",ND(r),e,t,kD))}),xD=function(e){return{$:"AutorecallIntervalChanged",a:e}},_D=function(e){var t=function(){return"Buyer"===e.$?"Seller":"Buyer"}();return"The offer will expire by this time window if a "+t+" does not commit to the trade, returning the balance and the 1% fee to your wallet. This can also be manually triggered anytime before a "+t+" commits."},LD=MR({description:"",src:"/DAIHard/static/img/open-window-icon.svg"}),PD=n(function(e,t,r){return f(Bk,F([Yk(8),Lk(Fk),ID,AD]),p(TD,LD,"Open Window",_D(r),e,t,xD))}),DD=function(e){return f(AN,F([AT(Nk),hN(20)]),F([l(PD,e.inputs.autorecallInterval,e.errors.autorecallInterval,e.inputs.userRole),h(BD,e.inputs.paymentMethod,e.errors.paymentMethod,e.inputs.autoabortInterval,e.errors.autoabortInterval,e.inputs.userRole),l($D,e.inputs.autoreleaseInterval,e.errors.autoreleaseInterval,e.inputs.userRole)]))},UD=function(e){return f(AN,F([AT(f(q$,1e3,Nk)),cN,hN(20),C$({bottom:30,left:40,right:40,top:0}),Zk($$(!1)),H$(px(e))]),F([iD(e),DD(e),sD(e.userInfo)]))},OD=Gu(Km(8226)),MD=r(function(e,t){if(t.b){var n=t.a,a=t.b,i=r(function(t,r){return f(qa,e,f(qa,t,r))}),o=l(Ja,i,mr,a);return f(qa,n,o)}return mr}),FD=r(function(e,t){return l(za,qa,t,e)}),VD=n(function(e,t,r){for(;;){if(!(t>0))return e;var n=f(FD,r,e),a=t-1,i=r;e=n,t=a,r=i}}),KD=r(function(e,t){var r=Oi(t);return!r||$(r,e)?t:_(r,e)<0?Ya(f(FD,f($s,e%r,t),l(VD,mr,e/r|0,t))):f($s,e,t)}),HD=a(function(e,t,r,n){for(;;){if(!r.b)return Ya(n);var a=r.a,i=r.b,o=e(a);if(f(gw,o,t)){var u=e,s=t,c=i,l=n;e=u,t=s,r=c,n=l}else{var u=e,s=f(kE,o,t),c=i,l=f(qa,a,n);e=u,t=s,r=c,n=l}}}),jD=function(e){return d(HD,to,mm,e,mr)},qD=r(function(e,t){return f(Bk,F([AT(Nk),H$(f(NN,F([hN(3),AT(VN(100)),AT(t),FN]),f(MD,f(Bk,F([wA(d(JR,0,0,0,.1)),aN(14)]),Jp(OD)),f(tu,f(wf,Bk(F([wA(d(JR,0,0,0,.2))])),Jp),f(KD,100,(e?Ya:to)(jD(f(tu,f($a,ko,hi),Ka(VR)))))))))]),Jp(" "))}),GD=r(function(e,t){var r=t.url,n=t.label;return d(gA,$T,kT("a"),f(qa,BT(mT(r)),f(qa,BT(bT("noopener noreferrer")),f(qa,AT(wT),f(qa,ET(wT),f(qa,vA(PT.contentCenterX+" "+PT.contentCenterY),e))))),NT(F([n])))}),zD=function(){var e=f(wf,Bk(F([wA(oN)])),Jp),t=f(wf,Bk(F([yN])),Jp);return f(AN,F([AT(Nk),ET(Nk),Lk(Fk),Yk(6),hN(50),rD({blur:20,color:d(iR,0,0,0,.1),offset:L(0,3),size:0}),Yk(10),KN(20)]),F([f(qD,!1,Nk),f(AN,F([cN,AT(f(q$,700,Nk)),hN(20)]),F([f(vN,F([aN(70),yN,cN,ux]),F([Jp("DAI"),e("Hard")])),f(NN,F([aN(30),tN,cN,ux,CN]),F([Jp("The "),e("Global"),Jp(", "),e("Unkillable"),Jp(" Crypto Gateway")]))])),f(NN,F([Lk(g$),hN(2),cN,V$,AT(Nk)]),F([f(Bk,F([f(Hk,40,10),Lk(Fk),AT(Nk),ET(Nk)]),f(AN,F([hN(60),TN]),F([f(Bk,F([aN(40),tN,cN]),Jp("Want to learn more?")),f(GD,F([Yk(4),Gk,f(Hk,25,17),Lk(T$),wA(Fk),yN,aN(24),cN]),{label:f(vN,F([ux]),F([Jp("Go to the DAIHard Info page")])),url:"http://daihard.io"})]))),f(Bk,F([f(Hk,40,10),Lk(Fk),AT(Nk),ET(Nk)]),f(AN,F([Sx,hN(60)]),F([f(Bk,F([aN(40),tN,cN]),Jp("Ready to try it out?")),f(vN,F([aN(24),cN,AT(xk(400))]),F([Jp("Follow the links at the top of this page to browse "),t("Sell Offers"),Jp(", browse "),t("Buy Offers"),Jp(", or "),t("Create Your Own Offer"),Jp(".")]))])))])),f(Bk,F([lx]),f(qD,!0,Nk))]))}(),YD=function(e){return{$:"ShowCurrencyDropdown",a:e}},WD=n(function(e,t,r){return f($a,Zd(t(e)),LN(r))}),JD={$:"AutoabortWindow"},QD={$:"AutoreleaseWindow"},XD={$:"Expiring"},ZD={$:"Fiat"},eU={$:"Margin"},tU={$:"TradeAmount"},rU=function(e){var t=e.a,r=e.b;return f(Bk,F([AT(VN(t)),ET(xk(60)),FN,Lk(Fk)]),f(Bk,F([KN(12),ON,AT(Nk)]),r))},nU={$:"Descending"},aU=r(function(e,t){return{$:"SortBy",a:e,b:t}}),iU=function(e){return f(Bk,F([jN,aN(17)]),Jp(e))},oU=n(function(e,t,r){return f(NN,F([hN(8)]),F([iU(e),f(AN,F([hN(2)]),F([f(Bk,F([KN(4),Gk,Zk(f(aU,t,sv))]),f(WR,F([AT(xk(8)),cN,ON]),SD)),f(Bk,F([KN(4),Gk,Zk(f(aU,t,nU))]),f(WR,F([AT(xk(8)),cN,ON]),CD))]))]))}),uU=r(function(e,t){var r=function(){return"Buyer"===e.$?oN:RR}(),n=_(Gl(t.parameters.autoabortInterval),216e5)<0?r:IR;return d(LR,mr,mr,L(n,AR),t.parameters.autoabortInterval)}),sU=r(function(e,t){var r=function(){return"Buyer"===e.$?RR:oN}(),n=_(Gl(t.parameters.autoabortInterval),216e5)<0?r:IR;return d(LR,mr,mr,L(n,AR),t.parameters.autoreleaseInterval)}),cU=r(function(e,t){var r=f(TR,e,t);if("TimeLeft"===r.$){var n=r.a,a=f(DR,n.a,n.b)<.05?oN:IR;return d(UR,F([AT(Nk)]),F([aN(16)]),L(a,AR),n)}var i=r.a;return d(UR,F([AT(Nk)]),F([aN(16)]),L(oN,AR),L(Ff(0),i))}),fU=function(e){return QR(e.terms.price)},lU=function(e){var t=fu(100*e),r=t-gi(t),n=ji(gi(t)),a=f(vi,0,3-go(n));return n+(function(){if(a){return f(Co,a+1,f(yo,1,Tw(r)))}return""}()+"%")},dU=r(function(e,t){return MR({description:"",src:function(){var r=L(e,t);if(r.a){if("Just"===r.b.$)return r.b.a?"/DAIHard/static/img/margin-up-green.svg":"/DAIHard/static/img/margin-up-red.svg";r.b;return"/DAIHard/static/img/margin-up.svg"}if("Just"===r.b.$)return r.b.a?"/DAIHard/static/img/margin-down-green.svg":"/DAIHard/static/img/margin-down-red.svg";r.b;return"/DAIHard/static/img/margin-down.svg"}()})}),hU=n(function(e,t,r){return f(WR,f(qa,ET(xk(34)),e),f(dU,t,r))}),pU=r(function(e,t){var r=lU(t);if("0%"===r)return f(Bk,F([aN(16)]),Jp("0%"));var n=r,a=t>=0,i=!(a!==e),o=i?RR:oN;return f(NN,F([hN(4)]),F([l(hU,mr,a,ya(i)),f(Bk,F([wA(o),aN(16)]),Jp(n))]))}),gU=r(function(e,t){return f(ec,Rk,f(jf,pU(t),e.derived.margin))}),vU=function(e){return f(ec,Rk,f(jf,ZR,Xf(e)))},yU=function(e){return a$(e.parameters.tradeAmount)},mU=function(e){return{$:"TradeClicked",a:e}},bU=function(e){return f(yR,F([Lk(d(iR,16,7,234,.2)),KN(11),Yk(4),AT(Nk),aR(F([Lk(d(iR,16,7,234,.4))]))]),{label:f(Bk,F([cN,wA(l(Tk,16,7,234)),jN]),Jp("View Offer")),onPress:ya(mU(e))})},CU=n(function(e,t,r){return f(NN,F([AT(Nk),hN(1),Lk(AR)]),F([f(AN,F([AT(Nk),hN(1),AT(VN(7))]),F([f(NN,F([AT(VN(6)),hN(1)]),f(tu,rU,F([L(2,f(cU,e,r)),L(1,yU(r)),L(2,fU(r)),L(1,f(gU,r,!$(t,ry))),L(2,f(uU,t,r)),L(2,f(sU,t,r))]))),rU(L(1,vU(r.terms.paymentMethods)))])),f(Bk,F([AT(VN(1)),ET(Nk),FN,Lk(Fk)]),f(Bk,F([cN,ON]),bU(r.id)))]))}),SU=n(function(e,t,r){var n=function(){return"Buyer"===r.browsingRole.$?"Selling":"Buying"}();return f(AN,F([AT(Nk),ET(Nk),KN(30),hN(5)]),F([f(NN,F([AT(Nk)]),F([f(NN,F([AT(VN(7))]),F([rU(L(2,l(oU,"Expires",XD,ma))),rU(L(1,l(oU,n,tU,ma))),rU(L(2,l(oU,"For Fiat",ZD,ma))),rU(L(1,l(oU,"Margin",eU,ma))),rU(L(2,l(oU,"Payment Window",JD,ma))),rU(L(2,l(oU,"Auto-Release",QD,ma)))])),f(Bk,F([AT(VN(1))]),Rk)])),f(AN,F([AT(Nk),d$(2),Yk(8),f$(g$),hN(1),Lk(g$),FN]),f(tu,f(CU,e,r.browsingRole),t))]))}),EU=n(function(e,t,r){var n=d(WD,e,r.filterFunc,r.sortFunc,v$(t)),a=function(e){return f(Bk,F([aN(24),tN,wA(g$),cN,KN(20)]),Jp(e))},i=L(t.dataFetchStatus.total,n);if("Nothing"===i.a.$){i.a;return a("Querying Factory contract...")}if(i.a.a){if(i.b.b){var o=i.a.a;return l(SU,e,n,r)}var o=i.a.a;return a(_(t.dataFetchStatus.loaded,o-t.dataFetchStatus.invalid)<0?"Searching trades for Open offers...":"No open offers found.")}return a("No trades found.")}),TU={$:"ApplyInputs"},wU=f(yR,F([Lk(T$),KN(10),Yk(5)]),{label:f(Bk,F([wA(Fk),cN,ON]),Jp("Apply")),onPress:ya(TU)}),IU=function(e){var t=e.topLeft,r=e.topRight,n=e.bottomLeft,a=e.bottomRight;return f(EA,zk,l(WI,"br-"+ji(t)+"-"+ji(r)+ji(n)+"-"+ji(a),"border-radius",ji(t)+"px "+ji(r)+"px "+ji(a)+"px "+ji(n)+"px"))},AU=function(e){return f(Qk,"focus",_o(e))},BU=f(wf,BT,AU),kU=s(function(e,t,r,n,a,i,o,u){var s=function(){if("Nothing"===o.$)return mr;var e=o.a;return F([BU(e(!0)),I_(e(!0))])}();return f(NN,O(e,F([ET(xk(40)),rD({blur:20,color:d(iR,233,237,242,.05),offset:L(0,3),size:0})])),F([f(Bk,F([Lk(AR),ET(xk(40)),IU({bottomLeft:4,bottomRight:0,topLeft:4,topRight:0})]),f(Bk,F([ON,f(Hk,10,0)]),r)),f(u_,O(s,O(t,F([AT(xk(100)),ET(xk(40)),f$(AR),IU({bottomLeft:0,bottomRight:4,topLeft:0,topRight:4}),p_({bottom:1,left:0,right:1,top:1})]))),{label:Tx(n),onChange:u,placeholder:i,text:a})]))}),NU=function(e){return{$:"MaxDaiChanged",a:e}},RU=function(e){return{$:"MinDaiChanged",a:e}},$U=r(function(e,t){return f(AN,F([AT(Nk),hN(8)]),F([f(Bk,F([aN(17),jN]),Jp(e)),t]))}),xU=aw(25),_U=function(e){return{$:"MoveX",a:e}},LU=function(e){return f(ZN,xU,_U(-e))},PU={$:"OnLeft"},DU=function(e){return f(QN,PU,e)},UU=a(function(e,t,r,n){var a=r$(F([ON])),i=f(NN,F([hN(8),ON,AT(xk(60))]),F([a,f(Bk,F([aN(16),ON]),Jp("max"))])),o=f(NN,F([hN(8),ON,AT(xk(60))]),F([a,f(Bk,F([aN(16),ON]),Jp("min"))]));return f($U,Qf(e)+" Range",f(AN,F([hN(5),AT(xk(200))]),F([v(kU,F([DU(f(z$,F([LU(5),AT(xk(200))]),n.minDai))]),F([BU(YD(!1))]),o,"min "+Qf(e),t,ma,ma,RU),v(kU,F([DU(f(z$,F([LU(5),AT(xk(200))]),n.maxDai))]),F([BU(YD(!1))]),i,"max "+Qf(e),r,ma,ma,NU)])))}),OU=function(e){var t=f(Sh,e,VR);if("Nothing"===t.$)return Jp("*");var r=t.a,n=r.b;return f(WR,F([ET(xk(26))]),n)},MU=function(e){return{$:"FiatTypeInputChanged",a:e}},FU=function(e){return{$:"MaxFiatChanged",a:e}},VU=function(e){return{$:"MinFiatChanged",a:e}},KU=i(function(e,t,r,n,a){var i=OU(t),o=f(NN,F([hN(8),ON,AT(xk(60))]),F([i,f(Bk,F([aN(16),ON]),Jp("max"))])),u=f(NN,F([hN(8),ON,AT(xk(60))]),F([i,f(Bk,F([aN(16),ON]),Jp("min"))]));return f($U,"Fiat Type",f(NN,F([hN(5),AT(wT)]),F([f(Bk,F([V$,AT(xk(120))]),d(YP,e,t,YD(!0),MU)),f(AN,F([hN(5),V$,AT(xk(200))]),F([v(kU,F([W$(f(z$,F([X$(5),AT(f(q$,200,wT))]),a.minFiat))]),F([BU(YD(!1))]),u,"min",r,ma,ma,VU),v(kU,F([f_(f(z$,F([l_(5),AT(f(q$,200,wT))]),a.maxFiat))]),F([BU(YD(!1))]),o,"max",n,ma,ma,FU)]))])))}),HU={$:"AddSearchTerm"},jU=function(e){return{$:"PaymentMethodInputChanged",a:e}},qU=f(Od,"keyCode",ZC),GU=function(e){return f(Qk,"keyup",f(Ro,function(t){return 13===t?_o(e):$o(ji(t))},qU))},zU=function(e){return f($U,"Search Payment Methods",f(u_,F([V$,AT(xk(250)),ET(xk(40)),f$(AR),rD({blur:20,color:d(iR,233,237,242,.05),offset:L(0,3),size:0}),O$(GU(HU))]),{label:Tx("payment methods search"),onChange:jU,placeholder:ma,text:e}))},YU={$:"ResetSearch"},WU=f(yR,F([Lk(T$),KN(10),Yk(5)]),{label:f(Bk,F([wA(Fk),cN,ON]),Jp("Reset")),onPress:ya(YU)}),JU=function(e){return{$:"RemoveTerm",a:e}},QU=function(e){return f(Bk,F([KN(3),V$,Gk,Zk(JU(e)),aN(10),wA(oN)]),Jp("x"))},XU=function(e){if(e.b){var t=e;return f(NN,F([AT(Nk),KN(10),hN(10)]),f(tu,function(e){return f(NN,F([Lk(d(iR,16,7,234,.2)),Yk(5),KN(4),hN(3)]),F([Jp(e),QU(e)]))},t))}return Rk},ZU=a(function(e,t,r,n){return f(AN,F([hN(10),AT(wT),cN]),F([f(NN,F([AT(wT),hN(10)]),F([f(Bk,F([AT(wT),V$]),d(UU,e,t.minDai,t.maxDai,r)),f(Bk,F([AT(wT),V$]),h(KU,n,t.fiatType,t.minFiat,t.maxFiat,r)),f(AN,F([AT(wT),V$,hN(5)]),F([zU(t.paymentMethod),XU(t.paymentMethodTerms)])),f($U," ",f(AN,F([hN(5),AT(wT)]),F([wU,WU])))]))]))}),eO=n(function(e,t,r){return f(AN,F([Yk(5),Lk(Fk),AT(Nk),ET(Nk),Zk(YD(!1))]),F([f(NN,F([AT(Nk),hN(10),KN(30)]),F([d(ZU,r.web3Context.factoryType,r.inputs,r.errors,r.showCurrencyDropdown)])),l(EU,e,t,r)]))}),tO=f($a,lu,km("USD")),rO=a(function(e,t,r,n){return{daiAmountIn:t,fiatValue:r,initiatorRole:e,intervals:n}}),nO=function(e){return Fv(f(Ru,f(gl,lu(10),lu(18)),lu(e)))},aO=F([d(rO,Of,nO(5),tO(4),P(Ff(1728e5),Ff(1728e5),Ff(2592e5))),d(rO,ry,nO(2),tO(7),P(Ff(1728e5),Ff(1728e5),Ff(2592e5)))]),iO=function(e){return f(Gf,Uv(e),3)},oO=PR,uO=r(function(e,t){return n$(t)+" "+Qf(e)}),sO=r(function(e,t){return f(Bk,F([wA(oO),aN(20)]),Jp(f(uO,e,t)))}),cO=RR,fO=function(e){return"$"+Tl(e.amount)+" USD"},lO=function(e){return f(Bk,F([wA(cO),aN(20)]),Jp(fO(e)))},dO=function(e){return $(e,Ff(6048e5))?Jp("1 week"):b("QuickCreate.View",{start:{line:132,column:9},end:{line:132,column:19}})("lol bet u forgot about dis. summarizeIntervalElement is a hack! A dirty hack!!")},hO=r(function(e,t){var r=function(){return"Buyer"===t.initiatorRole.$?f(sO,e,f(fd,Uv(t),iO(t))):lO(t.fiatValue)}(),n=function(){return"Buyer"===t.initiatorRole.$?f(AN,F([hN(5)]),F([f(sO,e,t.daiAmountIn),lO(t.fiatValue)])):f(sO,e,t.daiAmountIn)}(),a=dO(function(e){var t=e.a,r=e.b,n=e.c;return f(Tb,n,f(Tb,r,t))}(t.intervals)),i=Jp("---\x3e");return f(AN,F([hN(8)]),F([f(NN,F([hN(4)]),F([n,i,r])),a]))}),pO=r(function(e,t){return d(ax,P(d(JR,0,0,1,1),d(JR,0,0,1,.8),d(JR,0,0,1,.6)),Fk,e,t)}),gO=function(e){return{$:"StartClicked",a:e}},vO=function(e){return f(pO,"Start",gO(e))},yO=n(function(e,t,r){return f(NN,F([hN(40)]),F([f(hO,e,r),t?vO(r):Rk]))}),mO=r(function(e,t){return{$:"OpenClicked",a:e,b:t}}),bO=r(function(e,t){if("Just"!==e.$)return f(Z$,"Can't find userInfo...",ya("You shouldn't be seeing this. Maybe your web3 provider changed something just now?"));var r=e.a;if("Spec"!==t.$)return Rk;var n=t.a,a=t.b;switch(a.$){case"ApproveMining":a.a;return f(Z$,"Mining Prepare tx...",ma);case"ReadyToOpen":return f(ix,"Open Trade",f(mO,r,n));case"OpenNeedsSig":default:return Rk}}),CO=function(e){return{$:"TextInputChanged",a:e}},SO=function(e){return f(dD,mr,f(AN,F([hN(5)]),f(tu,f(wf,vN(mr),$E),function(){return F("Buyer"===e.$?[Jp("Some ideas:"),f(Bk,F([CN]),Jp("I can meet in NYC central park for a cash handoff after 6 pm.")),f(Bk,F([CN]),Jp("I'll send you $7 in Steam credit.")),f(Bk,F([CN]),Jp("TransferWise")),f(Bk,F([CN]),Jp("Cash drop in Hume Park, Bulawayo"))]:[Jp("Some ideas:"),f(Bk,F([CN]),Jp("I accept money orders or cashier checks into my Schwab bank account.")),f(Bk,F([CN]),Jp("Meet me at the Bangkok airport (BKK) on Saturday. I'm coming in on flight I453.")),f(Bk,F([CN]),Jp("Buy Dig Dog on Steam and gift it to me (syriven).")),f(Bk,F([CN]),Jp("Ship me a potato."))])}())))},EO=r(function(e,t){return f(gD,F([AT(Nk),ET(xk(200))]),{label:Tx("payment details"),onChange:CO,placeholder:""===t?ya(SO(e)):ma,spellcheck:!0,text:t})}),TO=r(function(e,t){return f(AN,F([hN(10)]),f(tu,vN(mr),F([function(){return F("Seller"===e.$?[Jp("How must the "),lO(t),Jp(" be paid?")]:[Jp("How can you deliver the "),lO(t),Jp("?")])}(),F([Jp("You will be able to chat with the "),Jp(function(){return"Seller"===e.$?"buyer":"seller"}()),Jp(" to coordinate further once the trade is in progress.")])])))}),wO=function(e){return{$:"ApproveClicked",a:e}},IO=function(e){return{$:"ChangeState",a:e}},AO={$:"Web3Connect"},BO=n(function(e,t,r){return f(ec,Rk,function(){e:for(;;)if("Menu"===r.$)switch(r.a.$){case"StartPrompt":var n=r.a.a;return ya(l(G$,mr,f(AN,F([hN(15),cN,KN(20)]),F([Jp("Text about approving"),function(){if("Just"===t.$){t.a;return f(pO,"Prepare "+n$(n.daiAmountIn)+" "+Qf(e)+" for deposit",wO(n))}return f(ix,"Connect to Wallet",AO)}()])),IO(Cv(Sv))));case"ApproveNeedsSig":var n=r.a.a;return ya(l(G$,mr,f(AN,F([hN(15),KN(20),cN]),F([Jp("Waiting for sig text")])),IO(Cv(Sv))));default:break e}else switch(r.b.$){case"OpenNeedsSig":var n=r.a;r.b;return ya(l(G$,mr,f(AN,F([hN(15),KN(20),cN]),F([Jp("Text about opening")])),IO(f(Lv,n,_v))));case"OpenMining":var n=r.a;r.b;return ya(l(G$,mr,f(AN,F([hN(15),KN(20),cN]),F([Jp("Opening trade. Note that if you close this modal or navigate away, the transaction could still complete."),Jp("You will be redirected when the trade is finished opening.")])),IO(Cv(Sv))));default:break e}return ma}())}),kO=function(e){return L(function(){var t=e.state;if("Menu"===t.$){t.a;return f(AN,F([hN(10),cN]),f(tu,f(yO,e.web3Context.factoryType,!0),aO))}var r=t.a;t.b;return f(AN,F([hN(20),cN]),F([l(yO,e.web3Context.factoryType,!1,r),f(AN,F([hN(10),cN]),F([f(TO,r.initiatorRole,r.fiatValue),f(EO,r.initiatorRole,e.textInput),f(bO,e.userInfo,e.state)]))]))}(),F([l(BO,e.web3Context.factoryType,e.userInfo,e.state)]))},NO=function(e){return{$:"MessageInputChanged",a:e}},RO={$:"MessageSubmit"},$O=function(e){return f(AN,F([AT(Nk),hN(10)]),F([f(gD,F([AT(Nk),ET(xk(100))]),{label:Tx("messageInput"),onChange:NO,placeholder:ma,spellcheck:!1,text:e.messageInput}),f(yR,F([cN,aN(24)]),{label:Jp("Submit"),onPress:ya(RO)})]))},xO=f(qk,MN,PT.scrollbarsY),_O=r(function(e,t){return f(Bk,F([ET(Nk),AT(Nk)]),f(Bk,O(F([O$(f(U$,"position","absolute")),O$(f(U$,"top","0")),O$(f(U$,"right","0")),O$(f(U$,"bottom","0")),O$(f(U$,"left","0")),xO]),e),t))}),LO=l(Tk,200,205,210),PO=n(function(e,t,r){var n=F([TN,Lk(T$),wA(Fk),IU({bottomLeft:15,bottomRight:0,topLeft:15,topRight:15})]),a=F([Sx,Lk(LO),wA(IR),IU({bottomLeft:0,bottomRight:15,topLeft:15,topRight:15})]),i=r.eventInfo;if("Statement"===i.$){var o=i.a,u=$(o.who,t)?n:a;return f(Bk,O(F([KN(7)]),u),f(vN,mr,F([Jp(O(function(){return"Buyer"===o.who.$?"B: ":"S: "}(),function(){var e=o.message;switch(e.$){case"FailedDecode":return"DECODE FAILED";case"Encrypted":return"(encrypted data)";case"FailedDecrypt":return"DECRYPT FAILED";default:return e.a}}()))])))}var s=i.a,c=function(){switch(s.$){case"Initiated":return ya(P(l(bA,0,0,1),Fk,"Initiator opened the trade"));case"Recalled":return ya(P(l(bA,0,0,1),Fk,"Initiator recalled the trade"));case"Committed":var t=s.a,r=f(Co,8,Xd(t))+"..";return ya(P(l(bA,1,0,1),Fk,r+" committed to the trade"));case"Aborted":return ya(P(l(bA,1,0,0),Fk,"Buyer aborted the trade"));case"Claimed":return ya(P(l(bA,0,1,0),Fk,"Buyer marked the fiat transfer complete"));case"Released":return ya(P(l(bA,0,0,1),Fk,"Seller released the "+Qf(e)+" and closed the contract"));default:return ya(P(l(bA,0,0,1),Fk,"Seller burned the "+Qf(e)+" and closed the contract"))}}();if("Nothing"===c.$)return Rk;var d=c.a,h=d.a,p=d.b,g=d.c;return f(Bk,F([Yk(3),d$(1),f$(l(bA,1,0,1)),cN,Lk(h)]),f(vN,F([wA(p)]),F([Jp(g)])))}),DO=n(function(e,t,r){if(r.b){var n=r;return f(_O,F([AT(Nk),ET(Nk),Yk(5),d$(1),f$(IR),KN(10)]),f(AN,F([AT(Nk),ET(Nk),hN(10)]),f(tu,f(PO,e,t),n)))}return f(Bk,F([AT(Nk),ET(Nk),Yk(5),d$(1),f$(IR),cN,wA(l(bA,.5,.5,.5)),CN]),Jp("no messages found."))}),UO=Sr,OO=function(e){return f(AN,F([AT(Nk),ET(Nk),hN(10),d$(1),Yk(5),KN(20)]),F([l(DO,e.web3Context.factoryType,e.userRole,f(UO,function(e){return e.blocknum},Ma(e.history))),$O(e)]))},MO=function(e){return f(Bk,F([Lk(Fk),Yk(8),nD,AT(Nk),ET(Nk)]),OO(e))},FO={$:"ToggleChat"},VO=function(e){if(e.showChatHistory){var t=f(ec,Rk,f(jf,MO,e.chatHistoryModel));return f(Bk,F([ET(Nk),AT(xk(500)),KN(20),TN]),l(G$,F([ET(Nk),AT(Nk)]),f(Lf,xS,t),FO))}return Rk},KO=function(e){return"Buyer"===e.initiatorRole.$?Of:ry},HO=function(e){return qR(e)+" "+e.fiatType},jO={$:"AbortAction"},qO=n(function(e,t,r){return{$:"ConfirmCommit",a:e,b:t,c:r}}),GO=function(e){var t=e.txChainStatus;if("Nothing"===t.$)return Rk;switch(t.a.$){case"ConfirmingCommit":var r=t.a,n=r.a,a=r.b,i=r.c,o=HO(n.terms.price),u=n$(Fv(i)),s=n$(n.parameters.tradeAmount)+" "+Qf(e.web3Context.factoryType),c=function(){return"Buyer"===KO(n.parameters).$?L(f(Bk,F([jN,wA(IR)]),Jp("buyer")),F([Jp("pay the seller "),f(Bk,F([wA(T$)]),Jp(o)),Jp(" in exchange for the "),f(Bk,F([wA(T$)]),Jp(s)),Jp(" held in this contract.")])):L(f(Bk,F([jN,wA(IR)]),Jp("seller")),F([Jp("accept "),f(Bk,F([wA(T$)]),Jp(o)),Jp(" from the buyer in exchange for the "),f(Bk,F([wA(T$)]),Jp(s)),Jp(" held in this contract.")]))}(),d=c.a,h=c.b;return l(G$,mr,f(AN,F([hN(20),KN(20),cN,ET(Nk),ux]),F([f(Bk,F([aN(26),tN,cN,ON]),Jp("Just to Confirm...")),f(AN,F([hN(20),cN,ON]),f(tu,vN(F([cN,aN(18),jN,wA(ex)])),O(F([O(F([Jp("You will deposit "),f(Bk,F([wA(T$)]),Jp(u+" "+Qf(e.web3Context.factoryType))),Jp(", thereby becoming the "),d,Jp(" of this trade. By doing so, you are agreeing to ")]),h)]),function(){return"Token"===e.web3Context.factoryType.$?F([F([Jp("(This ususally requires two Metamask signatures. Your "+Qf(e.web3Context.factoryType)+" will not be deposited until the second transaction has been mined.)")])]):mr}()))),f(Bk,F([lx,cN]),f(ix,"Yes, I definitely want to commit to this trade.",l(qO,n,a,i)))])),jO);case"ApproveNeedsSig":t.a;return sx(F([Jp("Waiting for user signature for the approve call."),Jp("(check Metamask!)"),Jp("Note that there will be a second transaction to sign after this.")]));case"ApproveMining":var p=t.a.a;return sx(F([Jp("Mining the initial approve transaction..."),f(yA,F([dx,wA(T$)]),{label:Jp("See the transaction on Etherscan"),url:f(cx,e.web3Context.factoryType,p)}),Jp("Funds will not leave your wallet until you sign the next transaction.")]));case"CommitNeedsSig":t.a;return sx(F([Jp("Waiting for user signature for the final commit call."),Jp("(check Metamask!)"),Jp("This will make the deposit and commit you to the trade.")]));case"CommitMining":var p=t.a.a;return sx(F([Jp("Mining the final commit transaction..."),f(yA,F([dx,wA(T$)]),{label:Jp("See the transaction"),url:f(cx,e.web3Context.factoryType,p)})]));case"ConfirmingAction":var g=t.a.a;return l(G$,mr,f(AN,F([hN(20),KN(20),cN,ET(Nk),ux]),F([f(Bk,F([aN(26),tN,cN,ON]),Jp("Just to Confirm...")),f(AN,F([hN(20),cN,ON]),f(tu,vN(F([cN,aN(18),jN,wA(ex)])),function(){switch(g.$){case"Poke":case"Recall":return mr;case"Claim":return F([F([Jp('By clicking "Confirm Payment", you are claiming that you\'ve paid the Seller in a way they can verify. Only do this if you are sure the Seller will agree that they have the money--otherwise they may burn the '+Qf(e.web3Context.factoryType)+" rather than release it to you.")])]);case"Abort":return F([F([Jp("Aborting will incur a small penalty on both parties, and refund the rest of the "+Qf(e.web3Context.factoryType)+".")])]);case"Release":return F([F([Jp("Releasing the payment will irreversibly send the trade's balance to the Buyer. Only do this if you are certain you've received the full agreed-upon payment.")])]);default:return F([F([Jp("This will destroy the "+Qf(e.web3Context.factoryType)+" in the payment. Only do this if the Buyer has attempted to scam you, is nonresponsive, or for some reason has failed the payment.")])])}}())),f(Bk,F([lx,cN]),function(e){return f(ix,e,HS(g))}(function(){switch(g.$){case"Poke":return"Poke";case"Recall":return"Recall";case"Claim":return"I understand. Confirm Payment";case"Abort":return"I understand. Abort the trade.";case"Release":return"I understand. Release the "+Qf(e.web3Context.factoryType)+".";default:return"I understand. Burn the "+Qf(e.web3Context.factoryType)+"."}}()))])),jO);case"ActionNeedsSig":var g=t.a.a;return sx(F([Jp("Waiting for user signature for the "+qS(g)+" call."),Jp("(check Metamask!)")]));default:var v=t.a,g=v.a,p=v.b;return Rk}},zO=NN(F([AT(Nk),Lk(Fk),Yk(5),KN(20),aD,nD])),YO=function(e){return f(NN,F([hN(8)]),F([f(WR,mr,t$),f(Bk,F([aN(24),jN]),Jp(n$(e)))]))},WO=r(function(e,t){var r=f(ng,yb(e),f(jf,function(e){return e.address},t));return f(v_,function(){var t=L(e.parameters.initiatorRole,r);if("Buyer"===t.a.$){if("Just"===t.b.$&&"Initiator"===t.b.a.$){t.a,t.b.a;return"You're Buying"}t.a;return"Buying"}if("Just"===t.b.$&&"Initiator"===t.b.a.$){t.a,t.b.a;return"You're Selling"}t.a;return"Selling"}(),YO(e.parameters.tradeAmount))}),JO=function(e){return f(NN,F([hN(5)]),F([w_(e.fiatType),f(Bk,F([aN(24),jN]),Jp(HO(e)))]))},QO=function(e){return f(v_,"For Fiat",JO(e.terms.price))},XO=function(e){return"Buyer"===e.$?"Buyer":"Seller"},ZO=l(Tk,250,165,22),eM=l(Tk,255,0,0),tM=l(Tk,0,255,0),rM=MR({description:"aborted",src:"/DAIHard/static/img/aborted.svg"}),nM=MR({description:"burned",src:"/DAIHard/static/img/burned.svg"}),aM=MR({description:"released",src:"/DAIHard/static/img/released.svg"}),iM={$:"ToggleStatsModal"},oM=function(e){return f(UO,to,e)},uM=n(function(e,t,n){var a=f(Zd,function(e){return $(f(CS,e,n),ya(t))},f(qE,function(e){if("LoadedTrade"===e.$){var t=e.a;return ya(t)}return ma},Ma(e.trades))),i=Oi(a),o=l(za,r(function(e,t){switch(e.state.closedReason.$){case"Released":return U(t,{amountReleased:f(fd,t.amountReleased,e.parameters.tradeAmount),numReleases:t.numReleases+1});case"Burned":return U(t,{amountBurned:f(fd,t.amountBurned,e.parameters.tradeAmount),numBurns:t.numBurns+1});case"Aborted":return U(t,{numAborts:t.numAborts+1});default:return t}}),{amountBurned:Wf,amountReleased:Wf,numAborts:0,numBurns:0,numReleases:0},a),u=f(jf,Ff,Xf(oM(f(qE,function(e){return function(e){return e?ya(e):ma}(Gl(e.phaseStartInfo.committedTime))},a))));return{amountBurned:o.amountBurned,amountReleased:o.amountReleased,asRole:t,firstTrade:u,numAborts:o.numAborts,numBurns:o.numBurns,numReleases:o.numReleases,numTrades:i}}),sM=function(e){return{$:"ViewUserHistory",a:e}},cM=f(_B,0,mr),fM=f(qk,eN,PT.textNormalWeight),lM=r(function(e,t){return gi(e/t)}),dM=n(function(e,t,r){for(;;){if(!r.b)return t+e;var n=r.a,a=r.b;if(_(n.start,t)<0)return t+n.offset;var i=e,o=t,u=a;e=i,t=o,r=u}}),hM=r(function(e,t){var r=e.a,n=e.b;return l(dM,r,f(lM,Gl(t),6e4),n)}),pM=r(function(e,t){return f(Xu,24,f(lM,f(hM,e,t),60))}),gM=r(function(e,t){return f(Xu,1e3,Gl(t))}),vM=r(function(e,t){return f(Xu,60,f(hM,e,t))}),yM={$:"Apr"},mM={$:"Aug"},bM={$:"Dec"},CM={$:"Feb"},SM={$:"Jan"},EM={$:"Jul"},TM={$:"Jun"},wM={$:"Mar"},IM={$:"May"},AM={$:"Nov"},BM={$:"Oct"},kM={$:"Sep"},NM=function(e){var t=f(lM,e,1440)+719468,r=(t>=0?t:t-146096)/146097|0,n=t-146097*r,a=(n-(n/1460|0)+(n/36524|0)-(n/146096|0))/365|0,i=n-(365*a+(a/4|0)-(a/100|0)),o=(5*i+2)/153|0,u=o+(o<10?3:-9);return{day:i-((153*o+2)/5|0)+1,month:u,year:a+400*r+(u<=2?1:0)}},RM=r(function(e,t){switch(NM(f(hM,e,t)).month){case 1:return SM;case 2:return CM;case 3:return wM;case 4:return yM;case 5:return IM;case 6:return TM;case 7:return EM;case 8:return mM;case 9:return kM;case 10:return BM;case 11:return AM;default:return bM}}),$M=r(function(e,t){return f(Xu,60,f(lM,Gl(t),1e3))}),xM={$:"Fri"},_M={$:"Mon"},LM={$:"Sat"},PM={$:"Sun"},DM={$:"Thu"},UM={$:"Tue"},OM={$:"Wed"},MM=r(function(e,t){switch(f(Xu,7,f(lM,f(hM,e,t),1440))){case 0:return DM;case 1:return xM;case 2:return LM;case 3:return PM;case 4:return _M;case 5:return UM;default:return OM}}),FM=n(function(e,t,r){return e.toAmPm(f(pM,t,r))}),VM=r(function(e,t){return NM(f(hM,e,t)).day}),KM=VM,HM=F([PM,_M,UM,OM,DM,xM,LM]),jM=r(function(e,t){return function(e){return e.a}(f(ec,L(0,PM),Xf(f(Zd,function(r){return $(r.b,f(MM,e,t))},f(Ki,r(function(e,t){return L(e,t)}),HM)))))}),qM=function(e){return l(za,Ga,0,e)},GM=r(function(e,t){return NM(f(hM,e,t)).year}),zM=function(e){return!f(Xu,4,e)&&(!!f(Xu,100,e)||!f(Xu,400,e))},YM=r(function(e,t){switch(t.$){case"Jan":return 31;case"Feb":return zM(e)?29:28;case"Mar":return 31;case"Apr":return 30;case"May":return 31;case"Jun":return 30;case"Jul":case"Aug":return 31;case"Sep":return 30;case"Oct":return 31;case"Nov":return 30;default:return 31}}),WM=F([SM,CM,wM,yM,IM,TM,EM,mM,kM,BM,AM,bM]),JM=r(function(e,t){return f(ec,L(0,SM),Xf(f(Zd,function(r){r.a;return $(r.b,f(RM,e,t))},f(Ki,r(function(e,t){return L(e,t)}),WM))))}),QM=r(function(e,t){return 1+function(e){var t=e.a;e.b;return t}(f(JM,e,t))}),XM=r(function(e,t){var r=f($s,f(QM,e,t)-1,WM);return qM(f(tu,YM(f(GM,e,t)),r))+f(KM,e,t)}),ZM=r(function(e,t){return f(QM,e,t)/4|0}),eF=r(function(e,t){var r=ji(t),n=e-go(r);return O(f(qi,"",f(tu,function(e){return"0"},f(Vi,1,n))),r)}),tF=function(e){return e?e<=12?e:e-12:12},rF=Ag(315576e5),nF=r(function(e,t){return Ff(rF*f(GM,e,t))}),aF=r(function(e,t){var r=f(nF,e,t),n=f(jM,e,r);return 1+((f(XM,e,t)+n)/7|0)}),iF=r(function(e,t){return ji(f(GM,e,t))}),oF=a(function(e,t,r,n){switch(n.$){case"MonthNumber":return ji(f(QM,t,r));case"MonthSuffix":return function(t){return O(ji(t),e.toOrdinalSuffix(t))}(f(QM,t,r));case"MonthFixed":return f(eF,2,f(QM,t,r));case"MonthNameAbbreviated":return e.toMonthAbbreviation(f(RM,t,r));case"MonthNameFull":return e.toMonthName(f(RM,t,r));case"QuarterNumber":return ji(1+f(ZM,t,r));case"QuarterSuffix":return function(t){return O(ji(t),e.toOrdinalSuffix(t))}(1+f(ZM,t,r));case"DayOfMonthNumber":return ji(f(KM,t,r));case"DayOfMonthSuffix":return function(t){return O(ji(t),e.toOrdinalSuffix(t))}(f(KM,t,r));case"DayOfMonthFixed":return f(eF,2,f(KM,t,r));case"DayOfYearNumber":return ji(f(XM,t,r));case"DayOfYearSuffix":return function(t){return O(ji(t),e.toOrdinalSuffix(t))}(f(XM,t,r));case"DayOfYearFixed":return f(eF,3,f(XM,t,r));case"DayOfWeekNumber":return ji(f(jM,t,r));case"DayOfWeekSuffix":return function(t){return O(ji(t),e.toOrdinalSuffix(t))}(f(jM,t,r));case"DayOfWeekNameAbbreviated":return e.toWeekdayAbbreviation(f(MM,t,r));case"DayOfWeekNameFull":return e.toWeekdayName(f(MM,t,r));case"WeekOfYearNumber":return ji(f(aF,t,r));case"WeekOfYearSuffix":return function(t){return O(ji(t),e.toOrdinalSuffix(t))}(f(aF,t,r));case"WeekOfYearFixed":return f(eF,2,f(aF,t,r));case"YearNumberLastTwo":return f(wo,2,f(iF,t,r));case"YearNumber":return f(iF,t,r);case"AmPmUppercase":return HP(l(FM,e,t,r));case"AmPmLowercase":return cl(l(FM,e,t,r));case"HourMilitaryNumber":return ji(f(pM,t,r));case"HourMilitaryFixed":return f(eF,2,f(pM,t,r));case"HourNumber":return ji(tF(f(pM,t,r)));case"HourFixed":return f(eF,2,tF(f(pM,t,r)));case"HourMilitaryFromOneNumber":return ji(1+f(pM,t,r));case"HourMilitaryFromOneFixed":return f(eF,2,1+f(pM,t,r));case"MinuteNumber":return ji(f(vM,t,r));case"MinuteFixed":return f(eF,2,f(vM,t,r));case"SecondNumber":return ji(f($M,t,r));case"SecondFixed":return f(eF,2,f($M,t,r));case"MillisecondNumber":return ji(f(gM,t,r));case"MillisecondFixed":return f(eF,3,f(gM,t,r));default:return n.a}}),uF=a(function(e,t,r,n){return f(qi,"",f(tu,l(oF,e,r,n),t))}),sF=o(function(e,t,r,n,a,i){return{toAmPm:a,toMonthAbbreviation:t,toMonthName:e,toOrdinalSuffix:i,toWeekdayAbbreviation:n,toWeekdayName:r}}),cF=function(e){return e>11?"pm":"am"},fF=function(e){switch(e.$){case"Jan":return"January";case"Feb":return"February";case"Mar":return"March";case"Apr":return"April";case"May":return"May";case"Jun":return"June";case"Jul":return"July";case"Aug":return"August";case"Sep":return"September";case"Oct":return"October";case"Nov":return"November";default:return"December"}},lF=function(e){switch(f(Xu,100,e)){case 11:case 12:case 13:return"th";default:switch(f(Xu,10,e)){case 1:return"st";case 2:return"nd";case 3:return"rd";default:return"th"}}},dF=function(e){switch(e.$){case"Mon":return"Monday";case"Tue":return"Tuesday";case"Wed":return"Wednesday";case"Thu":return"Thursday";case"Fri":return"Friday";case"Sat":return"Saturday";default:return"Sunday"}},hF=p(sF,fF,f($a,fF,Co(3)),dF,f($a,dF,Co(3)),cF,lF),pF=uF(hF),gF={$:"MonthNameFull"},vF=gF,yF=function(e){return{$:"Text",a:e}},mF=yF,bF={$:"YearNumber"},CF=bF,SF=n(function(e,t,n){var a=r(function(e,t){return f(AN,F([aN(18),hN(6)]),F([f(Bk,F([yN]),Jp(e)),f(Bk,F([fM]),Jp(t))]))}),i=pF(F([vF,mF(", "),CF])),o=f(AN,F([hN(23),AT(Nk)]),O(f(tu,function(e){var t=e.a,r=e.b;return f(a,t,r)},F([L("First Trade",function(){var e=n.firstTrade;if("Just"===e.$){var t=e.a;return f(i,cM,t)}return"No Committed Trades yet!"}()),L("Release Outcomes",ji(n.numReleases)+" trades / "+n$(n.amountReleased)+" "+Qf(e)+" Released"),L("Abort Outcomes",ji(n.numAborts)+" trades"),L("Burn Outcomes",ji(n.numBurns)+" trades / "+n$(n.amountBurned)+" "+Qf(e)+" Burned")])),F([f(Bk,F([cN]),f(pO,"View User History",sM(n.asRole)))])));return f(AN,F([Yk(8),ID,AD,Lk(AR),hN(1),rD({blur:20,color:d(JR,0,0,0,.08),offset:L(0,0),size:0})]),F([f(Bk,F([AT(Nk),Lk(Fk),KN(17)]),f(m$,18,t)),f(Bk,F([AT(Nk),Lk(Fk),KN(17)]),o)]))}),EF=a(function(e,t,r,n){var a=l(uM,r,t.parameters.initiatorRole,t.parameters.initiatorAddress),i=XO(t.parameters.initiatorRole)+" Stats";return f(Bk,n?F([f_(f(Bk,F([l_(30),TN]),l(SF,e,t.parameters.initiatorAddress,a)))]):mr,f(v_,i,f(NN,F([AT(Nk),hN(20),Gk,Zk(iM)]),f(tu,NN(F([hN(5)])),F([F([f(WR,F([ET(xk(28))]),aM),f(Bk,F([aN(24),jN,wA(tM)]),Jp(l(Ju,2,D("0"),ji(a.numReleases))))]),F([f(WR,F([ET(xk(28))]),rM),f(Bk,F([aN(24),jN,wA(ZO)]),Jp(l(Ju,2,D("0"),ji(a.numAborts))))]),F([f(WR,F([ET(xk(28))]),nM),f(Bk,F([aN(24),jN,wA(eM)]),Jp(l(Ju,2,D("0"),ji(a.numBurns))))])])))))}),TF=r(function(e,t){if("Token"===e.$){if("EthDai"===e.a.$){e.a;return"https://etherscan.io/address/"+Xd(t)}e.a;return"https://kovan.etherscan.io/address/"+Xd(t)}switch(e.a.$){case"Eth":e.a;return"https://etherscan.io/address/"+Xd(t);case"Kovan":e.a;return"https://kovan.etherscan.io/address/"+Xd(t);default:e.a;return"https://blockscout.com/poa/dai/address/"+Xd(t)}}),wF=n(function(e,t,r){return f(yA,e,{label:Jp(Xd(r)),url:f(TF,t,r)})}),IF=r(function(e,t){return f(v_,"Trade Status",f(AN,F([aN(24),jN,hN(8)]),F([Jp(function(){switch(e.state.phase.$){case"Open":return"Buyer"===e.parameters.initiatorRole.$?"Open Buy Offer":"Open Sell Offer";case"Committed":return"Committed";case"Judgment":return"Judgment";default:return"Closed"}}()),l(wF,F([aN(12),wA(T$),dx]),t,e.creationInfo.address)])))}),AF=o(function(e,t,r,n,a,i){return zO(F([f(IF,t,n),f(WO,t,r),QO(t),d(EF,n,t,a,i)]))}),BF=l(Tk,9,32,107),kF=MR({description:"chat",src:"/DAIHard/static/img/chat.svg"}),NF=f(Bk,F([Yk(4),Gk,Zk(FO),KN(5),Lk(l(Tk,22,0,255))]),f(WR,F([AT(xk(42))]),kF)),RF=function(e){switch(e.$){case"NotClosed":return"";case"Recalled":return"Recalled";case"Aborted":return"Aborted";case"Released":return"Released";default:return"Burned"}},$F=function(e){return f(AN,F([Yk(12),Lk(AR),KN(15),hN(15)]),F([f(Bk,F([aN(24),tN,CN]),Jp("Fiat Payment Method")),f(vN,F([aN(18),ET(wT),Lk(Fk),rD({blur:5,color:d(JR,0,0,0,.2),offset:L(-3,3),size:0}),Yk(3),KN(5)]),F([f(ec,f(Bk,F([wA(B$),CN]),Jp("No payment methods found.")),f(jf,Jp,f(jf,function(e){return e.info},Xf(e))))]))]))},xF={$:"Active"},_F=function(e){return{$:"ExpandPhase",a:e}},LF=F([Lk(BF),wA(Fk)]),PF=r(function(e,t){return{$:"Min",a:e,b:t}}),DF=r(function(e,t){return f(PF,e,t)}),UF=function(e){return F(e?[Yk(12),V$,ET(f(DF,380,wT))]:[Yk(12),cN])},OF=F([Lk(Fk)]),MF=MR({description:"flame",src:"/DAIHard/static/img/flame.png"}),FF=r(function(e,t){return Kf(f(xu,Hf(e),Hf(t)))}),VF=r(function(e,t){return d(ax,P(d(JR,1,.6,.2,1),d(JR,1,.6,.2,.8),d(JR,1,.6,.2,.6)),Fk,e,t)}),KF=n(function(e,t,r){return{$:"CommitClicked",a:e,b:t,c:r}}),HF=function(e){return{$:"ContractActionClicked",a:e}},jF={$:"Web3Connect"},qF=n(function(e,t,r){if("Just"===r.$){var n=r.a;return"TimeUp"===f(TR,e,t).$?Rk:f(NN,F([hN(8)]),function(){var e=P(t.state.phase,f(yb,t,n.address),f(CS,t,n.address));e:for(;;)switch(e.a.$){case"Open":if("Just"===e.b.$){if("Initiator"===e.b.a.$){e.a,e.b.a;return F([f(Lf,HS,f(pO,"Remove and Refund this Trade",VS))])}break e}var r=(e.a,e.b,Hf(mb(t.parameters)));return F([f(ix,"Deposit and Commit to Trade",l(KF,t,n,r))]);case"Committed":if("Just"===e.c.$){if("Buyer"===e.c.a.$){e.a,e.c.a;return F([f(Lf,HF,f(VF,"Abort Trade",IS)),f(Lf,HF,f(ix,"Confirm Payment",_S)),NF])}e.a,e.c.a;return F([NF])}break e;case"Judgment":if("Just"===e.c.$){if("Seller"===e.c.a.$){e.a,e.c.a;return F([f(Lf,HF,f(ix,"Burn it All!",$S)),f(Lf,HF,f(pO,"Release Everything",KS)),NF])}e.a,e.c.a;return F([NF])}break e;default:break e}return mr}())}return f(ix,"Connect to Wallet",jF)}),GF={$:"Finished"},zF={$:"NotStarted"},YF=r(function(e,t){var r=L(xN(t),xN(e.state.phase)),n=r.a,a=r.b;return _(n,a)>0?zF:$(n,a)?xF:GF}),WF=n(function(e,t,r){for(;;){if(t<=0)return e;var n=f(qa,r,e),a=t-1,i=r;e=n,t=a,r=i}}),JF=r(function(e,t){return l(WF,mr,e,t)}),QF=i(function(e,t,r,n,a){var i=n$(f(fd,n.parameters.tradeAmount,n.parameters.buyerDeposit))+" "+Qf(e),o=n$(n.parameters.tradeAmount)+" "+Qf(e),u=f(NN,mr,f(JF,3,f(WR,F([ET(xk(18))]),MF))),s=f(wf,Bk(F([wA(l(bA,1,0,0))])),Jp),c=$(t,n.state.phase),d=f(ng,CS(n),f(jf,function(e){return e.address},a)),h=c?Fk:IR,p=vN(F([wA(h),aN(18),tN])),g=HO(n.terms.price),v=c?l(Tk,0,226,255):l(Tk,16,7,234),y=f(wf,Bk(F([wA(v)])),Jp),m=n$(n.parameters.buyerDeposit)+" "+Qf(e),b=n.parameters.abortPunishment,C=n$(b)+" "+Qf(e),S=n$(f(FF,n.parameters.buyerDeposit,b))+" "+Qf(e),E=n$(f(FF,n.parameters.tradeAmount,b))+" "+Qf(e),T=function(){var r=L(t,d);if("Just"===r.b.$)switch(r.a.$){case"Open":var a=(r.a,r.b.a);return L("And Now, We Wait",function(){return"Buyer"===a.$?f(tu,p,F([F([Jp("Your "),s("burnable deposit"),Jp(" of "),y(m),Jp(" is now held in this contract, and your offer to buy "),y(o),Jp(" for "),y(g),Jp(" is now listed in the marketplace.")]),F([Jp("If another user likes your offer, they can become the Seller by depositing the full "),y(o),Jp(" into this contract.")]),F([Jp("If no one commits within the Open Window, your offer will expire, refunding the "),y(m),Jp(" to you.")])])):f(tu,p,F([F([Jp("Your offer to sell the "),y(o),Jp(" held in this contract for "),y(g),Jp(" is now listed in the marketplace.")]),F([Jp("If another user likes your offer, they can become the Buyer by depositing a "),s("burnable deposit"),Jp(" of 1/3 of the trade amount "),y("("+m+")"),Jp(" into this contract.")]),F([Jp("If no one commits within the Open Window, your offer will expire, refunding the "),y(o),Jp(" to you.")])]))}());case"Committed":if("Buyer"===r.b.a.$){r.a,r.b.a;return L("Time to Pay Up",f(tu,p,F([F([Jp("You must now pay the Seller "),y(g),Jp(" via the Fiat Payment Method, "),f(Bk,F([tN]),Jp("and then click ")),s("Confirm Payment"),Jp(" before the payment window runs out. Use the chat to coordinate.")]),F([Jp("If you abort the trade, or do not confirm payment before this time is up, "),y(C),Jp(" (1/4 of the "),s("burnable deposit"),Jp(") will be "),s("burned"),Jp(" from both parties, while the remainder of each party's deposit is refunded ("),y(E),Jp(" to the Seller, "),y(S),Jp(" to you).")]),F([Jp("This may be your last chance to clear up any ambiguity before Judgement. Do not confirm unless you're sure the "),y(g),Jp(" has been unmistakably transferred.")])])))}r.a,r.b.a;return L("Time to Get Paid",f(tu,p,F([F([Jp("Work and communicate with the Buyer to receive "),y(g),Jp(" as described in Fiat Payment Method. Then, the Buyer should confirm the payment, moving the trade to the final phase.")]),F([Jp("If the Buyer aborts the trade, or doesn't confirm payment before this time is up, "),y(C),Jp(" (1/4 of the "),s("burnable deposit"),Jp(") will be "),s("burned"),Jp(" from both parties, while the remainder of each party's deposit is refunded ("),y(E),Jp(" to you, "),y(S),Jp(" to the Buyer).")])])));case"Judgment":if("Buyer"===r.b.a.$){r.a,r.b.a;return L("Judgement",f(tu,p,F([F([Jp("If the Seller confirms receipt of payment, or fails to decide within the Burn/Release Window, the combined balance of "),y(i),Jp(" will be released to you.")]),F([Jp("If they cannot confirm they've received payment from you, they will probably instead "),s("burn the contract's balance of "),y(i),s("."),Jp(" In this case the "),y(i),Jp(" will be lost to both parties.")]),F([Jp("These are the only options the Seller has. So, fingers crossed!")])])))}r.a,r.b.a;return L("Judgement",f(tu,p,F([F([Jp("By pushing the contract to the final stage, the Buyer has indicated that the transfer has taken place, and awaits your judgement.")]),F([Jp("So, have you recieved the "),y(g),Jp("? If so, you can click "),y("Release Everything"),Jp(".")]),F([Jp("If not, the Buyer is probably trying to scam you, and you should probably "),s("burn it all"),Jp(". You're not getting it back either way, and you wouldn't want the other guy to get it, would you?")]),F([Jp("If you don't decide within the Burn/Release Window, the balance will be automatically released.")])])));default:r.a;return L("Contract closed.",F([p(F([Jp("Check the chat log for the full history.")]))]))}else switch(r.a.$){case"Open":r.a,r.b;return L("Get it while it's hot",function(){return"Seller"===n.parameters.initiatorRole.$?f(tu,p,F([F([Jp("The Seller has deposited "),y(o),Jp(" into this contract, and offers to sell it for "),y(g),Jp(". To become the Buyer, you must deposit 1/3 of the trade amount "),y("("+m+")"),Jp(" into this contract by clicking "),s("Deposit and Commit to Trade"),Jp(".")]),F([Jp("If the trade is successful, the combined "+Qf(e)+" balance "),y("("+i+")"),Jp(" will be released to you. If anything goes wrong, there are "),s("burnable punishments "),u,Jp(" for both parties (see Payment Window for more on this).")]),F([Jp("Don't commit unless you can fulfil one of the seller’s accepted payment methods below for "),y(g),Jp(" within the payment window.")])])):f(tu,p,F([F([Jp("The Buyer is offering to buy "),y(o),Jp(" for "),y(g),Jp(", and has deposited "),y(m),Jp(" into this contract as a "),s("burnable deposit"),Jp(". To become the Seller, deposit "),y(o),Jp(" into this contract by clicking "),s("Deposit and Commit to Trade"),Jp(".")]),F([Jp("When you receive the "),y(g),Jp(" from the Buyer, the combined "+Qf(e)+" balance "),y("("+i+")"),Jp(" will be released to the Buyer. If anything goes wrong, there are "),s("burnable punishments "),u,Jp(" for both parties (see Payment Window for more on this).")]),F([Jp("Don't commit unless you can receive "),y(g),Jp(" via one of the Buyer's payment methods below, within the payment window.")])]))}());case"Committed":r.a,r.b;return L("Making the Payment",f(tu,p,F([F([Jp("During this phase, the Buyer is expected to transfer "),y(g),Jp(" to the Seller, as described in Fiat Payment Method, "),f(Bk,F([tN]),Jp("and ")),s("Confirm the Payment "),Jp(" before the payment window runs out. This would move the trade to the final phase.")]),F([Jp("If the Buyer aborts the trade, or doesn't confirm payment before this time is up, "),y(C),Jp(" (1/4 of the "),s("burnable deposit"),Jp(" amount) will be "),s("burned"),Jp(" from both parties, while the remainder of each party's deposit is refunded ("),y(E),Jp(" to the Seller, "),y(S),Jp(" to the Buyer).")])])));case"Judgment":r.a,r.b;return L("Judgement",f(tu,p,F([F([Jp("The Buyer has indicated that the transfer has taken place, and awaits the Seller's judgement on the fact of the matter.")]),F([Jp("If the Seller can verify he has received the "),y(g),Jp(", he will probably release the total balance of "),y(o),Jp(" to the Buyer. If he cannot verify payment, he will probably instead "),s("burn it all"),Jp(".")]),F([Jp("If the Seller has not made a decision before the Burn/Release Window expires, the "),y(o),Jp(" will be automaticall released.")])])));default:r.a,r.b;return L("Contract closed.",mr)}}(),w=T.a,I=T.b;return f(AN,F([AT(Nk),ET(Nk),KN(20),hN(30)]),F([f(NN,F([AT(Nk)]),F([f(Bk,F([aN(24),tN,wA(v),Sx]),Jp(w))])),f(AN,F([AT(Nk),ON,hN(13)]),I),f(Bk,F([TN]),function(){switch(f(YF,n,t).$){case"Active":return l(qF,r,n,a);case"NotStarted":return f(Bk,F([aN(20),tN,CN,wA(g$)]),Jp("Phase not yet started."));default:return f(Bk,F([aN(20),tN,CN]),Jp("Phase no longer active."))}}())]))}),XF=MR({description:"committed phase",src:"/DAIHard/static/img/phase-committed.svg"}),ZF=MR({description:"judgment phase",src:"/DAIHard/static/img/time-clock-fire.svg"}),eV={$:"None"},tV=eV,rV=MR({description:"open phase",src:"/DAIHard/static/img/diamond-give-white.svg"}),nV=function(e){switch(e.$){case"Open":return rV;case"Committed":return XF;case"Judgment":return ZF;default:return tV}},aV=a(function(e,t,r,n){return{$:"RgbaSpace",a:e,b:t,c:r,d:n}}),iV=a(function(e,t,r,n){return d(aV,e,t,r,n)}),oV=function(e){var t=e.a,r=e.b,n=e.c;return{alpha:e.d,blue:n,green:r,red:t}},uV=function(e){return function(e){return d(iV,e.red,e.green,e.blue,e.alpha)}(oV(e))},sV=function(e){return{$:"Circle",a:e}},cV=sV,fV=d(aV,0,0,0,1),lV={$:"Flat"},dV={$:"Sharp"},hV=function(e){return{$:"Uniform",a:e}},pV=hV,gV={cap:lV,dashPattern:mr,dashPhase:0,fill:pV(fV),join:dV,thickness:2},vV=n(function(e,t,r){return U(gV,{dashPattern:e,fill:r,thickness:t})}),yV=vV(mr),mV={$:"Transparent"},bV=mV,CV=f(yV,0,bV),SV=r(function(e,t){return{$:"Shape",a:e,b:t}}),EV=function(e){return{basic:e,handlers:mr,name:ma,opacity:1,rotation:0,scale:L(1,1),shift:L(0,0)}},TV=function(e){return f(wf,EV,SV(e))},wV=function(e){return TV(L(e,CV))},IV=function(e){return L(-e.a,-e.b)},AV=r(function(e,t){var r=e.a,n=e.b,a=t.shift;return U(t,{shift:L(a.a+r,a.b+n)})}),BV=r(function(e,t){return f(AV,IV(e(t)),t)}),kV=function(e){var t=r(function(e,t){var r=e.a,n=e.b,a=t.a,i=t.b;return L(f(qa,r,a),f(qa,n,i))});return l(Ja,t,L(mr,mr),e)},NV=r(function(e,t){return{$:"Path",a:e,b:t}}),RV=Nr,$V=Rr,xV=function(e){var t=e.shift,r=e.scale,n=e.rotation,a=function(e){var t=e.a,r=e.b,a=$V(n),i=RV(n);return L(i*t-a*r,a*t+i*r)},i=r,o=i.a,u=i.b,s=function(e){var t=e.a,r=e.b;return L(o*t,u*r)},c=t,l=c.a,d=c.b;return f(wf,f(wf,function(e){var t=e.a,r=e.b;return L(t+l,r+d)},s),a)},_V=function(e){return tu(function(t){var r=t.a,n=t.b,a=e/2;return L(r<0?r-a:r+a,n<0?n-a:n+a)})},LV=r(function(e,t){var r=t.a,n=t.b,a=n/2,i=r/2;return f(_V,e,F([L(-i,-a),L(i,-a),L(i,a),L(-i,a)]))}),PV=function(e){var t=e.toTop,r=e.toBottom,n=e.toRight,a=e.toLeft;return F([L(-a,-r),L(n,-r),L(n,t),L(-a,t)])},DV=function(e){var t=UV(e.basic),r=kV(f(tu,xV(e),t)),n=r.a,a=r.b;return{toBottom:-f(ec,0,CI(a)),toLeft:-f(ec,0,CI(n)),toRight:f(ec,0,bI(n)),toTop:f(ec,0,bI(a))}},UV=function(e){e:for(;;)switch(e.$){case"Shape":switch(e.b.$){case"Circle":var t=e.a,r=t.b.thickness,n=e.b.a,a=2*n;return f(LV,r,L(a,a));case"Ellipse":var i=e.a,r=i.b.thickness,o=e.b,u=o.a,s=o.b;return f(LV,r,L(2*u,2*s));case"Rectangle":var c=e.a,r=c.b.thickness,l=e.b,d=l.a,h=l.b;return f(LV,r,L(d,h));case"Polygon":var p=e.a,r=p.b.thickness,g=e.b.a;return f(_V,r,g);default:var v=e.a,y=v.b,m=e.b.a,b=f(NV,y,m);e=b;continue e}case"Path":var r=e.a.thickness,C=e.a.cap,g=e.b.a;return f(_V,$(C,lV)?0:r,g);case"Text":case"Image":case"Html":var S=e.a;return f(LV,0,S);case"Group":var E=e.a;return f(_V,0,uy(f(tu,f($a,DV,PV),E)));default:var T=e.b;return f(_V,0,PV(DV(T)))}},OV=function(e){var t=DV(e);return t.toTop+t.toBottom},MV=function(e){var t=DV(e);return L(-t.toLeft,t.toTop)},FV=function(e){var t=DV(e);return t.toLeft+t.toRight},VV=Un("http://www.w3.org/2000/svg"),KV=VV("svg"),HV=qn("height"),jV=qn("version"),qV=qn("width"),GV=VV("circle"),zV=VV("ellipse"),YV=VV("foreignObject"),WV=VV("g"),JV=VV("image"),QV=VV("polygon"),XV=VV("polyline"),ZV=VV("rect"),eK=kw,tK=VV("text"),rK=qn("id"),nK=qn("points"),aK=qn("r"),iK=qn("rx"),oK=qn("ry"),uK=function(e){return l(Gn,"http://www.w3.org/1999/xlink","xlink:href",it(e))},sK=function(e){return{$:"Group",a:e}},cK=qn("dominant-baseline"),fK=qn("fill"),lK=qn("fill-opacity"),dK=qn("font-family"),hK=qn("font-size"),pK=qn("font-style"),gK=qn("font-variant"),vK=qn("font-weight"),yK=qn("opacity"),mK=qn("stroke"),bK=qn("stroke-dasharray"),CK=qn("stroke-dashoffset"),SK=qn("stroke-linecap"),EK=qn("stroke-linejoin"),TK=qn("stroke-opacity"),wK=qn("stroke-width"),IK=qn("text-anchor"),AK=qn("text-decoration"),BK=qn("transform"),kK=function(e){switch(e.$){case"Round":return"round";case"Padded":return"square";default:return"butt"}},NK=function(e){return f(qi," ",f(tu,function(e){var t=e.a,r=e.b;return f(qi,",",F([ji(t),ji(r)]))},e))},RK=n(function(e,t,r){return d(aV,e,t,r,1)}),$K=function(e){var t=e.a,r=e.b,n=e.c,a=e.d,i=function(e){return Ag(1e4*e)/100};return Sl(F(["rgba(",Tw(i(t)),"%,",Tw(i(r)),"%,",Tw(i(n)),"%,",Tw(function(e){return Ag(1e3*e)/1e3}(a)),")"]))},xK=function(e){var t=e.a,r=e.b,n=e.c;return{alpha:e.d,blue:n,green:r,red:t}},_K=function(e){var t=xK(e),r=t.red,n=t.green,a=t.blue;return $K(l(RK,r,n,a))},LK=function(e){if("Uniform"===e.$){var t=e.a;return _K(t)}return"none"},PK=function(e){var t=xK(e),r=t.alpha;return Tw(r)},DK=function(e){if("Uniform"===e.$){var t=e.a;return PK(t)}return"0"},UK=function(e){switch(e.$){case"Smooth":return"round";case"Sharp":return"miter";default:return"bevel"}},OK=kr,MK=function(e){var t=Tw(e.scale.b),r=Tw(e.scale.a),n=Tw(-e.rotation/2/OK*360),a=Tw(-e.shift.b),i=Tw(e.shift.a);return Sl(F(["translate(",i,",",a,") scale(",r,",",t,") rotate(",n,")"]))},FK=function(e){var t=e.basic;switch(t.$){case"Path":var r=t.a;return F([mK(LK(r.fill)),TK(DK(r.fill)),wK(Tw(r.thickness)),SK(kK(r.cap)),EK(UK(r.join)),fK("none"),yK(Tw(e.opacity)),BK(MK(e)),CK(ji(r.dashPhase)),bK(NK(r.dashPattern))]);case"Shape":var n=t.a,a=n.a,r=n.b;return F([fK(LK(a)),lK(DK(a)),mK(LK(r.fill)),TK(DK(r.fill)),wK(Tw(r.thickness)),SK(kK(r.cap)),EK(UK(r.join)),yK(Tw(e.opacity)),BK(MK(e)),CK(ji(r.dashPhase)),bK(NK(r.dashPattern))]);case"Text":var i=t.b,o=i.a;i.b;return F([fK(LK(hV(o.color))),dK(function(){var e=o.typeface;switch(e.$){case"Serif":return"serif";case"Sansserif":return"sans-serif";case"Monospace":return"monospace";default:return e.a}}()),hK(ji(o.size)),vK(function(){switch(o.weight.$){case"Thin":return"200";case"Light":return"300";case"Regular":return"normal";case"Medium":return"500";case"SemiBold":return"600";case"Bold":return"bold";default:return"800"}}()),pK(function(){switch(o.shape.$){case"Upright":case"SmallCaps":return"normal";case"Slanted":return"oblique";default:return"italic"}}()),gK(function(){return"SmallCaps"===o.shape.$?"small-caps":"normal"}()),AK(function(){switch(o.line.$){case"None":return"none";case"Under":return"underline";case"Over":return"overline";default:return"line-through"}}()),IK("middle"),cK("middle"),BK(MK(e))]);default:return F([BK(MK(e))])}},VK=qn("x"),KK=qn("y"),HK=r(function(e,t){return F([qV(Tw(e)),HV(Tw(t)),VK(Tw(-e/2)),KK(Tw(-t/2))])}),jK=function(e){return f(qi," ",f(tu,function(e){var t=e.a,r=e.b;return f(qi,",",F([Tw(t),Tw(-r)]))},e))},qK=Qk,GK=r(function(e,t){return f(e,t.a,t.b)}),zK=function(e){return f(tu,GK(qK),e)},YK=function(e){e:for(;;){var t=f(ec,"_unnamed_",e.name),n=e.basic;switch(n.$){case"Path":var a=(n.a,n.b),i=a.a;return f(XV,O(F([rK(t),nK(jK(i))]),O(FK(e),zK(e.handlers))),mr);case"Shape":var o=n.a,u=(o.a,o.b),s=n.b;switch(s.$){case"Polygon":var i=s.a;return f(QV,O(F([rK(t),nK(jK(i))]),O(FK(e),zK(e.handlers))),mr);case"Circle":var c=s.a;return f(GV,O(F([rK(t),aK(Tw(c))]),O(FK(e),zK(e.handlers))),mr);case"Ellipse":var d=s.a,h=s.b;return f(zV,O(F([rK(t),iK(Tw(d)),oK(Tw(h))]),O(FK(e),zK(e.handlers))),mr);case"Rectangle":var p=s.a,g=s.b,c=s.c;return f(ZV,O(F([rK(t),iK(Tw(c)),oK(Tw(c))]),O(f(HK,p,g),O(FK(e),zK(e.handlers)))),mr);default:var a=s.a,v=U(e,{basic:f(NV,u,a)});e=v;continue e}case"Text":var y=n.b,m=(y.a,y.b);return f(tK,O(F([rK(t)]),O(FK(e),zK(e.handlers))),F([eK(m)]));case"Image":var b=n.a,p=b.a,g=b.b,C=n.b;return f(JV,O(F([rK(t),uK(C)]),O(f(HK,p,g),O(FK(e),zK(e.handlers)))),mr);case"Html":var S=n.a,p=S.a,g=S.b,E=n.b;return f(YV,O(F([rK(t)]),O(f(HK,p,g),O(FK(e),zK(e.handlers)))),F([E]));case"Group":var T=n.a;return f(WV,f(qa,rK(t),O(FK(e),zK(e.handlers))),l(za,r(function(e,t){return f(qa,YK(e),t)}),mr,T));default:var w=n.a,I=n.b,v=U(e,{basic:sK(F([w,I]))});e=v;continue e}}},WK=r(function(e,t){var r=e.a,n=e.b,a=Tw(r),i=Tw(n);return f(WT,mr,F([f(KV,F([qV(a),HV(i),jV("1.1")]),F([YK(t)]))]))}),JK=function(e){return f(WK,L(FV(e),OV(e)),f(BV,MV,e))},QK=r(function(e,t){var r=nV(e),n=function(){switch(t.$){case"NotStarted":return l(Tk,10,33,108);case"Active":return l(Tk,0,100,170);default:return l(Tk,1,129,104)}}(),a=A_(JK(f(wV,pV(uV(n)),cV(50))));return f(Bk,F([cN,H$(f(WR,F([cN,ON,ET(xk(60))]),r))]),a)}),XK=function(e){var t=F([CN,tN,aN(20)]);switch(e.$){case"Active":return f(Bk,O(t,F([wA(oN)])),Jp("Active"));case"NotStarted":return f(Bk,O(t,F([wA(g$)])),Jp("Not Started"));default:return f(Bk,t,Jp("Finished"))}},ZK=n(function(e,t,r){var n=f(YF,t,e),a=function(){return"Active"===n.$?l(Tk,0,226,255):IR}(),i=f(Bk,F([wA(a),aN(20),tN,cN]),Jp(function(){switch(e.$){case"Open":return"Open Window";case"Committed":return"Payment Window";case"Judgment":return"Burn/Release Window";default:return"Closed"}}())),o=function(){if("Closed"===e.$)return Rk;switch(n.$){case"NotStarted":return d(LR,F([cN]),F([aN(22),jN]),L(IR,AR),f(SR,e,t));case"Active":var a=f(TR,r,t);if("TimeLeft"===a.$){var i=a.a;return d(UR,F([cN]),F([aN(22),jN]),L(Fk,AR),i)}return f(AN,F([cN,hN(10)]),F([f(Bk,F([cN]),Jp(wR(e))),f(pO,"Poke",HS(FS))]));default:return f(Bk,F([ET(xk(1))]),Rk)}}();return f(AN,F([KN(20),hN(10),ET(Nk)]),F([f(Bk,F([V$,cN]),i),f(Bk,F([ET(Nk),cN]),f(Bk,F([ON]),f(QK,e,n))),f(AN,F([hN(10),lx,cN]),F([f(Bk,F([cN]),XK(n)),o]))]))}),eH=u(function(e,t,r,n,a,i,o){var u=f(YF,n,r),s=f(Bk,F([KN(10),AT(Nk),ET(Nk)]),h(QF,t,r,o,n,a)),c=function(){switch(r.$){case"Open":return n.parameters.autorecallInterval;case"Committed":return n.parameters.autoabortInterval;case"Judgment":return n.parameters.autoreleaseInterval;default:return Ff(0)}}(),d=l(ZK,r,n,o),p=(function(){switch(u.$){case"NotStarted":return c;case"Active":return f(ER,f(Tb,n.state.phaseStartTime,c),o);default:Ff(0)}}(),f(Bk,F([ET(Nk),AT(xk(1)),Lk(function(){return"Active"===u.$?l(bA,0,0,1):AR}())]),Rk)),g=i?f(NN,O(UF(e),O($(u,xF)?LF:OF,F([AT(Nk)]))),F([d,p,s])):f(NN,O(UF(e),O($(u,xF)?LF:OF,F([Gk,Zk(_F(r))]))),F([d]));return!e&&$(u,xF)?f(AN,F([AT(Nk),hN(20),C$({bottom:20,left:0,right:0,top:0})]),F([g,$F(n.terms.paymentMethods)])):g}),tH=o(function(e,t,r,n,a,i){return"Closed"===r.state.phase.$?f(NN,F([cN,Yk(12),KN(30),hN(10),Lk(BF),aN(24),tN,wA(Fk)]),F([Jp("Trade "+RF(r.state.closedReason)),NF])):e?f(AN,F([AT(Nk),hN(10)]),F([f(NN,F([AT(Nk),ET(wT),hN(20)]),F([g(eH,e,t,no,r,a,$(n,no),i),g(eH,e,t,nC,r,a,$(n,nC),i),g(eH,e,t,aC,r,a,$(n,aC),i)])),$F(r.terms.paymentMethods)])):f(AN,F([AT(Nk),ET(wT),hN(20)]),F([g(eH,e,t,no,r,a,$(n,no),i),g(eH,e,t,nC,r,a,$(n,nC),i),g(eH,e,t,aC,r,a,$(n,aC),i)]))}),rH=a(function(e,t,r,n){var a=e>1300;return L(function(){var e=n.trade;switch(e.$){case"LoadedTrade":var i=e.a;return f(AN,F([AT(Nk),ET(Nk),hN(40)]),F([p(AF,t,i,n.userInfo,n.web3Context.factoryType,r,n.showStatsModal),f(Bk,F([AT(Nk),f(Hk,40,0),hN(40)]),p(tH,a,n.web3Context.factoryType,i,n.expandedPhase,n.userInfo,t))]));case"PartiallyLoadedTrade":e.a;return f(Bk,F([cN,ON,aN(30)]),Jp("Loading trade info..."));default:return f(Bk,F([cN,ON,aN(30)]),Jp("Invalid trade"))}}(),F([VO(n),GO(n)]))}),nH=n(function(e,t,r){var n=r.a,a=r.b;return L(e(n),t(a))}),aH=r(function(e,t){var r=function(){var r=t.submodel;switch(r.$){case"BetaLandingPage":return L(zD,mr);case"CreateModel":var n=r.a;return L(f(Lf,Uy,UD(n)),mr);case"QuickCreateModel":var a=r.a;return l(nH,Lf(Fy),tu(Lf(Fy)),kO(a));case"TradeModel":var i=r.a;return l(nH,Lf(Ky),tu(Lf(Ky)),d(rH,e,t.time,t.tradeCache,i));case"MarketplaceModel":var o=r.a;return L(f(Lf,gT,l(eO,t.time,t.tradeCache,o)),mr);default:var u=r.a;return L(f(Lf,lT,l(R$,t.time,t.tradeCache,u)),mr)}}(),n=r.a,a=r.b;return L(f(Bk,F([AT(Nk),ET(Nk),Yk(10)]),n),a)}),iH=function(e){return{$:"DismissNotice",a:e}},oH=function(e){return f(ZN,xU,_U(e))},uH=function(e){var t=e.a,n=e.b,a=function(){return"Error"===n.noticeType.$?l(bA,1,1,1):l(bA,0,0,0)}(),i=function(){switch(n.noticeType.$){case"Update":return l(Tk,100,200,255);case"Caution":return l(Tk,255,188,0);case"Error":return l(Tk,255,70,70);default:return l(Tk,200,200,200)}}(),o=f(Bk,F([TN,V$,X$(5),oH(5)]),P$(iH(t)));return f(Bk,F([Lk(i),Yk(10),KN(8),AT(Nk),d$(1),f$(d(JR,0,0,0,.15)),nD]),f(AN,F([hN(4),AT(Nk)]),f(Ki,r(function(e,t){return f(vN,F([AT(Nk),wA(a)]),e?t:f(qa,o,t))}),n.mainParagraphs)))},sH=function(e){return $(e,mr)?mr:F([f(AN,F([LU(20),X$(20),hN(10),TN,lx,AT(xk(300)),aN(15)]),f(tu,uH,f(Zd,function(e){return $(e.b.align,Yp)},f(Ki,r(function(e,t){return L(e,t)}),e)))),f(AN,F([oH(20),l_(100),hN(10),Sx,V$,AT(xk(300)),aN(15)]),f(tu,uH,f(Zd,function(e){return $(e.b.align,yB)},f(Ki,r(function(e,t){return L(e,t)}),e))))])},cH=r(function(e,t){var r=f(aH,e,t),n=r.a,a=r.b;return L(f(AN,F([kR(Pk),H$(RN(t)),AT(Nk),ET(Nk),KN(30)]),F([f(Bk,F([ET(xk(50))]),Rk),n])),O(a,sH(t.userNotices)))}),fH=r(function(e,t){return{$:"OnlyDynamic",a:e,b:t}}),lH=r(function(e,t){return{$:"StaticRootAndDynamic",a:e,b:t}}),dH={$:"AllowHover"},hH={$:"Layout"},pH={backgroundColor:ma,borderColor:ma,shadow:ya({blur:3,color:d(mA,155/255,203/255,1,1),offset:L(0,0),size:3})},gH=function(e){var t=r(function(e,t){switch(e.$){case"HoverOption":var r=e.a;return"Nothing"===t.hover.$?U(t,{hover:ya(r)}):t;case"FocusStyleOption":var n=e.a;return"Nothing"===t.focus.$?U(t,{focus:ya(n)}):t;default:var a=e.a;return"Nothing"===t.mode.$?U(t,{mode:ya(a)}):t}});return function(e){return{focus:function(){var t=e.focus;return"Nothing"===t.$?pH:t.a}(),hover:function(){var t=e.hover;return"Nothing"===t.$?dH:t.a}(),mode:function(){var t=e.mode;return"Nothing"===t.$?hH:t.a}()}}(l(Ja,t,{focus:ma,hover:ma,mode:ma},e))},vH=r(function(e,t){switch(t.$){case"Unstyled":var r=t.a;return r($T);case"Styled":var n=t.a.styles,r=t.a.html;return f(r,e(n),$T);case"Text":var a=t.a;return DI(a);default:return DI("")}}),yH=n(function(e,t,r){var n=gH(e),a=function(){return"NoStaticStyleSheet"===n.mode.$?fH(n):lH(n)}();return f(vH,a,d(gA,$T,Ak,t,NT(F([r]))))}),mH=aw(5),bH=r(function(e,t){return{$:"FontFamily",a:e,b:t}}),CH={$:"SansSerif"},SH=function(e){return{$:"Typeface",a:e}},EH=W,TH=r(function(e,t){return O(t,function(){switch(e.$){case"Serif":return"serif";case"SansSerif":return"sans-serif";case"Monospace":return"monospace";case"Typeface":var t=e.a;return f(qi,"-",EH(cl(t)));case"ImportFont":var t=e.a;e.b;return f(qi,"-",EH(cl(t)));default:var t=e.a.name;return f(qi,"-",EH(cl(t)))}}())}),wH=function(){var e=F([SH("Open Sans"),SH("Helvetica"),SH("Verdana"),CH]);return F([f(EA,_k,l(SA,"bg-color-"+TA(d(mA,1,1,1,0)),"background-color",d(mA,1,1,1,0))),f(EA,CA,l(SA,"font-color-"+TA(d(mA,0,0,0,1)),"color",d(mA,0,0,0,1))),f(EA,rN,nN(20)),f(EA,mH,f(bH,l(za,TH,"font-",e),e))])}(),IH=n(function(e,t,r){var n=e.options;return l(yH,n,f(qa,vA(f(qi," ",F([PT.root,PT.any,PT.single]))),O(wH,t)),r)}),AH=IH({options:mr}),BH=function(e){return f(EA,mH,f(bH,l(za,TH,"ff-",e),e))},kH=CH,NH=SH,RH=function(e){return{body:F([function(){var t=f(cH,e.screenWidth,e),r=t.a,n=t.b,a=O(F([AT(Nk),ET(Nk),BH(F([NH("Soleil"),kH]))]),f(tu,H$,n));return f(AH,a,r)}()]),title:"DAIHard"}},$H=jt,xH=$H({init:CB,onUrlChange:Ek,onUrlRequest:Sk,subscriptions:Ck,update:fB,view:RH});!function(t){e.Elm?We("Elm",e.Elm,t):e.Elm=t}({App:{init:xH(f(Ro,function(e){return f(Ro,function(t){return f(Ro,function(r){return _o({height:r,networkId:t,width:e})},f(Od,"height",ZC))},f(Od,"networkId",ZC))},f(Od,"width",ZC)))(0)}})}(this)},function(e,t,r){"use strict";function n(){"undefined"!=typeof web3?(window.ethereum&&(window.ethereum.autoRefreshOnNetworkChange=!1),web3.version.getNetwork(function(e,t){var r;e?(console.log("Error initializing web3: "+e),r=0):r=parseInt(t),window.app=s.Elm.App.init({node:document.getElementById("elm"),flags:{networkId:r,width:window.innerWidth,height:window.innerHeight}}),a(app),i(app,web3)})):(window.app=s.Elm.App.init({node:document.getElementById("elm"),flags:{networkId:0,width:window.innerWidth,height:window.innerHeight}}),a(app),console.log("Metamask not detected."))}function a(e){e.ports.gTagOut.subscribe(function(e){gtag("event",e.event,{event_category:e.category,event_label:e.label,value:e.value})})}function i(e,t){o(e,t),t.eth.getAccounts(function(r,n){n&&n.length>0&&u(e,t)})}function o(e,t){l.startWatching(e.ports.networkSentryPort,t),e.ports.connectToWeb3.subscribe(function(r){u(e,t)})}function u(e,t){window.ethereum&&!window.web3Connected&&(window.web3=new Web3(ethereum)),c.txSentry(e.ports.txOut,e.ports.txIn,t),c.walletSentry(e.ports.walletSentryPort,t),l.startWatching(e.ports.networkSentryPort,t),e.ports.genPrivkey.subscribe(function(t){f.prepareKeypair(t.signSeedMsg,t.address,function(t,r){console.log("pubkey: ",r),e.ports.userPubkeyResult.send(r)})}),e.ports.encryptToPubkeys.subscribe(function(t){var r=f.encryptToPubkeys(t.message,t.pubkeyHexStrings);e.ports.encryptionFinished.send(r)}),e.ports.decryptMessage.subscribe(function(t){var r=t.id,n=f.decryptForUser(t.encapsulation,t.iv,t.tag,t.encrypted);n||console.log("Uh oh! Decryption didn't work..."),e.ports.decryptionFinished.send({id:r,message:n})}),window.ethereum&&!window.web3Connected&&(ethereum.enable(),window.web3Connected=!0)}Object.defineProperty(t,"__esModule",{value:!0});var s=r(41),c=(r.n(s),r(40)),f=r(39),l=r(38);window.forge=r(22),window.web3Connected=!1,window.addEventListener("load",function(){n()})},function(e,t,r){"use strict";function n(e){var t=e.length;if(t%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var r=e.indexOf("=");return-1===r&&(r=t),[r,r===t?0:4-r%4]}function a(e){var t=n(e),r=t[0],a=t[1];return 3*(r+a)/4-a}function i(e,t,r){return 3*(t+r)/4-r}function o(e){for(var t,r=n(e),a=r[0],o=r[1],u=new d(i(e,a,o)),s=0,c=o>0?a-4:a,f=0;f>16&255,u[s++]=t>>8&255,u[s++]=255&t;return 2===o&&(t=l[e.charCodeAt(f)]<<2|l[e.charCodeAt(f+1)]>>4,u[s++]=255&t),1===o&&(t=l[e.charCodeAt(f)]<<10|l[e.charCodeAt(f+1)]<<4|l[e.charCodeAt(f+2)]>>2,u[s++]=t>>8&255,u[s++]=255&t),u}function u(e){return f[e>>18&63]+f[e>>12&63]+f[e>>6&63]+f[63&e]}function s(e,t,r){for(var n,a=[],i=t;io?o:i+16383));return 1===n?(t=e[r-1],a.push(f[t>>2]+f[t<<4&63]+"==")):2===n&&(t=(e[r-2]<<8)+e[r-1],a.push(f[t>>10]+f[t>>4&63]+f[t<<2&63]+"=")),a.join("")}t.byteLength=a,t.toByteArray=o,t.fromByteArray=c;for(var f=[],l=[],d="undefined"!=typeof Uint8Array?Uint8Array:Array,h="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",p=0,g=h.length;p>1,f=-7,l=r?a-1:0,d=r?-1:1,h=e[t+l];for(l+=d,i=h&(1<<-f)-1,h>>=-f,f+=u;f>0;i=256*i+e[t+l],l+=d,f-=8);for(o=i&(1<<-f)-1,i>>=-f,f+=n;f>0;o=256*o+e[t+l],l+=d,f-=8);if(0===i)i=1-c;else{if(i===s)return o?NaN:1/0*(h?-1:1);o+=Math.pow(2,n),i-=c}return(h?-1:1)*o*Math.pow(2,i-n)},t.write=function(e,t,r,n,a,i){var o,u,s,c=8*i-a-1,f=(1<>1,d=23===a?Math.pow(2,-24)-Math.pow(2,-77):0,h=n?0:i-1,p=n?1:-1,g=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(u=isNaN(t)?1:0,o=f):(o=Math.floor(Math.log(t)/Math.LN2),t*(s=Math.pow(2,-o))<1&&(o--,s*=2),t+=o+l>=1?d/s:d*Math.pow(2,1-l),t*s>=2&&(o++,s/=2),o+l>=f?(u=0,o=f):o+l>=1?(u=(t*s-1)*Math.pow(2,a),o+=l):(u=t*Math.pow(2,l-1)*Math.pow(2,a),o=0));a>=8;e[r+h]=255&u,h+=p,u/=256,a-=8);for(o=o<0;e[r+h]=255&o,h+=p,o/=256,c-=8);e[r+h-p]|=128*g}},function(e,t){var r={}.toString;e.exports=Array.isArray||function(e){return"[object Array]"==r.call(e)}},function(e,t,r){function n(e,t,r){var n=t.entity===c.tls.ConnectionEnd.client;e.read.cipherState={init:!1,cipher:c.cipher.createDecipher("AES-CBC",n?r.keys.server_write_key:r.keys.client_write_key),iv:n?r.keys.server_write_IV:r.keys.client_write_IV},e.write.cipherState={init:!1,cipher:c.cipher.createCipher("AES-CBC",n?r.keys.client_write_key:r.keys.server_write_key),iv:n?r.keys.client_write_IV:r.keys.server_write_IV},e.read.cipherFunction=u,e.write.cipherFunction=a,e.read.macLength=e.write.macLength=r.mac_length,e.read.macFunction=e.write.macFunction=f.hmac_sha1}function a(e,t){var r=!1,n=t.macFunction(t.macKey,t.sequenceNumber,e);e.fragment.putBytes(n),t.updateSequenceNumber();var a;a=e.version.minor===f.Versions.TLS_1_0.minor?t.cipherState.init?null:t.cipherState.iv:c.random.getBytesSync(16),t.cipherState.init=!0;var o=t.cipherState.cipher;return o.start({iv:a}),e.version.minor>=f.Versions.TLS_1_1.minor&&o.output.putBytes(a),o.update(e.fragment),o.finish(i)&&(e.fragment=o.output,e.length=e.fragment.length(),r=!0),r}function i(e,t,r){if(!r){var n=e-t.length()%e;t.fillWithByte(n-1,n)}return!0}function o(e,t,r){var n=!0;if(r){for(var a=t.length(),i=t.last(),o=a-1-i;o=i?(e.fragment=a.output.getBytes(d-i),u=a.output.getBytes(i)):e.fragment=a.output.getBytes(),e.fragment=c.util.createBuffer(e.fragment),e.length=e.fragment.length();var h=t.macFunction(t.macKey,t.sequenceNumber,e);return t.updateSequenceNumber(),r=s(t.macKey,u,h)&&r}function s(e,t,r){var n=c.hmac.create();return n.start("SHA1",e),n.update(t),t=n.digest().getBytes(),n.start(null,null),n.update(r),r=n.digest().getBytes(),t===r}var c=r(0);r(5),r(37);var f=e.exports=c.tls;f.CipherSuites.TLS_RSA_WITH_AES_128_CBC_SHA={id:[0,47],name:"TLS_RSA_WITH_AES_128_CBC_SHA",initSecurityParameters:function(e){e.bulk_cipher_algorithm=f.BulkCipherAlgorithm.aes,e.cipher_type=f.CipherType.block,e.enc_key_length=16,e.block_length=16,e.fixed_iv_length=16,e.record_iv_length=16,e.mac_algorithm=f.MACAlgorithm.hmac_sha1,e.mac_length=20,e.mac_key_length=20},initConnectionState:n},f.CipherSuites.TLS_RSA_WITH_AES_256_CBC_SHA={id:[0,53],name:"TLS_RSA_WITH_AES_256_CBC_SHA",initSecurityParameters:function(e){e.bulk_cipher_algorithm=f.BulkCipherAlgorithm.aes,e.cipher_type=f.CipherType.block,e.enc_key_length=32,e.block_length=16,e.fixed_iv_length=16,e.record_iv_length=16,e.mac_algorithm=f.MACAlgorithm.hmac_sha1,e.mac_length=20,e.mac_key_length=20},initConnectionState:n};var l=0},function(e,t,r){(function(t){function r(e,t){var r=0,n=t.length,a=t.charAt(0),i=[0];for(r=0;r0;)i.push(u%n),u=u/n|0}var s="";for(r=0;0===e.at(r)&&r=0;--r)s+=t[i[r]];return s}var n={};e.exports=n;var a={};n.encode=function(e,t,n){if("string"!=typeof t)throw new TypeError('"alphabet" must be a string.');if(void 0!==n&&"number"!=typeof n)throw new TypeError('"maxline" must be a number.');var a="";if(e instanceof Uint8Array){var i=0,o=t.length,u=t.charAt(0),s=[0];for(i=0;i0;)s.push(f%o),f=f/o|0}for(i=0;0===e[i]&&i=0;--i)a+=t[s[i]]}else a=r(e,t);if(n){var l=new RegExp(".{1,"+n+"}","g");a=a.match(l).join("\r\n")}return a},n.decode=function(e,r){if("string"!=typeof e)throw new TypeError('"input" must be a string.');if("string"!=typeof r)throw new TypeError('"alphabet" must be a string.');var n=a[r];if(!n){n=a[r]=[];for(var i=0;i>=8;for(;l>0;)s.push(255&l),l>>=8}for(var d=0;e[d]===u&&d=32;--n){for(r=0,a=n-32,i=n-12;a>8,t[a]-=256*r;t[a]+=r,t[n]=0}for(r=0,a=0;a<32;++a)t[a]+=r-(t[31]>>4)*H[a],r=t[a]>>8,t[a]&=255;for(a=0;a<32;++a)t[a]-=r*H[a];for(n=0;n<32;++n)t[n+1]+=t[n]>>8,e[n]=255&t[n]}function c(e){for(var t=new Float64Array(64),r=0;r<64;++r)t[r]=e[r],e[r]=0;s(e,t)}function f(e,t){var r=B(),n=B(),a=B(),i=B(),o=B(),u=B(),s=B(),c=B(),f=B();N(r,e[1],e[0]),N(f,t[1],t[0]),$(r,r,f),k(n,e[0],e[1]),k(f,t[0],t[1]),$(n,n,f),$(a,e[3],t[3]),$(a,a,F),$(i,e[2],t[2]),k(i,i,i),N(o,n,r),N(u,i,a),k(s,i,a),k(c,n,r),$(e[0],o,u),$(e[1],c,s),$(e[2],s,u),$(e[3],o,c)}function l(e,t,r){for(var n=0;n<4;++n)A(e[n],t[n],r)}function d(e,t){var r=B(),n=B(),a=B();w(a,t[2]),$(r,t[0],a),$(n,t[1],a),h(e,n),e[31]^=C(r)<<7}function h(e,t){var r,n,a,i=B(),o=B();for(r=0;r<16;++r)o[r]=t[r];for(I(o),I(o),I(o),n=0;n<2;++n){for(i[0]=o[0]-65517,r=1;r<15;++r)i[r]=o[r]-65535-(i[r-1]>>16&1),i[r-1]&=65535;i[15]=o[15]-32767-(i[14]>>16&1),a=i[15]>>16&1,i[14]&=65535,A(o,i,1-a)}for(r=0;r<16;r++)e[2*r]=255&o[r],e[2*r+1]=o[r]>>8}function p(e,t){var r=B(),n=B(),a=B(),i=B(),o=B(),u=B(),s=B();return T(e[2],O),g(e[1],t),R(a,e[1]),$(i,a,M),N(a,a,e[2]),k(i,e[2],i),R(o,i),R(u,o),$(s,u,o),$(r,s,a),$(r,r,i),v(r,r),$(r,r,a),$(r,r,i),$(r,r,i),$(e[0],r,i),R(n,e[0]),$(n,n,i),y(n,a)&&$(e[0],e[0],j),R(n,e[0]),$(n,n,i),y(n,a)?-1:(C(e[0])===t[31]>>7&&N(e[0],U,e[0]),$(e[3],e[0],e[1]),0)}function g(e,t){var r;for(r=0;r<16;++r)e[r]=t[2*r]+(t[2*r+1]<<8);e[15]&=32767}function v(e,t){var r,n=B();for(r=0;r<16;++r)n[r]=t[r];for(r=250;r>=0;--r)R(n,n),1!==r&&$(n,n,t);for(r=0;r<16;++r)e[r]=n[r]}function y(e,t){var r=new P(32),n=new P(32);return h(r,e),h(n,t),m(r,0,n,0)}function m(e,t,r,n){return b(e,t,r,n,32)}function b(e,t,r,n,a){var i,o=0;for(i=0;i>>8)-1}function C(e){var t=new P(32);return h(t,e),1&t[0]}function S(e,t,r){var n,a;for(T(e[0],U),T(e[1],O),T(e[2],O),T(e[3],U),a=255;a>=0;--a)n=r[a/8|0]>>(7&a)&1,l(e,t,n),f(t,e),f(e,e),l(e,t,n)}function E(e,t){var r=[B(),B(),B(),B()];T(r[0],V),T(r[1],K),T(r[2],O),$(r[3],V,K),S(e,r,t)}function T(e,t){var r;for(r=0;r<16;r++)e[r]=0|t[r]}function w(e,t){var r,n=B();for(r=0;r<16;++r)n[r]=t[r];for(r=253;r>=0;--r)R(n,n),2!==r&&4!==r&&$(n,n,t);for(r=0;r<16;++r)e[r]=n[r]}function I(e){var t,r,n=1;for(t=0;t<16;++t)r=e[t]+n+65535,n=Math.floor(r/65536),e[t]=r-65536*n;e[0]+=n-1+37*(n-1)}function A(e,t,r){for(var n,a=~(r-1),i=0;i<16;++i)n=a&(e[i]^t[i]),e[i]^=n,t[i]^=n}function B(e){var t,r=new Float64Array(16);if(e)for(t=0;t=0};var U=B(),O=B([1]),M=B([30883,4953,19914,30187,55467,16705,2637,112,59544,30585,16505,36039,65139,11119,27886,20995]),F=B([61785,9906,39828,60374,45398,33411,5274,224,53552,61171,33010,6542,64743,22239,55772,9222]),V=B([54554,36645,11616,51542,42930,38181,51040,26924,56412,64982,57905,49316,21502,52590,14035,8553]),K=B([26200,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214]),H=new Float64Array([237,211,245,92,26,99,18,88,214,156,247,162,222,249,222,20,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,16]),j=B([41136,18958,6951,50414,58488,44335,6150,12099,55207,15867,153,11085,57099,20417,9344,11139])}).call(t,r(10).Buffer)},function(e,t,r){function n(e,t,r,n){e.generate=function(e,i){for(var o=new a.util.ByteBuffer,u=Math.ceil(i/n)+r,s=new a.util.ByteBuffer,c=r;c0&&(o=a.util.fillString(String.fromCharCode(0),s)+o),{encapsulation:t.encrypt(o,"NONE"),key:e.generate(o,n)}},n.decrypt=function(t,r,n){var a=t.decrypt(r,"NONE");return e.generate(a,n)},n},a.kem.kdf1=function(e,t){n(this,e,0,t||e.digestLength)},a.kem.kdf2=function(e,t){n(this,e,1,t||e.digestLength)}},function(e,t,r){e.exports=r(4),r(16),r(9),r(35),r(36)},function(e,t,r){var n=r(0);r(26),e.exports=n.mgf=n.mgf||{},n.mgf.mgf1=n.mgf1},function(e,t,r){function n(e){var t={},r=[];if(!p.validate(e,g.asn1.recipientInfoValidator,t,r)){var n=new Error("Cannot read PKCS#7 RecipientInfo. ASN.1 object is not an PKCS#7 RecipientInfo.");throw n.errors=r,n}return{version:t.version.charCodeAt(0),issuer:h.pki.RDNAttributesAsArray(t.issuer),serialNumber:h.util.createBuffer(t.serial).toHex(),encryptedContent:{algorithm:p.derToOid(t.encAlgorithm),parameter:t.encParameter.value,content:t.encKey}}}function a(e){return p.create(p.Class.UNIVERSAL,p.Type.SEQUENCE,!0,[p.create(p.Class.UNIVERSAL,p.Type.INTEGER,!1,p.integerToDer(e.version).getBytes()),p.create(p.Class.UNIVERSAL,p.Type.SEQUENCE,!0,[h.pki.distinguishedNameToAsn1({attributes:e.issuer}),p.create(p.Class.UNIVERSAL,p.Type.INTEGER,!1,h.util.hexToBytes(e.serialNumber))]),p.create(p.Class.UNIVERSAL,p.Type.SEQUENCE,!0,[p.create(p.Class.UNIVERSAL,p.Type.OID,!1,p.oidToDer(e.encryptedContent.algorithm).getBytes()),p.create(p.Class.UNIVERSAL,p.Type.NULL,!1,"")]),p.create(p.Class.UNIVERSAL,p.Type.OCTETSTRING,!1,e.encryptedContent.content)])}function i(e){for(var t=[],r=0;r0){for(var r=p.create(p.Class.CONTEXT_SPECIFIC,1,!0,[]),n=0;n=r&&a0&&a.value[0].value.push(p.create(p.Class.CONTEXT_SPECIFIC,0,!0,e)),n.length>0&&a.value[0].value.push(p.create(p.Class.CONTEXT_SPECIFIC,1,!0,n)),a.value[0].value.push(p.create(p.Class.UNIVERSAL,p.Type.SET,!0,r.signerInfos)),p.create(p.Class.UNIVERSAL,p.Type.SEQUENCE,!0,[p.create(p.Class.UNIVERSAL,p.Type.OID,!1,p.oidToDer(r.type).getBytes()),a])},addSigner:function(e){var t=e.issuer,n=e.serialNumber;if(e.certificate){var a=e.certificate;"string"==typeof a&&(a=h.pki.certificateFromPem(a)),t=a.issuer.attributes,n=a.serialNumber}var i=e.key;if(!i)throw new Error("Could not add PKCS#7 signer; no private key specified.");"string"==typeof i&&(i=h.pki.privateKeyFromPem(i));var o=e.digestAlgorithm||h.pki.oids.sha1;switch(o){case h.pki.oids.sha1:case h.pki.oids.sha256:case h.pki.oids.sha384:case h.pki.oids.sha512:case h.pki.oids.md5:break;default:throw new Error("Could not add PKCS#7 signer; unknown message digest algorithm: "+o)}var u=e.authenticatedAttributes||[];if(u.length>0){for(var s=!1,c=!1,f=0;f="8"&&(r="00"+r);var n=o.util.hexToBytes(r);e.putInt32(n.length),e.putBytes(n)}function a(e,t){e.putInt32(t.length),e.putString(t)}function i(){for(var e=o.md.sha1.create(),t=arguments.length,r=0;r0&&(this.state=v[this.state].block)},y.prototype.unblock=function(e){return e=void 0===e?1:e,this.blocks-=e,0===this.blocks&&this.state!==d&&(this.state=c,b(this,0)),this.blocks},y.prototype.sleep=function(e){e=void 0===e?0:e,this.state=v[this.state].sleep;var t=this;this.timeoutId=setTimeout(function(){t.timeoutId=null,t.state=c,b(t,0)},e)},y.prototype.wait=function(e){e.wait(this)},y.prototype.wakeup=function(){this.state===l&&(cancelTimeout(this.timeoutId),this.timeoutId=null,this.state=c,b(this,0))},y.prototype.cancel=function(){this.state=v[this.state].cancel,this.permitsNeeded=0,null!==this.timeoutId&&(cancelTimeout(this.timeoutId),this.timeoutId=null),this.subtasks=[]},y.prototype.fail=function(e){if(this.error=!0,C(this,!0),e)e.error=this.error,e.swapTime=this.swapTime,e.userData=this.userData,b(e,0);else{if(null!==this.parent){for(var t=this.parent;null!==t.parent;)t.error=this.error,t.swapTime=this.swapTime,t.userData=this.userData,t=t.parent;C(t,!0)}this.failureCallback&&this.failureCallback(this)}};var m=function(e){e.error=!1,e.state=v[e.state][g],setTimeout(function(){e.state===c&&(e.swapTime=+new Date,e.run(e),b(e,0))},0)},b=function(e,t){var r=t>30||+new Date-e.swapTime>20,n=function(t){if(t++,e.state===c)if(r&&(e.swapTime=+new Date),e.subtasks.length>0){var n=e.subtasks.shift();n.error=e.error,n.swapTime=e.swapTime,n.userData=e.userData,n.run(n),n.error||b(n,t)}else C(e),e.error||null!==e.parent&&(e.parent.error=e.error,e.parent.swapTime=e.swapTime,e.parent.userData=e.userData,b(e.parent,t))};r?setTimeout(n,0):n(t)},C=function(e,t){e.state=d,delete i[e.id],null===e.parent&&(e.type in u?0===u[e.type].length?n.log.error(a,"[%s][%s] task queue empty [%s]",e.id,e.name,e.type):u[e.type][0]!==e?n.log.error(a,"[%s][%s] task not first in queue [%s]",e.id,e.name,e.type):(u[e.type].shift(),0===u[e.type].length?delete u[e.type]:u[e.type][0].start()):n.log.error(a,"[%s][%s] task queue missing [%s]",e.id,e.name,e.type),t||(e.error&&e.failureCallback?e.failureCallback(e):!e.error&&e.successCallback&&e.successCallback(e)))};e.exports=n.task=n.task||{},n.task.start=function(e){var t=new y({run:e.run,name:e.name||"?"});t.type=e.type,t.successCallback=e.success||null,t.failureCallback=e.failure||null,t.type in u?u[e.type].push(t):(u[t.type]=[t],m(t))},n.task.cancel=function(e){e in u&&(u[e]=[u[e][0]])},n.task.createCondition=function(){var e={tasks:{}};return e.wait=function(t){t.id in e.tasks||(t.block(),e.tasks[t.id]=t)},e.notify=function(){var t=e.tasks;e.tasks={};for(var r in t)t[r].unblock()},e}},function(e,t,r){(function(e,t){!function(e,r){"use strict";function n(e){"function"!=typeof e&&(e=new Function(""+e));for(var t=new Array(arguments.length-1),r=0;r=0&&(e._idleTimeoutId=setTimeout(function(){e._onTimeout&&e._onTimeout()},t))},r(55),t.setImmediate="undefined"!=typeof self&&self.setImmediate||void 0!==e&&e.setImmediate||this&&this.setImmediate,t.clearImmediate="undefined"!=typeof self&&self.clearImmediate||void 0!==e&&e.clearImmediate||this&&this.clearImmediate}).call(t,r(14))}]); \ No newline at end of file diff --git a/src/Landing/View.elm b/src/Landing/View.elm index 5433f4c..754cbbd 100644 --- a/src/Landing/View.elm +++ b/src/Landing/View.elm @@ -11,13 +11,21 @@ import Images exposing (Image) import Types exposing (..) -root : Msg -> Element Msg -root letsGoMsg = +root : Element Msg +root = + let + redText = + Element.el [ Element.Font.color EH.red ] << Element.text + + boldText = + Element.el [ Element.Font.bold ] << Element.text + in Element.column [ Element.width Element.fill , Element.height Element.fill , Element.Background.color EH.white , Element.Border.rounded 6 + , Element.spacing 50 , Element.Border.shadow { offset = ( 0, 3 ) , size = 0 @@ -25,170 +33,109 @@ root letsGoMsg = , color = Element.rgba255 0 0 0 0.1 } , Element.Border.rounded 10 - , Element.spaceEvenly , Element.padding 20 ] [ EH.coolCurrencyHbreak False Element.fill , Element.column [ Element.centerX - , Element.spacing 15 , Element.width (Element.fill |> Element.maximum 700) + , Element.spacing 20 ] - (List.map - (Element.paragraph - [ Element.width Element.fill - , Element.Font.size 17 - , Element.Font.medium - , Element.Font.color EH.permanentTextColor - , Element.Font.center - ] - ) - [ [ Element.el [ Element.Font.size 22, Element.Font.color EH.black ] <| Element.text "Hold on a second!" ] - , [ Element.text "This version of DAIHard is live and functional, but a Factory upgrade is coming soon." ] - , [ Element.text "When that upgrade hits, all current trades will be hidden in the new interface. So feel free to play around here if you want, but don't use the tool seriously in its current state." ] - , [ Element.text "If you'd like to keep up to date with our upgrades and progress, join our " - , Element.newTabLink - [ Element.Font.color EH.blue - , Element.Font.underline - ] - { url = "https://t.me/daihardexchange_group" - , label = Element.text "Telegram group" - } - , Element.text "." - ] + [ Element.paragraph + [ Element.Font.size 70 + , Element.Font.bold + , Element.centerX + , Element.Font.center + ] + [ Element.text "DAI" + , redText "Hard" + ] + , Element.row + [ Element.Font.size 30 + , Element.Font.semiBold + , Element.centerX + , Element.Font.center + , Element.Font.italic + ] + [ Element.text "The " + , redText "Global" + , Element.text ", " + , redText "Unkillable" + , Element.text " Crypto Gateway" ] - ) - - -- , Element.column - -- [ Element.centerX - -- , Element.spacing 25 - -- , Element.Font.center - -- ] - -- [ Element.paragraph - -- [ Element.Font.size 35 - -- , Element.Font.semiBold - -- ] - -- [ Element.text "Welcome to DAIHard!" ] - -- , Element.column - -- [ Element.centerX - -- , Element.spacing 5 - -- ] - -- (List.map - -- (Element.paragraph - -- [ Element.Font.size 17 - -- , Element.Font.medium - -- ] - -- ) - -- [ [ Element.text "Just a couple things to note below before you proceed." ] - -- , [ Element.text "This should make things go a bit smoother." ] - -- ] - -- ) - -- ] - -- , Element.rowcd d - -- [ Element.spaceEvenly - -- , Element.width Element.fill - -- ] - -- [ Element.el [ Element.width <| Element.px 1 ] Element.none - -- , Element.el [ Element.width <| Element.px 1 ] Element.none - -- , numberedNoteElement - -- 1 - -- "Confused?" - -- [ Element.text "See our " - -- , Element.newTabLink - -- [ Element.Font.color EH.blue - -- , Element.Font.underline - -- ] - -- { url = "https://www.reddit.com/r/ethereum/comments/bdetr2/daihard_the_unkillable_cryptofiat_gateway_any/" - -- , label = Element.text "announcement post" - -- } - -- , Element.text " for an overview of DAIHard, or the video " - -- , Element.newTabLink - -- [ Element.Font.color EH.blue - -- , Element.Font.underline - -- ] - -- { url = "https://www.youtube.com/watch?v=TaI1fCzhSt4" - -- , label = Element.text "Using DAIHard to Buy and Sell DAI" - -- } - -- , Element.text " for a quick usage demo." - -- ] - -- , numberedNoteElement - -- 2 - -- "Keep an Eye Out" - -- [ Element.text "Make sure you keep an eye on MetaMask for pending notifications or mining transactions; it doesn’t always pop up when it needs your attention." ] - -- , Element.el [ Element.width <| Element.px 1 ] Element.none - -- , Element.el [ Element.width <| Element.px 1 ] Element.none - -- ] - -- , Element.row - -- [ Element.spaceEvenly - -- , Element.width Element.fill - -- ] - -- [ Element.el [ Element.width <| Element.px 1 ] Element.none - -- , Element.el [ Element.width <| Element.px 1 ] Element.none - -- , numberedNoteElement - -- 3 - -- "Under Rapid Construction" - -- [ Element.text "We’re busy refining DaiHard and are regularly adding new functionality, so things might change quickly. Feel free to join our " - -- , Element.newTabLink - -- [ Element.Font.color EH.blue - -- , Element.Font.underline - -- ] - -- { url = "https://t.me/daihard_exchange" - -- , label = Element.text "Telegram channel" - -- } - -- , Element.text " for announcements." - -- ] - -- , numberedNoteElement - -- 4 - -- "Feedback, Please!" - -- [ Element.text "We’d love any feedback or critique you can possibly give us! We'll respond fastest if you use the " - -- , Element.newTabLink - -- [ Element.Font.color EH.blue - -- , Element.Font.underline - -- ] - -- { url = "https://t.me/daihardexchange_group" - -- , label = Element.text "Telegram group" - -- } - -- , Element.text "." - -- ] - -- , Element.el [ Element.width <| Element.px 1 ] Element.none - -- , Element.el [ Element.width <| Element.px 1 ] Element.none - -- ] - , Element.el - [ Element.centerX - , Element.Events.onClick <| - AppCmd <| - AppCmd.GTag <| - { event = "lets-go-clicked" - , category = "landing-page" - , label = "\"Let's Go\" clicked" - , value = 0 - } ] - (EH.redButton "Okay, got it. let's go!" letsGoMsg) - , EH.coolCurrencyHbreak True Element.fill - ] - - -numberedNoteElement : Int -> String -> List (Element msg) -> Element msg -numberedNoteElement number title textElList = - Element.column - [ Element.width (Element.fill |> Element.maximum 400) - , Element.spacing 10 - , Element.alignTop - ] - [ Images.toElement [ Element.centerX ] <| Images.numberOnCircleEl number - , Element.el - [ Element.Font.size 20 - , Element.Font.semiBold + , Element.row + [ Element.Background.color EH.darkGray + , Element.spacing 2 , Element.centerX + , Element.alignTop + , Element.width Element.fill ] - (Element.text title) - , Element.paragraph - [ Element.width Element.fill - , Element.Font.size 17 - , Element.Font.medium - , Element.Font.color EH.permanentTextColor - , Element.Font.center + [ Element.el + [ Element.paddingXY 40 10 + , Element.Background.color EH.white + , Element.width Element.fill + , Element.height Element.fill + ] + (Element.column + [ Element.spacing 60 + , Element.alignRight + ] + [ Element.el + [ Element.Font.size 40 + , Element.Font.semiBold + , Element.centerX + ] + (Element.text "Want to learn more?") + , Element.link + [ Element.Border.rounded 4 + , Element.pointer + , Element.paddingXY 25 17 + , Element.Background.color EH.blue + , Element.Font.color EH.white + , Element.Font.bold + , Element.Font.size 24 + , Element.centerX + ] + { url = "http://daihard.io" + , label = + Element.paragraph + [ Element.Font.center ] + [ Element.text "Go to the DAIHard Info page" ] + } + ] + ) + , Element.el + [ Element.paddingXY 40 10 + , Element.Background.color EH.white + , Element.width Element.fill + , Element.height Element.fill + ] + (Element.column + [ Element.alignLeft + , Element.spacing 60 + ] + [ Element.el + [ Element.Font.size 40 + , Element.Font.semiBold + , Element.centerX + ] + (Element.text "Ready to try it out?") + , Element.paragraph + [ Element.Font.size 24 + , Element.centerX + , Element.width <| Element.px 400 + ] + [ Element.text "Follow the links at the top of this page to browse " + , boldText "Sell Offers" + , Element.text ", browse " + , boldText "Buy Offers" + , Element.text ", or " + , boldText "Create Your Own Offer" + , Element.text "." + ] + ] + ) ] - textElList + , Element.el [ Element.alignBottom ] <| EH.coolCurrencyHbreak True Element.fill ] diff --git a/src/View.elm b/src/View.elm index 1690bfc..b512c2f 100644 --- a/src/View.elm +++ b/src/View.elm @@ -378,7 +378,7 @@ submodelElementAndModal screenWidth model = ( submodelEl, modalEls ) = case model.submodel of BetaLandingPage -> - ( Landing.View.root (GotoRoute <| Routing.Marketplace Buyer) + ( Landing.View.root , [] )