diff --git a/assets/static/img/add-circle-bold.svg b/assets/static/img/add-circle-bold.svg new file mode 100644 index 0000000..9bd71f8 --- /dev/null +++ b/assets/static/img/add-circle-bold.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/assets/static/img/currencies/crypto/A.png b/assets/static/img/currencies/crypto/A.png new file mode 100644 index 0000000..b71e776 Binary files /dev/null and b/assets/static/img/currencies/crypto/A.png differ diff --git a/assets/static/img/currencies/crypto/ABBC.png b/assets/static/img/currencies/crypto/ABBC.png new file mode 100644 index 0000000..da5fa11 Binary files /dev/null and b/assets/static/img/currencies/crypto/ABBC.png differ diff --git a/assets/static/img/currencies/crypto/ABT.png b/assets/static/img/currencies/crypto/ABT.png new file mode 100644 index 0000000..59b2c3d Binary files /dev/null and b/assets/static/img/currencies/crypto/ABT.png differ diff --git a/assets/static/img/currencies/crypto/ADA.png b/assets/static/img/currencies/crypto/ADA.png new file mode 100644 index 0000000..042d868 Binary files /dev/null and b/assets/static/img/currencies/crypto/ADA.png differ diff --git a/assets/static/img/currencies/crypto/AE.png b/assets/static/img/currencies/crypto/AE.png new file mode 100644 index 0000000..7d6abcf Binary files /dev/null and b/assets/static/img/currencies/crypto/AE.png differ diff --git a/assets/static/img/currencies/crypto/AGI.png b/assets/static/img/currencies/crypto/AGI.png new file mode 100644 index 0000000..a091d29 Binary files /dev/null and b/assets/static/img/currencies/crypto/AGI.png differ diff --git a/assets/static/img/currencies/crypto/AION.png b/assets/static/img/currencies/crypto/AION.png new file mode 100644 index 0000000..24a888f Binary files /dev/null and b/assets/static/img/currencies/crypto/AION.png differ diff --git a/assets/static/img/currencies/crypto/ALGO.png b/assets/static/img/currencies/crypto/ALGO.png new file mode 100644 index 0000000..0f01922 Binary files /dev/null and b/assets/static/img/currencies/crypto/ALGO.png differ diff --git a/assets/static/img/currencies/crypto/ANT.png b/assets/static/img/currencies/crypto/ANT.png new file mode 100644 index 0000000..db4b59b Binary files /dev/null and b/assets/static/img/currencies/crypto/ANT.png differ diff --git a/assets/static/img/currencies/crypto/AOA.png b/assets/static/img/currencies/crypto/AOA.png new file mode 100644 index 0000000..1952d07 Binary files /dev/null and b/assets/static/img/currencies/crypto/AOA.png differ diff --git a/assets/static/img/currencies/crypto/ARDR.png b/assets/static/img/currencies/crypto/ARDR.png new file mode 100644 index 0000000..eb86bde Binary files /dev/null and b/assets/static/img/currencies/crypto/ARDR.png differ diff --git a/assets/static/img/currencies/crypto/ARK.png b/assets/static/img/currencies/crypto/ARK.png new file mode 100644 index 0000000..a0c7f8d Binary files /dev/null and b/assets/static/img/currencies/crypto/ARK.png differ diff --git a/assets/static/img/currencies/crypto/ATOM.png b/assets/static/img/currencies/crypto/ATOM.png new file mode 100644 index 0000000..1651596 Binary files /dev/null and b/assets/static/img/currencies/crypto/ATOM.png differ diff --git a/assets/static/img/currencies/crypto/BAT.png b/assets/static/img/currencies/crypto/BAT.png new file mode 100644 index 0000000..4af9334 Binary files /dev/null and b/assets/static/img/currencies/crypto/BAT.png differ diff --git a/assets/static/img/currencies/crypto/BCD.png b/assets/static/img/currencies/crypto/BCD.png new file mode 100644 index 0000000..4606c10 Binary files /dev/null and b/assets/static/img/currencies/crypto/BCD.png differ diff --git a/assets/static/img/currencies/crypto/BCH.png b/assets/static/img/currencies/crypto/BCH.png new file mode 100644 index 0000000..1d6486e Binary files /dev/null and b/assets/static/img/currencies/crypto/BCH.png differ diff --git a/assets/static/img/currencies/crypto/BCN.png b/assets/static/img/currencies/crypto/BCN.png new file mode 100644 index 0000000..3c04051 Binary files /dev/null and b/assets/static/img/currencies/crypto/BCN.png differ diff --git a/assets/static/img/currencies/crypto/BCV.png b/assets/static/img/currencies/crypto/BCV.png new file mode 100644 index 0000000..47b11cf Binary files /dev/null and b/assets/static/img/currencies/crypto/BCV.png differ diff --git a/assets/static/img/currencies/crypto/BEAM.png b/assets/static/img/currencies/crypto/BEAM.png new file mode 100644 index 0000000..d0054d0 Binary files /dev/null and b/assets/static/img/currencies/crypto/BEAM.png differ diff --git a/assets/static/img/currencies/crypto/BFT.png b/assets/static/img/currencies/crypto/BFT.png new file mode 100644 index 0000000..74eef83 Binary files /dev/null and b/assets/static/img/currencies/crypto/BFT.png differ diff --git a/assets/static/img/currencies/crypto/BHP.png b/assets/static/img/currencies/crypto/BHP.png new file mode 100644 index 0000000..807599b Binary files /dev/null and b/assets/static/img/currencies/crypto/BHP.png differ diff --git a/assets/static/img/currencies/crypto/BIX.png b/assets/static/img/currencies/crypto/BIX.png new file mode 100644 index 0000000..4905509 Binary files /dev/null and b/assets/static/img/currencies/crypto/BIX.png differ diff --git a/assets/static/img/currencies/crypto/BMC.png b/assets/static/img/currencies/crypto/BMC.png new file mode 100644 index 0000000..6232c4e Binary files /dev/null and b/assets/static/img/currencies/crypto/BMC.png differ diff --git a/assets/static/img/currencies/crypto/BNB.png b/assets/static/img/currencies/crypto/BNB.png new file mode 100644 index 0000000..9b6b244 Binary files /dev/null and b/assets/static/img/currencies/crypto/BNB.png differ diff --git a/assets/static/img/currencies/crypto/BNT.png b/assets/static/img/currencies/crypto/BNT.png new file mode 100644 index 0000000..9799180 Binary files /dev/null and b/assets/static/img/currencies/crypto/BNT.png differ diff --git a/assets/static/img/currencies/crypto/BRD.png b/assets/static/img/currencies/crypto/BRD.png new file mode 100644 index 0000000..faecf52 Binary files /dev/null and b/assets/static/img/currencies/crypto/BRD.png differ diff --git a/assets/static/img/currencies/crypto/BSV.png b/assets/static/img/currencies/crypto/BSV.png new file mode 100644 index 0000000..51699a2 Binary files /dev/null and b/assets/static/img/currencies/crypto/BSV.png differ diff --git a/assets/static/img/currencies/crypto/BTC.png b/assets/static/img/currencies/crypto/BTC.png new file mode 100644 index 0000000..8a3b230 Binary files /dev/null and b/assets/static/img/currencies/crypto/BTC.png differ diff --git a/assets/static/img/currencies/crypto/BTG.png b/assets/static/img/currencies/crypto/BTG.png new file mode 100644 index 0000000..8b0f58a Binary files /dev/null and b/assets/static/img/currencies/crypto/BTG.png differ diff --git a/assets/static/img/currencies/crypto/BTM.png b/assets/static/img/currencies/crypto/BTM.png new file mode 100644 index 0000000..9517cc3 Binary files /dev/null and b/assets/static/img/currencies/crypto/BTM.png differ diff --git a/assets/static/img/currencies/crypto/BTS.png b/assets/static/img/currencies/crypto/BTS.png new file mode 100644 index 0000000..f03b7d1 Binary files /dev/null and b/assets/static/img/currencies/crypto/BTS.png differ diff --git a/assets/static/img/currencies/crypto/BTT.png b/assets/static/img/currencies/crypto/BTT.png new file mode 100644 index 0000000..fa6c712 Binary files /dev/null and b/assets/static/img/currencies/crypto/BTT.png differ diff --git a/assets/static/img/currencies/crypto/C20.png b/assets/static/img/currencies/crypto/C20.png new file mode 100644 index 0000000..efde976 Binary files /dev/null and b/assets/static/img/currencies/crypto/C20.png differ diff --git a/assets/static/img/currencies/crypto/CELR.png b/assets/static/img/currencies/crypto/CELR.png new file mode 100644 index 0000000..d2a1357 Binary files /dev/null and b/assets/static/img/currencies/crypto/CELR.png differ diff --git a/assets/static/img/currencies/crypto/CHZ.png b/assets/static/img/currencies/crypto/CHZ.png new file mode 100644 index 0000000..dba1bdb Binary files /dev/null and b/assets/static/img/currencies/crypto/CHZ.png differ diff --git a/assets/static/img/currencies/crypto/CMT.png b/assets/static/img/currencies/crypto/CMT.png new file mode 100644 index 0000000..28312c3 Binary files /dev/null and b/assets/static/img/currencies/crypto/CMT.png differ diff --git a/assets/static/img/currencies/crypto/COCOS.png b/assets/static/img/currencies/crypto/COCOS.png new file mode 100644 index 0000000..35de229 Binary files /dev/null and b/assets/static/img/currencies/crypto/COCOS.png differ diff --git a/assets/static/img/currencies/crypto/COS.png b/assets/static/img/currencies/crypto/COS.png new file mode 100644 index 0000000..0dfa56e Binary files /dev/null and b/assets/static/img/currencies/crypto/COS.png differ diff --git a/assets/static/img/currencies/crypto/CRO.png b/assets/static/img/currencies/crypto/CRO.png new file mode 100644 index 0000000..9e899be Binary files /dev/null and b/assets/static/img/currencies/crypto/CRO.png differ diff --git a/assets/static/img/currencies/crypto/CRPT.png b/assets/static/img/currencies/crypto/CRPT.png new file mode 100644 index 0000000..4f5220a Binary files /dev/null and b/assets/static/img/currencies/crypto/CRPT.png differ diff --git a/assets/static/img/currencies/crypto/CS.png b/assets/static/img/currencies/crypto/CS.png new file mode 100644 index 0000000..8943143 Binary files /dev/null and b/assets/static/img/currencies/crypto/CS.png differ diff --git a/assets/static/img/currencies/crypto/CVC.png b/assets/static/img/currencies/crypto/CVC.png new file mode 100644 index 0000000..679c9ad Binary files /dev/null and b/assets/static/img/currencies/crypto/CVC.png differ diff --git a/assets/static/img/currencies/crypto/CVNT.png b/assets/static/img/currencies/crypto/CVNT.png new file mode 100644 index 0000000..8f6ab24 Binary files /dev/null and b/assets/static/img/currencies/crypto/CVNT.png differ diff --git a/assets/static/img/currencies/crypto/DAC.png b/assets/static/img/currencies/crypto/DAC.png new file mode 100644 index 0000000..39c49c3 Binary files /dev/null and b/assets/static/img/currencies/crypto/DAC.png differ diff --git a/assets/static/img/currencies/crypto/DAI.png b/assets/static/img/currencies/crypto/DAI.png new file mode 100644 index 0000000..0ea3ac6 Binary files /dev/null and b/assets/static/img/currencies/crypto/DAI.png differ diff --git a/assets/static/img/currencies/crypto/DASH.png b/assets/static/img/currencies/crypto/DASH.png new file mode 100644 index 0000000..2fc5287 Binary files /dev/null and b/assets/static/img/currencies/crypto/DASH.png differ diff --git a/assets/static/img/currencies/crypto/DCR.png b/assets/static/img/currencies/crypto/DCR.png new file mode 100644 index 0000000..59e6c5f Binary files /dev/null and b/assets/static/img/currencies/crypto/DCR.png differ diff --git a/assets/static/img/currencies/crypto/DENT.png b/assets/static/img/currencies/crypto/DENT.png new file mode 100644 index 0000000..b5cf9e3 Binary files /dev/null and b/assets/static/img/currencies/crypto/DENT.png differ diff --git a/assets/static/img/currencies/crypto/DEX.png b/assets/static/img/currencies/crypto/DEX.png new file mode 100644 index 0000000..e15963d Binary files /dev/null and b/assets/static/img/currencies/crypto/DEX.png differ diff --git a/assets/static/img/currencies/crypto/DGB.png b/assets/static/img/currencies/crypto/DGB.png new file mode 100644 index 0000000..4fb6ce6 Binary files /dev/null and b/assets/static/img/currencies/crypto/DGB.png differ diff --git a/assets/static/img/currencies/crypto/DGD.png b/assets/static/img/currencies/crypto/DGD.png new file mode 100644 index 0000000..cf950f5 Binary files /dev/null and b/assets/static/img/currencies/crypto/DGD.png differ diff --git a/assets/static/img/currencies/crypto/DGTX.png b/assets/static/img/currencies/crypto/DGTX.png new file mode 100644 index 0000000..d02bcc7 Binary files /dev/null and b/assets/static/img/currencies/crypto/DGTX.png differ diff --git a/assets/static/img/currencies/crypto/DIVI.png b/assets/static/img/currencies/crypto/DIVI.png new file mode 100644 index 0000000..a5bb8a5 Binary files /dev/null and b/assets/static/img/currencies/crypto/DIVI.png differ diff --git a/assets/static/img/currencies/crypto/DOGE.png b/assets/static/img/currencies/crypto/DOGE.png new file mode 100644 index 0000000..128f4d1 Binary files /dev/null and b/assets/static/img/currencies/crypto/DOGE.png differ diff --git a/assets/static/img/currencies/crypto/DRG.png b/assets/static/img/currencies/crypto/DRG.png new file mode 100644 index 0000000..d1d899c Binary files /dev/null and b/assets/static/img/currencies/crypto/DRG.png differ diff --git a/assets/static/img/currencies/crypto/EDC.png b/assets/static/img/currencies/crypto/EDC.png new file mode 100644 index 0000000..8b787a8 Binary files /dev/null and b/assets/static/img/currencies/crypto/EDC.png differ diff --git a/assets/static/img/currencies/crypto/EDO.png b/assets/static/img/currencies/crypto/EDO.png new file mode 100644 index 0000000..ec1b325 Binary files /dev/null and b/assets/static/img/currencies/crypto/EDO.png differ diff --git a/assets/static/img/currencies/crypto/EGT.png b/assets/static/img/currencies/crypto/EGT.png new file mode 100644 index 0000000..3fbbaa8 Binary files /dev/null and b/assets/static/img/currencies/crypto/EGT.png differ diff --git a/assets/static/img/currencies/crypto/ELA.png b/assets/static/img/currencies/crypto/ELA.png new file mode 100644 index 0000000..aef8217 Binary files /dev/null and b/assets/static/img/currencies/crypto/ELA.png differ diff --git a/assets/static/img/currencies/crypto/ELF.png b/assets/static/img/currencies/crypto/ELF.png new file mode 100644 index 0000000..3a00ddb Binary files /dev/null and b/assets/static/img/currencies/crypto/ELF.png differ diff --git a/assets/static/img/currencies/crypto/ENG.png b/assets/static/img/currencies/crypto/ENG.png new file mode 100644 index 0000000..27a6b14 Binary files /dev/null and b/assets/static/img/currencies/crypto/ENG.png differ diff --git a/assets/static/img/currencies/crypto/ENJ.png b/assets/static/img/currencies/crypto/ENJ.png new file mode 100644 index 0000000..36aa412 Binary files /dev/null and b/assets/static/img/currencies/crypto/ENJ.png differ diff --git a/assets/static/img/currencies/crypto/EOS.png b/assets/static/img/currencies/crypto/EOS.png new file mode 100644 index 0000000..caef014 Binary files /dev/null and b/assets/static/img/currencies/crypto/EOS.png differ diff --git a/assets/static/img/currencies/crypto/ETC.png b/assets/static/img/currencies/crypto/ETC.png new file mode 100644 index 0000000..49fe9e4 Binary files /dev/null and b/assets/static/img/currencies/crypto/ETC.png differ diff --git a/assets/static/img/currencies/crypto/ETH.png b/assets/static/img/currencies/crypto/ETH.png new file mode 100644 index 0000000..4672dd0 Binary files /dev/null and b/assets/static/img/currencies/crypto/ETH.png differ diff --git a/assets/static/img/currencies/crypto/ETN.png b/assets/static/img/currencies/crypto/ETN.png new file mode 100644 index 0000000..be95889 Binary files /dev/null and b/assets/static/img/currencies/crypto/ETN.png differ diff --git a/assets/static/img/currencies/crypto/ETP.png b/assets/static/img/currencies/crypto/ETP.png new file mode 100644 index 0000000..4ad9c79 Binary files /dev/null and b/assets/static/img/currencies/crypto/ETP.png differ diff --git a/assets/static/img/currencies/crypto/EURS.png b/assets/static/img/currencies/crypto/EURS.png new file mode 100644 index 0000000..e00acbc Binary files /dev/null and b/assets/static/img/currencies/crypto/EURS.png differ diff --git a/assets/static/img/currencies/crypto/FCT.png b/assets/static/img/currencies/crypto/FCT.png new file mode 100644 index 0000000..a6123d9 Binary files /dev/null and b/assets/static/img/currencies/crypto/FCT.png differ diff --git a/assets/static/img/currencies/crypto/FET.png b/assets/static/img/currencies/crypto/FET.png new file mode 100644 index 0000000..dbf5528 Binary files /dev/null and b/assets/static/img/currencies/crypto/FET.png differ diff --git a/assets/static/img/currencies/crypto/FSN.png b/assets/static/img/currencies/crypto/FSN.png new file mode 100644 index 0000000..88e4573 Binary files /dev/null and b/assets/static/img/currencies/crypto/FSN.png differ diff --git a/assets/static/img/currencies/crypto/FTM.png b/assets/static/img/currencies/crypto/FTM.png new file mode 100644 index 0000000..327d5ed Binary files /dev/null and b/assets/static/img/currencies/crypto/FTM.png differ diff --git a/assets/static/img/currencies/crypto/FUN.png b/assets/static/img/currencies/crypto/FUN.png new file mode 100644 index 0000000..629fdf2 Binary files /dev/null and b/assets/static/img/currencies/crypto/FUN.png differ diff --git a/assets/static/img/currencies/crypto/FX.png b/assets/static/img/currencies/crypto/FX.png new file mode 100644 index 0000000..3d5eea0 Binary files /dev/null and b/assets/static/img/currencies/crypto/FX.png differ diff --git a/assets/static/img/currencies/crypto/GAS.png b/assets/static/img/currencies/crypto/GAS.png new file mode 100644 index 0000000..e6b9c13 Binary files /dev/null and b/assets/static/img/currencies/crypto/GAS.png differ diff --git a/assets/static/img/currencies/crypto/GNO.png b/assets/static/img/currencies/crypto/GNO.png new file mode 100644 index 0000000..417ca97 Binary files /dev/null and b/assets/static/img/currencies/crypto/GNO.png differ diff --git a/assets/static/img/currencies/crypto/GNT.png b/assets/static/img/currencies/crypto/GNT.png new file mode 100644 index 0000000..4a5e90c Binary files /dev/null and b/assets/static/img/currencies/crypto/GNT.png differ diff --git a/assets/static/img/currencies/crypto/GRIN.png b/assets/static/img/currencies/crypto/GRIN.png new file mode 100644 index 0000000..622974c Binary files /dev/null and b/assets/static/img/currencies/crypto/GRIN.png differ diff --git a/assets/static/img/currencies/crypto/GRS.png b/assets/static/img/currencies/crypto/GRS.png new file mode 100644 index 0000000..a2a0a5a Binary files /dev/null and b/assets/static/img/currencies/crypto/GRS.png differ diff --git a/assets/static/img/currencies/crypto/GXC.png b/assets/static/img/currencies/crypto/GXC.png new file mode 100644 index 0000000..61d3087 Binary files /dev/null and b/assets/static/img/currencies/crypto/GXC.png differ diff --git a/assets/static/img/currencies/crypto/HC.png b/assets/static/img/currencies/crypto/HC.png new file mode 100644 index 0000000..cf2ccda Binary files /dev/null and b/assets/static/img/currencies/crypto/HC.png differ diff --git a/assets/static/img/currencies/crypto/HEDG.png b/assets/static/img/currencies/crypto/HEDG.png new file mode 100644 index 0000000..2e7ff61 Binary files /dev/null and b/assets/static/img/currencies/crypto/HEDG.png differ diff --git a/assets/static/img/currencies/crypto/HOT.png b/assets/static/img/currencies/crypto/HOT.png new file mode 100644 index 0000000..12ac7ca Binary files /dev/null and b/assets/static/img/currencies/crypto/HOT.png differ diff --git a/assets/static/img/currencies/crypto/HPB.png b/assets/static/img/currencies/crypto/HPB.png new file mode 100644 index 0000000..b0b4d9b Binary files /dev/null and b/assets/static/img/currencies/crypto/HPB.png differ diff --git a/assets/static/img/currencies/crypto/HT.png b/assets/static/img/currencies/crypto/HT.png new file mode 100644 index 0000000..9691de9 Binary files /dev/null and b/assets/static/img/currencies/crypto/HT.png differ diff --git a/assets/static/img/currencies/crypto/HYN.png b/assets/static/img/currencies/crypto/HYN.png new file mode 100644 index 0000000..adb874e Binary files /dev/null and b/assets/static/img/currencies/crypto/HYN.png differ diff --git a/assets/static/img/currencies/crypto/ICX.png b/assets/static/img/currencies/crypto/ICX.png new file mode 100644 index 0000000..bf35a77 Binary files /dev/null and b/assets/static/img/currencies/crypto/ICX.png differ diff --git a/assets/static/img/currencies/crypto/IGNIS.png b/assets/static/img/currencies/crypto/IGNIS.png new file mode 100644 index 0000000..ac1ac3f Binary files /dev/null and b/assets/static/img/currencies/crypto/IGNIS.png differ diff --git a/assets/static/img/currencies/crypto/INB.png b/assets/static/img/currencies/crypto/INB.png new file mode 100644 index 0000000..f1e7660 Binary files /dev/null and b/assets/static/img/currencies/crypto/INB.png differ diff --git a/assets/static/img/currencies/crypto/IOST.png b/assets/static/img/currencies/crypto/IOST.png new file mode 100644 index 0000000..24436d0 Binary files /dev/null and b/assets/static/img/currencies/crypto/IOST.png differ diff --git a/assets/static/img/currencies/crypto/IOTX.png b/assets/static/img/currencies/crypto/IOTX.png new file mode 100644 index 0000000..1aa09b2 Binary files /dev/null and b/assets/static/img/currencies/crypto/IOTX.png differ diff --git a/assets/static/img/currencies/crypto/ITC.png b/assets/static/img/currencies/crypto/ITC.png new file mode 100644 index 0000000..114f9eb Binary files /dev/null and b/assets/static/img/currencies/crypto/ITC.png differ diff --git a/assets/static/img/currencies/crypto/KCS.png b/assets/static/img/currencies/crypto/KCS.png new file mode 100644 index 0000000..04dea50 Binary files /dev/null and b/assets/static/img/currencies/crypto/KCS.png differ diff --git a/assets/static/img/currencies/crypto/KMD.png b/assets/static/img/currencies/crypto/KMD.png new file mode 100644 index 0000000..1e336ba Binary files /dev/null and b/assets/static/img/currencies/crypto/KMD.png differ diff --git a/assets/static/img/currencies/crypto/KNC.png b/assets/static/img/currencies/crypto/KNC.png new file mode 100644 index 0000000..f45ac37 Binary files /dev/null and b/assets/static/img/currencies/crypto/KNC.png differ diff --git a/assets/static/img/currencies/crypto/LAMB.png b/assets/static/img/currencies/crypto/LAMB.png new file mode 100644 index 0000000..1574eb9 Binary files /dev/null and b/assets/static/img/currencies/crypto/LAMB.png differ diff --git a/assets/static/img/currencies/crypto/LCC.png b/assets/static/img/currencies/crypto/LCC.png new file mode 100644 index 0000000..8fe1b14 Binary files /dev/null and b/assets/static/img/currencies/crypto/LCC.png differ diff --git a/assets/static/img/currencies/crypto/LEO.png b/assets/static/img/currencies/crypto/LEO.png new file mode 100644 index 0000000..b6d6951 Binary files /dev/null and b/assets/static/img/currencies/crypto/LEO.png differ diff --git a/assets/static/img/currencies/crypto/LINA.png b/assets/static/img/currencies/crypto/LINA.png new file mode 100644 index 0000000..64aaf05 Binary files /dev/null and b/assets/static/img/currencies/crypto/LINA.png differ diff --git a/assets/static/img/currencies/crypto/LINK.png b/assets/static/img/currencies/crypto/LINK.png new file mode 100644 index 0000000..d8ecf2f Binary files /dev/null and b/assets/static/img/currencies/crypto/LINK.png differ diff --git a/assets/static/img/currencies/crypto/LOOM.png b/assets/static/img/currencies/crypto/LOOM.png new file mode 100644 index 0000000..420f783 Binary files /dev/null and b/assets/static/img/currencies/crypto/LOOM.png differ diff --git a/assets/static/img/currencies/crypto/LRC.png b/assets/static/img/currencies/crypto/LRC.png new file mode 100644 index 0000000..766ebf6 Binary files /dev/null and b/assets/static/img/currencies/crypto/LRC.png differ diff --git a/assets/static/img/currencies/crypto/LSK.png b/assets/static/img/currencies/crypto/LSK.png new file mode 100644 index 0000000..9666243 Binary files /dev/null and b/assets/static/img/currencies/crypto/LSK.png differ diff --git a/assets/static/img/currencies/crypto/LTC.png b/assets/static/img/currencies/crypto/LTC.png new file mode 100644 index 0000000..8ad8093 Binary files /dev/null and b/assets/static/img/currencies/crypto/LTC.png differ diff --git a/assets/static/img/currencies/crypto/MAID.png b/assets/static/img/currencies/crypto/MAID.png new file mode 100644 index 0000000..a0487f8 Binary files /dev/null and b/assets/static/img/currencies/crypto/MAID.png differ diff --git a/assets/static/img/currencies/crypto/MANA.png b/assets/static/img/currencies/crypto/MANA.png new file mode 100644 index 0000000..9532d4b Binary files /dev/null and b/assets/static/img/currencies/crypto/MANA.png differ diff --git a/assets/static/img/currencies/crypto/MATIC.png b/assets/static/img/currencies/crypto/MATIC.png new file mode 100644 index 0000000..79709a1 Binary files /dev/null and b/assets/static/img/currencies/crypto/MATIC.png differ diff --git a/assets/static/img/currencies/crypto/MCO.png b/assets/static/img/currencies/crypto/MCO.png new file mode 100644 index 0000000..e861b71 Binary files /dev/null and b/assets/static/img/currencies/crypto/MCO.png differ diff --git a/assets/static/img/currencies/crypto/MEDX.png b/assets/static/img/currencies/crypto/MEDX.png new file mode 100644 index 0000000..839045c Binary files /dev/null and b/assets/static/img/currencies/crypto/MEDX.png differ diff --git a/assets/static/img/currencies/crypto/MIOTA.png b/assets/static/img/currencies/crypto/MIOTA.png new file mode 100644 index 0000000..d7414d5 Binary files /dev/null and b/assets/static/img/currencies/crypto/MIOTA.png differ diff --git a/assets/static/img/currencies/crypto/MKR.png b/assets/static/img/currencies/crypto/MKR.png new file mode 100644 index 0000000..891cf48 Binary files /dev/null and b/assets/static/img/currencies/crypto/MKR.png differ diff --git a/assets/static/img/currencies/crypto/MONA.png b/assets/static/img/currencies/crypto/MONA.png new file mode 100644 index 0000000..6a07ca2 Binary files /dev/null and b/assets/static/img/currencies/crypto/MONA.png differ diff --git a/assets/static/img/currencies/crypto/MTL.png b/assets/static/img/currencies/crypto/MTL.png new file mode 100644 index 0000000..995284c Binary files /dev/null and b/assets/static/img/currencies/crypto/MTL.png differ diff --git a/assets/static/img/currencies/crypto/NANO.png b/assets/static/img/currencies/crypto/NANO.png new file mode 100644 index 0000000..ab3ae6c Binary files /dev/null and b/assets/static/img/currencies/crypto/NANO.png differ diff --git a/assets/static/img/currencies/crypto/NAS.png b/assets/static/img/currencies/crypto/NAS.png new file mode 100644 index 0000000..aca6fb7 Binary files /dev/null and b/assets/static/img/currencies/crypto/NAS.png differ diff --git a/assets/static/img/currencies/crypto/NEO.png b/assets/static/img/currencies/crypto/NEO.png new file mode 100644 index 0000000..e6b9c13 Binary files /dev/null and b/assets/static/img/currencies/crypto/NEO.png differ diff --git a/assets/static/img/currencies/crypto/NEW.png b/assets/static/img/currencies/crypto/NEW.png new file mode 100644 index 0000000..f70e86a Binary files /dev/null and b/assets/static/img/currencies/crypto/NEW.png differ diff --git a/assets/static/img/currencies/crypto/NEX.png b/assets/static/img/currencies/crypto/NEX.png new file mode 100644 index 0000000..3393020 Binary files /dev/null and b/assets/static/img/currencies/crypto/NEX.png differ diff --git a/assets/static/img/currencies/crypto/NEXO.png b/assets/static/img/currencies/crypto/NEXO.png new file mode 100644 index 0000000..b9d22e6 Binary files /dev/null and b/assets/static/img/currencies/crypto/NEXO.png differ diff --git a/assets/static/img/currencies/crypto/NPXS.png b/assets/static/img/currencies/crypto/NPXS.png new file mode 100644 index 0000000..2846a10 Binary files /dev/null and b/assets/static/img/currencies/crypto/NPXS.png differ diff --git a/assets/static/img/currencies/crypto/NRG.png b/assets/static/img/currencies/crypto/NRG.png new file mode 100644 index 0000000..0fddf4b Binary files /dev/null and b/assets/static/img/currencies/crypto/NRG.png differ diff --git a/assets/static/img/currencies/crypto/NULS.png b/assets/static/img/currencies/crypto/NULS.png new file mode 100644 index 0000000..7be463c Binary files /dev/null and b/assets/static/img/currencies/crypto/NULS.png differ diff --git a/assets/static/img/currencies/crypto/NXS.png b/assets/static/img/currencies/crypto/NXS.png new file mode 100644 index 0000000..04fd4da Binary files /dev/null and b/assets/static/img/currencies/crypto/NXS.png differ diff --git a/assets/static/img/currencies/crypto/NXT.png b/assets/static/img/currencies/crypto/NXT.png new file mode 100644 index 0000000..f71c20a Binary files /dev/null and b/assets/static/img/currencies/crypto/NXT.png differ diff --git a/assets/static/img/currencies/crypto/ODE.png b/assets/static/img/currencies/crypto/ODE.png new file mode 100644 index 0000000..3ffe975 Binary files /dev/null and b/assets/static/img/currencies/crypto/ODE.png differ diff --git a/assets/static/img/currencies/crypto/OMG.png b/assets/static/img/currencies/crypto/OMG.png new file mode 100644 index 0000000..9d44f49 Binary files /dev/null and b/assets/static/img/currencies/crypto/OMG.png differ diff --git a/assets/static/img/currencies/crypto/ONE.png b/assets/static/img/currencies/crypto/ONE.png new file mode 100644 index 0000000..a42bb1a Binary files /dev/null and b/assets/static/img/currencies/crypto/ONE.png differ diff --git a/assets/static/img/currencies/crypto/ONT.png b/assets/static/img/currencies/crypto/ONT.png new file mode 100644 index 0000000..29fc8fa Binary files /dev/null and b/assets/static/img/currencies/crypto/ONT.png differ diff --git a/assets/static/img/currencies/crypto/ORBS.png b/assets/static/img/currencies/crypto/ORBS.png new file mode 100644 index 0000000..b35df66 Binary files /dev/null and b/assets/static/img/currencies/crypto/ORBS.png differ diff --git a/assets/static/img/currencies/crypto/PAI.png b/assets/static/img/currencies/crypto/PAI.png new file mode 100644 index 0000000..0381450 Binary files /dev/null and b/assets/static/img/currencies/crypto/PAI.png differ diff --git a/assets/static/img/currencies/crypto/PAX.png b/assets/static/img/currencies/crypto/PAX.png new file mode 100644 index 0000000..dd9168d Binary files /dev/null and b/assets/static/img/currencies/crypto/PAX.png differ diff --git a/assets/static/img/currencies/crypto/PERL.png b/assets/static/img/currencies/crypto/PERL.png new file mode 100644 index 0000000..a030c61 Binary files /dev/null and b/assets/static/img/currencies/crypto/PERL.png differ diff --git a/assets/static/img/currencies/crypto/PIVX.png b/assets/static/img/currencies/crypto/PIVX.png new file mode 100644 index 0000000..3dd9d91 Binary files /dev/null and b/assets/static/img/currencies/crypto/PIVX.png differ diff --git a/assets/static/img/currencies/crypto/POLY.png b/assets/static/img/currencies/crypto/POLY.png new file mode 100644 index 0000000..b421030 Binary files /dev/null and b/assets/static/img/currencies/crypto/POLY.png differ diff --git a/assets/static/img/currencies/crypto/POWR.png b/assets/static/img/currencies/crypto/POWR.png new file mode 100644 index 0000000..32a1454 Binary files /dev/null and b/assets/static/img/currencies/crypto/POWR.png differ diff --git a/assets/static/img/currencies/crypto/PPT.png b/assets/static/img/currencies/crypto/PPT.png new file mode 100644 index 0000000..6515b4c Binary files /dev/null and b/assets/static/img/currencies/crypto/PPT.png differ diff --git a/assets/static/img/currencies/crypto/PZM.png b/assets/static/img/currencies/crypto/PZM.png new file mode 100644 index 0000000..b01e89d Binary files /dev/null and b/assets/static/img/currencies/crypto/PZM.png differ diff --git a/assets/static/img/currencies/crypto/QASH.png b/assets/static/img/currencies/crypto/QASH.png new file mode 100644 index 0000000..25f730f Binary files /dev/null and b/assets/static/img/currencies/crypto/QASH.png differ diff --git a/assets/static/img/currencies/crypto/QKC.png b/assets/static/img/currencies/crypto/QKC.png new file mode 100644 index 0000000..7c7f770 Binary files /dev/null and b/assets/static/img/currencies/crypto/QKC.png differ diff --git a/assets/static/img/currencies/crypto/QNT.png b/assets/static/img/currencies/crypto/QNT.png new file mode 100644 index 0000000..c93e529 Binary files /dev/null and b/assets/static/img/currencies/crypto/QNT.png differ diff --git a/assets/static/img/currencies/crypto/QTUM.png b/assets/static/img/currencies/crypto/QTUM.png new file mode 100644 index 0000000..85cf294 Binary files /dev/null and b/assets/static/img/currencies/crypto/QTUM.png differ diff --git a/assets/static/img/currencies/crypto/R.png b/assets/static/img/currencies/crypto/R.png new file mode 100644 index 0000000..70ddce2 Binary files /dev/null and b/assets/static/img/currencies/crypto/R.png differ diff --git a/assets/static/img/currencies/crypto/RDD.png b/assets/static/img/currencies/crypto/RDD.png new file mode 100644 index 0000000..5eeeb00 Binary files /dev/null and b/assets/static/img/currencies/crypto/RDD.png differ diff --git a/assets/static/img/currencies/crypto/REN.png b/assets/static/img/currencies/crypto/REN.png new file mode 100644 index 0000000..92a5200 Binary files /dev/null and b/assets/static/img/currencies/crypto/REN.png differ diff --git a/assets/static/img/currencies/crypto/REP.png b/assets/static/img/currencies/crypto/REP.png new file mode 100644 index 0000000..8dc8b62 Binary files /dev/null and b/assets/static/img/currencies/crypto/REP.png differ diff --git a/assets/static/img/currencies/crypto/RET.png b/assets/static/img/currencies/crypto/RET.png new file mode 100644 index 0000000..208d885 Binary files /dev/null and b/assets/static/img/currencies/crypto/RET.png differ diff --git a/assets/static/img/currencies/crypto/RHOC.png b/assets/static/img/currencies/crypto/RHOC.png new file mode 100644 index 0000000..1285320 Binary files /dev/null and b/assets/static/img/currencies/crypto/RHOC.png differ diff --git a/assets/static/img/currencies/crypto/RIF.png b/assets/static/img/currencies/crypto/RIF.png new file mode 100644 index 0000000..6c2a9f9 Binary files /dev/null and b/assets/static/img/currencies/crypto/RIF.png differ diff --git a/assets/static/img/currencies/crypto/RLC.png b/assets/static/img/currencies/crypto/RLC.png new file mode 100644 index 0000000..5340dec Binary files /dev/null and b/assets/static/img/currencies/crypto/RLC.png differ diff --git a/assets/static/img/currencies/crypto/ROX.png b/assets/static/img/currencies/crypto/ROX.png new file mode 100644 index 0000000..053e1c9 Binary files /dev/null and b/assets/static/img/currencies/crypto/ROX.png differ diff --git a/assets/static/img/currencies/crypto/RVN.png b/assets/static/img/currencies/crypto/RVN.png new file mode 100644 index 0000000..4a845fa Binary files /dev/null and b/assets/static/img/currencies/crypto/RVN.png differ diff --git a/assets/static/img/currencies/crypto/SAN.png b/assets/static/img/currencies/crypto/SAN.png new file mode 100644 index 0000000..e9bf2d6 Binary files /dev/null and b/assets/static/img/currencies/crypto/SAN.png differ diff --git a/assets/static/img/currencies/crypto/SC.png b/assets/static/img/currencies/crypto/SC.png new file mode 100644 index 0000000..96fa3d0 Binary files /dev/null and b/assets/static/img/currencies/crypto/SC.png differ diff --git a/assets/static/img/currencies/crypto/SEELE.png b/assets/static/img/currencies/crypto/SEELE.png new file mode 100644 index 0000000..afe3951 Binary files /dev/null and b/assets/static/img/currencies/crypto/SEELE.png differ diff --git a/assets/static/img/currencies/crypto/SNT.png b/assets/static/img/currencies/crypto/SNT.png new file mode 100644 index 0000000..3c02ab7 Binary files /dev/null and b/assets/static/img/currencies/crypto/SNT.png differ diff --git a/assets/static/img/currencies/crypto/SNX.png b/assets/static/img/currencies/crypto/SNX.png new file mode 100644 index 0000000..b25d5af Binary files /dev/null and b/assets/static/img/currencies/crypto/SNX.png differ diff --git a/assets/static/img/currencies/crypto/SOLVE.png b/assets/static/img/currencies/crypto/SOLVE.png new file mode 100644 index 0000000..8ca0a54 Binary files /dev/null and b/assets/static/img/currencies/crypto/SOLVE.png differ diff --git a/assets/static/img/currencies/crypto/STEEM.png b/assets/static/img/currencies/crypto/STEEM.png new file mode 100644 index 0000000..8711b83 Binary files /dev/null and b/assets/static/img/currencies/crypto/STEEM.png differ diff --git a/assets/static/img/currencies/crypto/STORJ.png b/assets/static/img/currencies/crypto/STORJ.png new file mode 100644 index 0000000..1902f55 Binary files /dev/null and b/assets/static/img/currencies/crypto/STORJ.png differ diff --git a/assets/static/img/currencies/crypto/STRAT.png b/assets/static/img/currencies/crypto/STRAT.png new file mode 100644 index 0000000..05c2b06 Binary files /dev/null and b/assets/static/img/currencies/crypto/STRAT.png differ diff --git a/assets/static/img/currencies/crypto/SYS.png b/assets/static/img/currencies/crypto/SYS.png new file mode 100644 index 0000000..b4e07de Binary files /dev/null and b/assets/static/img/currencies/crypto/SYS.png differ diff --git a/assets/static/img/currencies/crypto/TEL.png b/assets/static/img/currencies/crypto/TEL.png new file mode 100644 index 0000000..1dbae97 Binary files /dev/null and b/assets/static/img/currencies/crypto/TEL.png differ diff --git a/assets/static/img/currencies/crypto/TFUEL.png b/assets/static/img/currencies/crypto/TFUEL.png new file mode 100644 index 0000000..2a44bf2 Binary files /dev/null and b/assets/static/img/currencies/crypto/TFUEL.png differ diff --git a/assets/static/img/currencies/crypto/THETA.png b/assets/static/img/currencies/crypto/THETA.png new file mode 100644 index 0000000..0b6d98c Binary files /dev/null and b/assets/static/img/currencies/crypto/THETA.png differ diff --git a/assets/static/img/currencies/crypto/TKN.png b/assets/static/img/currencies/crypto/TKN.png new file mode 100644 index 0000000..a73044f Binary files /dev/null and b/assets/static/img/currencies/crypto/TKN.png differ diff --git a/assets/static/img/currencies/crypto/TOMO.png b/assets/static/img/currencies/crypto/TOMO.png new file mode 100644 index 0000000..983d799 Binary files /dev/null and b/assets/static/img/currencies/crypto/TOMO.png differ diff --git a/assets/static/img/currencies/crypto/TRUE.png b/assets/static/img/currencies/crypto/TRUE.png new file mode 100644 index 0000000..3a73a93 Binary files /dev/null and b/assets/static/img/currencies/crypto/TRUE.png differ diff --git a/assets/static/img/currencies/crypto/TRX.png b/assets/static/img/currencies/crypto/TRX.png new file mode 100644 index 0000000..1b52ba8 Binary files /dev/null and b/assets/static/img/currencies/crypto/TRX.png differ diff --git a/assets/static/img/currencies/crypto/TT.png b/assets/static/img/currencies/crypto/TT.png new file mode 100644 index 0000000..1c9b280 Binary files /dev/null and b/assets/static/img/currencies/crypto/TT.png differ diff --git a/assets/static/img/currencies/crypto/TTC.png b/assets/static/img/currencies/crypto/TTC.png new file mode 100644 index 0000000..525f496 Binary files /dev/null and b/assets/static/img/currencies/crypto/TTC.png differ diff --git a/assets/static/img/currencies/crypto/TUSD.png b/assets/static/img/currencies/crypto/TUSD.png new file mode 100644 index 0000000..d558fd3 Binary files /dev/null and b/assets/static/img/currencies/crypto/TUSD.png differ diff --git a/assets/static/img/currencies/crypto/UGAS.png b/assets/static/img/currencies/crypto/UGAS.png new file mode 100644 index 0000000..c4b7edc Binary files /dev/null and b/assets/static/img/currencies/crypto/UGAS.png differ diff --git a/assets/static/img/currencies/crypto/USDC.png b/assets/static/img/currencies/crypto/USDC.png new file mode 100644 index 0000000..eaf6836 Binary files /dev/null and b/assets/static/img/currencies/crypto/USDC.png differ diff --git a/assets/static/img/currencies/crypto/USDT.png b/assets/static/img/currencies/crypto/USDT.png new file mode 100644 index 0000000..98f24bf Binary files /dev/null and b/assets/static/img/currencies/crypto/USDT.png differ diff --git a/assets/static/img/currencies/crypto/VALOR.png b/assets/static/img/currencies/crypto/VALOR.png new file mode 100644 index 0000000..4073f3f Binary files /dev/null and b/assets/static/img/currencies/crypto/VALOR.png differ diff --git a/assets/static/img/currencies/crypto/VET.png b/assets/static/img/currencies/crypto/VET.png new file mode 100644 index 0000000..ab02e59 Binary files /dev/null and b/assets/static/img/currencies/crypto/VET.png differ diff --git a/assets/static/img/currencies/crypto/VSYS.png b/assets/static/img/currencies/crypto/VSYS.png new file mode 100644 index 0000000..c7d026f Binary files /dev/null and b/assets/static/img/currencies/crypto/VSYS.png differ diff --git a/assets/static/img/currencies/crypto/VTC.png b/assets/static/img/currencies/crypto/VTC.png new file mode 100644 index 0000000..18f9534 Binary files /dev/null and b/assets/static/img/currencies/crypto/VTC.png differ diff --git a/assets/static/img/currencies/crypto/WAN.png b/assets/static/img/currencies/crypto/WAN.png new file mode 100644 index 0000000..4b95659 Binary files /dev/null and b/assets/static/img/currencies/crypto/WAN.png differ diff --git a/assets/static/img/currencies/crypto/WAVES.png b/assets/static/img/currencies/crypto/WAVES.png new file mode 100644 index 0000000..fdd8ed3 Binary files /dev/null and b/assets/static/img/currencies/crypto/WAVES.png differ diff --git a/assets/static/img/currencies/crypto/WAX.png b/assets/static/img/currencies/crypto/WAX.png new file mode 100644 index 0000000..2f84ff3 Binary files /dev/null and b/assets/static/img/currencies/crypto/WAX.png differ diff --git a/assets/static/img/currencies/crypto/WICC.png b/assets/static/img/currencies/crypto/WICC.png new file mode 100644 index 0000000..3ecbb62 Binary files /dev/null and b/assets/static/img/currencies/crypto/WICC.png differ diff --git a/assets/static/img/currencies/crypto/WIN.png b/assets/static/img/currencies/crypto/WIN.png new file mode 100644 index 0000000..aeac98c Binary files /dev/null and b/assets/static/img/currencies/crypto/WIN.png differ diff --git a/assets/static/img/currencies/crypto/WTC.png b/assets/static/img/currencies/crypto/WTC.png new file mode 100644 index 0000000..728c46d Binary files /dev/null and b/assets/static/img/currencies/crypto/WTC.png differ diff --git a/assets/static/img/currencies/crypto/XDAI.png b/assets/static/img/currencies/crypto/XDAI.png new file mode 100644 index 0000000..358f9d5 Binary files /dev/null and b/assets/static/img/currencies/crypto/XDAI.png differ diff --git a/assets/static/img/currencies/crypto/XEM.png b/assets/static/img/currencies/crypto/XEM.png new file mode 100644 index 0000000..b750a83 Binary files /dev/null and b/assets/static/img/currencies/crypto/XEM.png differ diff --git a/assets/static/img/currencies/crypto/XLM.png b/assets/static/img/currencies/crypto/XLM.png new file mode 100644 index 0000000..1776a4f Binary files /dev/null and b/assets/static/img/currencies/crypto/XLM.png differ diff --git a/assets/static/img/currencies/crypto/XMR.png b/assets/static/img/currencies/crypto/XMR.png new file mode 100644 index 0000000..4b88148 Binary files /dev/null and b/assets/static/img/currencies/crypto/XMR.png differ diff --git a/assets/static/img/currencies/crypto/XMX.png b/assets/static/img/currencies/crypto/XMX.png new file mode 100644 index 0000000..8fb4f52 Binary files /dev/null and b/assets/static/img/currencies/crypto/XMX.png differ diff --git a/assets/static/img/currencies/crypto/XRC.png b/assets/static/img/currencies/crypto/XRC.png new file mode 100644 index 0000000..24b0b30 Binary files /dev/null and b/assets/static/img/currencies/crypto/XRC.png differ diff --git a/assets/static/img/currencies/crypto/XRP.png b/assets/static/img/currencies/crypto/XRP.png new file mode 100644 index 0000000..6722b37 Binary files /dev/null and b/assets/static/img/currencies/crypto/XRP.png differ diff --git a/assets/static/img/currencies/crypto/XTZ.png b/assets/static/img/currencies/crypto/XTZ.png new file mode 100644 index 0000000..695d92b Binary files /dev/null and b/assets/static/img/currencies/crypto/XTZ.png differ diff --git a/assets/static/img/currencies/crypto/XVG.png b/assets/static/img/currencies/crypto/XVG.png new file mode 100644 index 0000000..d26f0c1 Binary files /dev/null and b/assets/static/img/currencies/crypto/XVG.png differ diff --git a/assets/static/img/currencies/crypto/XZC.png b/assets/static/img/currencies/crypto/XZC.png new file mode 100644 index 0000000..39ff503 Binary files /dev/null and b/assets/static/img/currencies/crypto/XZC.png differ diff --git a/assets/static/img/currencies/crypto/ZB.png b/assets/static/img/currencies/crypto/ZB.png new file mode 100644 index 0000000..e164a25 Binary files /dev/null and b/assets/static/img/currencies/crypto/ZB.png differ diff --git a/assets/static/img/currencies/crypto/ZEC.png b/assets/static/img/currencies/crypto/ZEC.png new file mode 100644 index 0000000..5cc8a7a Binary files /dev/null and b/assets/static/img/currencies/crypto/ZEC.png differ diff --git a/assets/static/img/currencies/crypto/ZEN.png b/assets/static/img/currencies/crypto/ZEN.png new file mode 100644 index 0000000..ffc2200 Binary files /dev/null and b/assets/static/img/currencies/crypto/ZEN.png differ diff --git a/assets/static/img/currencies/crypto/ZIL.png b/assets/static/img/currencies/crypto/ZIL.png new file mode 100644 index 0000000..19f39fa Binary files /dev/null and b/assets/static/img/currencies/crypto/ZIL.png differ diff --git a/assets/static/img/currencies/crypto/ZRC.png b/assets/static/img/currencies/crypto/ZRC.png new file mode 100644 index 0000000..8f2d71d Binary files /dev/null and b/assets/static/img/currencies/crypto/ZRC.png differ diff --git a/assets/static/img/currencies/crypto/ZRX.png b/assets/static/img/currencies/crypto/ZRX.png new file mode 100644 index 0000000..98dc499 Binary files /dev/null and b/assets/static/img/currencies/crypto/ZRX.png differ diff --git a/assets/static/img/currencies/AUD.svg b/assets/static/img/currencies/fiat/AUD.svg similarity index 100% rename from assets/static/img/currencies/AUD.svg rename to assets/static/img/currencies/fiat/AUD.svg diff --git a/assets/static/img/currencies/BRL.svg b/assets/static/img/currencies/fiat/BRL.svg similarity index 100% rename from assets/static/img/currencies/BRL.svg rename to assets/static/img/currencies/fiat/BRL.svg diff --git a/assets/static/img/currencies/CAD.svg b/assets/static/img/currencies/fiat/CAD.svg similarity index 100% rename from assets/static/img/currencies/CAD.svg rename to assets/static/img/currencies/fiat/CAD.svg diff --git a/assets/static/img/currencies/CHF.svg b/assets/static/img/currencies/fiat/CHF.svg similarity index 100% rename from assets/static/img/currencies/CHF.svg rename to assets/static/img/currencies/fiat/CHF.svg diff --git a/assets/static/img/currencies/CLP.svg b/assets/static/img/currencies/fiat/CLP.svg similarity index 100% rename from assets/static/img/currencies/CLP.svg rename to assets/static/img/currencies/fiat/CLP.svg diff --git a/assets/static/img/currencies/CNY.svg b/assets/static/img/currencies/fiat/CNY.svg similarity index 100% rename from assets/static/img/currencies/CNY.svg rename to assets/static/img/currencies/fiat/CNY.svg diff --git a/assets/static/img/currencies/CZK.svg b/assets/static/img/currencies/fiat/CZK.svg similarity index 100% rename from assets/static/img/currencies/CZK.svg rename to assets/static/img/currencies/fiat/CZK.svg diff --git a/assets/static/img/currencies/DKK.svg b/assets/static/img/currencies/fiat/DKK.svg similarity index 100% rename from assets/static/img/currencies/DKK.svg rename to assets/static/img/currencies/fiat/DKK.svg diff --git a/assets/static/img/currencies/EUR.svg b/assets/static/img/currencies/fiat/EUR.svg similarity index 100% rename from assets/static/img/currencies/EUR.svg rename to assets/static/img/currencies/fiat/EUR.svg diff --git a/assets/static/img/currencies/GBP.svg b/assets/static/img/currencies/fiat/GBP.svg similarity index 100% rename from assets/static/img/currencies/GBP.svg rename to assets/static/img/currencies/fiat/GBP.svg diff --git a/assets/static/img/currencies/HKD.svg b/assets/static/img/currencies/fiat/HKD.svg similarity index 100% rename from assets/static/img/currencies/HKD.svg rename to assets/static/img/currencies/fiat/HKD.svg diff --git a/assets/static/img/currencies/HUF.svg b/assets/static/img/currencies/fiat/HUF.svg similarity index 100% rename from assets/static/img/currencies/HUF.svg rename to assets/static/img/currencies/fiat/HUF.svg diff --git a/assets/static/img/currencies/IDR.svg b/assets/static/img/currencies/fiat/IDR.svg similarity index 100% rename from assets/static/img/currencies/IDR.svg rename to assets/static/img/currencies/fiat/IDR.svg diff --git a/assets/static/img/currencies/ILS.svg b/assets/static/img/currencies/fiat/ILS.svg similarity index 100% rename from assets/static/img/currencies/ILS.svg rename to assets/static/img/currencies/fiat/ILS.svg diff --git a/assets/static/img/currencies/INR.svg b/assets/static/img/currencies/fiat/INR.svg similarity index 100% rename from assets/static/img/currencies/INR.svg rename to assets/static/img/currencies/fiat/INR.svg diff --git a/assets/static/img/currencies/JPY.svg b/assets/static/img/currencies/fiat/JPY.svg similarity index 100% rename from assets/static/img/currencies/JPY.svg rename to assets/static/img/currencies/fiat/JPY.svg diff --git a/assets/static/img/currencies/KRW.svg b/assets/static/img/currencies/fiat/KRW.svg similarity index 100% rename from assets/static/img/currencies/KRW.svg rename to assets/static/img/currencies/fiat/KRW.svg diff --git a/assets/static/img/currencies/MXN.svg b/assets/static/img/currencies/fiat/MXN.svg similarity index 100% rename from assets/static/img/currencies/MXN.svg rename to assets/static/img/currencies/fiat/MXN.svg diff --git a/assets/static/img/currencies/MYR.svg b/assets/static/img/currencies/fiat/MYR.svg similarity index 100% rename from assets/static/img/currencies/MYR.svg rename to assets/static/img/currencies/fiat/MYR.svg diff --git a/assets/static/img/currencies/NOK.svg b/assets/static/img/currencies/fiat/NOK.svg similarity index 100% rename from assets/static/img/currencies/NOK.svg rename to assets/static/img/currencies/fiat/NOK.svg diff --git a/assets/static/img/currencies/NZD.svg b/assets/static/img/currencies/fiat/NZD.svg similarity index 100% rename from assets/static/img/currencies/NZD.svg rename to assets/static/img/currencies/fiat/NZD.svg diff --git a/assets/static/img/currencies/PHP.svg b/assets/static/img/currencies/fiat/PHP.svg similarity index 100% rename from assets/static/img/currencies/PHP.svg rename to assets/static/img/currencies/fiat/PHP.svg diff --git a/assets/static/img/currencies/PKR.svg b/assets/static/img/currencies/fiat/PKR.svg similarity index 100% rename from assets/static/img/currencies/PKR.svg rename to assets/static/img/currencies/fiat/PKR.svg diff --git a/assets/static/img/currencies/PLN.svg b/assets/static/img/currencies/fiat/PLN.svg similarity index 100% rename from assets/static/img/currencies/PLN.svg rename to assets/static/img/currencies/fiat/PLN.svg diff --git a/assets/static/img/currencies/RUB.svg b/assets/static/img/currencies/fiat/RUB.svg similarity index 100% rename from assets/static/img/currencies/RUB.svg rename to assets/static/img/currencies/fiat/RUB.svg diff --git a/assets/static/img/currencies/SEK.svg b/assets/static/img/currencies/fiat/SEK.svg similarity index 100% rename from assets/static/img/currencies/SEK.svg rename to assets/static/img/currencies/fiat/SEK.svg diff --git a/assets/static/img/currencies/SGD.svg b/assets/static/img/currencies/fiat/SGD.svg similarity index 100% rename from assets/static/img/currencies/SGD.svg rename to assets/static/img/currencies/fiat/SGD.svg diff --git a/assets/static/img/currencies/THB.svg b/assets/static/img/currencies/fiat/THB.svg similarity index 100% rename from assets/static/img/currencies/THB.svg rename to assets/static/img/currencies/fiat/THB.svg diff --git a/assets/static/img/currencies/TRY.svg b/assets/static/img/currencies/fiat/TRY.svg similarity index 100% rename from assets/static/img/currencies/TRY.svg rename to assets/static/img/currencies/fiat/TRY.svg diff --git a/assets/static/img/currencies/TWD.svg b/assets/static/img/currencies/fiat/TWD.svg similarity index 100% rename from assets/static/img/currencies/TWD.svg rename to assets/static/img/currencies/fiat/TWD.svg diff --git a/assets/static/img/currencies/USD.svg b/assets/static/img/currencies/fiat/USD.svg similarity index 100% rename from assets/static/img/currencies/USD.svg rename to assets/static/img/currencies/fiat/USD.svg diff --git a/assets/static/img/currencies/VND.svg b/assets/static/img/currencies/fiat/VND.svg similarity index 100% rename from assets/static/img/currencies/VND.svg rename to assets/static/img/currencies/fiat/VND.svg diff --git a/assets/static/img/currencies/ZAR.svg b/assets/static/img/currencies/fiat/ZAR.svg similarity index 100% rename from assets/static/img/currencies/ZAR.svg rename to assets/static/img/currencies/fiat/ZAR.svg diff --git a/assets/static/img/diamond.svg b/assets/static/img/diamond.svg new file mode 100644 index 0000000..0e2a2bd --- /dev/null +++ b/assets/static/img/diamond.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/assets/static/img/farmer-s-market-kiosk-1.svg b/assets/static/img/farmer-s-market-kiosk-1.svg new file mode 100644 index 0000000..540a141 --- /dev/null +++ b/assets/static/img/farmer-s-market-kiosk-1.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/assets/static/img/search.svg b/assets/static/img/search.svg new file mode 100644 index 0000000..b128fb6 --- /dev/null +++ b/assets/static/img/search.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/assets/static/img/vertical-swap.svg b/assets/static/img/vertical-swap.svg new file mode 100644 index 0000000..a8a262c --- /dev/null +++ b/assets/static/img/vertical-swap.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/assets/static/index.html b/assets/static/index.html index 9230654..2d452dc 100644 --- a/assets/static/index.html +++ b/assets/static/index.html @@ -10,7 +10,7 @@ diff --git a/docs/404.html b/docs/404.html index d86ee38..4269bc1 100644 --- a/docs/404.html +++ b/docs/404.html @@ -10,7 +10,7 @@ @@ -29,6 +29,6 @@
- + \ No newline at end of file diff --git a/docs/index.html b/docs/index.html index d86ee38..4269bc1 100644 --- a/docs/index.html +++ b/docs/index.html @@ -10,7 +10,7 @@ @@ -29,6 +29,6 @@
- + \ No newline at end of file diff --git a/docs/static/img/add-circle-bold.svg b/docs/static/img/add-circle-bold.svg new file mode 100644 index 0000000..9bd71f8 --- /dev/null +++ b/docs/static/img/add-circle-bold.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/docs/static/img/currencies/crypto/A.png b/docs/static/img/currencies/crypto/A.png new file mode 100644 index 0000000..b71e776 Binary files /dev/null and b/docs/static/img/currencies/crypto/A.png differ diff --git a/docs/static/img/currencies/crypto/ABBC.png b/docs/static/img/currencies/crypto/ABBC.png new file mode 100644 index 0000000..da5fa11 Binary files /dev/null and b/docs/static/img/currencies/crypto/ABBC.png differ diff --git a/docs/static/img/currencies/crypto/ABT.png b/docs/static/img/currencies/crypto/ABT.png new file mode 100644 index 0000000..59b2c3d Binary files /dev/null and b/docs/static/img/currencies/crypto/ABT.png differ diff --git a/docs/static/img/currencies/crypto/ADA.png b/docs/static/img/currencies/crypto/ADA.png new file mode 100644 index 0000000..042d868 Binary files /dev/null and b/docs/static/img/currencies/crypto/ADA.png differ diff --git a/docs/static/img/currencies/crypto/AE.png b/docs/static/img/currencies/crypto/AE.png new file mode 100644 index 0000000..7d6abcf Binary files /dev/null and b/docs/static/img/currencies/crypto/AE.png differ diff --git a/docs/static/img/currencies/crypto/AGI.png b/docs/static/img/currencies/crypto/AGI.png new file mode 100644 index 0000000..a091d29 Binary files /dev/null and b/docs/static/img/currencies/crypto/AGI.png differ diff --git a/docs/static/img/currencies/crypto/AION.png b/docs/static/img/currencies/crypto/AION.png new file mode 100644 index 0000000..24a888f Binary files /dev/null and b/docs/static/img/currencies/crypto/AION.png differ diff --git a/docs/static/img/currencies/crypto/ALGO.png b/docs/static/img/currencies/crypto/ALGO.png new file mode 100644 index 0000000..0f01922 Binary files /dev/null and b/docs/static/img/currencies/crypto/ALGO.png differ diff --git a/docs/static/img/currencies/crypto/ANT.png b/docs/static/img/currencies/crypto/ANT.png new file mode 100644 index 0000000..db4b59b Binary files /dev/null and b/docs/static/img/currencies/crypto/ANT.png differ diff --git a/docs/static/img/currencies/crypto/AOA.png b/docs/static/img/currencies/crypto/AOA.png new file mode 100644 index 0000000..1952d07 Binary files /dev/null and b/docs/static/img/currencies/crypto/AOA.png differ diff --git a/docs/static/img/currencies/crypto/ARDR.png b/docs/static/img/currencies/crypto/ARDR.png new file mode 100644 index 0000000..eb86bde Binary files /dev/null and b/docs/static/img/currencies/crypto/ARDR.png differ diff --git a/docs/static/img/currencies/crypto/ARK.png b/docs/static/img/currencies/crypto/ARK.png new file mode 100644 index 0000000..a0c7f8d Binary files /dev/null and b/docs/static/img/currencies/crypto/ARK.png differ diff --git a/docs/static/img/currencies/crypto/ATOM.png b/docs/static/img/currencies/crypto/ATOM.png new file mode 100644 index 0000000..1651596 Binary files /dev/null and b/docs/static/img/currencies/crypto/ATOM.png differ diff --git a/docs/static/img/currencies/crypto/BAT.png b/docs/static/img/currencies/crypto/BAT.png new file mode 100644 index 0000000..4af9334 Binary files /dev/null and b/docs/static/img/currencies/crypto/BAT.png differ diff --git a/docs/static/img/currencies/crypto/BCD.png b/docs/static/img/currencies/crypto/BCD.png new file mode 100644 index 0000000..4606c10 Binary files /dev/null and b/docs/static/img/currencies/crypto/BCD.png differ diff --git a/docs/static/img/currencies/crypto/BCH.png b/docs/static/img/currencies/crypto/BCH.png new file mode 100644 index 0000000..1d6486e Binary files /dev/null and b/docs/static/img/currencies/crypto/BCH.png differ diff --git a/docs/static/img/currencies/crypto/BCN.png b/docs/static/img/currencies/crypto/BCN.png new file mode 100644 index 0000000..3c04051 Binary files /dev/null and b/docs/static/img/currencies/crypto/BCN.png differ diff --git a/docs/static/img/currencies/crypto/BCV.png b/docs/static/img/currencies/crypto/BCV.png new file mode 100644 index 0000000..47b11cf Binary files /dev/null and b/docs/static/img/currencies/crypto/BCV.png differ diff --git a/docs/static/img/currencies/crypto/BEAM.png b/docs/static/img/currencies/crypto/BEAM.png new file mode 100644 index 0000000..d0054d0 Binary files /dev/null and b/docs/static/img/currencies/crypto/BEAM.png differ diff --git a/docs/static/img/currencies/crypto/BFT.png b/docs/static/img/currencies/crypto/BFT.png new file mode 100644 index 0000000..74eef83 Binary files /dev/null and b/docs/static/img/currencies/crypto/BFT.png differ diff --git a/docs/static/img/currencies/crypto/BHP.png b/docs/static/img/currencies/crypto/BHP.png new file mode 100644 index 0000000..807599b Binary files /dev/null and b/docs/static/img/currencies/crypto/BHP.png differ diff --git a/docs/static/img/currencies/crypto/BIX.png b/docs/static/img/currencies/crypto/BIX.png new file mode 100644 index 0000000..4905509 Binary files /dev/null and b/docs/static/img/currencies/crypto/BIX.png differ diff --git a/docs/static/img/currencies/crypto/BMC.png b/docs/static/img/currencies/crypto/BMC.png new file mode 100644 index 0000000..6232c4e Binary files /dev/null and b/docs/static/img/currencies/crypto/BMC.png differ diff --git a/docs/static/img/currencies/crypto/BNB.png b/docs/static/img/currencies/crypto/BNB.png new file mode 100644 index 0000000..9b6b244 Binary files /dev/null and b/docs/static/img/currencies/crypto/BNB.png differ diff --git a/docs/static/img/currencies/crypto/BNT.png b/docs/static/img/currencies/crypto/BNT.png new file mode 100644 index 0000000..9799180 Binary files /dev/null and b/docs/static/img/currencies/crypto/BNT.png differ diff --git a/docs/static/img/currencies/crypto/BRD.png b/docs/static/img/currencies/crypto/BRD.png new file mode 100644 index 0000000..faecf52 Binary files /dev/null and b/docs/static/img/currencies/crypto/BRD.png differ diff --git a/docs/static/img/currencies/crypto/BSV.png b/docs/static/img/currencies/crypto/BSV.png new file mode 100644 index 0000000..51699a2 Binary files /dev/null and b/docs/static/img/currencies/crypto/BSV.png differ diff --git a/docs/static/img/currencies/crypto/BTC.png b/docs/static/img/currencies/crypto/BTC.png new file mode 100644 index 0000000..8a3b230 Binary files /dev/null and b/docs/static/img/currencies/crypto/BTC.png differ diff --git a/docs/static/img/currencies/crypto/BTG.png b/docs/static/img/currencies/crypto/BTG.png new file mode 100644 index 0000000..8b0f58a Binary files /dev/null and b/docs/static/img/currencies/crypto/BTG.png differ diff --git a/docs/static/img/currencies/crypto/BTM.png b/docs/static/img/currencies/crypto/BTM.png new file mode 100644 index 0000000..9517cc3 Binary files /dev/null and b/docs/static/img/currencies/crypto/BTM.png differ diff --git a/docs/static/img/currencies/crypto/BTS.png b/docs/static/img/currencies/crypto/BTS.png new file mode 100644 index 0000000..f03b7d1 Binary files /dev/null and b/docs/static/img/currencies/crypto/BTS.png differ diff --git a/docs/static/img/currencies/crypto/BTT.png b/docs/static/img/currencies/crypto/BTT.png new file mode 100644 index 0000000..fa6c712 Binary files /dev/null and b/docs/static/img/currencies/crypto/BTT.png differ diff --git a/docs/static/img/currencies/crypto/C20.png b/docs/static/img/currencies/crypto/C20.png new file mode 100644 index 0000000..efde976 Binary files /dev/null and b/docs/static/img/currencies/crypto/C20.png differ diff --git a/docs/static/img/currencies/crypto/CELR.png b/docs/static/img/currencies/crypto/CELR.png new file mode 100644 index 0000000..d2a1357 Binary files /dev/null and b/docs/static/img/currencies/crypto/CELR.png differ diff --git a/docs/static/img/currencies/crypto/CHZ.png b/docs/static/img/currencies/crypto/CHZ.png new file mode 100644 index 0000000..dba1bdb Binary files /dev/null and b/docs/static/img/currencies/crypto/CHZ.png differ diff --git a/docs/static/img/currencies/crypto/CMT.png b/docs/static/img/currencies/crypto/CMT.png new file mode 100644 index 0000000..28312c3 Binary files /dev/null and b/docs/static/img/currencies/crypto/CMT.png differ diff --git a/docs/static/img/currencies/crypto/COCOS.png b/docs/static/img/currencies/crypto/COCOS.png new file mode 100644 index 0000000..35de229 Binary files /dev/null and b/docs/static/img/currencies/crypto/COCOS.png differ diff --git a/docs/static/img/currencies/crypto/COS.png b/docs/static/img/currencies/crypto/COS.png new file mode 100644 index 0000000..0dfa56e Binary files /dev/null and b/docs/static/img/currencies/crypto/COS.png differ diff --git a/docs/static/img/currencies/crypto/CRO.png b/docs/static/img/currencies/crypto/CRO.png new file mode 100644 index 0000000..9e899be Binary files /dev/null and b/docs/static/img/currencies/crypto/CRO.png differ diff --git a/docs/static/img/currencies/crypto/CRPT.png b/docs/static/img/currencies/crypto/CRPT.png new file mode 100644 index 0000000..4f5220a Binary files /dev/null and b/docs/static/img/currencies/crypto/CRPT.png differ diff --git a/docs/static/img/currencies/crypto/CS.png b/docs/static/img/currencies/crypto/CS.png new file mode 100644 index 0000000..8943143 Binary files /dev/null and b/docs/static/img/currencies/crypto/CS.png differ diff --git a/docs/static/img/currencies/crypto/CVC.png b/docs/static/img/currencies/crypto/CVC.png new file mode 100644 index 0000000..679c9ad Binary files /dev/null and b/docs/static/img/currencies/crypto/CVC.png differ diff --git a/docs/static/img/currencies/crypto/CVNT.png b/docs/static/img/currencies/crypto/CVNT.png new file mode 100644 index 0000000..8f6ab24 Binary files /dev/null and b/docs/static/img/currencies/crypto/CVNT.png differ diff --git a/docs/static/img/currencies/crypto/DAC.png b/docs/static/img/currencies/crypto/DAC.png new file mode 100644 index 0000000..39c49c3 Binary files /dev/null and b/docs/static/img/currencies/crypto/DAC.png differ diff --git a/docs/static/img/currencies/crypto/DAI.png b/docs/static/img/currencies/crypto/DAI.png new file mode 100644 index 0000000..0ea3ac6 Binary files /dev/null and b/docs/static/img/currencies/crypto/DAI.png differ diff --git a/docs/static/img/currencies/crypto/DASH.png b/docs/static/img/currencies/crypto/DASH.png new file mode 100644 index 0000000..2fc5287 Binary files /dev/null and b/docs/static/img/currencies/crypto/DASH.png differ diff --git a/docs/static/img/currencies/crypto/DCR.png b/docs/static/img/currencies/crypto/DCR.png new file mode 100644 index 0000000..59e6c5f Binary files /dev/null and b/docs/static/img/currencies/crypto/DCR.png differ diff --git a/docs/static/img/currencies/crypto/DENT.png b/docs/static/img/currencies/crypto/DENT.png new file mode 100644 index 0000000..b5cf9e3 Binary files /dev/null and b/docs/static/img/currencies/crypto/DENT.png differ diff --git a/docs/static/img/currencies/crypto/DEX.png b/docs/static/img/currencies/crypto/DEX.png new file mode 100644 index 0000000..e15963d Binary files /dev/null and b/docs/static/img/currencies/crypto/DEX.png differ diff --git a/docs/static/img/currencies/crypto/DGB.png b/docs/static/img/currencies/crypto/DGB.png new file mode 100644 index 0000000..4fb6ce6 Binary files /dev/null and b/docs/static/img/currencies/crypto/DGB.png differ diff --git a/docs/static/img/currencies/crypto/DGD.png b/docs/static/img/currencies/crypto/DGD.png new file mode 100644 index 0000000..cf950f5 Binary files /dev/null and b/docs/static/img/currencies/crypto/DGD.png differ diff --git a/docs/static/img/currencies/crypto/DGTX.png b/docs/static/img/currencies/crypto/DGTX.png new file mode 100644 index 0000000..d02bcc7 Binary files /dev/null and b/docs/static/img/currencies/crypto/DGTX.png differ diff --git a/docs/static/img/currencies/crypto/DIVI.png b/docs/static/img/currencies/crypto/DIVI.png new file mode 100644 index 0000000..a5bb8a5 Binary files /dev/null and b/docs/static/img/currencies/crypto/DIVI.png differ diff --git a/docs/static/img/currencies/crypto/DOGE.png b/docs/static/img/currencies/crypto/DOGE.png new file mode 100644 index 0000000..128f4d1 Binary files /dev/null and b/docs/static/img/currencies/crypto/DOGE.png differ diff --git a/docs/static/img/currencies/crypto/DRG.png b/docs/static/img/currencies/crypto/DRG.png new file mode 100644 index 0000000..d1d899c Binary files /dev/null and b/docs/static/img/currencies/crypto/DRG.png differ diff --git a/docs/static/img/currencies/crypto/EDC.png b/docs/static/img/currencies/crypto/EDC.png new file mode 100644 index 0000000..8b787a8 Binary files /dev/null and b/docs/static/img/currencies/crypto/EDC.png differ diff --git a/docs/static/img/currencies/crypto/EDO.png b/docs/static/img/currencies/crypto/EDO.png new file mode 100644 index 0000000..ec1b325 Binary files /dev/null and b/docs/static/img/currencies/crypto/EDO.png differ diff --git a/docs/static/img/currencies/crypto/EGT.png b/docs/static/img/currencies/crypto/EGT.png new file mode 100644 index 0000000..3fbbaa8 Binary files /dev/null and b/docs/static/img/currencies/crypto/EGT.png differ diff --git a/docs/static/img/currencies/crypto/ELA.png b/docs/static/img/currencies/crypto/ELA.png new file mode 100644 index 0000000..aef8217 Binary files /dev/null and b/docs/static/img/currencies/crypto/ELA.png differ diff --git a/docs/static/img/currencies/crypto/ELF.png b/docs/static/img/currencies/crypto/ELF.png new file mode 100644 index 0000000..3a00ddb Binary files /dev/null and b/docs/static/img/currencies/crypto/ELF.png differ diff --git a/docs/static/img/currencies/crypto/ENG.png b/docs/static/img/currencies/crypto/ENG.png new file mode 100644 index 0000000..27a6b14 Binary files /dev/null and b/docs/static/img/currencies/crypto/ENG.png differ diff --git a/docs/static/img/currencies/crypto/ENJ.png b/docs/static/img/currencies/crypto/ENJ.png new file mode 100644 index 0000000..36aa412 Binary files /dev/null and b/docs/static/img/currencies/crypto/ENJ.png differ diff --git a/docs/static/img/currencies/crypto/EOS.png b/docs/static/img/currencies/crypto/EOS.png new file mode 100644 index 0000000..caef014 Binary files /dev/null and b/docs/static/img/currencies/crypto/EOS.png differ diff --git a/docs/static/img/currencies/crypto/ETC.png b/docs/static/img/currencies/crypto/ETC.png new file mode 100644 index 0000000..49fe9e4 Binary files /dev/null and b/docs/static/img/currencies/crypto/ETC.png differ diff --git a/docs/static/img/currencies/crypto/ETH.png b/docs/static/img/currencies/crypto/ETH.png new file mode 100644 index 0000000..4672dd0 Binary files /dev/null and b/docs/static/img/currencies/crypto/ETH.png differ diff --git a/docs/static/img/currencies/crypto/ETN.png b/docs/static/img/currencies/crypto/ETN.png new file mode 100644 index 0000000..be95889 Binary files /dev/null and b/docs/static/img/currencies/crypto/ETN.png differ diff --git a/docs/static/img/currencies/crypto/ETP.png b/docs/static/img/currencies/crypto/ETP.png new file mode 100644 index 0000000..4ad9c79 Binary files /dev/null and b/docs/static/img/currencies/crypto/ETP.png differ diff --git a/docs/static/img/currencies/crypto/EURS.png b/docs/static/img/currencies/crypto/EURS.png new file mode 100644 index 0000000..e00acbc Binary files /dev/null and b/docs/static/img/currencies/crypto/EURS.png differ diff --git a/docs/static/img/currencies/crypto/FCT.png b/docs/static/img/currencies/crypto/FCT.png new file mode 100644 index 0000000..a6123d9 Binary files /dev/null and b/docs/static/img/currencies/crypto/FCT.png differ diff --git a/docs/static/img/currencies/crypto/FET.png b/docs/static/img/currencies/crypto/FET.png new file mode 100644 index 0000000..dbf5528 Binary files /dev/null and b/docs/static/img/currencies/crypto/FET.png differ diff --git a/docs/static/img/currencies/crypto/FSN.png b/docs/static/img/currencies/crypto/FSN.png new file mode 100644 index 0000000..88e4573 Binary files /dev/null and b/docs/static/img/currencies/crypto/FSN.png differ diff --git a/docs/static/img/currencies/crypto/FTM.png b/docs/static/img/currencies/crypto/FTM.png new file mode 100644 index 0000000..327d5ed Binary files /dev/null and b/docs/static/img/currencies/crypto/FTM.png differ diff --git a/docs/static/img/currencies/crypto/FUN.png b/docs/static/img/currencies/crypto/FUN.png new file mode 100644 index 0000000..629fdf2 Binary files /dev/null and b/docs/static/img/currencies/crypto/FUN.png differ diff --git a/docs/static/img/currencies/crypto/FX.png b/docs/static/img/currencies/crypto/FX.png new file mode 100644 index 0000000..3d5eea0 Binary files /dev/null and b/docs/static/img/currencies/crypto/FX.png differ diff --git a/docs/static/img/currencies/crypto/GAS.png b/docs/static/img/currencies/crypto/GAS.png new file mode 100644 index 0000000..e6b9c13 Binary files /dev/null and b/docs/static/img/currencies/crypto/GAS.png differ diff --git a/docs/static/img/currencies/crypto/GNO.png b/docs/static/img/currencies/crypto/GNO.png new file mode 100644 index 0000000..417ca97 Binary files /dev/null and b/docs/static/img/currencies/crypto/GNO.png differ diff --git a/docs/static/img/currencies/crypto/GNT.png b/docs/static/img/currencies/crypto/GNT.png new file mode 100644 index 0000000..4a5e90c Binary files /dev/null and b/docs/static/img/currencies/crypto/GNT.png differ diff --git a/docs/static/img/currencies/crypto/GRIN.png b/docs/static/img/currencies/crypto/GRIN.png new file mode 100644 index 0000000..622974c Binary files /dev/null and b/docs/static/img/currencies/crypto/GRIN.png differ diff --git a/docs/static/img/currencies/crypto/GRS.png b/docs/static/img/currencies/crypto/GRS.png new file mode 100644 index 0000000..a2a0a5a Binary files /dev/null and b/docs/static/img/currencies/crypto/GRS.png differ diff --git a/docs/static/img/currencies/crypto/GXC.png b/docs/static/img/currencies/crypto/GXC.png new file mode 100644 index 0000000..61d3087 Binary files /dev/null and b/docs/static/img/currencies/crypto/GXC.png differ diff --git a/docs/static/img/currencies/crypto/HC.png b/docs/static/img/currencies/crypto/HC.png new file mode 100644 index 0000000..cf2ccda Binary files /dev/null and b/docs/static/img/currencies/crypto/HC.png differ diff --git a/docs/static/img/currencies/crypto/HEDG.png b/docs/static/img/currencies/crypto/HEDG.png new file mode 100644 index 0000000..2e7ff61 Binary files /dev/null and b/docs/static/img/currencies/crypto/HEDG.png differ diff --git a/docs/static/img/currencies/crypto/HOT.png b/docs/static/img/currencies/crypto/HOT.png new file mode 100644 index 0000000..12ac7ca Binary files /dev/null and b/docs/static/img/currencies/crypto/HOT.png differ diff --git a/docs/static/img/currencies/crypto/HPB.png b/docs/static/img/currencies/crypto/HPB.png new file mode 100644 index 0000000..b0b4d9b Binary files /dev/null and b/docs/static/img/currencies/crypto/HPB.png differ diff --git a/docs/static/img/currencies/crypto/HT.png b/docs/static/img/currencies/crypto/HT.png new file mode 100644 index 0000000..9691de9 Binary files /dev/null and b/docs/static/img/currencies/crypto/HT.png differ diff --git a/docs/static/img/currencies/crypto/HYN.png b/docs/static/img/currencies/crypto/HYN.png new file mode 100644 index 0000000..adb874e Binary files /dev/null and b/docs/static/img/currencies/crypto/HYN.png differ diff --git a/docs/static/img/currencies/crypto/ICX.png b/docs/static/img/currencies/crypto/ICX.png new file mode 100644 index 0000000..bf35a77 Binary files /dev/null and b/docs/static/img/currencies/crypto/ICX.png differ diff --git a/docs/static/img/currencies/crypto/IGNIS.png b/docs/static/img/currencies/crypto/IGNIS.png new file mode 100644 index 0000000..ac1ac3f Binary files /dev/null and b/docs/static/img/currencies/crypto/IGNIS.png differ diff --git a/docs/static/img/currencies/crypto/INB.png b/docs/static/img/currencies/crypto/INB.png new file mode 100644 index 0000000..f1e7660 Binary files /dev/null and b/docs/static/img/currencies/crypto/INB.png differ diff --git a/docs/static/img/currencies/crypto/IOST.png b/docs/static/img/currencies/crypto/IOST.png new file mode 100644 index 0000000..24436d0 Binary files /dev/null and b/docs/static/img/currencies/crypto/IOST.png differ diff --git a/docs/static/img/currencies/crypto/IOTX.png b/docs/static/img/currencies/crypto/IOTX.png new file mode 100644 index 0000000..1aa09b2 Binary files /dev/null and b/docs/static/img/currencies/crypto/IOTX.png differ diff --git a/docs/static/img/currencies/crypto/ITC.png b/docs/static/img/currencies/crypto/ITC.png new file mode 100644 index 0000000..114f9eb Binary files /dev/null and b/docs/static/img/currencies/crypto/ITC.png differ diff --git a/docs/static/img/currencies/crypto/KCS.png b/docs/static/img/currencies/crypto/KCS.png new file mode 100644 index 0000000..04dea50 Binary files /dev/null and b/docs/static/img/currencies/crypto/KCS.png differ diff --git a/docs/static/img/currencies/crypto/KMD.png b/docs/static/img/currencies/crypto/KMD.png new file mode 100644 index 0000000..1e336ba Binary files /dev/null and b/docs/static/img/currencies/crypto/KMD.png differ diff --git a/docs/static/img/currencies/crypto/KNC.png b/docs/static/img/currencies/crypto/KNC.png new file mode 100644 index 0000000..f45ac37 Binary files /dev/null and b/docs/static/img/currencies/crypto/KNC.png differ diff --git a/docs/static/img/currencies/crypto/LAMB.png b/docs/static/img/currencies/crypto/LAMB.png new file mode 100644 index 0000000..1574eb9 Binary files /dev/null and b/docs/static/img/currencies/crypto/LAMB.png differ diff --git a/docs/static/img/currencies/crypto/LCC.png b/docs/static/img/currencies/crypto/LCC.png new file mode 100644 index 0000000..8fe1b14 Binary files /dev/null and b/docs/static/img/currencies/crypto/LCC.png differ diff --git a/docs/static/img/currencies/crypto/LEO.png b/docs/static/img/currencies/crypto/LEO.png new file mode 100644 index 0000000..b6d6951 Binary files /dev/null and b/docs/static/img/currencies/crypto/LEO.png differ diff --git a/docs/static/img/currencies/crypto/LINA.png b/docs/static/img/currencies/crypto/LINA.png new file mode 100644 index 0000000..64aaf05 Binary files /dev/null and b/docs/static/img/currencies/crypto/LINA.png differ diff --git a/docs/static/img/currencies/crypto/LINK.png b/docs/static/img/currencies/crypto/LINK.png new file mode 100644 index 0000000..d8ecf2f Binary files /dev/null and b/docs/static/img/currencies/crypto/LINK.png differ diff --git a/docs/static/img/currencies/crypto/LOOM.png b/docs/static/img/currencies/crypto/LOOM.png new file mode 100644 index 0000000..420f783 Binary files /dev/null and b/docs/static/img/currencies/crypto/LOOM.png differ diff --git a/docs/static/img/currencies/crypto/LRC.png b/docs/static/img/currencies/crypto/LRC.png new file mode 100644 index 0000000..766ebf6 Binary files /dev/null and b/docs/static/img/currencies/crypto/LRC.png differ diff --git a/docs/static/img/currencies/crypto/LSK.png b/docs/static/img/currencies/crypto/LSK.png new file mode 100644 index 0000000..9666243 Binary files /dev/null and b/docs/static/img/currencies/crypto/LSK.png differ diff --git a/docs/static/img/currencies/crypto/LTC.png b/docs/static/img/currencies/crypto/LTC.png new file mode 100644 index 0000000..8ad8093 Binary files /dev/null and b/docs/static/img/currencies/crypto/LTC.png differ diff --git a/docs/static/img/currencies/crypto/MAID.png b/docs/static/img/currencies/crypto/MAID.png new file mode 100644 index 0000000..a0487f8 Binary files /dev/null and b/docs/static/img/currencies/crypto/MAID.png differ diff --git a/docs/static/img/currencies/crypto/MANA.png b/docs/static/img/currencies/crypto/MANA.png new file mode 100644 index 0000000..9532d4b Binary files /dev/null and b/docs/static/img/currencies/crypto/MANA.png differ diff --git a/docs/static/img/currencies/crypto/MATIC.png b/docs/static/img/currencies/crypto/MATIC.png new file mode 100644 index 0000000..79709a1 Binary files /dev/null and b/docs/static/img/currencies/crypto/MATIC.png differ diff --git a/docs/static/img/currencies/crypto/MCO.png b/docs/static/img/currencies/crypto/MCO.png new file mode 100644 index 0000000..e861b71 Binary files /dev/null and b/docs/static/img/currencies/crypto/MCO.png differ diff --git a/docs/static/img/currencies/crypto/MEDX.png b/docs/static/img/currencies/crypto/MEDX.png new file mode 100644 index 0000000..839045c Binary files /dev/null and b/docs/static/img/currencies/crypto/MEDX.png differ diff --git a/docs/static/img/currencies/crypto/MIOTA.png b/docs/static/img/currencies/crypto/MIOTA.png new file mode 100644 index 0000000..d7414d5 Binary files /dev/null and b/docs/static/img/currencies/crypto/MIOTA.png differ diff --git a/docs/static/img/currencies/crypto/MKR.png b/docs/static/img/currencies/crypto/MKR.png new file mode 100644 index 0000000..891cf48 Binary files /dev/null and b/docs/static/img/currencies/crypto/MKR.png differ diff --git a/docs/static/img/currencies/crypto/MONA.png b/docs/static/img/currencies/crypto/MONA.png new file mode 100644 index 0000000..6a07ca2 Binary files /dev/null and b/docs/static/img/currencies/crypto/MONA.png differ diff --git a/docs/static/img/currencies/crypto/MTL.png b/docs/static/img/currencies/crypto/MTL.png new file mode 100644 index 0000000..995284c Binary files /dev/null and b/docs/static/img/currencies/crypto/MTL.png differ diff --git a/docs/static/img/currencies/crypto/NANO.png b/docs/static/img/currencies/crypto/NANO.png new file mode 100644 index 0000000..ab3ae6c Binary files /dev/null and b/docs/static/img/currencies/crypto/NANO.png differ diff --git a/docs/static/img/currencies/crypto/NAS.png b/docs/static/img/currencies/crypto/NAS.png new file mode 100644 index 0000000..aca6fb7 Binary files /dev/null and b/docs/static/img/currencies/crypto/NAS.png differ diff --git a/docs/static/img/currencies/crypto/NEO.png b/docs/static/img/currencies/crypto/NEO.png new file mode 100644 index 0000000..e6b9c13 Binary files /dev/null and b/docs/static/img/currencies/crypto/NEO.png differ diff --git a/docs/static/img/currencies/crypto/NEW.png b/docs/static/img/currencies/crypto/NEW.png new file mode 100644 index 0000000..f70e86a Binary files /dev/null and b/docs/static/img/currencies/crypto/NEW.png differ diff --git a/docs/static/img/currencies/crypto/NEX.png b/docs/static/img/currencies/crypto/NEX.png new file mode 100644 index 0000000..3393020 Binary files /dev/null and b/docs/static/img/currencies/crypto/NEX.png differ diff --git a/docs/static/img/currencies/crypto/NEXO.png b/docs/static/img/currencies/crypto/NEXO.png new file mode 100644 index 0000000..b9d22e6 Binary files /dev/null and b/docs/static/img/currencies/crypto/NEXO.png differ diff --git a/docs/static/img/currencies/crypto/NPXS.png b/docs/static/img/currencies/crypto/NPXS.png new file mode 100644 index 0000000..2846a10 Binary files /dev/null and b/docs/static/img/currencies/crypto/NPXS.png differ diff --git a/docs/static/img/currencies/crypto/NRG.png b/docs/static/img/currencies/crypto/NRG.png new file mode 100644 index 0000000..0fddf4b Binary files /dev/null and b/docs/static/img/currencies/crypto/NRG.png differ diff --git a/docs/static/img/currencies/crypto/NULS.png b/docs/static/img/currencies/crypto/NULS.png new file mode 100644 index 0000000..7be463c Binary files /dev/null and b/docs/static/img/currencies/crypto/NULS.png differ diff --git a/docs/static/img/currencies/crypto/NXS.png b/docs/static/img/currencies/crypto/NXS.png new file mode 100644 index 0000000..04fd4da Binary files /dev/null and b/docs/static/img/currencies/crypto/NXS.png differ diff --git a/docs/static/img/currencies/crypto/NXT.png b/docs/static/img/currencies/crypto/NXT.png new file mode 100644 index 0000000..f71c20a Binary files /dev/null and b/docs/static/img/currencies/crypto/NXT.png differ diff --git a/docs/static/img/currencies/crypto/ODE.png b/docs/static/img/currencies/crypto/ODE.png new file mode 100644 index 0000000..3ffe975 Binary files /dev/null and b/docs/static/img/currencies/crypto/ODE.png differ diff --git a/docs/static/img/currencies/crypto/OMG.png b/docs/static/img/currencies/crypto/OMG.png new file mode 100644 index 0000000..9d44f49 Binary files /dev/null and b/docs/static/img/currencies/crypto/OMG.png differ diff --git a/docs/static/img/currencies/crypto/ONE.png b/docs/static/img/currencies/crypto/ONE.png new file mode 100644 index 0000000..a42bb1a Binary files /dev/null and b/docs/static/img/currencies/crypto/ONE.png differ diff --git a/docs/static/img/currencies/crypto/ONT.png b/docs/static/img/currencies/crypto/ONT.png new file mode 100644 index 0000000..29fc8fa Binary files /dev/null and b/docs/static/img/currencies/crypto/ONT.png differ diff --git a/docs/static/img/currencies/crypto/ORBS.png b/docs/static/img/currencies/crypto/ORBS.png new file mode 100644 index 0000000..b35df66 Binary files /dev/null and b/docs/static/img/currencies/crypto/ORBS.png differ diff --git a/docs/static/img/currencies/crypto/PAI.png b/docs/static/img/currencies/crypto/PAI.png new file mode 100644 index 0000000..0381450 Binary files /dev/null and b/docs/static/img/currencies/crypto/PAI.png differ diff --git a/docs/static/img/currencies/crypto/PAX.png b/docs/static/img/currencies/crypto/PAX.png new file mode 100644 index 0000000..dd9168d Binary files /dev/null and b/docs/static/img/currencies/crypto/PAX.png differ diff --git a/docs/static/img/currencies/crypto/PERL.png b/docs/static/img/currencies/crypto/PERL.png new file mode 100644 index 0000000..a030c61 Binary files /dev/null and b/docs/static/img/currencies/crypto/PERL.png differ diff --git a/docs/static/img/currencies/crypto/PIVX.png b/docs/static/img/currencies/crypto/PIVX.png new file mode 100644 index 0000000..3dd9d91 Binary files /dev/null and b/docs/static/img/currencies/crypto/PIVX.png differ diff --git a/docs/static/img/currencies/crypto/POLY.png b/docs/static/img/currencies/crypto/POLY.png new file mode 100644 index 0000000..b421030 Binary files /dev/null and b/docs/static/img/currencies/crypto/POLY.png differ diff --git a/docs/static/img/currencies/crypto/POWR.png b/docs/static/img/currencies/crypto/POWR.png new file mode 100644 index 0000000..32a1454 Binary files /dev/null and b/docs/static/img/currencies/crypto/POWR.png differ diff --git a/docs/static/img/currencies/crypto/PPT.png b/docs/static/img/currencies/crypto/PPT.png new file mode 100644 index 0000000..6515b4c Binary files /dev/null and b/docs/static/img/currencies/crypto/PPT.png differ diff --git a/docs/static/img/currencies/crypto/PZM.png b/docs/static/img/currencies/crypto/PZM.png new file mode 100644 index 0000000..b01e89d Binary files /dev/null and b/docs/static/img/currencies/crypto/PZM.png differ diff --git a/docs/static/img/currencies/crypto/QASH.png b/docs/static/img/currencies/crypto/QASH.png new file mode 100644 index 0000000..25f730f Binary files /dev/null and b/docs/static/img/currencies/crypto/QASH.png differ diff --git a/docs/static/img/currencies/crypto/QKC.png b/docs/static/img/currencies/crypto/QKC.png new file mode 100644 index 0000000..7c7f770 Binary files /dev/null and b/docs/static/img/currencies/crypto/QKC.png differ diff --git a/docs/static/img/currencies/crypto/QNT.png b/docs/static/img/currencies/crypto/QNT.png new file mode 100644 index 0000000..c93e529 Binary files /dev/null and b/docs/static/img/currencies/crypto/QNT.png differ diff --git a/docs/static/img/currencies/crypto/QTUM.png b/docs/static/img/currencies/crypto/QTUM.png new file mode 100644 index 0000000..85cf294 Binary files /dev/null and b/docs/static/img/currencies/crypto/QTUM.png differ diff --git a/docs/static/img/currencies/crypto/R.png b/docs/static/img/currencies/crypto/R.png new file mode 100644 index 0000000..70ddce2 Binary files /dev/null and b/docs/static/img/currencies/crypto/R.png differ diff --git a/docs/static/img/currencies/crypto/RDD.png b/docs/static/img/currencies/crypto/RDD.png new file mode 100644 index 0000000..5eeeb00 Binary files /dev/null and b/docs/static/img/currencies/crypto/RDD.png differ diff --git a/docs/static/img/currencies/crypto/REN.png b/docs/static/img/currencies/crypto/REN.png new file mode 100644 index 0000000..92a5200 Binary files /dev/null and b/docs/static/img/currencies/crypto/REN.png differ diff --git a/docs/static/img/currencies/crypto/REP.png b/docs/static/img/currencies/crypto/REP.png new file mode 100644 index 0000000..8dc8b62 Binary files /dev/null and b/docs/static/img/currencies/crypto/REP.png differ diff --git a/docs/static/img/currencies/crypto/RET.png b/docs/static/img/currencies/crypto/RET.png new file mode 100644 index 0000000..208d885 Binary files /dev/null and b/docs/static/img/currencies/crypto/RET.png differ diff --git a/docs/static/img/currencies/crypto/RHOC.png b/docs/static/img/currencies/crypto/RHOC.png new file mode 100644 index 0000000..1285320 Binary files /dev/null and b/docs/static/img/currencies/crypto/RHOC.png differ diff --git a/docs/static/img/currencies/crypto/RIF.png b/docs/static/img/currencies/crypto/RIF.png new file mode 100644 index 0000000..6c2a9f9 Binary files /dev/null and b/docs/static/img/currencies/crypto/RIF.png differ diff --git a/docs/static/img/currencies/crypto/RLC.png b/docs/static/img/currencies/crypto/RLC.png new file mode 100644 index 0000000..5340dec Binary files /dev/null and b/docs/static/img/currencies/crypto/RLC.png differ diff --git a/docs/static/img/currencies/crypto/ROX.png b/docs/static/img/currencies/crypto/ROX.png new file mode 100644 index 0000000..053e1c9 Binary files /dev/null and b/docs/static/img/currencies/crypto/ROX.png differ diff --git a/docs/static/img/currencies/crypto/RVN.png b/docs/static/img/currencies/crypto/RVN.png new file mode 100644 index 0000000..4a845fa Binary files /dev/null and b/docs/static/img/currencies/crypto/RVN.png differ diff --git a/docs/static/img/currencies/crypto/SAN.png b/docs/static/img/currencies/crypto/SAN.png new file mode 100644 index 0000000..e9bf2d6 Binary files /dev/null and b/docs/static/img/currencies/crypto/SAN.png differ diff --git a/docs/static/img/currencies/crypto/SC.png b/docs/static/img/currencies/crypto/SC.png new file mode 100644 index 0000000..96fa3d0 Binary files /dev/null and b/docs/static/img/currencies/crypto/SC.png differ diff --git a/docs/static/img/currencies/crypto/SEELE.png b/docs/static/img/currencies/crypto/SEELE.png new file mode 100644 index 0000000..afe3951 Binary files /dev/null and b/docs/static/img/currencies/crypto/SEELE.png differ diff --git a/docs/static/img/currencies/crypto/SNT.png b/docs/static/img/currencies/crypto/SNT.png new file mode 100644 index 0000000..3c02ab7 Binary files /dev/null and b/docs/static/img/currencies/crypto/SNT.png differ diff --git a/docs/static/img/currencies/crypto/SNX.png b/docs/static/img/currencies/crypto/SNX.png new file mode 100644 index 0000000..b25d5af Binary files /dev/null and b/docs/static/img/currencies/crypto/SNX.png differ diff --git a/docs/static/img/currencies/crypto/SOLVE.png b/docs/static/img/currencies/crypto/SOLVE.png new file mode 100644 index 0000000..8ca0a54 Binary files /dev/null and b/docs/static/img/currencies/crypto/SOLVE.png differ diff --git a/docs/static/img/currencies/crypto/STEEM.png b/docs/static/img/currencies/crypto/STEEM.png new file mode 100644 index 0000000..8711b83 Binary files /dev/null and b/docs/static/img/currencies/crypto/STEEM.png differ diff --git a/docs/static/img/currencies/crypto/STORJ.png b/docs/static/img/currencies/crypto/STORJ.png new file mode 100644 index 0000000..1902f55 Binary files /dev/null and b/docs/static/img/currencies/crypto/STORJ.png differ diff --git a/docs/static/img/currencies/crypto/STRAT.png b/docs/static/img/currencies/crypto/STRAT.png new file mode 100644 index 0000000..05c2b06 Binary files /dev/null and b/docs/static/img/currencies/crypto/STRAT.png differ diff --git a/docs/static/img/currencies/crypto/SYS.png b/docs/static/img/currencies/crypto/SYS.png new file mode 100644 index 0000000..b4e07de Binary files /dev/null and b/docs/static/img/currencies/crypto/SYS.png differ diff --git a/docs/static/img/currencies/crypto/TEL.png b/docs/static/img/currencies/crypto/TEL.png new file mode 100644 index 0000000..1dbae97 Binary files /dev/null and b/docs/static/img/currencies/crypto/TEL.png differ diff --git a/docs/static/img/currencies/crypto/TFUEL.png b/docs/static/img/currencies/crypto/TFUEL.png new file mode 100644 index 0000000..2a44bf2 Binary files /dev/null and b/docs/static/img/currencies/crypto/TFUEL.png differ diff --git a/docs/static/img/currencies/crypto/THETA.png b/docs/static/img/currencies/crypto/THETA.png new file mode 100644 index 0000000..0b6d98c Binary files /dev/null and b/docs/static/img/currencies/crypto/THETA.png differ diff --git a/docs/static/img/currencies/crypto/TKN.png b/docs/static/img/currencies/crypto/TKN.png new file mode 100644 index 0000000..a73044f Binary files /dev/null and b/docs/static/img/currencies/crypto/TKN.png differ diff --git a/docs/static/img/currencies/crypto/TOMO.png b/docs/static/img/currencies/crypto/TOMO.png new file mode 100644 index 0000000..983d799 Binary files /dev/null and b/docs/static/img/currencies/crypto/TOMO.png differ diff --git a/docs/static/img/currencies/crypto/TRUE.png b/docs/static/img/currencies/crypto/TRUE.png new file mode 100644 index 0000000..3a73a93 Binary files /dev/null and b/docs/static/img/currencies/crypto/TRUE.png differ diff --git a/docs/static/img/currencies/crypto/TRX.png b/docs/static/img/currencies/crypto/TRX.png new file mode 100644 index 0000000..1b52ba8 Binary files /dev/null and b/docs/static/img/currencies/crypto/TRX.png differ diff --git a/docs/static/img/currencies/crypto/TT.png b/docs/static/img/currencies/crypto/TT.png new file mode 100644 index 0000000..1c9b280 Binary files /dev/null and b/docs/static/img/currencies/crypto/TT.png differ diff --git a/docs/static/img/currencies/crypto/TTC.png b/docs/static/img/currencies/crypto/TTC.png new file mode 100644 index 0000000..525f496 Binary files /dev/null and b/docs/static/img/currencies/crypto/TTC.png differ diff --git a/docs/static/img/currencies/crypto/TUSD.png b/docs/static/img/currencies/crypto/TUSD.png new file mode 100644 index 0000000..d558fd3 Binary files /dev/null and b/docs/static/img/currencies/crypto/TUSD.png differ diff --git a/docs/static/img/currencies/crypto/UGAS.png b/docs/static/img/currencies/crypto/UGAS.png new file mode 100644 index 0000000..c4b7edc Binary files /dev/null and b/docs/static/img/currencies/crypto/UGAS.png differ diff --git a/docs/static/img/currencies/crypto/USDC.png b/docs/static/img/currencies/crypto/USDC.png new file mode 100644 index 0000000..eaf6836 Binary files /dev/null and b/docs/static/img/currencies/crypto/USDC.png differ diff --git a/docs/static/img/currencies/crypto/USDT.png b/docs/static/img/currencies/crypto/USDT.png new file mode 100644 index 0000000..98f24bf Binary files /dev/null and b/docs/static/img/currencies/crypto/USDT.png differ diff --git a/docs/static/img/currencies/crypto/VALOR.png b/docs/static/img/currencies/crypto/VALOR.png new file mode 100644 index 0000000..4073f3f Binary files /dev/null and b/docs/static/img/currencies/crypto/VALOR.png differ diff --git a/docs/static/img/currencies/crypto/VET.png b/docs/static/img/currencies/crypto/VET.png new file mode 100644 index 0000000..ab02e59 Binary files /dev/null and b/docs/static/img/currencies/crypto/VET.png differ diff --git a/docs/static/img/currencies/crypto/VSYS.png b/docs/static/img/currencies/crypto/VSYS.png new file mode 100644 index 0000000..c7d026f Binary files /dev/null and b/docs/static/img/currencies/crypto/VSYS.png differ diff --git a/docs/static/img/currencies/crypto/VTC.png b/docs/static/img/currencies/crypto/VTC.png new file mode 100644 index 0000000..18f9534 Binary files /dev/null and b/docs/static/img/currencies/crypto/VTC.png differ diff --git a/docs/static/img/currencies/crypto/WAN.png b/docs/static/img/currencies/crypto/WAN.png new file mode 100644 index 0000000..4b95659 Binary files /dev/null and b/docs/static/img/currencies/crypto/WAN.png differ diff --git a/docs/static/img/currencies/crypto/WAVES.png b/docs/static/img/currencies/crypto/WAVES.png new file mode 100644 index 0000000..fdd8ed3 Binary files /dev/null and b/docs/static/img/currencies/crypto/WAVES.png differ diff --git a/docs/static/img/currencies/crypto/WAX.png b/docs/static/img/currencies/crypto/WAX.png new file mode 100644 index 0000000..2f84ff3 Binary files /dev/null and b/docs/static/img/currencies/crypto/WAX.png differ diff --git a/docs/static/img/currencies/crypto/WICC.png b/docs/static/img/currencies/crypto/WICC.png new file mode 100644 index 0000000..3ecbb62 Binary files /dev/null and b/docs/static/img/currencies/crypto/WICC.png differ diff --git a/docs/static/img/currencies/crypto/WIN.png b/docs/static/img/currencies/crypto/WIN.png new file mode 100644 index 0000000..aeac98c Binary files /dev/null and b/docs/static/img/currencies/crypto/WIN.png differ diff --git a/docs/static/img/currencies/crypto/WTC.png b/docs/static/img/currencies/crypto/WTC.png new file mode 100644 index 0000000..728c46d Binary files /dev/null and b/docs/static/img/currencies/crypto/WTC.png differ diff --git a/docs/static/img/currencies/crypto/XDAI.png b/docs/static/img/currencies/crypto/XDAI.png new file mode 100644 index 0000000..358f9d5 Binary files /dev/null and b/docs/static/img/currencies/crypto/XDAI.png differ diff --git a/docs/static/img/currencies/crypto/XEM.png b/docs/static/img/currencies/crypto/XEM.png new file mode 100644 index 0000000..b750a83 Binary files /dev/null and b/docs/static/img/currencies/crypto/XEM.png differ diff --git a/docs/static/img/currencies/crypto/XLM.png b/docs/static/img/currencies/crypto/XLM.png new file mode 100644 index 0000000..1776a4f Binary files /dev/null and b/docs/static/img/currencies/crypto/XLM.png differ diff --git a/docs/static/img/currencies/crypto/XMR.png b/docs/static/img/currencies/crypto/XMR.png new file mode 100644 index 0000000..4b88148 Binary files /dev/null and b/docs/static/img/currencies/crypto/XMR.png differ diff --git a/docs/static/img/currencies/crypto/XMX.png b/docs/static/img/currencies/crypto/XMX.png new file mode 100644 index 0000000..8fb4f52 Binary files /dev/null and b/docs/static/img/currencies/crypto/XMX.png differ diff --git a/docs/static/img/currencies/crypto/XRC.png b/docs/static/img/currencies/crypto/XRC.png new file mode 100644 index 0000000..24b0b30 Binary files /dev/null and b/docs/static/img/currencies/crypto/XRC.png differ diff --git a/docs/static/img/currencies/crypto/XRP.png b/docs/static/img/currencies/crypto/XRP.png new file mode 100644 index 0000000..6722b37 Binary files /dev/null and b/docs/static/img/currencies/crypto/XRP.png differ diff --git a/docs/static/img/currencies/crypto/XTZ.png b/docs/static/img/currencies/crypto/XTZ.png new file mode 100644 index 0000000..695d92b Binary files /dev/null and b/docs/static/img/currencies/crypto/XTZ.png differ diff --git a/docs/static/img/currencies/crypto/XVG.png b/docs/static/img/currencies/crypto/XVG.png new file mode 100644 index 0000000..d26f0c1 Binary files /dev/null and b/docs/static/img/currencies/crypto/XVG.png differ diff --git a/docs/static/img/currencies/crypto/XZC.png b/docs/static/img/currencies/crypto/XZC.png new file mode 100644 index 0000000..39ff503 Binary files /dev/null and b/docs/static/img/currencies/crypto/XZC.png differ diff --git a/docs/static/img/currencies/crypto/ZB.png b/docs/static/img/currencies/crypto/ZB.png new file mode 100644 index 0000000..e164a25 Binary files /dev/null and b/docs/static/img/currencies/crypto/ZB.png differ diff --git a/docs/static/img/currencies/crypto/ZEC.png b/docs/static/img/currencies/crypto/ZEC.png new file mode 100644 index 0000000..5cc8a7a Binary files /dev/null and b/docs/static/img/currencies/crypto/ZEC.png differ diff --git a/docs/static/img/currencies/crypto/ZEN.png b/docs/static/img/currencies/crypto/ZEN.png new file mode 100644 index 0000000..ffc2200 Binary files /dev/null and b/docs/static/img/currencies/crypto/ZEN.png differ diff --git a/docs/static/img/currencies/crypto/ZIL.png b/docs/static/img/currencies/crypto/ZIL.png new file mode 100644 index 0000000..19f39fa Binary files /dev/null and b/docs/static/img/currencies/crypto/ZIL.png differ diff --git a/docs/static/img/currencies/crypto/ZRC.png b/docs/static/img/currencies/crypto/ZRC.png new file mode 100644 index 0000000..8f2d71d Binary files /dev/null and b/docs/static/img/currencies/crypto/ZRC.png differ diff --git a/docs/static/img/currencies/crypto/ZRX.png b/docs/static/img/currencies/crypto/ZRX.png new file mode 100644 index 0000000..98dc499 Binary files /dev/null and b/docs/static/img/currencies/crypto/ZRX.png differ diff --git a/docs/static/img/currencies/AUD.svg b/docs/static/img/currencies/fiat/AUD.svg similarity index 100% rename from docs/static/img/currencies/AUD.svg rename to docs/static/img/currencies/fiat/AUD.svg diff --git a/docs/static/img/currencies/BRL.svg b/docs/static/img/currencies/fiat/BRL.svg similarity index 100% rename from docs/static/img/currencies/BRL.svg rename to docs/static/img/currencies/fiat/BRL.svg diff --git a/docs/static/img/currencies/CAD.svg b/docs/static/img/currencies/fiat/CAD.svg similarity index 100% rename from docs/static/img/currencies/CAD.svg rename to docs/static/img/currencies/fiat/CAD.svg diff --git a/docs/static/img/currencies/CHF.svg b/docs/static/img/currencies/fiat/CHF.svg similarity index 100% rename from docs/static/img/currencies/CHF.svg rename to docs/static/img/currencies/fiat/CHF.svg diff --git a/docs/static/img/currencies/CLP.svg b/docs/static/img/currencies/fiat/CLP.svg similarity index 100% rename from docs/static/img/currencies/CLP.svg rename to docs/static/img/currencies/fiat/CLP.svg diff --git a/docs/static/img/currencies/CNY.svg b/docs/static/img/currencies/fiat/CNY.svg similarity index 100% rename from docs/static/img/currencies/CNY.svg rename to docs/static/img/currencies/fiat/CNY.svg diff --git a/docs/static/img/currencies/CZK.svg b/docs/static/img/currencies/fiat/CZK.svg similarity index 100% rename from docs/static/img/currencies/CZK.svg rename to docs/static/img/currencies/fiat/CZK.svg diff --git a/docs/static/img/currencies/DKK.svg b/docs/static/img/currencies/fiat/DKK.svg similarity index 100% rename from docs/static/img/currencies/DKK.svg rename to docs/static/img/currencies/fiat/DKK.svg diff --git a/docs/static/img/currencies/EUR.svg b/docs/static/img/currencies/fiat/EUR.svg similarity index 100% rename from docs/static/img/currencies/EUR.svg rename to docs/static/img/currencies/fiat/EUR.svg diff --git a/docs/static/img/currencies/GBP.svg b/docs/static/img/currencies/fiat/GBP.svg similarity index 100% rename from docs/static/img/currencies/GBP.svg rename to docs/static/img/currencies/fiat/GBP.svg diff --git a/docs/static/img/currencies/HKD.svg b/docs/static/img/currencies/fiat/HKD.svg similarity index 100% rename from docs/static/img/currencies/HKD.svg rename to docs/static/img/currencies/fiat/HKD.svg diff --git a/docs/static/img/currencies/HUF.svg b/docs/static/img/currencies/fiat/HUF.svg similarity index 100% rename from docs/static/img/currencies/HUF.svg rename to docs/static/img/currencies/fiat/HUF.svg diff --git a/docs/static/img/currencies/IDR.svg b/docs/static/img/currencies/fiat/IDR.svg similarity index 100% rename from docs/static/img/currencies/IDR.svg rename to docs/static/img/currencies/fiat/IDR.svg diff --git a/docs/static/img/currencies/ILS.svg b/docs/static/img/currencies/fiat/ILS.svg similarity index 100% rename from docs/static/img/currencies/ILS.svg rename to docs/static/img/currencies/fiat/ILS.svg diff --git a/docs/static/img/currencies/INR.svg b/docs/static/img/currencies/fiat/INR.svg similarity index 100% rename from docs/static/img/currencies/INR.svg rename to docs/static/img/currencies/fiat/INR.svg diff --git a/docs/static/img/currencies/JPY.svg b/docs/static/img/currencies/fiat/JPY.svg similarity index 100% rename from docs/static/img/currencies/JPY.svg rename to docs/static/img/currencies/fiat/JPY.svg diff --git a/docs/static/img/currencies/KRW.svg b/docs/static/img/currencies/fiat/KRW.svg similarity index 100% rename from docs/static/img/currencies/KRW.svg rename to docs/static/img/currencies/fiat/KRW.svg diff --git a/docs/static/img/currencies/MXN.svg b/docs/static/img/currencies/fiat/MXN.svg similarity index 100% rename from docs/static/img/currencies/MXN.svg rename to docs/static/img/currencies/fiat/MXN.svg diff --git a/docs/static/img/currencies/MYR.svg b/docs/static/img/currencies/fiat/MYR.svg similarity index 100% rename from docs/static/img/currencies/MYR.svg rename to docs/static/img/currencies/fiat/MYR.svg diff --git a/docs/static/img/currencies/NOK.svg b/docs/static/img/currencies/fiat/NOK.svg similarity index 100% rename from docs/static/img/currencies/NOK.svg rename to docs/static/img/currencies/fiat/NOK.svg diff --git a/docs/static/img/currencies/NZD.svg b/docs/static/img/currencies/fiat/NZD.svg similarity index 100% rename from docs/static/img/currencies/NZD.svg rename to docs/static/img/currencies/fiat/NZD.svg diff --git a/docs/static/img/currencies/PHP.svg b/docs/static/img/currencies/fiat/PHP.svg similarity index 100% rename from docs/static/img/currencies/PHP.svg rename to docs/static/img/currencies/fiat/PHP.svg diff --git a/docs/static/img/currencies/PKR.svg b/docs/static/img/currencies/fiat/PKR.svg similarity index 100% rename from docs/static/img/currencies/PKR.svg rename to docs/static/img/currencies/fiat/PKR.svg diff --git a/docs/static/img/currencies/PLN.svg b/docs/static/img/currencies/fiat/PLN.svg similarity index 100% rename from docs/static/img/currencies/PLN.svg rename to docs/static/img/currencies/fiat/PLN.svg diff --git a/docs/static/img/currencies/RUB.svg b/docs/static/img/currencies/fiat/RUB.svg similarity index 100% rename from docs/static/img/currencies/RUB.svg rename to docs/static/img/currencies/fiat/RUB.svg diff --git a/docs/static/img/currencies/SEK.svg b/docs/static/img/currencies/fiat/SEK.svg similarity index 100% rename from docs/static/img/currencies/SEK.svg rename to docs/static/img/currencies/fiat/SEK.svg diff --git a/docs/static/img/currencies/SGD.svg b/docs/static/img/currencies/fiat/SGD.svg similarity index 100% rename from docs/static/img/currencies/SGD.svg rename to docs/static/img/currencies/fiat/SGD.svg diff --git a/docs/static/img/currencies/THB.svg b/docs/static/img/currencies/fiat/THB.svg similarity index 100% rename from docs/static/img/currencies/THB.svg rename to docs/static/img/currencies/fiat/THB.svg diff --git a/docs/static/img/currencies/TRY.svg b/docs/static/img/currencies/fiat/TRY.svg similarity index 100% rename from docs/static/img/currencies/TRY.svg rename to docs/static/img/currencies/fiat/TRY.svg diff --git a/docs/static/img/currencies/TWD.svg b/docs/static/img/currencies/fiat/TWD.svg similarity index 100% rename from docs/static/img/currencies/TWD.svg rename to docs/static/img/currencies/fiat/TWD.svg diff --git a/docs/static/img/currencies/USD.svg b/docs/static/img/currencies/fiat/USD.svg similarity index 100% rename from docs/static/img/currencies/USD.svg rename to docs/static/img/currencies/fiat/USD.svg diff --git a/docs/static/img/currencies/VND.svg b/docs/static/img/currencies/fiat/VND.svg similarity index 100% rename from docs/static/img/currencies/VND.svg rename to docs/static/img/currencies/fiat/VND.svg diff --git a/docs/static/img/currencies/ZAR.svg b/docs/static/img/currencies/fiat/ZAR.svg similarity index 100% rename from docs/static/img/currencies/ZAR.svg rename to docs/static/img/currencies/fiat/ZAR.svg diff --git a/docs/static/img/diamond.svg b/docs/static/img/diamond.svg new file mode 100644 index 0000000..0e2a2bd --- /dev/null +++ b/docs/static/img/diamond.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/docs/static/img/farmer-s-market-kiosk-1.svg b/docs/static/img/farmer-s-market-kiosk-1.svg new file mode 100644 index 0000000..540a141 --- /dev/null +++ b/docs/static/img/farmer-s-market-kiosk-1.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/docs/static/img/search.svg b/docs/static/img/search.svg new file mode 100644 index 0000000..b128fb6 --- /dev/null +++ b/docs/static/img/search.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/docs/static/img/vertical-swap.svg b/docs/static/img/vertical-swap.svg new file mode 100644 index 0000000..a8a262c --- /dev/null +++ b/docs/static/img/vertical-swap.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/docs/static/js/main-001f030518e434ae4cd3.js b/docs/static/js/main-001f030518e434ae4cd3.js deleted file mode 100644 index 6dcef59..0000000 --- a/docs/static/js/main-001f030518e434ae4cd3.js +++ /dev/null @@ -1,7 +0,0 @@ -!function(e){function t(n){if(r[n])return r[n].exports;var a=r[n]={i:n,l:!1,exports:{}};return e[n].call(a.exports,a,a.exports,t),a.l=!0,a.exports}var r={};t.m=e,t.c=r,t.i=function(e){return e},t.d=function(e,r,n){t.o(e,r)||Object.defineProperty(e,r,{configurable:!1,enumerable:!0,get:n})},t.n=function(e){var r=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(r,"a",r),r},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p="/DAIHard/",t(t.s=43)}([function(e,t){e.exports={options:{usePureJavaScript:!1}}},function(e,t,r){(function(t,n,a,i){function o(e){if(8!==e&&16!==e&&24!==e&&32!==e)throw new Error("Only 8, 16, 24, or 32 bits supported: "+e)}function u(e){if(this.data="",this.read=0,"string"==typeof e)this.data=e;else if(l.isArrayBuffer(e)||l.isArrayBufferView(e))if(void 0!==i&&e instanceof i)this.data=e.toString("binary");else{var t=new Uint8Array(e);try{this.data=String.fromCharCode.apply(null,t)}catch(e){for(var r=0;r15?(i=Date.now(),s(e)):(a.push(e),1===a.length&&u.setAttribute("a",o=!o))}}l.nextTick=l.setImmediate}(),l.isNodejs=void 0!==t&&t.versions&&t.versions.node,l.globalScope=function(){return l.isNodejs?a:"undefined"==typeof self?window:self}(),l.isArray=Array.isArray||function(e){return"[object Array]"===Object.prototype.toString.call(e)},l.isArrayBuffer=function(e){return"undefined"!=typeof ArrayBuffer&&e instanceof ArrayBuffer},l.isArrayBufferView=function(e){return e&&l.isArrayBuffer(e.buffer)&&void 0!==e.byteLength},l.ByteBuffer=u,l.ByteStringBuffer=u;l.ByteStringBuffer.prototype._optimizeConstructedString=function(e){this._constructedStringLength+=e,this._constructedStringLength>4096&&(this.data.substr(0,1),this._constructedStringLength=0)},l.ByteStringBuffer.prototype.length=function(){return this.data.length-this.read},l.ByteStringBuffer.prototype.isEmpty=function(){return this.length()<=0},l.ByteStringBuffer.prototype.putByte=function(e){return this.putBytes(String.fromCharCode(e))},l.ByteStringBuffer.prototype.fillWithByte=function(e,t){e=String.fromCharCode(e);for(var r=this.data;t>0;)1&t&&(r+=e),(t>>>=1)>0&&(e+=e);return this.data=r,this._optimizeConstructedString(t),this},l.ByteStringBuffer.prototype.putBytes=function(e){return this.data+=e,this._optimizeConstructedString(e.length),this},l.ByteStringBuffer.prototype.putString=function(e){return this.putBytes(l.encodeUtf8(e))},l.ByteStringBuffer.prototype.putInt16=function(e){return this.putBytes(String.fromCharCode(e>>8&255)+String.fromCharCode(255&e))},l.ByteStringBuffer.prototype.putInt24=function(e){return this.putBytes(String.fromCharCode(e>>16&255)+String.fromCharCode(e>>8&255)+String.fromCharCode(255&e))},l.ByteStringBuffer.prototype.putInt32=function(e){return this.putBytes(String.fromCharCode(e>>24&255)+String.fromCharCode(e>>16&255)+String.fromCharCode(e>>8&255)+String.fromCharCode(255&e))},l.ByteStringBuffer.prototype.putInt16Le=function(e){return this.putBytes(String.fromCharCode(255&e)+String.fromCharCode(e>>8&255))},l.ByteStringBuffer.prototype.putInt24Le=function(e){return this.putBytes(String.fromCharCode(255&e)+String.fromCharCode(e>>8&255)+String.fromCharCode(e>>16&255))},l.ByteStringBuffer.prototype.putInt32Le=function(e){return this.putBytes(String.fromCharCode(255&e)+String.fromCharCode(e>>8&255)+String.fromCharCode(e>>16&255)+String.fromCharCode(e>>24&255))},l.ByteStringBuffer.prototype.putInt=function(e,t){o(t);var r="";do{t-=8,r+=String.fromCharCode(e>>t&255)}while(t>0);return this.putBytes(r)},l.ByteStringBuffer.prototype.putSignedInt=function(e,t){return e<0&&(e+=2<0);return t},l.ByteStringBuffer.prototype.getSignedInt=function(e){var t=this.getInt(e),r=2<=r&&(t-=r<<1),t},l.ByteStringBuffer.prototype.getBytes=function(e){var t;return e?(e=Math.min(this.length(),e),t=this.data.slice(this.read,this.read+e),this.read+=e):0===e?t="":(t=0===this.read?this.data:this.data.slice(this.read),this.clear()),t},l.ByteStringBuffer.prototype.bytes=function(e){return void 0===e?this.data.slice(this.read):this.data.slice(this.read,this.read+e)},l.ByteStringBuffer.prototype.at=function(e){return this.data.charCodeAt(this.read+e)},l.ByteStringBuffer.prototype.setAt=function(e,t){return this.data=this.data.substr(0,this.read+e)+String.fromCharCode(t)+this.data.substr(this.read+e+1),this},l.ByteStringBuffer.prototype.last=function(){return this.data.charCodeAt(this.data.length-1)},l.ByteStringBuffer.prototype.copy=function(){var e=l.createBuffer(this.data);return e.read=this.read,e},l.ByteStringBuffer.prototype.compact=function(){return this.read>0&&(this.data=this.data.slice(this.read),this.read=0),this},l.ByteStringBuffer.prototype.clear=function(){return this.data="",this.read=0,this},l.ByteStringBuffer.prototype.truncate=function(e){var t=Math.max(0,this.length()-e);return this.data=this.data.substr(this.read,t),this.read=0,this},l.ByteStringBuffer.prototype.toHex=function(){for(var e="",t=this.read;t=e)return this;t=Math.max(t||this.growSize,e);var r=new Uint8Array(this.data.buffer,this.data.byteOffset,this.data.byteLength),n=new Uint8Array(this.length()+t);return n.set(r),this.data=new DataView(n.buffer),this},l.DataBuffer.prototype.putByte=function(e){return this.accommodate(1),this.data.setUint8(this.write++,e),this},l.DataBuffer.prototype.fillWithByte=function(e,t){this.accommodate(t);for(var r=0;r>8&65535),this.data.setInt8(this.write,e>>16&255),this.write+=3,this},l.DataBuffer.prototype.putInt32=function(e){return this.accommodate(4),this.data.setInt32(this.write,e),this.write+=4,this},l.DataBuffer.prototype.putInt16Le=function(e){return this.accommodate(2),this.data.setInt16(this.write,e,!0),this.write+=2,this},l.DataBuffer.prototype.putInt24Le=function(e){return this.accommodate(3),this.data.setInt8(this.write,e>>16&255),this.data.setInt16(this.write,e>>8&65535,!0),this.write+=3,this},l.DataBuffer.prototype.putInt32Le=function(e){return this.accommodate(4),this.data.setInt32(this.write,e,!0),this.write+=4,this},l.DataBuffer.prototype.putInt=function(e,t){o(t),this.accommodate(t/8);do{t-=8,this.data.setInt8(this.write++,e>>t&255)}while(t>0);return this},l.DataBuffer.prototype.putSignedInt=function(e,t){return o(t),this.accommodate(t/8),e<0&&(e+=2<0);return t},l.DataBuffer.prototype.getSignedInt=function(e){var t=this.getInt(e),r=2<=r&&(t-=r<<1),t},l.DataBuffer.prototype.getBytes=function(e){var t;return e?(e=Math.min(this.length(),e),t=this.data.slice(this.read,this.read+e),this.read+=e):0===e?t="":(t=0===this.read?this.data:this.data.slice(this.read),this.clear()),t},l.DataBuffer.prototype.bytes=function(e){return void 0===e?this.data.slice(this.read):this.data.slice(this.read,this.read+e)},l.DataBuffer.prototype.at=function(e){return this.data.getUint8(this.read+e)},l.DataBuffer.prototype.setAt=function(e,t){return this.data.setUint8(e,t),this},l.DataBuffer.prototype.last=function(){return this.data.getUint8(this.write-1)},l.DataBuffer.prototype.copy=function(){return new l.DataBuffer(this)},l.DataBuffer.prototype.compact=function(){if(this.read>0){var e=new Uint8Array(this.data.buffer,this.read),t=new Uint8Array(e.byteLength);t.set(e),this.data=new DataView(t),this.write-=this.read,this.read=0}return this},l.DataBuffer.prototype.clear=function(){return this.data=new DataView(new ArrayBuffer(0)),this.read=this.write=0,this},l.DataBuffer.prototype.truncate=function(e){return this.write=Math.max(0,this.length()-e),this.read=Math.min(this.read,this.write),this},l.DataBuffer.prototype.toHex=function(){for(var e="",t=this.read;t0;)1&t&&(r+=e),(t>>>=1)>0&&(e+=e);return r},l.xorBytes=function(e,t,r){for(var n="",a="",i="",o=0,u=0;r>0;--r,++o)a=e.charCodeAt(o)^t.charCodeAt(o),u>=10&&(n+=i,i="",u=0),i+=String.fromCharCode(a),++u;return n+=i},l.hexToBytes=function(e){var t="",r=0;for(!0&e.length&&(r=1,t+=String.fromCharCode(parseInt(e[0],16)));r>24&255)+String.fromCharCode(e>>16&255)+String.fromCharCode(e>>8&255)+String.fromCharCode(255&e)};var d="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",h=[62,-1,-1,-1,63,52,53,54,55,56,57,58,59,60,61,-1,-1,-1,64,-1,-1,-1,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,-1,-1,-1,-1,-1,-1,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51],p="123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz";l.encode64=function(e,t){for(var r,n,a,i="",o="",u=0;u>2),i+=d.charAt((3&r)<<4|n>>4),isNaN(n)?i+="==":(i+=d.charAt((15&n)<<2|a>>6),i+=isNaN(a)?"=":d.charAt(63&a)),t&&i.length>t&&(o+=i.substr(0,t)+"\r\n",i=i.substr(t));return o+=i},l.decode64=function(e){e=e.replace(/[^A-Za-z0-9\+\/\=]/g,"");for(var t,r,n,a,i="",o=0;o>4),64!==n&&(i+=String.fromCharCode((15&r)<<4|n>>2),64!==a&&(i+=String.fromCharCode((3&n)<<6|a)));return i},l.encodeUtf8=function(e){return unescape(encodeURIComponent(e))},l.decodeUtf8=function(e){return decodeURIComponent(escape(e))},l.binary={raw:{},hex:{},base64:{},base58:{},baseN:{encode:f.encode,decode:f.decode}},l.binary.raw.encode=function(e){return String.fromCharCode.apply(null,e)},l.binary.raw.decode=function(e,t,r){var n=t;n||(n=new Uint8Array(e.length)),r=r||0;for(var a=r,i=0;i>2),i+=d.charAt((3&r)<<4|n>>4),isNaN(n)?i+="==":(i+=d.charAt((15&n)<<2|a>>6),i+=isNaN(a)?"=":d.charAt(63&a)),t&&i.length>t&&(o+=i.substr(0,t)+"\r\n",i=i.substr(t));return o+=i},l.binary.base64.decode=function(e,t,r){var n=t;n||(n=new Uint8Array(3*Math.ceil(e.length/4))),e=e.replace(/[^A-Za-z0-9\+\/\=]/g,""),r=r||0;for(var a,i,o,u,s=0,c=r;s>4,64!==o&&(n[c++]=(15&i)<<4|o>>2,64!==u&&(n[c++]=(3&o)<<6|u));return t?c-r:n.subarray(0,c)},l.binary.base58.encode=function(e,t){return l.binary.baseN.encode(e,p,t)},l.binary.base58.decode=function(e,t){return l.binary.baseN.decode(e,p,t)},l.text={utf8:{},utf16:{}},l.text.utf8.encode=function(e,t,r){e=l.encodeUtf8(e);var n=t;n||(n=new Uint8Array(e.length)),r=r||0;for(var a=r,i=0;i0?(a=r[n].substring(0,o),i=r[n].substring(o+1)):(a=r[n],i=null),a in t||(t[a]=[]),a in Object.prototype||null===i||t[a].push(unescape(i))}return t};return void 0===e?(null===E&&(E="undefined"!=typeof window&&window.location&&window.location.search?r(window.location.search.substring(1)):{}),t=E):t=r(e),t},l.parseFragment=function(e){var t=e,r="",n=e.indexOf("?");n>0&&(t=e.substring(0,n),r=e.substring(n+1));var a=t.split("/");return a.length>0&&""===a[0]&&a.shift(),{pathString:t,queryString:r,path:a,query:""===r?{}:l.getQueryVariables(r)}},l.makeRequest=function(e){var t=l.parseFragment(e),r={path:t.pathString,query:t.queryString,getPath:function(e){return void 0===e?t.path:t.path[e]},getQuery:function(e,r){var n;return void 0===e?n=t.query:(n=t.query[e])&&void 0!==r&&(n=n[r]),n},getQueryLast:function(e,t){var n=r.getQuery(e);return n?n[n.length-1]:t}};return r},l.makeLink=function(e,t,r){e=jQuery.isArray(e)?e.join("/"):e;var n=jQuery.param(t||{});return r=r||"",e+(n.length>0?"?"+n:"")+(r.length>0?"#"+r:"")},l.setPath=function(e,t,r){if("object"==typeof e&&null!==e)for(var n=0,a=t.length;n0&&i.push(r),o=n.lastIndex;var u=t[0][1];switch(u){case"s":case"o":a");break;case"%":i.push("%");break;default:i.push("<%"+u+"?>")}}return i.push(e.substring(o)),i.join("")},l.formatNumber=function(e,t,r,n){var a=e,i=isNaN(t=Math.abs(t))?2:t,o=void 0===r?",":r,u=void 0===n?".":n,s=a<0?"-":"",c=parseInt(a=Math.abs(+a||0).toFixed(i),10)+"",f=c.length>3?c.length%3:0;return s+(f?c.substr(0,f)+u:"")+c.substr(f).replace(/(\d{3})(?=\d)/g,"$1"+u)+(i?o+Math.abs(a-c).toFixed(i).slice(2):"")},l.formatSize=function(e){return e=e>=1073741824?l.formatNumber(e/1073741824,2,".","")+" GiB":e>=1048576?l.formatNumber(e/1048576,2,".","")+" MiB":e>=1024?l.formatNumber(e/1024,0)+" KiB":l.formatNumber(e,0)+" bytes"},l.bytesFromIP=function(e){return-1!==e.indexOf(".")?l.bytesFromIPv4(e):-1!==e.indexOf(":")?l.bytesFromIPv6(e):null},l.bytesFromIPv4=function(e){if(e=e.split("."),4!==e.length)return null;for(var t=l.createBuffer(),r=0;rr[n].end-r[n].start&&(n=r.length-1)):r.push({start:u,end:u})}t.push(i)}if(r.length>0){var s=r[n];s.end-s.start>0&&(t.splice(s.start,s.end-s.start+1,""),0===s.start&&t.unshift(""),7===s.end&&t.push(""))}return t.join(":")},l.estimateCores=function(e,t){function r(e,o,u){if(0===o){var s=Math.floor(e.reduce(function(e,t){return e+t},0)/e.length);return l.cores=Math.max(1,s),URL.revokeObjectURL(i),t(null,l.cores)}n(u,function(t,n){e.push(a(u,n)),r(e,o-1,u)})}function n(e,t){for(var r=[],n=[],a=0;au.st&&a.sta.st&&u.st0)return l.cores=navigator.hardwareConcurrency,t(null,l.cores);if("undefined"==typeof Worker)return l.cores=1,t(null,l.cores);if("undefined"==typeof Blob)return l.cores=2,t(null,l.cores);var i=URL.createObjectURL(new Blob(["(",function(){self.addEventListener("message",function(e){for(var t=Date.now(),r=t+4;Date.now()t){var n=new Error("Too few bytes to parse DER.");throw n.available=e.length(),n.remaining=t,n.requested=r,n}}function a(e,t,r,i){var s;n(e,t,2);var c=e.getByte();t--;var f=192&c,l=31&c;s=e.length();var d=u(e,t);if(t-=s-e.length(),void 0!==d&&d>t){if(i.strict){var h=new Error("Too few bytes to read ASN.1 value.");throw h.available=e.length(),h.remaining=t,h.requested=d,h}d=t}var p,v,g=32==(32&c);if(g)if(p=[],void 0===d)for(;;){if(n(e,t,2),e.bytes(2)===String.fromCharCode(0,0)){e.getBytes(2),t-=2;break}s=e.length(),p.push(a(e,t,r+1,i)),t-=s-e.length()}else for(;d>0;)s=e.length(),p.push(a(e,d,r+1,i)),t-=s-e.length(),d-=s-e.length();if(void 0===p&&f===o.Class.UNIVERSAL&&l===o.Type.BITSTRING&&(v=e.bytes(d)),void 0===p&&i.decodeBitStrings&&f===o.Class.UNIVERSAL&&l===o.Type.BITSTRING&&d>1){var y=e.read,m=t,b=0;if(l===o.Type.BITSTRING&&(n(e,t,1),b=e.getByte(),t--),0===b)try{s=e.length();var C={verbose:i.verbose,strict:!0,decodeBitStrings:!0},S=a(e,t,r+1,C),E=s-e.length();t-=E,l==o.Type.BITSTRING&&E++;var T=S.tagClass;E!==d||T!==o.Class.UNIVERSAL&&T!==o.Class.CONTEXT_SPECIFIC||(p=[S])}catch(e){}void 0===p&&(e.read=y,t=m)}if(void 0===p){if(void 0===d){if(i.strict)throw new Error("Non-constructed ASN.1 object of indefinite length.");d=t}if(l===o.Type.BMPSTRING)for(p="";d>0;d-=2)n(e,t,2),p+=String.fromCharCode(e.getInt16()),t-=2;else p=e.getBytes(d)}var w=void 0===v?null:{bitStringContents:v};return o.create(f,l,g,p,w)}var i=r(0);r(1),r(6);var o=e.exports=i.asn1=i.asn1||{};o.Class={UNIVERSAL:0,APPLICATION:64,CONTEXT_SPECIFIC:128,PRIVATE:192},o.Type={NONE:0,BOOLEAN:1,INTEGER:2,BITSTRING:3,OCTETSTRING:4,NULL:5,OID:6,ODESC:7,EXTERNAL:8,REAL:9,ENUMERATED:10,EMBEDDED:11,UTF8:12,ROID:13,SEQUENCE:16,SET:17,PRINTABLESTRING:19,IA5STRING:22,UTCTIME:23,GENERALIZEDTIME:24,BMPSTRING:30},o.create=function(e,t,r,n,a){if(i.util.isArray(n)){for(var u=[],s=0;s1&&(0===e.value.charCodeAt(0)&&0==(128&e.value.charCodeAt(1))||255===e.value.charCodeAt(0)&&128==(128&e.value.charCodeAt(1)))?n.putBytes(e.value.substr(1)):n.putBytes(e.value);if(t.putByte(r),n.length()<=127)t.putByte(127&n.length());else{var s=n.length(),c="";do{c+=String.fromCharCode(255&s),s>>>=8}while(s>0);t.putByte(128|c.length);for(var u=c.length-1;u>=0;--u)t.putByte(c.charCodeAt(u))}return t.putBuffer(n),t},o.oidToDer=function(e){var t=e.split("."),r=i.util.createBuffer();r.putByte(40*parseInt(t[0],10)+parseInt(t[1],10));for(var n,a,o,u,s=2;s>>=7,n||(u|=128),a.push(u),n=!1}while(o>0);for(var c=a.length-1;c>=0;--c)r.putByte(a[c])}return r},o.derToOid=function(e){var t;"string"==typeof e&&(e=i.util.createBuffer(e));var r=e.getByte();t=Math.floor(r/40)+"."+r%40;for(var n=0;e.length()>0;)r=e.getByte(),n<<=7,128&r?n+=127&r:(t+="."+(n+r),n=0);return t},o.utcTimeToDate=function(e){var t=new Date,r=parseInt(e.substr(0,2),10);r=r>=50?1900+r:2e3+r;var n=parseInt(e.substr(2,2),10)-1,a=parseInt(e.substr(4,2),10),i=parseInt(e.substr(6,2),10),o=parseInt(e.substr(8,2),10),u=0;if(e.length>11){var s=e.charAt(10),c=10;"+"!==s&&"-"!==s&&(u=parseInt(e.substr(10,2),10),c+=2)}if(t.setUTCFullYear(r,n,a),t.setUTCHours(i,o,u,0),c&&("+"===(s=e.charAt(c))||"-"===s)){var f=parseInt(e.substr(c+1,2),10),l=parseInt(e.substr(c+4,2),10),d=60*f+l;d*=6e4,"+"===s?t.setTime(+t-d):t.setTime(+t+d)}return t},o.generalizedTimeToDate=function(e){var t=new Date,r=parseInt(e.substr(0,4),10),n=parseInt(e.substr(4,2),10)-1,a=parseInt(e.substr(6,2),10),i=parseInt(e.substr(8,2),10),o=parseInt(e.substr(10,2),10),u=parseInt(e.substr(12,2),10),s=0,c=0,f=!1;"Z"===e.charAt(e.length-1)&&(f=!0);var l=e.length-5,d=e.charAt(l);if("+"===d||"-"===d){c=60*parseInt(e.substr(l+1,2),10)+parseInt(e.substr(l+4,2),10),c*=6e4,"+"===d&&(c*=-1),f=!0}return"."===e.charAt(14)&&(s=1e3*parseFloat(e.substr(14),10)),f?(t.setUTCFullYear(r,n,a),t.setUTCHours(i,o,u,s),t.setTime(+t+c)):(t.setFullYear(r,n,a),t.setHours(i,o,u,s)),t},o.dateToUtcTime=function(e){if("string"==typeof e)return e;var t="",r=[];r.push((""+e.getUTCFullYear()).substr(2)),r.push(""+(e.getUTCMonth()+1)),r.push(""+e.getUTCDate()),r.push(""+e.getUTCHours()),r.push(""+e.getUTCMinutes()),r.push(""+e.getUTCSeconds());for(var n=0;n=-128&&e<128)return t.putSignedInt(e,8);if(e>=-32768&&e<32768)return t.putSignedInt(e,16);if(e>=-8388608&&e<8388608)return t.putSignedInt(e,24);if(e>=-2147483648&&e<2147483648)return t.putSignedInt(e,32);var r=new Error("Integer too large; max is 32-bits.");throw r.integer=e,r},o.derToInteger=function(e){"string"==typeof e&&(e=i.util.createBuffer(e));var t=8*e.length();if(t>32)throw new Error("Integer too large; max is 32-bits.");return e.getSignedInt(t)},o.validate=function(e,t,r,n){var a=!1;if(e.tagClass!==t.tagClass&&void 0!==t.tagClass||e.type!==t.type&&void 0!==t.type)n&&(e.tagClass!==t.tagClass&&n.push("["+t.name+'] Expected tag class "'+t.tagClass+'", got "'+e.tagClass+'"'),e.type!==t.type&&n.push("["+t.name+'] Expected type "'+t.type+'", got "'+e.type+'"'));else if(e.constructed===t.constructed||void 0===t.constructed){if(a=!0,t.value&&i.util.isArray(t.value))for(var u=0,s=0;a&&s0&&(n+="\n");for(var a="",u=0;u1?n+="0x"+i.util.bytesToHex(e.value.slice(1)):n+="(none)",e.value.length>0){var d=e.value.charCodeAt(0);1==d?n+=" (1 unused bit shown)":d>1&&(n+=" ("+d+" unused bits shown)")}}else e.type===o.Type.OCTETSTRING?(s.test(e.value)||(n+="("+e.value+") "),n+="0x"+i.util.bytesToHex(e.value)):e.type===o.Type.UTF8?n+=i.util.decodeUtf8(e.value):e.type===o.Type.PRINTABLESTRING||e.type===o.Type.IA5String?n+=e.value:s.test(e.value)?n+="0x"+i.util.bytesToHex(e.value):0===e.value.length?n+="[null]":n+=e.value}return n}},function(e,t,r){var n=r(0);e.exports=n.md=n.md||{},n.md.algorithms=n.md.algorithms||{}},function(e,t,r){function n(e,t){var r=function(){return new s.aes.Algorithm(e,t)};s.cipher.registerAlgorithm(e,r)}function a(){p=!0,l=[0,1,2,4,8,16,32,64,128,27,54];for(var e=new Array(256),t=0;t<128;++t)e[t]=t<<1,e[t+128]=t+128<<1^283;c=new Array(256),f=new Array(256),d=new Array(4),h=new Array(4);for(var t=0;t<4;++t)d[t]=new Array(256),h[t]=new Array(256);for(var r,n,a,i,o,u,s,v=0,g=0,t=0;t<256;++t){i=g^g<<1^g<<2^g<<3^g<<4,i=i>>8^255&i^99,c[v]=i,f[i]=v,o=e[i],r=e[v],n=e[r],a=e[n],u=o<<24^i<<16^i<<8^i^o,s=(r^n^a)<<24^(v^a)<<16^(v^n^a)<<8^v^r^a;for(var y=0;y<4;++y)d[y][v]=u,h[y][i]=s,u=u<<24|u>>>8,s=s<<24|s>>>8;0===v?v=g=1:(v=r^e[e[e[r^a]]],g^=e[e[g]])}}function i(e,t){for(var r,n=e.slice(0),a=1,i=n.length,o=i+6+1,u=v*o,s=i;s>>16&255]<<24^c[r>>>8&255]<<16^c[255&r]<<8^c[r>>>24]^l[a]<<24,a++):i>6&&s%i==4&&(r=c[r>>>24]<<24^c[r>>>16&255]<<16^c[r>>>8&255]<<8^c[255&r]),n[s]=n[s-i]^r;if(t){var f,d=h[0],p=h[1],g=h[2],y=h[3],m=n.slice(0);u=n.length;for(var s=0,b=u-v;s>>24]]^p[c[f>>>16&255]]^g[c[f>>>8&255]]^y[c[255&f]];n=m}return n}function o(e,t,r,n){var a,i,o,u,s,l=e.length/4-1;n?(a=h[0],i=h[1],o=h[2],u=h[3],s=f):(a=d[0],i=d[1],o=d[2],u=d[3],s=c);var p,v,g,y,m,b,C;p=t[0]^e[0],v=t[n?3:1]^e[1],g=t[2]^e[2],y=t[n?1:3]^e[3];for(var S=3,E=1;E>>24]^i[v>>>16&255]^o[g>>>8&255]^u[255&y]^e[++S],b=a[v>>>24]^i[g>>>16&255]^o[y>>>8&255]^u[255&p]^e[++S],C=a[g>>>24]^i[y>>>16&255]^o[p>>>8&255]^u[255&v]^e[++S],y=a[y>>>24]^i[p>>>16&255]^o[v>>>8&255]^u[255&g]^e[++S],p=m,v=b,g=C;r[0]=s[p>>>24]<<24^s[v>>>16&255]<<16^s[g>>>8&255]<<8^s[255&y]^e[++S],r[n?3:1]=s[v>>>24]<<24^s[g>>>16&255]<<16^s[y>>>8&255]<<8^s[255&p]^e[++S],r[2]=s[g>>>24]<<24^s[y>>>16&255]<<16^s[p>>>8&255]<<8^s[255&v]^e[++S],r[n?1:3]=s[y>>>24]<<24^s[p>>>16&255]<<16^s[v>>>8&255]<<8^s[255&g]^e[++S]}function u(e){e=e||{};var t,r=(e.mode||"CBC").toUpperCase(),n="AES-"+r;t=e.decrypt?s.cipher.createDecipher(n,e.key):s.cipher.createCipher(n,e.key);var a=t.start;return t.start=function(e,r){var n=null;r instanceof s.util.ByteBuffer&&(n=r,r={}),r=r||{},r.output=n,r.iv=e,a.call(t,r)},t}var s=r(0);r(15),r(23),r(1),e.exports=s.aes=s.aes||{},s.aes.startEncrypting=function(e,t,r,n){var a=u({key:e,output:r,decrypt:!1,mode:n});return a.start(t),a},s.aes.createEncryptionCipher=function(e,t){return u({key:e,output:null,decrypt:!1,mode:t})},s.aes.startDecrypting=function(e,t,r,n){var a=u({key:e,output:r,decrypt:!0,mode:n});return a.start(t),a},s.aes.createDecryptionCipher=function(e,t){return u({key:e,output:null,decrypt:!0,mode:t})},s.aes.Algorithm=function(e,t){p||a();var r=this;r.name=e,r.mode=new t({blockSize:16,cipher:{encrypt:function(e,t){return o(r._w,e,t,!1)},decrypt:function(e,t){return o(r._w,e,t,!0)}}}),r._init=!1},s.aes.Algorithm.prototype.initialize=function(e){if(!this._init){var t,r=e.key;if("string"!=typeof r||16!==r.length&&24!==r.length&&32!==r.length){if(s.util.isArray(r)&&(16===r.length||24===r.length||32===r.length)){t=r,r=s.util.createBuffer();for(var n=0;n>>=2;for(var n=0;n65&&-1!==o){var u=t[o];","===u?(++o,t=t.substr(0,o)+"\r\n "+t.substr(o)):t=t.substr(0,o)+"\r\n"+u+t.substr(o+1),i=a-o-1,o=-1,++a}else" "!==t[a]&&"\t"!==t[a]&&","!==t[a]||(o=a);return t}function a(e){return e.replace(/^\s+/,"")}var i=r(0);r(1);var o=e.exports=i.pem=i.pem||{};o.encode=function(e,t){t=t||{};var r,a="-----BEGIN "+e.type+"-----\r\n";if(e.procType&&(r={name:"Proc-Type",values:[String(e.procType.version),e.procType.type]},a+=n(r)),e.contentDomain&&(r={name:"Content-Domain",values:[e.contentDomain]},a+=n(r)),e.dekInfo&&(r={name:"DEK-Info",values:[e.dekInfo.algorithm]},e.dekInfo.parameters&&r.values.push(e.dekInfo.parameters),a+=n(r)),e.headers)for(var o=0;ot.blockLength&&(t.start(),t.update(o.bytes()),o=t.digest()),r=n.util.createBuffer(),a=n.util.createBuffer(),c=o.length();for(var s=0;s=64;){for(a=e.h0,i=e.h1,o=e.h2,u=e.h3,s=e.h4,f=0;f<16;++f)n=r.getInt32(),t[f]=n,c=u^i&(o^u),n=(a<<5|a>>>27)+c+s+1518500249+n,s=u,u=o,o=(i<<30|i>>>2)>>>0,i=a,a=n;for(;f<20;++f)n=t[f-3]^t[f-8]^t[f-14]^t[f-16],n=n<<1|n>>>31,t[f]=n,c=u^i&(o^u),n=(a<<5|a>>>27)+c+s+1518500249+n,s=u,u=o,o=(i<<30|i>>>2)>>>0,i=a,a=n;for(;f<32;++f)n=t[f-3]^t[f-8]^t[f-14]^t[f-16],n=n<<1|n>>>31,t[f]=n,c=i^o^u,n=(a<<5|a>>>27)+c+s+1859775393+n,s=u,u=o,o=(i<<30|i>>>2)>>>0,i=a,a=n;for(;f<40;++f)n=t[f-6]^t[f-16]^t[f-28]^t[f-32],n=n<<2|n>>>30,t[f]=n,c=i^o^u,n=(a<<5|a>>>27)+c+s+1859775393+n,s=u,u=o,o=(i<<30|i>>>2)>>>0,i=a,a=n;for(;f<60;++f)n=t[f-6]^t[f-16]^t[f-28]^t[f-32],n=n<<2|n>>>30,t[f]=n,c=i&o|u&(i^o),n=(a<<5|a>>>27)+c+s+2400959708+n,s=u,u=o,o=(i<<30|i>>>2)>>>0,i=a,a=n;for(;f<80;++f)n=t[f-6]^t[f-16]^t[f-28]^t[f-32],n=n<<2|n>>>30,t[f]=n,c=i^o^u,n=(a<<5|a>>>27)+c+s+3395469782+n,s=u,u=o,o=(i<<30|i>>>2)>>>0,i=a,a=n;e.h0=e.h0+a|0,e.h1=e.h1+i|0,e.h2=e.h2+o|0,e.h3=e.h3+u|0,e.h4=e.h4+s|0,l-=64}}var i=r(0);r(4),r(1);var o=e.exports=i.sha1=i.sha1||{};i.md.sha1=i.md.algorithms.sha1=o,o.create=function(){s||n();var e=null,t=i.util.createBuffer(),r=new Array(80),o={algorithm:"sha1",blockLength:64,digestLength:20,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};a(p,r,n);var v=i.util.createBuffer();return v.putInt32(p.h0),v.putInt32(p.h1),v.putInt32(p.h2),v.putInt32(p.h3),v.putInt32(p.h4),v},o};var u=null,s=!1},function(e,t,r){"use strict";(function(e){function n(){return i.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function a(e,t){if(n()=n())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+n().toString(16)+" bytes");return 0|e}function v(e){return+e!=e&&(e=0),i.alloc(+e)}function g(e,t){if(i.isBuffer(e))return e.length;if("undefined"!=typeof ArrayBuffer&&"function"==typeof ArrayBuffer.isView&&(ArrayBuffer.isView(e)||e instanceof ArrayBuffer))return e.byteLength;"string"!=typeof e&&(e=""+e);var r=e.length;if(0===r)return 0;for(var n=!1;;)switch(t){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":case void 0:return j(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return z(e).length;default:if(n)return j(e).length;t=(""+t).toLowerCase(),n=!0}}function y(e,t,r){var n=!1;if((void 0===t||t<0)&&(t=0),t>this.length)return"";if((void 0===r||r>this.length)&&(r=this.length),r<=0)return"";if(r>>>=0,t>>>=0,r<=t)return"";for(e||(e="utf8");;)switch(e){case"hex":return x(this,t,r);case"utf8":case"utf-8":return k(this,t,r);case"ascii":return N(this,t,r);case"latin1":case"binary":return R(this,t,r);case"base64":return B(this,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return _(this,t,r);default:if(n)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),n=!0}}function m(e,t,r){var n=e[t];e[t]=e[r],e[r]=n}function b(e,t,r,n,a){if(0===e.length)return-1;if("string"==typeof r?(n=r,r=0):r>2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),r=+r,isNaN(r)&&(r=a?0:e.length-1),r<0&&(r=e.length+r),r>=e.length){if(a)return-1;r=e.length-1}else if(r<0){if(!a)return-1;r=0}if("string"==typeof t&&(t=i.from(t,n)),i.isBuffer(t))return 0===t.length?-1:C(e,t,r,n,a);if("number"==typeof t)return t&=255,i.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?a?Uint8Array.prototype.indexOf.call(e,t,r):Uint8Array.prototype.lastIndexOf.call(e,t,r):C(e,[t],r,n,a);throw new TypeError("val must be string, number or Buffer")}function C(e,t,r,n,a){function i(e,t){return 1===o?e[t]:e.readUInt16BE(t*o)}var o=1,u=e.length,s=t.length;if(void 0!==n&&("ucs2"===(n=String(n).toLowerCase())||"ucs-2"===n||"utf16le"===n||"utf-16le"===n)){if(e.length<2||t.length<2)return-1;o=2,u/=2,s/=2,r/=2}var c;if(a){var f=-1;for(c=r;cu&&(r=u-s),c=r;c>=0;c--){for(var l=!0,d=0;da&&(n=a):n=a;var i=t.length;if(i%2!=0)throw new TypeError("Invalid hex string");n>i/2&&(n=i/2);for(var o=0;o239?4:i>223?3:i>191?2:1;if(a+u<=r){var s,c,f,l;switch(u){case 1:i<128&&(o=i);break;case 2:s=e[a+1],128==(192&s)&&(l=(31&i)<<6|63&s)>127&&(o=l);break;case 3:s=e[a+1],c=e[a+2],128==(192&s)&&128==(192&c)&&(l=(15&i)<<12|(63&s)<<6|63&c)>2047&&(l<55296||l>57343)&&(o=l);break;case 4:s=e[a+1],c=e[a+2],f=e[a+3],128==(192&s)&&128==(192&c)&&128==(192&f)&&(l=(15&i)<<18|(63&s)<<12|(63&c)<<6|63&f)>65535&&l<1114112&&(o=l)}}null===o?(o=65533,u=1):o>65535&&(o-=65536,n.push(o>>>10&1023|55296),o=56320|1023&o),n.push(o),a+=u}return $(n)}function $(e){var t=e.length;if(t<=Z)return String.fromCharCode.apply(String,e);for(var r="",n=0;nn)&&(r=n);for(var a="",i=t;ir)throw new RangeError("Trying to access beyond buffer length")}function P(e,t,r,n,a,o){if(!i.isBuffer(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>a||te.length)throw new RangeError("Index out of range")}function D(e,t,r,n){t<0&&(t=65535+t+1);for(var a=0,i=Math.min(e.length-r,2);a>>8*(n?a:1-a)}function U(e,t,r,n){t<0&&(t=4294967295+t+1);for(var a=0,i=Math.min(e.length-r,4);a>>8*(n?a:3-a)&255}function O(e,t,r,n,a,i){if(r+n>e.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function M(e,t,r,n,a){return a||O(e,t,r,4,3.4028234663852886e38,-3.4028234663852886e38),Q.write(e,t,r,n,23,4),r+4}function F(e,t,r,n,a){return a||O(e,t,r,8,1.7976931348623157e308,-1.7976931348623157e308),Q.write(e,t,r,n,52,8),r+8}function V(e){if(e=K(e).replace(ee,""),e.length<2)return"";for(;e.length%4!=0;)e+="=";return e}function K(e){return e.trim?e.trim():e.replace(/^\s+|\s+$/g,"")}function H(e){return e<16?"0"+e.toString(16):e.toString(16)}function j(e,t){t=t||1/0;for(var r,n=e.length,a=null,i=[],o=0;o55295&&r<57344){if(!a){if(r>56319){(t-=3)>-1&&i.push(239,191,189);continue}if(o+1===n){(t-=3)>-1&&i.push(239,191,189);continue}a=r;continue}if(r<56320){(t-=3)>-1&&i.push(239,191,189),a=r;continue}r=65536+(a-55296<<10|r-56320)}else a&&(t-=3)>-1&&i.push(239,191,189);if(a=null,r<128){if((t-=1)<0)break;i.push(r)}else if(r<2048){if((t-=2)<0)break;i.push(r>>6|192,63&r|128)}else if(r<65536){if((t-=3)<0)break;i.push(r>>12|224,r>>6&63|128,63&r|128)}else{if(!(r<1114112))throw new Error("Invalid code point");if((t-=4)<0)break;i.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}}return i}function q(e){for(var t=[],r=0;r>8,a=r%256,i.push(a),i.push(n);return i}function z(e){return J.toByteArray(V(e))}function Y(e,t,r,n){for(var a=0;a=t.length||a>=e.length);++a)t[a+r]=e[a];return a}function W(e){return e!==e}/*! - * The buffer module from node.js, for the browser. - * - * @author Feross Aboukhadijeh - * @license MIT - */ -var J=r(44),Q=r(45),X=r(46);t.Buffer=i,t.SlowBuffer=v,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]|v[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],g=t[1];o=252645135&(u>>>4^g),g^=o,u^=o<<4,o=65535&(u>>>16^g),g^=o,u^=o<<16,o=858993459&(g>>>2^u),u^=o,g^=o<<2,o=16711935&(g>>>8^u),u^=o,g^=o<<8,o=1431655765&(u>>>1^g),g^=o,u^=o<<1,u=u<<1|u>>>31,g=g<<1|g>>>31;for(var y=0;y>>4|g<<28)^e[C+1];o=u,u=g,g=o^(c[S>>>24&63]|l[S>>>16&63]|h[S>>>8&63]|v[63&S]|s[E>>>24&63]|f[E>>>16&63]|d[E>>>8&63]|p[63&E])}o=u,u=g,g=o}u=u>>>1|u<<31,g=g>>>1|g<<31,o=1431655765&(u>>>1^g),g^=o,u^=o<<1,o=16711935&(g>>>8^u),u^=o,g^=o<<8,o=858993459&(g>>>2^u),u^=o,g^=o<<2,o=65535&(u>>>16^g),g^=o,u^=o<<16,o=252645135&(u>>>4^g),g^=o,u^=o<<4,r[0]=u,r[1]=g}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],v=[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 v(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 g(){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,v=(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]+g)*v);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 $(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 N(e){this.m=e}function R(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 N(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 $e(e){var t=a();return this.multiplyTo(e,t),t}function Ne(e){var t=a();return this.divRemTo(e,t,null),t}function Re(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 N(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,v=e.t-1,g=!0,y=a();for(i=b(e.data[v])-1;v>=0;){for(i>=c?h=e.data[v]>>i-c&f:(h=(e.data[v]&(1<0&&(h|=e.data[v-1]>>this.DB+i-c)),s=r;0==(1&h);)h>>=1,--s;if((i-=s)<0&&(i+=this.DB,--v),g)u[h].copyTo(o),g=!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(;v>=0&&0==(e.data[v]&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!==g.globalScope&&"object"==typeof g.globalScope.crypto&&"object"==typeof g.globalScope.crypto.subtle&&"function"==typeof g.globalScope.crypto.subtle[e]}function f(e){return void 0!==g.globalScope&&"object"==typeof g.globalScope.msCrypto&&"object"==typeof g.globalScope.msCrypto.subtle&&"function"==typeof g.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 g.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 g.globalScope.crypto.subtle.exportKey("pkcs8",e.privateKey)}).then(void 0,function(e){n(e)}).then(function(e){if(e){var t=y.privateKeyFromAsn1(v.fromDer(d.util.createBuffer(e)));n(null,{privateKey:t,publicKey:y.setRsaPublicKey(t.n,t.e)})}});if(f("generateKey")&&f("exportKey")){var a=g.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=g.globalScope.msCrypto.subtle.exportKey("pkcs8",t.privateKey);r.oncomplete=function(e){var t=e.target.result,r=y.privateKeyFromAsn1(v.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===v.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 v.create(v.Class.UNIVERSAL,v.Type.SEQUENCE,!0,[v.create(v.Class.UNIVERSAL,v.Type.INTEGER,!1,v.integerToDer(0).getBytes()),v.create(v.Class.UNIVERSAL,v.Type.SEQUENCE,!0,[v.create(v.Class.UNIVERSAL,v.Type.OID,!1,v.oidToDer(y.oids.rsaEncryption).getBytes()),v.create(v.Class.UNIVERSAL,v.Type.NULL,!1,"")]),v.create(v.Class.UNIVERSAL,v.Type.OCTETSTRING,!1,v.toDer(e).getBytes())])},y.privateKeyFromAsn1=function(e){var t={},r=[];if(v.validate(e,b,t,r)&&(e=v.fromDer(d.util.createBuffer(t.privateKey))),t={},r=[],!v.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 v.create(v.Class.UNIVERSAL,v.Type.SEQUENCE,!0,[v.create(v.Class.UNIVERSAL,v.Type.INTEGER,!1,v.integerToDer(0).getBytes()),v.create(v.Class.UNIVERSAL,v.Type.INTEGER,!1,o(e.n)),v.create(v.Class.UNIVERSAL,v.Type.INTEGER,!1,o(e.e)),v.create(v.Class.UNIVERSAL,v.Type.INTEGER,!1,o(e.d)),v.create(v.Class.UNIVERSAL,v.Type.INTEGER,!1,o(e.p)),v.create(v.Class.UNIVERSAL,v.Type.INTEGER,!1,o(e.q)),v.create(v.Class.UNIVERSAL,v.Type.INTEGER,!1,o(e.dP)),v.create(v.Class.UNIVERSAL,v.Type.INTEGER,!1,o(e.dQ)),v.create(v.Class.UNIVERSAL,v.Type.INTEGER,!1,o(e.qInv))])},y.publicKeyFromAsn1=function(e){var t={},r=[];if(v.validate(e,E,t,r)){var n=v.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=[],!v.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 v.create(v.Class.UNIVERSAL,v.Type.SEQUENCE,!0,[v.create(v.Class.UNIVERSAL,v.Type.SEQUENCE,!0,[v.create(v.Class.UNIVERSAL,v.Type.OID,!1,v.oidToDer(y.oids.rsaEncryption).getBytes()),v.create(v.Class.UNIVERSAL,v.Type.NULL,!1,"")]),v.create(v.Class.UNIVERSAL,v.Type.BITSTRING,!1,[y.publicKeyToRSAPublicKey(e)])])},y.publicKeyToRSAPublicKey=function(e){return v.create(v.Class.UNIVERSAL,v.Type.SEQUENCE,!0,[v.create(v.Class.UNIVERSAL,v.Type.INTEGER,!1,o(e.n)),v.create(v.Class.UNIVERSAL,v.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);v.start(null,null),v.update(r),v.update(n.util.int32ToBytes(C)),g=m=v.digest().getBytes(),S=2,f()}function f(){if(S<=i)return v.start(null,null),v.update(m),y=v.digest().getBytes(),g=n.util.xorBytes(g,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,v=n.hmac.create();v.start(u,e);var g,y,m,b="";if(!s){for(var C=1;C<=h;++C){v.start(null,null),v.update(r),v.update(n.util.int32ToBytes(C)),g=m=v.digest().getBytes();for(var S=2;S<=i;++S)v.start(null,null),v.update(m),y=v.digest().getBytes(),g=n.util.xorBytes(g,y,l),m=y;b+=C>8*l-f&255;return(C=String.fromCharCode(C.charCodeAt(0)&~S)+C.substr(1))+v+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 v=r.generate(h,l),g="";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 g=t.cert.generateSubjectKeyIdentifier();e.subjectKeyIdentifier=g.toHex(),e.value=l.create(l.Class.UNIVERSAL,l.Type.OCTETSTRING,!1,g.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,[]),v=0;v=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 v=l.toDer(s.tbsCertificate);s.md.update(v.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 v={keyUsage:!0,basicConstraints:!0},g=0;null===o&&gm.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(){v&&h&&(v=!1,h.length?p=h.concat(p):g=-1,p.length&&u())}function u(){if(!v){var e=a(o);v=!0;for(var t=p.length;t;){for(h=p,p=[];++g1)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--)$>>=8,$+=I.at(s)+k.at(s),k.setAt(s,255&$);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 v=a(n.prfOid),g=u.pkcs5.pbkdf2(r,s,l,d,v),y=n.encIv,m=p(g);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,v;switch(e){case f.oids["pbeWithSHAAnd3-KeyTripleDES-CBC"]:d=24,h=8,v=u.des.startDecrypting;break;case f.oids["pbewithSHAAnd40BitRC2-CBC"]:d=5,h=8,v=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 g=a(n.prfOid),y=f.pbe.generatePkcs12Key(r,s,1,l,d,g);return g.start(),v(y,f.pbe.generatePkcs12Key(r,s,2,l,h,g))},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,v=0;v=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 v=[],g=0;g0){var C=f.create(f.Class.UNIVERSAL,f.Type.SEQUENCE,!0,v),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.count,e=d.generateKey(r,k,3,$,20),N=c.hmac.create();N.start(u,e),N.update(f.toDer(B).getBytes());var R=N.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,R.getBytes())]),f.create(f.Class.UNIVERSAL,f.Type.OCTETSTRING,!1,k.getBytes()),f.create(f.Class.UNIVERSAL,f.Type.INTEGER,!1,f.integerToDer($).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,v=[];for(e=n.rc2.expandKey(e,t),c=0;c<64;c++)v.push(e.getInt16Le());r?(a=function(e){for(c=0;c<4;c++)e[c]+=v[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]+=v[63&e[(c+3)%4]]}):(a=function(e){for(c=3;c>=0;c--)e[c]=u(e[c],i[c]),e[c]-=v[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]-=v[63&e[(c+3)%4]]});var g=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;)g([[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,v,g,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,v=e.h4,g=e.h5,y=e.h6,m=e.h7,f=0;f<64;++f)o=(v>>>6|v<<26)^(v>>>11|v<<21)^(v>>>25|v<<7),u=y^v&(g^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=g,g=v,v=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+v|0,e.h5=e.h5+g|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 v=i.util.createBuffer();return v.putInt32(p.h0),v.putInt32(p.h1),v.putInt32(p.h2),v.putInt32(p.h3),v.putInt32(p.h4),v.putInt32(p.h5),v.putInt32(p.h6),v.putInt32(p.h7),v},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,v,g,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(g=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],$=e[6][1],N=e[7][0],R=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=($^I&(B^$))>>>0,u=((g>>>28|y<<4)^(y>>>2|g<<30)^(y>>>7|g<<25))>>>0,s=((g<<4|y>>>28)^(y<<30|g>>>2)^(y<<25|g>>>7))>>>0,p=(g&m|C&(g^m))>>>0,v=(y&b|S&(y^b))>>>0,L=R+l+h+f[x][1]+t[x][1],n=N+c+d+f[x][0]+t[x][0]+(L/4294967296>>>0)>>>0,a=L>>>0,L=s+v,i=u+p+(L/4294967296>>>0)>>>0,o=L>>>0,N=k,R=$,k=A,$=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=g,b=y,L=a+o,g=n+i+(L/4294967296>>>0)>>>0,y=L>>>0;L=e[0][1]+y,e[0][0]=e[0][0]+g+(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]+$,e[6][0]=e[6][0]+k+(L/4294967296>>>0)>>>0,e[6][1]=L>>>0,L=e[7][1]+R,e[7][0]=e[7][0]+N+(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 v=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 v=0;v0&&(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 v=n.util.createBuffer(a.cipher_suites.bytes());v.length()>0&&(e.session.cipherSuite=f.getCipherSuite(v.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=v,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=v,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?g: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,v=5,g=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,$=f.handleApplicationData,N=f.handleHeartbeat,R=[];R[f.ConnectionEnd.client]=[[I,B,k,I,N],[I,B,k,I,N],[I,B,k,I,N],[I,B,k,I,N],[I,B,k,I,N],[A,B,I,I,N],[I,B,k,I,N],[I,B,k,$,N],[I,B,k,I,N]],R[f.ConnectionEnd.server]=[[I,B,k,I,N],[I,B,k,I,N],[I,B,k,I,N],[I,B,k,I,N],[A,B,I,I,N],[I,B,k,I,N],[I,B,k,$,N],[I,B,k,I,N]];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 v=e.session.id,g=v.length+1+2+4+28+2+i+1+u+p,y=n.util.createBuffer();return y.putByte(f.HandshakeType.client_hello),y.putInt24(g),y.putByte(e.version.major),y.putByte(e.version.minor),y.putBytes(e.session.sp.client_random),c(y,1,n.util.createBuffer(v)),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=R[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={};return e.isAvailable=function(){return"function"==typeof Notification},e.requestPermission=function(e){var t=Notification.permission;"default"!=t?e(t):Notification.requestPermission(e)},e.notify=function(t,r,n){e.isAvailable()&&e.requestPermission(function(e){if("granted"==e){var a={};r&&(a.body=r),n&&(a.icon=n);var i=new Notification(t,a);setTimeout(function(){i.close.bind(i)()},4e3)}})},e}();e.exports=n},function(e,t,r){"use strict";var n=function(){var e,t,r={};return r.startWatching=function(r,n){e=r,t=n},r}();e.exports=n},function(e,t,r){"use strict";function n(e,t){for(;e.length100)return n.push(T(e,t)),!0;if(e===t)return!0;if("object"!=typeof e||null===e||null===t)return"function"==typeof e&&M(5),!1;"Set_elm_builtin"===e.$&&(e=wa(e),t=wa(t)),"RBNode_elm_builtin"!==e.$&&"RBEmpty_elm_builtin"!==e.$||(e=Ea(e),t=Ea(t));for(var a in e)if(!S(e[a],t[a],r+1,n))return!1;return!0}function E(e,t,r){if("object"!=typeof e)return e===t?0:e");if("boolean"==typeof t)return _(e,t?"True":"False");if("number"==typeof t)return L(e,t+"");if(t instanceof String)return D(e,"'"+x(t,!0)+"'");if("string"==typeof t)return P(e,'"'+x(t,!1)+'"');if("object"==typeof t&&"$"in t){var r=t.$;if("number"==typeof r)return O(e,"");if("#"===r[0]){var n=[];for(var a in t)"$"!==a&&n.push(R(e,t[a]));return"("+n.join(",")+")"}if("Set_elm_builtin"===r)return _(e,"Set")+U(e,".fromList")+" "+R(e,wa(t));if("RBNode_elm_builtin"===r||"RBEmpty_elm_builtin"===r)return _(e,"Dict")+U(e,".fromList")+" "+R(e,Ea(t));if("Array_elm_builtin"===r)return _(e,"Array")+U(e,".fromList")+" "+R(e,Ba(t));if("::"===r||"[]"===r){var n="[";for(t.b&&(n+=R(e,t.a),t=t.b);t.b;t=t.b)n+=","+R(e,t.a);return n+"]"}var n="";for(var i in t)if("$"!==i){var o=R(e,t[i]),u=o[0],s="{"===u||"("===u||"["===u||"<"===u||'"'===u||o.indexOf(" ")<0;n+=" "+(s?o:"("+o+")")}return _(e,r)+n}if("function"==typeof DataView&&t instanceof DataView)return P(e,"<"+t.byteLength+" bytes>");if("function"==typeof File&&t instanceof File)return O(e,"<"+t.name+">");if("object"==typeof t){var n=[];for(var c in t){var f="_"===c[0]?c.slice(1):c;n.push(U(e,f)+" = "+R(e,t[c]))}return 0===n.length?"{}":"{ "+n.join(", ")+" }"}return O(e,"")}function x(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 _(e,t){return e?""+t+"":t}function L(e,t){return e?""+t+"":t}function P(e,t){return e?""+t+"":t}function D(e,t){return e?""+t+"":t}function U(e,t){return e?""+t+"":t}function O(e,t){return e?""+t+"":t}function M(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+"` "+F(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 "+F(c)+"\n\nIt received the following value:\n\n "+N(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 F(e){return e.start.line===e.end.line?"on line "+e.start.line:"on lines "+e.start.line+" through "+e.end.line}function V(e){return e}function K(e){return!e}function H(e){var t=e.charCodeAt(0);return t?_a(55296<=t&&t<=56319?T(I(e[0]+e[1]),e.slice(2)):T(I(e[0]),e.slice(1))):La}function j(e){return e.length}function q(e){return m(e.trim().split(/\s+/g))}function G(e){return e.toUpperCase()}function z(e){return e.toLowerCase()}function Y(e){return e+""}function W(e){for(var t=0,r=e.charCodeAt(0),n=43==r||45==r?1:0,a=n;a=t.length)return pe("a LONGER array. Need index "+a+" but only see "+t.length+" entries",t);var n=fe(e.b,t[a]);return vi(n)?n:hi(f(mi,a,n.a));case 8:if("object"!=typeof t||null===t||de(t))return pe("an OBJECT",t);var i=tr;for(var o in t)if(t.hasOwnProperty(o)){var n=fe(e.b,t[o]);if(!vi(n))return hi(f(yi,o,n.a));i=y(T(o,n.a),i)}return pi(Ja(i));case 9:for(var u=e.f,s=e.g,c=0;c=0&&a.splice(t,1)}var a=[],i=yn[e].r,o=_e(0);return yn[e].b=o,yn[e].c=n(function(e,t,r){for(;t.b;t=t.b)for(var n=a,u=me(i(t.a)),s=0;s0&>(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 v=t.k;4===v.$;)h=!0,"object"!=typeof d?d=[d,v.j]:d.push(v.j),v=v.k;return h&&l.length!==d.length?void gt(r,0,n,t):((h?mt(l,d):l===d)||gt(r,2,n,d),void yt(p,v,r,n+1));case 0:return void(e.a!==t.a&>(r,3,n,t.a));case 1:return void bt(e,t,r,n,St);case 2:return void bt(e,t,r,n,Et);case 3:if(e.h!==t.h)return void gt(r,0,n,t);var g=Ct(e.d,t.d);g&>(r,4,n,g);var y=t.i(e.g,t.g);return void(y&>(r,5,n,y))}}}function mt(e,t){for(var r=0;ru?gt(r,6,n,{v:u,i:o-u}):o0||o.length>0||k)&>(r,8,n,{w:a,x:o,y:k})}function Tt(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 yt(o.z,n,u,o.r),o.r=a,void(o.s.s={w:u,A:o})}Tt(e,t,r+Un,n,a,i)}function wt(e,t,r,n,a){var i=e[r];if(!i){var o=gt(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 yt(n,i.z,u,a),void gt(t,9,a,{w:u,A:i})}wt(e,t,r+Un,n,a)}function It(e,t,r,n){At(e,t,r,0,0,t.b,n)}function At(e,t,r,n,a,i,o){for(var u=r[n],s=u.r;s===a;){var c=u.$;if(1===c)It(e,t.k,u.s,o);else if(8===c){u.t=e,u.u=o;var f=u.s.w;f.length>0&&At(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&&At(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 At(e,h,r,n,a+1,i,e.elm_event_node_ref)}for(var p=t.e,v=e.childNodes,g=0;gi))return n;a=m}return n}function Bt(e,t,r,n){return 0===r.length?e:(It(e,t,r,n),kt(e,r))}function kt(e,t){for(var r=0;r0){var o=a.substring(0,i),u=a.substring(i+2);t=l(Ud,o,function(e){return _a(Od(e)?u+", "+e.a:u)},t)}}return t}function Vt(e,t,r){t.upload.addEventListener("progress",function(n){t.c||Be(f(Fd,e,T(r,Gd({sent:n.loaded,size:n.total}))))}),t.addEventListener("progress",function(n){t.c||Be(f(Fd,e,T(r,qd({received:n.loaded,size:n.lengthComputable?_a(n.total):La}))))})}function Kt(e,t){function r(){n=1===n?0:(sa(r),t(e),1)}t(e);var n=0;return function(a,i){e=a,i?(t(e),2===n&&(n=1)):(0===n&&sa(r),n=2)}}function Ht(e){var t=e.onUrlChange,n=e.onUrlRequest,a=function(){a.a(t(jt()))};return ua({setup:function(e){return a.a=e,da.addEventListener("popstate",a),da.navigator.userAgent.indexOf("Trident")<0||da.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=jt(),o=Gm(a).a;e(n(o&&i.protocol===o.protocol&&i.host===o.host&&i.port_.a===o.port_.a?Lm(o):_m(a)))}})},init:function(t){return l(e.init,t,jt(),a)},view:e.view,update:e.update,subscriptions:e.subscriptions})}function jt(){return Gm(Tn.location.href).a||M(1)}function qt(e,t){return Ie(function(r){sa(function(){var n=document.getElementById(e);r(n?Te(t(n)):we(Pm(e)))})})}function Gt(e){return Ie(function(t){sa(function(){t(Te(e()))})})}function zt(){return{scene:Yt(),viewport:{x:da.pageXOffset,y:da.pageYOffset,width:la.documentElement.clientWidth,height:la.documentElement.clientHeight}}}function Yt(){var e=la.body,t=la.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 Wt(e){return qt(e,function(e){var t=e.getBoundingClientRect(),r=da.pageXOffset,n=da.pageYOffset;return{scene:Yt(),viewport:{x:r,y:n,width:la.documentElement.clientWidth,height:la.documentElement.clientHeight},element:{x:r+t.left,y:n+t.top,width:t.width,height:t.height}}})}function Jt(e){return f(Um,Dm,Ie(function(t){try{da.location=e}catch(e){Tn.location.reload(!1)}}))}function Qt(e){try{return _a(decodeURIComponent(e))}catch(e){return La}}function Xt(){return f(Oa,ho(Ec),f(Oa,nc,Sc))}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 Zt,er,tr={$:"[]"},rr=r(y),nr=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 m(n)}),ar=(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 m(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 m(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 m(o)}),r(function(e,t){return m(b(t).sort(function(t,r){return E(e(t),e(r))}))})),ir=r(function(e,t){return m(b(t).sort(function(t,r){var n=f(e,t,r);return n===ya?0:n===ba?-1:1}))}),or=r(C),ur=r(function(e,t){return!C(e,t)}),sr=(r(function(e,t){return E(e,t)<0}),r(function(e,t){return E(e,t)<1}),r(function(e,t){return E(e,t)>0}),r(function(e,t){return E(e,t)>=0}),r(function(e,t){var r=E(e,t);return r<0?ba:r?ma:ya})),cr={$:"#0"},fr=r(B),lr=[],dr=n(function(e,t,r){for(var n=new Array(e),a=0;a=0;n--)t=f(e,r[n],t);return t}),br=(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&&e<0||r<0&&e>0?r+e:r})),Br=Math.PI,kr=(Math.E,Math.cos),$r=Math.sin,Nr=(Math.tan,Math.acos,Math.asin,Math.atan,r(Math.atan2),Math.ceil),Rr=Math.floor,xr=Math.round,_r=(Math.sqrt,Math.log),Lr=(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})),Pr=r(function(e,t){return e+t}),Dr=(r(function(e,t){for(var r=t.length,n=new Array(r),a=0;a-1}),Hr=r(function(e,t){return 0===t.indexOf(e)}),jr=r(function(e,t){return t.length>=e.length&&t.lastIndexOf(e)===t.length-e.length}),qr=r(function(e,t){var r=e.length;if(r<1)return tr;for(var n=0,a=[];(n=t.indexOf(e,n))>-1;)a.push(n),n+=r;return m(a)}),Gr=ae(function(e){return"number"!=typeof e?pe("an INT",e):-2147483647>e}),r(function(e,t){return t>>>e}),r(function(e,t){return{$:3,b:e,d:t}})),dn=r(function(e,t){return{$:4,b:e,d:t}}),hn=0,pn=r(function(e,t){return Ie(function(r){$e(e,t),r(Te(cr))})}),vn=!1,gn=[],yn=(a(function(e,t,r,n){return Le(t,n,e.init,e.update,e.subscriptions,function(){return function(){}})}),{}),mn=r(function(e,t){return Ie(function(r){e.g(t),r(Te(cr))})}),bn=r(function(e,t){return f(pn,e.h,{$:0,a:t})}),Cn=r(function(e,t){return{$:3,n:e,o:t}}),Sn=r(function(e,t){return t}),En=r(function(e,t){return function(r){return e(t(r))}}),Tn="undefined"!=typeof document?document:{},wn=(a(function(e,t,r,n){var a=n&&n.node?n.node:M(0);return a.parentNode.replaceChild(ut(e,function(){}),a),{}}),r(function(e,t){return r(function(r,n){for(var a=[],i=0;n.b;n=n.b){var o=n.a;i+=o.b||0,a.push(o)}return i+=a.length,{$:1,c:t,d:it(r),e:a,f:e,b:i}})})),In=wn(void 0),An=r(function(e,t){return r(function(r,n){for(var a=[],i=0;n.b;n=n.b){var o=n.a;i+=o.b.b||0,a.push(o)}return i+=a.length,{$:2,c:t,d:it(r),e:a,f:e,b:i}})}),Bn=An(void 0),kn=r(function(e,t){return{$:4,j:e,k:t,b:1+(t.b||0)}}),$n=(r(function(e,t){return Xe([e,t],function(){return e(t)})}),n(function(e,t,r){return Xe([e,t,r],function(){return f(e,t,r)})}),a(function(e,t,r,n){return Xe([e,t,r,n],function(){return l(e,t,r,n)})}),i(function(e,t,r,n,a){return Xe([e,t,r,n,a],function(){return d(e,t,r,n,a)})}),o(function(e,t,r,n,a,i){return Xe([e,t,r,n,a,i],function(){return h(e,t,r,n,a,i)})}),u(function(e,t,r,n,a,i,o){return Xe([e,t,r,n,a,i,o],function(){return p(e,t,r,n,a,i,o)})}),s(function(e,t,r,n,a,i,o,u){return Xe([e,t,r,n,a,i,o,u],function(){return v(e,t,r,n,a,i,o,u)})}),c(function(e,t,r,n,a,i,o,u,s){return Xe([e,t,r,n,a,i,o,u,s],function(){return g(e,t,r,n,a,i,o,u,s)})}),r(function(e,t){return{$:"a0",n:e,o:t}})),Nn=r(function(e,t){return{$:"a1",n:e,o:t}}),Rn=r(function(e,t){return{$:"a2",n:e,o:t}}),xn=r(function(e,t){return{$:"a3",n:e,o:t}}),_n=n(function(e,t,r){return{$:"a4",n:t,o:{f:e,o:r}}}),Ln=r(function(e,t){return"a0"===t.$?f($n,t.n,at(e,t.o)):t}),Pn=r(function(e,t){return T(e(t.a),t.b)}),Dn=r(function(e,t){return{message:e(t.message),stopPropagation:t.stopPropagation,preventDefault:t.preventDefault}});try{window.addEventListener("t",null,Object.defineProperty({},"passive",{get:function(){er=!0}}))}catch(e){}var Un="_elmW6BL",On=(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})),Mn=a(function(e,t,r,n){return e.setInt16(t,r,n),t+2}),Fn=a(function(e,t,r,n){return e.setInt32(t,r,n),t+4}),Vn=n(function(e,t,r){return e.setUint8(t,r),t+1}),Kn=a(function(e,t,r,n){return e.setUint16(t,r,n),t+2}),Hn=a(function(e,t,r,n){return e.setUint32(t,r,n),t+4}),jn=a(function(e,t,r,n){return e.setFloat32(t,r,n),t+4}),qn=a(function(e,t,r,n){return e.setFloat64(t,r,n),t+8}),Gn=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}),Yn=r(function(e,t){try{return _a(f(e,t,0).b)}catch(e){return La}}),Wn=(r(function(e,t){return T(t+1,e.getInt8(t))}),n(function(e,t,r){return T(r+2,t.getInt16(r,e))}),n(function(e,t,r){return T(r+4,t.getInt32(r,e))}),r(function(e,t){return T(t+1,e.getUint8(t))})),Jn=(n(function(e,t,r){return T(r+2,t.getUint16(r,e))}),n(function(e,t,r){return T(r+4,t.getUint32(r,e))}),n(function(e,t,r){return T(r+4,t.getFloat32(r,e))}),n(function(e,t,r){return T(r+8,t.getFloat64(r,e))}),n(function(e,t,r){return T(r+e,new DataView(t.buffer,t.byteOffset+r,e))})),Qn=(n(function(e,t,r){for(var n="",a=r+e;r0;){var l=n[c];f[--c]=l?_a(l):La}a.push(d(Tl,n[0],n.index,i,m(f))),s=t.lastIndex}return t.lastIndex=u,m(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?_a(o):La}return r(d(Tl,t,arguments[arguments.length-2],i,m(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,m(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(jd)}),i.addEventListener("timeout",function(){a(zd)}),i.addEventListener("load",function(){a(Ot(r.expect.b,i))}),Od(r.tracker)&&Vt(e,i,r.tracker.a);try{i.open(r.method,r.url,!0)}catch(e){return a(Kd(r.url))}return Ut(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))}}}),na={$:0},aa=r(function(e,t){return{$:0,a:e,b:t}}),ia=(r(function(e,t){return new Blob([t],{type:e})}),i(function(e,t,r,n,a){for(var i=e.length,o=t+i<=a.length,u=0;o&&u0?e:t}),oi=wr,ui=Tr,si=$,ci=r(function(e,t){if(t.nodeListSize){var r=32*t.nodeListSize,n=ai(f(Va,32,r-1)),a=e?Ja(t.nodeList):t.nodeList,i=f(ti,a,t.nodeListSize);return d(Ma,si(t.tail)+r,f(ii,5,n*Ha),i,t.tail)}return d(Ma,si(t.tail),Ha,ja,t.tail)}),fi=dr,li=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=Ga(l(fi,32,t,e)),o=e,u=t-32,s=r,c=f(Sa,i,n),d=a;e=o,t=u,r=s,n=c,a=d}}),di=r(function(e,t){if(e<=0)return qa;var r=e%32,n=l(fi,r,e-r,t);return h(li,t,e-r-32,e,tr,n)}),hi=function(e){return{$:"Err",a:e}},pi=function(e){return{$:"Ok",a:e}},vi=function(e){return"Ok"===e.$},gi=r(function(e,t){return{$:"Failure",a:e,b:t}}),yi=r(function(e,t){return{$:"Field",a:e,b:t}}),mi=r(function(e,t){return{$:"Index",a:e,b:t}}),bi=function(e){return{$:"OneOf",a:e}},Ci=X,Si=function(e){var t=Ci(e);return 97<=t&&t<=122},Ei=function(e){var t=Ci(e);return t<=90&&65<=t},Ti=function(e){return Si(e)||Ei(e)},wi=function(e){var t=Ci(e);return t<=57&&48<=t},Ii=function(e){return Si(e)||Ei(e)||wi(e)},Ai=function(e){return l(Wa,r(function(e,t){return t+1}),0,e)},Bi=nr,ki=n(function(e,t,r){for(;;){if(!(E(e,t)<1))return r;var n=e,a=t-1,i=f(Sa,t,r);e=n,t=a,r=i}}),$i=r(function(e,t){return l(ki,e,t,tr)}),Ni=r(function(e,t){return l(Bi,e,f($i,0,Ai(t)-1),t)}),Ri=Vr,xi=Y,_i=r(function(e,t){return f(Mr,e,b(t))}),Li=H,Pi=r(function(e,t){return m(f(Or,e,t))}),Di=function(e){return f(_i,"\n ",f(Pi,"\n",e))},Ui=on,Oi=r(function(e,t){return"\n\n("+xi(e+1)+") "+Di(Mi(t))}),Mi=function(e){return f(Fi,e,tr)},Fi=r(function(e,t){e:for(;;)switch(e.$){case"Field":var r=e.a,n=e.b,a=function(){var e=Li(r);if("Nothing"===e.$)return!1;var t=e.a,n=t.a,a=t.b;return Ti(n)&&f(Ri,Ii,a)}(),i=a?"."+r:"['"+r+"']",o=n,u=f(Sa,i,t);e=o,t=u;continue e;case"Index":var s=e.a,n=e.b,c="["+xi(s)+"]",o=n,u=f(Sa,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(_i,"",Ja(t)):"Json.Decode.oneOf"}(),h=d+" failed in the following "+xi(Ai(l))+" ways:";return f(_i,"\n\n",f(Sa,h,f(Ni,Oi,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(_i,"",Ja(t)):"!"}();default:var p=e.a,v=e.b,h=function(){return t.b?"Problem with the value at json"+f(_i,"",Ja(t))+":\n\n ":"Problem with the given value:\n\n"}();return h+(Di(f(Ui,4,v))+"\n\n")+p}}),Vi=ye,Ki=f(Oa,Ua,Vi),Hi=function(e){return{$:"Magnitude",a:e}},ji=function(e){return{$:"Pos",a:e}},qi=r(function(e,t){return{$:"BigIntNotNormalised",a:e,b:t}}),Gi=function(e){return{$:"MagnitudeNotNormalised",a:e}},zi=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 _a(n)}return La}},Yi=function(e){var t=zi(e);return"Nothing"!==t.$&&t.a<0},Wi=function(e){return{$:"Neg",a:e}},Ji={$:"Zer"},Qi=function(e){return!e.b},Xi=r(function(e,t){var r=t.a;if(Qi(r))return Ji;switch(e.$){case"Zero":return Ji;case"Positive":return ji(t);default:return Wi(t)}}),Zi=function(e){return e},eo=r(function(e,t){return f(qi,e,Gi(t))}),to=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(Wa,e,t,Ja(p)):d(to,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}),ro=n(function(e,t,r){return d(to,e,t,0,r)}),no=function(e){return f(ro,r(function(t,r){return e(t)&&Qi(r)?tr:f(Sa,t,r)}),tr)}(Za(0)),ao=function(e){return-e},io=Ir,oo=-1+f(io,10,7),uo=oo+1,so=r(function(e,t){var r=t.a,n=t.b;return T(e(r),n)}),co=function(e){return e<0?f(so,ri(-1),co(e+uo)):T(e/uo|0,e%uo)},fo=r(function(e,t){for(;;){if(t.b){var r=t.a,n=t.b,a=co(r+e),i=a.a,o=a.b;return f(Sa,o,f(fo,i,n))}{if(!(E(e,uo)>0))return m([e]);var u=m([e]);e=0,t=u}}}),lo=function(e){var t=e.a;return Hi(no(f(fo,0,t)))},ho=r(function(e,t){return l(ro,r(function(t,r){return f(Sa,e(t),r)}),tr,t)}),po=ho(ao),vo={$:"Negative"},go={$:"Positive"},yo={$:"Zero"},mo=function(e){switch(e.$){case"Positive":return vo;case"Negative":return go;default:return yo}},bo=function(e){for(;;){var t=e.a,r=e.b,n=lo(r),a=n.a;if(!Yi(a))return f(Xi,t,Hi(a));e=f(eo,mo(t),po(a))}},Co=sr,So=function(e){switch(f(Co,e,0).$){case"LT":return vo;case"GT":return go;default:return yo}},Eo=function(e){return e<0?-e:e},To=function(e){return bo(f(qi,So(e),Gi(m([Eo(e)]))))},wo=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(io,10,7)+r}var i=e.a.a,r=i.a;return r}break e;default:break e}return 42},Io=function(e){switch(e.$){case"Zer":return Ji;case"Neg":var t=e.a;return ji(t);default:return e}},Ao=function(e){return{$:"MagnitudePair",a:e}},Bo=r(function(e,t){var r=T(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(Sa,T(a,u),f(Bo,i,s))}var c=r.a,a=c.a,i=c.b;return f(Sa,T(a,0),f(Bo,i,tr))}if(r.b.b){var l=r.b,u=l.a,s=l.b;return f(Sa,T(0,u),f(Bo,tr,s))}return tr}),ko=r(function(e,t){var r=e.a,n=t.a;return Ao(f(Bo,r,n))}),$o=function(e){switch(e.$){case"Zer":return f(eo,yo,tr);case"Neg":var t=e.a.a;return f(eo,go,po(t));default:var t=e.a.a;return f(eo,go,t)}},No=r(function(e,t){var r=$o(t),n=r.b,a=$o(e),i=a.b,o=f(ko,i,n),u=o.a,s=f(ho,function(e){return e.a+e.b},u);return bo(f(qi,go,Gi(s)))}),Ro=a(function(e,t,r,n){e:for(;;){var a=T(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(C(o,c)){var d=e,h=t,p=u,v=l;e=d,t=h,r=p,n=v;continue e}var d=o,h=c,p=u,v=l;e=d,t=h,r=p,n=v;continue e}return ma}return a.b.b?ba:f(Co,e,t)}}),xo=function(e){switch(e.$){case"LT":return ma;case"EQ":return ya;default:return ba}},_o=r(function(e,t){var r=T(e,t);switch(r.a.$){case"Pos":if("Pos"===r.b.$){var n=r.a.a.a,a=r.b.a.a;return d(Ro,0,0,n,a)}return ma;case"Neg":if("Neg"===r.b.$){var n=r.a.a.a,a=r.b.a.a;return xo(d(Ro,0,0,n,a))}return ba;default:switch(r.b.$){case"Pos":r.a;return ba;case"Zer":r.a,r.b;return ya;default:r.a;return ma}}}),Lo=r(function(e,t){return C(f(_o,e,t),ma)}),Po=K,Do=r(function(e,t){return!f(Lo,e,t)}),Uo=function(e){switch(e.$){case"Zer":return Hi(tr);case"Pos":default:var t=e.a;return t}},Oo=r(function(e,t){var r=e.a;return lo(Gi(f(ho,oi(t),r)))}),Mo=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(Oo,Hi(n),a),u=f(Mo,Hi(i),Hi(n)),s=u.a,c=f(No,f(Xi,go,o),f(Xi,go,Hi(f(Sa,0,s))));return Uo(c)}var a=r.a;return f(Oo,Hi(n),a)}return Hi(tr)}),Fo=function(e){switch(e.$){case"Zer":return yo;case"Pos":return go;default:return vo}},Vo=r(function(e,t){return C(e,yo)||C(t,yo)?yo:C(e,t)?go:vo}),Ko=r(function(e,t){return f(Xi,f(Vo,Fo(e),Fo(t)),f(Mo,Uo(e),Uo(t)))}),Ho=function(e){switch(e.$){case"Zer":return Ji;case"Pos":var t=e.a;return Wi(t);default:var t=e.a;return ji(t)}},jo=r(function(e,t){return f(No,e,Ho(t))}),qo=To(0),Go=a(function(e,t,r,n){if(e){var a=To(e),i=f(Ko,f(Ko,a,n),t),o=f(Do,i,r)?T(f(Ko,a,t),f(jo,r,i)):T(qo,r),u=o.a,s=o.b,c=d(Go,e/2|0,t,s,n),l=c.a,h=c.b;return T(f(No,u,l),h)}return T(qo,r)}),zo=Fa(f(Va,2,oo)),Yo=n(function(e,t,r){return d(Go,f(io,2,zo),e,t,r)}),Wo=To(1),Jo=r(function(e,t){return e}),Qo=n(function(e,t,r){return l(Wa,Jo(e),t,f($i,1,r))}),Xo=function(e){return l(Qo,Ko(To(uo)),Wo,e)},Zo=n(function(e,t,r){if(e){var n=l(Yo,Xo(e),t,r),a=n.a,i=n.b,o=l(Zo,e-1,i,r),u=o.a,s=o.b;return T(f(No,a,u),s)}return l(Yo,Xo(e),t,r)}),eu=function(e){switch(e.$){case"Zer":return tr;case"Pos":default:var t=e.a.a;return t}},tu=r(function(e,t){if(C(t,qo))return La;var r=Ai(eu(e))-Ai(eu(t))+1,n=l(Zo,f(ii,0,r),Io(e),Io(t)),a=n.a,i=n.b;return _a(T(f(Xi,f(Vo,Fo(e),Fo(t)),Uo(a)),f(Xi,Fo(e),Uo(i))))}),ru=f(Ko,To(2),To(2147483648)),nu=Lr,au=function(e){return f(nu,e,"")},iu=j,ou=cn,uu=n(function(e,t,r){return e<=0?r:l(uu,e>>1,B(t,t),1&e?B(r,t):r)}),su=r(function(e,t){return l(uu,e,t,"")}),cu=n(function(e,t,r){return B(f(su,e-iu(r),au(t)),r)}),fu=Q,lu=Ar,du=function(e){e:for(;;)switch(e){case 0:return I("0");case 1:return I("1");case 2:return I("2");case 3:return I("3");case 4:return I("4");case 5:return I("5");case 6:return I("6");case 7:return I("7");case 8:return I("8");case 9:return I("9");case 10:return I("a");case 11:return I("b");case 12:return I("c");case 13:return I("d");case 14:return I("e");case 15:return I("f");default:var t=e;e=t;continue e}},hu=r(function(e,t){for(;;){if(t<16)return f(Sa,du(t),e);var r=f(Sa,du(f(lu,16,t)),e),n=t/16|0;e=r,t=n}}),pu=function(e){return fu(e<0?f(Sa,I("-"),f(hu,tr,-e)):f(hu,tr,e))},vu=function(e){var t=f(tu,e,ru);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=pu(wo(a));return C(n,To(0))?i:B(vu(n),l(cu,8,I("0"),i))},gu=function(e){switch(e.$){case"Zer":return"0";case"Pos":var t=e.a;return C(t,Hi(tr))?"0":vu(ji(t));default:var t=e.a;return"-"+gu(f(Ko,To(-1),e))}},yu=f(Oa,gu,f(Oa,Da,Vi)),mu=function(e){var t=e.a;return Da(t)},bu=f(Oa,mu,Vi),Cu=f(Oa,pu,f(Oa,Da,Vi)),Su=ur,Eu=r(function(e,t){return l(ro,r(function(t,r){return e(t)?f(Sa,t,r):r}),tr,t)}),Tu=r(function(e,t){if("Just"===t.$){return t.a}return e}),wu=sn,Iu=function(e){return ye(l(Wa,r(function(e,t){var r=e.a,n=e.b;return l(un,r,n,t)}),Ce(),e))},Au=function(e){return Iu(f(ho,function(e){var t=e.a,r=e.b;return T(t,f(Tu,wu,r))},f(Eu,function(e){e.a;return!C(e.b,La)},e)))},Bu=r(function(e,t){if("Just"===t.$){var r=t.a;return _a(e(r))}return La}),ku=function(e){return Au(m([T("to",f(Bu,Ki,e.to)),T("from",f(Bu,Ki,e.from)),T("gas",f(Bu,Cu,e.gas)),T("gasPrice",f(Bu,yu,e.gasPrice)),T("value",f(Bu,yu,e.value)),T("data",f(Bu,bu,e.data)),T("nonce",f(Bu,Cu,e.nonce))]))},$u=function(e){return{$:"TxSentry",a:e}},Nu=ye,Ru=r(function(e,t){return Iu(m([T("ref",Nu(e)),T("txParams",t)]))}),xu=function(e){return{$:"Signing",a:e}},_u=r(function(e,t){var r=t.onSign;return{onBroadcastTagger:t.onBroadcast,onMinedTagger:t.onMined,onSignedTagger:r,params:e,status:xu(e)}}),Lu={$:"Black"},Pu=i(function(e,t,r,n,a){return{$:"RBNode_elm_builtin",a:e,b:t,c:r,d:n,e:a}}),Du={$:"RBEmpty_elm_builtin"},Uu={$:"Red"},Ou=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(Pu,Uu,t,r,h(Pu,Lu,c,f,l,d),h(Pu,Lu,i,o,u,s))}return h(Pu,e,i,o,h(Pu,Uu,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,v=(p.a,p.b),g=p.c,y=p.d,m=p.e,d=n.e;return h(Pu,Uu,c,f,h(Pu,Lu,v,g,y,m),h(Pu,Lu,t,r,d,a))}return h(Pu,e,t,r,n,a)}),Mu=n(function(e,t,r){if("RBEmpty_elm_builtin"===r.$)return h(Pu,Uu,e,t,Du,Du);var n=r.a,a=r.b,i=r.c,o=r.d,u=r.e;switch(f(Co,e,a).$){case"LT":return h(Ou,n,a,i,l(Mu,e,t,o),u);case"EQ":return h(Pu,n,a,t,o,u);default:return h(Ou,n,a,i,o,l(Mu,e,t,u))}}),Fu=n(function(e,t,r){var n=l(Mu,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(Pu,Lu,a,i,o,u)}return n}),Vu=Cn,Ku=n(function(e,t,r){var n=e.a,a=ku(r),i=l(Fu,n.ref,f(_u,r,t),n.txs);return T($u(A(n,{ref:n.ref+1,txs:i})),f(Vu,n.tagger,n.outPort(f(Ru,n.ref,a))))}),Hu=Ku,ju=Me,qu=ju(tr),Gu=r(function(e,t){var r=T(e,t);if("None"===r.b.$){r.b;return w(e,qu,tr)}if("Just"===r.a.$){var n=r.a.a,a=r.b,i=a.a,o=a.b;return function(e){var t=e.a,r=e.b;return w(_a(t),r,tr)}(l(Hu,n,i,o))}return w(La,qu,m([f(Ra,"submodel sent chainCmd, but there is no txSentry to use!",La)]))}),zu=r(function(e,t){return{$:"CustomSend",a:e,b:t}}),Yu={$:"None"},Wu=n(function(e,t,r){return{onBroadcast:t,onMined:r,onSign:e}}),Ju=n(function(e,t,r){return e(t(r))}),Qu=r(function(e,t){if("None"===t.$)return Yu;var r=t.a,n=t.b,a=l(Wu,f(Bu,Ju(e),r.onSign),f(Bu,Ju(e),r.onBroadcast),f(Bu,function(t){var r=t.a,n=t.b;return T(f(Oa,r,e),f(Bu,function(t){return{confirmations:t.confirmations,toMsg:f(Oa,t.toMsg,e)}},n))},r.onMined));return f(zu,a,n)}),Xu=n(function(e,t,r){return{$:"BrowserNotification",a:e,b:t,c:r}}),Zu=function(e){return{$:"GTag",a:e}},es=function(e){return{$:"GotoRoute",a:e}},ts={$:"RequestBrowserNotificationPermission"},rs=function(e){return{$:"UserNotice",a:e}},ns={$:"Web3Connect"},as=a(function(e,t,r,n){return{align:r,label:n,mainParagraphs:t,noticeType:e}}),is=en,os=tn,us=re,ss=function(e){switch(e.$){case"Normal":return 0;case"MayStopPropagation":return 1;case"MayPreventDefault":return 2;default:return 3}},cs=kn,fs={$:"Empty"},ls=function(e){return{$:"Styled",a:e}},ds=function(e){return{$:"Unstyled",a:e}},hs=r(function(e,t){switch(t.$){case"Styled":var n=t.a;return ls({html:r(function(t,r){return f(cs,e,f(n.html,t,r))}),styles:n.styles});case"Unstyled":var a=t.a;return ds(f(Ju,cs(e),a));case"Text":var i=t.a;return $a(i);default:return fs}}),ps=hs,vs=r(function(e,t){return d(as,t.noticeType,f(ho,ho(ps(e)),t.mainParagraphs),t.align,t.label)}),gs=r(function(e,t){switch(t.$){case"UserNotice":var r=t.a;return rs(f(vs,e,r));case"Web3Connect":return ns;case"GotoRoute":var n=t.a;return es(n);case"GTag":var a=t.a;return Zu(a);case"BrowserNotification":var i=t.a,o=t.b,u=t.c;return l(Xu,i,o,u);default:return ts}}),ys=r(function(e,t){return f(ho,gs(e),t)}),ms={$:"EthDai"},bs=function(e){return{$:"Native",a:e}},Cs=function(e){return{$:"Token",a:e}},Ss={$:"XDai"},Es=m([Cs(ms),bs(Ss)]),Ts={$:"Seller"},ws={$:"ZEC"},Is=r(function(e,t){return f(zu,e,t)}),As=Yu,Bs=a(function(e,t,r,n){return{category:t,event:e,label:r,value:n}}),ks=a(function(e,t,r,n){return Zu(d(Bs,e,t,r,n))}),$s={$:"Buyer"},Ns=function(e){return{$:"Address",a:e}},Rs=Fr,xs=r(function(e,t){return e<1?t:l(Rs,e,iu(t),t)}),_s=function(e){return f(Pa,"0x",e)||f(Pa,"0X",e)?f(xs,2,e):e},Ls=z,Ps=f(Oa,_s,f(Oa,Ls,Ns)),Ds=function(e){if("Token"===e.$){if("EthDai"===e.a.$){e.a;return Ps("0x5677CFbA35a0Db0469d3d56020d556B942E9ce90")}e.a;return Ps("0xbC69Aff9d93C5EA4a841166C46C68518D02aF818")}switch(e.a.$){case"Eth":e.a;return Ps("0xD3b1e8F2bDe0a2DdfC9F6e2EB6e2589e5Ba955b6");case"Kovan":e.a;return Ps("0xA30773FD520cdf845E1a00441aB09cE39B31F676");default:e.a;return Ps("0x7E370099a7a789dC28810a72381bcd7Be834Ad74")}},Us=function(e){return Ps("EthDai"===e.$?"0x89d24A6b4CcB1B6fAA2625fE562bDD9a23260359":"0xC4375B7De8af5a38a93548eb8453a498222C4fF2")},Os=function(e){return{$:"AbiDecoder",a:e}},Ms=r(function(e,t){return{$:"Tape",a:e,b:t}}),Fs=xs(64),Vs=n(function(e,t,r){return T(f(Ms,e,Fs(t)),r)}),Ks=r(function(e,t){return e<1?"":l(Rs,0,e,t)}),Hs=Ks(64),js=r(function(e,t){if("Ok"===t.$){var r=t.a;return pi(e(r))}var n=t.a;return hi(n)}),qs=r(function(e,t){return e<1?"":l(Rs,-e,iu(t),t)}),Gs=function(){var e=function(e){if(!f(Ri,Za(I("0")),f(Ks,63,e)))return hi("Boolean decode error. "+e+" is not 1 or 0.");switch(f(qs,1,e)){case"0":return pi(!1);case"1":return pi(!0);default:return hi("Boolean decode error. "+e+" is not 1 or 0.")}};return Os(function(t){var r=t.a,n=t.b;return f(js,f(Vs,r,n),e(Hs(n)))})}(),zs=function(e){return e.b},Ys=r(function(e,t){var r=e.a;return f(js,zs,r(function(e){return f(Ms,e,e)}(_s(t))))}),Ws=Zr,Js=ne,Qs=Jr,Xs=function(e){return f(Ws,function(t){var r=e(t);if("Ok"===r.$){var n=r.a;return us(n)}var a=r.a;return Js(a)},Qs)},Zs=f(Oa,Ys,Xs),ec=function(e){return{$:"AddressE",a:e}},tc=ec,rc=function(e){return l(cu,64,I("0"),e)},nc=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=rc(pu(a)),c=function(e){return B(e,n)}(rc(pu(u)));return w(a+32+(iu(n)/2|0),B(i,s),B(o,c))}return w(a,B(i,n),o)});return function(e){return B(e.b,e.c)}(l(Wa,t,w(32*Ai(e),"",""),e))},ac=Dr,ic=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))))}),oc=n(function(e,t,n){return l(ac,r(function(t,r){return l(ic,e,Ci(t),r)}),t,n)}),uc=function(e){return Ja(l(oc,Sa,tr,e))},sc=function(e){return f(_i,"",f(ho,f(Oa,pu,f(cu,2,I("0"))),uc(e)))},cc=function(e){return 64-f(lu,64,e)},fc=function(e){return B(e,f(su,cc(iu(e)),"0"))},lc=function(e){return T(_a(iu(e)/2|0),fc(e))},dc=function(e){return T(La,rc(e))},hc=function(e){switch(e){case"0000":return I("0");case"0001":return I("1");case"0010":return I("2");case"0011":return I("3");case"0100":return I("4");case"0101":return I("5");case"0110":return I("6");case"0111":return I("7");case"1000":return I("8");case"1001":return I("9");case"1010":return I("a");case"1011":return I("b");case"1100":return I("c");case"1101":return I("d");case"1110":return I("e");case"1111":return I("f");default:return I("!")}},pc=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"}},vc=Ur,gc=function(e){var t=r(function(e,t){var r=t.a,n=t.b,a=T(e,n);e:for(;;)if(a.b)switch(a.a.valueOf()){case"0":return T(f(nu,I("1"),r),!0);case"1":return T(f(nu,I("0"),r),!0);default:break e}else switch(a.a.valueOf()){case"0":return T(f(nu,I("0"),r),!1);case"1":return T(f(nu,I("1"),r),!0);default:break e}return T(r,!0)});return l(vc,t,T("",!1),e).a},yc=function(e){return l(vc,Sa,tr,e)},mc=n(function(e,t,r){for(;;){if(""===t)return Ja(r);var n=e,a=f(xs,e,t),i=f(Sa,l(Rs,0,e,t),r);e=n,t=a,r=i}}),bc=r(function(e,t){return e&&""!==t?l(mc,e,t,tr):m([t])}),Cc=function(e){var t=function(){var t=yc(gu(e));if(t.b&&"-"===t.a.valueOf()){var r=t.b;return T(r,f(Oa,gc,f(cu,256,I("1"))))}var r=t;return T(r,f(cu,256,I("0")))}(),r=t.a,n=t.b;return fu(f(ho,hc,f(bc,4,n(f(_i,"",f(ho,pc,r))))))},Sc=function(e){return{$:"Hex",a:e}},Ec=function(e){switch(e.$){case"AddressE":var t=e.a.a;return dc(t);case"UintE":var r=e.a;return dc(gu(r));case"IntE":var n=e.a;return dc(Cc(n));case"BoolE":return dc(e.a?"1":"0");case"DBytesE":var a=e.a.a;return lc(a);case"BytesE":var a=e.a.a;return dc(_s(a));case"StringE":var i=e.a;return lc(sc(i));case"ListE":var o=e.a;return function(e){var t=e.a;return lc(t)}(Xt()(o));default:var i=e.a;return dc(_s(i))}};try{var Tc=Xt();Xt=function(){return Tc}}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 wc=Pr,Ic=function(e){return 1===iu(e)?f(wc,"0",e):e},Ac=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(Sa,n,r);e=i,t=o,r=u}}}),Bc=r(function(e,t){return Ja(l(Ac,e,t,tr))}),kc=n(function(e,t,r){if(t<=0)return tr;var n=T(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 m([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 m([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,v=p.b,u=v.a,g=v.b,h=g.a,y=g.b,b=y.a,C=y.b;return e>1e3?f(Sa,i,f(Sa,u,f(Sa,h,f(Sa,b,f(Bc,t-4,C))))):f(Sa,i,f(Sa,u,f(Sa,h,f(Sa,b,l(kc,e+1,t-4,C)))))}break t}}return r}var S=n.b,i=S.a;return m([i])}),$c=r(function(e,t){return l(kc,0,e,t)}),Nc=function(e){return{$:"KC",a:e}}({capacity:512,delSuffix:1,outputLen:32,rate:1088}),Rc=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 Pt(e.a)}},xc={$:"LE"},_c=n(function(e,t,r){switch(e.$){case"I8":var n=e.a;return l(On,t,r,n);case"I16":var a=e.a,n=e.b;return d(Mn,t,r,n,C(a,xc));case"I32":var a=e.a,n=e.b;return d(Fn,t,r,n,C(a,xc));case"U8":var n=e.a;return l(Vn,t,r,n);case"U16":var a=e.a,n=e.b;return d(Kn,t,r,n,C(a,xc));case"U32":var a=e.a,n=e.b;return d(Hn,t,r,n,C(a,xc));case"F32":var a=e.a,n=e.b;return d(jn,t,r,n,C(a,xc));case"F64":var a=e.a,n=e.b;return d(qn,t,r,n,C(a,xc));case"Seq":var i=e.b;return l(Lc,i,t,r);case"Utf8":var o=e.b;return l(zn,t,r,o);default:var i=e.a;return l(Gn,t,r,i)}}),Lc=n(function(e,t,r){for(;;){if(!e.b)return r;var n=e.a,a=e.b,i=a,o=t,u=l(_c,n,t,r);e=i,t=o,r=u}}),Pc=Dt,Dc=r(function(e,t){return{$:"Seq",a:e,b:t}}),Uc=r(function(e,t){for(;;){if(!t.b)return e;var r=t.a,n=t.b,a=e+Rc(r),i=n;e=a,t=i}}),Oc=function(e){return f(Dc,f(Uc,0,e),e)},Mc=function(e){return{$:"U8",a:e}},Fc=Mc,Vc=r(function(e,t){return E(e,t)<0?e:t}),Kc=function(e){return{$:"Bytes",a:e}},Hc=Kc,jc=function(e){return Pc(Oc(f(ho,Hc,Ja(e))))},qc=Pt,Gc=r(function(e,t){var r=e.a;return f(Yn,r,t)}),zc=function(e){return{$:"Decoder",a:e}},Yc=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 T(u,s.a)}var c=s.a,l=c,d=t,h=r,p=u;e=l,t=d,r=h,n=p}}),Wc=r(function(e,t){return zc(f(Yc,e,t))}),Jc=zc(Wn),Qc=function(e){return{$:"Done",a:e}},Xc=function(e){return{$:"Loop",a:e}},Zc=r(function(e,t){var n=t.a;return zc(r(function(t,r){var a=f(n,t,r),i=a.a,o=a.b;return T(i,e(o))}))}),ef=function(e){return zc(r(function(t,r){return T(r,e)}))},tf=r(function(e,t){var r=t.a,n=t.b;return r<=0?ef(Qc(Ja(n))):f(Zc,function(e){return Xc(T(r-1,f(Sa,e,n)))},e)}),rf=function(e){return f(Tu,tr,f(Gc,f(Wc,T(qc(e),tr),tf(Jc)),e))},nf=n(function(e,t,r){var n=t.a,a=t.b,i=r.a,o=r.b;return T(f(e,n,i),f(e,a,o))}),af=r(function(e,t){return l(nf,ou,e,t)}),of=f($i,0,4),uf=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}}),sf=Ee,cf=r(function(e,t){var r=t.a,n=t.b;return T(e(r),e(n))}),ff=function(e){return f(cf,f(Oa,sf,ou(4294967295)),e)},lf=r(function(e,t){return 5*t+e}),df=4294967295>>>32-Ha,hf=pr,pf=n(function(e,t,r){for(;;){var n=df&t>>>e,a=f(hf,n,r);if("SubTree"!==a.$){var i=a.a;return f(hf,df&t,i)}var o=a.a,u=e-Ha,s=t,c=o;e=u,t=s,r=c}}),vf=function(e){return e>>>5<<5},gf=r(function(e,t){var r=t.a,n=t.b,a=t.c,i=t.d;return e<0||E(e,r)>-1?La:_a(E(e,vf(r))>-1?f(hf,df&e,i):l(pf,n,e,a))}),yf=r(function(e,t){var r=f(gf,e,t);if("Just"===r.$){return r.a}return T(0,0)}),mf=n(function(e,t,r){var n=f(lf,e,t);return f(yf,n,r)}),bf=vr,Cf=a(function(e,t,r,n){var a=df&t>>>e,i=f(hf,a,n);if("SubTree"===i.$){var o=i.a,u=d(Cf,e-Ha,t,r,o);return l(bf,a,za(u),n)}var s=i.a,c=l(bf,df&t,r,s);return l(bf,a,Ga(c),n)}),Sf=n(function(e,t,r){var n=r.a,a=r.b,i=r.c,o=r.d;return e<0||E(e,n)>-1?r:E(e,vf(n))>-1?d(Ma,n,a,i,l(bf,df&e,t,o)):d(Ma,n,a,d(Cf,a,e,t,i),o)}),Ef=n(function(e,t,r){return l(Sf,e,t,r)}),Tf=a(function(e,t,r,n){var a=f(lf,e,t);return l(Ef,a,r,n)}),wf=fn,If=r(function(e,t){return l(nf,wf,e,t)}),Af=function(e){var t=l(ro,r(function(t,n){var a={d0:l(mf,0,t,e.state),d1:l(mf,1,t,e.state),d2:l(mf,2,t,e.state),d3:l(mf,3,t,e.state),d4:l(mf,4,t,e.state)},i=r(function(e,r){return d(Tf,e,t,f(If,f(uf,e,a),f(af,ff(f(uf,f(lu,5,e+1),a)),f(uf,f(lu,5,e+2),a))),r)});return f(i,4,f(i,3,f(i,2,f(i,1,f(i,0,n)))))}),e.state,of);return A(e,{state:t})},Bf=T(0,0),kf=function(e){return{current:Bf,lfsrstate:1,state:e,x:1,y:0}},$f=function(e){var t=1&e;return 128&e?T(t,e<<1^113):T(t,e<<1)},Nf=T(1,0),Rf=r(function(e,t){var r=t.a,n=t.b;return e?T(n,r):T(r,n)}),xf=r(function(e,t){if(e){var n=f(Rf,1,t);return l(nf,r(function(t,r){return 4294967295&(t<>>32-e)}),t,n)}return t}),_f=r(function(e,t){var r=f(lu,32,e/32|0),n=f(Rf,r,t),a=f(lu,32,e);return f(xf,a,n)}),Lf=n(function(e,t,r){var n=f(gf,e,r);if("Nothing"===n.$)return r;var a=n.a;return l(Sf,e,t(a),r)}),Pf=n(function(e,t,r){return l(Lf,e,If(t),r)}),Df=a(function(e,t,r,n){var a=f(lf,e,t);return l(Pf,a,r,n)}),Uf=function(e){return l(Wa,r(function(e,t){var r=(1<>r}),qf=n(function(e,t,r){return t?T(0,r<0))return t;var a=f(Vc,n,r),i=f(ho,function(e){return f(jf,e,v)},f($i,0,a)),o=Hf(e),u=B(t,i),s=n-a;e=o,t=u,n=s}});return f($c,i.outputLen,l(g,v,tr,i.outputLen))},Wf=function(e){return{$:"KS",a:e}},Jf=function(e){var t=e.a;return Wf({config:t,inputLength:0,partial:tr,state:f(di,25,Jo(Bf))})},Qf=function(e){return zc(Jn(e))},Xf=Pc(Oc(tr)),Zf=r(function(e,t){var n=t.a;return zc(r(function(t,r){var a=f(n,t,r),i=a.a,o=a.b;return f(e(o).a,t,i)}))}),el=r(function(e,t){return f(Zf,function(e){return Qf(t)},Qf(e))}),tl=r(function(e,t){return f(Tu,Xf,f(Gc,f(el,e,qc(t)-e),t))}),rl=r(function(e,t){for(;;){var n=t.a,a=n.config.rate/8|0,i=qc(e)?f(Sa,e,n.partial):n.partial;if(!(E(l(Wa,r(function(e,t){return t+qc(e)}),0,i),a)>-1))return Wf(A(n,{inputLength:qc(e)+n.inputLength,partial:i}));var o=jc(i),u=f(Tu,Xf,f(Gc,Qf(a),o)),s=rf(u),c=f(zf,s,n.state),d=Hf(c),h=f(tl,a,o),p=Xf,v=Wf(A(n,{inputLength:qc(e)+n.inputLength,partial:m([h]),state:d}));e=p,t=v}}),nl=r(function(e,t){return Yf(f(rl,Pc(Oc(f(ho,Fc,t))),Jf(e)))}),al=nl(Nc),il=function(e){return Sc(f(_i,"",f(ho,f(Oa,pu,Ic),f($c,4,al(f(ho,Ci,yc(e)))))))},ol=r(function(e,t){var r=nc(f(ho,Ec,t)),n=function(e){return B(e,r)}(_s(mu(il(e))));return Sc(n)}),ul=function(e){return{$:"UintE",a:e}},sl=ul,cl=n(function(e,t,r){return{data:_a(f(ol,"approve(address,uint256)",m([tc(t),sl(r)]))),decoder:Zs(Gs),from:La,gas:La,gasPrice:La,nonce:La,to:_a(e),value:La}}),fl=function(e){return{$:"TokenValue",a:e}},ll=function(e){return e.a},dl=r(function(e,t){return f(Tu,qo,f(Bu,ei,f(tu,e,t)))}),hl=r(function(e,t){return fl(f(dl,ll(e),To(t)))}),pl=function(e){return f(hl,e,12)},vl=function(e){return f(hl,e,3)},gl=fl(To(0)),yl=r(function(e,t){var r=gl;return{abortPunishment:pl(t.tradeAmount),autoabortInterval:t.autoabortInterval,autorecallInterval:t.autorecallInterval,autoreleaseInterval:t.autoreleaseInterval,buyerDeposit:vl(t.tradeAmount),initiatorAddress:e.address,initiatorCommPubkey:e.commPubkey,initiatorRole:t.initiatorRole,paymentMethods:t.paymentMethods,pokeReward:r,price:t.price,tradeAmount:t.tradeAmount}}),ml=function(e){return f(hl,e,200)},bl=r(function(e,t){return fl(f(No,ll(e),ll(t)))}),Cl=function(e){var t=f(hl,e.tradeAmount,200);return f(bl,e.pokeReward,f(bl,ml(e.tradeAmount),f(bl,t,function(){return"Buyer"===e.initiatorRole.$?vl(e.tradeAmount):e.tradeAmount}())))},Sl=os(Xa),El=n(function(e,t,r){return{id:e,initiator:r,tradeAddress:t}}),Tl=a(function(e,t,r,n){return{index:t,match:e,number:r,submatches:n}}),wl=Zn,Il=Xn,Al=function(e){return f(Il,{caseInsensitive:!1,multiline:!1},e)},Bl=Qn,kl=wl(f(Tu,Bl,Al("^((0[Xx]){1})?[0-9A-Fa-f]{40}$"))),$l=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}}),Nl=r(function(e,t){return!f($l,f(Ju,Po,e),t)}),Rl=Nl(Zi),xl=ee,_l=r(function(e,t){if("Ok"===t.$){return t.a}return e}),Ll=n(function(e,t,r){if("Err"===t.$){var n=t.a;return hi(n)}var a=t.a;if("Err"===r.$){var n=r.a;return hi(n)}var i=r.a;return pi(f(e,a,i))}),Pl=f(ro,Ll(Sa),pi(tr)),Dl=function(e){if(e.b){var t=(e.a,e.b);return _a(t)}return La},Ul=r(function(e,t){if("Ok"===t.$){var r=t.a;return pi(r)}var n=t.a;return hi(e(n))}),Ol=function(e){return""===e},Ml=n(function(e,t,r){e:for(;;){if(!t.b)return pi(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(io,16,e);e=i,t=o,r=u;continue e;case"2":var i=e-1,o=a,u=r+2*f(io,16,e);e=i,t=o,r=u;continue e;case"3":var i=e-1,o=a,u=r+3*f(io,16,e);e=i,t=o,r=u;continue e;case"4":var i=e-1,o=a,u=r+4*f(io,16,e);e=i,t=o,r=u;continue e;case"5":var i=e-1,o=a,u=r+5*f(io,16,e);e=i,t=o,r=u;continue e;case"6":var i=e-1,o=a,u=r+6*f(io,16,e);e=i,t=o,r=u;continue e;case"7":var i=e-1,o=a,u=r+7*f(io,16,e);e=i,t=o,r=u;continue e;case"8":var i=e-1,o=a,u=r+8*f(io,16,e);e=i,t=o,r=u;continue e;case"9":var i=e-1,o=a,u=r+9*f(io,16,e);e=i,t=o,r=u;continue e;case"a":var i=e-1,o=a,u=r+10*f(io,16,e);e=i,t=o,r=u;continue e;case"b":var i=e-1,o=a,u=r+11*f(io,16,e);e=i,t=o,r=u;continue e;case"c":var i=e-1,o=a,u=r+12*f(io,16,e);e=i,t=o,r=u;continue e;case"d":var i=e-1,o=a,u=r+13*f(io,16,e);e=i,t=o,r=u;continue e;case"e":var i=e-1,o=a,u=r+14*f(io,16,e);e=i,t=o,r=u;continue e;case"f":var i=e-1,o=a,u=r+15*f(io,16,e);e=i,t=o,r=u;continue e;default:var s=n;return hi(au(s)+" is not a valid hexadecimal character.")}}}),Fl=function(e){if(Ol(e))return hi("Empty strings are not valid hexadecimal strings.");var t=function(){if(f(Pa,"-",e)){var t=f(Tu,tr,Dl(yc(e)));return f(js,ao,l(Ml,Ai(t)-1,t,0))}return l(Ml,iu(e)-1,yc(e),0)}();return f(Ul,function(t){return f(_i," ",m(['"'+e+'"',"is not a valid hexadecimal string because",t]))},t)},Vl=function(e){var t=yc(e);return function(e){return T(t,e)}(f(_l,tr,Pl(f(ho,Fl,f(Pi,"",f(_i,"",f(ho,f(Oa,pu,Ic),f($c,20,al(f(ho,f(Oa,xl,Ci),t))))))))))},Kl=function(e){var t=r(function(e,t){return!(t>=8&&Si(e)||t<8&&Ei(e))}),n=Vl(_s(e)),a=n.a,i=n.b,o=l(Bi,t,a,i);return!!kl(e)&&Rl(o)},Hl=wl(f(Tu,Bl,Al("^((0[Xx]){1})?[0-9a-f]{40}$"))),jl=wl(f(Tu,Bl,Al("^((0[Xx]){1})?[0-9A-F]{40}$"))),ql=function(e){return'"'+e+'"'},Gl=function(e){var t=_s(e),r=f(Ks,24,t),n=f(qs,40,e);return 64===iu(t)&&f(Ri,Za(I("0")),r)?jl(n)||Hl(n)?pi(Ns(n)):Kl(n)?pi(Ns(n)):hi("Given address "+ql(e)+" failed the EIP-55 checksum test."):40!==iu(t)?hi("Given address "+ql(e)+" is not the correct length."):kl(t)?jl(t)||Hl(t)?pi(Ns(t)):Kl(t)?pi(Ns(t)):hi("Given address "+ql(e)+" failed the EIP-55 checksum test."):hi("Given address "+ql(e)+" contains invalid hex characters.")},zl=Os(function(e){var t=e.a,r=e.b;return f(js,f(Vs,t,r),Gl(Hs(r)))}),Yl=r(function(e,t){var r=t.a;return Os(function(t){var n=t.a,a=t.b;return r(f(Ms,n,f(xs,64*e,a)))})}),Wl=Qr,Jl=r(function(e,t){return f(Wl,"data",Zs(f(Yl,e,t)))}),Ql=Xr,Xl=r(function(e,t){return f(Wl,"topics",f(Ql,e,Zs(t)))}),Zl=function(e){if("Ok"===e.$){var t=e.a;return _a(t)}return La},ed=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}}}),td=n(function(e,t,r){var n=f(ed,t,r),a=Ai(r)>0;return e>0&&t>0&&a?f(Sa,f($c,e,r),l(td,e,t,n)):tr}),rd=r(function(e,t){return l(td,e,e,t)}),nd=function(e){var t=r(function(t,r){var n=e(t);if("Nothing"===n.$)return La;var a=n.a;return f(Bu,Sa(a),r)});return f(ro,t,_a(tr))}(Zi),ad=function(e){return f(Bu,f(Oa,Ja,f(Wa,r(function(e,t){return f(No,To(e),f(Ko,t,ru))}),qo)),nd(f(ho,f(Oa,Ja,f(Oa,fu,f(Oa,Fl,Zl))),f(rd,8,Ja(e)))))},id=function(e){var t=yc(Ls(e));e:for(;;){if(!t.b)return La;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(Bu,Ko(To(-1)),ad(a))}var i=t.b;i.b;return La}var a=t.b;return f(Bu,Ko(To(-1)),ad(a))}return La;case"+":if(t.b.b){var a=t.b;return ad(a)}return La;case"0":if(t.b.b&&"x"===t.b.a.valueOf()){if(t.b.b.b){var o=t.b,a=o.b;return ad(a)}t.b;return La}break e;default:break e}}var a=t;return ad(a)},od=r(function(e,t){if("Just"===t.$){var r=t.a;return pi(r)}return hi(e)}),ud=Os(function(e){var t=e.a,r=e.b;return f(js,f(Vs,t,r),f(od,"Error Decoding Uint into BigInt",id(Da(Hs(r)))))}),sd=f(Sl,f(Xl,1,zl),f(Sl,f(Jl,1,zl),f(Sl,f(Jl,0,ud),us(El)))),cd=an,fd=r(function(e,t){return ye(l(Wa,Se(e),be(),t))}),ld=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(cd,e,Iu(m([T("data",Vi(t.data)),T("topics",f(fd,bu,t.topics))]))),topics:t.topics,transactionHash:t.transactionHash,transactionIndex:t.transactionIndex}}),dd=function(e){if(e.b){var t=e.a;e.b;return _a(t)}return La},hd=r(function(e,t){if("Ok"===t.$){return e(t.a)}var r=t.a;return hi(r)}),pd=r(function(e,t){return f(js,function(e){return e.id},f(hd,function(e){return f(Ul,Mi,f(ld,sd,e).returnData)},f(od,"No log found from that factoryAddress in that txReceipt",dd(f(Eu,function(t){return C(f(Oa,Ua,Ls)(t.address),f(Oa,Ua,Ls)(Ds(e)))},t.logs)))))}),vd=n(function(e,t,r){return{data:_a(f(ol,"allowance(address,address)",m([tc(t),tc(r)]))),decoder:Zs(ud),from:La,gas:La,gasPrice:La,nonce:La,to:_a(e),value:La}}),gd=function(e){if("Token"===e.$){if("EthDai"===e.a.$){e.a;return"https://mainnet.infura.io/v3/e3eef0e2435349bf9164e6f465bd7cf9"}e.a;return"https://kovan.infura.io/v3/e3eef0e2435349bf9164e6f465bd7cf9"}switch(e.a.$){case"Eth":e.a;return"https://mainnet.infura.io/v3/e3eef0e2435349bf9164e6f465bd7cf9";case"Kovan":e.a;return"https://kovan.infura.io/v3/e3eef0e2435349bf9164e6f465bd7cf9";default:e.a;return"https://dai.poa.network"}},yd=function(e){switch(e.$){case"BlockNum":var t=e.a;return Vi(Da(pu(t)));case"EarliestBlock":return Vi("earliest");case"LatestBlock":return Vi("latest");default:return Vi("pending")}},md=function(e){var t=e.to,r=e.from,n=e.gas,a=e.gasPrice,i=e.value,o=e.data;return Au(m([T("to",f(Bu,Ki,t)),T("from",f(Bu,Ki,r)),T("gas",f(Bu,Cu,n)),T("gasPrice",f(Bu,yu,a)),T("value",f(Bu,yu,i)),T("data",f(Bu,bu,o))]))},bd=function(e){return{$:"BadBody",a:e}},Cd=function(e){return{$:"BadStatus",a:e}},Sd=function(e){return{$:"BadUrl",a:e}},Ed={$:"NetworkError"},Td={$:"Timeout"},wd=nn,Id=r(function(e,t){switch(t.$){case"BadUrl_":var r=t.a;return hi(Sd(r));case"Timeout_":return hi(Td);case"NetworkError_":return hi(Ed);case"BadStatus_":var n=t.a,a=t.b;return hi(Cd(n.statusCode));default:var n=t.a,a=t.b,i=f(wd,f(Wl,"result",e),a);if("Ok"===i.$){var o=i.a;return pi(o)}var u=i.a;return hi(bd(Mi(u)))}}),Ad=n(function(e,t,r){return Iu(m([T("id",Nu(e)),T("jsonrpc",Vi("2.0")),T("method",Vi(t)),T("params",f(fd,Zi,r))]))}),Bd=Du,kd=r(function(e,t){e:for(;;){if("RBEmpty_elm_builtin"===t.$)return La;var r=t.b,n=t.c,a=t.d,i=t.e,o=f(Co,e,r);switch(o.$){case"LT":var u=e,s=a;e=u,t=s;continue e;case"EQ":return _a(n);default:var u=e,s=i;e=u,t=s;continue e}}}),$d=function(e){for(;;){if("RBNode_elm_builtin"!==e.$||"RBNode_elm_builtin"!==e.d.$)return e;e=e.d}},Nd=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),v=d.c,g=d.d,y=d.e,m=c.e;return h(Pu,Uu,p,v,h(Pu,Lu,r,n,h(Pu,Uu,i,o,u,s),g),h(Pu,Lu,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(Pu,Lu,r,n,h(Pu,Uu,i,o,u,s),h(Pu,Uu,f,l,d,m))}return e},Rd=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,v=(p.a,p.b),g=p.c,y=p.d,m=p.e;return h(Pu,Uu,i,o,h(Pu,Lu,s,c,f,l),h(Pu,Lu,r,n,d,h(Pu,Uu,v,g,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,v=(S.a,S.b),g=S.c,y=S.d,m=S.e;return t.$,h(Pu,Lu,r,n,h(Pu,Uu,i,o,C,d),h(Pu,Uu,v,g,y,m))}return e},xd=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(Pu,r,u,s,c,h(Pu,Uu,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 Rd(t)}break e}o.a,o.d;return Rd(t)}break e}return t}),_d=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(Pu,t,r,n,_d(a),u)}var s=Nd(e);if("RBNode_elm_builtin"===s.$){var c=s.a,f=s.b,l=s.c,d=s.d,p=s.e;return h(Ou,c,f,l,_d(d),p)}return Du}return h(Pu,t,r,n,_d(a),u)}return Du},Ld=r(function(e,t){if("RBEmpty_elm_builtin"===t.$)return Du;var r=t.a,n=t.b,a=t.c,i=t.d,o=t.e;if(E(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(Pu,r,n,a,f(Ld,e,i),o)}var s=Nd(t);if("RBNode_elm_builtin"===s.$){var c=s.a,l=s.b,d=s.c,p=s.d,g=s.e;return h(Ou,c,l,d,f(Ld,e,p),g)}return Du}return h(Pu,r,n,a,f(Ld,e,i),o)}return f(Pd,e,v(xd,e,t,r,n,a,i,o))}),Pd=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(C(e,n)){var u=$d(o);if("RBNode_elm_builtin"===u.$){var s=u.b,c=u.c;return h(Ou,r,s,c,i,_d(o))}return Du}return h(Ou,r,n,a,i,f(Ld,e,o))}return Du}),Dd=r(function(e,t){var r=f(Ld,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(Pu,Lu,n,a,i,o)}return r}),Ud=n(function(e,t,r){var n=t(f(kd,e,r));if("Just"===n.$){var a=n.a;return l(Fu,e,a,r)}return f(Dd,e,r)}),Od=function(e){return"Just"===e.$},Md=mn,Fd=bn,Vd=r(function(e,t){return{$:"BadStatus_",a:e,b:t}}),Kd=function(e){return{$:"BadUrl_",a:e}},Hd=r(function(e,t){return{$:"GoodStatus_",a:e,b:t}}),jd={$:"NetworkError_"},qd=function(e){return{$:"Receiving",a:e}},Gd=function(e){return{$:"Sending",a:e}},zd={$:"Timeout_"},Yd=function(e){return f(aa,"application/json",f(Ui,0,e))},Wd=n(function(e,t,r){return Yd(l(Ad,e,t,r))}),Jd=f(ta,"",Zi),Qd=we,Xd=Te,Zd=function(e){if("Ok"===e.$){var t=e.a;return Xd(t)}var r=e.a;return Qd(r)},eh=function(e){return l(ea,cr,Zd,{allowCookiesFromOtherDomains:!1,body:e.body,expect:e.resolver,headers:e.headers,method:e.method,timeout:e.timeout,tracker:La,url:e.url})},th=function(e){var t=e.url,r=e.method,n=e.params,a=e.decoder;return eh({body:l(Wd,1,r,n),headers:tr,method:"POST",resolver:Jd(Id(a)),timeout:La,url:t})},rh=n(function(e,t,r){return th({decoder:t.decoder,method:"eth_call",params:m([md(t),yd(r)]),url:e})}),nh={$:"LatestBlock"},ah=r(function(e,t){return l(rh,e,t,nh)}),ih=function(e){return{$:"Perform",a:e}},oh=ln,uh=Xd(cr),sh=r(function(e,t){return f(oh,function(t){return Xd(e(t))},t)}),ch=n(function(e,t,r){return f(oh,function(t){return f(oh,function(r){return Xd(f(e,t,r))},r)},t)}),fh=function(e){return l(ro,ch(Sa),Xd(tr),e)},lh=r(function(e,t){var r=t.a;return ke(f(oh,Md(e),r))}),dh=n(function(e,t,r){return f(sh,function(e){return cr},fh(f(ho,lh(e),t)))}),hh=n(function(e,t,r){return Xd(cr)}),ph=r(function(e,t){var r=t.a;return ih(f(sh,e,r))});yn.Task=De(uh,dh,hh,ph);var vh=Oe("Task"),gh=dn,yh=r(function(e,t){return vh(ih(f(gh,f(Ju,f(Ju,Xd,e),hi),f(oh,f(Ju,f(Ju,Xd,e),pi),t))))}),mh=a(function(e,t,r,n){return f(yh,n,f(ah,gd(Cs(e)),l(vd,Us(e),t,r)))}),bh=function(e){if("Token"===e.$){if("EthDai"===e.a.$){e.a;return Ps("0x61F399ED1D5AEC3Bc9d4B026352d5764181d6b35")}e.a;return Ps("0xF59ed429f9753B0498436DE1a3559AEC7a0c2a21")}switch(e.a.$){case"Eth":e.a;return Ps("0x61F399ED1D5AEC3Bc9d4B026352d5764181d6b35");case"Kovan":e.a;return Ps("0xF59ed429f9753B0498436DE1a3559AEC7a0c2a21");default:e.a;return Ps("0x092110996699c3E06e998d89F0f4586026e44F0F")}},Ch=function(e){return{$:"BoolE",a:e}},Sh=Ch,Eh=function(e){return{$:"StringE",a:e}},Th=Eh,wh=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:_a(f(ol,"createOpenTrade(address[2],bool,uint256[8],string,string)",m([tc(t),tc(r),Sh(n),sl(a),sl(i),sl(o),sl(u),sl(s),sl(c),sl(l),sl(d),Th(h),Th(p)]))),decoder:Zs(zl),from:La,gas:La,gasPrice:La,nonce:La,to:_a(e),value:La}}}}}}}}}}}}}}},Ih=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:_a(f(ol,"createOpenTrade(address[2],bool,uint256[8],string,string)",m([tc(t),tc(r),Sh(n),sl(a),sl(i),sl(o),sl(u),sl(s),sl(c),sl(l),sl(d),Th(h),Th(p)]))),decoder:Zs(zl),from:La,gas:La,gasPrice:La,nonce:La,to:_a(e),value:La}}}}}}}}}}}}}}},Ah=r(function(e,t){return{paymentMethods:t,price:e}}),Bh=function(e){switch(e.$){case"Cash":return"cash";case"Bank":return"bank";default:return"custom"}},kh=function(e){return Iu(m([T("type",Vi(Bh(e.type_))),T("info",Vi(e.info))]))},$h=ye,Nh=function(e){return f(fd,Zi,m([Vi(e.symbol),$h(e.amount)]))},Rh=function(e){var t=Nh(e.price),r=f(fd,kh,e.paymentMethods);return f(Ui,0,Iu(m([T("paymentmethods",r),T("price",t)])))},xh=r(function(e,t){return A(t,{value:_a(e)})}),_h=function(e){return e.a},Lh=function(e){return To(_h(e))},Ph=function(e){return f(dl,Lh(e),To(1e3))},Dh=r(function(e,t){var r=function(){return"Token"===e.$?wh:Ih}();return function(){return"Native"===e.$?xh(ll(Cl(t))):Zi}()(r(Ds(e))(t.initiatorAddress)(bh(e))(C(t.initiatorRole,Ts))(ll(t.tradeAmount))(ll(vl(t.tradeAmount)))(ll(pl(t.tradeAmount)))(ll(t.pokeReward))(Ph(t.autorecallInterval))(Ph(t.autoabortInterval))(Ph(t.autoreleaseInterval))(ll(ml(t.tradeAmount)))(Rh(f(Ah,t.price,t.paymentMethods)))(t.initiatorCommPubkey))}),Uh=r(function(e,t){return{$:"CreateMined",a:e,b:t}}),Oh=function(e){return{$:"CreateNeedsSig",a:e}},Mh=r(function(e,t){return{$:"CreateSigned",a:e,b:t}}),Fh=function(e){return{data:e.data,from:e.from,gas:e.gas,gasPrice:e.gasPrice,nonce:e.nonce,to:e.to,value:e.value}},Vh=r(function(e,t){var r=Fh(f(Dh,e,t)),n={onBroadcast:La,onMined:_a(T(Uh(e),La)),onSign:_a(Mh(e))};return T(_a(Oh(e)),f(Is,n,r))}),Kh=J,Hh=function(e){if(""===e)return pi(La);var t=Kh(e);if("Just"===t.$){var r=t.a;return pi(_a(r))}return hi("Invalid amount")},jh=function(e){return""===e?pi(La):f(js,_a,f(js,function(e){return e/100},f(od,"Invalid responderProfit",Kh(e))))},qh=r(function(e,t){return f(Bu,zs,dd(f(Eu,f(Oa,ei,Za(e)),t)))}),Gh={$:"Caution"},zh={align:va,label:"oldPriceDataWarning",mainParagraphs:m([m([Na("Uh oh, it looks like our price data might be out of date. You might want to double check the math...")])]),noticeType:Gh},Yh=n(function(e,t,r){if("Nothing"===t.$)return La;var n=t.a;if("Nothing"===r.$)return La;var a=r.a;return _a(f(e,n,a))}),Wh=Y,Jh=function(e){var t=f(qh,e.foreignCrypto,e.prices);if("Just"===t.$){if("Ok"===t.a.$){var n=t.a.a,a=l(Yh,r(function(t,r){return"Buyer"===e.initiatorRole.$?t*(r+1)/n:t*(r+1)*n*1.01}),e.amountOut,e.responderProfit);return T(A(e,{amountIn:function(){return"Just"===a.$?a:e.amountIn}(),amountInInput:f(Tu,e.amountInInput,f(Bu,Wh,a))}),tr)}t.a;return T(e,m([rs(zh)]))}return T(e,tr)},Qh=function(e){var t=f(qh,e.foreignCrypto,e.prices);if("Just"===t.$){if("Ok"===t.a.$){var n=t.a.a,a=l(Yh,r(function(t,r){return"Buyer"===e.initiatorRole.$?t*n/(r+1):t/1.01/n/(r+1)}),e.amountIn,e.responderProfit);return T(A(e,{amountOut:function(){return"Just"===a.$?a:e.amountOut}(),amountOutInput:f(Tu,e.amountOutInput,f(Bu,Wh,a))}),tr)}t.a;return T(e,m([rs(zh)]))}return T(e,tr)},Xh=function(e){return"Buyer"===e.initiatorRole.$?Qh(e):Jh(e)},Zh=function(e){return"Buyer"===e.initiatorRole.$?Jh(e):Qh(e)},ep=r(function(e,t){return{$:"AllowanceFetched",a:e,b:t}}),tp=n(function(e,t,r){return{$:"ApproveMining",a:e,b:t,c:r}}),rp=function(e){return{$:"ApproveNeedsSig",a:e}},np=n(function(e,t,r){return{$:"ApproveSigned",a:e,b:t,c:r}}),ap=n(function(e,t,r){return{$:"Confirm",a:e,b:t,c:r}}),ip=r(function(e,t){return{$:"CreateMining",a:e,b:t}}),op=function(e){return{$:"PricesFetched",a:e}},up=a(function(e,t,r,n){return{chainCmd:r,cmd:t,cmdUps:n,model:e}}),sp=function(e){return d(up,e,qu,As,tr)},cp=f(Ju,f(cu,7,I("0")),xi),fp=function(e){return f(_i,"",e)},lp=function(e){var t=e.a,r=Ja(t);if(r.b){var n=r.a,a=r.b;return fp(f(Sa,xi(n),f(ho,cp,a)))}return"0"},dp=function(e){switch(e.$){case"Zer":return"0";case"Pos":var t=e.a;return lp(t);default:var t=e.a;return"-"+lp(t)}},hp=W,pp=function(e){return hp(dp(e))},vp=r(function(e,t){return f(Co,_h(e),_h(t))}),gp=function(e){return{$:"Posix",a:e}},yp=gp,mp=r(function(e,t){return yp(_h(e)-_h(t))}),bp=function(e){return{$:"Ok",a:e}},Cp={$:"Outdated"},Sp=r(function(e,t){return C(f(vp,f(mp,e,t.timestamp),yp(6e5)),ma)?Cp:bp(t.price)}),Ep=r(function(e,t){return{price:e,timestamp:t}}),Tp={$:"BTC"},wp={$:"XMR"},Ip=m([ws,wp,Tp]),Ap=function(e){switch(e.$){case"ZEC":return"ZEC";case"XMR":return"XMR";default:return"BTC"}},Bp=function(e){return l(Wa,r(function(e,t){var r=e.a,n=e.b;return l(Fu,r,n,t)}),Bd,e)},kp=function(e){return f(kd,e,Bp(f(ho,function(e){return T(Ap(e),e)},Ip)))},$p=f(Ws,f(Oa,kp,f(Oa,Bu(us),Tu(Js("")))),Qs),Np=r(function(e,t){return T(e,t)}),Rp=Yr,xp=n(function(e,t,r){return{col:t,problem:r,row:e}}),_p=function(e){return l(xp,e.row,e.col,e.problem)},Lp=r(function(e,t){e:for(;;)switch(e.$){case"Empty":return t;case"AddRight":var r=e.a,n=e.b,a=r,i=f(Sa,n,t);e=a,t=i;continue e;default:var r=e.a,o=e.b,a=r,i=f(Lp,o,t);e=a,t=i;continue e}}),Pp=r(function(e,t){var r=e.a,n=r({col:1,context:tr,indent:1,offset:0,row:1,src:t});if("Good"===n.$){var a=n.b;return pi(a)}var i=n.b;return hi(f(Lp,i,tr))}),Dp=r(function(e,t){var r=f(Pp,e,t);if("Ok"===r.$){var n=r.a;return pi(n)}var a=r.a;return hi(f(ho,_p,a))}),Up=r(function(e,t){return{$:"Bad",a:e,b:t}}),Op=n(function(e,t,r){return{$:"Good",a:e,b:t,c:r}}),Mp=function(e){return{$:"Parser",a:e}},Fp=r(function(e,t){var r=t.a;return Mp(function(t){var n=r(t);if("Bad"===n.$){var a=n.a,i=n.b;return f(Up,a,i)}var o=n.a,u=n.b,s=n.c,c=e(u),d=c.a,h=d(s);if("Bad"===h.$){var p=h.a,i=h.b;return f(Up,o||p,i)}var p=h.a,v=h.b,g=h.c;return l(Op,o||p,v,g)})}),Vp=Fp,Kp={$:"ExpectingEnd"},Hp=r(function(e,t){return{$:"AddRight",a:e,b:t}}),jp=a(function(e,t,r,n){return{col:t,contextStack:n,problem:r,row:e}}),qp={$:"Empty"},Gp=r(function(e,t){return f(Hp,qp,d(jp,e.row,e.col,t,e.context))}),zp=function(e){return Mp(function(t){return C(iu(t.src),t.offset)?l(Op,!1,cr,t):f(Up,!1,f(Gp,t,e))})}(Kp),Yp=n(function(e,t,r){var n=t.a,a=r.a;return Mp(function(t){var r=n(t);if("Bad"===r.$){var i=r.a,o=r.b;return f(Up,i,o)}var u=r.a,s=r.b,c=r.c,d=a(c);if("Bad"===d.$){var h=d.a,o=d.b;return f(Up,u||h,o)}var h=d.a,p=d.b,v=d.c;return l(Op,u||h,f(e,s,p),v)})}),Wp=r(function(e,t){return l(Yp,Jo,e,t)}),Jp=Wp,Qp=r(function(e,t){return l(Yp,ni,e,t)}),Xp=Qp,Zp=r(function(e,t){return{$:"Append",a:e,b:t}}),ev=n(function(e,t,r){for(;;){if(!r.b)return f(Up,!1,t);var n=r.a.a,a=r.b,i=n(e);if("Good"===i.$){var o=i;return o}var o=i,u=o.a,s=o.b;if(u)return o;var c=e,l=f(Zp,t,s),d=a;e=c,t=l,r=d}}),tv=function(e){return Mp(function(t){return l(ev,t,qp,e)})},rv=tv,nv=function(e){return Mp(function(t){return l(Op,!1,e,t)})},av=nv,iv=function(e){return{$:"ExpectingSymbol",a:e}},ov=r(function(e,t){return{$:"Token",a:e,b:t}}),uv=ia,sv=function(e){var t=e.a,r=e.b,n=!Ol(t);return Mp(function(e){var a=h(uv,t,e.offset,e.row,e.col,e.src),i=a.a,o=a.b,u=a.c;return C(i,-1)?f(Up,!1,f(Gp,e,r)):l(Op,n,cr,{col:u,context:e.context,indent:e.indent,offset:i,row:o,src:e.src})})},cv=sv,fv=function(e){return cv(f(ov,e,iv(e)))},lv=xr,dv=oa,hv=i(function(e,t,r,n,a){for(;;){var i=l(dv,e,t,a.src);if(C(i,-1))return l(Op,E(a.offset,t)<0,cr,{col:n,context:a.context,indent:a.indent,offset:t,row:r,src:a.src});if(C(i,-2)){var o=e,u=t+1,s=r+1,c=1,f=a;e=o,t=u,r=s,n=c,a=f}else{var o=e,u=i,s=r,c=n+1,f=a;e=o,t=u,r=s,n=c,a=f}}}),pv=function(e){return Mp(function(t){return h(hv,e,t.offset,t.row,t.col,t)})},vv=pv,gv=r(function(e,t){var r=t.a;return Mp(function(t){var n=r(t);if("Bad"===n.$){var a=n.a,i=n.b;return f(Up,a,i)}var a=n.a,o=n.b,u=n.c;return l(Op,a,f(e,l(Rs,t.offset,u.offset,t.src),o),u)})}),yv=function(e){return f(gv,Jo,e)},mv=yv,bv=function(e){return{$:"Problem",a:e}},Cv=function(e){return Mp(function(t){return f(Up,!1,f(Gp,t,e))})},Sv=function(e){return Cv(bv(e))},Ev=f(Vp,function(e){if(iu(e)<=9){var t=Kh("0."+e);if("Just"===t.$){var r=t.a;return av(lv(1e3*r))}return Sv('Invalid float: "'+e+'"')}return Sv("Expected at most 9 digits, but got "+xi(iu(e)))},mv(vv(wi))),Tv=o(function(e,t,r,n,a,i){return yp(e+60*t*60*1e3+60*(r-i)*1e3+1e3*n+a)}),wv=function(e){return{$:"Done",a:e}},Iv=function(e){return{$:"Loop",a:e}},Av={$:"UnexpectedChar"},Bv=r(function(e,t){return Mp(function(r){var n=l(dv,e,r.offset,r.src);return C(n,-1)?f(Up,!1,f(Gp,r,t)):C(n,-2)?l(Op,!0,cr,{col:1,context:r.context,indent:r.indent,offset:r.offset+1,row:r.row+1,src:r.src}):l(Op,!0,cr,{col:r.col+1,context:r.context,indent:r.indent,offset:n,row:r.row,src:r.src})})}),kv=function(e){return f(Bv,e,Av)},$v=r(function(e,t){var r=t.a;return Mp(function(t){var n=r(t);if("Good"===n.$){var a=n.a,i=n.b,o=n.c;return l(Op,a,e(i),o)}var a=n.a,u=n.b;return f(Up,a,u)})}),Nv=$v,Rv=function(e){return{$:"Done",a:e}},xv=function(e){return{$:"Loop",a:e}},_v=function(e){if("Loop"===e.$){var t=e.a;return xv(t)}var r=e.a;return Rv(r)},Lv=a(function(e,t,r,n){e:for(;;){var a=r(t),i=a.a,o=i(n);if("Good"===o.$){var u=o.a,s=o.b,c=o.c;if("Loop"===s.$){var d=s.a,h=e||u,p=d,v=r,g=c;e=h,t=p,r=v,n=g;continue e}var y=s.a;return l(Op,e||u,y,c)}var u=o.a,m=o.b;return f(Up,e||u,m)}}),Pv=r(function(e,t){return Mp(function(r){return d(Lv,!1,e,t,r)})}),Dv=r(function(e,t){return f(Pv,e,function(e){return f(Nv,_v,t(e))})}),Uv=function(e){return f(Dv,"",function(t){if(C(iu(t),e)){var r=hp(t);if("Just"===r.$){var n=r.a;return f(Nv,wv,av(n))}return Sv('Invalid integer: "'+t+'"')}return f(Nv,function(e){return Iv(f(wc,t,e))},mv(kv(wi)))})},Ov=function(e){return Sv("Invalid day: "+xi(e))},Mv=function(e){return!f(lu,4,e)&&(f(lu,100,e)||!f(lu,400,e))},Fv=function(e){var t=e-1;return(t/4|0)-(t/100|0)+(t/400|0)},Vv=function(e){var t=e.a,r=e.b,n=e.c;if(n<0)return Ov(n);var a=function(e){var a=31536e6*(t-1970),i=r<3||!Mv(t)?n-1:n,o=864e5*(i+(Fv(t)-Fv(1970)));return av(e+a+o)};switch(r){case 1:return n>31?Ov(n):a(0);case 2:return n>29||29===n&&!Mv(t)?Ov(n):a(26784e5);case 3:return n>31?Ov(n):a(50976e5);case 4:return n>30?Ov(n):a(7776e6);case 5:return n>31?Ov(n):a(10368e6);case 6:return n>30?Ov(n):a(130464e5);case 7:return n>31?Ov(n):a(156384e5);case 8:return n>31?Ov(n):a(183168e5);case 9:return n>30?Ov(n):a(209952e5);case 10:return n>31?Ov(n):a(235872e5);case 11:return n>30?Ov(n):a(262656e5);case 12:return n>31?Ov(n):a(288576e5);default:return Sv('Invalid month: "'+xi(r)+'"')}},Kv=f(Vp,Vv,f(Xp,f(Xp,f(Xp,av(n(function(e,t,r){return w(e,t,r)})),Uv(4)),rv(m([f(Xp,f(Jp,av(Zi),fv("-")),Uv(2)),Uv(2)]))),rv(m([f(Xp,f(Jp,av(Zi),fv("-")),Uv(2)),Uv(2)])))),Hv=function(){var e=n(function(e,t,r){return e*(60*t)+r});return f(Xp,av(Zi),rv(m([f(Nv,function(e){return 0},fv("Z")),f(Xp,f(Xp,f(Xp,av(e),rv(m([f(Nv,function(e){return 1},fv("+")),f(Nv,function(e){return-1},fv("-"))]))),Uv(2)),rv(m([f(Xp,f(Jp,av(Zi),fv(":")),Uv(2)),Uv(2),av(0)]))),f(Jp,av(0),zp)])))}(),jv=f(Vp,function(e){return rv(m([f(Xp,f(Xp,f(Xp,f(Xp,f(Xp,f(Jp,av(Tv(e)),fv("T")),Uv(2)),rv(m([f(Xp,f(Jp,av(Zi),fv(":")),Uv(2)),Uv(2)]))),rv(m([f(Xp,f(Jp,av(Zi),fv(":")),Uv(2)),Uv(2)]))),rv(m([f(Xp,f(Jp,av(Zi),fv(".")),Ev),av(0)]))),f(Jp,Hv,zp)),f(Jp,av(p(Tv,e,0,0,0,0,0)),zp)]))},Kv),qv=function(e){return f(Dp,jv,e)},Gv=f(Ws,function(e){var t=qv(e);if("Err"===t.$){t.a;return Js("TODO deadEndsToString")}var r=t.a;return us(r)},Qs),zv=l(os,Np,f(Wl,"symbol",$p),f(Wl,"quote",f(Wl,"USD",l(os,Ep,f(Wl,"price",Rp),f(Wl,"last_updated",Gv))))),Yv=function(e){return l(Ca,n(function(e,t,r){return f(Sa,t,r)}),tr,e)},Wv=ue,Jv=f(is,Yv,function(e){return f(is,Bp,Wv(e))}(zv)),Qv=na,Xv=r(function(e,t){return l(ta,"",Zi,f(Oa,t,e))}),Zv=r(function(e,t){switch(t.$){case"BadUrl_":var r=t.a;return hi(Sd(r));case"Timeout_":return hi(Td);case"NetworkError_":return hi(Ed);case"BadStatus_":var n=t.a;return hi(Cd(n.statusCode));default:var a=t.b;return f(Ul,bd,e(a))}}),eg=r(function(e,t){return f(Xv,e,Zv(function(e){return f(Ul,Mi,f(wd,t,e))}))}),tg=function(e){return{$:"Request",a:e}},rg=r(function(e,t){return{reqs:e,subs:t}}),ng=Xd(f(rg,Bd,tr)),ag=Ne,ig=ke,og=n(function(e,t,r){e:for(;;){if(t.b){var n=t.a,a=t.b;if("Cancel"===n.$){var i=n.a,o=f(kd,i,r);if("Nothing"===o.$){var u=e,s=a,c=r;e=u,t=s,r=c;continue e}var d=o.a;return f(oh,function(t){return l(og,e,a,f(Dd,i,r))},ag(d))}var h=n.a;return f(oh,function(t){var n=h.tracker;if("Nothing"===n.$)return l(og,e,a,r);var i=n.a;return l(og,e,a,l(Fu,i,t,r))},ig(l(ea,e,Md(e),h)))}return Xd(r)}}),ug=a(function(e,t,r,n){return f(oh,function(e){return Xd(f(rg,e,r))},l(og,e,t,n.reqs))}),sg=n(function(e,t,r){var n=e(t);if("Just"===n.$){var a=n.a;return f(Sa,a,r)}return r}),cg=r(function(e,t){return l(ro,sg(e),tr,t)}),fg=a(function(e,t,r,n){var a=n.a,i=n.b;return C(t,a)?_a(f(Md,e,i(r))):La}),lg=n(function(e,t,r){var n=t.a,a=t.b;return f(oh,function(e){return Xd(r)},fh(f(cg,l(fg,e,n,a),r.subs)))}),dg=function(e){return{$:"Cancel",a:e}},hg=r(function(e,t){if("Cancel"===t.$){var r=t.a;return dg(r)}var n=t.a;return tg({allowCookiesFromOtherDomains:n.allowCookiesFromOtherDomains,body:n.body,expect:f(ra,e,n.expect),headers:n.headers,method:n.method,timeout:n.timeout,tracker:n.tracker,url:n.url})}),pg=r(function(e,t){return{$:"MySub",a:e,b:t}}),vg=r(function(e,t){var r=t.a,n=t.b;return f(pg,r,f(Oa,n,e))});yn.Http=De(ng,ug,lg,hg,vg);var gg=Oe("Http"),yg=(Oe("Http"),function(e){return gg(tg({allowCookiesFromOtherDomains:!1,body:e.body,expect:e.expect,headers:e.headers,method:e.method,timeout:e.timeout,tracker:e.tracker,url:e.url}))}),mg=function(e){return yg({body:Qv,expect:f(eg,e,Jv),headers:tr,method:"GET",timeout:La,tracker:La,url:"https://daihard.exchange/prices.json"})},bg=r(function(e,t){return{$:"Trade",a:e,b:t}}),Cg={align:va,label:"cantFetchPrices",mainParagraphs:m([m([Na("Error encountered fetching crypto prices.")])]),noticeType:Gh},Sg={$:"Error"},Eg=r(function(e,t){f(ka,e+" fetch error",t);return{align:va,label:"web3FetchError",mainParagraphs:m([m([Na('Failed to fetch "'+e+'". See console output for more info.')])]),noticeType:Sg}}),Tg=r(function(e,t){return{align:va,label:"web3MiningError",mainParagraphs:m([m([Na('Error mining "'+e+'" transaction: '+t)])]),noticeType:Sg}}),wg=r(function(e,t){return{align:va,label:"web3SigError",mainParagraphs:m([m([Na('Error signing "'+e+'" transaction: '+t)])]),noticeType:Gh}}),Ig={$:"KovanDai"},Ag=function(e){e:for(;;)switch(e.$){case"Mainnet":return _a(Cs(ms));case"Kovan":return _a(Cs(Ig));case"Private":if(100===e.a)return _a(bs(Ss));break e;default:break e}return La},Bg=function(e){switch(e.$){case"NoneDetected":return La;case"OnlyNetwork":var t=e.a;return _a(t);default:var r=e.a;return _a(r.network)}},kg=r(function(e,t){if("Just"===t.$){return e(t.a)}return La}),$g=function(e){return f(kg,Ag,Bg(e))},Ng=function(e){if("Active"===e.$){var t=e.a;return _a(t)}return La},Rg=r(function(e,t){return T(t.a,e(t.b))}),xg=r(function(e,t){switch(e.$){case"UpdateNow":var r=e.a;return sp(A(t,{now:r}));case"Refresh":var n=function(){var e=T(Ng(t.wallet),$g(t.wallet));if("Just"===e.a.$&&"Just"===e.b.$&&"Token"===e.b.a.$){var r=e.a.a,n=e.b.a.a;return d(mh,n,r.address,Ds(Cs(n)),ep(n))}return qu}(),a=mg(op);return d(up,t,ju(m([n,a])),As,tr);case"PricesFetched":var i=e.a;if("Ok"===i.$){var o=i.a,u=f(ho,Rg(Sp(t.now)),o),s=Qh(A(t,{prices:u})),c=s.a,h=s.b;return d(up,c,qu,As,h)}i.a;return d(up,t,qu,As,m([rs(Cg)]));case"AmountInChanged":var p=e.a,v=function(){var e=t.errors,r=Hh(p);if("Ok"===r.$){return T(r.a,A(e,{amountIn:La}))}var n=r.a;return T(La,A(e,{amountIn:_a(n)}))}(),g=v.a,y=v.b,b=Qh(A(t,{amountIn:g,amountInInput:p,errors:y})),c=b.a,h=b.b;return d(up,c,qu,As,h);case"AmountOutChanged":var p=e.a,S=function(){var e=t.errors,r=Hh(p);if("Ok"===r.$){return T(r.a,A(e,{amountOut:La}))}var n=r.a;return T(La,A(e,{amountOut:_a(n)}))}(),E=S.a,y=S.b,w=Jh(A(t,{amountOut:E,amountOutInput:p,errors:y})),c=w.a,h=w.b;return d(up,c,qu,As,h);case"ResponderProfitChanged":var p=e.a,I=function(){var e=t.errors,r=jh(p);if("Ok"===r.$){return T(r.a,A(e,{responderProfit:La}))}var n=r.a;return T(La,A(e,{responderProfit:_a(n)}))}(),B=I.a,y=I.b,k=Qh(A(t,{errors:y,responderProfit:B,responderProfitInput:p})),c=k.a,h=k.b;return d(up,c,qu,As,h);case"SwapClicked":var $=Xh(A(t,{amountIn:t.amountOut,amountInInput:t.amountOutInput,amountOut:t.amountIn,amountOutInput:t.amountInInput,initiatorRole:function(){return"Buyer"===t.initiatorRole.$?Ts:$s}()})),c=$.a,h=$.b;return d(up,c,qu,As,h);case"TokenTypeClicked":return sp(A(t,{showDhTokenDropdown:!t.showDhTokenDropdown}));case"ChangeTokenType":var N=e.a,R=Xh(A(t,{dhToken:N,showDhTokenDropdown:!1})),c=R.a,h=R.b;return d(up,c,qu,As,h);case"ForeignCryptoTypeClicked":return sp(A(t,{showForeignCryptoDropdown:!t.showForeignCryptoDropdown}));case"ChangeForeignCrypto":var x=e.a,_=Zh(A(t,{foreignCrypto:x,showForeignCryptoDropdown:!1})),c=_.a,h=_.b;return d(up,c,qu,As,h);case"ReceiveAddressChanged":var p=e.a;return sp(A(t,{receiveAddress:p}));case"PlaceOrderClicked":var L=e.a,P=e.b,D=e.c,U=f(yl,P,D);return sp(A(t,{depositAmount:_a(ll(Cl(U))),txChainStatus:_a(l(ap,L,U,t.receiveAddress))}));case"AbortCreate":return d(up,A(t,{txChainStatus:La}),qu,As,m([d(ks,"abort","abort","create",0)]));case"ConfirmCreate":var L=e.a,U=e.b,O=e.c,M=function(){if("Native"===L.$)return f(Vh,L,U);var e=L.a,r=function(){var t=Fh(l(cl,Us(e),Ds(L),O)),r={onBroadcast:La,onMined:La,onSign:_a(f(np,e,U))};return f(Is,r,t)}(),n=t.allowance;if("Just"===n.$){var a=n.a;return C(f(_o,a,O),ba)?T(_a(rp(e)),r):f(Vh,L,U)}return T(_a(rp(e)),r)}(),F=M.a,V=M.b;return d(up,A(t,{txChainStatus:F}),qu,V,tr);case"ApproveSigned":var K=e.a,U=e.b,H=e.c;if("Ok"===H.$){var j=H.a;return sp(A(t,{txChainStatus:_a(l(tp,K,U,j))}))}var q=H.a;return d(up,A(t,{txChainStatus:La}),qu,As,m([rs(f(wg,"appove",q))]));case"AllowanceFetched":var K=e.a,i=e.b;if("Ok"===i.$){var G=i.a,c=A(t,{allowance:_a(G)}),z=T(c.txChainStatus,c.depositAmount);if("Just"===z.a.$&&"ApproveMining"===z.a.a.$&&"Just"===z.b.$){var Y=z.a.a,U=Y.b,W=z.b.a;if(C(f(_o,G,W),ba))return sp(c);var J=f(Vh,Cs(K),U),F=J.a,V=J.b;return d(up,A(c,{txChainStatus:F}),qu,V,tr)}return sp(c)}var Q=i.a;return d(up,t,qu,As,m([rs(f(Eg,"allowance",Q))]));case"CreateSigned":var L=e.a,H=e.b;if("Ok"===H.$){var j=H.a;return sp(A(t,{txChainStatus:_a(f(ip,L,j))}))}var q=H.a;return d(up,A(t,{txChainStatus:La}),qu,As,m([rs(f(wg,"create",q))]));case"CreateMined":if("Err"===e.b.$){var L=e.a,q=e.b.a;return d(up,t,qu,As,m([rs(f(Tg,"create",q))]))}var N=e.a,X=e.b.a,Z=f(kg,pp,Zl(f(pd,N,X)));if("Just"===Z.$){var ee=Z.a;return d(up,t,qu,As,m([es(f(bg,N,ee))]))}return d(up,t,qu,As,m([rs(f(Ra,'Error getting the ID of the created offer. Check the "My Trades" page for your open offer.',X))]));case"CmdUp":var te=e.a;return d(up,t,qu,As,m([te]));default:return sp(t)}}),_g={$:"Refresh"},Lg=n(function(e,t,r){return{amountIn:e,amountOut:t,responderProfit:r}}),Pg=l(Lg,La,La,La),Dg=function(e){return f(xg,_g,{allowance:La,amountIn:La,amountInInput:"",amountOut:La,amountOutInput:"",depositAmount:La,dhToken:f(Tu,bs(Ss),$g(e)),errors:Pg,foreignCrypto:ws,initiatorRole:Ts,now:yp(0),prices:tr,receiveAddress:"",responderProfit:_a(.02),responderProfitInput:"2",showDhTokenDropdown:!1,showForeignCryptoDropdown:!1,txChainStatus:La,wallet:e})},Ug=function(e){var t=e.a;e.b,e.c;return t},Og=function(e){var t=(e.a,e.b);e.c;return t},Mg=function(e){e.a,e.b;return e.c},Fg={$:"CryptoSwap"},Vg=r(function(e,t){return t.b?l(ro,Sa,t,e):e}),Kg=r(function(e,t){return A(t,{userNotices:f(Vg,t.userNotices,m([e]))})}),Hg=r(function(e,t){return l(Wa,Kg,t,e)}),jg=Zi,qg=r(function(e,t){return{options:t,type_:e}}),Gg={$:"OfferType"},zg=n(function(e,t,r){return{checked:t,label:e,testTrade:r}}),Yg=r(function(e,t){return f(qg,Gg,m([l(zg,"Buying",e,function(e){return C(e.parameters.initiatorRole,$s)}),l(zg,"Selling",t,function(e){return C(e.parameters.initiatorRole,Ts)})]))}),Wg={$:"Closed"},Jg={$:"Committed"},Qg={$:"Judgment"},Xg={$:"Open"},Zg={$:"Phase"},ey=a(function(e,t,r,n){return f(qg,Zg,m([l(zg,"Open",e,function(e){return C(e.state.phase,Xg)}),l(zg,"Committed",t,function(e){return C(e.state.phase,Jg)}),l(zg,"Judgment",r,function(e){return C(e.state.phase,Qg)}),l(zg,"Closed",n,function(e){return C(e.state.phase,Wg)})]))}),ty={$:"Initiator"},ry={$:"Responder"},ny=r(function(e,t){return C(t,e.parameters.initiatorAddress)?_a(ty):f(kg,function(e){return C(t,e)?_a(ry):La},e.state.responder)}),ay=r(function(e,t){return f(Bu,function(t){var r=T(t,e.parameters.initiatorRole);if("Initiator"===r.a.$){if("Seller"===r.b.$){r.a,r.b;return Ts}r.a,r.b;return $s}if("Seller"===r.b.$){r.a,r.b;return $s}r.a,r.b;return Ts},f(ny,e,t))}),iy={$:"Role"},oy=n(function(e,t,r){return f(qg,iy,m([l(zg,"Buyer",t,function(t){return C(f(ay,t,e),_a($s))}),l(zg,"Seller",r,function(t){return C(f(ay,t,e),_a(Ts))})]))}),uy=function(e){return{orderBy:e}},sy=uy,cy={$:"Ascending"},fy={$:"Phase"},ly=r(function(e,t){return T({agentAddress:t,filters:jg(m([d(ey,!0,!0,!0,!1),f(Yg,!0,!0),l(oy,t,!0,!0)])),now:yp(0),prices:tr,tradeTable:sy(T(fy,cy)),wallet:e},qu)}),dy=a(function(e,t,r,n){return{chainCmd:r,cmd:t,cmdUps:n,model:e}}),hy=function(e){return d(dy,e,qu,As,tr)},py=r(function(e,t){if("UpdateWallet"===e.$){var r=e.a;return hy(A(t,{wallet:r}))}return hy(t)}),vy=function(e){return{$:"PricesFetched",a:e}},gy=function(e){return{$:"TradeTableMsg",a:e}},yy=function(e){return{data:_a(f(ol,"poke()",tr)),decoder:Zs(Gs),from:La,gas:La,gasPrice:La,nonce:La,to:_a(e),value:La}},my=r(function(e,t){return A(t,{checked:e})}),by=n(function(e,t,r){return f(ho,function(r){return e(r)?t(r):r},r)}),Cy=r(function(e,t){var r=e.a,n=e.b,a=e.c;return l(by,f(Oa,function(e){return e.type_},Za(r)),function(e){return A(e,{options:l(by,f(Oa,function(e){return e.label},Za(n)),my(a),e.options)})},t)}),Sy=a(function(e,t,r,n){return{chainCmd:r,cmd:t,cmdUps:n,model:e}}),Ey={$:"Descending"},Ty=function(e){return"Ascending"===e.$?Ey:cy},wy=function(e){return d(Sy,e,qu,As,tr)},Iy=r(function(e,t){switch(e.$){case"TradeClicked":var r=e.a,n=e.b;return d(Sy,t,qu,As,m([es(f(bg,r,n))]));case"ChangeSort":var a=e.a,i=C(t.orderBy.a,a)?f(Rg,Ty,t.orderBy):T(a,cy);return wy(A(t,{orderBy:i}));default:return wy(t)}}),Ay=r(function(e,t){switch(e.$){case"Poke":var r=e.a,n=Fh(yy(r)),a={onBroadcast:La,onMined:La,onSign:La},i=f(Is,a,n);return d(dy,t,qu,i,tr);case"TradeClicked":var o=e.a,u=e.b;return d(dy,t,qu,As,m([es(f(bg,o,u))]));case"FiltersMsg":var s=e.a;return hy(A(t,{filters:f(Cy,s,t.filters)}));case"TradeTableMsg":var c=e.a,l=f(Iy,c,t.tradeTable);return d(dy,A(t,{tradeTable:l.model}),f(Vu,gy,l.cmd),f(Qu,gy,l.chainCmd),f(ho,gs(gy),l.cmdUps));case"UpdateNow":var h=e.a;return hy(A(t,{now:h}));case"PricesFetched":var p=e.a;if("Ok"===p.$){var v=p.a,g=f(ho,Rg(Sp(t.now)),v);return hy(A(t,{prices:g}))}p.a;return d(dy,t,qu,As,m([rs(Cg)]));case"Refresh":return d(dy,t,mg(vy),As,tr);default:return hy(t)}}),By={$:"CloseAnyDropdownsOrModals"},ky=function(e){return{$:"UpdateWallet",a:e}},$y=n(function(e,t,r){return{address:t,commPubkey:r,network:e}}),Ny=function(e){return{autoabortInterval:yp(0),autorecallInterval:yp(0),autoreleaseInterval:yp(0),daiAmount:"",dhToken:e,fiatAmount:"",fiatType:"USD",paymentMethod:"",userRole:Ts}},Ry=qr,xy=function(e){var t=dd(f(Ry,".",e));if("Nothing"===t.$)return T(e,0);var r=t.a,n=iu(e)-1-r;return T(B(f(Ks,r,e),f(xs,r+1,e)),n)},_y=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 tr}}),Ly=function(e){var t=e.a,r=f(_y,Za(0),t);return Hi(r.b?t:tr)},Py=function(e){return f(Bu,f(Ju,Ly,Hi),nd(f(ho,f(Oa,Ja,f(Oa,fu,hp)),f(rd,7,Ja(e)))))},Dy=function(e){var t=yc(Ls(e));if(!t.b)return La;switch(t.a.valueOf()){case"-":if(t.b.b){var r=t.b;return f(Bu,Xi(vo),Py(r))}return La;case"+":if(t.b.b){var r=t.b;return f(Bu,Xi(go),Py(r))}return La;default:var r=t;return f(Bu,Xi(go),Py(r))}},Uy=function(e){var t=function(e){return!f(lu,2,e)};switch(e.$){case"Zer":return!0;case"Pos":default:var r=e.a.a;return t(f(Tu,0,dd(r)))}},Oy=function(e){return f(Ko,e,e)},My=To(2),Fy=n(function(e,t,r){e:for(;;)switch(r.$){case"Zer":return Wo;case"Neg":return Ji;default:if(C(r,Wo))return f(Ko,e,t);if(Uy(r)){var n=e,a=Oy(t),i=f(dl,r,My);e=n,t=a,r=i;continue e}var n=f(Ko,t,e),a=Oy(t),i=f(dl,f(jo,r,Wo),My);e=n,t=a,r=i;continue e}}),Vy=r(function(e,t){return l(Fy,Wo,e,t)}),Ky=r(function(e,t){return e<1?t:l(Rs,0,-e,t)}),Hy=function(e){if(""===e)return La;var t=xy(e),r=t.a,n=t.b,a=18-n,i=Dy(a<0?f(Ky,-a,r):r);if("Nothing"===i.$)return La;var o=i.a,u=f(Ko,o,f(Vy,To(10),To(a)));return _a(u)},jy=function(e){return f(Bu,fl,Hy(e))},qy=jr,Gy=function(e){for(;;){if(f(qy,".",e))return l(Rs,0,-1,e);{if(!f(qy,"0",e))return""===e?"0":e;e=l(Rs,0,-1,e)}}},zy=function(e){if(C(f(_o,e,To(0)),ba))return"-"+zy(Ho(e));var t=l(cu,18,I("0"),dp(e)),r=f(Ky,18,t)+"."+f(qs,18,t);return function(e){return""===e?"0":e}(Gy(r))},Yy=r(function(e,t){var r=zy(t),n=dd(f(Ry,".",r));if("Nothing"===n.$)return r;var a=n.a;return e?f(Ks,a+1+e,r):f(Ks,a,r)}),Wy=r(function(e,t){if("Nothing"===e.$)return zy(ll(t));var r=e.a;return f(Yy,r,ll(t))}),Jy=function(e){var t=Kh(f(Wy,La,e));if("Just"===t.$){return t.a}f(ka,"Error converting tokenValue to float: string -> float failed",e);return 0},Qy=function(e){if(""===e)return hi("You must specify a trade amount.");var t=jy(e);if("Nothing"===t.$)return hi("I don't understand this number.");var r=t.a;return Jy(r)<1?hi("Trade amount can't be less than 1."):pi(r)},Xy=function(e){if(""===e)return hi("You must specify a fiat price.");var t=Kh(e);if("Nothing"===t.$)return hi("I don't understand this number.");var r=t.a;return pi(r)},Zy=function(e){return Ol(e)?La:_a(e)},em=function(e){return f(od,"You must specify a fiat type.",Zy(e))},tm=function(e){return""===e?hi("Must specify a payment method."):pi(e)},rm=s(function(e,t,r,n,a,i,o,u){return{autoabortInterval:o,autorecallInterval:i,autoreleaseInterval:u,daiAmount:t,dhToken:e,fiatAmount:r,fiatType:n,paymentMethod:a}}),nm=g(rm,La,La,La,La,La,La,La,La),am=function(e){var t=e.a,r=e.b,n=e.c,a=w(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 pi(w(i,o,u))}var s=a.c.a;return hi(s)}var c=a.b.a;return hi(c)}var f=a.a.a;return hi(f)},im=a(function(e,t,r,n){var a=n.a,i=n.b,o=n.c;return w(e(a),t(i),r(o))}),om={$:"Custom"},um=r(function(e,t){return{info:t,type_:e}}),sm=r(function(e,t){return{amount:t,symbol:e}}),cm=o(function(e,t,r,n,a,i){if("Err"===t.$){var o=t.a;return hi(o)}var u=t.a;if("Err"===r.$){var o=r.a;return hi(o)}var s=r.a;if("Err"===n.$){var o=n.a;return hi(o)}var c=n.a;if("Err"===a.$){var o=a.a;return hi(o)}var f=a.a;if("Err"===i.$){var o=i.a;return hi(o)}var l=i.a;return pi(h(e,u,s,c,f,l))}),fm=function(e){return p(cm,i(function(t,r,n,a,i){var o=i.a;return{autoabortInterval:i.b,autorecallInterval:o,autoreleaseInterval:i.c,initiatorRole:e.userRole,paymentMethods:m([f(um,om,a)]),price:f(sm,n,r),tradeAmount:t}}),f(Ul,function(e){return A(nm,{daiAmount:_a(e)})},Qy(e.daiAmount)),f(Ul,function(e){return A(nm,{fiatAmount:_a(e)})},Xy(e.fiatAmount)),f(Ul,function(e){return A(nm,{fiatType:_a(e)})},em(e.fiatType)),f(Ul,function(e){return A(nm,{paymentMethod:_a(e)})},tm(e.paymentMethod)),am(d(im,function(e){return _h(e)>0?pi(e):hi(A(nm,{autorecallInterval:_a("Must specify a non-zero time for this window")}))},function(e){return _h(e)>0?pi(e):hi(A(nm,{autoabortInterval:_a("Must specify a non-zero time for this window")}))},function(e){return _h(e)>0?pi(e):hi(A(nm,{autoreleaseInterval:_a("Must specify a non-zero time for this window")}))},w(e.autorecallInterval,e.autoabortInterval,e.autoreleaseInterval))))},lm=function(e){var t=fm(e.inputs),r=function(){return C(e.errors,nm)?nm:"Ok"===t.$?nm:t.a}();return A(e,{createParameters:l(Yh,yl,Ng(e.wallet),Zl(t)),errors:r})},dm=r(function(e,t){return lm(A(t,{inputs:e}))}),hm=r(function(e,t){return{autoabortInterval:t.autoabortInterval,autorecallInterval:t.autorecallInterval,autoreleaseInterval:t.autoreleaseInterval,daiAmount:f(Wy,La,t.tradeAmount),dhToken:e,fiatAmount:Wh(t.price.amount),fiatType:t.price.symbol,paymentMethod:f(Tu,"",f(Bu,function(e){return e.info},dd(t.paymentMethods))),userRole:t.initiatorRole}}),pm=a(function(e,t,r,n){return{chainCmd:r,cmd:t,cmdUps:n,model:e}}),vm=r(function(e,t){var r=f(Tu,bs(Ss),$g(e)),n={allowance:La,createParameters:La,depositAmount:La,errors:nm,inputs:f(Tu,Ny(r),f(Bu,hm(r),t)),showDhTypeDropdown:!1,showFiatTypeDropdown:!1,txChainStatus:La,wallet:e};return d(pm,f(dm,n.inputs,n),qu,As,tr)}),gm=r(function(e,t){return{$:"AllowanceFetched",a:e,b:t}}),ym=function(e){return{chainCmd:As,cmd:qu,cmdUps:tr,model:e}},mm=r(function(e,t){if("UpdateWallet"===e.$){var r=e.a;return d(pm,f(dm,t.inputs,A(t,{wallet:r})),function(){var e=T(Ng(r),$g(r));if("Just"===e.a.$&&"Just"===e.b.$&&"Token"===e.b.a.$){var t=e.a.a,n=e.b.a.a;return d(mh,n,t.address,Ds(Cs(n)),gm(n))}return qu}(),As,tr)}return ym(A(t,{showFiatTypeDropdown:!1}))}),bm=r(function(e,t){return{$:"CreateMined",a:e,b:t}}),Cm=function(e){return{$:"CreateNeedsSig",a:e}},Sm=r(function(e,t){return{$:"CreateSigned",a:e,b:t}}),Em=r(function(e,t){var r=Fh(f(Dh,e,t)),n={onBroadcast:La,onMined:_a(T(bm(e),La)),onSign:_a(Sm(e))};return T(_a(Cm(e)),f(Is,n,r))}),Tm=n(function(e,t,r){return{$:"ApproveMining",a:e,b:t,c:r}}),wm=function(e){return{$:"ApproveNeedsSig",a:e}},Im=n(function(e,t,r){return{$:"ApproveSigned",a:e,b:t,c:r}}),Am=r(function(e,t){return{$:"Confirm",a:e,b:t}}),Bm=r(function(e,t){return{$:"CreateMining",a:e,b:t}}),km={$:"NoOp"},$m=r(function(e,t){return 1-e(1-t)}),Nm=function(e){return f(io,e,5)},Rm=$m(Nm),xm={easing:Rm,offset:12,speed:200},_m=function(e){return{$:"External",a:e}},Lm=function(e){return{$:"Internal",a:e}},Pm=function(e){return{$:"NotFound",a:e}},Dm=function(e){for(;;){e=e.a}},Um=r(function(e,t){return vh(ih(f(sh,e,t)))}),Om={$:"Http"},Mm={$:"Https"},Fm=Kr,Vm=o(function(e,t,r,n,a,i){return{fragment:i,host:t,path:n,port_:r,protocol:e,query:a}}),Km=i(function(e,t,r,n,a){if(Ol(a)||f(Fm,"@",a))return La;var i=f(Ry,":",a);if(i.b){if(i.b.b)return La;var o=i.a,u=hp(f(xs,o+1,a));if("Nothing"===u.$)return La;var s=u;return _a(p(Vm,e,f(Ks,o,a),s,t,r,n))}return _a(p(Vm,e,a,La,t,r,n))}),Hm=a(function(e,t,r,n){if(Ol(n))return La;var a=f(Ry,"/",n);if(a.b){var i=a.a;return h(Km,e,f(xs,i,n),t,r,f(Ks,i,n))}return h(Km,e,"/",t,r,n)}),jm=n(function(e,t,r){if(Ol(r))return La;var n=f(Ry,"?",r);if(n.b){var a=n.a;return d(Hm,e,_a(f(xs,a+1,r)),t,f(Ks,a,r))}return d(Hm,e,La,t,r)}),qm=r(function(e,t){if(Ol(t))return La;var r=f(Ry,"#",t);if(r.b){var n=r.a;return l(jm,e,_a(f(xs,n+1,t)),f(Ks,n,t))}return l(jm,e,La,t)}),Gm=function(e){return f(Pa,"http://",e)?f(qm,Om,f(xs,7,e)):f(Pa,"https://",e)?f(qm,Mm,f(xs,8,e)):La},zm=Wt,Ym=Gt(zt),Wm=ha,Jm=a(function(e,t,r,n){var a=E(r,n)>0?ui:ri,i=Eo(r-n),o=f(ii,1,lv(i)/e|0),u=o,s=f(ho,function(e){return t(e/u)},f($i,0,o));return e<=0||C(r,n)?tr:f(ho,function(e){return f(a,r,e*i)},s)}),Qm=r(function(e,t){var n=r(function(t,r){return fh(f(ho,Wm(0),d(Jm,e.speed,e.easing,t,r-e.offset)))});return f(oh,function(e){var t=e.a.viewport,r=e.b.element;return f(n,t.y,r.y)},l(ch,Np,Ym,zm(t)))}),Xm=r(function(e,t){switch(e.$){case"Refresh":var r=(e.a,T(Ng(t.wallet),$g(t.wallet)));if("Just"===r.a.$&&"Just"===r.b.$&&"Token"===r.b.a.$){var n=r.a.a,a=r.b.a.a,i=d(mh,a,n.address,Ds(Cs(a)),gm(a));return d(pm,t,i,As,tr)}return ym(t);case"ChangeRole":var o=e.a,u=t.inputs;return d(pm,A(t,{inputs:A(u,{userRole:o})}),qu,As,m([function(){return"Buyer"===o.$?d(ks,"create offer type changed","input","sell dai",0):d(ks,"create offer type changed","input","buy dai",0)}()]));case"DhDropdownClicked":return ym(A(t,{showDhTypeDropdown:!t.showDhTypeDropdown}));case"DhTypeChanged":var s=e.a,u=t.inputs;return ym(A(t,{inputs:A(u,{dhToken:s}),showDhTypeDropdown:!1}));case"TradeAmountChanged":var c=e.a,u=t.inputs;return ym(f(dm,A(u,{daiAmount:c}),t));case"FiatAmountChanged":var c=e.a,u=t.inputs;return ym(f(dm,A(u,{fiatAmount:c}),t));case"FiatTypeChanged":var h=e.a,u=t.inputs;return ym(f(dm,A(u,{fiatType:h}),t));case"FiatTypeLostFocus":return ym(A(t,{showFiatTypeDropdown:!1}));case"ChangePaymentMethodText":var p=e.a,u=t.inputs;return ym(f(dm,A(u,{paymentMethod:p}),t));case"AutorecallIntervalChanged":var v=e.a,u=t.inputs;return ym(f(dm,A(u,{autorecallInterval:v}),t));case"AutoabortIntervalChanged":var v=e.a,u=t.inputs;return ym(f(dm,A(u,{autoabortInterval:v}),t));case"AutoreleaseIntervalChanged":var v=e.a,u=t.inputs;return ym(f(dm,A(u,{autoreleaseInterval:v}),t));case"ShowCurrencyDropdown":var g=e.a,u=t.inputs;return d(pm,(g?dm(A(u,{fiatType:""})):Zi)(A(t,{showFiatTypeDropdown:g})),qu,As,g?m([d(ks,"currency-selector-clicked","input","",0)]):tr);case"CreateClicked":var y=e.a,n=e.b,b=fm(t.inputs);if("Ok"===b.$){var S=b.a,E=f(yl,n,S);return ym(A(t,{depositAmount:_a(ll(Cl(E))),txChainStatus:_a(f(Am,y,E))}))}var w=b.a;return d(pm,A(t,{errors:w}),f(yh,Jo(km),function(){return f(Qm,A(xm,{offset:60}),"inputError")}()),As,tr);case"AbortCreate":return d(pm,A(t,{txChainStatus:La}),qu,As,m([d(ks,"abort","abort","create",0)]));case"ConfirmCreate":var y=e.a,E=e.b,I=e.c,B=function(){if("Native"===y.$)return f(Em,y,E);var e=y.a,r=function(){var t=Fh(l(cl,Us(e),Ds(y),I)),r={onBroadcast:La,onMined:La,onSign:_a(f(Im,e,E))};return f(Is,r,t)}(),n=t.allowance;if("Just"===n.$){var a=n.a;return C(f(_o,a,I),ba)?T(_a(wm(e)),r):f(Em,y,E)}return T(_a(wm(e)),r)}(),k=B.a,$=B.b;return d(pm,A(t,{txChainStatus:k}),qu,$,tr);case"ApproveSigned":var a=e.a,E=e.b,N=e.c;if("Ok"===N.$){var R=N.a;return ym(A(t,{txChainStatus:_a(l(Tm,a,E,R))}))}var x=N.a;return d(pm,A(t,{txChainStatus:La}),qu,As,m([rs(f(wg,"appove",x))]));case"AllowanceFetched":var a=e.a,_=e.b;if("Ok"===_.$){var L=_.a,P=A(t,{allowance:_a(L)}),D=T(P.txChainStatus,P.depositAmount);if("Just"===D.a.$&&"ApproveMining"===D.a.a.$&&"Just"===D.b.$){var U=D.a.a,E=U.b,O=D.b.a;if(C(f(_o,L,O),ba))return ym(P);var M=f(Em,Cs(a),E),k=M.a,$=M.b;return d(pm,A(P,{txChainStatus:k}),qu,$,tr)}return ym(P)}var F=_.a;return d(pm,t,qu,As,m([rs(f(Eg,"allowance",F))]));case"CreateSigned":var y=e.a,N=e.b;if("Ok"===N.$){var R=N.a;return ym(A(t,{txChainStatus:_a(f(Bm,y,R))}))}var x=N.a;return d(pm,A(t,{txChainStatus:La}),qu,As,m([rs(f(wg,"create",x))]));case"CreateMined":if("Err"===e.b.$){var y=e.a,x=e.b.a;return d(pm,t,qu,As,m([rs(f(Tg,"create",x))]))}var V=e.a,K=e.b.a,H=f(kg,pp,Zl(f(pd,V,K)));if("Just"===H.$){var j=H.a;return d(pm,t,qu,As,m([es(f(bg,V,j))]))}return d(pm,t,qu,As,m([rs(f(Ra,'Error getting the ID of the created offer. Check the "My Trades" page for your open offer.',K))]));case"Web3Connect":return d(pm,t,qu,As,m([ns]));case"NoOp":return ym(t);default:var q=e.a;return d(pm,t,qu,As,m([q]))}}),Zm=r(function(e,t){if("UpdateWallet"===e.$){var r=e.a;return d(up,A(t,{wallet:r}),function(){var e=T(Ng(r),$g(r));if("Just"===e.a.$&&"Just"===e.b.$&&"Token"===e.b.a.$){var t=e.a.a,n=e.b.a.a;return d(mh,n,t.address,Ds(Cs(n)),ep(n))}return qu}(),As,tr)}return sp(A(t,{showDhTokenDropdown:!1,showForeignCryptoDropdown:!1}))}),eb=r(function(e,t){return f(Nl,function(e){return f($l,function(e){return e.checked&&e.testTrade(t)},e.options)},e)}),tb=r(function(e,t){return C(f(vp,t.derived.phaseEndTime,e),ma)}),rb=function(e){if(""===e)return pi(La);var t=jy(e);if("Nothing"===t.$)return hi("I can't interpret this number");var r=t.a;return pi(_a(r))},nb=r(function(e,t){return{maxDai:t,minDai:e}}),ab=f(nb,La,La),ib=function(e){return l(Ll,r(function(t,r){return{dai:{max:r,min:t},fiatSymbol:Zy(e.fiatType),paymentMethodTerms:e.paymentMethodTerms}}),f(Ul,function(e){return A(ab,{minDai:_a(e)})},rb(e.minDai)),f(Ul,function(e){return A(ab,{maxDai:_a(e)})},rb(e.maxDai)))},ob=r(function(e,t){var r=function(t){return f(Nl,function(e){return f(Fm,Ls(e),Ls(t))},e)};return f($l,function(e){return r(e.info)},t)}),ub=r(function(e,t){return A(t,{paymentMethod:e})}),sb=r(function(e,t){return A(t,{paymentMethodTerms:e})}),cb=r(function(e,t){return f(_o,ll(e),ll(t))}),fb=function(e){if(""===e.inputs.paymentMethod)return e;var t=e.inputs.paymentMethod,r=f(Vg,e.inputs.paymentMethodTerms,m([t]));return lb(A(e,{inputs:f(sb,r,f(ub,"",e.inputs))}))},lb=function(e){var t=fb(e),n=ib(t.inputs);if("Err"===n.$){return A(e,{errors:n.a})}var a=n.a,i=r(function(e,t){var r=a.paymentMethodTerms;if(r.b){return f(ob,r,t.terms.paymentMethods)}return!0}),o=function(e){var t=a.fiatSymbol;if("Nothing"===t.$)return!0;var r=t.a;return C(e.terms.price.symbol,r)},u=function(e){return function(){var t=a.dai.min;if("Nothing"===t.$)return!0;var r=t.a;return!C(f(cb,e.parameters.tradeAmount,r),ba)}()&&function(){var t=a.dai.max;if("Nothing"===t.$)return!0;var r=t.a;return!C(f(cb,e.parameters.tradeAmount,r),ma)}()},s=r(function(e,r){return f(tb,e,r)&&f(i,e,r)&&u(r)&&o(r)&&f(eb,t.filters,r)});return A(t,{filterFunc:s})},db={fiatType:"",maxDai:"",minDai:"",paymentMethod:"",paymentMethodTerms:tr},hb=function(e){return{$:"PricesFetched",a:e}},pb={$:"Expires"},vb=function(e){return T(lb({errors:ab,filterFunc:tb,filters:jg(m([f(Yg,!0,!0),d(ey,!0,!1,!1,!1)])),inputs:db,now:yp(0),prices:tr,showCurrencyDropdown:!1,tradeTable:sy(T(pb,cy)),wallet:e}),mg(hb))},gb=r(function(e,t){var r=f(Eu,Su(e),t.inputs.paymentMethodTerms);return lb(A(t,{inputs:f(sb,r,t.inputs)}))}),yb=function(e){return lb(A(e,{filterFunc:tb,inputs:db}))},mb=function(e){return{$:"TradeTableMsg",a:e}},bb=a(function(e,t,r,n){return{chainCmd:r,cmd:t,cmdUps:n,model:e}}),Cb=function(e){return d(bb,e,qu,As,tr)},Sb=r(function(e,t){return A(t,{fiatType:e})}),Eb=r(function(e,t){return A(t,{maxDai:e})}),Tb=r(function(e,t){return A(t,{minDai:e})}),wb=r(function(e,t){switch(e.$){case"UpdateNow":var r=e.a;return Cb(A(t,{now:r}));case"Refresh":return d(bb,t,mg(hb),As,tr);case"PricesFetched":var n=e.a;if("Ok"===n.$){var a=n.a,i=f(ho,Rg(Sp(t.now)),a);return Cb(A(t,{prices:i}))}n.a;return d(bb,t,qu,As,m([rs(Cg)]));case"MinDaiChanged":var o=e.a;return Cb(A(t,{inputs:f(Tb,o,t.inputs)}));case"MaxDaiChanged":var o=e.a;return Cb(A(t,{inputs:f(Eb,o,t.inputs)}));case"FiatTypeInputChanged":var o=e.a;return Cb(A(t,{inputs:f(Sb,o,t.inputs)}));case"ShowCurrencyDropdown":var u=e.a;t.inputs;return Cb(A(t,{inputs:(u?Sb(""):Zi)(t.inputs),showCurrencyDropdown:u}));case"FiatTypeLostFocus":return Cb(A(t,{showCurrencyDropdown:!1}));case"PaymentMethodInputChanged":var o=e.a;return Cb(A(t,{inputs:f(ub,o,t.inputs)}));case"AddSearchTerm":return Cb(fb(t));case"RemoveTerm":var s=e.a;return Cb(f(gb,s,t));case"ApplyInputs":return d(bb,lb(t),qu,As,tr);case"ResetSearch":return Cb(yb(t));case"FiltersMsg":var c=e.a;return Cb(lb(A(t,{filters:f(Cy,c,t.filters)})));case"TradeTableMsg":var l=e.a,h=f(Iy,l,t.tradeTable);return d(bb,A(t,{tradeTable:h.model}),f(Vu,mb,h.cmd),f(Qu,mb,h.chainCmd),f(ho,gs(mb),h.cmdUps));case"NoOp":return Cb(t);default:var p=e.a;return d(bb,t,qu,As,m([p]))}}),Ib=function(e){return{$:"ShowCurrencyDropdown",a:e}},Ab=r(function(e,t){if("UpdateWallet"===e.$){var r=e.a;return Cb(A(t,{wallet:r}))}return f(wb,Ib(!1),t)}),Bb=a(function(e,t,r,n){return e(Iu(m([T("title",Vi(t)),T("body",function(){if("Nothing"===r.$)return wu;var e=r.a;return Vi(e)}()),T("image",function(){if("Nothing"===n.$)return wu;var e=n.a;return Vi(e)}())])))}),kb=function(e){if("Token"===e.$){if("EthDai"===e.a.$){e.a;return"dai"}e.a;return"kdai"}switch(e.a.$){case"Eth":e.a;return"eth";case"Kovan":e.a;return"keth";default:e.a;return"xdai"}},$b=function(e){return e.a+"="+e.b},Nb=function(e){return e.b?"?"+f(_i,"&",f(ho,$b,e)):""},Rb=r(function(e,t){return"/"+(f(_i,"/",e)+Nb(t))}),xb=function(e){switch(e.$){case"CryptoSwap":return f(Rb,m(["DAIHard","cryptoswap"]),tr);case"Create":return f(Rb,m(["DAIHard","create"]),tr);case"Trade":var t=e.a,r=e.b;return f(Rb,m(["DAIHard","trade",kb(t),xi(r)]),tr);case"Marketplace":return f(Rb,m(["DAIHard","marketplace"]),tr);case"AgentHistory":var n=e.a;return f(Rb,m(["DAIHard","history",Ua(n)]),tr);default:return f(Rb,tr,tr)}},_b={$:"NotFound"},Lb=function(e){return{$:"AgentHistory",a:e}},Pb=function(e){return{$:"Create",a:e}},Db={$:"Marketplace"},Ub=function(e){return{$:"Parser",a:e}},Ob=i(function(e,t,r,n,a){return{frag:n,params:r,unvisited:t,value:a,visited:e}}),Mb=r(function(e,t){return Ub(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 m([h(Ob,f(Sa,u,r),s,a,i,o(l))])}return tr}return tr})}),Fb=f(Mb,"ADDRESS",f(Oa,Gl,Zl)),Vb={$:"Eth"},Kb={$:"Kovan"},Hb=f(Mb,"FACTORY",function(e){switch(e){case"eth":return _a(bs(Vb));case"keth":return _a(bs(Kb));case"dai":return _a(Cs(ms));case"kdai":return _a(Cs(Ig));case"xdai":return _a(bs(Ss));default:return La}}),jb=f(Mb,"NUMBER",hp),qb=r(function(e,t){var r=t.visited,n=t.unvisited,a=t.params,i=t.frag,o=t.value;return h(Ob,r,n,a,i,e(o))}),Gb=r(function(e,t){var r=t.a;return Ub(function(t){var n=t.visited,a=t.unvisited,i=t.params,o=t.frag,u=t.value;return f(ho,qb(u),r(h(Ob,n,a,i,o,e)))})}),zb=function(e){return l(ro,Vg,tr,e)},Yb=r(function(e,t){return zb(f(ho,e,t))}),Wb=function(e){return Ub(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 C(u,e)?m([h(Ob,f(Sa,u,r),s,a,i,o)]):tr}return tr})},Jb=r(function(e,t){var r=e.a,n=t.a;return Ub(function(e){return f(Yb,n,r(e))})}),Qb=Ub(function(e){return m([e])}),Xb=f(Jb,Wb("DAIHard"),function(e){return Ub(function(t){return f(Yb,function(e){return(0,e.a)(t)},e)})}(m([f(Gb,Fg,Qb),f(Gb,Fg,Wb("cryptoswap")),f(Gb,Pb(La),Wb("create")),f(Gb,bg,f(Jb,Wb("trade"),f(Jb,Hb,jb))),f(Gb,Db,Wb("marketplace")),f(Gb,Lb,f(Jb,Wb("history"),Fb)),f(Gb,function(e){return Lb(e)},f(Jb,Wb("history"),Fb))]))),Zb=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 _a(t.value)}return _a(t.value)}return La}},eC=function(e){if(e.b){if(""!==e.a||e.b.b){var t=e.a,r=e.b;return f(Sa,t,eC(r))}return tr}return tr},tC=function(e){var t=f(Pi,"/",e);if(t.b&&""===t.a){var r=t.b;return eC(r)}var r=t;return eC(r)},rC=Qt,nC=r(function(e,t){if("Nothing"===t.$)return _a(m([e]));var r=t.a;return _a(f(Sa,e,r))}),aC=r(function(e,t){var r=f(Pi,"=",e);if(r.b&&r.b.b&&!r.b.b.b){var n=r.a,a=r.b,i=a.a,o=rC(n);if("Nothing"===o.$)return t;var u=o.a,s=rC(i);if("Nothing"===s.$)return t;var c=s.a;return l(Ud,u,nC(c),t)}return t}),iC=function(e){if("Nothing"===e.$)return Bd;var t=e.a;return l(ro,aC,Bd,f(Pi,"&",t))},oC=r(function(e,t){var r=e.a;return Zb(r(h(Ob,tr,tC(t.path),iC(t.query),t.fragment,Zi)))}),uC=function(e){return f(Tu,_b,f(oC,Xb,e))},sC=qe("connectToWeb3",function(e){return wu}),cC=function(e){return Iu(m([T("event",Vi(e.event)),T("category",Vi(e.category)),T("label",Vi(e.label)),T("value",Nu(e.value))]))},fC=r(function(e,t){return Iu(m([T("address",Vi(Ua(e))),T("signSeedMsg",Vi(t))]))}),lC=qe("gTagOut",Zi),dC=qe("genPrivkey",Zi),hC=r(function(e,t){for(;;){if(!t.b)return La;var r=t.a,n=t.b;if(e(r))return _a(r);var a=e,i=n;e=a,t=i}}),pC=n(function(e,t,r){return f(kg,gf(t),f(Bu,function(e){return e.trades},f(hC,function(t){return C(t.factory,e)},r)))}),vC=qe("notifyPort",Zi),gC=qe("requestNotifyPermissionPort",function(e){return wu}),yC=u(function(e,t,r,n,a,i,o){return{creationInfo:r,factory:e,id:t,parameters:n,phaseStartInfo:o,state:a,terms:i}}),mC=function(e){return{$:"PartiallyLoadedTrade",a:e}},bC=r(function(e,t){return mC(v(yC,e,t,La,La,La,La,La))}),CC=function(e){return{$:"CurrentBlockFetched",a:e}},SC=Xs(f(Oa,_s,Fl)),EC=function(e){return th({decoder:SC,method:"eth_blockNumber",params:tr,url:e})},TC=function(e){return f(yh,CC,EC(e))},wC=r(function(e,t){return{address_:e,blocknum:t}}),IC=function(e){return Os(function(t){return pi(T(t,e))})},AC=n(function(e,t,r){var n=t.a,a=r.a;return Os(function(t){return f(hd,function(t){var r=t.a,n=t.b;return f(js,Rg(e(n)),a(r))},n(t))})}),BC=r(function(e,t){return l(AC,r(function(e,t){return e(t)}),t,e)}),kC=Zs(f(BC,ud,f(BC,zl,IC(wC)))),$C=r(function(e,t){return{data:_a(f(ol,"createdTrades(uint256)",m([sl(t)]))),decoder:kC,from:La,gas:La,gasPrice:La,nonce:La,to:_a(e),value:La}}),NC=n(function(e,t,r){return f(yh,r,f(ah,gd(e),f($C,Ds(e),t)))}),RC=function(e){return{$:"CreationInfoFetched",a:e}},xC=r(function(e,t){return l(NC,e,To(t),RC)}),_C=function(e){return{$:"EventSentryMsg",a:e}},LC=function(e){return{$:"BlockNumber",a:e}},PC=function(e){return{$:"EventSentry",a:e}},DC=function(e){return{$:"Set_elm_builtin",a:e}},UC=DC(Bd),OC=r(function(e,t){return T(PC({blockNumber:La,errors:tr,nodePath:t,pending:UC,ref:1,requests:Bd,tagger:e,watching:UC}),f(yh,f(Oa,LC,e),EC(t)))}),MC=function(e){return f(OC,_C,gd(e))},FC=r(function(e,t){return{initiatorPubkey:e,responderPubkey:t}}),VC=function(e){return{$:"PartiallyLoadedCommInfo",a:e}},KC=VC(f(FC,La,La)),HC=n(function(e,t,r){return{allowance:La,blocknumOnInit:La,chatHistoryModel:La,eventSentry:t,eventsWaitingForChatHistory:tr,expandedPhase:Xg,secureCommInfo:KC,showChatHistory:!1,showStatsModal:!1,trade:e,txChainStatus:La,wallet:r}}),jC=a(function(e,t,r,n){return{chainCmd:r,cmd:t,cmdUps:n,model:e}}),qC=n(function(e,t,r){var n=f(xC,t,r),a=MC(t),i=a.a,o=a.b;return d(jC,l(HC,f(bC,t,r),i,e),ju(m([n,o,TC(gd(t))])),As,m([ts]))}),GC=function(e){return{$:"LoadedTrade",a:e}},zC=function(e){return{$:"EventLogFetched",a:e}},YC=r(function(e,t){return{$:"GetLogs",a:e,b:t}}),WC=oe,JC=ce,QC=Wr,XC=n(function(e,t,r){var n=function(e){return JC(m([e,WC(r)]))};return f(Ws,function(a){var i=f(cd,e,a);if("Ok"===i.$){var o=i.a,u=f(cd,n(t),o);if("Ok"===u.$){var s=u.a;return us(s)}var c=u.a;return Js(Mi(c))}return us(r)},QC)}),ZC=a(function(e,t,r,n){return f(Sl,l(XC,f(Wl,e,QC),t,r),n)}),eS=n(function(e,t,r){return f(Sl,f(Wl,e,t),r)}),tS=Xs(Gl),rS=wl(f(Tu,Bl,Al("^((0[Xx]){1})?[0-9a-fA-F]{64}$"))),nS=function(e){return{$:"BlockHash",a:e}},aS=function(e){return rS(e)?pi(nS(_s(e))):hi("Given blockHash "+ql(e)+" is not valid.")},iS=Xs(aS),oS=wl(f(Tu,Bl,Al("^((0[Xx]){1})?[0-9a-fA-F]+$"))),uS=function(e){return oS(e)?pi(Sc(_s(e))):hi("Something in here is not very hexy: "+ql(e))},sS=Xs(uS),cS=function(e){return{$:"TxHash",a:e}},fS=function(e){return rS(e)?pi(cS(_s(e))):hi("Given txHash "+ql(e)+" is not valid.")},lS=Xs(fS),dS=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}}),hS=zr,pS=ie,vS=l(eS,"blockNumber",SC,l(eS,"blockHash",iS,l(eS,"transactionHash",lS,l(eS,"transactionIndex",SC,l(eS,"logIndex",SC,d(ZC,"removed",hS,!1,l(eS,"topics",pS(sS),l(eS,"data",Qs,l(eS,"address",tS,us(dS)))))))))),gS=function(e){return f(fd,function(e){if("Just"===e.$){var t=e.a;return Vi(mu(t))}return wu},e)},yS=function(e){return Iu(m([T("fromBlock",yd(e.fromBlock)),T("toBlock",yd(e.toBlock)),T("address",Ki(e.address)),T("topics",gS(e.topics))]))},mS=r(function(e,t){return th({decoder:pS(vS),method:"eth_getLogs",params:m([yS(t)]),url:e})}),bS=function(e){return{$:"BlockNum",a:e}},CS=n(function(e,t,r){var n=r.a,a=r.b;return"BlockNum"===t.toBlock.$?f(oh,function(r){return f(sh,xa(r),f(mS,e,A(t,{fromBlock:bS(n),toBlock:bS(a)})))},f(mS,e,t)):f(mS,e,t)}),SS=r(function(e,t){var r=t.a;return DC(l(Fu,e,cr,r))}),ES=a(function(e,t,r,n){var a=r.a,i={logCount:0,logFilter:n,ref:a.ref,tagger:t,watchOnce:e},o=A(a,{ref:a.ref+1,requests:l(Fu,a.ref,i,a.requests)}),u=a.blockNumber;if("Just"===u.$){var s=u.a;return function(e){return w(PC(A(o,{watching:f(SS,a.ref,o.watching)})),f(yh,f(Oa,YC(a.ref),a.tagger),e),a.ref)}(l(CS,a.nodePath,n,T(s,s)))}return w(PC(A(o,{pending:f(SS,a.ref,o.pending)})),qu,a.ref)}),TS=ES(!1),wS=r(function(e,t){var r=function(){var e=MC(t.factory),r=e.a,n=e.b;return function(e){var t=e.a,r=e.b,a=e.c;return w(t,ju(m([n,r])),a)}(l(TS,zC,r,{address:t.creationInfo.address,fromBlock:bS(t.creationInfo.blocknum),toBlock:nh,topics:tr}))}(),n=r.a,a=r.b;return d(jC,l(HC,GC(t),n,e),ju(m([a,TC(gd(t.factory))])),As,m([ts]))}),IS=function(e){return{$:"AllowanceFetched",a:e}},AS=function(e){return d(jC,e,qu,As,tr)},BS=r(function(e,t){if("UpdateWallet"===e.$){var r=e.a;return d(jC,A(t,{wallet:r}),function(){var e=w(Ng(r),$g(r),t.trade);if("Just"===e.a.$&&"Just"===e.b.$&&"Token"===e.b.a.$&&"LoadedTrade"===e.c.$){var n=e.a.a,a=e.b.a.a,i=e.c.a;return C($g(r),_a(i.factory))?d(mh,a,n.address,i.creationInfo.address,IS):qu}return qu}(),As,tr)}return AS(A(t,{showChatHistory:!1,showStatsModal:!1}))}),kS=function(e){return{data:_a(f(ol,"abort()",tr)),decoder:us(cr),from:La,gas:La,gasPrice:La,nonce:La,to:_a(e),value:La}},$S=function(e){return{data:_a(f(ol,"burn()",tr)),decoder:us(cr),from:La,gas:La,gasPrice:La,nonce:La,to:_a(e),value:La}},NS=function(e){return{data:_a(f(ol,"claim()",tr)),decoder:us(cr),from:La,gas:La,gasPrice:La,nonce:La,to:_a(e),value:La}},RS=r(function(e,t){return{data:_a(f(ol,"initiatorStatement(string)",m([Th(t)]))),decoder:us(cr),from:La,gas:La,gasPrice:La,nonce:La,to:_a(e),value:La}}),xS=function(e){return{data:_a(f(ol,"recall()",tr)),decoder:us(cr),from:La,gas:La,gasPrice:La,nonce:La,to:_a(e),value:La}},_S=function(e){return{data:_a(f(ol,"release()",tr)),decoder:us(cr),from:La,gas:La,gasPrice:La,nonce:La,to:_a(e),value:La}},LS=r(function(e,t){return{data:_a(f(ol,"responderStatement(string)",m([Th(t)]))),decoder:us(cr),from:La,gas:La,gasPrice:La,nonce:La,to:_a(e),value:La}}),PS={$:"Invalid"},DS={$:"Bank"},US={$:"Cash"},OS=function(e){switch(e){case"cash":return _a(US);case"bank":return _a(DS);case"custom":return _a(om);default:return La}},MS=f(Ws,function(e){var t=OS(e);if("Just"===t.$){var r=t.a;return us(r)}return Js("")},Qs),FS=l(os,um,f(Wl,"type",MS),f(Wl,"info",Qs)),VS=f(Ws,function(e){var t=Dy(e);if("Just"===t.$){var r=t.a;return us(r)}return Js("Can't convert that to a BigInt")},Qs),KS=JC(m([l(os,sm,f(Ql,0,Qs),f(Ws,function(e){var t=Kh(e);if("Just"===t.$){var r=t.a;return us(r)}return Js("Error converting BigInt to float")},f(is,dp,f(Ql,1,VS)))),l(os,sm,f(Ql,0,Qs),f(Ql,1,Rp))])),HS=function(e){var t=l(os,Ah,f(Wl,"price",KS),f(Wl,"paymentmethods",pS(FS)));return f(wd,t,e)},jS=r(function(e,t){return{commPubkey:t,responder:e}}),qS=r(function(e,t){var n=r(function(t,r){return l(Rs,t,t+2*r,e)}),a=f(Oa,Fl,js(oi(2)));return f(hd,function(t){return f(js,function(e){return f(n,t+64,e)},Fl(l(Rs,t,t+64,e)))},a(t))}),GS=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?w(0,0,f(e,o(t),i)):w(o(t),a-1,i):128&t?192==(224&t)?w(31&t,1,i):224==(240&t)?w(15&t,2,i):w(7&t,3,i):w(0,0,f(e,t,i))}),zS=n(function(e,t,r){var n=l(Wa,GS(e),w(0,0,t),r);if(n.b)return hi("invalid UTF-8 sequence");var a=n.c;return pi(a)}),YS=Z,WS=function(e){return au(YS(e))},JS=function(e){return l(zS,r(function(e,t){return B(t,WS(e))}),"",e)},QS=Os(function(e){var t=e.a,r=e.b;return f(js,f(Vs,t,r),f(hd,JS,f(hd,f(Oa,ho(Fl),Pl),f(js,Eu(f(Oa,Ol,Po)),f(js,bc(2),f(qS,t,Hs(r)))))))}),XS=f(Sl,f(Jl,1,QS),f(Sl,f(Jl,0,zl),us(jS))),ZS=r(function(e,t){return{commPubkey:t,terms:e}}),eE=f(Sl,f(Jl,1,QS),f(Sl,f(Jl,0,QS),us(ZS))),tE=function(e){return{statement:e}},rE=f(Sl,f(Jl,0,QS),us(tE)),nE=function(e){return{statement:e}},aE=f(Sl,f(Jl,0,QS),us(nE)),iE={$:"AbortedEvent"},oE={$:"BurnedEvent"},uE={$:"ClaimedEvent"},sE=function(e){return{$:"CommittedEvent",a:e}},cE=function(e){return{$:"InitiatedEvent",a:e}},fE=function(e){return{$:"InitiatorStatementLogEvent",a:e}},lE={$:"PokeEvent"},dE={$:"RecalledEvent"},hE={$:"ReleasedEvent"},pE=function(e){return{$:"ResponderStatementLogEvent",a:e}},vE=f(Wl,"topics",f(Ql,0,sS)),gE=function(e){return Sc(f(_i,"",f(ho,f(Oa,pu,Ic),al(f(ho,Ci,yc(e))))))},yE=f(Ws,function(e){return C(e,gE("Initiated(string,string)"))?f(is,cE,eE):C(e,gE("Committed(address,string)"))?f(is,sE,XS):C(e,gE("Recalled()"))?us(dE):C(e,gE("Claimed()"))?us(uE):C(e,gE("Aborted()"))?us(iE):C(e,gE("Released()"))?us(hE):C(e,gE("Burned()"))?us(oE):C(e,gE("InitiatorStatementLog(string)"))?f(is,fE,rE):C(e,gE("ResponderStatementLog(string)"))?f(is,pE,aE):C(e,gE("Poke()"))?us(lE):Js("Unrecognized topic hash")},vE),mE=function(e){return"Buyer"===e.initiatorRole.$?e.tradeAmount:e.buyerDeposit},bE=function(e){switch(e.$){case"Invalid":return La;case"PartiallyLoadedTrade":var t=e.a;return _a(t.factory);default:var r=e.a;return _a(r.factory)}},CE=function(e){return C(e.buyerDeposit,vl(e.tradeAmount))&&C(e.abortPunishment,pl(e.tradeAmount))},SE=s(function(e,t,r,n,a,i,o,u){return{creationInfo:r,derived:u,factory:e,id:t,parameters:n,phaseStartInfo:o,state:a,terms:i}}),EE=r(function(e,t){return yp(_h(t)+_h(e))}),TE=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 yp(0)}}();return{phaseEndTime:function(){return"Closed"===t.phase.$?yp(f(io,2,53)-1):f(EE,t.phaseStartTime,n)}()}}),wE=function(e){var t=w(T(e.creationInfo,e.parameters),T(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 GC(g(SE,e.factory,e.id,n,a,o,u,s,l(TE,a,o,u)))}return mC(e)},IE=r(function(e,t){switch(t.$){case"PartiallyLoadedTrade":var r=t.a;return wE(A(r,{creationInfo:_a(e)}));case"LoadedTrade":f(ka,"Trying to update creation info on a trade that's already fully loaded!","");return t;default:return PS}}),AE=r(function(e,t){switch(t.$){case"PartiallyLoadedTrade":var r=t.a;return wE(A(r,{parameters:_a(e)}));case"LoadedTrade":t.a,f(ka,"Trying to update parameters on a trade that's already fully loaded!","");return t;default:return PS}}),BE=r(function(e,t){switch(t.$){case"PartiallyLoadedTrade":var r=t.a;return wE(A(r,{phaseStartInfo:_a(e)}));case"LoadedTrade":t.a,f(ka,"Trying to update phaseStartInfo on a trade that's already fully loaded!","");return t;default:return PS}}),kE=r(function(e,t){switch(t.$){case"PartiallyLoadedTrade":var r=t.a;return wE(A(r,{state:_a(e)}));case"LoadedTrade":var n=t.a;return GC(A(n,{state:e}));default:return PS}}),$E=r(function(e,t){switch(t.$){case"PartiallyLoadedTrade":var r=t.a;return wE(A(r,{terms:_a(e)}));case"LoadedTrade":t.a,f(ka,"Trying to update terms on a trade that's already fully loaded!","");return t;default:return PS}}),NE=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}}),RE=Zs(f(BC,ud,f(BC,ud,f(BC,ud,f(BC,ud,f(BC,ud,f(BC,ud,f(BC,ud,f(BC,Gs,f(BC,zl,IC(NE))))))))))),xE=function(e){return{data:_a(f(ol,"getParameters()",tr)),decoder:RE,from:La,gas:La,gasPrice:La,nonce:La,to:_a(e),value:La}},_E=function(e){return f(Bu,function(e){return yp(1e3*e)},hp(dp(e)))},LE=function(e){return fl(e)},PE=a(function(e,t,r,n){if("Err"===t.$){var a=t.a;return hi(a)}var i=t.a;if("Err"===r.$){var a=r.a;return hi(a)}var o=r.a;if("Err"===n.$){var a=n.a;return hi(a)}var u=n.a;return pi(l(e,i,o,u))}),DE=function(e){var t=f(od,"error converting BigInt to Time.Posix",_E(e.autoabortInterval)),r=f(od,"error converting BigInt to Time.Posix",_E(e.autoreleaseInterval)),a=f(od,"error converting BigInt to Time.Posix",_E(e.autorecallInterval));return d(PE,n(function(t,r,n){return{abortPunishment:LE(e.abortPunishment),autoabortInterval:r,autorecallInterval:t,autoreleaseInterval:n,buyerDeposit:LE(e.beneficiaryDeposit),initiatorAddress:e.initiator,initiatorRole:e.initiatedByCustodian?Ts:$s,pokeReward:LE(e.pokeReward),tradeAmount:LE(e.tradeAmount)}}),a,t,r)},UE=n(function(e,t,r){return f(yh,r,f(sh,DE,f(ah,gd(e),xE(t))))}),OE=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}}}}}}}}}}},ME=Zs(f(BC,ud,f(BC,ud,f(BC,ud,f(BC,ud,f(BC,ud,f(BC,ud,f(BC,ud,f(BC,ud,f(BC,ud,f(BC,ud,IC(OE)))))))))))),FE=function(e){return{data:_a(f(ol,"getPhaseStartInfo()",tr)),decoder:ME,from:La,gas:La,gasPrice:La,nonce:La,to:_a(e),value:La}},VE=i(function(e,t,r,n,a){if("Nothing"===t.$)return La;var i=t.a;if("Nothing"===r.$)return La;var o=r.a;if("Nothing"===n.$)return La;var u=n.a;if("Nothing"===a.$)return La;var s=a.a;return _a(d(e,i,o,u,s))}),KE=function(e){return h(VE,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}}),_E(e.v6),_E(e.v7),_E(e.v8),_E(e.v9))},HE=n(function(e,t,r){return f(yh,r,f(sh,KE,f(ah,gd(e),FE(t))))}),jE=i(function(e,t,r,n,a){return{balance:e,closedReason:a,phase:t,phaseStartTimestamp:r,responder:n}}),qE=Zs(f(BC,ud,f(BC,zl,f(BC,ud,f(BC,ud,f(BC,ud,IC(jE))))))),GE=function(e){return{data:_a(f(ol,"getState()",tr)),decoder:qE,from:La,gas:La,gasPrice:La,nonce:La,to:_a(e),value:La}},zE={$:"Aborted"},YE={$:"Burned"},WE={$:"NotClosed"},JE={$:"Recalled"},QE={$:"Released"},XE=function(e){switch(f(Tu,99,hp(dp(e)))){case 0:return _a(WE);case 1:return _a(JE);case 2:return _a(zE);case 3:return _a(QE);case 4:return _a(YE);default:return La}},ZE=function(e){switch(f(Tu,99,hp(dp(e)))){case 1:return _a(Xg);case 2:return _a(Jg);case 3:return _a(Qg);case 4:return _a(Wg);default:return La}},eT=function(e){return C(e,Ps("0x0000000000000000000000000000000000000000"))?La:_a(e)},tT=a(function(e,t,r,n){if("Nothing"===t.$)return La;var a=t.a;if("Nothing"===r.$)return La;var i=r.a;if("Nothing"===n.$)return La;var o=n.a;return _a(l(e,a,i,o))}),rT=function(e){var t=_E(e.phaseStartTimestamp),r=ZE(e.phase),a=XE(e.closedReason);return d(tT,n(function(t,r,n){return{balance:LE(e.balance),closedReason:n,phase:t,phaseStartTime:r,responder:eT(e.responder)}}),r,t,a)},nT=n(function(e,t,r){return f(yh,r,f(sh,rT,f(ah,gd(e),GE(t))))}),aT=i(function(e,t,r,n,a){return ju(m([l(UE,e,t,r),l(nT,e,t,n),l(HE,e,t,a)]))}),iT=function(e){var t=pp(e);if("Just"===t.$){return t.a}f(ka,"Warning! BigInt to Int conversion failed!",dp(e));return 0},oT=a(function(e,t,r,n){return{encapsulatedKey:e,iv:t,message:n,tag:r}}),uT=n(function(e,t,r){for(;;){var n=f(Ya,32,e),a=n.a,i=n.b;if(E(si(a),32)<0)return f(ci,!0,{nodeList:t,nodeListSize:r,tail:a});var o=i,u=f(Sa,Ga(a),t),s=r+1;e=o,t=u,r=s}}),sT=function(e){return e.b?l(uT,e,tr,0):qa},cT=rn,fT=function(e){var t=h(cT,oT,f(Wl,"encapsulation",Qs),f(Wl,"iv",Qs),f(Wl,"tag",Qs),f(Wl,"encrypted",Qs)),r=pS(t),n=f(cd,r,e);if("Err"===n.$){var a=n.a;return hi(Mi(a))}var i=n.a;return function(e){var t=T(f(gf,0,e),f(gf,1,e));if("Just"===t.a.$&&"Just"===t.b.$){var r=t.a.a,n=t.b.a;return pi(T(r,n))}return hi("Decoded list has less than 2 items.")}(sT(i))},lT=function(e){var t=function(e){var t=iu(e);return t>1114111?hi("string is too long"):pi(f(nu,YS(t),e))};return f(js,_i(""),Pl(f(ho,t,e)))},dT=function(e){var t=e.a,r=e.b;return lT(m([t.encapsulatedKey,t.iv,t.tag,t.message,r.encapsulatedKey,r.iv,r.tag,r.message]))},hT=r(function(e,t){return Iu(m([T("message",Vi(e)),T("pubkeyHexStrings",f(fd,Vi,m([t.initiatorPubkey,t.responderPubkey])))]))}),pT=function(e){return{$:"LoadedCommInfo",a:e}},vT=r(function(e,t){return{initiatorPubkey:e,responderPubkey:t}}),gT=function(e){var t=T(e.initiatorPubkey,e.responderPubkey);if("Just"===t.a.$&&"Just"===t.b.$){var r=t.a.a,n=t.b.a;return pT(f(vT,r,n))}return VC(e)},yT=r(function(e,t){if("PartiallyLoadedCommInfo"===t.$){var r=t.a;return gT(A(r,{initiatorPubkey:_a(e)}))}var n=t.a;return pT(A(n,{initiatorPubkey:e}))}),mT=r(function(e,t){if("PartiallyLoadedCommInfo"===t.$){var r=t.a;return gT(A(r,{responderPubkey:_a(e)}))}var n=t.a;return pT(A(n,{responderPubkey:e}))}),bT=r(function(e,t){var r=T(t,e);if("Initiator"===r.a.$){if("Buyer"===r.b.$){r.a,r.b;return $s}r.a,r.b;return Ts}if("Buyer"===r.b.$){r.a,r.b;return Ts}r.a,r.b;return $s}),CT=r(function(e,t){for(;;){if(!e.b)return t;var r=e.a,n=e.b,a=Ci(r),i=f(ed,a,n),o=fu(f($c,a,n)),u=B(t,m([o])),s=i,c=u;e=s,t=c}}),ST=function(e){var t=sT(f(CT,yc(e),tr));return l(Yh,Np,h(VE,oT,f(gf,0,t),f(gf,1,t),f(gf,2,t),f(gf,3,t)),h(VE,oT,f(gf,4,t),f(gf,5,t),f(gf,6,t),f(gf,7,t)))},ET=r(function(e,t){if("Statement"===t.$){t.a;return l(Xu,"New Message from Trade",La,La)}var r=t.a,n=function(){switch(r.$){case"Initiated":return"Trade Opened.";case"Committed":return e?"Someone has committed to the Trade!":"You are now committed to the Trade!";case"Recalled":return"Trade recalled.";case"Claimed":return"Payment has been confirmed by the Buyer.";case"Aborted":return"Trade aborted by Buyer.";case"Released":return"Trade released by Seller.";default:return"Trade burned by Seller."}}();return l(Xu,n,La,La)}),TT={$:"Aborted"},wT={$:"Burned"},IT={$:"Claimed"},AT=function(e){return{$:"Committed",a:e}},BT=function(e){return{$:"Encrypted",a:e}},kT={$:"FailedDecode"},$T={$:"Initiated"},NT={$:"Recalled"},RT={$:"Released"},xT=function(e){return{$:"StateChange",a:e}},_T=function(e){return{$:"Statement",a:e}},LT=Cr,PT=br,DT=r(function(e,t){var r=si(e),n=32-si(t.tail)-r,a=l(LT,32,t.tail,e);return n<0?{nodeList:f(Sa,Ga(a),t.nodeList),nodeListSize:t.nodeListSize+1,tail:l(PT,n,r,e)}:n?{nodeList:t.nodeList,nodeListSize:t.nodeListSize,tail:a}:{nodeList:f(Sa,Ga(a),t.nodeList),nodeListSize:t.nodeListSize+1,tail:ja}}),UT=gr,OT=k,MT=a(function(e,t,r,n){var a=df&t>>>e;if(E(a,si(n))>-1){if(5===e)return f(UT,Ga(r),n);var i=za(d(MT,e-Ha,t,r,ja));return f(UT,i,n)}var o=f(hf,a,n);if("SubTree"===o.$){var u=o.a,i=za(d(MT,e-Ha,t,r,u));return l(bf,a,i,n)}var i=za(d(MT,e-Ha,t,r,OT(o)));return l(bf,a,i,n)}),FT=r(function(e,t){var r=t.a,n=t.b,a=t.c,i=t.d,o=si(i),u=si(e),s=r+(u-o);if(C(u,32)){if(E(s>>>Ha,1<0){var c=n+Ha,f=d(MT,c,r,e,OT(za(a)));return d(Ma,s,c,f,ja)}return d(Ma,s,n,d(MT,n,r,e,a),ja)}return d(Ma,s,n,a,e)}),VT=r(function(e,t){var r=(t.a,t.c,t.d),n=si(e),a=32-si(r)-n,i=l(LT,32,r,e),o=f(FT,i,t);if(a<0){var u=l(PT,a,n,e);return f(FT,u,o)}return o}),KT=yr,HT=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(KT,i,t,r)}return f(Sa,e,t)});return{nodeList:l(KT,i,tr,n),nodeListSize:t/32|0,tail:a}},jT=r(function(e,t){var n=(e.d,t.a),a=t.c,i=t.d;if(E(n,128)<1){var o=r(function(e,t){if("SubTree"===e.$){var r=e.a;return l(KT,o,t,r)}var n=e.a;return f(VT,n,t)});return f(VT,i,l(KT,o,e,a))}var o=r(function(e,t){if("SubTree"===e.$){var r=e.a;return l(KT,o,t,r)}var n=e.a;return f(DT,n,t)});return f(ci,!0,f(DT,i,l(KT,o,HT(e),a)))}),qT=r(function(e,t){if("Nothing"===e.$)return t;var r=e.a;return f(Sa,r,t)}),GT=f(ro,qT,tr),zT=n(function(e,t,r){var n=bT(r.trade.parameters.initiatorRole),a=function(){switch(t.$){case"InitiatedEvent":return _a(xT($T));case"CommittedEvent":var r=t.a;return _a(xT(AT(r.responder)));case"RecalledEvent":return _a(xT(NT));case"ClaimedEvent":return _a(xT(IT));case"AbortedEvent":return _a(xT(TT));case"ReleasedEvent":return _a(xT(RT));case"BurnedEvent":return _a(xT(wT));case"InitiatorStatementLogEvent":var r=t.a;return _a(_T({blocknum:e,message:function(){var e=ST(r.statement);if("Just"===e.$){var t=e.a;return BT(t)}return kT}(),who:n(ty)}));case"ResponderStatementLogEvent":var r=t.a;return _a(_T({blocknum:e,message:function(){var e=ST(r.statement);if("Just"===e.$){var t=e.a;return BT(t)}return kT}(),who:n(ry)}));default:return La}}(),i=f(Bu,function(t){return{blocknum:e,eventInfo:t,time:La}},a),o=f(jT,r.history,sT(GT(m([i])))),u=E(e,r.lastNotificationBlocknum)>0?T(f(Bu,ET(C(r.userRole,r.trade.parameters.initiatorRole)),a),e):T(La,r.lastNotificationBlocknum),s=u.a;return w(A(r,{history:o,lastNotificationBlocknum:u.b}),function(){return"Just"===a.$&&"Statement"===a.a.$}(),GT(m([s])))}),YT=Gr,WT=function(e){var t=l(os,Np,f(Wl,"id",YT),f(Wl,"message",Qs));return f(Ul,Mi,f(cd,t,e))},JT=function(e){return{$:"Decrypted",a:e}},QT=a(function(e,t,r,n){return{cmdUps:n,maybeMessageSubmit:r,model:e,shouldCallDecrypt:t}}),XT=r(function(e,t){switch(e.$){case"NewEvent":var r=e.a,n=r.a,a=r.b,i=l(zT,n,a,t),o=i.a,u=i.b,s=i.c;return d(QT,o,u,La,s);case"MessageInputChanged":var c=e.a;return d(QT,A(t,{messageInput:c}),!1,La,tr);case"MessageSubmit":return d(QT,A(t,{messageInput:""}),!1,_a(t.messageInput),tr);default:var h=e.a,p=WT(h);if("Ok"===p.$){var v=p.a,g=v.a,y=v.b,b=f(gf,g,t.history);if("Just"===b.$){var C=b.a,S=C.eventInfo;if("Statement"===S.$){var E=S.a,w=A(E,{message:JT(y)}),I=A(C,{eventInfo:_T(w)}),B=l(Sf,g,I,t.history);return d(QT,A(t,{history:B}),!1,La,tr)}return d(QT,t,!1,La,m([rs(f(Ra,"got a decryption result, but for an event that is not a message!",C))]))}return d(QT,t,!1,La,m([rs(f(Ra,"got a decryption result, but for an id out of bounds!",T(g,t.history)))]))}var k=p.a;return d(QT,t,!1,La,m([rs(f(Ra,"Error decoding decryption result",k))]))}}),ZT=r(function(e,t){return{$:"ActionMined",a:e,b:t}}),ew=r(function(e,t){return{$:"ActionSigned",a:e,b:t}}),tw=function(e){return{onBroadcast:La,onMined:_a(T(ZT(e),La)),onSign:_a(ew(e))}},rw=qe("encryptToPubkeys",Zi),nw=n(function(e,t,r){return{data:_a(f(ol,"commit(address,string)",m([tc(t),Th(r)]))),decoder:us(cr),from:La,gas:La,gasPrice:La,nonce:La,to:_a(e),value:La}}),aw=n(function(e,t,r){return{data:_a(f(ol,"commit(address,string)",m([tc(t),Th(r)]))),decoder:us(cr),from:La,gas:La,gasPrice:La,nonce:La,to:_a(e),value:La}}),iw=function(e){return{$:"CommitMined",a:e}},ow={$:"CommitNeedsSig"},uw=function(e){return{$:"CommitSigned",a:e}},sw=n(function(e,t,r){var n=function(){return"Token"===e.factory.$?aw:nw}(),a=Fh(function(){return"Token"===e.factory.$?Zi:xh(ll(mE(e.parameters)))}()(l(n,e.creationInfo.address,t,r)));return T(_a(ow),f(Is,{onBroadcast:La,onMined:_a(T(iw,La)),onSign:_a(uw)},a))}),cw=r(function(e,t){return Iu(m([T("id",Nu(e)),T("encapsulation",Vi(t.encapsulatedKey)),T("iv",Vi(t.iv)),T("tag",Vi(t.tag)),T("encrypted",Vi(t.message))]))}),fw=qe("decryptMessage",Zi),lw=function(e){var t=e.a,n=r(function(e,t){var r=t.a,n=t.b;return T(r-1,f(Sa,T(r,e),n))});return l(Aa,n,T(t-1,tr),e).b},dw=r(function(e,t){return ju(f(ho,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 fw(f(cw,r,s))}return qu}return qu},lw(e.history)))}),hw=function(e){if("Just"===e.$){return e.a}return La},pw=function(e){var t=hw(l(Yh,ny,function(){var t=e.trade;if("LoadedTrade"===t.$){var r=t.a;return _a(r)}return La}(),f(Bu,function(e){return e.address},Ng(e.wallet)))),r=T(e.chatHistoryModel,t);if("Just"===r.a.$&&"Just"===r.b.$){var n=r.a.a,a=r.b.a;return f(dw,n,a)}return qu},vw=r(function(e,t){return f(r(function(e,t){for(;;){var r=t.a,n=t.b,a=t.c;if(!e.b)return w(r,n,a);var i=e.a,o=i.a,u=i.b,s=e.b,c=l(zT,o,u,r),d=c.a,h=c.b,p=c.c,v=s,g=w(d,n||h,f(Vg,a,p));e=v,t=g}}),e,w(t,!1,tr))}),gw=o(function(e,t,r,n,a,i){return{history:n,lastNotificationBlocknum:a,messageInput:i,trade:t,userRole:r,wallet:e}}),yw=i(function(e,t,r,n,a){return f(vw,n,p(gw,e,r,t,qa,a,""))}),mw=function(e){return{$:"ChatHistoryMsg",a:e}},bw=a(function(e,t,r,n){var a=w(t,Ng(e),r);if("LoadedTrade"===a.a.$&&"Just"===a.b.$&&"Just"===a.c.$){var i=a.a.a,o=a.b.a,u=a.c.a,s=f(ay,i,o.address);if("Just"===s.$){var c=s.a;return function(e){var t=e.a,r=e.b,n=e.c;return w(_a(t),r,f(ho,gs(mw),n))}(h(yw,e,c,i,n,u))}return w(La,!1,tr)}return w(La,!1,tr)}),Cw={$:"Abort"},Sw=r(function(e,t){return{$:"ActionMining",a:e,b:t}}),Ew=function(e){return{$:"ActionNeedsSig",a:e}},Tw=function(e){return{$:"ApproveMining",a:e}},ww={$:"ApproveNeedsSig"},Iw=function(e){return{$:"ApproveSigned",a:e}},Aw={$:"Burn"},Bw={$:"Claim"},kw=function(e){return{$:"CommitMining",a:e}},$w=function(e){return{$:"ConfirmingAction",a:e}},Nw=r(function(e,t){return{$:"ConfirmingCommit",a:e,b:t}}),Rw=function(e){return{$:"ParametersFetched",a:e}},xw=function(e){return{$:"PhaseInfoFetched",a:e}},_w={$:"Poke"},Lw={$:"Recall"},Pw={$:"Release"},Dw=function(e){return{$:"StartContractAction",a:e}},Uw=function(e){return{$:"StateFetched",a:e}},Ow=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"}},Mw={align:va,label:"cantFindTradeWillRetry",mainParagraphs:m([m([Na("Can't find a trade by that ID. I'll try again in half a second.")])]),noticeType:Sg},Fw=r(function(e,t){if("Err"===t.$){var r=t.a;return f(Eg,e,r)}if("Nothing"===t.a.$){t.a;return f(Ra,"Couldn't decode the fetched \""+e+'" result.',La)}return f(Ra,"fromBadFetchResultMaybe being called with an 'OK (Just a)' value",t)}),Vw={align:va,label:"tradeParametersNotDefault",mainParagraphs:m([m([Na("Sorry, I'm not yet able to deal with this kind of trade. This must have been created by some other DAIHard interface.")])]),noticeType:Sg},Kw=Cs(ms),Hw=n(function(e,t,r){return l(Ud,e,Bu(function(e){return A(e,{logCount:Ai(t)+e.logCount})}),r)}),jw=r(function(e,t){var r=t.a;return DC(f(Dd,e,r))}),qw=n(function(e,t,r){var n=e.a,a=f(kd,t,n.requests);if("Nothing"===a.$)return T(PC(n),qu);var i=a.a,o=T(i.watchOnce,dd(r));if("Nothing"===o.b.$){o.b;return T(PC(A(n,{requests:l(Hw,t,r,n.requests)})),qu)}if(o.a){var u=o.b.a;return T(PC(A(n,{requests:l(Hw,t,r,n.requests),watching:f(jw,t,n.watching)})),f(Um,i.tagger,Xd(u)))}return T(PC(A(n,{requests:l(Hw,t,r,n.requests)})),ju(f(ho,function(e){return f(Um,i.tagger,Xd(e))},r)))}),Gw=_e,zw=r(function(e,t){return f(yh,f(Oa,LC,t),f(oh,function(t){return EC(e)},Gw(2e3)))}),Yw=n(function(e,t,r){var n=r.a,a=r.b;return f(mS,e,A(t,{fromBlock:bS(n),toBlock:bS(a)}))}),Ww=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(Ww,e,t,i)),c=o;e=u,t=s,r=c}}),Jw=r(function(e,t){return l(Ww,Fu,t,e)}),Qw=r(function(e,t){var r=e.a,n=t.a;return DC(f(Jw,r,n))}),Xw=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 ju(f(ho,function(t){return f(yh,f(Oa,YC(t.ref),r.tagger),l(n,r.nodePath,t.logFilter,e))},GT(f(ho,function(e){return f(kd,e,r.requests)},wa(t)))))}),o=r.blockNumber;if("Just"===o.$){var u=o.a;return a-u?T(PC(A(r,{blockNumber:_a(a)})),ju(m([f(zw,r.nodePath,r.tagger),l(i,T(u+1,a),r.watching,Yw)]))):T(t,f(zw,r.nodePath,r.tagger))}return T(PC(A(r,{blockNumber:_a(a),pending:UC,watching:f(Qw,r.watching,r.pending)})),ju(m([f(zw,r.nodePath,r.tagger),l(i,T(a,a),r.pending,CS),l(i,T(a,a),r.watching,Yw)])))}var s=e.a.a;return T(PC(A(r,{errors:f(Sa,s,r.errors)})),f(zw,r.nodePath,r.tagger))}if("Ok"===e.b.$){var c=e.a,d=e.b.a;return l(qw,t,c,d)}var s=e.b.a;return T(PC(A(r,{errors:f(Sa,s,r.errors)})),qu)}),Zw=function(e){return m([e])},eI=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(xC,r.factory,r.id):qu}}(),function(){var e=w(Ng(t.wallet),$g(t.wallet),t.trade);if("Just"===e.a.$&&"Just"===e.b.$&&"Token"===e.b.a.$&&"LoadedTrade"===e.c.$){var r=e.a.a,n=e.b.a.a,a=e.c.a;return C($g(t.wallet),_a(a.factory))?d(mh,n,r.address,a.creationInfo.address,IS):qu}return qu}()),n=function(){return"Nothing"===t.chatHistoryModel.$?d(bw,t.wallet,t.trade,t.blocknumOnInit,t.eventsWaitingForChatHistory):w(t.chatHistoryModel,!1,tr)}(),a=n.a,i=n.b,o=n.c,u=A(t,{chatHistoryModel:a}),s=i?pw(t):qu,c=t.trade;if("LoadedTrade"===c.$){var p=c.a;return d(jC,u,ju(m([l(nT,p.factory,p.creationInfo.address,Uw),s,r])),As,o)}return AS(u);case"CurrentBlockFetched":var v=e.a;if("Ok"===v.$){var g=v.a;return AS(A(t,{blocknumOnInit:_a(g)}))}var y=v.a;return d(jC,t,qu,As,m([rs(f(Eg,"blocknum",y))]));case"AllowanceFetched":var v=e.a;if("Ok"===v.$){var b=v.a,u=A(t,{allowance:_a(b)}),S=w(u.txChainStatus,u.trade,u.wallet);if("Just"===S.a.$&&"ApproveMining"===S.a.a.$&&"LoadedTrade"===S.b.$&&"Active"===S.c.$){var E=S.b.a,I=S.c.a;if(C(f(_o,b,ll(mE(E.parameters))),ba))return AS(u);var k=l(sw,E,I.address,I.commPubkey),$=k.a,N=k.b;return d(jC,A(u,{txChainStatus:$}),qu,N,tr)}return AS(u)}var y=v.a;return d(jC,t,qu,As,m([rs(f(Eg,"allowance",y))]));case"CreationInfoFetched":var v=e.a;if("Ok"===v.$){var R=v.a,x={address:R.address_,blocknum:iT(R.blocknum)},_=l(TS,zC,t.eventSentry,{address:x.address,fromBlock:bS(x.blocknum),toBlock:nh,topics:tr}),L=_.a,P=_.b,u=A(t,{eventSentry:L,trade:f(IE,x,t.trade)}),D=f(Tu,Kw,bE(u.trade)),U=ju(m([P,h(aT,D,x.address,Rw,Uw,xw)]));return d(jC,u,U,As,tr)}if("BadBody"===v.a.$){v.a.a;return d(jC,t,qu,As,m([rs(Mw)]))}var y=v.a;return d(jC,t,qu,As,m([rs(f(Eg,"trade state",y))]));case"StateFetched":var v=e.a;if("Ok"===v.$&&"Just"===v.a.$){var O=v.a.a,M=function(){var e=t.trade;switch(e.$){case"PartiallyLoadedTrade":return!0;case"LoadedTrade":return!C(e.a.state.phase,O.phase);default:return!1}}(),u=A(t,{expandedPhase:M?O.phase:t.expandedPhase,trade:f(kE,O,t.trade)});return d(jC,u,pw(u),As,tr)}return d(jC,t,qu,As,m([rs(f(Fw,"trade state",v))]));case"ParametersFetched":var v=e.a;if("Ok"===v.$){if("Ok"===v.a.$){var F=v.a.a;if(CE(F)){var u=A(t,{trade:f(AE,F,t.trade)});return d(jC,u,pw(u),As,tr)}return d(jC,A(t,{trade:PS}),qu,As,m([rs(Vw)]))}var V=v.a.a;return d(jC,t,qu,As,m([rs(f(Ra,"Error decoding fetched trade parameters",V))]))}var K=v.a;return d(jC,t,qu,As,m([rs(f(Eg,"trade parameters",K))]));case"PhaseInfoFetched":var v=e.a;if("Ok"===v.$&&"Just"===v.a.$){var H=v.a.a,u=A(t,{trade:f(BE,H,t.trade)});return d(jC,u,pw(u),As,tr)}return d(jC,t,qu,As,m([rs(f(Fw,"trade state",v))]));case"EventLogFetched":var j=e.a,q=f(ld,yE,j),G=q.returnData;if("Err"===G.$){var z=G.a;return d(jC,t,qu,As,m([rs(f(Ra,"Error decoding contract event",z))]))}var Y=G.a,W=function(){switch(Y.$){case"InitiatedEvent":var e=Y.a;return f(yT,e.commPubkey,t.secureCommInfo);case"CommittedEvent":var e=Y.a;return f(mT,e.commPubkey,t.secureCommInfo);default:return t.secureCommInfo}}(),J=function(){if("InitiatedEvent"===Y.$){var e=Y.a,r=HS(e.terms);if("Ok"===r.$){var n=r.a;return T(f($E,n,t.trade),La)}var a=r.a;return T(t.trade,_a(f(Ra,"Couldn't decode payment methods!",a)))}return T(t.trade,La)}(),Q=J.a,X=J.b,Z=function(){var e=t.chatHistoryModel;if("Just"===e.$){var r=e.a;return w(_a(r),!1,tr)}return d(bw,t.wallet,Q,t.blocknumOnInit,t.eventsWaitingForChatHistory)}(),ee=Z.a,te=Z.b,re=Z.c,ne=function(){if("Just"===ee.$){var e=ee.a;return T(function(e){var t=e.a,r=e.b,n=e.c;return w(_a(t),r||te,f(Vg,re,f(ho,gs(mw),n)))}(l(zT,q.blockNumber,Y,e)),tr)}return T(w(La,!1,re),f(Vg,t.eventsWaitingForChatHistory,m([T(q.blockNumber,Y)])))}(),ae=ne.a,ie=ae.a,oe=ae.b,ue=ae.c,se=ne.b,u=A(t,{chatHistoryModel:ie,eventsWaitingForChatHistory:se,secureCommInfo:W,trade:Q}),U=oe?pw(u):qu;return d(jC,u,U,As,f(Vg,f(ho,rs,GT(m([X]))),ue));case"ExpandPhase":var ce=e.a;return AS(A(t,{expandedPhase:ce}));case"ToggleChat":var fe=!t.showChatHistory;return AS(A(t,{showChatHistory:fe}));case"ToggleStatsModal":var le=!t.showStatsModal;return AS(A(t,{showStatsModal:le}));case"ViewUserHistory":var de=(e.a,t.trade);if("LoadedTrade"===de.$){var E=de.a;return d(jC,t,qu,As,m([es(Lb(E.parameters.initiatorAddress))]))}return d(jC,t,qu,As,m([rs(f(Ra,"Trying to view a user's history for a not-yet-loaded Trade",t.trade))]));case"CommitClicked":var E=e.a,I=e.b,he=e.c;return AS(A(t,{txChainStatus:_a(f(Nw,I,he))}));case"AbortAction":return AS(A(t,{txChainStatus:La}));case"ConfirmCommit":var E=e.a,I=e.b,he=e.c,pe=function(){var e=E.factory;if("Native"===e.$)return l(sw,E,I.address,I.commPubkey);var r=e.a,n=function(){var e=Fh(l(cl,Us(r),E.creationInfo.address,he)),t={onBroadcast:La,onMined:La,onSign:_a(Iw)};return f(Is,t,e)}(),a=t.allowance;if("Just"===a.$){var i=a.a;return C(f(_o,i,ll(mE(E.parameters))),ba)?T(_a(ww),n):l(sw,E,I.address,I.commPubkey)}return T(_a(ww),n)}(),$=pe.a,N=pe.b;return d(jC,A(t,{txChainStatus:$}),qu,N,tr);case"ContractActionClicked":var ve=e.a;if(C(ve,_w)||C(ve,Lw)){var ge=Dw(ve),ye=t;e=ge,t=ye;continue e}return AS(A(t,{txChainStatus:_a($w(ve))}));case"StartContractAction":var me=e.a,be=function(){var e=t.trade;if("LoadedTrade"!==e.$){var r=e;return w(t.txChainStatus,As,m([rs(f(Ra,"Trying to handle StartContractAction msg for a not-yet-loaded Trade",r))]))}var n=e.a;switch(me.$){case"Recall":var a=Fh(xS(n.creationInfo.address));return w(_a(Ew(Lw)),f(Is,tw(Lw),a),tr);case"Claim":var a=Fh(NS(n.creationInfo.address));return w(_a(Ew(Bw)),f(Is,tw(Bw),a),tr);case"Abort":var a=Fh(kS(n.creationInfo.address));return w(_a(Ew(Cw)),f(Is,tw(Cw),a),tr);case"Release":var a=Fh(_S(n.creationInfo.address));return w(_a(Ew(Pw)),f(Is,tw(Pw),a),tr);case"Burn":var a=Fh($S(n.creationInfo.address));return w(_a(Ew(Aw)),f(Is,tw(Aw),a),tr);default:var a=Fh(yy(n.creationInfo.address));return w(_a(Ew(_w)),f(Is,tw(_w),a),tr)}}(),$=be.a,N=be.b,o=be.c;return d(jC,A(t,{txChainStatus:$}),qu,N,o);case"ApproveSigned":var Ce=e.a;if("Ok"===Ce.$){var Se=Ce.a;return AS(A(t,{txChainStatus:_a(Tw(Se))}))}var V=Ce.a;return d(jC,A(t,{txChainStatus:La}),qu,As,m([rs(f(wg,"approve",V))]));case"CommitSigned":var Ce=e.a;if("Ok"===Ce.$){var Se=Ce.a;return AS(A(t,{txChainStatus:_a(kw(Se))}))}var V=Ce.a;return d(jC,A(t,{txChainStatus:La}),qu,As,m([rs(f(wg,"commit",V))]));case"CommitMined":return AS(A(t,{txChainStatus:La}));case"ActionSigned":var ve=e.a,Ce=e.b;if("Ok"===Ce.$){var Se=Ce.a;return AS(A(t,{txChainStatus:_a(f(Sw,ve,Se))}))}var V=Ce.a;return d(jC,A(t,{txChainStatus:La}),qu,As,m([rs(f(wg,Ow(ve),V))]));case"ActionMined":var ve=e.a;return AS(A(t,{txChainStatus:La}));case"EventSentryMsg":var Ee=e.a,Te=f(Xw,Ee,t.eventSentry),we=Te.a,U=Te.b;return d(jC,A(t,{eventSentry:we}),U,As,tr);case"ChatHistoryMsg":var Ie=e.a,Ae=t.chatHistoryModel;if("Just"===Ae.$){var Be=Ae.a,ke=f(XT,Ie,Be),$e=A(t,{chatHistoryModel:_a(ke.model)}),s=ke.shouldCallDecrypt?pw(t):qu,Ne=function(){var e=ke.maybeMessageSubmit;if("Just"===e.$){var r=e.a,n=t.secureCommInfo;if("LoadedCommInfo"===n.$){var a=n.a;return T(rw(f(hT,r,a)),La)}return T(qu,_a(f(Ra,"Trying to encrypt, but commInfo is not loaded",n)))}return T(qu,La)}(),Re=Ne.a,xe=Ne.b;return d(jC,$e,ju(m([s,Re])),As,B(f(ys,mw,ke.cmdUps),f(Tu,tr,f(Bu,Zw,f(Bu,rs,xe)))))}return d(jC,t,qu,As,m([rs(f(Ra,"Got a chat history message, but there is no chat history model!",Ie))]));case"EncryptionFinished":var _e=e.a,Le=f(hd,dT,fT(_e)),Pe=w(t.wallet,t.trade,Le);if("Ok"===Pe.c.$){if("Active"===Pe.a.$&&"LoadedTrade"===Pe.b.$){var I=Pe.a.a,p=Pe.b.a,De=Pe.c.a,Ue=f(ny,p,I.address);if("Nothing"===Ue.$)return d(jC,t,qu,As,m([rs(f(Ra,"Trying to encrypt, but the user is not involved in this trade.",La))]));var Oe=Ue.a,Me=function(){return Fh("Initiator"===Oe.$?f(RS,p.creationInfo.address,De):f(LS,p.creationInfo.address,De))}();return d(jC,t,qu,f(Is,{onBroadcast:La,onMined:La,onSign:La},Me),tr)}var Fe=Pe.a,Ve=Pe.b;return d(jC,t,qu,As,m([rs(f(Ra,"Encryption successful, but the user or trade is no longer valid.",T(Fe,Ve)))]))}var Ke=Pe.c.a;return d(jC,t,qu,As,m([rs(f(Ra,"Error translating JS encryption result into Elm.",Ke))]));case"MessageSubmitMined":if("Ok"===e.a.$){e.a.a;return AS(t)}var V=e.a.a;return d(jC,t,qu,As,m([rs(f(Tg,"message",V))]));case"Web3Connect":return d(jC,t,qu,As,m([ns]));default:return AS(t)}}),tI=r(function(e,t){return{address:e,blocknum:t}}),rI=function(e){switch(e.$){case"LoadedTrade":var t=e.a;return _a(t.creationInfo);case"PartiallyLoadedTrade":return e.a.creationInfo;default:return La}},nI=n(function(e,t,r){return function(e){return T(e.a,e.b)}(d(ES,!0,e,t,r))}),aI=n(function(e,t,r){var n=function(e){return r(f(ld,eE,e).returnData)},a={address:t.address,fromBlock:bS(t.blocknum),toBlock:bS(t.blocknum),topics:m([_a(gE("Initiated(string,string)"))])};return l(nI,n,e,a)}),iI=function(e){return{data:_a(f(ol,"numTrades()",tr)),decoder:Zs(ud),from:La,gas:La,gasPrice:La,nonce:La,to:_a(e),value:La}},oI=r(function(e,t){return f(yh,t,f(ah,gd(e),iI(Ds(e))))}),uI=function(e){return{data:_a(f(ol,"phase()",tr)),decoder:Zs(ud),from:La,gas:La,gasPrice:La,nonce:La,to:_a(e),value:La}},sI=n(function(e,t,r){return f(yh,r,f(sh,ZE,f(ah,gd(e),uI(t))))}),cI=function(e){return f(cg,function(e){if("LoadedTrade"===e.$){var t=e.a;return _a(t)}return La},Ba(e.trades))},fI=function(e){return f(Wa,r(function(t,r){return e(t)?r+1:r}),0)},lI=function(e){return f(fI,Za(PS),Ba(e.trades))},dI=function(e){return A(e,{dataFetchState:A(e.dataFetchState,{invalid:lI(e),loaded:Ai(cI(e))})})},hI=n(function(e,t,r){return{cmd:t,cmdUps:r,tradeCache:e}}),pI=r(function(e,t){var r=f(gf,e,t.trades);if("Just"===r.$){var n=(r.a,l(Sf,e,PS,t.trades));return l(hI,dI(A(t,{trades:n})),qu,tr)}return l(hI,t,qu,m([rs(f(Ra,"markTradeInvalid ran into an out-of-range error",T(e,t.trades)))]))}),vI=n(function(e,t,r){var n=f(gf,e,r.trades);if("Just"===n.$){var a=n.a,i=f(IE,t,a),o=l(Sf,e,i,r.trades);return T(dI(A(r,{trades:o})),tr)}return T(r,m([f(Ra,"updateTradeAddress ran into an out-of-range error",T(e,r.trades))]))}),gI=n(function(e,t,r){var n=f(gf,e,r.trades);if("Just"===n.$){var a=n.a,i=f(AE,t,a),o=l(Sf,e,i,r.trades);return l(hI,dI(A(r,{trades:o})),qu,tr)}return l(hI,r,qu,m([rs(f(Ra,"updateTradeParameters ran into an out-of-range error",T(e,r.trades)))]))}),yI=n(function(e,t,r){var n=f(gf,e,r.trades);if("Just"===n.$){if("LoadedTrade"===n.a.$){var a=n.a.a,i=a.state,o=l(Sf,e,GC(A(a,{state:A(i,{phase:t})})),r.trades);return l(hI,dI(A(r,{trades:o})),qu,tr)}return l(hI,r,qu,m([rs(f(Ra,"updateTradePhase is trying to update a partially loaded trade",T(e,r.trades)))]))}return l(hI,r,qu,m([rs(f(Ra,"updateTradePhase ran into an out-of-range error",T(e,r.trades)))]))}),mI=n(function(e,t,r){var n=f(gf,e,r.trades);if("Just"===n.$){var a=n.a,i=f(BE,t,a),o=l(Sf,e,i,r.trades);return l(hI,dI(A(r,{trades:o})),qu,tr)}return l(hI,r,qu,m([rs(f(Ra,"updateTradePhaseTimeInfo ran into an out-of-range error",T(e,r.trades)))]))}),bI=n(function(e,t,r){var n=f(gf,e,r.trades);if("Just"===n.$){var a=n.a,i=f(kE,t,a),o=l(Sf,e,i,r.trades);return l(hI,dI(A(r,{trades:o})),qu,tr)}return l(hI,r,qu,m([rs(f(Ra,"updateTradeState ran into an out-of-range error",T(e,r.trades)))]))}),CI=n(function(e,t,r){var n=f(gf,e,r.trades);if("Just"===n.$){var a=n.a,i=f($E,t,a),o=l(Sf,e,i,r.trades);return l(hI,dI(A(r,{trades:o})),qu,tr)}return l(hI,r,qu,m([rs(f(Ra,"updateTTPaymentMethods ran into an out-of-range error",T(e,r.trades)))]))}),SI=r(function(e,t){return{$:"CreationInfoFetched",a:e,b:t}}),EI=n(function(e,t,r){return{invalid:r,loaded:t,total:e}}),TI=r(function(e,t){return{$:"InitiatedEventDataFetched",a:e,b:t}}),wI=function(e){return{$:"NumTradesFetchedAgain",a:e}},II=r(function(e,t){return{$:"ParametersFetched",a:e,b:t}}),AI=n(function(e,t,r){return{$:"PhaseFetched",a:e,b:t,c:r}}),BI=r(function(e,t){return{$:"PhaseStartInfoFetched",a:e,b:t}}),kI=r(function(e,t){return{$:"StateFetched",a:e,b:t}}),$I=function(e){return l(hI,e,qu,tr)},NI=r(function(e,t){switch(e.$){case"InitialNumTradesFetched":var r=e.a;if("Ok"===r.$){var n=r.a,a=iT(n),i=sT(f(ho,bC(t.factory),f($i,0,a-1))),o=ju(f(ho,function(e){return l(NC,t.factory,To(e),SI(e))},f($i,0,a-1)));return l(hI,A(t,{dataFetchState:l(EI,_a(a),0,0),trades:i}),o,tr)}var u=r.a;return l(hI,t,qu,m([rs(f(Eg,"Factory numTrades",u))]));case"CheckForNewTrades":return l(hI,t,f(oI,t.factory,wI),tr);case"UpdateTradePhases":var s=ju(GT(f(ho,function(e){return"Closed"===e.state.phase.$?La:_a(l(sI,e.factory,e.creationInfo.address,f(AI,e.factory,e.id)))},cI(t))));return l(hI,t,s,tr);case"PhaseFetched":var c=e.a,d=e.b,r=e.c;if("Ok"===r.$&&"Just"===r.a.$){var p=r.a.a,v=l(yI,d,p,t),g=function(){var e=T(p,f(gf,d,t.trades));if("Just"===e.b.$){if("Committed"===e.a.$){var r=(e.a,e.b.a),n=rI(r);if("Just"===n.$){var a=n.a;return T(l(nT,c,a.address,kI(d)),tr)}return T(qu,m([rs(f(Ra,"Phase fetched for a trade that has no creationInfo",r))]))}return T(qu,tr)}e.b;return T(qu,m([rs(f(Ra,"Phase fetched for a trade, but then ran into an out-of-range error",La))]))}(),y=g.a,b=g.b;return l(hI,v.tradeCache,ju(m([v.cmd,y])),f(Vg,v.cmdUps,b))};return l(hI,t,qu,m([rs(f(Fw,"phase",r))]));case"NumTradesFetchedAgain":var r=e.a,C=T(r,t.dataFetchState.total);if("Ok"===C.a.$){if("Just"===C.b.$){var n=C.a.a,S=C.b.a,w=iT(n);if(E(S,w)<0){var I=t.dataFetchState,o=ju(f(ho,function(e){return l(NC,t.factory,To(e),SI(e))},f($i,S,w-1))),B=sT(f(ho,bC(t.factory),f($i,S,w-1)));return l(hI,A(t,{dataFetchState:A(I,{total:_a(w)}),trades:f(jT,t.trades,B)}),o,tr)}return $I(t)}C.b;return l(hI,t,qu,m([rs(f(Ra,"Trying to fetch additional trades, but there is an unexpected Nothing in the existing numTrades.",""))]))}var u=C.a.a;return l(hI,t,qu,m([rs(f(Eg,"Factory numTrades",u))]));case"CreationInfoFetched":var d=e.a,r=e.b;if("Ok"===r.$){var k=r.a,$=f(tI,k.address_,iT(k.blocknum)),N=l(aI,t.eventSentry,$,TI(d)),R=N.a,x=N.b,y=ju(m([h(aT,t.factory,$.address,II(d),kI(d),BI(d)),x])),_=l(vI,d,$,t),L=_.a,P=_.b;return l(hI,dI(A(L,{eventSentry:R})),y,f(ho,rs,P))}var u=r.a;return l(hI,t,qu,m([rs(f(Eg,"creationInfo",u))]));case"ParametersFetched":var d=e.a,r=e.b;if("Err"===r.$){var D=r.a;return l(hI,t,qu,m([rs(f(Eg,"parameters",D))]))}if("Ok"===r.a.$){var U=r.a.a;return l(gI,d,U,t)}var O=r.a.a;return l(hI,t,qu,m([rs(f(Ra,"Can't decode fetched trade parameters",O))]));case"StateFetched":var d=e.a,r=e.b;if("Ok"===r.$&&"Just"===r.a.$){var M=r.a.a;return l(bI,d,M,t)}return l(hI,t,qu,m([rs(f(Fw,"state",r))]));case"PhaseStartInfoFetched":var d=e.a,r=e.b;if("Ok"===r.$&&"Just"===r.a.$){var F=r.a.a;return l(mI,d,F,t)}return l(hI,t,qu,m([rs(f(Fw,"phaseStartInfo",r))]));case"InitiatedEventDataFetched":var d=e.a,r=e.b;if("Ok"===r.$){var V=r.a,K=HS(V.terms);if("Ok"===K.$){var H=K.a;return l(CI,d,H,t)}var j=K.a;return f(pI,d,t)}var j=r.a;return l(hI,t,qu,m([rs(f(Ra,"Error decoding initiated event",j))]));default:var q=e.a,G=f(Xw,q,t.eventSentry),z=G.a,y=G.b;return l(hI,A(t,{eventSentry:z}),y,tr)}}),RI=function(e){return{$:"AgentHistoryModel",a:e}},xI=function(e){return{$:"AgentHistoryMsg",a:e}},_I=function(e){return{$:"CmdUp",a:e}},LI={$:"ConnectToWeb3"},PI=function(e){return{$:"CreateModel",a:e}},DI=function(e){return{$:"CreateMsg",a:e}},UI=function(e){return{$:"CryptoSwapModel",a:e}},OI=function(e){return{$:"CryptoSwapMsg",a:e}},MI=function(e){return{$:"GotoRoute",a:e}},FI=function(e){return{$:"MarketplaceModel",a:e}},VI=function(e){return{$:"MarketplaceMsg",a:e}},KI=r(function(e,t){return{$:"TradeCacheMsg",a:e,b:t}}),HI=function(e){return{$:"TradeModel",a:e}},jI=function(e){return{$:"TradeMsg",a:e}},qI=r(function(e,t){return f(Rn,e,Vi(t))}),GI=function(e){return f(qI,"href",rt(e))},zI=xn("rel"),YI=qI("target"),WI=function(e){return{$:"Height",a:e}},JI=WI,QI={$:"Content"},XI=QI,ZI=function(e){return{$:"Width",a:e}},eA=ZI,tA=function(e){return{$:"Attr",a:e}},rA=function(e){return{$:"NodeName",a:e}},nA=function(e){return{$:"Unkeyed",a:e}},aA={$:"AsEl"},iA=aA,oA=r(function(e,t){return{$:"Field",a:e,b:t}}),uA=f(oA,0,0),sA={$:"NoNearbyChildren"},cA={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",focusedWithin:"focus-within",fullSize:"fs",grid:"g",hasBehind:"hbh",heightContent:"hc",heightExact:"he",heightFill:"hf",heightFillPortion:"hfp",hover:"hv",imageContainer:"ic",inFront:"fr",inputMultiline:"iml",inputMultilineFiller:"imlf",inputMultilineParent:"imlp",inputMultilineWrapper:"implw",inputText:"it",italic:"i",link:"lnk",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"},fA=cA.any+" "+cA.column,lA=cA.any+" "+cA.grid,dA=cA.any+" "+cA.page,hA=cA.any+" "+cA.paragraph,pA=cA.any+" "+cA.row,vA=cA.any+" "+cA.single,gA=function(e){switch(e.$){case"AsRow":return pA;case"AsColumn":return fA;case"AsEl":return vA;case"AsGrid":return lA;case"AsParagraph":return hA;default:return dA}},yA=function(e){return{$:"Keyed",a:e}},mA={$:"NoStyleSheet"},bA=r(function(e,t){switch(t.$){case"NoNearbyChildren":return e;case"ChildrenBehind":var r=t.a;return B(r,e);case"ChildrenInFront":var n=t.a;return B(e,n);default:var r=t.a,n=t.b;return B(r,B(e,n))}}),CA=n(function(e,t,r){switch(r.$){case"NoNearbyChildren":return t;case"ChildrenBehind":var n=r.a;return B(f(ho,function(t){return T(e,t)},n),t);case"ChildrenInFront":var a=r.a;return B(t,f(ho,function(t){return T(e,t)},a));default:var n=r.a,a=r.b;return B(f(ho,function(t){return T(e,t)},n),B(t,f(ho,function(t){return T(e,t)},a)))}}),SA={$:"AsParagraph"},EA=SA,TA=In("div"),wA=In("p"),IA=In("s"),AA=In("u"),BA=qI("className"),kA=function(e){return Bn(Ze(e))},$A=function(e){return In(Ze(e))},NA=function(e){return{$:"Flag",a:e}},RA=function(e){return{$:"Second",a:e}},xA=function(e){return e>31?RA(1< .ctr > ."+cA.any+" {\n border: 4px dashed rgb(0, 151, 167) !important;\n}\n\n",_B="@media screen and (-ms-high-contrast: active), (-ms-high-contrast: none) {"+ZA(cA.any)+ZA(cA.row)+" > "+ZA(cA.any)+" { flex-basis: auto !important; } "+ZA(cA.any)+ZA(cA.row)+" > "+ZA(cA.any)+ZA(cA.container)+' { flex-basis: auto !important; }}\ninput[type="search"],\ninput[type="search"]::-webkit-search-decoration,\ninput[type="search"]::-webkit-search-cancel-button,\ninput[type="search"]::-webkit-search-results-button,\ninput[type="search"]::-webkit-search-results-decoration {\n -webkit-appearance:none;\n}\n\ninput[type=range] {\n -webkit-appearance: none; \n background: transparent;\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\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\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'+xB,LB=function(e){return{$:"Intermediate",a:e}},PB=r(function(e,t){return LB({closing:t,others:tr,props:tr,selector:e})}),DB=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 A(t,{props:f(Sa,T(r,a),t.props)});case"Supports":var i=e.a,o=i.a,u=i.b,s=e.b;return A(t,{others:f(Sa,LB({closing:"\n}",others:tr,props:s,selector:"@supports ("+o+":"+u+") {"+n.selector}),t.others)});case"Adjacent":var c=e.a,l=e.b;return A(t,{others:f(Sa,f(DB,f(PB,n.selector+" + "+c,""),l),t.others)});case"Child":var d=e.a,h=e.b;return A(t,{others:f(Sa,f(DB,f(PB,n.selector+" > "+d,""),h),t.others)});case"Descriptor":var p=e.a,v=e.b;return A(t,{others:f(Sa,f(DB,f(PB,B(n.selector,p),""),v),t.others)});default:var g=e.a;return A(t,{others:f(Sa,f(DB,f(PB,n.selector,""),g),t.others)})}});return LB(l(ro,a,n,t))}),UB=B(_B,function(e){var t=function(e){return fp(f(ho,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 B(n(t),fp(f(ho,a,t.others)))};return fp(f(ho,a,l(ro,r(function(e,t){var r=e.a,n=e.b;return f(Sa,f(DB,f(PB,r,""),n),t)}),tr,e)))}(B($B,RB))),OB=function(e){switch(e.mode.$){case"Layout":return l($A,"div",tr,m([l($A,"style",tr,m([rB(UB)]))]));case"NoStaticStyleSheet":return rB("");default:return l($A,"elm-ui-static-rules",m([f(tB,"rules",Vi(UB))]),tr)}},MB=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+'"'}},FB=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}},VB=function(e){if("FontWith"===e.$){var t=e.a;return f($l,FB,t.variants)}return!1},KB=n(function(e,t,r){var n=t.a,a=t.b;return e?r+"\n "+n+": "+a+" !important;":r+"\n "+n+": "+a+";"}),HB=a(function(e,t,r,n){if("Nothing"===t.$)return m([r+"{"+l(Wa,KB(!1),"",n)+"\n}"]);switch(t.a.$){case"Hover":switch(e.hover.$){case"NoHover":return tr;case"ForceHover":return m([r+"-hv {"+l(Wa,KB(!0),"",n)+"\n}"]);default:return m([r+"-hv:hover {"+l(Wa,KB(!1),"",n)+"\n}"])}case"Focus":var a=l(Wa,KB(!1),"",n);return m([r+"-fs:focus {"+a+"\n}","."+cA.any+":focus ~ "+r+"-fs:not(.focus) {"+a+"\n}","."+cA.any+":focus "+r+"-fs {"+a+"\n}",r+"-fs:focus-within {"+a+"\n}",".focusable-parent:focus ~ ."+cA.any+" "+r+"-fs {"+a+"\n}"]);default:return m([r+"-act:active {"+l(Wa,KB(!1),"",n)+"\n}"])}}),jB=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+'" '+xi(r)}},qB=function(e){if("FontWith"===e.$){var t=e.a;return _a(f(_i,", ",f(ho,jB,t.variants)))}return La},GB=function(e){switch(e.$){case"Untransformed":return La;case"Moved":var t=e.a,r=t.a,n=t.b,a=t.c;return _a("translate3d("+Wh(r)+"px, "+Wh(n)+"px, "+Wh(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,v=h.b,g=h.c,y=e.d,m="translate3d("+Wh(o)+"px, "+Wh(u)+"px, "+Wh(s)+"px)",b="scale3d("+Wh(f)+", "+Wh(l)+", "+Wh(d)+")",C="rotate3d("+Wh(p)+", "+Wh(v)+", "+Wh(g)+", "+Wh(y)+"rad)";return _a(m+" "+b+" "+C)}},zB=n(function(e,t,r){switch(t.$){case"Style":var a=t.a,i=t.b;return d(HB,e,r,a,i);case"Shadows":var o=t.a,u=t.b;return d(HB,e,r,"."+o,m([f(WA,"box-shadow",u)]));case"Transparency":var o=t.a,s=t.b,c=f(ii,0,f(Vc,1,1-s));return d(HB,e,r,"."+o,m([f(WA,"opacity",Wh(c))]));case"FontSize":var h=t.a;return d(HB,e,r,".font-size-"+xi(h),m([f(WA,"font-size",xi(h)+"px")]));case"FontFamily":var o=t.a,p=t.b,v=f(_i,", ",f(cg,qB,p)),g=m([f(WA,"font-family",f(_i,", ",f(ho,MB,p))),f(WA,"font-feature-settings",v),f(WA,"font-variant",f($l,VB,p)?"small-caps":"normal")]);return d(HB,e,r,"."+o,g);case"Single":var y=t.a,u=t.b,b=t.c;return d(HB,e,r,"."+y,m([f(WA,u,b)]));case"Colored":var y=t.a,u=t.b,C=t.c;return d(HB,e,r,"."+y,m([f(WA,u,QA(C))]));case"SpacingStyle":var S=t.a,E=t.b,w=t.c,I=xi(w)+"px",A=xi(E)+"px",k="."+cA.row,$="."+(cA.wrapped+k),N="."+cA.alignRight,R="."+cA.paragraph,x="."+cA.page,_="."+cA.alignLeft,L=Wh(w/2)+"px",P=Wh(E/2)+"px",D="."+cA.column,y="."+S,U="."+cA.any;return zb(m([d(HB,e,r,y+(k+" > ")+U+" + "+U,m([f(WA,"margin-left",A)])),d(HB,e,r,y+($+" > ")+U,m([f(WA,"margin",L+" "+P)])),d(HB,e,r,y+(D+" > ")+U+" + "+U,m([f(WA,"margin-top",I)])),d(HB,e,r,y+(x+" > ")+U+" + "+U,m([f(WA,"margin-top",I)])),d(HB,e,r,y+(x+" > ")+_,m([f(WA,"margin-right",A)])),d(HB,e,r,y+(x+" > ")+N,m([f(WA,"margin-left",A)])),d(HB,e,r,B(y,R),m([f(WA,"line-height","calc(1em + "+xi(w)+"px)")])),d(HB,e,r,"textarea"+(U+y),m([f(WA,"line-height","calc(1em + "+xi(w)+"px)"),f(WA,"height","calc(100% + "+xi(w)+"px)")])),d(HB,e,r,y+(R+" > ")+_,m([f(WA,"margin-right",A)])),d(HB,e,r,y+(R+" > ")+N,m([f(WA,"margin-left",A)])),d(HB,e,r,y+(R+"::after"),m([f(WA,"content","''"),f(WA,"display","block"),f(WA,"height","0"),f(WA,"width","0"),f(WA,"margin-top",xi(-1*(w/2|0))+"px")])),d(HB,e,r,y+(R+"::before"),m([f(WA,"content","''"),f(WA,"display","block"),f(WA,"height","0"),f(WA,"width","0"),f(WA,"margin-bottom",xi(-1*(w/2|0))+"px")]))]));case"PaddingStyle":var S=t.a,O=t.b,N=t.c,M=t.d,_=t.e,y="."+S;return d(HB,e,r,y,m([f(WA,"padding",xi(O)+"px "+xi(N)+"px "+xi(M)+"px "+xi(_)+"px")]));case"BorderWidth":var S=t.a,O=t.b,N=t.c,M=t.d,_=t.e,y="."+S;return d(HB,e,r,y,m([f(WA,"border-width",xi(O)+"px "+xi(N)+"px "+xi(M)+"px "+xi(_)+"px")]));case"GridTemplateStyle":var F=t.a,V=n(function(e,t,r){e:for(;;)switch(r.$){case"Px":var n=r.a;return xi(n)+"px";case"Content":var a=T(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, "+xi(i)+"px)"}if("Nothing"===a.b.$){var o=a.a.a;a.b;return"minmax("+xi(o)+"px, max-content)"}var o=a.a.a,i=a.b.a;return"minmax("+xi(o)+"px, "+xi(i)+"px)";case"Fill":var u=r.a,s=T(e,t);if("Nothing"===s.a.$){if("Nothing"===s.b.$){s.a,s.b;return xi(u)+"fr"}var i=(s.a,s.b.a);return"minmax(max-content, "+xi(i)+"px)"}if("Nothing"===s.b.$){var o=s.a.a;s.b;return"minmax("+xi(o)+"px, "+xi(u)+"frfr)"}var o=s.a.a,i=s.b.a;return"minmax("+xi(o)+"px, "+xi(i)+"px)";case"Min":var c=r.a,f=r.b,l=_a(c),d=t,h=f;e=l,t=d,r=h;continue e;default:var c=r.a,f=r.b,l=e,d=_a(c),h=f;e=l,t=d,r=h;continue e}}),K=function(e){return l(V,La,La,e)},H=(K(F.spacing.a),K(F.spacing.b)),j=function(e){return"grid-template-rows: "+e+";"}(f(_i," ",f(ho,K,F.rows))),q=function(e){return"-ms-grid-rows: "+e+";"}(f(_i,H,f(ho,K,F.columns))),G=function(e){return"-ms-grid-columns: "+e+";"}(f(_i,H,f(ho,K,F.columns))),z="grid-row-gap:"+K(F.spacing.b)+";",Y="grid-column-gap:"+K(F.spacing.a)+";",W=function(e){return"grid-template-columns: "+e+";"}(f(_i," ",f(ho,K,F.columns))),y=".grid-rows-"+f(_i,"-",f(ho,jA,F.rows))+"-cols-"+f(_i,"-",f(ho,jA,F.columns))+"-space-x-"+jA(F.spacing.a)+"-space-y-"+jA(F.spacing.b),J=y+"{"+W+j+Y+z+"}",Q="@supports (display:grid) {"+J+"}",X=y+"{"+G+q+"}";return m([X,Q]);case"GridPosition":var Z=t.a,ee=f(_i," ",m(["-ms-grid-row: "+xi(Z.row)+";","-ms-grid-row-span: "+xi(Z.height)+";","-ms-grid-column: "+xi(Z.col)+";","-ms-grid-column-span: "+xi(Z.width)+";"])),te=f(_i," ",m(["grid-row: "+xi(Z.row)+" / "+xi(Z.row+Z.height)+";","grid-column: "+xi(Z.col)+" / "+xi(Z.col+Z.width)+";"])),y=".grid-pos-"+xi(Z.row)+"-"+xi(Z.col)+"-"+xi(Z.width)+"-"+xi(Z.height),J=y+"{"+te+"}",Q="@supports (display:grid) {"+J+"}",X=y+"{"+ee+"}";return m([X,Q]);case"PseudoSelector":var y=t.a,re=t.b;return f(Yb,function(t){return l(zB,e,t,_a(y))},re);default:var ne=t.a,b=GB(ne),y=GA(ne),ae=T(y,b);if("Just"===ae.a.$&&"Just"===ae.b.$){var S=ae.a.a,ie=ae.b.a;return d(HB,e,r,"."+S,m([f(WA,"transform",ie)]))}return tr}}),YB=r(function(e,t){return Iu(f(ho,function(t){var r=l(zB,e,t,La);return T(zA(t),f(fd,Vi,r))},t))}),WB=r(function(e,t){return e+" {"+f(_i,"",f(ho,function(e){return e.a+": "+e.b+";"},t))+"}"}),JB=n(function(e,t,r){var n=r.a,a=r.b;return m([f(WB,"."+e+"."+t+", ."+e+" ."+t,n),f(WB,"."+e+"."+t+"> ."+cA.text+", ."+e+" ."+t+" > ."+cA.text,a)])}),QB=n(function(e,t,r){var n=t.a,a=t.b,i=C(e,r)?e:r+" ."+e;return f(_i," ",B(l(JB,i,cA.sizeByCapital,a),l(JB,i,cA.fullSize,n)))}),XB=r(function(e,t){var r=C(e,t)?e:t+" ."+e;return f(_i," ",m([f(WB,"."+r+"."+cA.sizeByCapital+", ."+r+" ."+cA.sizeByCapital,m([T("line-height","1")])),f(WB,"."+r+"."+cA.sizeByCapital+"> ."+cA.text+", ."+r+" ."+cA.sizeByCapital+" > ."+cA.text,m([T("vertical-align","0"),T("line-height","1")]))]))}),ZB=function(e){if(e.b){var t=e.a,r=e.b;return _a(l(Wa,ii,t,r))}return La},ek=function(e){if(e.b){var t=e.a,r=e.b;return _a(l(Wa,Vc,t,r))}return La},tk=n(function(e,t,r){return{height:t/e,size:e,vertical:r}}),rk=function(e){var t=m([e.capital,e.baseline,e.descender,e.lowercase]),r=f(Tu,e.descender,ek(t)),n=f(Tu,e.baseline,ek(f(Eu,function(e){return!C(e,r)},t))),a=f(Tu,e.capital,ZB(t)),i=1/(a-n),o=1-a,u=1/(a-r),s=1-a;return{capital:l(tk,i,a-n,o),full:l(tk,u,a-r,s)}},nk=function(e){return T(m([T("display","block")]),m([T("display","inline-block"),T("line-height",Wh(e.height)),T("vertical-align",Wh(e.vertical)+"em"),T("font-size",Wh(e.size)+"em")]))},ak=function(e){return l(Wa,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 _a(T(nk(function(e){return e.full}(rk(a))),nk(function(e){return e.capital}(rk(a)))))}return t}return t}),La,e)},ik=function(e){var t=function(e){if("ImportFont"===e.$){var t=e.b;return _a("@import url('"+t+"');")}return La},r=function(e){var r=(e.a,e.b);return f(_i,"\n",f(cg,t,r))},n=f(ho,ei,e),a=function(e){var t=e.a,r=e.b,a=ak(r);if("Nothing"===a.$)return f(_i,"",f(ho,XB(t),n));var i=a.a;return f(_i,"",f(ho,f(QB,t,i),n))};return B(f(_i,"\n",f(ho,r,e)),f(_i,"\n",f(ho,a,e)))},ok=function(e){if("FontFamily"===e.$){var t=e.a,r=e.b;return _a(T(t,r))}return La},uk=r(function(e,t){var n=r(function(t,r){return{rules:B(r.rules,l(zB,e,t,La)),topLevel:function(){var e=ok(t);if("Nothing"===e.$)return r.topLevel;var n=e.a;return f(Sa,n,r.topLevel)}()}}),a=l(Wa,n,{rules:tr,topLevel:tr},t),i=a.topLevel,o=a.rules;return B(ik(i),fp(o))}),sk=r(function(e,t){switch(e.mode.$){case"Layout":case"NoStaticStyleSheet":return l($A,"div",tr,m([l($A,"style",tr,m([rB(f(uk,e,t))]))]));default:return l($A,"elm-ui-rules",m([f(tB,"rules",f(YB,e,t))]),tr)}}),ck=a(function(e,t,r,n){var a=f(sk,t,l(Wa,YA,T(UC,eB(t.focus)),r).b);return e?f(Sa,T("static-stylesheet",OB(t)),f(Sa,T("dynamic-stylesheet",a),n)):f(Sa,T("dynamic-stylesheet",a),n)}),fk=a(function(e,t,r,n){var a=f(sk,t,l(Wa,YA,T(UC,eB(t.focus)),r).b);return e?f(Sa,OB(t),f(Sa,a,n)):f(Sa,a,n)}),lk=o(function(e,t,n,a,i,o){var u=r(function(e,t){if("Keyed"===a.$){var r=a.a;return l(kA,e,t,function(){switch(i.$){case"NoStyleSheet":return r;case"OnlyDynamic":var e=i.a,t=i.b;return d(ck,!1,e,t,r);default:var e=i.a,t=i.b;return d(ck,!0,e,t,r)}}())}var n=a.a;return f(function(){switch(e){case"div":return TA;case"p":return wA;default:return $A(e)}}(),t,function(){switch(i.$){case"NoStyleSheet":return n;case"OnlyDynamic":var e=i.a,t=i.b;return d(fk,!1,e,t,n);default:var e=i.a,t=i.b;return d(fk,!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($A,e,n,m([f(u,r,m([BA(cA.any+" "+cA.single)]))]))}}();switch(o.$){case"AsRow":return f(MA,VA,e)&&!f(MA,FA,e)?s:f(MA,LA,e)?f(AA,m([BA(f(_i," ",m([cA.any,cA.single,cA.container,cA.contentCenterY,cA.alignContainerRight])))]),m([s])):f(MA,PA,e)?f(IA,m([BA(f(_i," ",m([cA.any,cA.single,cA.container,cA.contentCenterY,cA.alignContainerCenterX])))]),m([s])):s;case"AsColumn":return f(MA,OA,e)&&!f(MA,UA,e)?s:f(MA,DA,e)?f(IA,m([BA(f(_i," ",m([cA.any,cA.single,cA.container,cA.alignContainerCenterY])))]),m([s])):f(MA,_A,e)?f(AA,m([BA(f(_i," ",m([cA.any,cA.single,cA.container,cA.alignContainerBottom])))]),m([s])):s;default:return s}}),dk=rB,hk=cA.any+" "+cA.text+" "+cA.widthContent+" "+cA.heightContent,pk=function(e){return f(TA,m([BA(hk)]),m([dk(e)]))},vk=cA.any+" "+cA.text+" "+cA.widthFill+" "+cA.heightFill,gk=function(e){return f(TA,m([BA(vk)]),m([dk(e)]))},yk=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 C(e,EA),T(f(Sa,T(n,u(e)),i),o);case"Styled":var s=a.a;return C(e,EA),T(f(Sa,T(n,f(s.html,mA,e)),i),Qi(o)?s.styles:B(s.styles,o));case"Text":var c=a.a;return T(f(Sa,T(n,C(e,iA)?gk(c):pk(c)),i),o);default:return T(i,o)}}),i=r(function(t,r){var n=r.a,a=r.b;switch(t.$){case"Unstyled":var i=t.a;return C(e,EA),T(f(Sa,i(e),n),a);case"Styled":var o=t.a;return C(e,EA),T(f(Sa,f(o.html,mA,e),n),Qi(a)?o.styles:B(o.styles,a));case"Text":var u=t.a;return T(f(Sa,C(e,iA)?gk(u):pk(u),n),a);default:return T(n,a)}});if("Keyed"===t.$){var o=t.a,u=l(ro,a,T(tr,tr),o),s=u.a,c=u.b,p=Qi(c)?n.styles:B(n.styles,c);if(p.b){var v=p;return ls({html:d(lk,n.has,n.node,n.attributes,yA(l(CA,"nearby-element-pls",s,n.children))),styles:v})}return ds(h(lk,n.has,n.node,n.attributes,yA(l(CA,"nearby-element-pls",s,n.children)),mA))}var g=t.a,y=l(ro,i,T(tr,tr),g),m=y.a,c=y.b,p=Qi(c)?n.styles:B(n.styles,c);if(p.b){var v=p;return ls({html:d(lk,n.has,n.node,n.attributes,nA(f(bA,m,n.children))),styles:v})}return ds(h(lk,n.has,n.node,n.attributes,nA(f(bA,m,n.children)),mA))}),mk=r(function(e,t){return f(xn,et(e),nt(t))}),bk=r(function(e,t){var r=t.a,n=t.b;if("Flag"===e.$){var a=e.a;return f(oA,a|r,n)}var i=e.a;return f(oA,r,i|n)}),Ck=xA(7),Sk=xA(36),Ek=r(function(e,t){var r=e.a,n=e.b,a=t.a,i=t.b;return f(oA,r|a,n|i)}),Tk=xA(6),wk=xA(38),Ik=xA(30),Ak=xA(29),Bk=n(function(e,t,r){return{$:"Single",a:e,b:t,c:r}}),kk=function(e){return{$:"Transform",a:e}},$k=function(e){return{$:"ChildrenBehind",a:e}},Nk=r(function(e,t){return{$:"ChildrenBehindAndInFront",a:e,b:t}}),Rk=function(e){return{$:"ChildrenInFront",a:e}},xk=r(function(e,t){return f(TA,m([BA(function(){switch(e.$){case"Above":return f(_i," ",m([cA.nearby,cA.single,cA.above]));case"Below":return f(_i," ",m([cA.nearby,cA.single,cA.below]));case"OnRight":return f(_i," ",m([cA.nearby,cA.single,cA.onRight]));case"OnLeft":return f(_i," ",m([cA.nearby,cA.single,cA.onLeft]));case"InFront":return f(_i," ",m([cA.nearby,cA.single,cA.inFront]));default:return f(_i," ",m([cA.nearby,cA.single,cA.behind]))}}())]),m([function(){switch(t.$){case"Empty":return rB("");case"Text":var e=t.a;return pk(e);case"Unstyled":return(0,t.a)(iA);default:return f(t.a.html,mA,iA)}}()]))}),_k=n(function(e,t,r){var n=f(xk,e,t);switch(r.$){case"NoNearbyChildren":return"Behind"===e.$?$k(m([n])):Rk(m([n]));case"ChildrenBehind":var a=r.a;return"Behind"===e.$?$k(f(Sa,n,a)):f(Nk,a,m([n]));case"ChildrenInFront":var i=r.a;return"Behind"===e.$?f(Nk,m([n]),i):Rk(f(Sa,n,i));default:var a=r.a,i=r.b;return"Behind"===e.$?f(Nk,f(Sa,n,a),i):f(Nk,a,f(Sa,n,i))}}),Lk=r(function(e,t){return{$:"Embedded",a:e,b:t}}),Pk=r(function(e,t){switch(t.$){case"Generic":return rA(e);case"NodeName":var r=t.a;return f(Lk,r,e);default:var n=t.a,a=t.b;return f(Lk,n,a)}}),Dk=function(e){switch(e.$){case"Left":return cA.alignedHorizontally+" "+cA.alignLeft;case"Right":return cA.alignedHorizontally+" "+cA.alignRight;default:return cA.alignedHorizontally+" "+cA.alignCenterX}},Uk=function(e){switch(e.$){case"Top":return cA.alignedVertically+" "+cA.alignTop;case"Bottom":return cA.alignedVertically+" "+cA.alignBottom;default:return cA.alignedVertically+" "+cA.alignCenterY}},Ok=a(function(e,t,r,n){return{$:"FullTransform",a:e,b:t,c:r,d:n}}),Mk=function(e){return{$:"Moved",a:e}},Fk=r(function(e,t){switch(e.$){case"Untransformed":switch(t.$){case"MoveX":var r=t.a;return Mk(w(r,0,0));case"MoveY":var n=t.a;return Mk(w(0,n,0));case"MoveZ":var a=t.a;return Mk(w(0,0,a));case"MoveXYZ":var i=t.a;return Mk(i);case"Rotate":var i=t.a,o=t.b;return d(Ok,w(0,0,0),w(1,1,1),i,o);default:var i=t.a;return d(Ok,w(0,0,0),i,w(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 Mk(w(s,n,a));case"MoveY":var c=t.a;return Mk(w(r,c,a));case"MoveZ":var f=t.a;return Mk(w(r,n,f));case"MoveXYZ":var i=t.a;return Mk(i);case"Rotate":var i=t.a,o=t.b;return d(Ok,u,w(1,1,1),i,o);default:var l=t.a;return d(Ok,u,l,w(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(Ok,w(s,n,a),h,p,o);case"MoveY":var c=t.a;return d(Ok,w(r,c,a),h,p,o);case"MoveZ":var f=t.a;return d(Ok,w(r,n,f),h,p,o);case"MoveXYZ":var v=t.a;return d(Ok,v,h,p,o);case"Rotate":var g=t.a,y=t.b;return d(Ok,u,h,g,y);default:var m=t.a;return d(Ok,u,m,p,o)}}}),Vk=function(e){switch(e.$){case"Px":var t=e.a,r=xi(t),n="height-px-"+r;return w(uA,cA.heightExact+" "+n,m([l(Bk,n,"height",r+"px")]));case"Content":return w(f(bk,Sk,uA),cA.heightContent,tr);case"Fill":var a=e.a;return 1===a?w(f(bk,OA,uA),cA.heightFill,tr):w(f(bk,OA,uA),cA.heightFillPortion+" height-fill-"+xi(a),m([l(Bk,cA.any+"."+cA.column+" > "+ZA("height-fill-"+xi(a)),"flex-grow",xi(1e5*a))]));case"Min":var i=e.a,o=e.b,u="min-height-"+xi(i),s=l(Bk,u,"min-height",xi(i)+"px"),c=Vk(o),d=c.a,h=c.b,p=c.c;return w(f(bk,UA,d),u+" "+h,f(Sa,s,p));default:var v=e.a,o=e.b,u="max-height-"+xi(v),s=l(Bk,u,"max-height",xi(v)+"px"),g=Vk(o),d=g.a,h=g.b,p=g.c;return w(f(bk,UA,d),u+" "+h,f(Sa,s,p))}},Kk=function(e){switch(e.$){case"Px":var t=e.a;return w(uA,cA.widthExact+" width-px-"+xi(t),m([l(Bk,"width-px-"+xi(t),"width",xi(t)+"px")]));case"Content":return w(f(bk,wk,uA),cA.widthContent,tr);case"Fill":var r=e.a;return 1===r?w(f(bk,VA,uA),cA.widthFill,tr):w(f(bk,VA,uA),cA.widthFillPortion+" width-fill-"+xi(r),m([l(Bk,cA.any+"."+cA.row+" > "+ZA("width-fill-"+xi(r)),"flex-grow",xi(1e5*r))]));case"Min":var n=e.a,a=e.b,i="min-width-"+xi(n),o=l(Bk,i,"min-width",xi(n)+"px"),u=Kk(a),s=u.a,c=u.b,d=u.c;return w(f(bk,FA,s),i+" "+c,f(Sa,o,d));default:var h=e.a,a=e.b,i="max-width-"+xi(h),o=l(Bk,i,"max-width",xi(h)+"px"),p=Kk(a),s=p.a,c=p.b,d=p.c;return w(f(bk,FA,s),i+" "+c,f(Sa,o,d))}},Hk=xA(27),jk=r(function(e,t){if(C(e,Hk)){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 C(n,i)&&C(n,a)&&C(n,o)&&n>=0&&n<=24;default:return!1}}),qk=s(function(e,t,r,n,a,i,o,u){e:for(;;){if(!u.b){var s=GA(n);if("Nothing"===s.$)return{attributes:f(Sa,BA(e),i),children:o,has:r,node:t,styles:a};var c=s.a;return{attributes:f(Sa,BA(e+" "+c),i),children:o,has:r,node:t,styles:f(Sa,kk(n),a)}}var d=u.a,h=u.b;switch(d.$){case"NoAttribute":var p=e,v=t,g=r,y=n,m=a,b=i,C=o,S=h;e=p,t=v,r=g,n=y,a=m,i=b,o=C,u=S;continue e;case"Class":var E=d.a,T=d.b;if(f(MA,E,r)){var p=e,v=t,g=r,y=n,m=a,b=i,C=o,S=h;e=p,t=v,r=g,n=y,a=m,i=b,o=C,u=S;continue e}var p=T+" "+e,v=t,g=f(bk,E,r),y=n,m=a,b=i,C=o,S=h;e=p,t=v,r=g,n=y,a=m,i=b,o=C,u=S;continue e;case"Attr":var w=d.a,p=e,v=t,g=r,y=n,m=a,b=f(Sa,w,i),C=o,S=h;e=p,t=v,r=g,n=y,a=m,i=b,o=C,u=S;continue e;case"StyleClass":var E=d.a,I=d.b;if(f(MA,E,r)){var p=e,v=t,g=r,y=n,m=a,b=i,C=o,S=h;e=p,t=v,r=g,n=y,a=m,i=b,o=C,u=S;continue e}if(f(jk,E,I)){var p=zA(I)+" "+e,v=t,g=f(bk,E,r),y=n,m=a,b=i,C=o,S=h;e=p,t=v,r=g,n=y,a=m,i=b,o=C,u=S;continue e}var p=zA(I)+" "+e,v=t,g=f(bk,E,r),y=n,m=f(Sa,I,a),b=i,C=o,S=h;e=p,t=v,r=g,n=y,a=m,i=b,o=C,u=S;continue e;case"TransformComponent":var E=d.a,A=d.b,p=e,v=t,g=f(bk,E,r),y=f(Fk,n,A),m=a,b=i,C=o,S=h;e=p,t=v,r=g,n=y,a=m,i=b,o=C,u=S;continue e;case"Width":var k=d.a;if(f(MA,Tk,r)){var p=e,v=t,g=r,y=n,m=a,b=i,C=o,S=h;e=p,t=v,r=g,n=y,a=m,i=b,o=C,u=S;continue e}switch(k.$){case"Px":var $=k.a,p=cA.widthExact+" width-px-"+xi($)+" "+e,v=t,g=f(bk,Tk,r),y=n,m=f(Sa,l(Bk,"width-px-"+xi($),"width",xi($)+"px"),a),b=i,C=o,S=h;e=p,t=v,r=g,n=y,a=m,i=b,o=C,u=S;continue e;case"Content":var p=e+" "+cA.widthContent,v=t,g=f(bk,wk,f(bk,Tk,r)),y=n,m=a,b=i,C=o,S=h;e=p,t=v,r=g,n=y,a=m,i=b,o=C,u=S;continue e;case"Fill":var N=k.a;if(1===N){var p=e+" "+cA.widthFill,v=t,g=f(bk,VA,f(bk,Tk,r)),y=n,m=a,b=i,C=o,S=h;e=p,t=v,r=g,n=y,a=m,i=b,o=C,u=S;continue e}var p=e+" "+cA.widthFillPortion+" width-fill-"+xi(N),v=t,g=f(bk,VA,f(bk,Tk,r)),y=n,m=f(Sa,l(Bk,cA.any+"."+cA.row+" > "+ZA("width-fill-"+xi(N)),"flex-grow",xi(1e5*N)),a),b=i,C=o,S=h;e=p,t=v,r=g,n=y,a=m,i=b,o=C,u=S;continue e;default:var R=Kk(k),x=R.a,_=R.b,L=R.c,p=e+" "+_,v=t,g=f(Ek,x,f(bk,Tk,r)),y=n,m=B(L,a),b=i,C=o,S=h;e=p,t=v,r=g,n=y,a=m,i=b,o=C,u=S;continue e}case"Height":var P=d.a;if(f(MA,Ck,r)){var p=e,v=t,g=r,y=n,m=a,b=i,C=o,S=h;e=p,t=v,r=g,n=y,a=m,i=b,o=C,u=S;continue e}switch(P.$){case"Px":var $=P.a,D=xi($)+"px",U="height-px-"+D,p=cA.heightExact+" "+U+" "+e,v=t,g=f(bk,Ck,r),y=n,m=f(Sa,l(Bk,U,"height ",D),a),b=i,C=o,S=h;e=p,t=v,r=g,n=y,a=m,i=b,o=C,u=S;continue e;case"Content":var p=cA.heightContent+" "+e,v=t,g=f(bk,Sk,f(bk,Ck,r)),y=n,m=a,b=i,C=o,S=h;e=p,t=v,r=g,n=y,a=m,i=b,o=C,u=S;continue e;case"Fill":var N=P.a;if(1===N){var p=cA.heightFill+" "+e,v=t,g=f(bk,OA,f(bk,Ck,r)),y=n,m=a,b=i,C=o,S=h;e=p,t=v,r=g,n=y,a=m,i=b,o=C,u=S;continue e}var p=e+" "+cA.heightFillPortion+" height-fill-"+xi(N),v=t,g=f(bk,OA,f(bk,Ck,r)),y=n,m=f(Sa,l(Bk,cA.any+"."+cA.column+" > "+ZA("height-fill-"+xi(N)),"flex-grow",xi(1e5*N)),a),b=i,C=o,S=h;e=p,t=v,r=g,n=y,a=m,i=b,o=C,u=S;continue e;default:var O=Vk(P),x=O.a,_=O.b,L=O.c,p=e+" "+_,v=t,g=f(Ek,x,f(bk,Ck,r)),y=n,m=B(L,a),b=i,C=o,S=h;e=p,t=v,r=g,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,v=f(Pk,"main",t),g=r,y=n,m=a,b=i,C=o,S=h;e=p,t=v,r=g,n=y,a=m,i=b,o=C,u=S;continue e;case"Navigation":var p=e,v=f(Pk,"nav",t),g=r,y=n,m=a,b=i,C=o,S=h;e=p,t=v,r=g,n=y,a=m,i=b,o=C,u=S;continue e;case"ContentInfo":var p=e,v=f(Pk,"footer",t),g=r,y=n,m=a,b=i,C=o,S=h;e=p,t=v,r=g,n=y,a=m,i=b,o=C,u=S;continue e;case"Complementary":var p=e,v=f(Pk,"aside",t),g=r,y=n,m=a,b=i,C=o,S=h;e=p,t=v,r=g,n=y,a=m,i=b,o=C,u=S;continue e;case"Heading":var F=M.a;if(F<=1){var p=e,v=f(Pk,"h1",t),g=r,y=n,m=a,b=i,C=o,S=h;e=p,t=v,r=g,n=y,a=m,i=b,o=C,u=S;continue e}if(F<7){var p=e,v=f(Pk,"h"+xi(F),t),g=r,y=n,m=a,b=i,C=o,S=h;e=p,t=v,r=g,n=y,a=m,i=b,o=C,u=S;continue e}var p=e,v=f(Pk,"h6",t),g=r,y=n,m=a,b=i,C=o,S=h;e=p,t=v,r=g,n=y,a=m,i=b,o=C,u=S;continue e;case"Paragraph":var p=e,v=t,g=r,y=n,m=a,b=i,C=o,S=h;e=p,t=v,r=g,n=y,a=m,i=b,o=C,u=S;continue e;case"Button":var p=e,v=t,g=r,y=n,m=a,b=f(Sa,f(mk,"role","button"),i),C=o,S=h;e=p,t=v,r=g,n=y,a=m,i=b,o=C,u=S;continue e;case"Label":var V=M.a,p=e,v=t,g=r,y=n,m=a,b=f(Sa,f(mk,"aria-label",V),i),C=o,S=h;e=p,t=v,r=g,n=y,a=m,i=b,o=C,u=S;continue e;case"LivePolite":var p=e,v=t,g=r,y=n,m=a,b=f(Sa,f(mk,"aria-live","polite"),i),C=o,S=h;e=p,t=v,r=g,n=y,a=m,i=b,o=C,u=S;continue e;default:var p=e,v=t,g=r,y=n,m=a,b=f(Sa,f(mk,"aria-live","assertive"),i),C=o,S=h;e=p,t=v,r=g,n=y,a=m,i=b,o=C,u=S;continue e}case"Nearby":var K=d.a,H=d.b,L=function(){switch(H.$){case"Empty":return a;case"Text":H.a;return a;case"Unstyled":H.a;return a;default:var e=H.a;return B(a,e.styles)}}(),p=e,v=t,g=r,y=n,m=L,b=i,C=l(_k,K,H,o),S=h;e=p,t=v,r=g,n=y,a=m,i=b,o=C,u=S;continue e;case"AlignX":var j=d.a;if(f(MA,Ik,r)){var p=e,v=t,g=r,y=n,m=a,b=i,C=o,S=h;e=p,t=v,r=g,n=y,a=m,i=b,o=C,u=S;continue e}var p=Dk(j)+" "+e,v=t,g=function(e){switch(j.$){case"CenterX":return f(bk,PA,e);case"Right":return f(bk,LA,e);default:return e}}(f(bk,Ik,r)),y=n,m=a,b=i,C=o,S=h;e=p,t=v,r=g,n=y,a=m,i=b,o=C,u=S;continue e;default:var q=d.a;if(f(MA,Ak,r)){var p=e,v=t,g=r,y=n,m=a,b=i,C=o,S=h;e=p,t=v,r=g,n=y,a=m,i=b,o=C,u=S;continue e}var p=Uk(q)+" "+e,v=t,g=function(e){switch(q.$){case"CenterY":return f(bk,DA,e);case"Bottom":return f(bk,_A,e);default:return e}}(f(bk,Ak,r)),y=n,m=a,b=i,C=o,S=h;e=p,t=v,r=g,n=y,a=m,i=b,o=C,u=S;continue e}}}),Gk={$:"Untransformed"},zk=Gk,Yk=a(function(e,t,r,n){return l(yk,e,n,g(qk,gA(e),t,uA,zk,tr,tr,sA,Ja(r)))}),Wk=function(e){return tA(BA(e))},Jk=r(function(e,t){var r=t.url,n=t.label;return d(Yk,iA,rA("a"),f(Sa,tA(GI(r)),f(Sa,tA(zI("noopener noreferrer")),f(Sa,tA(YI("_blank")),f(Sa,eA(XI),f(Sa,JI(XI),f(Sa,Wk(cA.contentCenterX+" "+cA.contentCenterY+" "+cA.link),e)))))),nA(m([n])))}),Qk=a(function(e,t,r,n){return{$:"Rgba",a:e,b:t,c:r,d:n}}),Xk=n(function(e,t,r){return d(Qk,e,t,r,1)}),Zk=xA(14),e$=n(function(e,t,r){return{$:"Colored",a:e,b:t,c:r}}),t$=r(function(e,t){return{$:"StyleClass",a:e,b:t}}),r$=function(e){var t=e.a,r=e.b,n=e.c,a=e.d;return qA(t)+"-"+qA(r)+"-"+qA(n)+"-"+qA(a)},n$=function(e){return f(t$,Zk,l(e$,"fc-"+r$(e),"color",e))},a$={align:va,label:"cantConnectNoWeb3",mainParagraphs:m([m([Na("You need a web3 provider (such as "),f(Jk,m([n$(l(Xk,0,0,1))]),{label:Na("Metamask"),url:"https://metamask.io/"}),Na(") to Connect.")]),m([Na("Until you connect, DAIHard will operate in read-only mode.")])]),noticeType:Gh},i$={align:va,label:"invalidUrl",mainParagraphs:m([m([Na("I don't understand that URL...")]),m([Na("I'll just set you down here. Maybe check the URL and try again?")])]),noticeType:Sg},o$=function(e){return{$:"Active",a:e}},u$=function(e){return{$:"OnlyNetwork",a:e}},s$=Xs(f(Oa,Da,f(Oa,id,od("Error decoding hex to BigInt")))),c$=function(){return Xs(function(e){switch(e){case"0x0":return pi(!1);case"0x1":return pi(!0);default:return hi("Error decoding "+e+"as bool.")}})}(),f$=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}}}}}}}}}}}},l$=function(e){return JC(m([f(is,_a,e),us(La)]))},d$=f(Sl,l$(f(Wl,"status",c$)),f(Sl,l$(f(Wl,"root",Qs)),l(eS,"logsBloom",Qs,l(eS,"logs",pS(vS),f(Sl,l$(f(Wl,"contractAddress",tS)),l(eS,"cumulativeGasUsed",s$,l(eS,"gasUsed",s$,l(eS,"blockNumber",SC,l(eS,"blockHash",iS,l(eS,"transactionIndex",SC,l(eS,"transactionHash",lS,us(f$)))))))))))),h$=function(e){var t=e.a;return Da(t)},p$=f(Oa,h$,Vi),v$=r(function(e,t){return th({decoder:d$,method:"eth_getTransactionReceipt",params:m([p$(t)]),url:e})}),g$=n(function(e,t,r){return{$:"TrackTx",a:e,b:t,c:r}}),y$=r(function(e,t){return{$:"TxMined",a:e,b:t}}),m$=r(function(e,t){return{$:"TxSent",a:e,b:t}}),b$=r(function(e,t){return f(Bu,function(e){return e.toMsg},f(kg,function(e){return e.b},f(kg,function(e){return e.onMinedTagger},f(kd,t,e))))}),C$=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}}}}}}}}}}}},S$=function(e){return JC(m([WC(La),f(is,_a,e)]))},E$=l(eS,"input",Qs,l(eS,"gas",SC,l(eS,"gasPrice",s$,l(eS,"value",s$,l(eS,"to",S$(tS),l(eS,"from",tS,l(eS,"transactionIndex",SC,l(eS,"blockNumber",S$(SC),l(eS,"blockHash",function(e){return f(Ws,function(t){return"0x"===t||"0x0"===t?us(La):f(Ri,function(e){return C(e,I("0"))},_s(t))?us(La):f(is,_a,e)},Qs)}(iS),l(eS,"nonce",SC,l(eS,"hash",lS,us(C$)))))))))))),T$=r(function(e,t){return th({decoder:E$,method:"eth_getTransactionByHash",params:m([p$(t)]),url:e})}),w$=r(function(e,t){return{attempts:e,sleep:t}}),I$=r(function(e,t){var r=e.attempts,n=e.sleep,a=r-1;return f(gh,function(e){return a>0?f(oh,function(e){return f(I$,f(w$,a,n),t)},Gw(1e3*n)):Qd(e)},t)}),A$=r(function(e,t){return f(oh,function(r){return f(I$,{attempts:30,sleep:1},f(T$,e,t))},Gw(250))}),B$=r(function(e,t){return f(I$,{attempts:60,sleep:5},f(v$,e,t))}),k$=function(e){return{$:"Mined",a:e}},$$=function(e){return Bu(function(t){return A(t,{status:k$(e)})})},N$=function(e){return{$:"Sent",a:e}},R$=function(e){return Bu(function(t){return A(t,{status:N$(e)})})},x$=function(e){return{$:"Signed",a:e}},_$=function(e){return Bu(function(t){return A(t,{status:x$(e)})})},L$=function(e){return"Nothing"!==e.$},P$=r(function(e,t){var r=t.a;switch(e.$){case"NoOp":return T($u(r),qu);case"TxSigned":var n=e.a,a=e.b,i=f(kd,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(Um,t,Xd(a))}return qu}(),s=function(e){var t=w(o.onSignedTagger,o.onBroadcastTagger,o.onMinedTagger);if("Just"===t.a.$)return qu;if("Just"===t.b.$){var r=t.b.a;return f(Um,r,Xd(hi(e)))}if("Just"===t.c.$){var n=t.c.a,a=n.a;return f(Um,a,Xd(hi(e)))}t.a,t.b,t.c;return qu};if("Ok"===a.$){var c=a.a,d=L$(o.onBroadcastTagger)||L$(o.onMinedTagger)?f(Vu,r.tagger,f(yh,m$(n),f(A$,r.nodePath,c))):qu;return T($u(A(r,{txs:l(Ud,n,_$(c),r.txs)})),ju(m([u,d])))}var h=a.a;return T($u(r),ju(m([u,s(h)])))}return T($u(r),qu);case"TxSent":var n=e.a,p=e.b,v=f(kd,n,r.txs);if("Just"===v.$){var o=v.a;if("Ok"===p.$){var g=p.a,y=function(){return"Just"===o.onMinedTagger.$?f(Vu,r.tagger,f(yh,y$(n),f(B$,r.nodePath,g.hash))):qu}(),d=function(){var e=o.onBroadcastTagger;if("Just"===e.$){var t=e.a;return f(Um,t,Xd(pi(g)))}return qu}();return T($u(A(r,{txs:l(Ud,n,R$(g),r.txs)})),ju(m([d,y])))}var h=p.a,s=function(){var e=T(o.onBroadcastTagger,o.onMinedTagger);if("Just"===e.a.$){var t=e.a.a;return f(Um,t,Xd(hi("Error with TxSent stuff")))}if("Just"===e.b.$){var r=e.b.a,n=r.a;return f(Um,n,Xd(hi("Error with TxSent stuff")))}e.a,e.b;return qu}();return T($u(r),s)}return T($u(r),qu);case"TxMined":var n=e.a,b=e.b,S=f(kd,n,r.txs);if("Just"===S.$){var o=S.a;if("Ok"===b.$){var E=b.a,I=function(){var e=o.onMinedTagger;if("Just"===e.$){if("Nothing"===e.a.b.$){var t=e.a,a=t.a;t.b;return f(Um,a,Xd(pi(E)))}var i=e.a,a=i.a,u=i.b.a,s={currentDepth:1,doneWatching:!1,lastCheckedBlock:E.blockNumber,minedInBlock:E.blockNumber,reOrg:!1,stopWatchingAtBlock:E.blockNumber+(u.confirmations-1),txHash:E.hash};return ju(m([f(Vu,r.tagger,f(yh,f(g$,n,s),EC(r.nodePath))),f(Um,a,Xd(pi(E))),f(Um,u.toMsg,Xd(s))]))}return qu}();return T($u(A(r,{txs:l(Ud,n,$$(E),r.txs)})),I)}var h=b.a,B=function(){var e=o.onMinedTagger;if("Just"===e.$){var t=e.a,r=t.a;return f(Um,r,Xd(hi("TxReceipt decoding failure")))}return qu}();return T($u(r),B)}return T($u(r),qu);case"TrackTx":if("Ok"===e.c.$){var n=e.a,k=e.b,$=e.c.a,N=A(k,{currentDepth:$-k.minedInBlock+1,lastCheckedBlock:$});if(C($,k.stopWatchingAtBlock)){var R=f(b$,r.txs,n);if("Just"===R.$){var x=R.a;return T($u(r),f(Um,x,f(gh,function(e){return Xd(A(N,{doneWatching:!0,reOrg:!0}))},f(oh,function(e){return Xd(A(N,{doneWatching:!0}))},f(v$,r.nodePath,k.txHash)))))}return T($u(r),qu)}if(C($,k.lastCheckedBlock))return T($u(r),f(Vu,r.tagger,f(yh,f(g$,n,k),f(oh,function(e){return EC(r.nodePath)},Gw(2e3)))));var _=f(b$,r.txs,n);if("Just"===_.$){var x=_.a;return T($u(r),ju(m([f(Vu,r.tagger,f(yh,f(g$,n,N),f(oh,function(e){return EC(r.nodePath)},Gw(2e3)))),f(Um,x,Xd(N))])))}return T($u(r),qu)}var n=e.a,h=e.c.a;return T($u(r),qu);default:var h=e.a;return T($u(r),qu)}}),D$=Jt,U$=ca,O$=r(function(e,t){if("Nothing"===e.$)return t;var r=e.a;return t+":"+xi(r)}),M$=n(function(e,t,r){return"Nothing"===t.$?r:B(r,B(e,t.a))}),F$=function(e){var t=function(){return"Http"===e.protocol.$?"http://":"https://"}();return l(M$,"#",e.fragment,l(M$,"?",e.query,B(f(O$,e.port_,B(t,e.host)),e.path)))},V$=r(function(e,t){return e<0?La:dd(f(ed,e,t))}),K$=r(function(e,t){if(e<0)return t;var r=Dl(f(ed,e,t)),n=f($c,e,t);if("Nothing"===r.$)return t;var a=r.a;return f(Vg,n,a)}),H$=n(function(e,t,r){if(e<0)return r;var n=f(ed,e,r),a=f($c,e,r);if(n.b){var i=n.a,o=n.b;return B(a,f(Sa,t(i),o))}return r}),j$=r(function(e,t){return f(H$,e,Jo(t))}),q$=r(function(e,t){return f(so,function(t){return A(t,{currentRoute:e})},function(){switch(e.$){case"Create":var r=e.a,n=f(vm,t.wallet,r),a=f(Gu,t.txSentry,f(Qu,DI,n.chainCmd)),i=a.a,o=a.b,u=a.c;return f(Y$,B(f(ys,DI,n.cmdUps),f(ho,rs,u)),T(A(t,{submodel:PI(n.model),txSentry:i}),ju(m([f(Vu,DI,n.cmd),o]))));case"CryptoSwap":var n=Dg(t.wallet),s=f(Gu,t.txSentry,f(Qu,OI,n.chainCmd)),i=s.a,o=s.b,u=s.c;return f(Y$,B(f(ys,OI,n.cmdUps),f(ho,rs,u)),T(A(t,{submodel:UI(n.model),txSentry:i}),ju(m([f(Vu,OI,n.cmd),o]))));case"Trade":var c=e.a,d=e.b,n=function(){var e=l(pC,c,d,t.tradeCaches);if("Just"===e.$&&"LoadedTrade"===e.a.$){var r=e.a.a;return f(wS,t.wallet,r)}return l(qC,t.wallet,c,d)}(),h=f(Gu,t.txSentry,f(Qu,jI,n.chainCmd)),i=h.a,o=h.b,u=h.c;return f(Y$,B(f(ys,jI,n.cmdUps),f(ho,rs,u)),T(A(t,{submodel:HI(n.model),txSentry:i}),ju(m([f(Vu,jI,n.cmd),o]))));case"Marketplace":var p=vb(t.wallet),v=p.a,g=p.b;return T(A(t,{submodel:FI(v)}),ju(m([f(Vu,VI,g)])));case"AgentHistory":var y=e.a,b=f(ly,t.wallet,y),C=b.a,S=b.b;return T(A(t,{submodel:RI(C)}),ju(m([f(Vu,xI,S)])));default:return T(f(Kg,i$,t),qu)}}())}),G$=r(function(e,t){var r=t.submodel;switch(r.$){case"CreateModel":var n=r.a,a=f(mm,e,n),i=f(Gu,t.txSentry,f(Qu,DI,a.chainCmd)),o=i.a,u=i.b,s=i.c;return f(Y$,B(f(ys,DI,a.cmdUps),f(ho,rs,s)),T(A(t,{submodel:PI(a.model),txSentry:o}),ju(m([f(Vu,DI,a.cmd),u]))));case"CryptoSwapModel":var c=r.a,a=f(Zm,e,c),l=f(Gu,t.txSentry,f(Qu,OI,a.chainCmd)),o=l.a,u=l.b,s=l.c;return f(Y$,B(f(ys,OI,a.cmdUps),f(ho,rs,s)),T(A(t,{submodel:UI(a.model),txSentry:o}),ju(m([f(Vu,OI,a.cmd),u]))));case"TradeModel":var d=r.a,a=f(BS,e,d),h=f(Gu,t.txSentry,f(Qu,jI,a.chainCmd)),o=h.a,u=h.b,s=h.c;return f(Y$,B(f(ys,jI,a.cmdUps),f(ho,rs,s)),T(A(t,{submodel:HI(a.model),txSentry:o}),ju(m([f(Vu,jI,a.cmd),u]))));case"MarketplaceModel":var p=r.a,a=f(Ab,e,p),v=f(Gu,t.txSentry,f(Qu,VI,a.chainCmd)),o=v.a,u=v.b,s=v.c;return f(Y$,B(f(ys,VI,a.cmdUps),f(ho,rs,s)),T(A(t,{submodel:FI(a.model),txSentry:o}),ju(m([f(Vu,VI,a.cmd),u]))));default:var g=r.a,a=f(py,e,g),y=f(Gu,t.txSentry,f(Qu,xI,a.chainCmd)),o=y.a,u=y.b,s=y.c;return f(Y$,B(f(ys,xI,a.cmdUps),f(ho,rs,s)),T(A(t,{submodel:RI(a.model),txSentry:o}),ju(m([f(Vu,xI,a.cmd),u]))))}}),z$=r(function(e,t){var r=t.a,n=t.b,a=f(W$,_I(e),r),i=a.a,o=a.b;return T(i,ju(m([n,o])))}),Y$=r(function(e,t){var r=t.a,n=t.b;return l(Wa,z$,T(r,n),e)}),W$=r(function(e,t){switch(e.$){case"CmdUp":var r=e.a;switch(r.$){case"Web3Connect":return f(W$,LI,t);case"GotoRoute":var n=r.a;return f(W$,MI(n),t);case"GTag":var a=r.a;return T(t,lC(cC(a)));case"UserNotice":var i=r.a;return T(f(Kg,i,t),lC(cC(d(Bs,"user notice","user notice",i.label,0))));case"BrowserNotification":var o=r.a,u=r.b,s=r.c;return T(t,d(Bb,vC,o,u,s));default:return T(t,gC(cr))}case"DismissNotice":var c=e.a;return T(A(t,{userNotices:f(K$,c,t.userNotices)}),qu);case"LinkClicked":var h=e.a,p=function(){if("Internal"===h.$){var e=h.a;return f(U$,t.key,F$(e))}var r=h.a;return D$(r)}();return T(t,p);case"UrlChanged":var v=e.a;return f(J$,v,t);case"GotoRoute":var g=e.a;return f(Rg,function(e){return ju(m([e,lC(cC(d(Bs,"GotoRoute","navigation",xb(g),0))),f(U$,t.key,xb(g))]))},f(q$,g,t));case"Tick":var y=e.a;return T(A(t,{time:y}),qu);case"ConnectToWeb3":return"NoneDetected"===t.wallet.$?T(f(Kg,a$,t),qu):T(t,sC(cr));case"WalletStatus":var b=e.a,C=function(){var e=b.account;if("Nothing"===e.$)return qu;var t=e.a;return dC(f(fC,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 T(A(t,{userAddress:b.account,wallet:u$(b.networkId)}),C);case"UserPubkeySet":var S=e.a,E=f(cd,Qs,S);if("Ok"===E.$){var w=E.a,I=T(t.userAddress,t.wallet);if("Just"===I.a.$){if("OnlyNetwork"===I.b.$){var k=I.a.a,$=I.b.a,N=o$(l($y,$,k,w));return f(G$,ky(N),A(t,{wallet:N}))}return T(f(Kg,f(Ra,"Unexpected wallet state encounted when setting commPubkey!",T(t.userAddress,t.wallet)),t),qu)}I.a;return T(f(Kg,f(Ra,"User pubkey set, but I can no longer find the user address!",La),t),qu)}var R=E.a;return T(l(ni,Kg,f(Ra,"error decoding commPubkey from JS",R),t),qu);case"CreateMsg":var x=e.a,_=t.submodel;if("CreateModel"===_.$){var L=_.a,P=f(Xm,x,L),D=f(Gu,t.txSentry,f(Qu,DI,P.chainCmd)),U=D.a,O=D.b,M=D.c;return f(Y$,B(f(ys,DI,P.cmdUps),f(ho,rs,M)),T(A(t,{submodel:PI(P.model),txSentry:U}),ju(m([f(Vu,DI,P.cmd),O]))))}return T(t,qu);case"CryptoSwapMsg":var F=e.a,V=t.submodel;if("CryptoSwapModel"===V.$){var K=V.a,P=f(xg,F,K),H=f(Gu,t.txSentry,f(Qu,OI,P.chainCmd)),U=H.a,O=H.b,M=H.c;return f(Y$,B(f(ys,OI,P.cmdUps),f(ho,rs,M)),T(A(t,{submodel:UI(P.model),txSentry:U}),ju(m([f(Vu,OI,P.cmd),O]))))}return T(t,qu);case"TradeMsg":var j=e.a,q=t.submodel;if("TradeModel"===q.$){var G=q.a,P=f(eI,j,G),z=f(Gu,t.txSentry,f(Qu,jI,P.chainCmd)),U=z.a,O=z.b,M=z.c;return f(Y$,B(f(ys,jI,P.cmdUps),f(ho,rs,M)),T(A(t,{submodel:HI(P.model),txSentry:U}),ju(m([f(Vu,jI,P.cmd),O]))))}return T(t,qu);case"MarketplaceMsg":var Y=e.a,W=t.submodel;if("MarketplaceModel"===W.$){var J=W.a,P=f(wb,Y,J);return f(Y$,f(ys,VI,P.cmdUps),T(A(t,{submodel:FI(P.model)}),f(Vu,VI,P.cmd)))}return T(t,qu);case"AgentHistoryMsg":var Q=e.a,X=t.submodel;if("AgentHistoryModel"===X.$){var Z=X.a,P=f(Ay,Q,Z),ee=f(Gu,t.txSentry,f(Qu,xI,P.chainCmd)),U=ee.a,O=ee.b,M=ee.c;return f(Y$,B(f(ys,xI,P.cmdUps),f(ho,rs,M)),T(A(t,{submodel:RI(P.model),txSentry:U}),ju(m([f(Vu,xI,P.cmd),O]))))}return T(t,qu);case"TxSentryMsg":var te=e.a,re=function(){var e=t.txSentry;if("Just"===e.$){var r=e.a;return f(so,_a,f(P$,te,r))}return T(La,qu)}(),U=re.a,ne=re.b;return T(A(t,{txSentry:U}),ne);case"TradeCacheMsg":var ae=e.a,ie=e.b,oe=f(V$,ae,t.tradeCaches);if("Nothing"===oe.$)return f(z$,rs(f(Ra,"Encountered an out-of-range error when trying to route a TradeCacheMsg",La)),T(t,qu));var ue=oe.a,P=f(NI,ie,ue);return T(A(t,{tradeCaches:l(j$,ae,P.tradeCache,t.tradeCaches)}),f(Vu,KI(ae),P.cmd));case"ClickHappened":return f(G$,By,t);case"NoOp":return T(t,qu);default:var R=e.a;f(ka,"test",R);return T(t,qu)}}),J$=r(function(e,t){return C(xb(t.currentRoute),e.path)?T(t,qu):f(q$,uC(e),t)}),Q$=ze("txIn",QC),X$=qe("txOut",Zi),Z$=function(e){if("Token"===e.$){if("EthDai"===e.a.$){e.a;return"Dai"}e.a;return"Kovan Dai"}switch(e.a.$){case"Eth":e.a;return"Ether";case"Kovan":e.a;return"Kovan Ether";default:e.a;return"xDai"}},eN=function(e){return{$:"EventSentryMsg",a:e}},tN=function(e){var t=f(OC,eN,gd(e)),r=t.a,n=t.b;return w({dataFetchState:l(EI,La,0,0),eventSentry:r,factory:e,trades:qa},n,m([d(ks,"tradeCache init","processing",Z$(e),0)]))},rN=function(e){return{$:"InitialNumTradesFetched",a:e}},nN=function(e){return f(oI,e.factory,rN)},aN=function(e){var t=tN(e),r=t.a,n=t.b,a=t.c;return w(r,ju(m([n,nN(r)])),a)},iN=function(e){return{$:"TxSentryMsg",a:e}},oN={align:va,label:"noWeb3Provider",mainParagraphs:m([m([Na("No web3 provider detected. Is "),f(Jk,m([n$(l(Xk,0,0,1))]),{label:Na("Metamask"),url:"https://metamask.io/"}),Na(" or some other web3 provider installed and unlocked?")])]),noticeType:Gh},uN={$:"TopLeft"},sN={align:uN,label:"screenToSmall",mainParagraphs:m([m([Na("Your screen is quite small--things may be very broken! We will be addressing this soon.")])]),noticeType:Gh},cN={align:va,label:"wrongWeb3Network",mainParagraphs:m([m([Na("Make sure your wallet is set to a compatible network.")]),m([Na(" At the moment DAIHard works on: xDai, the Kovan Ethereum Test Net, or Ethereum Main Net.")])]),noticeType:Sg},fN={$:"NoneDetected"},lN=function(e){return f(Bu,gd,$g(e))},dN={$:"ETCMain"},hN={$:"ETCTest"},pN={$:"Expanse"},vN={$:"Kovan"},gN={$:"Mainnet"},yN=function(e){return{$:"Private",a:e}},mN={$:"Rinkeby"},bN={$:"Ropsten"},CN={$:"RskMain"},SN={$:"RskTest"},EN=function(e){switch(e){case 1:return gN;case 2:return pN;case 3:return bN;case 4:return mN;case 30:return CN;case 31:return SN;case 42:return vN;case 41:return dN;case 62:return hN;default:return yN(e)}},TN=n(function(e,t,r){var n=e.a,a=e.b;return $u({inPort:a,nodePath:r,outPort:n,ref:1,tagger:t,txs:Bd})}),wN=n(function(e,t,n){var a=e.networkId?u$(EN(e.networkId)):fN,i=f(Bu,function(e){return l(TN,T(X$,Q$),iN,e)},lN(a)),o=e.width<1024?_a(sN):La,u=f(ho,aN,Es),s=Dg(a),c=function(){return C(a,fN)?_a(oN):"Nothing"===$g(a).$?_a(cN):La}(),d=GT(m([o,c])),h=w(f(ho,Ug,u),f(ho,Og,u),f(ho,Mg,u)),p=h.a,v=h.b,g=h.c,y=zb(f(Ni,r(function(e,t){return f(ys,KI(e),t)}),g)),b=ju(f(Ni,r(function(e,t){return f(Vu,KI(e),t)}),v)),S=f(Gu,i,f(Qu,OI,s.chainCmd)),E=S.a,I=S.b,A=S.c,k=f(Y$,y,f(J$,t,{currentRoute:Fg,key:n,screenWidth:e.width,submodel:UI(s.model),time:yp(0),tradeCaches:p,txSentry:E,userAddress:La,userNotices:tr,wallet:a})),$=k.a,N=k.b;return f(Y$,f(ho,gs(OI),s.cmdUps),T(f(Hg,B(d,A),$),ju(m([b,N,f(Vu,OI,s.cmd),I]))))}),IN={$:"Refresh"},AN=function(e){return{$:"UpdateNow",a:e}},BN=Me,kN=r(function(e,t){return{$:"Every",a:e,b:t}}),$N=r(function(e,t){return{processes:t,taggers:e}}),NN=Xd(f($N,Bd,Bd)),RN=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(E(c,r)<0){var p=r,v=n,g=T(h,l(e,c,f,u));r=p,n=v,i=g;continue e}return E(c,r)>0?T(o,l(a,r,n,u)):T(h,d(t,c,f,n,u))}return T(o,l(a,r,n,u))}}),c=l(Ww,s,T(Ea(i),u),o),f=c.a,h=c.b;return l(Wa,r(function(t,r){var n=t.a,a=t.b;return l(e,n,a,r)}),h,f)}),xN=r(function(e,t){var r=e.a,n=e.b,a=f(kd,r,t);if("Nothing"===a.$)return l(Fu,r,m([n]),t);var i=a.a;return l(Fu,r,f(Sa,n,i),t)}),_N=r(function(e,t){return{$:"Zone",a:e,b:t}}),LN=pa,PN=n(function(e,t,r){if(t.b){var n=t.a,a=t.b,i=ig(f(LN,n,f(Fd,e,n)));return f(oh,function(t){return l(PN,e,a,l(Fu,n,t,r))},i)}return Xd(r)}),DN=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 w(n,a,f(oh,function(e){return i},ag(t)))}),u=l(Wa,xN,Bd,t),s=n(function(e,t,r){var n=r.a,a=r.b,i=r.c;return w(f(Sa,e,n),a,i)}),c=a(function(e,t,r,n){var a=n.a,i=n.b,o=n.c;return w(a,l(Fu,e,r,i),o)}),d=p(RN,s,c,o,u,i,w(tr,Bd,Xd(cr))),h=d.a,v=d.b,g=d.c;return f(oh,function(e){return Xd(f($N,u,e))},f(oh,function(t){return l(PN,e,h,v)},g))}),UN=function(e){return Ie(function(t){t(Te(e(Date.now())))})}(yp),ON=n(function(e,t,r){var n=f(kd,t,r.taggers);if("Nothing"===n.$)return Xd(r);var a=n.a,i=function(t){return fh(f(ho,function(r){return f(Md,e,r(t))},a))};return f(oh,function(e){return Xd(r)},f(oh,i,UN))}),MN=r(function(e,t){var r=t.a,n=t.b;return f(kN,r,f(Ju,e,n))});yn.Time=De(NN,DN,ON,0,MN);var FN=Oe("Time"),VN=r(function(e,t){return FN(f(kN,e,t))}),KN=function(e){return BN(m([f(VN,500,AN),f(VN,5e3,Jo(IN))]))},HN=function(e){return{$:"Refresh",a:e}},jN=function(e){return f(VN,2e3,HN)},qN=function(e){return{$:"UpdateNow",a:e}},GN=function(e){return BN(m([f(VN,1e4,Jo(_g)),f(VN,500,qN)]))},zN={$:"Refresh"},YN=function(e){return{$:"UpdateNow",a:e}},WN=function(e){return BN(m([f(VN,500,YN),f(VN,5e3,Jo(zN))]))},JN=function(e){return{$:"DecryptionFinished",a:e}},QN=ze("decryptionFinished",QC),XN=ze("encryptionFinished",QC),ZN=function(e){return{$:"EncryptionFinished",a:e}},eR=function(e){return{$:"Refresh",a:e}},tR=function(e){return BN(m([f(VN,3e3,eR),XN(ZN),QN(function(e){return mw(JN(e))})]))},rR=Cn,nR=function(e){var t=e.submodel;switch(t.$){case"CreateModel":t.a;return f(rR,DI,jN());case"CryptoSwapModel":t.a;return f(rR,OI,GN());case"TradeModel":t.a;return f(rR,jI,tR());case"MarketplaceModel":t.a;return f(rR,VI,WN());default:t.a;return f(rR,xI,KN())}},aR=ze("userPubkeyResult",QC),iR=ze("walletSentryPort",QC),oR={$:"CheckForNewTrades"},uR={$:"UpdateTradePhases"},sR=function(e){return BN(m([f(VN,5e3,function(e){return oR}),f(VN,3e3,function(e){return uR})]))},cR=function(e){return{$:"Tick",a:e}},fR=function(e){return{$:"UserPubkeySet",a:e}},lR=function(e){return{$:"WalletStatus",a:e}},dR=function(e){return f(Ra,"Error decoding JS walletSentry: "+e,La)},hR=function(e){return{$:"ErrorDecoding",a:e}},pR=r(function(e,t){return{$:"TxSigned",a:e,b:t}}),vR=l(os,r(function(e,t){return{ref:e,txHash:t}}),f(Wl,"ref",YT),f(Wl,"txHash",l$(lS))),gR=function(e){var t=f(cd,vR,e);if("Ok"===t.$){var r=t.a,n=r.txHash;if("Just"===n.$){var a=n.a;return f(pR,r.ref,pi(a))}return f(pR,r.ref,hi("Problem signing/broadcasting Tx. Ref #"+xi(r.ref)))}t.a;return hR("Error decoding tx data")},yR=function(e){var t=e.a;return f(rR,t.tagger,t.inPort(gR))},mR=f(is,EN,YT),bR=Xs(f(Oa,hp,f(Oa,od("Failure decoding stringy int"),js(EN)))),CR=JC(m([bR,mR])),SR=r(function(e,t){return{account:e,networkId:t}}),ER=l(os,SR,f(Wl,"account",l$(tS)),f(Wl,"networkId",CR)),TR=n(function(e,t,r){var n=f(cd,ER,r);if("Err"===n.$){var a=n.a;return e(Mi(a))}return t(n.a)}),wR=BN(tr),IR=function(e){var t=f(Oa,dR,f(Oa,rs,_I));return BN(B(m([f(VN,1e3,cR),iR(f(TR,t,lR)),f(Tu,wR,f(Bu,yR,e.txSentry)),aR(fR),BN(f(Ni,r(function(e,t){return f(rR,KI(e),t)}),f(ho,sR,e.tradeCaches)))]),m([nR(e)])))},AR=function(e){return{$:"LinkClicked",a:e}},BR=function(e){return{$:"UrlChanged",a:e}},kR={$:"ClickHappened"},$R={$:"Generic"},NR=$R,RR=r(function(e,t){return d(Yk,iA,NR,f(Sa,eA(XI),f(Sa,JI(XI),e)),nA(m([t])))}),xR=function(e){return{$:"Fill",a:e}},_R=xR(1),LR=r(function(e,t){return{$:"Nearby",a:e,b:t}}),PR={$:"NoAttribute"},DR=r(function(e,t){return"Empty"===t.$?PR:f(LR,e,t)}),UR={$:"InFront"},OR=function(e){return f(DR,UR,e)},MR=fs,FR=function(e){return{$:"Px",a:e}},VR=FR,KR=n(function(e,t,r){return d(Qk,e/255,t/255,r/255,1)}),HR=Qk,jR=xA(8),qR=function(e){return f(t$,jR,l(e$,"bg-"+r$(e),"background-color",e))},GR=xA(19),zR=function(e){return fp(m([e.inset?"box-inset":"box-",qA(e.offset.a)+"px",qA(e.offset.b)+"px",qA(e.blur)+"px",qA(e.size)+"px",r$(e.color)]))},YR=function(e){var t={blur:e.blur,color:e.color,inset:!1,offset:e.offset,size:e.size};return f(t$,GR,l(Bk,zR(t),"box-shadow",XA(t)))},WR=function(){var e=l(KR,255,144,0);return f(RR,m([eA(_R),JI(VR(400)),qR(e),YR({blur:30,color:e,offset:T(0,0),size:30}),OR(f(RR,m([eA(_R),JI(VR(80)),qR(l(KR,10,33,108)),YR({blur:20,color:d(HR,0,0,0,.4),offset:T(0,0),size:8})]),MR))]),MR)}(),JR={$:"Active"},QR={$:"Important"},XR={$:"Normal"},ZR=l(Xk,1,1,1),ex=xA(2),tx=i(function(e,t,r,n,a){return{$:"PaddingStyle",a:e,b:t,c:r,d:n,e:a}}),rx=r(function(e,t){return C(e,t)?f(t$,ex,h(tx,"p-"+xi(e),e,e,e,e)):f(t$,ex,h(tx,"p-"+xi(e)+"-"+xi(t),t,e,t,e))}),nx=xA(21),ax=r(function(e,t){return{$:"Class",a:e,b:t}}),ix=f(ax,nx,cA.cursorPointer),ox=xA(17),ux=function(e){return f(t$,ox,l(Bk,"br-"+xi(e),"border-radius",xi(e)+"px"))},sx=function(e){return{$:"Normal",a:e}},cx=$n,fx=r(function(e,t){return f(cx,e,sx(t))}),lx=function(e){return f(fx,"click",us(e))},dx=f(Ju,tA,lx),hx=xA(13),px=f(ax,hx,cA.textSemiBold),vx=xA(4),gx=function(e){return{$:"FontSize",a:e}},yx=function(e){return f(t$,vx,gx(e))},mx=n(function(e,t,r){var n=function(){switch(r.$){case"Normal":return tr;case"Active":return m([ux(4),qR(l(Xk,0,0,1))]);default:return m([ux(4),qR(l(Xk,.9,0,0))])}}();return f(RR,B(m([f(rx,23,12),yx(22),px,n$(ZR),ix,dx(t)]),n),Na(e))}),bx=l(KR,244,0,103),Cx=function(e){return{$:"AlignX",a:e}},Sx={$:"CenterX"},Ex=Cx(Sx),Tx=xA(3),wx=n(function(e,t,r){return{$:"SpacingStyle",a:e,b:t,c:r}}),Ix=r(function(e,t){return"spacing-"+xi(e)+"-"+xi(t)}),Ax=function(e){return f(t$,Tx,l(wx,f(Ix,e,e),e,e))},Bx=function(e){return{$:"Describe",a:e}},kx={$:"Paragraph"},$x=r(function(e,t){return d(Yk,EA,NR,f(Sa,Bx(kx),f(Sa,eA(_R),f(Sa,Ax(5),e))),nA(t))}),Nx=f(ax,hx,cA.bold),Rx=f(RR,m([yx(29),n$(ZR),Nx,Ex,ix,dx(MI(Fg))]),f($x,tr,m([Na("DAI"),f(RR,m([n$(bx)]),Na("Hard"))]))),xx={$:"Right"},_x=Cx(xx),Lx={$:"AsColumn"},Px=Lx,Dx=r(function(e,t){return d(Yk,Px,NR,f(Sa,Wk(cA.contentTop+" "+cA.contentLeft),f(Sa,JI(XI),f(Sa,eA(XI),e))),nA(t))}),Ux={$:"AsRow"},Ox=Ux,Mx=r(function(e,t){return d(Yk,Ox,NR,f(Sa,Wk(cA.contentLeft+" "+cA.contentCenterY),f(Sa,eA(XI),f(Sa,JI(XI),e))),nA(t))}),Fx=function(e){return f(Mx,m([eA(_R),Ax(30),f(rx,30,17)]),m([l(mx,"Crypto Swap",MI(Fg),function(){return"CryptoSwapModel"===e.submodel.$?JR:XR}()),l(mx,"Custom Trade",MI(Pb(La)),function(){return"CreateModel"===e.submodel.$?JR:XR}()),l(mx,"Marketplace",MI(Db),function(){var t=e.submodel;if("MarketplaceModel"===t.$){t.a;return JR}return XR}()),function(){var t=Ng(e.wallet);if("Just"===t.$){var r=t.a;return l(mx,"My Trades",MI(Lb(r.address)),function(){var t=e.submodel;if("AgentHistoryModel"===t.$){return C(t.a.agentAddress,r.address)?JR:XR}return XR}())}return l(mx,"Connect to Wallet",LI,QR)}(),f(Dx,m([_x,Ax(0),f(rx,8,0)]),m([Rx]))]))},Vx=function(e){return function(t){return C(t.parameters.initiatorAddress,e.agentAddress)||C(t.state.responder,_a(e.agentAddress))}},Kx=function(e){return Eu(e)},Hx=r(function(e,t){return f(Eu,eb(e),t)}),jx=function(e){return f(Eu,function(e){return CE(e.parameters)},cI(e))},qx={$:"BurnWindow"},Gx={$:"Offer"},zx={$:"PaymentWindow"},Yx={$:"Price"},Wx={$:"ResponderProfit"},Jx=function(e){return{$:"AlignY",a:e}},Qx={$:"CenterY"},Xx=Jx(Qx),Zx=xA(20),e_=f(ax,Zx,cA.clip),t_=xR,r_=function(e){return f(t$,ex,h(tx,"p-"+xi(e),e,e,e,e))},n_=r(function(e,t){return f(RR,m([eA(t_(e)),JI(VR(60)),e_]),f(RR,m([r_(12),Xx,eA(_R)]),t))}),a_=function(e){switch(e.$){case"Phase":case"Expires":case"Offer":return 1;case"Price":return 2;case"ResponderProfit":return 1;case"PaymentWindow":default:return 2}},i_=function(e){return{$:"JustImage",a:e}},o_=i_({description:"down",src:"/DAIHard/static/img/arrow-down.svg"}),u_=qI("alt"),s_=function(e){return f(qI,"src",nt(e))},c_=r(function(e,t){var r=t.src,n=t.description,a=f(Eu,function(e){switch(e.$){case"Width":case"Height":return!0;default:return!1}},e);return d(Yk,iA,NR,f(Sa,Wk(cA.imageContainer),e),nA(m([d(Yk,iA,rA("img"),B(m([tA(s_(r)),tA(u_(n))]),a),nA(tr))])))}),f_=r(function(e,t){if("None"===t.$)return MR;var r=t.a;return f(c_,e,r)}),l_=i_({description:"up",src:"/DAIHard/static/img/arrow-up.svg"}),d_=function(e){return{$:"ChangeSort",a:e}},h_=f(ax,hx,cA.textMedium),p_=function(e){return f(RR,m([h_,yx(17)]),Na(function(){switch(e.$){case"Phase":return"Phase";case"Expires":return"Expiring";case"Offer":return"Offer";case"Price":return"For";case"ResponderProfit":return"Responder Profit";case"PaymentWindow":return"Payment Window";default:return"Burn Window"}}()))},v_=r(function(e,t){return f(Mx,m([Ax(5),ix,dx(d_(e))]),m([p_(e),function(){if("Just"===t.$){var e=t.a;return f(RR,m([Xx]),f(f_,m([eA(VR(8))]),function(){return"Ascending"===e.$?o_:l_}()))}return MR}()]))}),g_=r(function(e,t){return f(n_,a_(t),f(v_,t,e))}),y_=r(function(e,t){return f(Mx,m([eA(_R)]),f(ho,function(t){var r=C(e.a,t)?_a(e.b):La;return f(g_,r,t)},t))}),m_=l(KR,150,150,150),b_=function(e){switch(e.$){case"Open":return 1;case"Committed":return 2;case"Judgment":return 3;default:return 4}},C_=r(function(e,t){return C(e.symbol,t.symbol)?f(Co,e.amount,t.amount):f(Co,e.symbol,t.symbol)}),S_=function(e){if("Ok"===e.$){var t=e.a;return _a(t)}return La},E_=r(function(e,t){return f(Bu,function(e){var r=t.terms.price.amount*e,n=Jy(t.parameters.tradeAmount),a=function(){return"Buyer"===t.parameters.initiatorRole.$?T(n,r):T(r,n)}(),i=a.a;return(a.b-i)/i},f(kg,S_,f(kg,function(t){return f(qh,t,e)},kp(t.terms.price.symbol))))}),T_=n(function(e,t,r){return f(e,r,t)}),w_=r(function(e,t){var n=t.a;return(C(t.b,cy)?Zi:T_)(function(){switch(n.$){case"Phase":return r(function(t,r){return C(t.state.phase,r.state.phase)?d(w_,e,T(pb,Ey),t,r):f(Co,b_(t.state.phase),b_(r.state.phase))});case"Expires":return r(function(e,t){return f(vp,e.derived.phaseEndTime,t.derived.phaseEndTime)});case"Offer":return r(function(e,t){return f(cb,e.parameters.tradeAmount,t.parameters.tradeAmount)});case"Price":return r(function(e,t){return f(C_,e.terms.price,t.terms.price)});case"ResponderProfit":return r(function(t,r){return f(Tu,ya,l(Yh,Co,f(E_,e,t),f(E_,e,r)))});case"PaymentWindow":return r(function(e,t){return f(vp,e.parameters.autoabortInterval,t.parameters.autoabortInterval)});default:return r(function(e,t){return f(vp,e.parameters.autoreleaseInterval,t.parameters.autoreleaseInterval)})}}())}),I_=r(function(e,t){return{$:"TradeClicked",a:e,b:t}}),A_=function(e){return f(RR,m([eA(_R),JI(_R),e_]),f($x,m([yx(12)]),m([Na(e.info)])))},B_=function(e){return f(Tu,MR,f(Bu,A_,dd(e)))},k_=function(e){if("Token"===e.$){if("EthDai"===e.a.$){e.a;return"Dai"}e.a;return"(k)Dai"}switch(e.a.$){case"Eth":e.a;return"ETH";case"Kovan":e.a;return"(k)ETH";default:e.a;return"xDai"}},$_=function(e){return{$:"TimeLeft",a:e}},N_=function(e){return{$:"TimeUp",a:e}},R_=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 yp(0)}}),x_=r(function(e,t){var r=f(R_,t.state.phase,t),n=f(mp,e,t.state.phaseStartTime),a=f(mp,r,n);return _h(a)>0?$_(T(a,r)):N_(r)}),__=function(e){switch(e.$){case"Open":return"Open";case"Committed":return"Committed";case"Judgment":return"Judgment";default:return"Closed"}},L_=l(Xk,0,0,0),P_=l(KR,51,183,2),D_=function(e){return B(e>0?"+":"",function(e){return e+"%"}(e<.1?Wh(function(e){return e/10}(lv(1e3*e))):xi(lv(100*e))))},U_=r(function(e,t){var r=D_(t);if("0%"===r)return f(RR,m([yx(16)]),Na("0%"));var n=r;return f(RR,m([n$(t>=0===e?P_:bx),yx(16)]),Na(n))}),O_=function(e){return _h(e)<0},M_=a(function(e,t,r,n){return{days:e,hours:t,min:r,sec:n}}),F_=function(e){var t=Ph(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(M_,iT(t),iT(r),iT(n),iT(a))}(f(Tu,T(To(0),To(0)),f(tu,n,To(60))))}(f(Tu,T(To(0),To(0)),f(tu,r,To(3600))))}(f(Tu,T(To(0),To(0)),f(tu,t,To(86400))))},V_=a(function(e,t,n,a){for(;;){var i=n.a,o=n.b;if(!O_(a)){var u=r(function(e,t){return B(l(cu,2,I("0"),xi(e)),t)}),s=_h(a)>0?i:o,c=F_(a),d=c.days||c.hours?i:o,h=c.days?i:o;return f(Mx,B(m([Ax(5)]),e),m([f(RR,B(m([n$(h)]),t),Na(f(u,c.days,"d"))),f(RR,B(m([n$(d)]),t),Na(f(u,c.hours,"h"))),f(RR,B(m([n$(s)]),t),Na(f(u,c.min,"m")))]))}var p=e,v=t,g=T(i,o),y=yp(0);e=p,t=v,n=g,a=y}}),K_=l(KR,233,237,242),H_={$:"Behind"},j_=function(e){return f(DR,H_,e)},q_=r(function(e,t){var r=lv(200*e),n=200-r,a=f(RR,m([eA(t_(n))]),MR),i=m([JI(VR(3)),ux(20)]),o=f(RR,B(i,m([eA(t_(r)),qR(t)])),MR),u=f(RR,B(i,m([eA(_R),qR(K_)])),MR);return f(Mx,m([eA(_R),j_(u)]),m([o,a]))}),G_=l(Xk,1,1,0),z_=r(function(e,t){return _h(e)/_h(t)}),Y_=a(function(e,t,r,n){var a=r.a,i=r.b,o=n.a,u=n.b,s=f(z_,o,u),c=(f(RR,m([Ex]),d(V_,tr,tr,T(a,i),o)),s<.1?bx:s<.2?G_:P_);return f(Dx,B(m([Ax(5)]),e),m([d(V_,m([Ex]),t,T(a,i),o),f(q_,1-s,c)]))}),W_={$:"None"},J_=W_,Q_=i_,X_=Bp(f(ho,function(e){var t=e.a;return T(t,T(e.b,_a(Q_({description:t,src:"/DAIHard/static/img/currencies/"+t+".svg"}))))},m([T("AUD",_a("$")),T("CLP",_a("$")),T("EUR",_a("€")),T("IDR",_a("Rp")),T("KRW",_a("₩")),T("NZD",_a("$")),T("RUB",_a("₽")),T("TRY",_a("₺")),T("BRL",_a("R$")),T("CNY",_a("¥")),T("GBP",_a("£")),T("ILS",_a("₪")),T("MXN",_a("$")),T("PHP",_a("₱")),T("SEK",_a("kr")),T("TWD",_a("NT$")),T("CAD",_a("$")),T("CZK",_a("Kč")),T("HKD",_a("$")),T("INR",_a("₹")),T("MYR",_a("RM")),T("PKR",_a("₨")),T("SGD",_a("$")),T("USD",_a("$")),T("CHF",_a("Fr")),T("DKK",_a("kr")),T("HUF",_a("Ft")),T("JPY",_a("¥")),T("NOK",_a("kr")),T("PLN",_a("zł")),T("THB",_a("฿")),T("ZAR",_a("R")),T("VND",_a("₫"))]))),Z_=function(e){var t=Wh(e.amount)+" "+e.symbol,r=f(kd,e.symbol,X_);if("Just"===r.$){var n=r.a,a=n.a;return B(f(Tu,"",a),t)}return t},eL=function(e){var t=function(){var t=f(kd,e.symbol,X_);if("Nothing"===t.$)return MR;var r=t.a,n=r.b;return f(f_,m([JI(VR(26))]),f(Tu,J_,n))}();return f(Mx,m([Ax(4)]),m([t,f(RR,m([n$(d(HR,0,0,0,.5)),h_,eA(VR(50))]),Na(e.symbol)),Na(Z_(e))]))},tL=function(e){return LE(Ho(ll(e)))},rL=function(e){if(C(f(_o,ll(e),To(0)),ba))return"-"+rL(tL(e));var t=function(e){return f(Ks,4,f(Tu,e,f(Bu,Wh,f(Bu,function(e){return e/100},f(Bu,Ka,f(Bu,lv,f(Bu,oi(100),Kh(e))))))))},r=zy(ll(e)),n=f(Ry,".",r);if(!n.b)return r;if(n.b.b){ka("Error interpreting evmValueToString result. More than one decimal??");return"???"}switch(n.a){case 0:return t("0"+r);case 1:return t(r);default:var a=n.a;return f(Tu,f(Ks,a,r),f(Bu,xi,f(Bu,lv,Kh(r))))}},nL=a(function(e,t,r,n){return f(n_,a_(r),function(){switch(r.$){case"Phase":var a=__(n.state.phase),i=T(f(x_,e,n),n.state.phase);e:for(;;){if("TimeLeft"===i.a.$){if("Closed"===i.b.$)break e;var o=i.a.a,u=f(z_,o.a,o.b)<.05?bx:L_;return f(Dx,m([Ax(3)]),m([Na(a),d(Y_,m([eA(_R)]),m([yx(16)]),T(u,K_),o)]))}if("Closed"===i.b.$)break e;var s=i.a.a;return f(Mx,m([Ax(6),n$(m_)]),m([Na(a),f(RR,m([yx(16)]),Na("(stale)"))]))}i.b;return Na(a);case"Expires":if("Open"===n.state.phase.$){var c=f(x_,e,n);if("TimeLeft"===c.$){var o=c.a,u=f(z_,o.a,o.b)<.05?bx:L_;return d(Y_,m([eA(_R)]),m([yx(16)]),T(u,K_),o)}var s=c.a;return d(Y_,m([eA(_R)]),m([yx(16)]),T(bx,K_),T(yp(0),s))}return MR;case"Offer":return f(Mx,m([Ax(5)]),m([Na(function(){return"Buyer"===n.parameters.initiatorRole.$?"Buying ":"Selling "}()+(rL(n.parameters.tradeAmount)+" ")+k_(n.factory))]));case"Price":return eL(n.terms.price);case"ResponderProfit":return f(Tu,MR,f(Bu,U_(!0),f(E_,t,n)));case"PaymentWindow":var l=function(){return"Seller"===n.parameters.initiatorRole.$?bx:P_}(),h=E(_h(n.parameters.autoabortInterval),216e5)<0?l:L_;return d(V_,tr,tr,T(h,K_),n.parameters.autoabortInterval);default:var l=function(){return"Seller"===n.parameters.initiatorRole.$?P_:bx}(),h=E(_h(n.parameters.autoabortInterval),216e5)<0?l:L_;return d(V_,tr,tr,T(h,K_),n.parameters.autoreleaseInterval)}}())}),aL=a(function(e,t,r,n){return f(Dx,m([eA(_R),Ax(1),qR(ZR),ix,dx(f(I_,n.factory,n.id))]),m([f(Mx,m([eA(_R),Ax(1)]),f(ho,function(r){return d(nL,e,t,r,n)},r)),f(n_,1,B_(n.terms.paymentMethods))]))}),iL=ir,oL=xA(28),uL=function(e){return f(t$,oL,l(e$,"bc-"+r$(e),"border-color",e))},sL=i(function(e,t,r,n,a){return{$:"BorderWidth",a:e,b:t,c:r,d:n,e:a}}),cL=function(e){return f(t$,Hk,h(sL,"b-"+xi(e),e,e,e,e))},fL=i(function(e,t,r,n,a){return f(Dx,m([eA(_R),cL(2),ux(8),uL(m_),Ax(2),qR(m_),e_]),f(ho,l(aL,e,r,n),f(iL,f(w_,r,t.orderBy),a)))}),lL=i(function(e,t,r,n,a){return f(Dx,m([eA(_R),JI(_R),Ax(5)]),m([f(y_,t.orderBy,n),h(fL,e,t,r,n,a)]))}),dL=a(function(e,t,r,n){return"pad-"+xi(e)+"-"+xi(t)+"-"+xi(r)+"-"+xi(n)}),hL=function(e){var t=e.top,r=e.right,n=e.bottom,a=e.left;return C(t,r)&&C(t,n)&&C(t,a)?f(t$,ex,h(tx,"p-"+xi(t),t,t,t,t)):f(t$,ex,h(tx,d(dL,t,r,n,a),t,r,n,a))},pL=Wk(cA.italic),vL=a(function(e,t,r,n){var a=f(Hx,n.filters,zb(f(ho,function(e){return f(Kx,Vx(n),jx(e))},r)));return C(a,tr)?f(RR,m([Ex,yx(24),hL({bottom:0,left:0,right:0,top:30}),pL]),Na(t?"No trades found with those filters.":"Initializing Trade Cache...")):f(ps,gy,h(lL,e,n.tradeTable,n.prices,m([fy,Gx,Yx,Wx,zx,qx]),a))}),gL=function(e){return{$:"FiltersMsg",a:e}},yL=function(e){switch(e.$){case"Phase":return"Phases";case"Role":return"Role";default:return"Offer Type"}},mL=n(function(e,t,r){return{$:"SetOption",a:e,b:t,c:r}}),bL=mk,CL={$:"Left"},SL=Cx(CL),EL=n(function(e,t,r){if("HiddenLabel"===t.$){t.a;return d(Yk,Px,rA("label"),e,nA(m([r])))}var n=t.a,a=t.b,i=t.c,o=d(Yk,iA,NR,a,nA(m([i])));switch(n.$){case"Above":return d(Yk,Px,rA("label"),e,nA(m([o,r])));case"Below":return d(Yk,Px,rA("label"),e,nA(m([r,o])));case"OnRight":return d(Yk,Ox,rA("label"),e,nA(m([r,o])));default:return d(Yk,Ox,rA("label"),e,nA(m([o,r])))}}),TL=function(e){return{$:"Label",a:e}},wL=function(e){if("HiddenLabel"===e.$){var t=e.a;return Bx(TL(t))}return PR},IL=function(e){return"HiddenLabel"===e.$},AL=function(e){var t=function(t){var r=e(t);if("Nothing"===r.$)return Js("No key matched");var n=r.a;return us(n)},r=f(Ws,t,f(Wl,"key",Qs));return tA(f(fx,"keyup",r))},BL=function(e){return f(xn,"tabIndex",xi(e))},kL=f(Ju,tA,BL),$L={$:"LivePolite"},NL=Bx($L),RL=r(function(e,t){var r=t.label,n=t.icon,a=t.checked,i=t.onChange,o=B(m([IL(r)?PR:Ax(6),tA(lx(i(!a))),NL,AL(function(e){return C(e,"Enter")?_a(i(!a)):C(e," ")?_a(i(!a)):La}),kL(0),ix,SL,eA(_R)]),e);return l(EL,o,r,d(Yk,iA,NR,m([tA(f(bL,"role","checkbox")),tA(f(bL,"aria-checked",a?"true":"false")),wL(r),Xx,JI(_R),eA(XI)]),nA(m([n(a)]))))}),xL=Br,_L=function(e){return e*xL/180},LL=xA(26),PL=function(e){return{$:"MoveY",a:e}},DL=r(function(e,t){return{$:"TransformComponent",a:e,b:t}}),UL=function(e){return f(DL,LL,PL(-e))},OL=xA(24),ML=r(function(e,t){return{$:"Rotate",a:e,b:t}}),FL=function(e){return f(DL,OL,f(ML,w(0,0,1),e))},VL=r(function(e,t){return f(t$,Hk,h(sL,"b-"+xi(e)+"-"+xi(t),t,e,t,e))}),KL=function(e){var t=e.bottom,r=e.top,n=e.left,a=e.right;return C(r,t)&&C(n,a)?C(r,a)?cL(r):f(VL,n,r):f(t$,Hk,h(sL,"b-"+xi(r)+"-"+xi(a)+"-"+xi(t)+"-"+xi(n),r,a,t,n))},HL=xA(12),jL=f(ax,HL,cA.textCenter),qL=l(Xk,1,1,1),GL=function(e){return f(RR,m([Wk("focusable"),eA(VR(14)),JI(VR(14)),n$(qL),Xx,yx(9),jL,ux(3),uL(e?l(Xk,59/255,.6,252/255):l(Xk,211/255,211/255,211/255)),YR({blur:1,color:e?d(HR,238/255,238/255,238/255,0):l(Xk,238/255,238/255,238/255),offset:T(0,0),size:1}),qR(e?l(Xk,59/255,.6,252/255):qL),cL(e?0:1)]),e?f(RR,m([uL(qL),JI(VR(6)),eA(VR(9)),FL(_L(-45)),Ex,Xx,UL(1),KL({bottom:2,left:2,right:0,top:0})]),MR):MR)},zL=n(function(e,t,r){return{$:"Label",a:e,b:t,c:r}}),YL={$:"OnRight"},WL=zL(YL),JL=r(function(e,t){return f(RL,tr,{checked:t.checked,icon:GL,label:f(WL,tr,Na(t.label)),onChange:f(mL,e,t.label)})}),QL={$:"Top"},XL=Jx(QL),ZL=function(e){return f(Dx,m([Ax(15),XL]),m([f(RR,m([yx(28),h_]),Na(yL(e.type_))),f(Dx,m([Ax(5)]),f(ho,JL(e.type_),e.options))]))},eP=function(e){return f(Mx,m([Ax(20)]),f(ho,ZL,e))},tP={$:"NoneFound"},rP={$:"AllFetched"},nP={$:"FetchingTrades"},aP={$:"QueryingNumTrades"},iP=function(e){var t=e.dataFetchState.total;if("Nothing"===t.$)return aP;if(t.a){var r=t.a;return E(e.dataFetchState.loaded,r-e.dataFetchState.invalid)<0?nP:rP}return tP},oP=r(function(e,t){var r=function(e){return f(RR,m([yx(20),px,n$(m_),Ex]),Na(e))},n=f(Nl,Za(tP),f(ho,iP,e))?m([r("No trades found.")]):f(ho,r,GT(f(ho,function(e){switch(iP(e).$){case"QueryingNumTrades":return _a("Querying "+Z$(e.factory)+" Factory...");case"NoneFound":return La;case"FetchingTrades":return _a("Fetching "+Z$(e.factory)+" Trades...");default:return La}},e)));return f(RR,m([eA(_R),OR(f(Dx,m([Ax(5),SL]),n))]),f(RR,m([Ex]),f(ps,gL,eP(t.filters))))}),uP=l(Xk,.95,.98,1),sP=r(function(e,t){return{$:"Max",a:e,b:t}}),cP=r(function(e,t){return f(sP,e,t)}),fP=a(function(e,t,r,n){return f(Dx,m([hL({bottom:40,left:0,right:0,top:60}),Ax(60),eA(_R)]),m([f(Tu,MR,f(Bu,f(Ju,RR(m([n$(ZR),yx(38),Ex])),Na),t)),f(Dx,m([qR(uP),Ax(20),ux(8),e_,Ex,eA(f(cP,e,_R)),YR({blur:3,color:d(HR,0,0,0,.2),offset:T(0,0),size:1})]),m([f(RR,m([eA(_R),r_(15),qR(ZR),YR({blur:30,color:d(HR,0,0,0,.15),offset:T(0,0),size:0})]),f(RR,m([yx(16),n$(bx),Nx,Ex]),Na(r))),n]))]))}),lP=n(function(e,t,r){return d(fP,1800,La,function(){var e=Ng(r.wallet);return"Nothing"===e.$?"TRADE HISTORY FOR "+Ua(r.agentAddress):C(e.a.address,r.agentAddress)?"YOUR TRADES":"TRADE HISTORY FOR "+Ua(r.agentAddress)}(),f(Dx,m([eA(_R),r_(30)]),m([f(oP,t,r),function(){var n=f(Nl,f(Oa,iP,Za(rP)),t);return d(vL,e,n,t,r)}()])))}),dP={$:"DhDropdownClicked"},hP=function(e){return{$:"DhTypeChanged",a:e}},pP=function(e){return{$:"TradeAmountChanged",a:e}},vP=qI("id"),gP=tA,yP=gP(vP("inputError")),mP=function(e){return{$:"MayStopPropagation",a:e}},bP=r(function(e,t){return f(cx,e,mP(t))}),CP=function(e){return gP(f(bP,"click",us(T(e,!0))))},SP=Nn,EP=SP,TP=xA(33),wP={$:"Hover"},IP=r(function(e,t){return{$:"PseudoSelector",a:e,b:t}}),AP=Ln,BP=r(function(e,t){switch(t.$){case"NoAttribute":return PR;case"Describe":var r=t.a;return Bx(r);case"AlignX":var n=t.a;return Cx(n);case"AlignY":var a=t.a;return Jx(a);case"Width":var n=t.a;return ZI(n);case"Height":var n=t.a;return WI(n);case"Class":var n=t.a,a=t.b;return f(ax,n,a);case"StyleClass":var i=t.a,o=t.b;return f(t$,i,o);case"Nearby":var u=t.a,s=t.b;return f(LR,u,f(hs,e,s));case"Attr":var c=t.a;return tA(f(AP,e,c));default:var l=t.a,d=t.b;return f(DL,l,d)}}),kP=function(e){return f(BP,Dm,e)},$P=r(function(e,t){var r=t.a,n=t.b,a=kP(e);switch(a.$){case"StyleClass":var i=a.b;return T(f(Sa,i,r),n);case"TransformComponent":var o=(a.a,a.b);return T(r,f(Fk,n,o));default:return T(r,n)}}),NP=function(e){var t=l(Wa,$P,T(tr,Gk),e),r=t.a,n=t.b;return f(Sa,kk(n),r)},RP=function(e){return f(t$,TP,f(IP,wP,NP(e)))},xP=function(e){return f(Dx,m([uL(d(HR,0,0,0,.2)),cL(1),ux(5),qR(ZR),r_(10),gP(f(EP,"position","fixed")),gP(f(EP,"z-index","1000")),YR({blur:10,color:d(HR,0,0,0,.1),offset:T(2,2),size:0})]),f(ho,function(e){var t=e.a,r=e.b;return f(RR,m([f(rx,0,5),CP(r),RP(m([qR(l(Xk,.8,.8,1))]))]),t)},e))},_P=xA(25),LP=function(e){return{$:"MoveX",a:e}},PP=function(e){return f(DL,_P,LP(-e))},DP=a(function(e,t,r,n){return f(Mx,m([Ax(8),ix,CP(r),Xx,OR(t?f(RR,m([UL(15),PP(10),gP(f(EP,"position","fixed")),gP(f(EP,"z-index","1000"))]),xP(f(ho,function(e){return T(Na(k_(e)),n(e))},m([Cs(ms),bs(Ss)])))):MR)]),m([Na(k_(e)),f(f_,m([eA(VR(12))]),o_)]))}),UP=r(function(e,t){if("Nothing"===t.$)return MR;var r=t.a;return f(RR,B(m([ux(5),uL(l(Xk,.9,0,0)),cL(1),qR(l(Xk,1,.4,.4)),r_(5),Ex,Xx,eA(f(cP,200,XI)),yx(14)]),e),f($x,tr,m([Na(r)])))}),OP=f(ax,HL,cA.textRight),MP=In("span"),FP=qI("type"),VP=function(e){return T(e,!0)},KP=r(function(e,t){return l(ro,Wl,t,e)}),HP=f(KP,m(["target","value"]),Qs),jP=function(e){return f(bP,"input",f(is,VP,f(is,e,HP)))},qP=f(ax,Zx,cA.scrollbarsY),GP={$:"TextArea"},zP=f(Ju,tA,bL("autocomplete")),YP=function(e){var t=r(function(e,t){if("StyleClass"===e.$&&"SpacingStyle"===e.b.$){var r=e.b,n=(r.b,r.c);return"Nothing"===t.$?_a(n):t}return t}),n=l(ro,t,La,e);if("Nothing"===n.$)return PR;var a=n.a;return UL(ai(a/2))},WP=l(Xk,186/255,189/255,182/255),JP=f(rx,12,12),QP=m([JP,ux(3),uL(WP),qR(qL),cL(1),Ax(5),eA(_R),JI(XI)]),XP=function(e){if("Height"===e.$){var t=e.a;return _a(t)}return La},ZP=function(e){if("StyleClass"===e.$&&"PseudoSelector"===e.b.$&&"Focus"===e.b.a.$){var t=e.b;t.a;return!0}return!1},eD=function(e){e:for(;;)switch(e.$){case"Content":return!1;case"Px":case"Fill":return!0;case"Min":var t=e.b,r=t;e=r;continue e;default:var t=e.b;return!0}},tD=function(e){if("Label"!==e.$)return!0;switch(e.a.$){case"OnRight":case"OnLeft":return!1;case"Above":default:return!0}},rD=function(e){return{bottom:-e.bottom,left:-e.left,right:-e.right,top:-e.top}},nD=function(e){e:for(;;)switch(e.$){case"Fill":return!0;case"Content":case"Px":return!1;case"Min":default:var t=e.b,r=t;e=r;continue e}},aD=function(e){e:for(;;)switch(e.$){case"Content":return!1;case"Px":return!0;case"Fill":return!1;case"Min":default:var t=e.b,r=t;e=r;continue e}},iD=a(function(e,t,r,n){switch(r.$){case"Nearby":return A(n,{parent:f(Sa,r,n.parent)});case"Width":var a=r.a;return nD(a)?A(n,{fullParent:f(Sa,r,n.fullParent),input:f(Sa,r,n.input),parent:f(Sa,r,n.parent)}):t?A(n,{fullParent:f(Sa,r,n.fullParent)}):A(n,{parent:f(Sa,r,n.parent)});case"Height":var i=r.a;return t?nD(i)?A(n,{fullParent:f(Sa,r,n.fullParent),parent:f(Sa,r,n.parent)}):(aD(i),A(n,{parent:f(Sa,r,n.parent)})):A(n,{fullParent:f(Sa,r,n.fullParent),parent:f(Sa,r,n.parent)});case"AlignX":case"AlignY":return A(n,{fullParent:f(Sa,r,n.fullParent)});case"StyleClass":switch(r.b.$){case"SpacingStyle":r.b;return A(n,{fullParent:f(Sa,r,n.fullParent),input:f(Sa,r,n.input),parent:f(Sa,r,n.parent),wrapper:f(Sa,r,n.wrapper)});case"PaddingStyle":var o=(r.a,r.b),u=(o.a,o.b),s=o.c,c=o.d,l=o.e;if(e)return A(n,{cover:f(Sa,r,n.cover),parent:f(Sa,r,n.parent)});var d=hL({bottom:c-f(Vc,u,c),left:l,right:s,top:u-f(Vc,u,c)}),h=gP(f(EP,"line-height","calc(1.0em + "+xi(2*f(Vc,u,c))+"px)")),p=gP(f(EP,"height","calc(1.0em + "+xi(2*f(Vc,u,c))+"px)"));return A(n,{cover:f(Sa,r,n.cover),input:f(Sa,p,f(Sa,h,n.input)),parent:f(Sa,d,n.parent)});case"BorderWidth":r.b;return A(n,{cover:f(Sa,r,n.cover),parent:f(Sa,r,n.parent)});case"Transform":return A(n,{cover:f(Sa,r,n.cover),parent:f(Sa,r,n.parent)});case"FontSize":return A(n,{fullParent:f(Sa,r,n.fullParent)});case"FontFamily":r.b;return A(n,{fullParent:f(Sa,r,n.fullParent)});default:r.a,r.b;return A(n,{parent:f(Sa,r,n.parent)})}case"NoAttribute":return n;case"Attr":r.a;return A(n,{input:f(Sa,r,n.input)});case"Describe":return A(n,{input:f(Sa,r,n.input)});case"Class":return A(n,{parent:f(Sa,r,n.parent)});default:return A(n,{input:f(Sa,r,n.input)})}}),oD=n(function(e,t,r){return function(e){return{cover:Ja(e.cover),fullParent:Ja(e.fullParent),input:Ja(e.input),parent:Ja(e.parent),wrapper:Ja(e.wrapper)}}(l(Wa,f(iD,e,t),{cover:tr,fullParent:tr,input:tr,parent:tr,wrapper:tr},r))}),uD=function(e){var t=e.top,r=e.right,n=e.bottom,a=e.left;return xi(t)+"px "+xi(r)+"px "+xi(n)+"px "+xi(a)+"px"},sD=xA(0),cD=r(function(e,t){return{$:"Transparency",a:e,b:t}}),fD=function(e){var t=function(e){return 1-e}(f(Vc,1,f(ii,0,e)));return f(t$,sD,f(cD,"transparency-"+qA(t),t))},lD=l(Xk,136/255,138/255,133/255),dD=n(function(e,t,r){var n=e.a,a=e.b;return f(RR,B(t,B(m([n$(lD),Wk(cA.noTextSelection+" "+cA.passPointerEvents),e_,uL(d(HR,0,0,0,0)),qR(d(HR,0,0,0,0)),JI(_R),eA(_R),fD(r?1:0)]),n)),a)}),hD=ye,pD=r(function(e,t){return f(Rn,e,hD(t))}),vD=pD("spellcheck"),gD=f(Ju,tA,vD),yD=qI("value"),mD=f(Ju,tA,yD),bD=f(Ju,ds,Jo),CD=n(function(e,t,r){var n=B(QP,t),a=l(oD,C(e.type_,GP),tD(r.label),n),i=function(){var t=e.type_;if("TextInputNode"===t.$){t.a;return!1}return f(Tu,!1,f(Bu,eD,dd(Ja(f(cg,XP,n)))))}(),o=function(e){if("StyleClass"===e.$&&"PaddingStyle"===e.b.$){var t=(e.a,e.b),r=(t.a,t.b),n=t.c,a=t.d,i=t.e;return _a({bottom:f(ii,0,ai(a-3)),left:f(ii,0,ai(i-3)),right:f(ii,0,ai(n-3)),top:f(ii,0,ai(r-3))})}return La},u=f(Tu,{bottom:0,left:0,right:0,top:0},dd(Ja(f(cg,o,n)))),s=d(Yk,iA,function(){var t=e.type_;if("TextInputNode"===t.$){t.a;return rA("input")}return rA("textarea")}(),B(function(){var t=e.type_;if("TextInputNode"===t.$){var r=t.a;return m([tA(FP(r)),Wk(cA.inputText)])}return m([e_,JI(_R),Wk(cA.inputMultiline),YP(n),hL(u),tA(f(EP,"margin",uD(rD(u)))),tA(f(EP,"box-sizing","content-box"))])}(),B(m([mD(r.text),tA(jP(r.onChange)),wL(r.label),gD(e.spellchecked),f(Tu,PR,f(Bu,zP,e.autofill))]),a.input)),nA(tr)),c=function(){var t=e.type_;if("TextArea"===t.$)return d(Yk,iA,NR,B((i?Sa(qP):Zi)(m([eA(_R),f($l,ZP,n)?PR:Wk(cA.focusedWithin),Wk(cA.inputMultilineWrapper)])),a.parent),nA(m([d(Yk,EA,NR,f(Sa,eA(_R),f(Sa,JI(_R),f(Sa,OR(s),f(Sa,Wk(cA.inputMultilineParent),a.wrapper)))),nA(function(){if(""===r.text){var e=r.placeholder;if("Nothing"===e.$)return m([Na(" ")]);var t=e.a;return m([l(dD,t,tr,""===r.text)])}return m([bD(f(MP,m([BA(cA.inputMultilineFiller)]),m([dk(r.text+" ")])))])}()))])));t.a;return d(Yk,iA,NR,f(Sa,eA(_R),f(Sa,f($l,ZP,n)?PR:Wk(cA.focusedWithin),zb(m([a.parent,function(){var e=r.placeholder;if("Nothing"===e.$)return tr;var t=e.a;return m([j_(l(dD,t,a.cover,""===r.text))])}()])))),nA(m([s])))}();return l(EL,f(Sa,f(ax,nx,cA.cursorText),f(Sa,IL(r.label)?PR:Ax(5),f(Sa,NL,a.fullParent))),r.label,c)}),SD=CD({autofill:La,spellchecked:!1,type_:function(e){return{$:"TextInputNode",a:e}}("text")}),ED=a(function(e,t,r,n){return f(Mx,B(e,m([ux(20),f(rx,20,0),cL(1),qR(ZR),uL(d(HR,0,0,0,.1)),JI(VR(60))])),B(t,B(m([f(SD,m([cL(0),eA(_R),OP]),r)]),n)))}),TD=n(function(e,t,r){return f(Dx,B(e,m([Ax(5)])),m([f(RR,m([yx(20),f(rx,20,0),n$(bx)]),Na(t)),r]))}),wD={$:"Below"},ID=function(e){return f(DR,wD,e)},AD=function(e){return f(DL,LL,PL(e))},BD=function(e){return{$:"HiddenLabel",a:e}},kD=BD,$D=r(function(e,t){return l(TD,m([XL]),function(){return"Buyer"===t.inputs.userRole.$?"You're buying":"You're selling"}(),d(ED,m([eA(VR(200)),ID(f(UP,m([yP,AD(5)]),t.errors.daiAmount))]),m([d(DP,t.inputs.dhToken,t.showDhTypeDropdown,dP,hP)]),{label:kD("dai input"),onChange:pP,placeholder:La,text:t.inputs.daiAmount},tr))}),ND=function(e){return{$:"CmdUp",a:e}},RD=function(e){return f(Tu,Kw,$g(e))},xD=function(e){var t=function(){var t=jy(e.inputs.daiAmount);if("Just"===t.$){var r=t.a;return"There is a 1% fee of "+rL(f(hl,r,100))+" "+k_(RD(e.wallet))+"."}return"There is a 1% fee."}();return f(Mx,m([Ex,f(rx,20,10),qR(l(KR,10,33,108)),ux(8),Ax(5),dx(ND(d(ks,"click","misclick","fee notify element",0)))]),m([f(RR,m([yx(18),n$(l(KR,0,226,255)),px]),Na(t)),f(RR,m([yx(17),n$(ZR),h_]),Na("We only collect this fee when trades resolve successfully."))]))},_D=function(e){return{$:"FiatAmountChanged",a:e}},LD=function(e){return{$:"FiatTypeChanged",a:e}},PD=function(e){return{$:"ShowCurrencyDropdown",a:e}},DD=bD,UD=function(e){return{$:"AppendProperty",a:e}},OD=r(function(e,t){return UD(e+":"+t)}),MD=r(function(e,t){return f(OD,e,t.value)}),FD=MD("cursor"),VD={$:"Compatible"},KD={cursor:VD,value:"default"},HD=r(function(e,t){return{$:"ExtendSelector",a:e,b:t}}),jD=function(e){return{$:"PseudoClassSelector",a:e}},qD=function(e){return HD(jD(e))}("hover"),GD=n(function(e,t,r){return{$:"Node",a:e,b:t,c:r}}),zD=GD,YD=zD,WD=YD("span"),JD=n(function(e,t,r){return{$:"Attribute",a:e,b:t,c:r}}),QD=a(function(e,t,r,n){return{charsProcessed:n,hash:r,seed:t,shift:e}}),XD=r(function(e,t){return(65535&t)*e+(((t>>>16)*e&65535)<<16)}),ZD=r(function(e,t){return t<>>32-e}),eU=function(e){var t=e.hash?e.seed^f(XD,461845907,f(ZD,15,f(XD,3432918353,e.hash))):e.seed,r=t^e.charsProcessed,n=f(XD,2246822507,r^r>>>16),a=f(XD,3266489909,n^n>>>13);return(a^a>>>16)>>>0},tU=r(function(e,t){return f(XD,5,f(ZD,13,e^f(XD,461845907,f(ZD,15,f(XD,3432918353,t)))))+3864292196}),rU=r(function(e,t){var r=t.hash|(255&Ci(e))<";default:return""}},fO=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+"]"}},lO=function(e){switch(e.$){case"TypeSelectorSequence":var t=e.a.a,r=e.b;return f(_i,"",f(Sa,t,f(ho,fO,r)));case"UniversalSelectorSequence":var r=e.a;return Qi(r)?"*":f(_i,"",f(ho,fO,r));default:var t=e.a,r=e.b;return f(_i,"",f(Sa,t,f(ho,fO,r)))}},dO=function(e){var t=e.a,r=e.b;return f(_i," ",m([cO(t),lO(r)]))},hO=function(e){var t=e.a,r=e.b,n=e.c,a=f(Sa,lO(t),f(ho,dO,r)),i=f(_i,"",m([f(Tu,"",f(Bu,sO,n))]));return f(wc,f(_i," ",f(Eu,f(Ju,Po,Ol),a)),i)},pO=r(function(e,t){var r=t.a,n=t.b,a=t.c,i=f(_i,", ",f(ho,hO,f(Sa,r,n)));return f(_i,"",m([i," {\n",e,uO(a),"\n",e,"}"]))}),vO=function(e){switch(e.$){case"StyleBlockDeclaration":var t=e.a;return f(pO,"",t);case"MediaRule":var r=e.a,n=e.b;return"@media "+f(_i,",\n",f(ho,tO,r))+" {\n"+f(_i,"\n\n",f(ho,f(Ju,iO,pO(" ")),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"}},gO=function(e){var t=e.charset,r=e.imports,n=e.namespaces,a=e.declarations;return f(_i,"\n\n",f(Eu,f(Ju,Po,Ol),m([XU(t),f(_i,"\n",f(ho,nO,r)),f(_i,"\n",f(ho,aO,n)),f(_i,"\n\n",f(ho,vO,a))])))},yO=function(e){return gO(QU(YU(e)))},mO=function(e){return f(_i,"\n\n",f(ho,yO,e))},bO=function(e){return{$:"Snippet",a:e}},CO=n(function(e,t,r){return{$:"StyleBlock",a:e,b:t,c:r}}),SO=function(e){return{$:"StyleBlockDeclaration",a:e}},EO=r(function(e,t){var r=l(SU,t,tr,La);return bO(m([SO(l(CO,r,tr,e))]))}),TO=function(e){return Qi(e)?"unstyled":f(nu,I("_"),pu(f(nU,15739,mO(Zw(aU(Zw(f(EO,e,_U(tr)))))))))},wO=function(e){var t=TO(e),r=f(tB,"className",Vi(t));return l(JD,r,e,t)},IO=a(function(e,t,r,n){return f(e,f(Sa,wO(t),r),n)}),AO=function(e){return{$:"Unstyled",a:e}},BO=function(e){return AO(rB(e))},kO=BO,$O=r(function(e,t){return f(An,e,Ze(t))}),NO=function(e){return wn(Ze(e))},RO=r(function(e,t){var r=e.b,n=e.c;return Qi(r)?t:l(Fu,n,r,t)}),xO=function(e){return e.a},_O=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 T(f(Sa,T(r,o),a),i);case"Node":var u=n.a,s=n.b,c=n.c,h=l(Wa,RO,i,s),p=l(Wa,LO,T(tr,h),c),v=p.a,g=p.b,o=l($A,u,f(ho,xO,s),Ja(v));return T(f(Sa,T(r,o),a),g);case"NodeNS":var y=n.a,u=n.b,s=n.c,c=n.d,h=l(Wa,RO,i,s),m=l(Wa,LO,T(tr,h),c),v=m.a,g=m.b,o=d(NO,y,u,f(ho,xO,s),Ja(v));return T(f(Sa,T(r,o),a),g);case"KeyedNode":var u=n.a,s=n.b,c=n.c,h=l(Wa,RO,i,s),b=l(Wa,_O,T(tr,h),c),v=b.a,g=b.b,o=l(kA,u,f(ho,xO,s),Ja(v));return T(f(Sa,T(r,o),a),g);default:var y=n.a,u=n.b,s=n.c,c=n.d,h=l(Wa,RO,i,s),C=l(Wa,_O,T(tr,h),c),v=C.a,g=C.b,o=d($O,y,u,f(ho,xO,s),Ja(v));return T(f(Sa,T(r,o),a),g)}}),LO=r(function(e,t){var r=t.a,n=t.b;switch(e.$){case"Unstyled":var a=e.a;return T(f(Sa,a,r),n);case"Node":var i=e.a,o=e.b,u=e.c,s=l(Wa,RO,n,o),c=l(Wa,LO,T(tr,s),u),h=c.a,p=c.b,a=l($A,i,f(ho,xO,o),Ja(h));return T(f(Sa,a,r),p);case"NodeNS":var v=e.a,i=e.b,o=e.c,u=e.d,s=l(Wa,RO,n,o),g=l(Wa,LO,T(tr,s),u),h=g.a,p=g.b,a=d(NO,v,i,f(ho,xO,o),Ja(h));return T(f(Sa,a,r),p);case"KeyedNode":var i=e.a,o=e.b,u=e.c,s=l(Wa,RO,n,o),y=l(Wa,_O,T(tr,s),u),h=y.a,p=y.b,a=l(kA,i,f(ho,xO,o),Ja(h));return T(f(Sa,a,r),p);default:var v=e.a,i=e.b,o=e.c,u=e.d,s=l(Wa,RO,n,o),m=l(Wa,_O,T(tr,s),u),h=m.a,p=m.b,a=d($O,v,i,f(ho,xO,o),Ja(h));return T(f(Sa,a,r),p)}}),PO=r(function(e,t){return h(Pu,Lu,e,t,Du,Du)}),DO=r(function(e,t){for(;;){if(!t.b)return e;var r=t.a,n=r.b,a=r.c,i=t.b;if(Ol(a)){var o=e,u=i;e=o,t=u}else{var o=_a(T(a,n)),u=i;e=o,t=u}}}),UO=function(e){var t=f(DO,La,e);if("Nothing"===t.$)return Bd;var r=t.a,n=r.a,a=r.b;return f(PO,n,a)},OO=function(e){return{$:"ClassSelector",a:e}},MO=function(e){var t=e.a,r=e.b;return f(EO,r,_U(m([OO(t)])))},FO=function(e){return mO(Zw(aU(f(ho,MO,Ea(e)))))},VO=function(e){return l($A,"style",tr,Zw(rB(FO(e))))},KO=n(function(e,t,r){var n=f(ho,xO,t),a=UO(t),i=l(Wa,LO,T(tr,a),r),o=i.a,u=i.b,s=VO(u);return l($A,e,n,f(Sa,s,Ja(o)))}),HO=r(function(e,t){for(;;){if(!t.b)return!1;var r=t.a,n=r.a,a=t.b;if(C(e,n))return!0;var i=e,o=a;e=i,t=o}}),jO=r(function(e,t){e:for(;;){if(t.b){var r=t.a,n=r.a,a=t.b,i="_"+n;if(f(HO,i,a)){var o=i,u=a;e=o,t=u;continue e}return i}return e}}),qO=r(function(e,t){return T(f(jO,"_",t),VO(e))}),GO=n(function(e,t,r){var n=f(ho,xO,t),a=UO(t),i=l(Wa,_O,T(tr,a),r),o=i.a,u=i.b,s=f(qO,u,o);return l(kA,e,n,f(Sa,s,Ja(o)))}),zO=a(function(e,t,r,n){var a=f(ho,xO,r),i=UO(r),o=l(Wa,_O,T(tr,i),n),u=o.a,s=o.b,c=f(qO,s,u);return d($O,e,t,a,f(Sa,c,Ja(u)))}),YO=a(function(e,t,r,n){var a=f(ho,xO,r),i=UO(r),o=l(Wa,LO,T(tr,i),n),u=o.a,s=o.b,c=VO(s);return d(NO,e,t,a,f(Sa,c,Ja(u)))}),WO=function(e){switch(e.$){case"Unstyled":return e.a;case"Node":var t=e.a,r=e.b,n=e.c;return l(KO,t,r,n);case"NodeNS":var a=e.a,t=e.b,r=e.c,n=e.d;return d(YO,a,t,r,n);case"KeyedNode":var t=e.a,r=e.b,n=e.c;return l(GO,t,r,n);default:var a=e.a,t=e.b,r=e.c,n=e.d;return d(zO,a,t,r,n)}},JO=WO,QO=function(e){return DD(JO(d(IO,WD,m([qD(m([FD(KD)]))]),tr,m([kO(e)]))))},XO=function(e){return f(Bu,f_(m([JI(VR(26))])),hw(f(Bu,zs,f(kd,e,X_))))},ZO=r(function(e,t){return l(Ww,n(function(t,r,n){return f(e,t,r)?l(Fu,t,r,n):n}),Bd,t)}),eM=function(e){return f(ZO,r(function(t,r){return f(Fm,e,t)}),X_)},tM=G,rM=i(function(e,t,r,n,a){return{$:"Padding",a:e,b:t,c:r,d:n,e:a}}),nM=n(function(e,t,r){return{$:"Spaced",a:e,b:t,c:r}}),aM=function(e){return l(ro,r(function(e,t){var r=t.a,n=t.b;return T(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 _a(h(rM,n,a,i,o,u))}return La}(),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 _a(l(nM,a,t,i))}return La}())}),T(La,La),e)},iM=r(function(e,t){var r=aM(e),n=r.a,a=r.b;if("Nothing"===a.$)return d(Yk,Ox,NR,f(Sa,Wk(cA.contentLeft+" "+cA.contentCenterY+" "+cA.wrapped),f(Sa,eA(XI),f(Sa,JI(XI),e))),nA(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 E(r,u/2|0)>-1&&E(a,s/2|0)>-1?_a(hL({bottom:a-(s/2|0),left:i-(u/2|0),right:r-(u/2|0),top:t-(s/2|0)})):La}return La}();if("Just"===c.$){var h=c.a;return d(Yk,Ox,NR,f(Sa,Wk(cA.contentLeft+" "+cA.contentCenterY+" "+cA.wrapped),f(Sa,eA(XI),f(Sa,JI(XI),B(e,m([h]))))),nA(t))}var p=-s/2,v=-u/2;return d(Yk,iA,NR,e,nA(m([d(Yk,Ox,NR,f(Sa,Wk(cA.contentLeft+" "+cA.contentCenterY+" "+cA.wrapped),f(Sa,tA(f(EP,"margin",Wh(p)+"px "+Wh(v)+"px")),f(Sa,tA(f(EP,"width","calc(100% + "+xi(u)+"px)")),f(Sa,tA(f(EP,"height","calc(100% + "+xi(s)+"px)")),f(Sa,f(t$,Tx,l(wx,o,u,s)),tr))))),nA(t))])))}),oM=i(function(e,t,r,n,a){var i=f(kd,t,X_),o=f(SD,m([eA(VR(80)),JI(VR(40)),yx(24),h_,uL(K_),CP(r)]),{label:kD("currency type"),onChange:f(Oa,tM,n),placeholder:La,text:t}),u=function(){var r=T(e,i);if(r.a){if("Just"===r.b.$)return MR;r.b;return f(iM,m([eA(VR(350)),uL(L_),cL(1),qR(ZR),r_(10),Ex,gP(f(EP,"position","fixed")),gP(f(EP,"z-index","1000"))]),f(ho,function(e){var t=e.a,r=e.b,a=r.b;return f(Mx,m([eA(VR(80)),Ax(9),f(rx,0,5),CP(n(t)),RP(m([qR(l(Xk,.8,.8,1))]))]),m([f(f_,m([JI(VR(26))]),f(Tu,J_,a)),f(RR,m([yx(16),px]),QO(t))]))},Ea(eM(t))))}return MR}();return f(Mx,m([Ax(4),ID(u)]),m([f(RR,m([dx(a)]),f(Tu,MR,XO(t))),o]))}),uM=l(KR,213,217,222),sM=function(e){return f(kg,ei,f(kd,e,X_))},cM=r(function(e,t){return"Nothing"===e.$?t:e}),fM=r(function(e,t){return{$:"Placeholder",a:e,b:t}}),lM=fM,dM=function(e){var t=function(){var t=sM(e.inputs.fiatType);if("Just"===t.$){var r=t.a;return f(RR,m([dx(ND(d(ks,"click","misclick","currency symbol",0)))]),Na(r))}return MR}();return l(TD,m([XL]),"For:",d(ED,m([eA(VR(250)),r_(8),ID(f(UP,m([yP,AD(5)]),f(cM,e.errors.fiatAmount,e.errors.fiatType)))]),m([h(oM,e.showFiatTypeDropdown,e.inputs.fiatType,PD(!0),LD,ND(d(ks,"click","misclick","currency flag",0))),t]),{label:kD("price input"),onChange:_D,placeholder:_a(f(lM,m([n$(uM)]),Na("0"))),text:e.inputs.fiatAmount},tr))},hM=function(e){return{$:"ChangeRole",a:e}},pM=l(Xk,0,0,1),vM=n(function(e,t,r){return f(RR,B(e,m([KL({bottom:2,left:0,right:0,top:0}),hL({bottom:2,left:0,right:0,top:0}),uL(t?pM:d(HR,0,0,0,0))])),r)}),gM=r(function(e,t){var r=m([yx(24),h_,ix]),n=T(l(vM,tr,C(t,$s),f(RR,B(m([dx(hM($s))]),r),Na("Buy "+e))),l(vM,tr,C(t,Ts),f(RR,B(m([dx(hM(Ts))]),r),Na("Sell "+e)))),a=n.a,i=n.b;return f(Mx,m([Ax(20),hL({bottom:0,left:0,right:0,top:10})]),m([i,a]))}),yM=r(function(e,t){return l(TD,m([XL]),"Trade Type",f(gM,k_(e),t.inputs.userRole))}),mM=f(ax,Tx,cA.spaceEvenly),bM=function(e){var t=RD(e.wallet);return f(Dx,m([eA(_R),Ax(20),ux(5),f(rx,20,0)]),m([f(Mx,m([eA(_R),mM]),m([f(yM,t,e),f($D,t,e),dM(e)])),xD(e)]))},CM=function(e){if("Token"===e.$){if("EthDai"===e.a.$){e.a;return"Ethereum"}e.a;return"Kovan"}switch(e.a.$){case"Eth":e.a;return"Ethereum";case"Kovan":e.a;return"Kovan";default:e.a;return"xDai"}},SM=r(function(e,t){return{$:"CreateClicked",a:e,b:t}}),EM={$:"Web3Connect"},TM={$:"Above"},wM=function(e){return f(DR,TM,e)},IM=r(function(e,t){return f(RR,m([ux(4),f(rx,25,17),yx(18),px,qR(K_),wM(f(UP,m([UL(5)]),t))]),Na(e))}),AM=xA(32),BM={$:"Active"},kM=function(e){return f(t$,AM,f(IP,BM,NP(e)))},$M=a(function(e,t,r,n){var a=e.a,i=e.b,o=e.c;return f(RR,m([ux(4),ix,dx(n),f(rx,25,17),n$(t),yx(18),px,qR(a),kM(m([qR(o)])),RP(m([qR(i)]))]),Na(r))}),NM=r(function(e,t){return d($M,w(d(HR,1,0,0,1),d(HR,1,0,0,.8),d(HR,1,0,0,.6)),ZR,e,t)}),RM=r(function(e,t){return f(RR,m([Ex]),function(){var r=T(Ng(t),$g(t));if("Just"===r.a.$){if("Just"===r.b.$){var n=r.a.a,a=r.b.a;return C(a,e)?f(NM,"Open Trade",f(SM,a,n)):f(IM,"Open Trade",_a("You must switch your wallet to the "+CM(e)+" network to create a trade with "+k_(e)))}r.b;return f(IM,"Unsupported Network",La)}r.a;return f(NM,"Connect to Wallet",EM)}())}),xM=function(e){return{$:"AutoabortIntervalChanged",a:e}},_M=function(e){return{$:"ChangePaymentMethodText",a:e}},LM=function(e){return f(lM,m([n$(d(HR,0,0,0,.2))]),function(){return Na("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")}())},PM=a(function(e,t,r,n){return d(Qk,e/255,t/255,r/255,n)}),DM=r(function(e,t){return l(CD,{autofill:La,spellchecked:t.spellcheck,type_:GP},e,{label:t.label,onChange:t.onChange,placeholder:t.placeholder,text:t.text})}),UM=n(function(e,t,r){var n=f(RR,m([yx(22),px]),Na("Payment Method")),a=f(DM,m([eA(_R),JI(VR(150)),qR(d(PM,155,203,255,.2)),cL(0)]),{label:kD("payment method"),onChange:_M,placeholder:""===r?_a(LM(t)):La,spellcheck:!0,text:r});return f(Dx,m([Ax(20),hL({bottom:15,left:45,right:45,top:0}),eA(_R),wM(f(UP,m([yP,AD(30),r_(10),yx(20),eA(VR(400))]),e))]),m([n,a]))}),OM=function(e){return"Buyer"===e.$?"After committing, you and the Seller have this long to complete the external 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 external 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."},MM=a(function(e,t,r,n){var a=l(cu,e,I("0"),xi(n));return f(RR,m([yx(22),n$(t)]),Na(B(a,r)))}),FM=function(e){return _h(e)<0?yp(0):e},VM=n(function(e,t,n){var a=r(function(e,r){return f(Dx,m([Ax(4)]),m([f(RR,m([r_(4),ix,dx(n(f(EE,t,e)))]),f(f_,m([JI(VR(10))]),l_)),r,f(RR,m([r_(4),ix,dx(n(function(e){return _h(e)?e:yp(3e5)}(FM(f(mp,t,e)))))]),f(f_,m([JI(VR(10))]),o_))]))}),i=F_(t);return f(Mx,m([mM,Ax(10)]),m([f(a,yp(864e5),d(MM,3,e," days",i.days)),f(a,yp(36e5),d(MM,2,e," hours",i.hours)),f(a,yp(3e5),d(MM,2,e," min",i.min))]))}),KM=d(PM,1,31,52,.8),HM=o(function(e,t,r,n,a,i){var o=f(RR,m([qR(d(PM,155,203,255,.2)),ux(5),r_(15),wM(f(UP,m([yP]),a))]),l(VM,L_,n,i)),u=f(Mx,m([Ax(30)]),m([f(f_,m([JI(VR(40)),dx(ND(d(ks,"click","misclick","symbol for "+t,0)))]),e),f(RR,m([yx(22),px]),Na(t))])),s=f($x,m([yx(17),h_,n$(KM)]),m([Na(r)]));return f(Dx,m([eA(_R),Ax(2)]),f(ho,RR(m([f(rx,45,18),eA(_R)])),m([u,f(Mx,m([eA(_R),Ax(25)]),m([o,s]))])))}),jM=i_({description:"fiat",src:"/DAIHard/static/img/fiat-bag-white.svg"}),qM=i(function(e,t,r,n,a){return f(Dx,m([Ax(15)]),m([p(HM,jM,"Payment Window",OM(a),r,n,xM),l(UM,t,a,e)]))}),GM=function(e){return{$:"AutoreleaseIntervalChanged",a:e}},zM=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."},YM=i_({description:"",src:"/DAIHard/static/img/release-window-icon.svg"}),WM=n(function(e,t,r){return p(HM,YM,"Burn/Release Window",zM(r),e,t,GM)}),JM=function(e){return{$:"AutorecallIntervalChanged",a:e}},QM=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."},XM=i_({description:"",src:"/DAIHard/static/img/open-window-icon.svg"}),ZM=n(function(e,t,r){return p(HM,XM,"Open Window",QM(r),e,t,JM)}),eF=f(RR,m([eA(_R),JI(VR(2)),qR(L_)]),MR),tF=function(e){return f(Dx,m([eA(_R),Ax(15)]),m([eF,l(ZM,e.inputs.autorecallInterval,e.errors.autorecallInterval,e.inputs.userRole),eF,h(qM,e.inputs.paymentMethod,e.errors.paymentMethod,e.inputs.autoabortInterval,e.errors.autoabortInterval,e.inputs.userRole),eF,l(WM,e.inputs.autoreleaseInterval,e.errors.autoreleaseInterval,e.inputs.userRole),eF]))},rF={$:"AbortCreate"},nF=n(function(e,t,r){return{$:"ConfirmCreate",a:e,b:t,c:r}}),aF=function(e){return f(ho,function(e){return m([f(RR,m([n$(bx)]),Na("Caution! ")),Na(e)])},GT(m([C(f(vp,e.autoreleaseInterval,yp(12e5)),ba)?_a(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."}()):La,C(f(vp,e.autoabortInterval,yp(36e5)),ba)?_a(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.'}()):La])))},iF=function(e){return f(RR,m([hL({bottom:5,left:5,right:5,top:0}),dx(e),ux(30),qR(d(HR,1,1,1,.4)),cL(1),uL(d(HR,0,0,0,.3)),ix,yx(14)]),f(RR,m([n$(d(HR,0,0,0,.7))]),Na("x")))},oF=a(function(e,t,r,n){return f(RR,m([j_(f(RR,m([qR(e),gP(f(EP,"position","fixed")),gP(f(EP,"z-index","1000")),gP(f(EP,"top","0")),gP(f(EP,"left","0")),gP(f(EP,"width","100%")),gP(f(EP,"height","100%")),dx(r)]),MR)),eA(_R),JI(_R),CP(t)]),n)}),uF=a(function(e,t,r,n){return d(oF,d(HR,0,0,.3,.6),r,n,f(RR,B(m([Ex,Xx,eA(f(cP,700,_R)),qR(ZR),ux(8),OR(f(RR,m([_x,XL]),iF(n)))]),e),t))}),sF=n(function(e,t,r){return d(oF,d(HR,0,0,.3,.6),t,r,f(Dx,m([Ax(10),Ex,Xx,qR(d(HR,0,0,0,.5)),ux(8),r_(20)]),f(ho,function(e){return f($x,m([Ex,Xx,yx(20),px,n$(ZR),jL]),m([e]))},e)))}),cF=r(function(e,t){if("Token"===e.$){if("EthDai"===e.a.$){e.a;return"https://etherscan.io/tx/"+h$(t)}e.a;return"https://kovan.etherscan.io/tx/"+h$(t)}switch(e.a.$){case"Eth":e.a;return"https://etherscan.io/tx/"+h$(t);case"Kovan":e.a;return"https://kovan.etherscan.io/tx/"+h$(t);default:e.a;return"https://blockscout.com/poa/dai/tx/"+h$(t)}}),fF={$:"Bottom"},lF=Jx(fF),dF=Wk(cA.underline),hF=r(function(e,t){switch(e.$){case"Confirm":var r=e.a,n=e.b,a=function(){var e=t.depositAmount;if("Just"===e.$){var a=e.a;return T(Na(rL(LE(a))),f(NM,"Yes, I definitely want to open this trade.",l(nF,r,n,a)))}return T(Na("??"),f(IM,"(loading exact fees...)",La))}(),i=a.a,o=a.b;return d(uF,tr,f(Dx,m([Ax(20),r_(20),Ex,JI(_R),jL]),m([f(RR,m([yx(26),px,Ex,Xx]),Na("Just to Confirm...")),f(Dx,m([Ax(20),Ex,Xx]),f(ho,$x(m([Ex,yx(18),h_,n$(KM)])),B(aF(n),B(m([m([Na("You will deposit "),i,Na(" "+k_(r)+" (this includes the 1% dev fee) to open this trade.")])]),function(){return"Token"===r.$?m([m([Na("This ususally requires two Metamask signatures. Your "+k_(r)+" will not be deposited until the final transaction has been mined.")])]):tr}())))),f(RR,m([lF,Ex]),o)])),km,rF);case"ApproveNeedsSig":var u=e.a;return f(RR,m([Ex,Xx,dx(ND(d(ks,"txChainModal clicked","misclick","ApproveNeedsSig",0)))]),l(sF,m([Na("Waiting for user signature for the approve call."),Na("(check Metamask!)"),Na("Note that there will be a second transaction to sign after this.")]),km,km));case"ApproveMining":var u=e.a,n=e.b,s=e.c;return f(RR,m([Ex,Xx,dx(ND(d(ks,"txChainModal clicked","misclick","ApproveMining",0)))]),l(sF,m([Na("Mining the initial approve transaction..."),f(Jk,m([dF,n$(pM)]),{label:Na("See the transaction on Etherscan"),url:f(cF,Cs(u),s)}),Na("Funds will not leave your wallet until you sign the next transaction.")]),km,km));case"CreateNeedsSig":return f(RR,m([Ex,Xx,dx(ND(d(ks,"txChainModal clicked","misclick","CreateNeedsSig",0)))]),l(sF,m([Na("Waiting for user signature for the create call."),Na("(check Metamask!)")]),km,km));default:var r=e.a,s=e.b;return f(RR,m([Ex,Xx,dx(ND(d(ks,"txChainModal clicked","misclick","CreateMining",0)))]),l(sF,m([Na("Mining the final create call..."),f(Jk,m([dF,n$(pM)]),{label:Na("See the transaction on Etherscan"),url:f(cF,r,s)}),Na("You will be redirected when it's mined.")]),km,km))}}),pF=function(e){return GT(Zw(f(Bu,function(t){return f(hF,t,e)},e.txChainStatus)))},vF=function(e){return T(d(fP,1e3,_a("Trade Dai/xDai for any asset! No bank account or KYC required."),"CUSTOM TRADE",f(Dx,m([eA(_R),Ax(20),r_(20)]),m([bM(e),tF(e),f(RM,e.inputs.dhToken,e.wallet)]))),pF(e))},gF=function(e){return{$:"AmountInChanged",a:e}},yF=function(e){return{$:"ChangeForeignCrypto",a:e}},mF=function(e){return{$:"ChangeTokenType",a:e}},bF={$:"ForeignCryptoTypeClicked"},CF={$:"TokenTypeClicked"},SF=a(function(e,t,r,n){return f(Mx,m([Ax(8),ix,CP(r),Xx,OR(t?f(RR,m([UL(15),PP(10),gP(f(EP,"position","fixed")),gP(f(EP,"z-index","1000"))]),xP(f(ho,function(e){return T(Na(Ap(e)),n(e))},Ip))):MR)]),m([Na(Ap(e)),f(f_,m([eA(VR(12))]),o_)]))}),EF=function(e){var t=function(){return"Buyer"===e.initiatorRole.$?d(SF,e.foreignCrypto,e.showForeignCryptoDropdown,bF,yF):d(DP,e.dhToken,e.showDhTokenDropdown,CF,mF)}();return d(ED,m([eA(_R),Xx]),m([t]),{label:kD("amount in"),onChange:gF,placeholder:_a(f(lM,m([n$(uM)]),Na("0"))),text:e.amountInInput},tr)},TF={$:"SwapClicked"},wF=function(e){return{$:"ResponderProfitChanged",a:e}},IF=function(e){return f(Mx,m([Ex]),m([f(Mx,m([yx(16)]),m([Na("-"),f(SD,m([cL(0),r_(0),JI(XI),eA(VR(20))]),{label:kD("responderProfit"),onChange:wF,placeholder:La,text:e.responderProfitInput}),Na("%")]))]))},AF=i_({description:"switch order type",src:"/DAIHard/static/img/swap-arrows.svg"}),BF=function(e){return f(Dx,m([Ax(5),lF]),m([IF(e),f(f_,m([Ex,eA(VR(24)),ix,dx(TF),hL({bottom:6,left:0,right:0,top:0})]),AF)]))},kF=function(e){return{$:"AmountOutChanged",a:e}},$F=function(e){var t=function(){return"Buyer"===e.initiatorRole.$?d(DP,e.dhToken,e.showDhTokenDropdown,CF,mF):d(SF,e.foreignCrypto,e.showForeignCryptoDropdown,bF,yF)}();return d(ED,m([Ax(15),eA(_R),Xx]),m([t]),{label:kD("amount out"),onChange:kF,placeholder:_a(f(lM,m([n$(uM)]),Na("0"))),text:e.amountOutInput},tr)},NF=function(e){return f(Dx,m([eA(_R),Ax(10)]),m([f(Mx,m([Ax(10),eA(_R)]),m([l(TD,m([lF,eA(_R)]),"From:",EF(e)),BF(e),l(TD,m([lF,eA(_R)]),"To:",$F(e))])),f(Mx,m([eA(_R),Ax(10)]),m([f(RR,m([eA(_R)]),function(){var t=e.errors.amountIn;if("Just"===t.$){var r=t.a;return f(RR,m([n$(bx),yx(14),Ex]),Na(r))}return MR}()),f(RR,m([eA(VR(24))]),MR),f(RR,m([eA(_R)]),function(){var t=e.errors.responderProfit;if("Just"===t.$){var r=t.a;return f(RR,m([n$(bx),yx(14),Ex]),Na(r))}return MR}())]))]))},RF=function(e){return f(bl,ml(e.tradeAmount),f(hl,e.tradeAmount,200))},xF=function(e){return{autoabortInterval:e.autoabortInterval,autorecallInterval:e.autorecallInterval,autoreleaseInterval:e.autoreleaseInterval,initiatorRole:e.initiatorRole,paymentMethods:e.paymentMethods,price:e.price,tradeAmount:e.tradeAmount}},_F=function(e){return{abortPunishment:e.abortPunishment,autoabortInterval:e.autoabortInterval,autorecallInterval:e.autorecallInterval,autoreleaseInterval:e.autoreleaseInterval,buyerDeposit:e.buyerDeposit,initiatorAddress:e.initiatorAddress,initiatorRole:e.initiatorRole,pokeReward:e.pokeReward,tradeAmount:e.tradeAmount}},LF=function(e){return"Buyer"===e.initiatorRole.$?Ts:$s},PF=function(e){return"Buyer"===LF(_F(e)).$?e.buyerDeposit:e.tradeAmount},DF={$:"AbortCreate"},UF=function(e){return{$:"CmdUp",a:e}},OF=n(function(e,t,r){return{$:"ConfirmCreate",a:e,b:t,c:r}}),MF={$:"NoOp"},FF=r(function(e,t){return d($M,w(d(HR,0,0,1,1),d(HR,0,0,1,.8),d(HR,0,0,1,.6)),ZR,e,t)}),VF=r(function(e,t){switch(e.$){case"Confirm":var r=e.a,n=e.b,a=e.c,i=f(FF,"Not yet. Go back.",DF),o=f(Ju,RR(m([Nx,n$(L_)])),Na),u=f(FF,"Customize Contract Terms",UF(es(Pb(_a(xF(n)))))),s=f(Ju,RR(m([px,n$(pM)])),Na),c=s(rL(n.buyerDeposit)+" "+k_(r)),h=s(rL(RF(n))+" "+k_(r)),p=s(Z_(n.price)),v=s(rL(f(bl,n.tradeAmount,n.buyerDeposit))+" "+k_(r)),g=s(rL(n.tradeAmount)+" "+k_(r)),y=function(){var e=t.depositAmount;if("Just"===e.$){var a=e.a,i=rL(f(bl,RF(n),f(bl,LE(a),PF(n))))+" "+k_(r),o=rL(LE(a))+" "+k_(r);return w(s(o),s(i),f(NM,"Yes. Deposit "+o+" and open this trade.",l(OF,r,n,a)))}return w(s("??"),s("??"),f(IM,"(loading exact fees...)",La))}(),b=y.a,C=y.b,S=y.c;return d(uF,tr,f(Dx,m([Ax(20),r_(20),Ex,JI(_R),eA(_R),jL]),m([f(RR,m([yx(26),px,Ex,Xx]),function(){var e=n.initiatorRole;return Na("Buyer"===e.$?"Opening a DAIHard Buy Offer":"Opening a DAIHard Sell Offer")}()),f(Dx,m([Ax(20),Ex,Xx]),f(ho,$x(m([Ex,yx(18),h_,n$(KM)])),function(){return"Buyer"===n.initiatorRole.$?B(m([m([Na("To open this offer, you must deposit "),b,Na(". Your offer to buy "),g,Na(" for "),p,Na(" will then be listed on the marketplace.")]),m([Na("You can abort the offer any time before a Seller commits for a full refund. If no Seller commits within "),o("24 hours"),Na(" your offer will automatically expire. In both these cases, the full "),b,Na(" is returned to you.")]),m([Na("A Seller can commit to the trade by depositing the full "),g,Na(" into the contract, and is expected to immediately post his "),s(n.price.symbol),Na(" address in the DAIHard chat.")]),m([Na("You will then have "),o("24 hours"),Na(" to send "),p,Na(' to that address and click "Confirm Payment".')]),m([Na("Once you've confirmed payment, for "),o("24 hours"),Na(", the Seller has the option of burning the trade's full balance of "),C,Na(". He is expected to do this if and only if you failed to send the "),p,Na(" to the address he posted.")]),m([Na("If the Seller has not burned the "),Na(k_(r)),Na(" within 24 hours, "),v,Na(" is yours to claim and we take a 1% fee ("),h,Na(").")]),m([Na("Are you ready?")])]),function(){return"Token"===r.$?m([m([Na("(Trade creation ususally requires two Metamask signatures. Your "+k_(r)+" will not be deposited until the final transaction has been mined.)")])]):tr}()):B(m([m([Na("Of your "),b,Na(", 1% ("),h,Na(") will be set aside, and "),g,Na(" will be listed as selling for "),p,Na(".")]),m([Na("You can abort the offer at any time before a Buyer commits for a full refund. If no Buyer commits within "),o("24 hours"),Na(" your offer will automatically expire. In both these cases, the full "),b,Na(" is returned to you.")]),m([Na("A Buyer must deposit "),c,Na(" into this contract to commit. He is then expected to send the "),p,Na(" to your receive address "),s(a),Na(", and mark the payment as complete, all within "),o("1 hour.")]),m([o("Make sure the above address is correct! DAIHard does not do refunds!")]),m([Na("When the Buyer marks the payment complete, for "),o("24 hours"),Na(" you will have the option to burn the trade's balance of "),C,Na(", which you are expected to do if and only if the Buyer has not sent the payment.")]),m([Na("If the trade has resolved successfully, DAIHard takes the 1% fee of "),h,Na(" set aside earlier.")]),m([Na("Are you ready?")])]),function(){return"Token"===r.$?m([m([Na("(Trade creation ususally requires two Metamask signatures. Your "+k_(r)+" will not be deposited until the final transaction has been mined.)")])]):tr}())}())),f(Dx,m([Ex,Ax(15)]),f(ho,RR(m([Ex])),m([S,i,u])))])),MF,DF);case"ApproveNeedsSig":var E=e.a;return f(RR,m([Ex,Xx,dx(UF(d(ks,"txChainModal clicked","misclick","ApproveNeedsSig",0)))]),l(sF,m([Na("Waiting for user signature for the approve call."),Na("(check Metamask!)"),Na("Note that there will be a second transaction to sign after this.")]),MF,MF));case"ApproveMining":var E=e.a,n=e.b,T=e.c;return f(RR,m([Ex,Xx,dx(UF(d(ks,"txChainModal clicked","misclick","ApproveMining",0)))]),l(sF,m([Na("Mining the initial approve transaction..."),f(Jk,m([dF,n$(pM)]),{label:Na("See the transaction on Etherscan"),url:f(cF,Cs(E),T)}),Na("Funds will not leave your wallet until you sign the next transaction.")]),MF,MF));case"CreateNeedsSig":return f(RR,m([Ex,Xx,dx(UF(d(ks,"txChainModal clicked","misclick","CreateNeedsSig",0)))]),l(sF,m([Na("Waiting for user signature for the create call."),Na("(check Metamask!)")]),MF,MF));default:var r=e.a,T=e.b;return f(RR,m([Ex,Xx,dx(UF(d(ks,"txChainModal clicked","misclick","CreateMining",0)))]),l(sF,m([Na("Mining the final create call..."),f(Jk,m([dF,n$(pM)]),{label:Na("See the transaction on Etherscan"),url:f(cF,r,T)}),Na("You will be redirected when it's mined.")]),MF,MF))}}),KF=function(e){var t=e.txChainStatus;if("Nothing"===t.$)return MR;var r=t.a;return f(VF,r,e)},HF=function(e){return{$:"ReceiveAddressChanged",a:e}},jF=function(e){switch(e.$){case"ZEC":return"zs... / zc... / t...";case"XMR":return"4...";default:return"1... / 3... / bc1..."}},qF=r(function(e,t){return d(ED,m([eA(_R),f(rx,10,0)]),tr,{label:kD("receive address"),onChange:HF,placeholder:_a(f(lM,m([n$(uM)]),Na(jF(t)))),text:e},tr)}),GF=function(e){return"Buyer"===e.initiatorRole.$?MR:l(TD,m([lF,eA(_R)]),"Send "+Ap(e.foreignCrypto)+" To:",f(qF,e.receiveAddress,e.foreignCrypto))},zF=n(function(e,t,r){return{$:"PlaceOrderClicked",a:e,b:t,c:r}}),YF=r(function(e,t){return f(sm,Ap(e),t)}),WF=function(e){var t=Hy(Wh(e));if("Just"===t.$){var r=t.a;return LE(r)}f(ka,"Error converting float to tokenValue","");return LE(To(0))},JF=function(e){return"Buyer"===e.initiatorRole.$?d(tT,n(function(t,r,n){return{autoabortInterval:yp(864e5),autorecallInterval:yp(864e5),autoreleaseInterval:yp(864e5),initiatorRole:e.initiatorRole,paymentMethods:m([f(um,om,"Provide your "+Ap(e.foreignCrypto)+" address immediately upon commitment, via chat.")]),price:f(YF,e.foreignCrypto,t),tradeAmount:WF(n)}}),e.amountIn,e.responderProfit,e.amountOut):h(VE,a(function(t,r,n,a){return{autoabortInterval:yp(36e5),autorecallInterval:yp(864e5),autoreleaseInterval:yp(864e5),initiatorRole:e.initiatorRole,paymentMethods:m([f(um,om,"Pay to "+n+" immediately upon commitment.")]),price:f(YF,e.foreignCrypto,a),tradeAmount:WF(t-t/101)}}),e.amountIn,e.responderProfit,""===e.receiveAddress?La:_a(e.receiveAddress),e.amountOut)},QF=function(e){var t=T(Ng(e.wallet),JF(e));if("Just"===t.a.$){if("Just"===t.b.$){var r=t.a.a,n=t.b.a;return C($g(e.wallet),_a(e.dhToken))?f(NM,"Place Order",l(zF,e.dhToken,r,n)):f(IM,"Place Order",_a("You must switch your wallet to the "+CM(e.dhToken)+" network to create a trade with "+k_(e.dhToken)))}t.b;return f(IM,"Place Order",La)}t.a;return f(NM,"Connect to Wallet",UF(ns))},XF=r(function(e,t){var r=t.url,n=t.label;return d(Yk,iA,rA("a"),f(Sa,tA(GI(r)),f(Sa,tA(zI("noopener noreferrer")),f(Sa,eA(XI),f(Sa,JI(XI),f(Sa,Wk(cA.contentCenterX+" "+cA.contentCenterY+" "+cA.link),e))))),nA(m([n])))}),ZF=function(e){return T(f(Dx,m([Ax(30),eA(_R)]),m([d(fP,1e3,_a("Trade Dai/xDai for ZEC, XMR, or BTC"),"CRYPTO SWAP",f(Dx,m([Ax(20),r_(15),eA(_R)]),m([NF(e),f(Mx,m([eA(_R)]),m([f(RR,m([eA(t_(1))]),MR),f(RR,m([eA(t_(2))]),GF(e)),f(RR,m([eA(t_(1))]),MR)])),f(RR,m([Ex]),QF(e))]))),f(XF,m([ux(4),eA(_R),ix,f(rx,22,15),qR(pM),n$(ZR),px,yx(20),Ex,eA(XI),JI(XI)]),{label:f($x,m([jL]),m([Na("Join the Telegram Group")])),url:"https://t.me/daihardexchange_group"})])),m([KF(e)]))},eV=r(function(e,t){return f(hC,f(Oa,function(e){return e.type_},Za(e)),t)}),tV=r(function(e,t){return Eu(t(e))}),rV=i(function(e,t,r,n,a){var i=l(tV,e,a.filterFunc,zb(f(ho,jx,n)));return C(i,tr)?f(RR,m([Ex,yx(24),hL({bottom:0,left:0,right:0,top:30}),pL]),Na(r?"No trades found with those filters.":"Initializing Trade Cache...")):f(ps,mb,h(lL,e,a.tradeTable,a.prices,m([t?pb:fy,Gx,Yx,Wx,zx,qx]),i))}),nV=function(e){return{$:"FiltersMsg",a:e}},aV={$:"ApplyInputs"},iV=pD("disabled"),oV=function(e){return f($l,ZP,e)?PR:Wk("focusable")},uV=function(e){return{$:"MayPreventDefault",a:e}},sV=r(function(e,t){return f(cx,e,uV(t))}),cV=r(function(e,t){var r=function(r){return C(r,e)?us(t):Js("Not the enter key")},n=f(Ws,r,f(Wl,"key",Qs));return tA(f(sV,"keyup",f(is,function(e){return T(e,!0)},n)))}),fV=function(e){return f(cV,"Enter",e)},lV={$:"Button"},dV=r(function(e,t){var r=t.onPress,n=t.label;return d(Yk,iA,NR,f(Sa,eA(XI),f(Sa,JI(XI),f(Sa,Wk(cA.contentCenterX+" "+cA.contentCenterY+" "+cA.seButton+" "+cA.noTextSelection),f(Sa,ix,f(Sa,oV(e),f(Sa,Bx(lV),f(Sa,tA(BL(0)),function(){if("Nothing"===r.$)return f(Sa,tA(iV(!0)),e);var t=r.a;return f(Sa,dx(t),f(Sa,fV(t),e))}()))))))),nA(m([n])))}),hV=f(dV,m([qR(pM),r_(10),ux(5)]),{label:f(RR,m([n$(ZR),Ex,Xx]),Na("Apply")),onPress:_a(aV)}),pV=i_({description:"DAI",src:"/DAIHard/static/img/dai-symbol.png"}),vV=function(e){return f(f_,f(Sa,JI(VR(26)),e),pV)},gV=function(e){var t=e.topLeft,r=e.topRight,n=e.bottomLeft,a=e.bottomRight;return f(t$,ox,l(Bk,"br-"+xi(t)+"-"+xi(r)+xi(n)+"-"+xi(a),"border-radius",xi(t)+"px "+xi(r)+"px "+xi(a)+"px "+xi(n)+"px"))},yV=function(e){return f(fx,"focus",us(e))},mV=f(Ju,tA,yV),bV=s(function(e,t,r,n,a,i,o,u){var s=function(){if("Nothing"===o.$)return tr;var e=o.a;return m([mV(e(!0)),CP(e(!0))])}();return f(Mx,B(e,m([JI(VR(40)),YR({blur:20,color:d(PM,233,237,242,.05),offset:T(0,3),size:0})])),m([f(RR,m([qR(K_),JI(VR(40)),gV({bottomLeft:4,bottomRight:0,topLeft:4,topRight:0})]),f(RR,m([Xx,f(rx,10,0)]),r)),f(SD,B(s,B(t,m([eA(VR(100)),JI(VR(40)),uL(K_),gV({bottomLeft:0,bottomRight:4,topLeft:0,topRight:4}),KL({bottom:1,left:0,right:1,top:1})]))),{label:kD(n),onChange:u,placeholder:i,text:a})]))}),CV=function(e){return{$:"MaxDaiChanged",a:e}},SV=function(e){return{$:"MinDaiChanged",a:e}},EV=r(function(e,t){return f(Dx,m([eA(_R),Ax(8)]),m([f(RR,m([yx(17),h_]),Na(e)),t]))}),TV={$:"OnLeft"},wV=function(e){return f(DR,TV,e)},IV=n(function(e,t,r){var n=vV(m([Xx])),a=f(Mx,m([Ax(8),Xx,eA(VR(60))]),m([n,f(RR,m([yx(16),Xx]),Na("max"))])),i=f(Mx,m([Ax(8),Xx,eA(VR(60))]),m([n,f(RR,m([yx(16),Xx]),Na("min"))]));return f(EV,"Dai Range",f(Dx,m([Ax(5),eA(VR(200))]),m([g(bV,m([wV(f(UP,m([PP(5),eA(VR(200))]),r.minDai))]),m([mV(Ib(!1))]),i,"min Dai",e,La,La,SV),g(bV,m([wV(f(UP,m([PP(5),eA(VR(200))]),r.maxDai))]),m([mV(Ib(!1))]),a,"max Dai",t,La,La,CV)])))}),AV=function(e){return{$:"CmdUp",a:e}},BV=function(e){return{$:"FiatTypeInputChanged",a:e}},kV=n(function(e,t,r){var n=AV(d(ks,"click","misclick","currency flag",0)),a=f(Tu,MR,XO(t));f(Mx,m([Ax(8),Xx,eA(VR(60))]),m([a,f(RR,m([yx(16),Xx]),Na("max"))])),f(Mx,m([Ax(8),Xx,eA(VR(60))]),m([a,f(RR,m([yx(16),Xx]),Na("min"))]));return f(RR,m([XL,eA(VR(120))]),f(EV,"Currency Type",h(oM,e,t,Ib(!0),BV,n)))}),$V={$:"AddSearchTerm"},NV=function(e){return{$:"PaymentMethodInputChanged",a:e}},RV=f(Wl,"keyCode",YT),xV=function(e){return f(fx,"keyup",f(Ws,function(t){return 13===t?us(e):Js(xi(t))},RV))},_V=function(e){return f(EV,"Search Payment Methods",f(SD,m([XL,eA(VR(250)),JI(VR(40)),uL(K_),YR({blur:20,color:d(PM,233,237,242,.05),offset:T(0,3),size:0}),gP(xV($V))]),{label:kD("payment methods search"),onChange:NV,placeholder:La,text:e}))},LV={$:"ResetSearch"},PV=f(dV,m([qR(pM),r_(10),ux(5)]),{label:f(RR,m([n$(ZR),Ex,Xx]),Na("Reset")),onPress:_a(LV)}),DV=function(e){return{$:"RemoveTerm",a:e}},UV=function(e){return f(RR,m([r_(3),XL,ix,dx(DV(e)),yx(10),n$(bx)]),Na("x"))},OV=function(e){if(e.b){var t=e;return f(Mx,m([eA(_R),r_(10),Ax(10)]),f(ho,function(e){return f(Mx,m([qR(d(PM,16,7,234,.2)),ux(5),r_(4),Ax(3)]),m([Na(e),UV(e)]))},t))}return MR},MV=i(function(e,t,r,n,a){var i=function(e){return f(RR,m([yx(20),px,n$(m_),Ex]),Na(e))},o=f(Nl,Za(tP),f(ho,iP,e))?m([i("No trades found.")]):f(ho,i,GT(f(ho,function(e){switch(iP(e).$){case"QueryingNumTrades":return _a("Querying "+Z$(e.factory)+" Factory...");case"NoneFound":return La;case"FetchingTrades":return _a("Fetching "+Z$(e.factory)+" Trades...");default:return La}},e)));return f(RR,m([eA(_R),OR(f(Dx,m([Ax(5),SL]),o))]),f(Mx,m([Ex,Ax(50)]),m([f(ps,nV,eP(t)),f(Mx,m([eA(XI),Ax(10)]),m([f(RR,m([eA(XI),XL]),l(IV,r.minDai,r.maxDai,n)),f(RR,m([eA(XI),XL]),l(kV,a,r.fiatType,n)),f(Dx,m([eA(XI),XL,Ax(5)]),m([_V(r.paymentMethod),OV(r.paymentMethodTerms)])),f(EV," ",f(Dx,m([Ax(5),eA(XI)]),m([hV,PV])))]))])))}),FV=n(function(e,t,r){var n=f(Nl,f(Oa,iP,Za(rP)),t),a=function(){return!f(Tu,0,f(Bu,function(e){return f(fI,function(e){return e.checked&&"Open"!==e.label},e.options)},f(eV,Zg,r.filters)))}();return T(d(fP,1800,_a("Browse Offers. Local or Worldwide, Cash or Crypto."),"MARKETPLACE",f(Dx,m([eA(_R),JI(_R),r_(30)]),m([f(Mx,m([eA(_R),Ax(10)]),m([h(MV,t,r.filters,r.inputs,r.errors,r.showCurrencyDropdown)])),h(rV,e,a,n,t,r)]))),tr)}),VV=YR({blur:20,color:d(PM,0,0,0,.04),offset:T(0,3),size:0}),KV=function(e){return{$:"MessageInputChanged",a:e}},HV={$:"MessageSubmit"},jV=function(e){return f(Dx,m([eA(_R),Ax(10)]),m([f(DM,m([eA(_R),JI(VR(100))]),{label:kD("messageInput"),onChange:KV,placeholder:La,spellcheck:!1,text:e.messageInput}),f(dV,m([Ex,yx(24)]),{label:Na("Submit"),onPress:_a(HV)})]))},qV=r(function(e,t){return f(RR,m([JI(_R),eA(_R)]),f(RR,B(m([gP(f(EP,"position","absolute")),gP(f(EP,"top","0")),gP(f(EP,"right","0")),gP(f(EP,"bottom","0")),gP(f(EP,"left","0")),qP]),e),t))}),GV=l(KR,200,205,210),zV=n(function(e,t,r){var n=m([_x,qR(pM),n$(ZR),gV({bottomLeft:15,bottomRight:0,topLeft:15,topRight:15})]),a=m([SL,qR(GV),n$(L_),gV({bottomLeft:0,bottomRight:15,topLeft:15,topRight:15})]),i=r.eventInfo;if("Statement"===i.$){var o=i.a,u=C(o.who,t)?n:a;return f(RR,B(m([r_(7)]),u),f($x,tr,m([Na(B(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 _a(w(l(Xk,0,0,1),ZR,"Initiator opened the trade"));case"Recalled":return _a(w(l(Xk,0,0,1),ZR,"Initiator recalled the trade"));case"Committed":var t=s.a,r=f(Ks,8,Ua(t))+"..";return _a(w(l(Xk,1,0,1),ZR,r+" committed to the trade"));case"Aborted":return _a(w(l(Xk,1,0,0),ZR,"Buyer aborted the trade"));case"Claimed":return _a(w(l(Xk,0,1,0),ZR,"Buyer marked the external payment complete"));case"Released":return _a(w(l(Xk,0,0,1),ZR,"Seller released the "+k_(e)+" and closed the contract"));default:return _a(w(l(Xk,0,0,1),ZR,"Seller burned the "+k_(e)+" and closed the contract"))}}();if("Nothing"===c.$)return MR;var d=c.a,h=d.a,p=d.b,v=d.c;return f(RR,m([ux(3),cL(1),uL(l(Xk,1,0,1)),Ex,qR(h)]),f($x,m([n$(p)]),m([Na(v)])))}),YV=n(function(e,t,r){if(r.b){var n=r;return f(qV,m([eA(_R),JI(_R),ux(5),cL(1),uL(L_),r_(10)]),f(Dx,m([eA(_R),JI(_R),Ax(10)]),f(ho,f(zV,e,t),n)))}return f(RR,m([eA(_R),JI(_R),ux(5),cL(1),uL(L_),Ex,n$(l(Xk,.5,.5,.5)),pL]),Na("no messages found."))}),WV=ar,JV=function(e){return f(Dx,m([eA(_R),JI(_R),Ax(10),cL(1),ux(5),r_(20)]),m([l(YV,e.trade.factory,e.userRole,f(WV,function(e){return e.blocknum},Ba(e.history))),jV(e)]))},QV=function(e){return f(RR,m([qR(ZR),ux(8),VV,eA(_R),JI(_R)]),JV(e))},XV={$:"NoOp"},ZV={$:"ToggleChat"},eK=function(e){if(e.showChatHistory){var t=f(Tu,MR,f(Bu,QV,e.chatHistoryModel));return f(RR,m([JI(_R),eA(VR(500)),r_(20),_x]),d(uF,m([JI(_R),eA(_R)]),f(ps,mw,t),XV,ZV))}return MR},tK={$:"AbortAction"},rK=n(function(e,t,r){return{$:"ConfirmCommit",a:e,b:t,c:r}}),nK=function(e){var t=T(e.txChainStatus,e.trade);if("Just"!==t.a.$){t.a;return MR}if("LoadedTrade"!==t.b.$)return MR;var r=t.a.a,n=t.b.a;switch(r.$){case"ConfirmingCommit":var a=r.a,i=r.b,o=Z_(n.terms.price),u=rL(LE(i)),s=rL(n.parameters.tradeAmount)+" "+k_(n.factory),c=function(){return"Buyer"===LF(n.parameters).$?T(f(RR,m([h_,n$(L_)]),Na("buyer")),m([Na("pay the seller "),f(RR,m([n$(pM)]),Na(o)),Na(" in exchange for the "),f(RR,m([n$(pM)]),Na(s)),Na(" held in this contract.")])):T(f(RR,m([h_,n$(L_)]),Na("seller")),m([Na("accept "),f(RR,m([n$(pM)]),Na(o)),Na(" from the buyer in exchange for the "),f(RR,m([n$(pM)]),Na(s)),Na(" held in this contract.")]))}(),h=c.a,p=c.b;return d(uF,tr,f(Dx,m([Ax(20),r_(20),Ex,JI(_R),jL]),m([f(RR,m([yx(26),px,Ex,Xx]),Na("Just to Confirm...")),f(Dx,m([Ax(20),Ex,Xx]),f(ho,$x(m([Ex,yx(18),h_,n$(KM)])),B(m([B(m([Na("You will deposit "),f(RR,m([n$(pM)]),Na(u+" "+k_(n.factory))),Na(", thereby becoming the "),h,Na(" of this trade. By doing so, you are agreeing to ")]),p)]),function(){return"Token"===n.factory.$?m([m([Na("(This ususally requires two Metamask signatures. Your "+k_(n.factory)+" will not be deposited until the second transaction has been mined.)")])]):tr}()))),f(RR,m([lF,Ex]),f(NM,"Yes, I definitely want to commit to this trade.",l(rK,n,a,i)))])),XV,tK);case"ApproveNeedsSig":return l(sF,m([Na("Waiting for user signature for the approve call."),Na("(check Metamask!)"),Na("Note that there will be a second transaction to sign after this.")]),XV,XV);case"ApproveMining":var v=r.a;return l(sF,m([Na("Mining the initial approve transaction..."),f(Jk,m([dF,n$(pM)]),{label:Na("See the transaction on Etherscan"),url:f(cF,n.factory,v)}),Na("Funds will not leave your wallet until you sign the next transaction.")]),XV,XV);case"CommitNeedsSig":return l(sF,m([Na("Waiting for user signature for the final commit call."),Na("(check Metamask!)"),Na("This will make the deposit and commit you to the trade.")]),XV,XV);case"CommitMining":var v=r.a;return l(sF,m([Na("Mining the final commit transaction..."),f(Jk,m([dF,n$(pM)]),{label:Na("See the transaction"),url:f(cF,n.factory,v)})]),XV,XV);case"ConfirmingAction":var g=r.a;return d(uF,tr,f(Dx,m([Ax(20),r_(20),Ex,JI(_R),jL]),m([f(RR,m([yx(26),px,Ex,Xx]),Na("Just to Confirm...")),f(Dx,m([Ax(20),Ex,Xx]),f(ho,$x(m([Ex,yx(18),h_,n$(KM)])),function(){switch(g.$){case"Poke":case"Recall":return tr;case"Claim":return m([m([Na('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 '+k_(n.factory)+" rather than release it to you.")])]);case"Abort":return m([m([Na("Aborting will incur a small penalty on both parties, and refund the rest of the "+k_(n.factory)+".")])]);case"Release":return m([m([Na("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 m([m([Na("This will destroy the "+k_(n.factory)+" 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(RR,m([lF,Ex]),function(e){return f(NM,e,Dw(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 "+k_(n.factory)+".";default:return"I understand. Burn the "+k_(n.factory)+"."}}()))])),XV,tK);case"ActionNeedsSig":var g=r.a;return l(sF,m([Na("Waiting for user signature for the "+Ow(g)+" call."),Na("(check Metamask!)")]),XV,XV);default:var g=r.a,v=r.b;return MR}},aK=r(function(e,t){return f(Dx,m([Ax(10)]),m([f(RR,m([yx(17),px]),Na(e)),t]))}),iK=function(e){return f(Mx,m([Ax(8)]),m([f(f_,tr,pV),f(RR,m([yx(24),h_]),Na(rL(e)))]))},oK=r(function(e,t){var r=f(kg,ny(e),f(Bu,function(e){return e.address},Ng(t)));return f(aK,function(){var t=T(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"}(),iK(e.parameters.tradeAmount))}),uK=function(e){return f(Mx,m([Ax(5)]),m([f(Tu,MR,XO(e.symbol)),f(RR,m([yx(24),h_]),Na(Z_(e)))]))},sK=function(e){return f(aK,"For",uK(e.terms.price))},cK=function(e){return"Buyer"===e.$?"Buyer":"Seller"},fK=l(KR,250,165,22),lK=l(KR,255,0,0),dK=l(KR,0,255,0),hK=i_({description:"aborted",src:"/DAIHard/static/img/aborted.svg"}),pK=i_({description:"burned",src:"/DAIHard/static/img/burned.svg"}),vK=i_({description:"released",src:"/DAIHard/static/img/released.svg"}),gK={$:"ToggleStatsModal"},yK=function(e){return f(WV,Zi,e)},mK=n(function(e,t,n){var a=zb(f(ho,function(e){return f(Eu,function(e){return C(f(ay,e,n),_a(t))},f(cg,function(e){if("LoadedTrade"===e.$){var t=e.a;return _a(t)}return La},Ba(e.trades)))},e)),i=Ai(a),o=l(Wa,r(function(e,t){switch(e.state.closedReason.$){case"Released":return A(t,{amountReleased:f(bl,t.amountReleased,e.parameters.tradeAmount),numReleases:t.numReleases+1});case"Burned":return A(t,{amountBurned:f(bl,t.amountBurned,e.parameters.tradeAmount),numBurns:t.numBurns+1});case"Aborted":return A(t,{numAborts:t.numAborts+1});default:return t}}),{amountBurned:gl,amountReleased:gl,numAborts:0,numBurns:0,numReleases:0},a),u=f(Bu,yp,dd(yK(f(cg,function(e){return function(e){return e?_a(e):La}(_h(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}}),bK=r(function(e,t){return f(RR,m([ux(4),qR(d(HR,0,0,1,.1)),n$(l(KR,16,7,234)),yx(e),px,f(rx,15,13)]),Na(Ua(t)))}),CK=function(e){return{$:"ViewUserHistory",a:e}},SK=f(_N,0,tr),EK=f(ax,Zx,cA.clipX),TK=f(ax,Zx,cA.clipY),wK=f(ax,hx,cA.textNormalWeight),IK=r(function(e,t){return ai(e/t)}),AK=n(function(e,t,r){for(;;){if(!r.b)return t+e;var n=r.a,a=r.b;if(E(n.start,t)<0)return t+n.offset;var i=e,o=t,u=a;e=i,t=o,r=u}}),BK=r(function(e,t){var r=e.a,n=e.b;return l(AK,r,f(IK,_h(t),6e4),n)}),kK=r(function(e,t){return f(lu,24,f(IK,f(BK,e,t),60))}),$K=r(function(e,t){return f(lu,1e3,_h(t))}),NK=r(function(e,t){return f(lu,60,f(BK,e,t))}),RK={$:"Apr"},xK={$:"Aug"},_K={$:"Dec"},LK={$:"Feb"},PK={$:"Jan"},DK={$:"Jul"},UK={$:"Jun"},OK={$:"Mar"},MK={$:"May"},FK={$:"Nov"},VK={$:"Oct"},KK={$:"Sep"},HK=function(e){var t=f(IK,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)}},jK=r(function(e,t){switch(HK(f(BK,e,t)).month){case 1:return PK;case 2:return LK;case 3:return OK;case 4:return RK;case 5:return MK;case 6:return UK;case 7:return DK;case 8:return xK;case 9:return KK;case 10:return VK;case 11:return FK;default:return _K}}),qK=r(function(e,t){return f(lu,60,f(IK,_h(t),1e3))}),GK={$:"Fri"},zK={$:"Mon"},YK={$:"Sat"},WK={$:"Sun"},JK={$:"Thu"},QK={$:"Tue"},XK={$:"Wed"},ZK=r(function(e,t){switch(f(lu,7,f(IK,f(BK,e,t),1440))){case 0:return JK;case 1:return GK;case 2:return YK;case 3:return WK;case 4:return zK;case 5:return QK;default:return XK}}),eH=n(function(e,t,r){return e.toAmPm(f(kK,t,r))}),tH=r(function(e,t){return HK(f(BK,e,t)).day}),rH=tH,nH=m([WK,zK,QK,XK,JK,GK,YK]),aH=r(function(e,t){return function(e){return e.a}(f(Tu,T(0,WK),dd(f(Eu,function(r){return C(r.b,f(ZK,e,t))},f(Ni,r(function(e,t){return T(e,t)}),nH)))))}),iH=function(e){return l(Wa,ri,0,e)},oH=r(function(e,t){return HK(f(BK,e,t)).year}),uH=function(e){return!f(lu,4,e)&&(!!f(lu,100,e)||!f(lu,400,e))},sH=r(function(e,t){switch(t.$){case"Jan":return 31;case"Feb":return uH(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}}),cH=m([PK,LK,OK,RK,MK,UK,DK,xK,KK,VK,FK,_K]),fH=r(function(e,t){return f(Tu,T(0,PK),dd(f(Eu,function(r){r.a;return C(r.b,f(jK,e,t))},f(Ni,r(function(e,t){return T(e,t)}),cH))))}),lH=r(function(e,t){return 1+function(e){var t=e.a;e.b;return t}(f(fH,e,t))}),dH=r(function(e,t){var r=f($c,f(lH,e,t)-1,cH);return iH(f(ho,sH(f(oH,e,t)),r))+f(rH,e,t)}),hH=r(function(e,t){return f(lH,e,t)/4|0}),pH=r(function(e,t){var r=xi(t),n=e-iu(r);return B(f(_i,"",f(ho,function(e){return"0"},f($i,1,n))),r)}),vH=function(e){return e?e<=12?e:e-12:12},gH=lv(315576e5),yH=r(function(e,t){return yp(gH*f(oH,e,t))}),mH=r(function(e,t){var r=f(yH,e,t),n=f(aH,e,r);return 1+((f(dH,e,t)+n)/7|0)}),bH=r(function(e,t){return xi(f(oH,e,t))}),CH=a(function(e,t,r,n){switch(n.$){case"MonthNumber":return xi(f(lH,t,r));case"MonthSuffix":return function(t){return B(xi(t),e.toOrdinalSuffix(t))}(f(lH,t,r));case"MonthFixed":return f(pH,2,f(lH,t,r));case"MonthNameAbbreviated":return e.toMonthAbbreviation(f(jK,t,r));case"MonthNameFull":return e.toMonthName(f(jK,t,r));case"QuarterNumber":return xi(1+f(hH,t,r));case"QuarterSuffix":return function(t){return B(xi(t),e.toOrdinalSuffix(t))}(1+f(hH,t,r));case"DayOfMonthNumber":return xi(f(rH,t,r));case"DayOfMonthSuffix":return function(t){return B(xi(t),e.toOrdinalSuffix(t))}(f(rH,t,r));case"DayOfMonthFixed":return f(pH,2,f(rH,t,r));case"DayOfYearNumber":return xi(f(dH,t,r));case"DayOfYearSuffix":return function(t){return B(xi(t),e.toOrdinalSuffix(t))}(f(dH,t,r));case"DayOfYearFixed":return f(pH,3,f(dH,t,r));case"DayOfWeekNumber":return xi(f(aH,t,r));case"DayOfWeekSuffix":return function(t){return B(xi(t),e.toOrdinalSuffix(t))}(f(aH,t,r));case"DayOfWeekNameAbbreviated":return e.toWeekdayAbbreviation(f(ZK,t,r));case"DayOfWeekNameFull":return e.toWeekdayName(f(ZK,t,r));case"WeekOfYearNumber":return xi(f(mH,t,r));case"WeekOfYearSuffix":return function(t){return B(xi(t),e.toOrdinalSuffix(t))}(f(mH,t,r));case"WeekOfYearFixed":return f(pH,2,f(mH,t,r));case"YearNumberLastTwo":return f(qs,2,f(bH,t,r));case"YearNumber":return f(bH,t,r);case"AmPmUppercase":return tM(l(eH,e,t,r));case"AmPmLowercase":return Ls(l(eH,e,t,r));case"HourMilitaryNumber":return xi(f(kK,t,r));case"HourMilitaryFixed":return f(pH,2,f(kK,t,r));case"HourNumber":return xi(vH(f(kK,t,r)));case"HourFixed":return f(pH,2,vH(f(kK,t,r)));case"HourMilitaryFromOneNumber":return xi(1+f(kK,t,r));case"HourMilitaryFromOneFixed":return f(pH,2,1+f(kK,t,r));case"MinuteNumber":return xi(f(NK,t,r));case"MinuteFixed":return f(pH,2,f(NK,t,r));case"SecondNumber":return xi(f(qK,t,r));case"SecondFixed":return f(pH,2,f(qK,t,r));case"MillisecondNumber":return xi(f($K,t,r));case"MillisecondFixed":return f(pH,3,f($K,t,r));default:return n.a}}),SH=a(function(e,t,r,n){return f(_i,"",f(ho,l(CH,e,r,n),t))}),EH=o(function(e,t,r,n,a,i){return{toAmPm:a,toMonthAbbreviation:t,toMonthName:e,toOrdinalSuffix:i,toWeekdayAbbreviation:n,toWeekdayName:r}}),TH=function(e){return e>11?"pm":"am"},wH=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"}},IH=function(e){switch(f(lu,100,e)){case 11:case 12:case 13:return"th";default:switch(f(lu,10,e)){case 1:return"st";case 2:return"nd";case 3:return"rd";default:return"th"}}},AH=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"}},BH=p(EH,wH,f(Oa,wH,Ks(3)),AH,f(Oa,AH,Ks(3)),TH,IH),kH=SH(BH),$H={$:"MonthNameFull"},NH=$H,RH=function(e){return{$:"Text",a:e}},xH=RH,_H={$:"YearNumber"},LH=_H,PH=n(function(e,t,n){var a=r(function(e,t){return f(Dx,m([yx(18),Ax(6)]),m([f(RR,m([Nx]),Na(e)),f(RR,m([wK]),Na(t))]))}),i=kH(m([NH,xH(", "),LH])),o=f(Dx,m([Ax(23),eA(_R)]),B(f(ho,function(e){var t=e.a,r=e.b;return f(a,t,r)},m([T("First Trade",function(){var e=n.firstTrade;if("Just"===e.$){var t=e.a;return f(i,SK,t)}return"No Committed Trades yet!"}()),T("Release Outcomes",xi(n.numReleases)+" trades / "+rL(n.amountReleased)+" "+k_(e)+" Released"),T("Abort Outcomes",xi(n.numAborts)+" trades"),T("Burn Outcomes",xi(n.numBurns)+" trades / "+rL(n.amountBurned)+" "+k_(e)+" Burned")])),m([f(RR,m([Ex]),f(FF,"View User History",CK(n.asRole)))])));return f(Dx,m([ux(8),EK,TK,qR(K_),Ax(1),YR({blur:20,color:d(HR,0,0,0,.08),offset:T(0,0),size:0})]),m([f(RR,m([eA(_R),qR(ZR),r_(17)]),f(bK,18,t)),f(RR,m([eA(_R),qR(ZR),r_(17)]),o)]))}),DH=n(function(e,t,r){var n=l(mK,t,e.parameters.initiatorRole,e.parameters.initiatorAddress),a=cK(e.parameters.initiatorRole)+" Stats";return f(RR,r?m([ID(f(RR,m([AD(30),_x]),l(PH,e.factory,e.parameters.initiatorAddress,n)))]):tr,f(aK,a,f(Mx,m([eA(_R),Ax(20),ix,CP(gK)]),f(ho,Mx(m([Ax(5)])),m([m([f(f_,m([JI(VR(28))]),vK),f(RR,m([yx(24),h_,n$(dK)]),Na(l(cu,2,I("0"),xi(n.numReleases))))]),m([f(f_,m([JI(VR(28))]),hK),f(RR,m([yx(24),h_,n$(fK)]),Na(l(cu,2,I("0"),xi(n.numAborts))))]),m([f(f_,m([JI(VR(28))]),pK),f(RR,m([yx(24),h_,n$(lK)]),Na(l(cu,2,I("0"),xi(n.numBurns))))])])))))}),UH=r(function(e,t){if("Token"===e.$){if("EthDai"===e.a.$){e.a;return"https://etherscan.io/address/"+Ua(t)}e.a;return"https://kovan.etherscan.io/address/"+Ua(t)}switch(e.a.$){case"Eth":e.a;return"https://etherscan.io/address/"+Ua(t);case"Kovan":e.a;return"https://kovan.etherscan.io/address/"+Ua(t);default:e.a;return"https://blockscout.com/poa/dai/address/"+Ua(t)}}),OH=n(function(e,t,r){return f(Jk,e,{label:Na(Ua(r)),url:f(UH,t,r)})}),MH=function(e){return f(aK,"Trade Status",f(Dx,m([yx(24),h_,Ax(8)]),m([Na(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(OH,m([yx(12),n$(pM),dF]),e.factory,e.creationInfo.address)])))},FH=i(function(e,t,r,n,a){return f(Mx,m([eA(_R),mM]),m([MH(t),f(oK,t,r),sK(t),l(DH,t,n,a)]))}),VH=l(KR,9,32,107),KH=i_({description:"chat",src:"/DAIHard/static/img/chat.svg"}),HH=f(RR,m([ux(4),ix,CP(ZV),r_(5),qR(l(KR,22,0,255))]),f(f_,m([eA(VR(42))]),KH)),jH=function(e){switch(e.$){case"NotClosed":return"";case"Recalled":return"Recalled";case"Aborted":return"Aborted";case"Released":return"Released";default:return"Burned"}},qH=d(PM,1,31,52,.13),GH=function(e){return f(Dx,m([ux(12),qR(K_),r_(15),Ax(15),Ex]),m([f(RR,m([yx(24),px,pL,Ex]),Na("External Payment Method")),f($x,m([yx(18),JI(XI),qR(ZR),YR({blur:5,color:d(HR,0,0,0,.2),offset:T(-3,3),size:0}),ux(3),r_(5)]),m([f(Tu,f(RR,m([n$(qH),pL]),Na("No payment methods found.")),f(Bu,Na,f(Bu,function(e){return e.info},dd(e))))]))]))},zH={$:"Active"},YH=function(e){return{$:"ExpandPhase",a:e}},WH=m([qR(VH),n$(ZR)]),JH=m([qR(ZR)]),QH=i_({description:"flame",src:"/DAIHard/static/img/flame.png"}),XH=r(function(e,t){return fl(f(jo,ll(e),ll(t)))}),ZH=r(function(e,t){return d($M,w(d(HR,1,.6,.2,1),d(HR,1,.6,.2,.8),d(HR,1,.6,.2,.6)),ZR,e,t)}),ej=n(function(e,t,r){return{$:"CommitClicked",a:e,b:t,c:r}}),tj=function(e){return{$:"ContractActionClicked",a:e}},rj={$:"Web3Connect"},nj=function(e){if("Token"===e.$){if("EthDai"===e.a.$){e.a;return gN}e.a;return vN}switch(e.a.$){case"Eth":e.a;return gN;case"Kovan":e.a;return vN;default:e.a;return yN(100)}},aj=n(function(e,t,r){var n=Ng(r);if("Just"===n.$){var a=n.a;if(C(nj(t.factory),a.network)){return"TimeUp"===f(x_,e,t).$?MR:f(Mx,m([Ax(8)]),function(){var e=w(t.state.phase,f(ny,t,a.address),f(ay,t,a.address));e:for(;;)switch(e.a.$){case"Open":if("Just"===e.b.$){if("Initiator"===e.b.a.$){e.a,e.b.a;return m([f(ps,Dw,f(FF,"Remove and Refund this Trade",Lw))])}break e}var r=(e.a,e.b,ll(mE(t.parameters)));return m([f(NM,"Deposit and Commit to Trade",l(ej,t,a,r))]);case"Committed":if("Just"===e.c.$){if("Buyer"===e.c.a.$){e.a,e.c.a;return m([f(ps,tj,f(ZH,"Abort Trade",Cw)),f(ps,tj,f(NM,"Confirm Payment",Bw)),HH])}e.a,e.c.a;return m([HH])}break e;case"Judgment":if("Just"===e.c.$){if("Seller"===e.c.a.$){e.a,e.c.a;return m([f(ps,tj,f(NM,"Burn it All!",Aw)),f(ps,tj,f(FF,"Release Everything",Pw)),HH])}e.a,e.c.a;return m([HH])}break e;default:break e}return tr}())}return f($x,m([yx(18),pL,n$(m_)]),m([Na("You must connect to the "+CM(t.factory)+" network to interact with this trade.")]))}return f(NM,"Connect to Wallet",rj)}),ij={$:"Finished"},oj={$:"NotStarted"},uj=r(function(e,t){var r=T(b_(t),b_(e.state.phase)),n=r.a,a=r.b;return E(n,a)>0?oj:C(n,a)?zH:ij}),sj=n(function(e,t,r){for(;;){if(t<=0)return e;var n=f(Sa,r,e),a=t-1,i=r;e=n,t=a,r=i}}),cj=r(function(e,t){return l(sj,tr,e,t)}),fj=a(function(e,t,r,n){var a=rL(f(bl,r.parameters.tradeAmount,r.parameters.buyerDeposit))+" "+k_(r.factory),i=rL(r.parameters.tradeAmount)+" "+k_(r.factory),o=f(Mx,tr,f(cj,3,f(f_,m([JI(VR(18))]),QH))),u=f(Ju,RR(m([n$(l(Xk,1,0,0))])),Na),s=Z_(r.terms.price),c=C(e,r.state.phase),d=f(kg,ay(r),f(Bu,function(e){return e.address},Ng(n))),h=c?ZR:L_,p=$x(m([n$(h),yx(18),px])),v=c?l(KR,0,226,255):l(KR,16,7,234),g=f(Ju,RR(m([n$(v)])),Na),y=rL(r.parameters.buyerDeposit)+" "+k_(r.factory),b=r.parameters.abortPunishment,S=rL(b)+" "+k_(r.factory),E=rL(f(XH,r.parameters.buyerDeposit,b))+" "+k_(r.factory),w=rL(f(XH,r.parameters.tradeAmount,b))+" "+k_(r.factory),I=function(){var t=T(e,d);if("Just"===t.b.$)switch(t.a.$){case"Open":var n=(t.a,t.b.a);return T("And Now, We Wait",function(){return"Buyer"===n.$?f(ho,p,m([m([Na("Your "),u("burnable deposit"),Na(" of "),g(y),Na(" is now held in this contract, and your offer to buy "),g(i),Na(" for "),g(s),Na(" is now listed in the marketplace.")]),m([Na("If another user likes your offer, they can become the Seller by depositing the full "),g(i),Na(" into this contract.")]),m([Na("If no one commits within the Open Window, your offer will expire, refunding the "),g(y),Na(" to you.")])])):f(ho,p,m([m([Na("Your offer to sell the "),g(i),Na(" held in this contract for "),g(s),Na(" is now listed in the marketplace.")]),m([Na("If another user likes your offer, they can become the Buyer by depositing a "),u("burnable deposit"),Na(" of 1/3 of the trade amount "),g("("+y+")"),Na(" into this contract.")]),m([Na("If no one commits within the Open Window, your offer will expire, refunding the "),g(i),Na(" to you.")])]))}());case"Committed":if("Buyer"===t.b.a.$){t.a,t.b.a;return T("Time to Pay Up",f(ho,p,m([m([Na("You must now pay the Seller "),g(s),Na(" via the External Payment Method, "),f(RR,m([px]),Na("and then click ")),u("Confirm Payment"),Na(" before the payment window runs out. Use the chat to coordinate.")]),m([Na("If you abort the trade, or do not confirm payment before this time is up, "),g(S),Na(" (1/4 of the "),u("burnable deposit"),Na(") will be "),u("burned"),Na(" from both parties, while the remainder of each party's deposit is refunded ("),g(w),Na(" to the Seller, "),g(E),Na(" to you).")]),m([Na("This may be your last chance to clear up any ambiguity before Judgement. Do not confirm unless you're sure the "),g(s),Na(" has been unmistakably transferred.")])])))}t.a,t.b.a;return T("Time to Get Paid",f(ho,p,m([m([Na("Work and communicate with the Buyer to receive "),g(s),Na(" as described in External Payment Method. Then, the Buyer should confirm the payment, moving the trade to the final phase.")]),m([Na("If the Buyer aborts the trade, or doesn't confirm payment before this time is up, "),g(S),Na(" (1/4 of the "),u("burnable deposit"),Na(") will be "),u("burned"),Na(" from both parties, while the remainder of each party's deposit is refunded ("),g(w),Na(" to you, "),g(E),Na(" to the Buyer).")])])));case"Judgment":if("Buyer"===t.b.a.$){t.a,t.b.a;return T("Judgement",f(ho,p,m([m([Na("If the Seller confirms receipt of payment, or fails to decide within the Burn/Release Window, the combined balance of "),g(a),Na(" will be released to you.")]),m([Na("If they cannot confirm they've received payment from you, they will probably instead "),u("burn the contract's balance of "),g(a),u("."),Na(" In this case the "),g(a),Na(" will be lost to both parties.")]),m([Na("These are the only options the Seller has. So, fingers crossed!")])])))}t.a,t.b.a;return T("Judgement",f(ho,p,m([m([Na("By pushing the contract to the final stage, the Buyer has indicated that the transfer has taken place, and awaits your judgement.")]),m([Na("So, have you recieved the "),g(s),Na("? If so, you can click "),g("Release Everything"),Na(".")]),m([Na("If not, the Buyer is probably trying to scam you, and you should probably "),u("burn it all"),Na(". You're not getting it back either way, and you wouldn't want the other guy to get it, would you?")]),m([Na("If you don't decide within the Burn/Release Window, the balance will be automatically released.")])])));default:t.a;return T("Contract closed.",m([p(m([Na("Check the chat log for the full history.")]))]))}else switch(t.a.$){case"Open":t.a,t.b;return T("Get it while it's hot",function(){return"Seller"===r.parameters.initiatorRole.$?f(ho,p,m([m([Na("The Seller has deposited "),g(i),Na(" into this contract, and offers to sell it for "),g(s),Na(". To become the Buyer, you must deposit 1/3 of the trade amount "),g("("+y+")"),Na(" into this contract by clicking "),u("Deposit and Commit to Trade"),Na(".")]),m([Na("If the trade is successful, the combined "+k_(r.factory)+" balance "),g("("+a+")"),Na(" will be released to you. If anything goes wrong, there are "),u("burnable punishments "),o,Na(" for both parties (see Payment Window for more on this).")]),m([Na("Don't commit unless you can fulfil one of the seller’s accepted payment methods below for "),g(s),Na(" within the payment window.")])])):f(ho,p,m([m([Na("The Buyer is offering to buy "),g(i),Na(" for "),g(s),Na(", and has deposited "),g(y),Na(" into this contract as a "),u("burnable deposit"),Na(". To become the Seller, deposit "),g(i),Na(" into this contract by clicking "),u("Deposit and Commit to Trade"),Na(".")]),m([Na("When you receive the "),g(s),Na(" from the Buyer, the combined "+k_(r.factory)+" balance "),g("("+a+")"),Na(" will be released to the Buyer. If anything goes wrong, there are "),u("burnable punishments "),o,Na(" for both parties (see Payment Window for more on this).")]),m([Na("Don't commit unless you can receive "),g(s),Na(" via one of the Buyer's payment methods below, within the payment window.")])]))}());case"Committed":t.a,t.b;return T("Making the Payment",f(ho,p,m([m([Na("During this phase, the Buyer is expected to transfer "),g(s),Na(" to the Seller, as described in External Payment Method, "),f(RR,m([px]),Na("and ")),u("Confirm the Payment "),Na(" before the payment window runs out. This would move the trade to the final phase.")]),m([Na("If the Buyer aborts the trade, or doesn't confirm payment before this time is up, "),g(S),Na(" (1/4 of the "),u("burnable deposit"),Na(" amount) will be "),u("burned"),Na(" from both parties, while the remainder of each party's deposit is refunded ("),g(w),Na(" to the Seller, "),g(E),Na(" to the Buyer).")])])));case"Judgment":t.a,t.b;return T("Judgement",f(ho,p,m([m([Na("The Buyer has indicated that the transfer has taken place, and awaits the Seller's judgement on the fact of the matter.")]),m([Na("If the Seller can verify he has received the "),g(s),Na(", he will probably release the total balance of "),g(i),Na(" to the Buyer. If he cannot verify payment, he will probably instead "),u("burn it all"),Na(".")]),m([Na("If the Seller has not made a decision before the Burn/Release Window expires, the "),g(i),Na(" will be automaticall released.")])])));default:t.a,t.b;return T("Contract closed.",tr)}}(),A=I.a,B=I.b;return f(Dx,m([eA(_R),JI(_R),r_(20),Ax(30)]),m([f(Mx,m([eA(_R)]),m([f(RR,m([yx(24),px,n$(v),SL]),Na(A))])),f(Dx,m([eA(_R),Xx,Ax(13)]),B),f(RR,m([_x]),function(){switch(f(uj,r,e).$){case"Active":return l(aj,t,r,n);case"NotStarted":return f(RR,m([yx(20),px,pL,n$(m_)]),Na("Phase not yet started."));default:return f(RR,m([yx(20),px,pL]),Na("Phase no longer active."))}}())]))}),lj=function(e){switch(e.$){case"Open":return"Expiring...";case"Committed":return"Aborting...";case"Judgment":return"Releasing...";default:return""}},dj=i_({description:"committed phase",src:"/DAIHard/static/img/phase-committed.svg"}),hj=i_({description:"judgment phase",src:"/DAIHard/static/img/time-clock-fire.svg"}),pj=i_({description:"open phase",src:"/DAIHard/static/img/diamond-give-white.svg"}),vj=function(e){switch(e.$){case"Open":return pj;case"Committed":return dj;case"Judgment":return hj;default:return J_}},gj=a(function(e,t,r,n){return{$:"RgbaSpace",a:e,b:t,c:r,d:n}}),yj=a(function(e,t,r,n){return d(gj,e,t,r,n)}),mj=function(e){var t=e.a,r=e.b,n=e.c;return{alpha:e.d,blue:n,green:r,red:t}},bj=function(e){return function(e){return d(yj,e.red,e.green,e.blue,e.alpha)}(mj(e))},Cj=function(e){return{$:"Circle",a:e}},Sj=Cj,Ej=d(gj,0,0,0,1),Tj={$:"Flat"},wj={$:"Sharp"},Ij=function(e){return{$:"Uniform",a:e}},Aj=Ij,Bj={cap:Tj,dashPattern:tr,dashPhase:0,fill:Aj(Ej),join:wj,thickness:2},kj=n(function(e,t,r){return A(Bj,{dashPattern:e,fill:r,thickness:t})}),$j=kj(tr),Nj={$:"Transparent"},Rj=Nj,xj=f($j,0,Rj),_j=r(function(e,t){return{$:"Shape",a:e,b:t}}),Lj=function(e){return{basic:e,handlers:tr,name:La,opacity:1,rotation:0,scale:T(1,1),shift:T(0,0)}},Pj=function(e){return f(Ju,Lj,_j(e))},Dj=function(e){return Pj(T(e,xj))},Uj=function(e){return T(-e.a,-e.b)},Oj=r(function(e,t){var r=e.a,n=e.b,a=t.shift;return A(t,{shift:T(a.a+r,a.b+n)})}),Mj=r(function(e,t){return f(Oj,Uj(e(t)),t)}),Fj=function(e){var t=r(function(e,t){var r=e.a,n=e.b,a=t.a,i=t.b;return T(f(Sa,r,a),f(Sa,n,i))});return l(ro,t,T(tr,tr),e)},Vj=r(function(e,t){return{$:"Path",a:e,b:t}}),Kj=kr,Hj=$r,jj=function(e){var t=e.shift,r=e.scale,n=e.rotation,a=function(e){var t=e.a,r=e.b,a=Hj(n),i=Kj(n);return T(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 T(o*t,u*r)},c=t,l=c.a,d=c.b;return f(Ju,f(Ju,function(e){var t=e.a,r=e.b;return T(t+l,r+d)},s),a)},qj=function(e){return ho(function(t){var r=t.a,n=t.b,a=e/2;return T(r<0?r-a:r+a,n<0?n-a:n+a)})},Gj=r(function(e,t){var r=t.a,n=t.b,a=n/2,i=r/2;return f(qj,e,m([T(-i,-a),T(i,-a),T(i,a),T(-i,a)]))}),zj=function(e){var t=e.toTop,r=e.toBottom,n=e.toRight,a=e.toLeft;return m([T(-a,-r),T(n,-r),T(n,t),T(-a,t)])},Yj=function(e){var t=Wj(e.basic),r=Fj(f(ho,jj(e),t)),n=r.a,a=r.b;return{toBottom:-f(Tu,0,ek(a)),toLeft:-f(Tu,0,ek(n)),toRight:f(Tu,0,ZB(n)),toTop:f(Tu,0,ZB(a))}},Wj=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(Gj,r,T(a,a));case"Ellipse":var i=e.a,r=i.b.thickness,o=e.b,u=o.a,s=o.b;return f(Gj,r,T(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(Gj,r,T(d,h));case"Polygon":var p=e.a,r=p.b.thickness,v=e.b.a;return f(qj,r,v);default:var g=e.a,y=g.b,m=e.b.a,b=f(Vj,y,m);e=b;continue e}case"Path":var r=e.a.thickness,S=e.a.cap,v=e.b.a;return f(qj,C(S,Tj)?0:r,v);case"Text":case"Image":case"Html":var E=e.a;return f(Gj,0,E);case"Group":var w=e.a;return f(qj,0,zb(f(ho,f(Oa,Yj,zj),w)));default:var I=e.b;return f(qj,0,zj(Yj(I)))}},Jj=function(e){var t=Yj(e);return t.toTop+t.toBottom},Qj=function(e){var t=Yj(e);return T(-t.toLeft,t.toTop)},Xj=function(e){var t=Yj(e);return t.toLeft+t.toRight},Zj=wn("http://www.w3.org/2000/svg"),eq=Zj("svg"),tq=xn("height"),rq=xn("version"),nq=xn("width"),aq=Zj("circle"),iq=Zj("ellipse"),oq=Zj("foreignObject"),uq=Zj("g"),sq=Zj("image"),cq=Zj("polygon"),fq=Zj("polyline"),lq=Zj("rect"),dq=rB,hq=Zj("text"),pq=xn("id"),vq=xn("points"),gq=xn("r"),yq=xn("rx"),mq=xn("ry"),bq=function(e){return l(_n,"http://www.w3.org/1999/xlink","xlink:href",rt(e))},Cq=function(e){return{$:"Group",a:e}},Sq=xn("dominant-baseline"),Eq=xn("fill"),Tq=xn("fill-opacity"),wq=xn("font-family"),Iq=xn("font-size"),Aq=xn("font-style"),Bq=xn("font-variant"),kq=xn("font-weight"),$q=xn("opacity"),Nq=xn("stroke"),Rq=xn("stroke-dasharray"),xq=xn("stroke-dashoffset"),_q=xn("stroke-linecap"),Lq=xn("stroke-linejoin"),Pq=xn("stroke-opacity"),Dq=xn("stroke-width"),Uq=xn("text-anchor"),Oq=xn("text-decoration"),Mq=xn("transform"),Fq=function(e){switch(e.$){case"Round":return"round";case"Padded":return"square";default:return"butt"}},Vq=function(e){return f(_i," ",f(ho,function(e){var t=e.a,r=e.b;return f(_i,",",m([xi(t),xi(r)]))},e))},Kq=n(function(e,t,r){return d(gj,e,t,r,1)}),Hq=function(e){var t=e.a,r=e.b,n=e.c,a=e.d,i=function(e){return lv(1e4*e)/100};return fp(m(["rgba(",Wh(i(t)),"%,",Wh(i(r)),"%,",Wh(i(n)),"%,",Wh(function(e){return lv(1e3*e)/1e3}(a)),")"]))},jq=function(e){var t=e.a,r=e.b,n=e.c;return{alpha:e.d,blue:n,green:r,red:t}},qq=function(e){var t=jq(e),r=t.red,n=t.green,a=t.blue;return Hq(l(Kq,r,n,a))},Gq=function(e){if("Uniform"===e.$){var t=e.a;return qq(t)}return"none"},zq=function(e){var t=jq(e),r=t.alpha;return Wh(r)},Yq=function(e){if("Uniform"===e.$){var t=e.a;return zq(t)}return"0"},Wq=function(e){switch(e.$){case"Smooth":return"round";case"Sharp":return"miter";default:return"bevel"}},Jq=function(e){var t=Wh(e.scale.b),r=Wh(e.scale.a),n=Wh(-e.rotation/2/xL*360),a=Wh(-e.shift.b),i=Wh(e.shift.a);return fp(m(["translate(",i,",",a,") scale(",r,",",t,") rotate(",n,")"]))},Qq=function(e){var t=e.basic;switch(t.$){case"Path":var r=t.a;return m([Nq(Gq(r.fill)),Pq(Yq(r.fill)),Dq(Wh(r.thickness)),_q(Fq(r.cap)),Lq(Wq(r.join)),Eq("none"),$q(Wh(e.opacity)),Mq(Jq(e)),xq(xi(r.dashPhase)),Rq(Vq(r.dashPattern))]);case"Shape":var n=t.a,a=n.a,r=n.b;return m([Eq(Gq(a)),Tq(Yq(a)),Nq(Gq(r.fill)),Pq(Yq(r.fill)),Dq(Wh(r.thickness)),_q(Fq(r.cap)),Lq(Wq(r.join)),$q(Wh(e.opacity)),Mq(Jq(e)),xq(xi(r.dashPhase)),Rq(Vq(r.dashPattern))]);case"Text":var i=t.b,o=i.a;i.b;return m([Eq(Gq(Ij(o.color))),wq(function(){var e=o.typeface;switch(e.$){case"Serif":return"serif";case"Sansserif":return"sans-serif";case"Monospace":return"monospace";default:return e.a}}()),Iq(xi(o.size)),kq(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"}}()),Aq(function(){switch(o.shape.$){case"Upright":case"SmallCaps":return"normal";case"Slanted":return"oblique";default:return"italic"}}()),Bq(function(){return"SmallCaps"===o.shape.$?"small-caps":"normal"}()),Oq(function(){switch(o.line.$){case"None":return"none";case"Under":return"underline";case"Over":return"overline";default:return"line-through"}}()),Uq("middle"),Sq("middle"),Mq(Jq(e))]);default:return m([Mq(Jq(e))])}},Xq=xn("x"),Zq=xn("y"),eG=r(function(e,t){return m([nq(Wh(e)),tq(Wh(t)),Xq(Wh(-e/2)),Zq(Wh(-t/2))])}),tG=function(e){return f(_i," ",f(ho,function(e){var t=e.a,r=e.b;return f(_i,",",m([Wh(t),Wh(-r)]))},e))},rG=fx,nG=r(function(e,t){return f(e,t.a,t.b)}),aG=function(e){return f(ho,nG(rG),e)},iG=function(e){e:for(;;){var t=f(Tu,"_unnamed_",e.name),n=e.basic;switch(n.$){case"Path":var a=(n.a,n.b),i=a.a;return f(fq,B(m([pq(t),vq(tG(i))]),B(Qq(e),aG(e.handlers))),tr);case"Shape":var o=n.a,u=(o.a,o.b),s=n.b;switch(s.$){case"Polygon":var i=s.a;return f(cq,B(m([pq(t),vq(tG(i))]),B(Qq(e),aG(e.handlers))),tr);case"Circle":var c=s.a;return f(aq,B(m([pq(t),gq(Wh(c))]),B(Qq(e),aG(e.handlers))),tr);case"Ellipse":var d=s.a,h=s.b;return f(iq,B(m([pq(t),yq(Wh(d)),mq(Wh(h))]),B(Qq(e),aG(e.handlers))),tr);case"Rectangle":var p=s.a,v=s.b,c=s.c;return f(lq,B(m([pq(t),yq(Wh(c)),mq(Wh(c))]),B(f(eG,p,v),B(Qq(e),aG(e.handlers)))),tr);default:var a=s.a,g=A(e,{basic:f(Vj,u,a)});e=g;continue e}case"Text":var y=n.b,b=(y.a,y.b);return f(hq,B(m([pq(t)]),B(Qq(e),aG(e.handlers))),m([dq(b)]));case"Image":var C=n.a,p=C.a,v=C.b,S=n.b;return f(sq,B(m([pq(t),bq(S)]),B(f(eG,p,v),B(Qq(e),aG(e.handlers)))),tr);case"Html":var E=n.a,p=E.a,v=E.b,T=n.b;return f(oq,B(m([pq(t)]),B(f(eG,p,v),B(Qq(e),aG(e.handlers)))),m([T]));case"Group":var w=n.a;return f(uq,f(Sa,pq(t),B(Qq(e),aG(e.handlers))),l(Wa,r(function(e,t){return f(Sa,iG(e),t)}),tr,w));default:var I=n.a,k=n.b,g=A(e,{basic:Cq(m([I,k]))});e=g;continue e}}},oG=r(function(e,t){var r=e.a,n=e.b,a=Wh(r),i=Wh(n);return f(TA,tr,m([f(eq,m([nq(a),tq(i),rq("1.1")]),m([iG(t)]))]))}),uG=function(e){return f(oG,T(Xj(e),Jj(e)),f(Mj,Qj,e))},sG=r(function(e,t){var r=vj(e),n=function(){switch(t.$){case"NotStarted":return l(KR,10,33,108);case"Active":return l(KR,0,100,170);default:return l(KR,1,129,104)}}(),a=DD(uG(f(Dj,Aj(bj(n)),Sj(50))));return f(RR,m([Ex,OR(f(f_,m([Ex,Xx,JI(VR(60))]),r))]),a)}),cG=function(e){var t=m([pL,px,yx(20)]);switch(e.$){case"Active":return f(RR,B(t,m([n$(bx)])),Na("Active"));case"NotStarted":return f(RR,B(t,m([n$(m_)])),Na("Not Started"));default:return f(RR,t,Na("Finished"))}},fG=n(function(e,t,r){var n=f(uj,t,e),a=function(){return"Active"===n.$?l(KR,0,226,255):L_}(),i=f(RR,m([n$(a),yx(20),px,Ex]),Na(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 MR;switch(n.$){case"NotStarted":return d(V_,m([Ex]),m([yx(22),h_]),T(L_,K_),f(R_,e,t));case"Active":var a=f(x_,r,t);if("TimeLeft"===a.$){var i=a.a;return d(Y_,m([Ex]),m([yx(22),h_]),T(ZR,K_),i)}return f(Dx,m([Ex,Ax(10)]),m([f(RR,m([Ex]),Na(lj(e))),f(FF,"Poke",Dw(_w))]));default:return f(RR,m([JI(VR(1))]),MR)}}();return f(Dx,m([r_(20),Ax(10),JI(_R)]),m([f(RR,m([XL,Ex]),i),f(RR,m([JI(_R),Ex]),f(RR,m([Xx]),f(sG,e,n))),f(Dx,m([Ax(10),lF,Ex]),m([f(RR,m([Ex]),cG(n)),o]))]))}),lG=r(function(e,t){return{$:"Min",a:e,b:t}}),dG=r(function(e,t){return f(lG,e,t)}),hG=i(function(e,t,r,n,a){var i=f(uj,t,e),o=f(RR,m([r_(10),eA(_R),JI(_R)]),d(fj,e,a,t,r)),u=function(){switch(e.$){case"Open":return t.parameters.autorecallInterval;case"Committed":return t.parameters.autoabortInterval;case"Judgment":return t.parameters.autoreleaseInterval;default:return yp(0)}}(),s=l(fG,e,t,a),c=(function(){switch(i.$){case"NotStarted":return u;case"Active":return f(mp,f(EE,t.state.phaseStartTime,u),a);default:yp(0)}}(),m([ux(12),XL,JI(f(dG,380,XI)),YR({blur:8,color:d(HR,0,0,0,.2),offset:T(0,0),size:0})])),h=f(RR,m([JI(_R),eA(VR(1)),qR(function(){return"Active"===i.$?l(Xk,0,0,1):K_}())]),MR);return n?f(Mx,B(c,B(C(i,zH)?WH:JH,m([eA(_R)]))),m([s,h,o])):f(Mx,B(c,B(C(i,zH)?WH:JH,m([ix,dx(YH(e))]))),m([s]))}),pG=a(function(e,t,r,n){return"Closed"===e.state.phase.$?f(Mx,m([Ex,ux(12),Ax(10),r_(10),qR(VH),yx(24),px,n$(ZR)]),m([Na("Trade "+jH(e.state.closedReason)),HH])):f(Dx,m([eA(_R),Ax(10)]),m([f(Mx,m([eA(_R),JI(XI),Ax(20)]),m([h(hG,Xg,e,r,C(t,Xg),n),h(hG,Jg,e,r,C(t,Jg),n),h(hG,Qg,e,r,C(t,Qg),n)])),GH(e.terms.paymentMethods)]))}),vG=a(function(e,t,r,n){return T(d(fP,1800,La,"Trade at "+function(){var e=rI(n.trade);if("Just"===e.$){var t=e.a;return Ua(t.address)}return"..."}(),f(RR,m([r_(30),eA(_R)]),function(){var e=n.trade;switch(e.$){case"LoadedTrade":var a=e.a;return f(Dx,m([eA(_R),JI(_R),Ax(40)]),m([h(FH,t,a,n.wallet,r,n.showStatsModal),f(RR,m([eA(_R),f(rx,40,0),Ax(40)]),d(pG,a,n.expandedPhase,n.wallet,t))]));case"PartiallyLoadedTrade":e.a;return f(RR,m([Ex,Xx,yx(30)]),Na("Loading trade info..."));default:return f(RR,m([Ex,Xx,yx(30)]),Na("Invalid trade"))}}())),m([eK(n),nK(n)]))}),gG=n(function(e,t,r){var n=r.a,a=r.b;return T(e(n),t(a))}),yG=r(function(e,t){var r=function(){var r=t.submodel;switch(r.$){case"CreateModel":var n=r.a;return l(gG,ps(DI),ho(ps(DI)),vF(n));case"CryptoSwapModel":var a=r.a;return l(gG,ps(OI),ho(ps(OI)),ZF(a));case"TradeModel":var i=r.a;return l(gG,ps(jI),ho(ps(jI)),d(vG,e,t.time,t.tradeCaches,i));case"MarketplaceModel":var o=r.a;return l(gG,ps(VI),ho(ps(VI)),l(FV,t.time,t.tradeCaches,o));default:var u=r.a;return T(f(ps,xI,l(lP,t.time,t.tradeCaches,u)),tr)}}(),n=r.a,a=r.b;return T(f(RR,m([eA(_R),JI(_R),ux(10)]),n),a)}),mG=function(e){return{$:"DismissNotice",a:e}},bG=function(e){return f(DL,_P,LP(e))},CG=function(e){var t=e.a,n=e.b,a=function(){return"Error"===n.noticeType.$?l(Xk,1,1,1):l(Xk,0,0,0)}(),i=function(){switch(n.noticeType.$){case"Update":return l(KR,100,200,255);case"Caution":return l(KR,255,188,0);case"Error":return l(KR,255,70,70);default:return l(KR,200,200,200)}}(),o=f(RR,m([_x,XL,UL(5),bG(5)]),iF(mG(t)));return f(RR,m([qR(i),ux(10),r_(8),eA(_R),cL(1),uL(d(HR,0,0,0,.15)),VV]),f(Dx,m([Ax(4),eA(_R)]),f(Ni,r(function(e,t){return f($x,m([eA(_R),n$(a)]),e?t:f(Sa,o,t))}),n.mainParagraphs)))},SG=function(e){return C(e,tr)?tr:m([f(Dx,m([PP(20),UL(20),Ax(10),_x,lF,eA(VR(300)),yx(15)]),f(ho,CG,f(Eu,function(e){return C(e.b.align,va)},f(Ni,r(function(e,t){return T(e,t)}),e)))),f(Dx,m([bG(20),AD(100),Ax(10),SL,XL,eA(VR(300)),yx(15)]),f(ho,CG,f(Eu,function(e){return C(e.b.align,uN)},f(Ni,r(function(e,t){return T(e,t)}),e))))])},EG=r(function(e,t){var r=f(yG,e,t),n=r.a,a=r.b;return T(f(Dx,m([j_(WR),OR(Fx(t)),eA(_R),JI(_R),r_(30)]),m([f(RR,m([JI(VR(50))]),MR),n])),B(a,SG(t.userNotices)))}),TG=function(e){return{$:"FocusStyleOption",a:e}},wG=TG,IG=r(function(e,t){return{$:"OnlyDynamic",a:e,b:t}}),AG=r(function(e,t){return{$:"StaticRootAndDynamic",a:e,b:t}}),BG={$:"AllowHover"},kG={$:"Layout"},$G={backgroundColor:La,borderColor:La,shadow:_a({blur:0,color:d(Qk,155/255,203/255,1,1),offset:T(0,0),size:3})},NG=function(e){var t=r(function(e,t){switch(e.$){case"HoverOption":var r=e.a;return"Nothing"===t.hover.$?A(t,{hover:_a(r)}):t;case"FocusStyleOption":var n=e.a;return"Nothing"===t.focus.$?A(t,{focus:_a(n)}):t;default:var a=e.a;return"Nothing"===t.mode.$?A(t,{mode:_a(a)}):t}});return function(e){return{focus:function(){var t=e.focus;return"Nothing"===t.$?$G:t.a}(),hover:function(){var t=e.hover;return"Nothing"===t.$?BG:t.a}(),mode:function(){var t=e.mode;return"Nothing"===t.$?kG:t.a}()}}(l(ro,t,{focus:La,hover:La,mode:La},e))},RG=r(function(e,t){switch(t.$){case"Unstyled":var r=t.a;return r(iA);case"Styled":var n=t.a.styles,r=t.a.html;return f(r,e(n),iA);case"Text":var a=t.a;return pk(a);default:return pk("")}}),xG=n(function(e,t,r){var n=NG(e),a=function(){return"NoStaticStyleSheet"===n.mode.$?IG(n):AG(n)}();return f(RG,a,d(Yk,iA,NR,t,nA(m([r]))))}),_G=xA(5),LG=r(function(e,t){return{$:"FontFamily",a:e,b:t}}),PG={$:"SansSerif"},DG=function(e){return{$:"Typeface",a:e}},UG=q,OG=r(function(e,t){return B(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(_i,"-",UG(Ls(t)));case"ImportFont":var t=e.a;e.b;return f(_i,"-",UG(Ls(t)));default:var t=e.a.name;return f(_i,"-",UG(Ls(t)))}}())}),MG=function(){var e=m([DG("Open Sans"),DG("Helvetica"),DG("Verdana"),PG]);return m([f(t$,jR,l(e$,"bg-"+r$(d(Qk,1,1,1,0)),"background-color",d(Qk,1,1,1,0))),f(t$,Zk,l(e$,"fc-"+r$(d(Qk,0,0,0,1)),"color",d(Qk,0,0,0,1))),f(t$,vx,gx(20)),f(t$,_G,f(LG,l(Wa,OG,"font-",e),e))])}(),FG=n(function(e,t,r){var n=e.options;return l(xG,n,f(Sa,Wk(f(_i," ",m([cA.root,cA.any,cA.single]))),B(MG,t)),r)}),VG=function(e){return f(t$,_G,f(LG,l(Wa,OG,"ff-",e),e))},KG=PG,HG=DG,jG=function(e){return{body:m([function(){var t=f(EG,e.screenWidth,e),r=t.a,n=t.b,a=B(m([eA(_R),JI(_R),dx(kR),VG(m([HG("Soleil"),KG]))]),f(ho,OR,n));return l(FG,{options:m([wG({backgroundColor:La,borderColor:La,shadow:La})])},a,r)}()]),title:"DAIHard"}},qG=Ht,GG=qG({init:wN,onUrlChange:BR,onUrlRequest:AR,subscriptions:IR,update:W$,view:jG});!function(t){e.Elm?We("Elm",e.Elm,t):e.Elm=t}({App:{init:GG(f(Ws,function(e){return f(Ws,function(t){return f(Ws,function(r){return us({height:r,networkId:t,width:e})},f(Wl,"height",YT))},f(Wl,"networkId",YT))},f(Wl,"width",YT)))(0)}})}(this)},function(e,t,r){"use strict";function n(){"undefined"!=typeof web3?web3.version.getNetwork(function(e,t){var r;e?(console.log("Error initializing web3: "+e),r=0):r=parseInt(t),window.app=c.Elm.App.init({node:document.getElementById("elm"),flags:{networkId:r,width:window.innerWidth,height:window.innerHeight}}),i(app),a(app),o(app,web3)}):(window.app=c.Elm.App.init({node:document.getElementById("elm"),flags:{networkId:0,width:window.innerWidth,height:window.innerHeight}}),i(app),a(app),console.log("Metamask not detected."))}function a(e){e.ports.notifyPort.subscribe(function(e){h.notify(e.title,e.body,e.image)}),e.ports.requestNotifyPermissionPort.subscribe(function(){h.requestPermission(function(e){})})}function i(e){e.ports.gTagOut.subscribe(function(e){gtag("event",e.event,{event_category:e.category,event_label:e.label,value:e.value})})}function o(e,t){u(e,t),t.eth.getAccounts(function(r,n){n&&n.length>0&&s(e,t)})}function u(e,t){d.startWatching(e.ports.networkSentryPort,t),e.ports.connectToWeb3.subscribe(function(r){s(e,t)})}function s(e,t){window.ethereum&&!window.web3Connected&&(window.web3=new Web3(ethereum)),f.txSentry(e.ports.txOut,e.ports.txIn,t),f.walletSentry(e.ports.walletSentryPort,t),d.startWatching(e.ports.networkSentryPort,t),e.ports.genPrivkey.subscribe(function(t){l.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=l.encryptToPubkeys(t.message,t.pubkeyHexStrings);e.ports.encryptionFinished.send(r)}),e.ports.decryptMessage.subscribe(function(t){var r=t.id,n=l.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 c=r(42),f=(r.n(c),r(41)),l=r(40),d=r(39),h=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,v=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,v=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*v}},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();$(r,e[1],e[0]),$(f,t[1],t[0]),R(r,r,f),k(n,e[0],e[1]),k(f,t[0],t[1]),R(n,n,f),R(a,e[3],t[3]),R(a,a,F),R(i,e[2],t[2]),k(i,i,i),$(o,n,r),$(u,i,a),k(s,i,a),k(c,n,r),R(e[0],o,u),R(e[1],c,s),R(e[2],s,u),R(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(r,t[0],a),R(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),v(e[1],t),N(a,e[1]),R(i,a,M),$(a,a,e[2]),k(i,e[2],i),N(o,i),N(u,o),R(s,u,o),R(r,s,a),R(r,r,i),g(r,r),R(r,r,a),R(r,r,i),R(r,r,i),R(e[0],r,i),N(n,e[0]),R(n,n,i),y(n,a)&&R(e[0],e[0],j),N(n,e[0]),R(n,n,i),y(n,a)?-1:(C(e[0])===t[31]>>7&&$(e[0],U,e[0]),R(e[3],e[0],e[1]),0)}function v(e,t){var r;for(r=0;r<16;++r)e[r]=t[2*r]+(t[2*r+1]<<8);e[15]&=32767}function g(e,t){var r,n=B();for(r=0;r<16;++r)n[r]=t[r];for(r=250;r>=0;--r)N(n,n),1!==r&&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(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)N(n,n),2!==r&&4!==r&&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,v.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=g[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=g[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=g[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=g[e.state][v],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(56),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/docs/static/js/main-f00bf12f5b428b34fa4f.js b/docs/static/js/main-f00bf12f5b428b34fa4f.js new file mode 100644 index 0000000..b1f20f3 --- /dev/null +++ b/docs/static/js/main-f00bf12f5b428b34fa4f.js @@ -0,0 +1,7 @@ +!function(e){function t(n){if(r[n])return r[n].exports;var a=r[n]={i:n,l:!1,exports:{}};return e[n].call(a.exports,a,a.exports,t),a.l=!0,a.exports}var r={};t.m=e,t.c=r,t.i=function(e){return e},t.d=function(e,r,n){t.o(e,r)||Object.defineProperty(e,r,{configurable:!1,enumerable:!0,get:n})},t.n=function(e){var r=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(r,"a",r),r},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p="/DAIHard/",t(t.s=43)}([function(e,t){e.exports={options:{usePureJavaScript:!1}}},function(e,t,r){(function(t,n,a,i){function o(e){if(8!==e&&16!==e&&24!==e&&32!==e)throw new Error("Only 8, 16, 24, or 32 bits supported: "+e)}function u(e){if(this.data="",this.read=0,"string"==typeof e)this.data=e;else if(l.isArrayBuffer(e)||l.isArrayBufferView(e))if(void 0!==i&&e instanceof i)this.data=e.toString("binary");else{var t=new Uint8Array(e);try{this.data=String.fromCharCode.apply(null,t)}catch(e){for(var r=0;r15?(i=Date.now(),s(e)):(a.push(e),1===a.length&&u.setAttribute("a",o=!o))}}l.nextTick=l.setImmediate}(),l.isNodejs=void 0!==t&&t.versions&&t.versions.node,l.globalScope=function(){return l.isNodejs?a:"undefined"==typeof self?window:self}(),l.isArray=Array.isArray||function(e){return"[object Array]"===Object.prototype.toString.call(e)},l.isArrayBuffer=function(e){return"undefined"!=typeof ArrayBuffer&&e instanceof ArrayBuffer},l.isArrayBufferView=function(e){return e&&l.isArrayBuffer(e.buffer)&&void 0!==e.byteLength},l.ByteBuffer=u,l.ByteStringBuffer=u;l.ByteStringBuffer.prototype._optimizeConstructedString=function(e){this._constructedStringLength+=e,this._constructedStringLength>4096&&(this.data.substr(0,1),this._constructedStringLength=0)},l.ByteStringBuffer.prototype.length=function(){return this.data.length-this.read},l.ByteStringBuffer.prototype.isEmpty=function(){return this.length()<=0},l.ByteStringBuffer.prototype.putByte=function(e){return this.putBytes(String.fromCharCode(e))},l.ByteStringBuffer.prototype.fillWithByte=function(e,t){e=String.fromCharCode(e);for(var r=this.data;t>0;)1&t&&(r+=e),(t>>>=1)>0&&(e+=e);return this.data=r,this._optimizeConstructedString(t),this},l.ByteStringBuffer.prototype.putBytes=function(e){return this.data+=e,this._optimizeConstructedString(e.length),this},l.ByteStringBuffer.prototype.putString=function(e){return this.putBytes(l.encodeUtf8(e))},l.ByteStringBuffer.prototype.putInt16=function(e){return this.putBytes(String.fromCharCode(e>>8&255)+String.fromCharCode(255&e))},l.ByteStringBuffer.prototype.putInt24=function(e){return this.putBytes(String.fromCharCode(e>>16&255)+String.fromCharCode(e>>8&255)+String.fromCharCode(255&e))},l.ByteStringBuffer.prototype.putInt32=function(e){return this.putBytes(String.fromCharCode(e>>24&255)+String.fromCharCode(e>>16&255)+String.fromCharCode(e>>8&255)+String.fromCharCode(255&e))},l.ByteStringBuffer.prototype.putInt16Le=function(e){return this.putBytes(String.fromCharCode(255&e)+String.fromCharCode(e>>8&255))},l.ByteStringBuffer.prototype.putInt24Le=function(e){return this.putBytes(String.fromCharCode(255&e)+String.fromCharCode(e>>8&255)+String.fromCharCode(e>>16&255))},l.ByteStringBuffer.prototype.putInt32Le=function(e){return this.putBytes(String.fromCharCode(255&e)+String.fromCharCode(e>>8&255)+String.fromCharCode(e>>16&255)+String.fromCharCode(e>>24&255))},l.ByteStringBuffer.prototype.putInt=function(e,t){o(t);var r="";do{t-=8,r+=String.fromCharCode(e>>t&255)}while(t>0);return this.putBytes(r)},l.ByteStringBuffer.prototype.putSignedInt=function(e,t){return e<0&&(e+=2<0);return t},l.ByteStringBuffer.prototype.getSignedInt=function(e){var t=this.getInt(e),r=2<=r&&(t-=r<<1),t},l.ByteStringBuffer.prototype.getBytes=function(e){var t;return e?(e=Math.min(this.length(),e),t=this.data.slice(this.read,this.read+e),this.read+=e):0===e?t="":(t=0===this.read?this.data:this.data.slice(this.read),this.clear()),t},l.ByteStringBuffer.prototype.bytes=function(e){return void 0===e?this.data.slice(this.read):this.data.slice(this.read,this.read+e)},l.ByteStringBuffer.prototype.at=function(e){return this.data.charCodeAt(this.read+e)},l.ByteStringBuffer.prototype.setAt=function(e,t){return this.data=this.data.substr(0,this.read+e)+String.fromCharCode(t)+this.data.substr(this.read+e+1),this},l.ByteStringBuffer.prototype.last=function(){return this.data.charCodeAt(this.data.length-1)},l.ByteStringBuffer.prototype.copy=function(){var e=l.createBuffer(this.data);return e.read=this.read,e},l.ByteStringBuffer.prototype.compact=function(){return this.read>0&&(this.data=this.data.slice(this.read),this.read=0),this},l.ByteStringBuffer.prototype.clear=function(){return this.data="",this.read=0,this},l.ByteStringBuffer.prototype.truncate=function(e){var t=Math.max(0,this.length()-e);return this.data=this.data.substr(this.read,t),this.read=0,this},l.ByteStringBuffer.prototype.toHex=function(){for(var e="",t=this.read;t=e)return this;t=Math.max(t||this.growSize,e);var r=new Uint8Array(this.data.buffer,this.data.byteOffset,this.data.byteLength),n=new Uint8Array(this.length()+t);return n.set(r),this.data=new DataView(n.buffer),this},l.DataBuffer.prototype.putByte=function(e){return this.accommodate(1),this.data.setUint8(this.write++,e),this},l.DataBuffer.prototype.fillWithByte=function(e,t){this.accommodate(t);for(var r=0;r>8&65535),this.data.setInt8(this.write,e>>16&255),this.write+=3,this},l.DataBuffer.prototype.putInt32=function(e){return this.accommodate(4),this.data.setInt32(this.write,e),this.write+=4,this},l.DataBuffer.prototype.putInt16Le=function(e){return this.accommodate(2),this.data.setInt16(this.write,e,!0),this.write+=2,this},l.DataBuffer.prototype.putInt24Le=function(e){return this.accommodate(3),this.data.setInt8(this.write,e>>16&255),this.data.setInt16(this.write,e>>8&65535,!0),this.write+=3,this},l.DataBuffer.prototype.putInt32Le=function(e){return this.accommodate(4),this.data.setInt32(this.write,e,!0),this.write+=4,this},l.DataBuffer.prototype.putInt=function(e,t){o(t),this.accommodate(t/8);do{t-=8,this.data.setInt8(this.write++,e>>t&255)}while(t>0);return this},l.DataBuffer.prototype.putSignedInt=function(e,t){return o(t),this.accommodate(t/8),e<0&&(e+=2<0);return t},l.DataBuffer.prototype.getSignedInt=function(e){var t=this.getInt(e),r=2<=r&&(t-=r<<1),t},l.DataBuffer.prototype.getBytes=function(e){var t;return e?(e=Math.min(this.length(),e),t=this.data.slice(this.read,this.read+e),this.read+=e):0===e?t="":(t=0===this.read?this.data:this.data.slice(this.read),this.clear()),t},l.DataBuffer.prototype.bytes=function(e){return void 0===e?this.data.slice(this.read):this.data.slice(this.read,this.read+e)},l.DataBuffer.prototype.at=function(e){return this.data.getUint8(this.read+e)},l.DataBuffer.prototype.setAt=function(e,t){return this.data.setUint8(e,t),this},l.DataBuffer.prototype.last=function(){return this.data.getUint8(this.write-1)},l.DataBuffer.prototype.copy=function(){return new l.DataBuffer(this)},l.DataBuffer.prototype.compact=function(){if(this.read>0){var e=new Uint8Array(this.data.buffer,this.read),t=new Uint8Array(e.byteLength);t.set(e),this.data=new DataView(t),this.write-=this.read,this.read=0}return this},l.DataBuffer.prototype.clear=function(){return this.data=new DataView(new ArrayBuffer(0)),this.read=this.write=0,this},l.DataBuffer.prototype.truncate=function(e){return this.write=Math.max(0,this.length()-e),this.read=Math.min(this.read,this.write),this},l.DataBuffer.prototype.toHex=function(){for(var e="",t=this.read;t0;)1&t&&(r+=e),(t>>>=1)>0&&(e+=e);return r},l.xorBytes=function(e,t,r){for(var n="",a="",i="",o=0,u=0;r>0;--r,++o)a=e.charCodeAt(o)^t.charCodeAt(o),u>=10&&(n+=i,i="",u=0),i+=String.fromCharCode(a),++u;return n+=i},l.hexToBytes=function(e){var t="",r=0;for(!0&e.length&&(r=1,t+=String.fromCharCode(parseInt(e[0],16)));r>24&255)+String.fromCharCode(e>>16&255)+String.fromCharCode(e>>8&255)+String.fromCharCode(255&e)};var d="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",h=[62,-1,-1,-1,63,52,53,54,55,56,57,58,59,60,61,-1,-1,-1,64,-1,-1,-1,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,-1,-1,-1,-1,-1,-1,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51],p="123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz";l.encode64=function(e,t){for(var r,n,a,i="",o="",u=0;u>2),i+=d.charAt((3&r)<<4|n>>4),isNaN(n)?i+="==":(i+=d.charAt((15&n)<<2|a>>6),i+=isNaN(a)?"=":d.charAt(63&a)),t&&i.length>t&&(o+=i.substr(0,t)+"\r\n",i=i.substr(t));return o+=i},l.decode64=function(e){e=e.replace(/[^A-Za-z0-9\+\/\=]/g,"");for(var t,r,n,a,i="",o=0;o>4),64!==n&&(i+=String.fromCharCode((15&r)<<4|n>>2),64!==a&&(i+=String.fromCharCode((3&n)<<6|a)));return i},l.encodeUtf8=function(e){return unescape(encodeURIComponent(e))},l.decodeUtf8=function(e){return decodeURIComponent(escape(e))},l.binary={raw:{},hex:{},base64:{},base58:{},baseN:{encode:f.encode,decode:f.decode}},l.binary.raw.encode=function(e){return String.fromCharCode.apply(null,e)},l.binary.raw.decode=function(e,t,r){var n=t;n||(n=new Uint8Array(e.length)),r=r||0;for(var a=r,i=0;i>2),i+=d.charAt((3&r)<<4|n>>4),isNaN(n)?i+="==":(i+=d.charAt((15&n)<<2|a>>6),i+=isNaN(a)?"=":d.charAt(63&a)),t&&i.length>t&&(o+=i.substr(0,t)+"\r\n",i=i.substr(t));return o+=i},l.binary.base64.decode=function(e,t,r){var n=t;n||(n=new Uint8Array(3*Math.ceil(e.length/4))),e=e.replace(/[^A-Za-z0-9\+\/\=]/g,""),r=r||0;for(var a,i,o,u,s=0,c=r;s>4,64!==o&&(n[c++]=(15&i)<<4|o>>2,64!==u&&(n[c++]=(3&o)<<6|u));return t?c-r:n.subarray(0,c)},l.binary.base58.encode=function(e,t){return l.binary.baseN.encode(e,p,t)},l.binary.base58.decode=function(e,t){return l.binary.baseN.decode(e,p,t)},l.text={utf8:{},utf16:{}},l.text.utf8.encode=function(e,t,r){e=l.encodeUtf8(e);var n=t;n||(n=new Uint8Array(e.length)),r=r||0;for(var a=r,i=0;i0?(a=r[n].substring(0,o),i=r[n].substring(o+1)):(a=r[n],i=null),a in t||(t[a]=[]),a in Object.prototype||null===i||t[a].push(unescape(i))}return t};return void 0===e?(null===S&&(S="undefined"!=typeof window&&window.location&&window.location.search?r(window.location.search.substring(1)):{}),t=S):t=r(e),t},l.parseFragment=function(e){var t=e,r="",n=e.indexOf("?");n>0&&(t=e.substring(0,n),r=e.substring(n+1));var a=t.split("/");return a.length>0&&""===a[0]&&a.shift(),{pathString:t,queryString:r,path:a,query:""===r?{}:l.getQueryVariables(r)}},l.makeRequest=function(e){var t=l.parseFragment(e),r={path:t.pathString,query:t.queryString,getPath:function(e){return void 0===e?t.path:t.path[e]},getQuery:function(e,r){var n;return void 0===e?n=t.query:(n=t.query[e])&&void 0!==r&&(n=n[r]),n},getQueryLast:function(e,t){var n=r.getQuery(e);return n?n[n.length-1]:t}};return r},l.makeLink=function(e,t,r){e=jQuery.isArray(e)?e.join("/"):e;var n=jQuery.param(t||{});return r=r||"",e+(n.length>0?"?"+n:"")+(r.length>0?"#"+r:"")},l.setPath=function(e,t,r){if("object"==typeof e&&null!==e)for(var n=0,a=t.length;n0&&i.push(r),o=n.lastIndex;var u=t[0][1];switch(u){case"s":case"o":a");break;case"%":i.push("%");break;default:i.push("<%"+u+"?>")}}return i.push(e.substring(o)),i.join("")},l.formatNumber=function(e,t,r,n){var a=e,i=isNaN(t=Math.abs(t))?2:t,o=void 0===r?",":r,u=void 0===n?".":n,s=a<0?"-":"",c=parseInt(a=Math.abs(+a||0).toFixed(i),10)+"",f=c.length>3?c.length%3:0;return s+(f?c.substr(0,f)+u:"")+c.substr(f).replace(/(\d{3})(?=\d)/g,"$1"+u)+(i?o+Math.abs(a-c).toFixed(i).slice(2):"")},l.formatSize=function(e){return e=e>=1073741824?l.formatNumber(e/1073741824,2,".","")+" GiB":e>=1048576?l.formatNumber(e/1048576,2,".","")+" MiB":e>=1024?l.formatNumber(e/1024,0)+" KiB":l.formatNumber(e,0)+" bytes"},l.bytesFromIP=function(e){return-1!==e.indexOf(".")?l.bytesFromIPv4(e):-1!==e.indexOf(":")?l.bytesFromIPv6(e):null},l.bytesFromIPv4=function(e){if(e=e.split("."),4!==e.length)return null;for(var t=l.createBuffer(),r=0;rr[n].end-r[n].start&&(n=r.length-1)):r.push({start:u,end:u})}t.push(i)}if(r.length>0){var s=r[n];s.end-s.start>0&&(t.splice(s.start,s.end-s.start+1,""),0===s.start&&t.unshift(""),7===s.end&&t.push(""))}return t.join(":")},l.estimateCores=function(e,t){function r(e,o,u){if(0===o){var s=Math.floor(e.reduce(function(e,t){return e+t},0)/e.length);return l.cores=Math.max(1,s),URL.revokeObjectURL(i),t(null,l.cores)}n(u,function(t,n){e.push(a(u,n)),r(e,o-1,u)})}function n(e,t){for(var r=[],n=[],a=0;au.st&&a.sta.st&&u.st0)return l.cores=navigator.hardwareConcurrency,t(null,l.cores);if("undefined"==typeof Worker)return l.cores=1,t(null,l.cores);if("undefined"==typeof Blob)return l.cores=2,t(null,l.cores);var i=URL.createObjectURL(new Blob(["(",function(){self.addEventListener("message",function(e){for(var t=Date.now(),r=t+4;Date.now()t){var n=new Error("Too few bytes to parse DER.");throw n.available=e.length(),n.remaining=t,n.requested=r,n}}function a(e,t,r,i){var s;n(e,t,2);var c=e.getByte();t--;var f=192&c,l=31&c;s=e.length();var d=u(e,t);if(t-=s-e.length(),void 0!==d&&d>t){if(i.strict){var h=new Error("Too few bytes to read ASN.1 value.");throw h.available=e.length(),h.remaining=t,h.requested=d,h}d=t}var p,g,v=32==(32&c);if(v)if(p=[],void 0===d)for(;;){if(n(e,t,2),e.bytes(2)===String.fromCharCode(0,0)){e.getBytes(2),t-=2;break}s=e.length(),p.push(a(e,t,r+1,i)),t-=s-e.length()}else for(;d>0;)s=e.length(),p.push(a(e,d,r+1,i)),t-=s-e.length(),d-=s-e.length();if(void 0===p&&f===o.Class.UNIVERSAL&&l===o.Type.BITSTRING&&(g=e.bytes(d)),void 0===p&&i.decodeBitStrings&&f===o.Class.UNIVERSAL&&l===o.Type.BITSTRING&&d>1){var y=e.read,m=t,b=0;if(l===o.Type.BITSTRING&&(n(e,t,1),b=e.getByte(),t--),0===b)try{s=e.length();var C={verbose:i.verbose,strict:!0,decodeBitStrings:!0},E=a(e,t,r+1,C),S=s-e.length();t-=S,l==o.Type.BITSTRING&&S++;var T=E.tagClass;S!==d||T!==o.Class.UNIVERSAL&&T!==o.Class.CONTEXT_SPECIFIC||(p=[E])}catch(e){}void 0===p&&(e.read=y,t=m)}if(void 0===p){if(void 0===d){if(i.strict)throw new Error("Non-constructed ASN.1 object of indefinite length.");d=t}if(l===o.Type.BMPSTRING)for(p="";d>0;d-=2)n(e,t,2),p+=String.fromCharCode(e.getInt16()),t-=2;else p=e.getBytes(d)}var w=void 0===g?null:{bitStringContents:g};return o.create(f,l,v,p,w)}var i=r(0);r(1),r(6);var o=e.exports=i.asn1=i.asn1||{};o.Class={UNIVERSAL:0,APPLICATION:64,CONTEXT_SPECIFIC:128,PRIVATE:192},o.Type={NONE:0,BOOLEAN:1,INTEGER:2,BITSTRING:3,OCTETSTRING:4,NULL:5,OID:6,ODESC:7,EXTERNAL:8,REAL:9,ENUMERATED:10,EMBEDDED:11,UTF8:12,ROID:13,SEQUENCE:16,SET:17,PRINTABLESTRING:19,IA5STRING:22,UTCTIME:23,GENERALIZEDTIME:24,BMPSTRING:30},o.create=function(e,t,r,n,a){if(i.util.isArray(n)){for(var u=[],s=0;s1&&(0===e.value.charCodeAt(0)&&0==(128&e.value.charCodeAt(1))||255===e.value.charCodeAt(0)&&128==(128&e.value.charCodeAt(1)))?n.putBytes(e.value.substr(1)):n.putBytes(e.value);if(t.putByte(r),n.length()<=127)t.putByte(127&n.length());else{var s=n.length(),c="";do{c+=String.fromCharCode(255&s),s>>>=8}while(s>0);t.putByte(128|c.length);for(var u=c.length-1;u>=0;--u)t.putByte(c.charCodeAt(u))}return t.putBuffer(n),t},o.oidToDer=function(e){var t=e.split("."),r=i.util.createBuffer();r.putByte(40*parseInt(t[0],10)+parseInt(t[1],10));for(var n,a,o,u,s=2;s>>=7,n||(u|=128),a.push(u),n=!1}while(o>0);for(var c=a.length-1;c>=0;--c)r.putByte(a[c])}return r},o.derToOid=function(e){var t;"string"==typeof e&&(e=i.util.createBuffer(e));var r=e.getByte();t=Math.floor(r/40)+"."+r%40;for(var n=0;e.length()>0;)r=e.getByte(),n<<=7,128&r?n+=127&r:(t+="."+(n+r),n=0);return t},o.utcTimeToDate=function(e){var t=new Date,r=parseInt(e.substr(0,2),10);r=r>=50?1900+r:2e3+r;var n=parseInt(e.substr(2,2),10)-1,a=parseInt(e.substr(4,2),10),i=parseInt(e.substr(6,2),10),o=parseInt(e.substr(8,2),10),u=0;if(e.length>11){var s=e.charAt(10),c=10;"+"!==s&&"-"!==s&&(u=parseInt(e.substr(10,2),10),c+=2)}if(t.setUTCFullYear(r,n,a),t.setUTCHours(i,o,u,0),c&&("+"===(s=e.charAt(c))||"-"===s)){var f=parseInt(e.substr(c+1,2),10),l=parseInt(e.substr(c+4,2),10),d=60*f+l;d*=6e4,"+"===s?t.setTime(+t-d):t.setTime(+t+d)}return t},o.generalizedTimeToDate=function(e){var t=new Date,r=parseInt(e.substr(0,4),10),n=parseInt(e.substr(4,2),10)-1,a=parseInt(e.substr(6,2),10),i=parseInt(e.substr(8,2),10),o=parseInt(e.substr(10,2),10),u=parseInt(e.substr(12,2),10),s=0,c=0,f=!1;"Z"===e.charAt(e.length-1)&&(f=!0);var l=e.length-5,d=e.charAt(l);if("+"===d||"-"===d){c=60*parseInt(e.substr(l+1,2),10)+parseInt(e.substr(l+4,2),10),c*=6e4,"+"===d&&(c*=-1),f=!0}return"."===e.charAt(14)&&(s=1e3*parseFloat(e.substr(14),10)),f?(t.setUTCFullYear(r,n,a),t.setUTCHours(i,o,u,s),t.setTime(+t+c)):(t.setFullYear(r,n,a),t.setHours(i,o,u,s)),t},o.dateToUtcTime=function(e){if("string"==typeof e)return e;var t="",r=[];r.push((""+e.getUTCFullYear()).substr(2)),r.push(""+(e.getUTCMonth()+1)),r.push(""+e.getUTCDate()),r.push(""+e.getUTCHours()),r.push(""+e.getUTCMinutes()),r.push(""+e.getUTCSeconds());for(var n=0;n=-128&&e<128)return t.putSignedInt(e,8);if(e>=-32768&&e<32768)return t.putSignedInt(e,16);if(e>=-8388608&&e<8388608)return t.putSignedInt(e,24);if(e>=-2147483648&&e<2147483648)return t.putSignedInt(e,32);var r=new Error("Integer too large; max is 32-bits.");throw r.integer=e,r},o.derToInteger=function(e){"string"==typeof e&&(e=i.util.createBuffer(e));var t=8*e.length();if(t>32)throw new Error("Integer too large; max is 32-bits.");return e.getSignedInt(t)},o.validate=function(e,t,r,n){var a=!1;if(e.tagClass!==t.tagClass&&void 0!==t.tagClass||e.type!==t.type&&void 0!==t.type)n&&(e.tagClass!==t.tagClass&&n.push("["+t.name+'] Expected tag class "'+t.tagClass+'", got "'+e.tagClass+'"'),e.type!==t.type&&n.push("["+t.name+'] Expected type "'+t.type+'", got "'+e.type+'"'));else if(e.constructed===t.constructed||void 0===t.constructed){if(a=!0,t.value&&i.util.isArray(t.value))for(var u=0,s=0;a&&s0&&(n+="\n");for(var a="",u=0;u1?n+="0x"+i.util.bytesToHex(e.value.slice(1)):n+="(none)",e.value.length>0){var d=e.value.charCodeAt(0);1==d?n+=" (1 unused bit shown)":d>1&&(n+=" ("+d+" unused bits shown)")}}else e.type===o.Type.OCTETSTRING?(s.test(e.value)||(n+="("+e.value+") "),n+="0x"+i.util.bytesToHex(e.value)):e.type===o.Type.UTF8?n+=i.util.decodeUtf8(e.value):e.type===o.Type.PRINTABLESTRING||e.type===o.Type.IA5String?n+=e.value:s.test(e.value)?n+="0x"+i.util.bytesToHex(e.value):0===e.value.length?n+="[null]":n+=e.value}return n}},function(e,t,r){var n=r(0);e.exports=n.md=n.md||{},n.md.algorithms=n.md.algorithms||{}},function(e,t,r){function n(e,t){var r=function(){return new s.aes.Algorithm(e,t)};s.cipher.registerAlgorithm(e,r)}function a(){p=!0,l=[0,1,2,4,8,16,32,64,128,27,54];for(var e=new Array(256),t=0;t<128;++t)e[t]=t<<1,e[t+128]=t+128<<1^283;c=new Array(256),f=new Array(256),d=new Array(4),h=new Array(4);for(var t=0;t<4;++t)d[t]=new Array(256),h[t]=new Array(256);for(var r,n,a,i,o,u,s,g=0,v=0,t=0;t<256;++t){i=v^v<<1^v<<2^v<<3^v<<4,i=i>>8^255&i^99,c[g]=i,f[i]=g,o=e[i],r=e[g],n=e[r],a=e[n],u=o<<24^i<<16^i<<8^i^o,s=(r^n^a)<<24^(g^a)<<16^(g^n^a)<<8^g^r^a;for(var y=0;y<4;++y)d[y][g]=u,h[y][i]=s,u=u<<24|u>>>8,s=s<<24|s>>>8;0===g?g=v=1:(g=r^e[e[e[r^a]]],v^=e[e[v]])}}function i(e,t){for(var r,n=e.slice(0),a=1,i=n.length,o=i+6+1,u=g*o,s=i;s>>16&255]<<24^c[r>>>8&255]<<16^c[255&r]<<8^c[r>>>24]^l[a]<<24,a++):i>6&&s%i==4&&(r=c[r>>>24]<<24^c[r>>>16&255]<<16^c[r>>>8&255]<<8^c[255&r]),n[s]=n[s-i]^r;if(t){var f,d=h[0],p=h[1],v=h[2],y=h[3],m=n.slice(0);u=n.length;for(var s=0,b=u-g;s>>24]]^p[c[f>>>16&255]]^v[c[f>>>8&255]]^y[c[255&f]];n=m}return n}function o(e,t,r,n){var a,i,o,u,s,l=e.length/4-1;n?(a=h[0],i=h[1],o=h[2],u=h[3],s=f):(a=d[0],i=d[1],o=d[2],u=d[3],s=c);var p,g,v,y,m,b,C;p=t[0]^e[0],g=t[n?3:1]^e[1],v=t[2]^e[2],y=t[n?1:3]^e[3];for(var E=3,S=1;S>>24]^i[g>>>16&255]^o[v>>>8&255]^u[255&y]^e[++E],b=a[g>>>24]^i[v>>>16&255]^o[y>>>8&255]^u[255&p]^e[++E],C=a[v>>>24]^i[y>>>16&255]^o[p>>>8&255]^u[255&g]^e[++E],y=a[y>>>24]^i[p>>>16&255]^o[g>>>8&255]^u[255&v]^e[++E],p=m,g=b,v=C;r[0]=s[p>>>24]<<24^s[g>>>16&255]<<16^s[v>>>8&255]<<8^s[255&y]^e[++E],r[n?3:1]=s[g>>>24]<<24^s[v>>>16&255]<<16^s[y>>>8&255]<<8^s[255&p]^e[++E],r[2]=s[v>>>24]<<24^s[y>>>16&255]<<16^s[p>>>8&255]<<8^s[255&g]^e[++E],r[n?1:3]=s[y>>>24]<<24^s[p>>>16&255]<<16^s[g>>>8&255]<<8^s[255&v]^e[++E]}function u(e){e=e||{};var t,r=(e.mode||"CBC").toUpperCase(),n="AES-"+r;t=e.decrypt?s.cipher.createDecipher(n,e.key):s.cipher.createCipher(n,e.key);var a=t.start;return t.start=function(e,r){var n=null;r instanceof s.util.ByteBuffer&&(n=r,r={}),r=r||{},r.output=n,r.iv=e,a.call(t,r)},t}var s=r(0);r(15),r(23),r(1),e.exports=s.aes=s.aes||{},s.aes.startEncrypting=function(e,t,r,n){var a=u({key:e,output:r,decrypt:!1,mode:n});return a.start(t),a},s.aes.createEncryptionCipher=function(e,t){return u({key:e,output:null,decrypt:!1,mode:t})},s.aes.startDecrypting=function(e,t,r,n){var a=u({key:e,output:r,decrypt:!0,mode:n});return a.start(t),a},s.aes.createDecryptionCipher=function(e,t){return u({key:e,output:null,decrypt:!0,mode:t})},s.aes.Algorithm=function(e,t){p||a();var r=this;r.name=e,r.mode=new t({blockSize:16,cipher:{encrypt:function(e,t){return o(r._w,e,t,!1)},decrypt:function(e,t){return o(r._w,e,t,!0)}}}),r._init=!1},s.aes.Algorithm.prototype.initialize=function(e){if(!this._init){var t,r=e.key;if("string"!=typeof r||16!==r.length&&24!==r.length&&32!==r.length){if(s.util.isArray(r)&&(16===r.length||24===r.length||32===r.length)){t=r,r=s.util.createBuffer();for(var n=0;n>>=2;for(var n=0;n65&&-1!==o){var u=t[o];","===u?(++o,t=t.substr(0,o)+"\r\n "+t.substr(o)):t=t.substr(0,o)+"\r\n"+u+t.substr(o+1),i=a-o-1,o=-1,++a}else" "!==t[a]&&"\t"!==t[a]&&","!==t[a]||(o=a);return t}function a(e){return e.replace(/^\s+/,"")}var i=r(0);r(1);var o=e.exports=i.pem=i.pem||{};o.encode=function(e,t){t=t||{};var r,a="-----BEGIN "+e.type+"-----\r\n";if(e.procType&&(r={name:"Proc-Type",values:[String(e.procType.version),e.procType.type]},a+=n(r)),e.contentDomain&&(r={name:"Content-Domain",values:[e.contentDomain]},a+=n(r)),e.dekInfo&&(r={name:"DEK-Info",values:[e.dekInfo.algorithm]},e.dekInfo.parameters&&r.values.push(e.dekInfo.parameters),a+=n(r)),e.headers)for(var o=0;ot.blockLength&&(t.start(),t.update(o.bytes()),o=t.digest()),r=n.util.createBuffer(),a=n.util.createBuffer(),c=o.length();for(var s=0;s=64;){for(a=e.h0,i=e.h1,o=e.h2,u=e.h3,s=e.h4,f=0;f<16;++f)n=r.getInt32(),t[f]=n,c=u^i&(o^u),n=(a<<5|a>>>27)+c+s+1518500249+n,s=u,u=o,o=(i<<30|i>>>2)>>>0,i=a,a=n;for(;f<20;++f)n=t[f-3]^t[f-8]^t[f-14]^t[f-16],n=n<<1|n>>>31,t[f]=n,c=u^i&(o^u),n=(a<<5|a>>>27)+c+s+1518500249+n,s=u,u=o,o=(i<<30|i>>>2)>>>0,i=a,a=n;for(;f<32;++f)n=t[f-3]^t[f-8]^t[f-14]^t[f-16],n=n<<1|n>>>31,t[f]=n,c=i^o^u,n=(a<<5|a>>>27)+c+s+1859775393+n,s=u,u=o,o=(i<<30|i>>>2)>>>0,i=a,a=n;for(;f<40;++f)n=t[f-6]^t[f-16]^t[f-28]^t[f-32],n=n<<2|n>>>30,t[f]=n,c=i^o^u,n=(a<<5|a>>>27)+c+s+1859775393+n,s=u,u=o,o=(i<<30|i>>>2)>>>0,i=a,a=n;for(;f<60;++f)n=t[f-6]^t[f-16]^t[f-28]^t[f-32],n=n<<2|n>>>30,t[f]=n,c=i&o|u&(i^o),n=(a<<5|a>>>27)+c+s+2400959708+n,s=u,u=o,o=(i<<30|i>>>2)>>>0,i=a,a=n;for(;f<80;++f)n=t[f-6]^t[f-16]^t[f-28]^t[f-32],n=n<<2|n>>>30,t[f]=n,c=i^o^u,n=(a<<5|a>>>27)+c+s+3395469782+n,s=u,u=o,o=(i<<30|i>>>2)>>>0,i=a,a=n;e.h0=e.h0+a|0,e.h1=e.h1+i|0,e.h2=e.h2+o|0,e.h3=e.h3+u|0,e.h4=e.h4+s|0,l-=64}}var i=r(0);r(4),r(1);var o=e.exports=i.sha1=i.sha1||{};i.md.sha1=i.md.algorithms.sha1=o,o.create=function(){s||n();var e=null,t=i.util.createBuffer(),r=new Array(80),o={algorithm:"sha1",blockLength:64,digestLength:20,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};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},o};var u=null,s=!1},function(e,t,r){"use strict";(function(e){function n(){return i.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function a(e,t){if(n()=n())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+n().toString(16)+" bytes");return 0|e}function g(e){return+e!=e&&(e=0),i.alloc(+e)}function v(e,t){if(i.isBuffer(e))return e.length;if("undefined"!=typeof ArrayBuffer&&"function"==typeof ArrayBuffer.isView&&(ArrayBuffer.isView(e)||e instanceof ArrayBuffer))return e.byteLength;"string"!=typeof e&&(e=""+e);var r=e.length;if(0===r)return 0;for(var n=!1;;)switch(t){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":case void 0:return j(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return z(e).length;default:if(n)return j(e).length;t=(""+t).toLowerCase(),n=!0}}function y(e,t,r){var n=!1;if((void 0===t||t<0)&&(t=0),t>this.length)return"";if((void 0===r||r>this.length)&&(r=this.length),r<=0)return"";if(r>>>=0,t>>>=0,r<=t)return"";for(e||(e="utf8");;)switch(e){case"hex":return x(this,t,r);case"utf8":case"utf-8":return k(this,t,r);case"ascii":return $(this,t,r);case"latin1":case"binary":return R(this,t,r);case"base64":return B(this,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return _(this,t,r);default:if(n)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),n=!0}}function m(e,t,r){var n=e[t];e[t]=e[r],e[r]=n}function b(e,t,r,n,a){if(0===e.length)return-1;if("string"==typeof r?(n=r,r=0):r>2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),r=+r,isNaN(r)&&(r=a?0:e.length-1),r<0&&(r=e.length+r),r>=e.length){if(a)return-1;r=e.length-1}else if(r<0){if(!a)return-1;r=0}if("string"==typeof t&&(t=i.from(t,n)),i.isBuffer(t))return 0===t.length?-1:C(e,t,r,n,a);if("number"==typeof t)return t&=255,i.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?a?Uint8Array.prototype.indexOf.call(e,t,r):Uint8Array.prototype.lastIndexOf.call(e,t,r):C(e,[t],r,n,a);throw new TypeError("val must be string, number or Buffer")}function C(e,t,r,n,a){function i(e,t){return 1===o?e[t]:e.readUInt16BE(t*o)}var o=1,u=e.length,s=t.length;if(void 0!==n&&("ucs2"===(n=String(n).toLowerCase())||"ucs-2"===n||"utf16le"===n||"utf-16le"===n)){if(e.length<2||t.length<2)return-1;o=2,u/=2,s/=2,r/=2}var c;if(a){var f=-1;for(c=r;cu&&(r=u-s),c=r;c>=0;c--){for(var l=!0,d=0;da&&(n=a):n=a;var i=t.length;if(i%2!=0)throw new TypeError("Invalid hex string");n>i/2&&(n=i/2);for(var o=0;o239?4:i>223?3:i>191?2:1;if(a+u<=r){var s,c,f,l;switch(u){case 1:i<128&&(o=i);break;case 2:s=e[a+1],128==(192&s)&&(l=(31&i)<<6|63&s)>127&&(o=l);break;case 3:s=e[a+1],c=e[a+2],128==(192&s)&&128==(192&c)&&(l=(15&i)<<12|(63&s)<<6|63&c)>2047&&(l<55296||l>57343)&&(o=l);break;case 4:s=e[a+1],c=e[a+2],f=e[a+3],128==(192&s)&&128==(192&c)&&128==(192&f)&&(l=(15&i)<<18|(63&s)<<12|(63&c)<<6|63&f)>65535&&l<1114112&&(o=l)}}null===o?(o=65533,u=1):o>65535&&(o-=65536,n.push(o>>>10&1023|55296),o=56320|1023&o),n.push(o),a+=u}return N(n)}function N(e){var t=e.length;if(t<=Z)return String.fromCharCode.apply(String,e);for(var r="",n=0;nn)&&(r=n);for(var a="",i=t;ir)throw new RangeError("Trying to access beyond buffer length")}function P(e,t,r,n,a,o){if(!i.isBuffer(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>a||te.length)throw new RangeError("Index out of range")}function D(e,t,r,n){t<0&&(t=65535+t+1);for(var a=0,i=Math.min(e.length-r,2);a>>8*(n?a:1-a)}function U(e,t,r,n){t<0&&(t=4294967295+t+1);for(var a=0,i=Math.min(e.length-r,4);a>>8*(n?a:3-a)&255}function O(e,t,r,n,a,i){if(r+n>e.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function M(e,t,r,n,a){return a||O(e,t,r,4,3.4028234663852886e38,-3.4028234663852886e38),Q.write(e,t,r,n,23,4),r+4}function F(e,t,r,n,a){return a||O(e,t,r,8,1.7976931348623157e308,-1.7976931348623157e308),Q.write(e,t,r,n,52,8),r+8}function V(e){if(e=K(e).replace(ee,""),e.length<2)return"";for(;e.length%4!=0;)e+="=";return e}function K(e){return e.trim?e.trim():e.replace(/^\s+|\s+$/g,"")}function H(e){return e<16?"0"+e.toString(16):e.toString(16)}function j(e,t){t=t||1/0;for(var r,n=e.length,a=null,i=[],o=0;o55295&&r<57344){if(!a){if(r>56319){(t-=3)>-1&&i.push(239,191,189);continue}if(o+1===n){(t-=3)>-1&&i.push(239,191,189);continue}a=r;continue}if(r<56320){(t-=3)>-1&&i.push(239,191,189),a=r;continue}r=65536+(a-55296<<10|r-56320)}else a&&(t-=3)>-1&&i.push(239,191,189);if(a=null,r<128){if((t-=1)<0)break;i.push(r)}else if(r<2048){if((t-=2)<0)break;i.push(r>>6|192,63&r|128)}else if(r<65536){if((t-=3)<0)break;i.push(r>>12|224,r>>6&63|128,63&r|128)}else{if(!(r<1114112))throw new Error("Invalid code point");if((t-=4)<0)break;i.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}}return i}function q(e){for(var t=[],r=0;r>8,a=r%256,i.push(a),i.push(n);return i}function z(e){return J.toByteArray(V(e))}function W(e,t,r,n){for(var a=0;a=t.length||a>=e.length);++a)t[a+r]=e[a];return a}function Y(e){return e!==e}/*! + * The buffer module from node.js, for the browser. + * + * @author Feross Aboukhadijeh + * @license MIT + */ +var J=r(44),Q=r(45),X=r(46);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 E(this,e,t,r);case"utf8":case"utf-8":return S(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^S),S^=t,E^=t<<4,t=65535&(S>>>-16^E),E^=t,S^=t<<-16,t=858993459&(E>>>2^S),S^=t,E^=t<<2,t=65535&(S>>>-16^E),E^=t,S^=t<<-16,t=1431655765&(E>>>1^S),S^=t,E^=t<<1,t=16711935&(S>>>8^E),E^=t,S^=t<<8,t=1431655765&(E>>>1^S),S^=t,E^=t<<1,t=E<<8|S>>>20&240,E=S<<24|S<<8&16711680|S>>>8&65280|S>>>24&240,S=t;for(var T=0;T>>26,S=S<<2|S>>>26):(E=E<<1|E>>>27,S=S<<1|S>>>27),E&=-15,S&=-15;var w=r[E>>>28]|n[E>>>24&15]|a[E>>>20&15]|i[E>>>16&15]|o[E>>>12&15]|u[E>>>8&15]|s[E>>>4&15],I=c[S>>>28]|f[S>>>24&15]|l[S>>>20&15]|d[S>>>16&15]|h[S>>>12&15]|p[S>>>8&15]|g[S>>>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[E>>>24&63]|l[E>>>16&63]|h[E>>>8&63]|g[63&E]|s[S>>>24&63]|f[S>>>16&63]|d[S>>>8&63]|p[63&S])}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 E(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 S(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 E=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,E,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 $(e){this.m=e}function R(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 $(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 Y(){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 $e(e){var t=a();return this.divRemTo(e,t,null),t}function Re(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 We(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 $(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,S,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,E,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(),E=2,f()}function f(){if(E<=i)return g.start(null,null),g.update(m),y=g.digest().getBytes(),v=n.util.xorBytes(v,y,l),m=y,++E,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 E=2;E<=i;++E)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)&~E)+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,[]),E=l.create(l.Class.CONTEXT_SPECIFIC,0,!0,[]),g=0;g=E&&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,E=r.verify?r.verify(C,u,n):C;if(!0!==E)throw!0===C&&(o={message:"The application rejected the certificate.",error:d.certificateError.bad_certificate}),(E||0===E)&&("object"!=typeof E||f.util.isArray(E)?"string"==typeof E&&(o.error=E):(E.message&&(o.message=E.message),E.error&&(o.error=E.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),E=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(E)}var S=null;if(null!==e){var T=l.wrapRsaPrivateKey(l.privateKeyToAsn1(e));S=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,[S]),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),$=c.hmac.create();$.start(u,e),$.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,R.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,E,S,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],E=e[2][1],S=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],$=e[7][0],R=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|E&(y^b))>>>0,L=R+l+h+f[x][1]+t[x][1],n=$+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,$=k,R=N,k=A,N=B,A=w,B=I,L=T+a,w=S+n+(L/4294967296>>>0)>>>0,I=L>>>0,S=C,T=E,C=m,E=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]+E,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]+S+(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]+R,e[7][0]=e[7][0]+$+(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=S,null!==e.session.clientCertificate&&(e.expect=E),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=S,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,E=3,S=4,T=5,w=6,I=f.handleUnexpected,A=f.handleChangeCipherSpec,B=f.handleAlert,k=f.handleHandshake,N=f.handleApplicationData,$=f.handleHeartbeat,R=[];R[f.ConnectionEnd.client]=[[I,B,k,I,$],[I,B,k,I,$],[I,B,k,I,$],[I,B,k,I,$],[I,B,k,I,$],[A,B,I,I,$],[I,B,k,I,$],[I,B,k,N,$],[I,B,k,I,$]],R[f.ConnectionEnd.server]=[[I,B,k,I,$],[I,B,k,I,$],[I,B,k,I,$],[I,B,k,I,$],[A,B,I,I,$],[I,B,k,I,$],[I,B,k,N,$],[I,B,k,I,$]];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=R[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={};return e.isAvailable=function(){return"function"==typeof Notification},e.requestPermission=function(e){var t=Notification.permission;"default"!=t?e(t):Notification.requestPermission(e)},e.notify=function(t,r,n){e.isAvailable()&&e.requestPermission(function(e){if("granted"==e){var a={};r&&(a.body=r),n&&(a.icon=n);var i=new Notification(t,a);setTimeout(function(){i.close.bind(i)()},4e3)}})},e}();e.exports=n},function(e,t,r){"use strict";var n=function(){var e,t,r={};return r.startWatching=function(r,n){e=r,t=n},r}();e.exports=n},function(e,t,r){"use strict";function n(e,t){for(;e.length");if("boolean"==typeof t)return S(e,t?"True":"False");if("number"==typeof t)return T(e,t+"");if(t instanceof String)return I(e,"'"+E(t,!0)+"'");if("string"==typeof t)return w(e,'"'+E(t,!1)+'"');if("object"==typeof t&&"$"in t){var r=t.$;if("number"==typeof r)return B(e,"");if("#"===r[0]){var n=[];for(var a in t)"$"!==a&&n.push(C(e,t[a]));return"("+n.join(",")+")"}if("Set_elm_builtin"===r)return S(e,"Set")+A(e,".fromList")+" "+C(e,$a(t));if("RBNode_elm_builtin"===r||"RBEmpty_elm_builtin"===r)return S(e,"Dict")+A(e,".fromList")+" "+C(e,ka(t));if("Array_elm_builtin"===r)return S(e,"Array")+A(e,".fromList")+" "+C(e,Ia(t));if("::"===r||"[]"===r){var n="[";for(t.b&&(n+=C(e,t.a),t=t.b);t.b;t=t.b)n+=","+C(e,t.a);return n+"]"}var n="";for(var i in t)if("$"!==i){var o=C(e,t[i]),u=o[0],s="{"===u||"("===u||"["===u||"<"===u||'"'===u||o.indexOf(" ")<0;n+=" "+(s?o:"("+o+")")}return S(e,r)+n}if("function"==typeof DataView&&t instanceof DataView)return w(e,"<"+t.byteLength+" bytes>");if("function"==typeof File&&t instanceof File)return B(e,"<"+t.name+">");if("object"==typeof t){var n=[];for(var c in t){var f="_"===c[0]?c.slice(1):c;n.push(A(e,f)+" = "+C(e,t[c]))}return 0===n.length?"{}":"{ "+n.join(", ")+" }"}return B(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 S(e,t){return e?""+t+"":t}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,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+"` "+N(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 "+N(c)+"\n\nIt received the following value:\n\n "+b(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 N(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=R(e,t,0,n);a&&(r=n.pop());a=R(r.a,r.b,0,n));return a}function R(e,t,r,n){if(r>100)return n.push(_(e,t)),!0;if(e===t)return!0;if("object"!=typeof e||null===e||null===t)return"function"==typeof e&&k(5),!1;"Set_elm_builtin"===e.$&&(e=$a(e),t=$a(t)),"RBNode_elm_builtin"!==e.$&&"RBEmpty_elm_builtin"!==e.$||(e=ka(e),t=ka(t));for(var a in e)if(!R(e[a],t[a],r+1,n))return!1;return!0}function x(e,t,r){if("object"!=typeof e)return e===t?0:e=t.length)return ve("a LONGER array. Need index "+a+" but only see "+t.length+" entries",t);var n=de(e.b,t[a]);return Va(n)?n:di(f(vi,a,n.a));case 8:if("object"!=typeof t||null===t||pe(t))return ve("an OBJECT",t);var i=vr;for(var o in t)if(t.hasOwnProperty(o)){var n=de(e.b,t[o]);if(!Va(n))return di(f(gi,o,n.a));i=O(_(o,n.a),i)}return hi(La(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=Le(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=Ce(i(t.a)),s=0;s0&&yt(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 yt(r,0,n,t):((h?bt(l,d):l===d)||yt(r,2,n,d),void mt(p,g,r,n+1));case 0:return void(e.a!==t.a&&yt(r,3,n,t.a));case 1:return void Ct(e,t,r,n,St);case 2:return void Ct(e,t,r,n,Tt);case 3:if(e.h!==t.h)return void yt(r,0,n,t);var v=Et(e.d,t.d);v&&yt(r,4,n,v);var y=t.i(e.g,t.g);return void(y&&yt(r,5,n,y))}}}function bt(e,t){for(var r=0;ru?yt(r,6,n,{v:u,i:o-u}):o0||o.length>0||k)&&yt(r,8,n,{w:a,x:o,y:k})}function wt(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 mt(o.z,n,u,o.r),o.r=a,void(o.s.s={w:u,A:o})}wt(e,t,r+Pn,n,a,i)}function It(e,t,r,n,a){var i=e[r];if(!i){var o=yt(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 mt(n,i.z,u,a),void yt(t,9,a,{w:u,A:i})}It(e,t,r+Pn,n,a)}function At(e,t,r,n){Bt(e,t,r,0,0,t.b,n)}function Bt(e,t,r,n,a,i,o){for(var u=r[n],s=u.r;s===a;){var c=u.$;if(1===c)At(e,t.k,u.s,o);else if(8===c){u.t=e,u.u=o;var f=u.s.w;f.length>0&&Bt(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&&Bt(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 Bt(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 kt(e,t,r,n){return 0===r.length?e:(At(e,t,r,n),Nt(e,r))}function Nt(e,t){for(var r=0;r0){var o=a.substring(0,i),u=a.substring(i+2);t=l(th,o,function(e){return fi(rh(e)?u+", "+e.a:u)},t)}}return t}function Ht(e,t,r){t.upload.addEventListener("progress",function(n){t.c||ke(f(ah,e,_(r,fh({sent:n.loaded,size:n.total}))))}),t.addEventListener("progress",function(n){t.c||ke(f(ah,e,_(r,ch({received:n.loaded,size:n.lengthComputable?fi(n.total):li}))))})}function jt(e){try{return fi(decodeURIComponent(e))}catch(e){return li}}function qt(e,t){function r(){n=1===n?0:(sa(r),t(e),1)}t(e);var n=0;return function(a,i){e=a,i?(t(e),2===n&&(n=1)):(0===n&&sa(r),n=2)}}function Gt(e){var t=e.onUrlChange,n=e.onUrlRequest,a=function(){a.a(t(zt()))};return ua({setup:function(e){return a.a=e,la.addEventListener("popstate",a),la.navigator.userAgent.indexOf("Trident")<0||la.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=zt(),o=$N(a).a;e(n(o&&i.protocol===o.protocol&&i.host===o.host&&i.port_.a===o.port_.a?CN(o):bN(a)))}})},init:function(t){return l(e.init,t,zt(),a)},view:e.view,update:e.update,subscriptions:e.subscriptions})}function zt(){return $N(En.location.href).a||k(1)}function Wt(e,t){return Ae(function(r){sa(function(){var n=document.getElementById(e);r(n?we(t(n)):Ie(EN(e)))})})}function Yt(e){return Ae(function(t){sa(function(){t(we(e()))})})}function Jt(e){return f(Nw,SN,Ae(function(t){try{la.location=e}catch(e){En.location.reload(!1)}}))}function Qt(){return f(tu,Ua(dc),f(tu,zs,lc))}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 Xt,Zt,er=[],tr=n(function(e,t,r){for(var n=new Array(e),a=0;a=0;n--)t=f(e,r[n],t);return t}),sr=(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 x(e,t)>=0}),r(function(e,t){var r=x(e,t);return r<0?Sa:r?Aa:Ea})),pr={$:"#0"},gr=r(U),vr={$:"[]"},yr=r(O),mr=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 M(n)}),br=(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 M(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 M(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 M(o)}),r(function(e,t){return M(F(t).sort(function(t,r){return x(e(t),e(r))}))})),Cr=r(function(e,t){return M(F(t).sort(function(t,r){var n=f(e,t,r);return n===Ea?0:n===Sa?-1:1}))}),Er=r(function(e,t){return e+t}),Sr=(r(function(e,t){return e-t}),r(function(e,t){return e*t})),Tr=(r(function(e,t){return e/t}),r(function(e,t){return e/t|0}),r(Math.pow)),wr=(r(function(e,t){return t%e}),r(function(e,t){var r=t%e;return 0===e?k(11):r>0&&e<0||r<0&&e>0?r+e:r})),Ir=Math.PI,Ar=(Math.E,Math.cos),Br=Math.sin,kr=(Math.tan,Math.acos,Math.asin,Math.atan,r(Math.atan2),Math.ceil),Nr=Math.floor,$r=Math.round,Rr=(Math.sqrt,Math.log),xr=isNaN,_r=(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})),Lr=r(function(e,t){return e+t}),Pr=(r(function(e,t){for(var r=t.length,n=new Array(r),a=0;a-1}),Hr=r(function(e,t){return 0===t.indexOf(e)}),jr=r(function(e,t){return t.length>=e.length&&t.lastIndexOf(e)===t.length-e.length}),qr=r(function(e,t){var r=e.length;if(r<1)return vr;for(var n=0,a=[];(n=t.indexOf(e,n))>-1;)a.push(n),n+=r;return M(a)}),Gr=oe(function(e){return"number"!=typeof e?ve("an INT",e):-2147483647>e}),r(function(e,t){return t>>>e}),r(function(e,t){return Ae(function(r){r(we(1===new Uint8Array(new Uint32Array([1]))[0]?e:t))})}),n(function(e,t,r){return e.setInt8(t,r),t+1})),Mn=a(function(e,t,r,n){return e.setInt16(t,r,n),t+2}),Fn=a(function(e,t,r,n){return e.setInt32(t,r,n),t+4}),Vn=n(function(e,t,r){return e.setUint8(t,r),t+1}),Kn=a(function(e,t,r,n){return e.setUint16(t,r,n),t+2}),Hn=a(function(e,t,r,n){return e.setUint32(t,r,n),t+4}),jn=a(function(e,t,r,n){return e.setFloat32(t,r,n),t+4}),qn=a(function(e,t,r,n){return e.setFloat64(t,r,n),t+8}),Gn=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}),Wn=r(function(e,t){try{return fi(f(e,t,0).b)}catch(e){return li}}),Yn=(r(function(e,t){return _(t+1,e.getInt8(t))}),n(function(e,t,r){return _(r+2,t.getInt16(r,e))}),n(function(e,t,r){return _(r+4,t.getInt32(r,e))}),r(function(e,t){return _(t+1,e.getUint8(t))})),Jn=(n(function(e,t,r){return _(r+2,t.getUint16(r,e))}),n(function(e,t,r){return _(r+4,t.getUint32(r,e))}),n(function(e,t,r){return _(r+4,t.getFloat32(r,e))}),n(function(e,t,r){return _(r+8,t.getFloat64(r,e))}),n(function(e,t,r){return _(r+e,new DataView(t.buffer,t.byteOffset+r,e))})),Qn=(n(function(e,t,r){for(var n="",a=r+e;r0;){var l=n[c];f[--c]=l?fi(l):li}a.push(d(Eg,n[0],n.index,i,M(f))),s=t.lastIndex}return t.lastIndex=u,M(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?fi(o):li}return r(d(Eg,t,arguments[arguments.length-2],i,M(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,M(a)}),a(function(e,t,r,n){return Pe(t,n,e.init,e.update,e.subscriptions,function(t,r){var a=e.view,i=n&&n.node?n.node:k(0),o=Lt(i);return qt(r,function(e){var r=a(e),n=vt(o,r);i=kt(i,o,n,t),o=r})})}),a(function(e,t,r,n){return Pe(t,n,e.init,e.update,e.subscriptions,function(t,r){var n=e.setup&&e.setup(t),a=e.view,i=En.title,o=En.body,u=Lt(o);return qt(r,function(e){Xt=n;var r=a(e),s=Tn("body")(vr)(r.body),c=vt(u,s);o=kt(o,u,c,t),u=s,Xt=0,i!==r.title&&(En.title=i=r.title)})})})),sa=("undefined"!=typeof cancelAnimationFrame&&cancelAnimationFrame,"undefined"!=typeof requestAnimationFrame?requestAnimationFrame:function(e){return setTimeout(e,1e3/60)}),ca=(r(function(e,t){return f(Nw,SN,Ae(function(){t&&history.go(t),e()}))}),r(function(e,t){return f(Nw,SN,Ae(function(){history.pushState({},"",t),e()}))})),fa=(r(function(e,t){return f(Nw,SN,Ae(function(){history.replaceState({},"",t),e()}))}),{addEventListener:function(){},removeEventListener:function(){}}),la=("undefined"!=typeof document&&document,"undefined"!=typeof window?window:fa),da=(n(function(e,t,r){return Ne(Ae(function(n){function a(e){ke(r(e))}return e.addEventListener(t,a,Zt&&{passive:!0}),function(){e.removeEventListener(t,a)}}))}),r(function(e,t){var r=de(e,t);return Va(r)?fi(r.a):li}),r(function(e,t){return Wt(t,function(t){return t[e](),pr})}),r(function(e,t){return Yt(function(){return la.scroll(e,t),pr})}),n(function(e,t,r){return Wt(e,function(e){return e.scrollLeft=t,e.scrollTop=r,pr})}),r(function(e,t){return Ae(function(r){var n=setInterval(function(){ke(t)},e);return function(){clearInterval(n)}})})),ha=n(function(e,t,r){return{$:"BrowserNotification",a:e,b:t,c:r}}),pa=function(e){return{$:"GTag",a:e}},ga=function(e){return{$:"GotoRoute",a:e}},va={$:"RequestBrowserNotificationPermission"},ya=function(e){return{$:"UserNotice",a:e}},ma={$:"Web3Connect"},ba=a(function(e,t,r,n){return{align:r,label:n,mainParagraphs:t,noticeType:e}}),Ca=r(function(e,t){return t(e)}),Ea={$:"EQ"},Sa={$:"LT"},Ta=ur,wa=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(Ta,o,r,n)}var a=t.a;return l(Ta,e,r,a)});return l(Ta,o,l(Ta,e,t,i),a)}),Ia=function(e){return l(wa,Ra,vr,e)},Aa={$:"GT"},Ba=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(Ba,e,t,o)),c=i;e=u,t=s,r=c}}),ka=function(e){return l(Ba,n(function(e,t,r){return f(Ra,_(e,t),r)}),vr,e)},Na=function(e){return l(Ba,n(function(e,t,r){return f(Ra,e,r)}),vr,e)},$a=function(e){var t=e.a;return Na(t)},Ra=yr,xa=Er,_a=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}}),La=function(e){return l(_a,Ra,vr,e)},Pa=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(_a,e,t,La(p)):d(Pa,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}),Da=n(function(e,t,r){return d(Pa,e,t,0,r)}),Ua=r(function(e,t){return l(Da,r(function(t,r){return f(Ra,e(t),r)}),vr,t)}),Oa=r(function(e,t){return e(t)}),Ma=n(function(e,t,r){return e(t(r))}),Fa=function(e){return e},Va=function(e){return"Ok"===e.$},Ka=a(function(e,t,r,n){return{$:"Array_elm_builtin",a:e,b:t,c:r,d:n}}),Ha=kr,ja=r(function(e,t){return Rr(t)/Rr(e)}),qa=V,Ga=Ha(f(ja,2,32)),za=er,Wa=d(Ka,0,Ga,za,za),Ya=function(e){return{$:"Leaf",a:e}},Ja=function(e){return{$:"SubTree",a:e}},Qa=rr,Xa=r(function(e,t){for(;;){var r=f(Qa,32,e),n=r.a,a=r.b,i=f(Ra,Ja(n),t);if(!a.b)return La(i);var o=a,u=i;e=o,t=u}}),Za=lr,ei=function(e){return e.a},ti=r(function(e,t){for(;;){var r=Ha(t/32);if(1===r)return f(Qa,32,e).a;var n=f(Xa,e,vr),a=r;e=n,t=a}}),ri=Nr,ni=r(function(e,t){return x(e,t)>0?e:t}),ai=Sr,ii=m,oi=r(function(e,t){if(t.nodeListSize){var r=32*t.nodeListSize,n=ri(f(ja,32,r-1)),a=e?La(t.nodeList):t.nodeList,i=f(ti,a,t.nodeListSize);return d(Ka,ii(t.tail)+r,f(ni,5,n*Ga),i,t.tail)}return d(Ka,ii(t.tail),Ga,za,t.tail)}),ui=tr,si=i(function(e,t,r,n,a){for(;;){if(t<0)return f(oi,!1,{nodeList:n,nodeListSize:r/32|0,tail:a});var i=Ya(l(ui,32,t,e)),o=e,u=t-32,s=r,c=f(Ra,i,n),d=a;e=o,t=u,r=s,n=c,a=d}}),ci=r(function(e,t){if(e<=0)return Wa;var r=e%32,n=l(ui,r,e-r,t);return h(si,t,e-r-32,e,vr,n)}),fi=function(e){return{$:"Just",a:e}},li={$:"Nothing"},di=function(e){return{$:"Err",a:e}},hi=function(e){return{$:"Ok",a:e}},pi=r(function(e,t){return{$:"Failure",a:e,b:t}}),gi=r(function(e,t){return{$:"Field",a:e,b:t}}),vi=r(function(e,t){return{$:"Index",a:e,b:t}}),yi=function(e){return{$:"OneOf",a:e}},mi=gr,bi=j,Ci=function(e){var t=bi(e);return 97<=t&&t<=122},Ei=function(e){var t=bi(e);return t<=90&&65<=t},Si=function(e){return Ci(e)||Ei(e)},Ti=function(e){var t=bi(e);return t<=57&&48<=t},wi=function(e){return Ci(e)||Ei(e)||Ti(e)},Ii=function(e){return l(_a,r(function(e,t){return t+1}),0,e)},Ai=mr,Bi=n(function(e,t,r){for(;;){if(!(x(e,t)<1))return r;var n=e,a=t-1,i=f(Ra,t,r);e=n,t=a,r=i}}),ki=r(function(e,t){return l(Bi,e,t,vr)}),Ni=r(function(e,t){return l(Ai,e,f(ki,0,Ii(t)-1),t)}),$i=Vr,Ri=Z,xi=r(function(e,t){return f(Mr,e,F(t))}),_i=z,Li=r(function(e,t){return M(f(Or,e,t))}),Pi=function(e){return f(xi,"\n ",f(Li,"\n",e))},Di=on,Ui=r(function(e,t){return"\n\n("+Ri(e+1)+") "+Pi(Oi(t))}),Oi=function(e){return f(Mi,e,vr)},Mi=r(function(e,t){e:for(;;)switch(e.$){case"Field":var r=e.a,n=e.b,a=function(){var e=_i(r);if("Nothing"===e.$)return!1;var t=e.a,n=t.a,a=t.b;return Si(n)&&f($i,wi,a)}(),i=a?"."+r:"['"+r+"']",o=n,u=f(Ra,i,t);e=o,t=u;continue e;case"Index":var s=e.a,n=e.b,c="["+Ri(s)+"]",o=n,u=f(Ra,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(xi,"",La(t)):"Json.Decode.oneOf"}(),h=d+" failed in the following "+Ri(Ii(l))+" ways:";return f(xi,"\n\n",f(Ra,h,f(Ni,Ui,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(xi,"",La(t)):"!"}();default:var p=e.a,g=e.b,h=function(){return t.b?"Problem with the value at json"+f(xi,"",La(t))+":\n\n ":"Problem with the given value:\n\n"}();return h+(Pi(f(Di,4,g))+"\n\n")+p}}),Fi=en,Vi=tn,Ki=ae,Hi=function(e){switch(e.$){case"Normal":return 0;case"MayStopPropagation":return 1;case"MayPreventDefault":return 2;default:return 3}},ji=An,qi={$:"Empty"},Gi=function(e){return{$:"Styled",a:e}},zi=function(e){return{$:"Text",a:e}},Wi=function(e){return{$:"Unstyled",a:e}},Yi=r(function(e,t){switch(t.$){case"Styled":var n=t.a;return Gi({html:r(function(t,r){return f(ji,e,f(n.html,t,r))}),styles:n.styles});case"Unstyled":var a=t.a;return Wi(f(Ma,ji(e),a));case"Text":var i=t.a;return zi(i);default:return qi}}),Ji=Yi,Qi=r(function(e,t){return d(ba,t.noticeType,f(Ua,Ua(Ji(e)),t.mainParagraphs),t.align,t.label)}),Xi=r(function(e,t){switch(t.$){case"UserNotice":var r=t.a;return ya(f(Qi,e,r));case"Web3Connect":return ma;case"GotoRoute":var n=t.a;return ga(n);case"GTag":var a=t.a;return pa(a);case"BrowserNotification":var i=t.a,o=t.b,u=t.c;return l(ha,i,o,u);default:return va}}),Zi=r(function(e,t){return f(Ua,Xi(e),t)}),eo={$:"EthDai"},to=function(e){return{$:"Native",a:e}},ro=function(e){return{$:"Token",a:e}},no={$:"XDai"},ao=M([ro(eo),to(no)]),io=function(e){var t=e.a;e.b,e.c;return t},oo=function(e){var t=(e.a,e.b);e.c;return t},uo=function(e){e.a,e.b;return e.c},so={$:"InitialBlank"},co=r(function(e,t){return t.b?l(Da,Ra,t,e):e}),fo=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}}),lo=r(function(e,t){return f(fo,function(t){return $(t,e)},t)}),ho=r(function(e,t){return f(lo,e,t.userNotices)?t:D(t,{userNotices:f(co,t.userNotices,M([e]))})}),po=r(function(e,t){return l(_a,ho,t,e)}),go=Fa,vo={$:"Buyer"},yo={$:"Seller"},mo=r(function(e,t){return{options:t,type_:e}}),bo={$:"OfferType"},Co=n(function(e,t,r){return{checked:t,label:e,testTrade:r}}),Eo=r(function(e,t){return f(mo,bo,M([l(Co,"Buying",e,function(e){return $(e.parameters.initiatorRole,vo)}),l(Co,"Selling",t,function(e){return $(e.parameters.initiatorRole,yo)})]))}),So={$:"Closed"},To={$:"Committed"},wo={$:"Judgment"},Io={$:"Open"},Ao={$:"Phase"},Bo=a(function(e,t,r,n){return f(mo,Ao,M([l(Co,"Open",e,function(e){return $(e.state.phase,Io)}),l(Co,"Committed",t,function(e){return $(e.state.phase,To)}),l(Co,"Judgment",r,function(e){return $(e.state.phase,wo)}),l(Co,"Closed",n,function(e){return $(e.state.phase,So)})]))}),ko={$:"Initiator"},No={$:"Responder"},$o=r(function(e,t){if("Just"===t.$){return e(t.a)}return li}),Ro=r(function(e,t){return $(t,e.parameters.initiatorAddress)?fi(ko):f($o,function(e){return $(t,e)?fi(No):li},e.state.responder)}),xo=r(function(e,t){if("Just"===t.$){var r=t.a;return fi(e(r))}return li}),_o=r(function(e,t){return f(xo,function(t){var r=_(t,e.parameters.initiatorRole);if("Initiator"===r.a.$){if("Seller"===r.b.$){r.a,r.b;return yo}r.a,r.b;return vo}if("Seller"===r.b.$){r.a,r.b;return vo}r.a,r.b;return yo},f(Ro,e,t))}),Lo={$:"Role"},Po=n(function(e,t,r){return f(mo,Lo,M([l(Co,"Buyer",t,function(t){return $(f(_o,t,e),fi(vo))}),l(Co,"Seller",r,function(t){return $(f(_o,t,e),fi(yo))})]))}),Do=function(e){return{orderBy:e}},Uo=Do,Oo={$:"Ascending"},Mo={$:"Phase"},Fo=Fe,Vo=Fo(vr),Ko=function(e){return{$:"Posix",a:e}},Ho=Ko,jo=r(function(e,t){return _({agentAddress:t,filters:go(M([d(Bo,!0,!0,!0,!1),f(Eo,!0,!0),l(Po,t,!0,!0)])),now:Ho(0),prices:vr,tradeTable:Uo(_(Mo,Oo)),wallet:e},Vo)}),qo=a(function(e,t,r,n){return{chainCmd:r,cmd:t,cmdUps:n,model:e}}),Go={$:"None"},zo=Go,Wo=function(e){return d(qo,e,Vo,zo,vr)},Yo=r(function(e,t){if("UpdateWallet"===e.$){var r=e.a;return Wo(D(t,{wallet:r}))}return Wo(t)}),Jo=function(e){return{$:"PricesFetched",a:e}},Qo=function(e){return{$:"TradeTableMsg",a:e}},Xo=r(function(e,t){return{$:"CustomSend",a:e,b:t}}),Zo=r(function(e,t){return f(Xo,e,t)}),eu=n(function(e,t,r){return{onBroadcast:t,onMined:r,onSign:e}}),tu=n(function(e,t,r){return t(e(r))}),ru=r(function(e,t){if("None"===t.$)return Go;var r=t.a,n=t.b,a=l(eu,f(xo,Ma(e),r.onSign),f(xo,Ma(e),r.onBroadcast),f(xo,function(t){var r=t.a,n=t.b;return _(f(tu,r,e),f(xo,function(t){return{confirmations:t.confirmations,toMsg:f(tu,t.toMsg,e)}},n))},r.onMined));return f(Xo,a,n)}),nu=function(e){return{$:"AbiDecoder",a:e}},au=r(function(e,t){return{$:"Tape",a:e,b:t}}),iu=W,ou=Fr,uu=r(function(e,t){return e<1?t:l(ou,e,iu(t),t)}),su=uu(64),cu=n(function(e,t,r){return _(f(au,e,su(t)),r)}),fu=r(function(e,t){return e<1?"":l(ou,0,e,t)}),lu=fu(64),du=r(function(e,t){if("Ok"===t.$){var r=t.a;return hi(e(r))}var n=t.a;return di(n)}),hu=function(e){return-e},pu=r(function(e,t){return e<1?"":l(ou,-e,iu(t),t)}),gu=function(){var e=function(e){if(!f($i,Za(P("0")),f(fu,63,e)))return di("Boolean decode error. "+e+" is not 1 or 0.");switch(f(pu,1,e)){case"0":return hi(!1);case"1":return hi(!0);default:return di("Boolean decode error. "+e+" is not 1 or 0.")}};return nu(function(t){var r=t.a,n=t.b;return f(du,f(cu,r,n),e(lu(n)))})}(),vu=Hr,yu=function(e){return f(vu,"0x",e)||f(vu,"0X",e)?f(uu,2,e):e},mu=function(e){return e.b},bu=r(function(e,t){var r=e.a;return f(du,mu,r(function(e){return f(au,e,e)}(yu(t))))}),Cu=Zr,Eu=ie,Su=Jr,Tu=function(e){return f(Cu,function(t){var r=e(t);if("Ok"===r.$){var n=r.a;return Ki(n)}var a=r.a;return Eu(a)},Su)},wu=f(tu,bu,Tu),Iu=function(e){return{$:"Magnitude",a:e}},Au=function(e){return{$:"Pos",a:e}},Bu=r(function(e,t){return{$:"BigIntNotNormalised",a:e,b:t}}),ku=function(e){return{$:"MagnitudeNotNormalised",a:e}},Nu=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 fi(n)}return li}},$u=function(e){var t=Nu(e);return"Nothing"!==t.$&&t.a<0},Ru=function(e){return{$:"Neg",a:e}},xu={$:"Zer"},_u=function(e){return!e.b},Lu=r(function(e,t){var r=t.a;if(_u(r))return xu;switch(e.$){case"Zero":return xu;case"Positive":return Au(t);default:return Ru(t)}}),Pu=r(function(e,t){return f(Bu,e,ku(t))}),Du=function(e){return f(Da,r(function(t,r){return e(t)&&_u(r)?vr:f(Ra,t,r)}),vr)}(Za(0)),Uu=Tr,Ou=-1+f(Uu,10,7),Mu=Ou+1,Fu=r(function(e,t){var r=t.a,n=t.b;return _(e(r),n)}),Vu=function(e){return e<0?f(Fu,xa(-1),Vu(e+Mu)):_(e/Mu|0,e%Mu)},Ku=r(function(e,t){for(;;){if(t.b){var r=t.a,n=t.b,a=Vu(r+e),i=a.a,o=a.b;return f(Ra,o,f(Ku,i,n))}{if(!(x(e,Mu)>0))return M([e]);var u=M([e]);e=0,t=u}}}),Hu=function(e){var t=e.a;return Iu(Du(f(Ku,0,t)))},ju=Ua(hu),qu={$:"Negative"},Gu={$:"Positive"},zu={$:"Zero"},Wu=function(e){switch(e.$){case"Positive":return qu;case"Negative":return Gu;default:return zu}},Yu=function(e){for(;;){var t=e.a,r=e.b,n=Hu(r),a=n.a;if(!$u(a))return f(Lu,t,Iu(a));e=f(Pu,Wu(t),ju(a))}},Ju=hr,Qu=function(e){switch(f(Ju,e,0).$){case"LT":return qu;case"GT":return Gu;default:return zu}},Xu=function(e){return e<0?-e:e},Zu=function(e){return Yu(f(Bu,Qu(e),ku(M([Xu(e)]))))},es=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(Uu,10,7)+r}var i=e.a.a,r=i.a;return r}break e;default:break e}return 42},ts=function(e){switch(e.$){case"Zer":return xu;case"Neg":var t=e.a;return Au(t);default:return e}},rs=function(e){return{$:"MagnitudePair",a:e}},ns=r(function(e,t){var r=_(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(Ra,_(a,u),f(ns,i,s))}var c=r.a,a=c.a,i=c.b;return f(Ra,_(a,0),f(ns,i,vr))}if(r.b.b){var l=r.b,u=l.a,s=l.b;return f(Ra,_(0,u),f(ns,vr,s))}return vr}),as=r(function(e,t){var r=e.a,n=t.a;return rs(f(ns,r,n))}),is=function(e){switch(e.$){case"Zer":return f(Pu,zu,vr);case"Neg":var t=e.a.a;return f(Pu,Gu,ju(t));default:var t=e.a.a;return f(Pu,Gu,t)}},os=r(function(e,t){var r=is(t),n=r.b,a=is(e),i=a.b,o=f(as,i,n),u=o.a,s=f(Ua,function(e){return e.a+e.b},u);return Yu(f(Bu,Gu,ku(s)))}),us=a(function(e,t,r,n){e:for(;;){var a=_(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 Aa}return a.b.b?Sa:f(Ju,e,t)}}),ss=function(e){switch(e.$){case"LT":return Aa;case"EQ":return Ea;default:return Sa}},cs=r(function(e,t){var r=_(e,t);switch(r.a.$){case"Pos":if("Pos"===r.b.$){var n=r.a.a.a,a=r.b.a.a;return d(us,0,0,n,a)}return Aa;case"Neg":if("Neg"===r.b.$){var n=r.a.a.a,a=r.b.a.a;return ss(d(us,0,0,n,a))}return Sa;default:switch(r.b.$){case"Pos":r.a;return Sa;case"Zer":r.a,r.b;return Ea;default:r.a;return Aa}}}),fs=r(function(e,t){return $(f(cs,e,t),Aa)}),ls=H,ds=r(function(e,t){return!f(fs,e,t)}),hs=function(e){switch(e.$){case"Zer":return Iu(vr);case"Pos":default:var t=e.a;return t}},ps=r(function(e,t){var r=e.a;return Hu(ku(f(Ua,ai(t),r)))}),gs=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(ps,Iu(n),a),u=f(gs,Iu(i),Iu(n)),s=u.a,c=f(os,f(Lu,Gu,o),f(Lu,Gu,Iu(f(Ra,0,s))));return hs(c)}var a=r.a;return f(ps,Iu(n),a)}return Iu(vr)}),vs=function(e){switch(e.$){case"Zer":return zu;case"Pos":return Gu;default:return qu}},ys=r(function(e,t){return $(e,zu)||$(t,zu)?zu:$(e,t)?Gu:qu}),ms=r(function(e,t){return f(Lu,f(ys,vs(e),vs(t)),f(gs,hs(e),hs(t)))}),bs=function(e){switch(e.$){case"Zer":return xu;case"Pos":var t=e.a;return Ru(t);default:var t=e.a;return Au(t)}},Cs=r(function(e,t){return f(os,e,bs(t))}),Es=Zu(0),Ss=a(function(e,t,r,n){if(e){var a=Zu(e),i=f(ms,f(ms,a,n),t),o=f(ds,i,r)?_(f(ms,a,t),f(Cs,r,i)):_(Es,r),u=o.a,s=o.b,c=d(Ss,e/2|0,t,s,n),l=c.a,h=c.b;return _(f(os,u,l),h)}return _(Es,r)}),Ts=Ha(f(ja,2,Ou)),ws=n(function(e,t,r){return d(Ss,f(Uu,2,Ts),e,t,r)}),Is=Zu(1),As=r(function(e,t){return e}),Bs=n(function(e,t,r){return l(_a,As(e),t,f(ki,1,r))}),ks=function(e){return l(Bs,ms(Zu(Mu)),Is,e)},Ns=n(function(e,t,r){if(e){var n=l(ws,ks(e),t,r),a=n.a,i=n.b,o=l(Ns,e-1,i,r),u=o.a,s=o.b;return _(f(os,a,u),s)}return l(ws,ks(e),t,r)}),$s=function(e){switch(e.$){case"Zer":return vr;case"Pos":default:var t=e.a.a;return t}},Rs=r(function(e,t){if($(t,Es))return li;var r=Ii($s(e))-Ii($s(t))+1,n=l(Ns,f(ni,0,r),ts(e),ts(t)),a=n.a,i=n.b;return fi(_(f(Lu,f(ys,vs(e),vs(t)),hs(a)),f(Lu,vs(e),hs(i))))}),xs=f(ms,Zu(2),Zu(2147483648)),_s=_r,Ls=function(e){return f(_s,e,"")},Ps=Dn,Ds=n(function(e,t,r){return e<=0?r:l(Ds,e>>1,U(t,t),1&e?U(r,t):r)}),Us=r(function(e,t){return l(Ds,e,t,"")}),Os=n(function(e,t,r){return U(f(Us,e-iu(r),Ls(t)),r)}),Ms=re,Fs=wr,Vs=function(e){e:for(;;)switch(e){case 0:return P("0");case 1:return P("1");case 2:return P("2");case 3:return P("3");case 4:return P("4");case 5:return P("5");case 6:return P("6");case 7:return P("7");case 8:return P("8");case 9:return P("9");case 10:return P("a");case 11:return P("b");case 12:return P("c");case 13:return P("d");case 14:return P("e");case 15:return P("f");default:var t=e;e=t;continue e}},Ks=r(function(e,t){for(;;){if(t<16)return f(Ra,Vs(t),e);var r=f(Ra,Vs(f(Fs,16,t)),e),n=t/16|0;e=r,t=n}}),Hs=function(e){return Ms(e<0?f(Ra,P("-"),f(Ks,vr,-e)):f(Ks,vr,e))},js=function(e){var t=f(Rs,e,xs);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=Hs(es(a));return $(n,Zu(0))?i:U(js(n),l(Os,8,P("0"),i))},qs=function(e){switch(e.$){case"Zer":return"0";case"Pos":var t=e.a;return $(t,Iu(vr))?"0":js(Au(t));default:var t=e.a;return"-"+qs(f(ms,Zu(-1),e))}},Gs=function(e){return l(Os,64,P("0"),e)},zs=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=Gs(Hs(a)),c=function(e){return U(e,n)}(Gs(Hs(u)));return L(a+32+(iu(n)/2|0),U(i,s),U(o,c))}return L(a,U(i,n),o)});return function(e){return U(e.b,e.c)}(l(_a,t,L(32*Ii(e),"",""),e))},Ws=Dr,Ys=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))))}),Js=n(function(e,t,n){return l(Ws,r(function(t,r){return l(Ys,e,bi(t),r)}),t,n)}),Qs=function(e){return La(l(Js,Ra,vr,e))},Xs=function(e){return f(xi,"",f(Ua,f(tu,Hs,f(Os,2,P("0"))),Qs(e)))},Zs=function(e){return 64-f(Fs,64,e)},ec=function(e){return U(e,f(Us,Zs(iu(e)),"0"))},tc=function(e){return _(fi(iu(e)/2|0),ec(e))},rc=function(e){return _(li,Gs(e))},nc=function(e){switch(e){case"0000":return P("0");case"0001":return P("1");case"0010":return P("2");case"0011":return P("3");case"0100":return P("4");case"0101":return P("5");case"0110":return P("6");case"0111":return P("7");case"1000":return P("8");case"1001":return P("9");case"1010":return P("a");case"1011":return P("b");case"1100":return P("c");case"1101":return P("d");case"1110":return P("e");case"1111":return P("f");default:return P("!")}},ac=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"}},ic=Ur,oc=function(e){var t=r(function(e,t){var r=t.a,n=t.b,a=_(e,n);e:for(;;)if(a.b)switch(a.a.valueOf()){case"0":return _(f(_s,P("1"),r),!0);case"1":return _(f(_s,P("0"),r),!0);default:break e}else switch(a.a.valueOf()){case"0":return _(f(_s,P("0"),r),!1);case"1":return _(f(_s,P("1"),r),!0);default:break e}return _(r,!0)});return l(ic,t,_("",!1),e).a},uc=function(e){return l(ic,Ra,vr,e)},sc=n(function(e,t,r){for(;;){if(""===t)return La(r);var n=e,a=f(uu,e,t),i=f(Ra,l(ou,0,e,t),r);e=n,t=a,r=i}}),cc=r(function(e,t){return e&&""!==t?l(sc,e,t,vr):M([t])}),fc=function(e){var t=function(){var t=uc(qs(e));if(t.b&&"-"===t.a.valueOf()){var r=t.b;return _(r,f(tu,oc,f(Os,256,P("1"))))}var r=t;return _(r,f(Os,256,P("0")))}(),r=t.a,n=t.b;return Ms(f(Ua,nc,f(cc,4,n(f(xi,"",f(Ua,ac,r))))))},lc=function(e){return{$:"Hex",a:e}},dc=function(e){switch(e.$){case"AddressE":var t=e.a.a;return rc(t);case"UintE":var r=e.a;return rc(qs(r));case"IntE":var n=e.a;return rc(fc(n));case"BoolE":return rc(e.a?"1":"0");case"DBytesE":var a=e.a.a;return tc(a);case"BytesE":var a=e.a.a;return rc(yu(a));case"StringE":var i=e.a;return tc(Xs(i));case"ListE":var o=e.a;return function(e){var t=e.a;return tc(t)}(Qt()(o));default:var i=e.a;return rc(yu(i))}};try{var hc=Qt();Qt=function(){return hc}}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 pc=Lr,gc=function(e){return 1===iu(e)?f(pc,"0",e):e},vc=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(Ra,n,r);e=i,t=o,r=u}}}),yc=r(function(e,t){return La(l(vc,e,t,vr))}),mc=n(function(e,t,r){if(t<=0)return vr;var n=_(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 M([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 M([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(Ra,i,f(Ra,u,f(Ra,h,f(Ra,m,f(yc,t-4,b))))):f(Ra,i,f(Ra,u,f(Ra,h,f(Ra,m,l(mc,e+1,t-4,b)))))}break t}}return r}var C=n.b,i=C.a;return M([i])}),bc=r(function(e,t){return l(mc,0,e,t)}),Cc=function(e){return{$:"KC",a:e}}({capacity:512,delSuffix:1,outputLen:32,rate:1088}),Ec=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 Ut(e.a)}},Sc={$:"LE"},Tc=n(function(e,t,r){switch(e.$){case"I8":var n=e.a;return l(On,t,r,n);case"I16":var a=e.a,n=e.b;return d(Mn,t,r,n,$(a,Sc));case"I32":var a=e.a,n=e.b;return d(Fn,t,r,n,$(a,Sc));case"U8":var n=e.a;return l(Vn,t,r,n);case"U16":var a=e.a,n=e.b;return d(Kn,t,r,n,$(a,Sc));case"U32":var a=e.a,n=e.b;return d(Hn,t,r,n,$(a,Sc));case"F32":var a=e.a,n=e.b;return d(jn,t,r,n,$(a,Sc));case"F64":var a=e.a,n=e.b;return d(qn,t,r,n,$(a,Sc));case"Seq":var i=e.b;return l(wc,i,t,r);case"Utf8":var o=e.b;return l(zn,t,r,o);default:var i=e.a;return l(Gn,t,r,i)}}),wc=n(function(e,t,r){for(;;){if(!e.b)return r;var n=e.a,a=e.b,i=a,o=t,u=l(Tc,n,t,r);e=i,t=o,r=u}}),Ic=Ot,Ac=r(function(e,t){return{$:"Seq",a:e,b:t}}),Bc=r(function(e,t){for(;;){if(!t.b)return e;var r=t.a,n=t.b,a=e+Ec(r),i=n;e=a,t=i}}),kc=function(e){return f(Ac,f(Bc,0,e),e)},Nc=function(e){return{$:"U8",a:e}},$c=Nc,Rc=r(function(e,t){return x(e,t)<0?e:t}),xc=dr,_c=function(e){return{$:"Bytes",a:e}},Lc=_c,Pc=function(e){return Ic(kc(f(Ua,Lc,La(e))))},Dc=Ut,Uc=r(function(e,t){var r=e.a;return f(Wn,r,t)}),Oc=function(e){return{$:"Decoder",a:e}},Mc=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 _(u,s.a)}var c=s.a,l=c,d=t,h=r,p=u;e=l,t=d,r=h,n=p}}),Fc=r(function(e,t){return Oc(f(Mc,e,t))}),Vc=Oc(Yn),Kc=r(function(e,t){if("Just"===t.$){return t.a}return e}),Hc=function(e){return{$:"Done",a:e}},jc=function(e){return{$:"Loop",a:e}},qc=r(function(e,t){var n=t.a;return Oc(r(function(t,r){var a=f(n,t,r),i=a.a,o=a.b;return _(i,e(o))}))}),Gc=function(e){return Oc(r(function(t,r){return _(r,e)}))},zc=r(function(e,t){var r=t.a,n=t.b;return r<=0?Gc(Hc(La(n))):f(qc,function(e){return jc(_(r-1,f(Ra,e,n)))},e)}),Wc=function(e){return f(Kc,vr,f(Uc,f(Fc,_(Dc(e),vr),zc(Vc)),e))},Yc=n(function(e,t,r){var n=t.a,a=t.b,i=r.a,o=r.b;return _(f(e,n,i),f(e,a,o))}),Jc=r(function(e,t){return l(Yc,Ps,e,t)}),Qc=f(ki,0,4),Xc=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}}),Zc=Dt,ef=r(function(e,t){var r=t.a,n=t.b;return _(e(r),e(n))}),tf=function(e){return f(ef,f(tu,Zc,Ps(4294967295)),e)},rf=r(function(e,t){return 5*t+e}),nf=4294967295>>>32-Ga,af=nr,of=n(function(e,t,r){for(;;){var n=nf&t>>>e,a=f(af,n,r);if("SubTree"!==a.$){var i=a.a;return f(af,nf&t,i)}var o=a.a,u=e-Ga,s=t,c=o;e=u,t=s,r=c}}),uf=function(e){return e>>>5<<5},sf=r(function(e,t){var r=t.a,n=t.b,a=t.c,i=t.d;return e<0||x(e,r)>-1?li:fi(x(e,uf(r))>-1?f(af,nf&e,i):l(of,n,e,a))}),cf=r(function(e,t){var r=f(sf,e,t);if("Just"===r.$){return r.a}return _(0,0)}),ff=n(function(e,t,r){var n=f(rf,e,t);return f(cf,n,r)}),lf=ar,df=a(function(e,t,r,n){var a=nf&t>>>e,i=f(af,a,n);if("SubTree"===i.$){var o=i.a,u=d(df,e-Ga,t,r,o);return l(lf,a,Ja(u),n)}var s=i.a,c=l(lf,nf&t,r,s);return l(lf,a,Ya(c),n)}),hf=n(function(e,t,r){var n=r.a,a=r.b,i=r.c,o=r.d;return e<0||x(e,n)>-1?r:x(e,uf(n))>-1?d(Ka,n,a,i,l(lf,nf&e,t,o)):d(Ka,n,a,d(df,a,e,t,i),o)}),pf=n(function(e,t,r){return l(hf,e,t,r)}),gf=a(function(e,t,r,n){var a=f(rf,e,t);return l(pf,a,r,n)}),vf=Un,yf=r(function(e,t){return l(Yc,vf,e,t)}),mf=function(e){var t=l(Da,r(function(t,n){var a={d0:l(ff,0,t,e.state),d1:l(ff,1,t,e.state),d2:l(ff,2,t,e.state),d3:l(ff,3,t,e.state),d4:l(ff,4,t,e.state)},i=r(function(e,r){return d(gf,e,t,f(yf,f(Xc,e,a),f(Jc,tf(f(Xc,f(Fs,5,e+1),a)),f(Xc,f(Fs,5,e+2),a))),r)});return f(i,4,f(i,3,f(i,2,f(i,1,f(i,0,n)))))}),e.state,Qc);return D(e,{state:t})},bf=_(0,0),Cf=function(e){return{current:bf,lfsrstate:1,state:e,x:1,y:0}},Ef=function(e){var t=1&e;return 128&e?_(t,e<<1^113):_(t,e<<1)},Sf=_(1,0),Tf=r(function(e,t){var r=t.a,n=t.b;return e?_(n,r):_(r,n)}),wf=r(function(e,t){if(e){var n=f(Tf,1,t);return l(Yc,r(function(t,r){return 4294967295&(t<>>32-e)}),t,n)}return t}),If=r(function(e,t){var r=f(Fs,32,e/32|0),n=f(Tf,r,t),a=f(Fs,32,e);return f(wf,a,n)}),Af=n(function(e,t,r){var n=f(sf,e,r);if("Nothing"===n.$)return r;var a=n.a;return l(hf,e,t(a),r)}),Bf=n(function(e,t,r){return l(Af,e,yf(t),r)}),kf=a(function(e,t,r,n){var a=f(rf,e,t);return l(Bf,a,r,n)}),Nf=function(e){return l(_a,r(function(e,t){var r=(1<>r}),Uf=n(function(e,t,r){return t?_(0,r<0))return t;var a=f(Rc,n,r),i=f(Ua,function(e){return f(Df,e,g)},f(ki,0,a)),o=Pf(e),u=U(t,i),s=n-a;e=o,t=u,n=s}});return f(bc,i.outputLen,l(v,g,vr,i.outputLen))},Vf=function(e){return{$:"KS",a:e}},Kf=function(e){var t=e.a;return Vf({config:t,inputLength:0,partial:vr,state:f(ci,25,As(bf))})},Hf=function(e){return Oc(Jn(e))},jf=Ic(kc(vr)),qf=r(function(e,t){var n=t.a;return Oc(r(function(t,r){var a=f(n,t,r),i=a.a,o=a.b;return f(e(o).a,t,i)}))}),Gf=r(function(e,t){return f(qf,function(e){return Hf(t)},Hf(e))}),zf=r(function(e,t){return f(Kc,jf,f(Uc,f(Gf,e,Dc(t)-e),t))}),Wf=r(function(e,t){for(;;){var n=t.a,a=n.config.rate/8|0,i=Dc(e)?f(Ra,e,n.partial):n.partial;if(!(x(l(_a,r(function(e,t){return t+Dc(e)}),0,i),a)>-1))return Vf(D(n,{inputLength:Dc(e)+n.inputLength,partial:i}));var o=Pc(i),u=f(Kc,jf,f(Uc,Hf(a),o)),s=Wc(u),c=f(Mf,s,n.state),d=Pf(c),h=f(zf,a,o),p=jf,g=Vf(D(n,{inputLength:Dc(e)+n.inputLength,partial:M([h]),state:d}));e=p,t=g}}),Yf=r(function(e,t){return Ff(f(Wf,Ic(kc(f(Ua,$c,t))),Kf(e)))}),Jf=Yf(Cc),Qf=function(e){return lc(f(xi,"",f(Ua,f(tu,Hs,gc),f(bc,4,Jf(f(Ua,bi,uc(e)))))))},Xf=function(e){return f(vu,"0x",e)||f(vu,"0X",e)?e:"0x"+e},Zf=function(e){var t=e.a;return Xf(t)},el=r(function(e,t){var r=zs(f(Ua,dc,t)),n=function(e){return U(e,r)}(yu(Zf(Qf(e))));return lc(n)}),tl=function(e){return{data:fi(f(el,"poke()",vr)),decoder:wu(gu),from:li,gas:li,gasPrice:li,nonce:li,to:fi(e),value:li}},rl=r(function(e,t){return D(t,{checked:e})}),nl=n(function(e,t,r){return f(Ua,function(r){return e(r)?t(r):r},r)}),al=r(function(e,t){var r=e.a,n=e.b,a=e.c;return l(nl,f(tu,function(e){return e.type_},Za(r)),function(e){return D(e,{options:l(nl,f(tu,function(e){return e.label},Za(n)),rl(a),e.options)})},t)}),il=function(e){return e.a},ol=r(function(e,t){return f(Ju,il(e),il(t))}),ul=r(function(e,t){return Ho(il(e)-il(t))}),sl=function(e){return{$:"Ok",a:e}},cl={$:"Outdated"},fl=r(function(e,t){return $(f(ol,f(ul,e,t.timestamp),Ho(6e5)),Aa)?cl:sl(t.price)}),ll=r(function(e,t){return{price:e,timestamp:t}}),dl=r(function(e,t){return _(e,t)}),hl=Qr,pl=Wr,gl=n(function(e,t,r){return{col:t,problem:r,row:e}}),vl=function(e){return l(gl,e.row,e.col,e.problem)},yl=r(function(e,t){e:for(;;)switch(e.$){case"Empty":return t;case"AddRight":var r=e.a,n=e.b,a=r,i=f(Ra,n,t);e=a,t=i;continue e;default:var r=e.a,o=e.b,a=r,i=f(yl,o,t);e=a,t=i;continue e}}),ml=r(function(e,t){var r=e.a,n=r({col:1,context:vr,indent:1,offset:0,row:1,src:t});if("Good"===n.$){var a=n.b;return hi(a)}var i=n.b;return di(f(yl,i,vr))}),bl=r(function(e,t){var r=f(ml,e,t);if("Ok"===r.$){var n=r.a;return hi(n)}var a=r.a;return di(f(Ua,vl,a))}),Cl=r(function(e,t){return{$:"Bad",a:e,b:t}}),El=n(function(e,t,r){return{$:"Good",a:e,b:t,c:r}}),Sl=function(e){return{$:"Parser",a:e}},Tl=r(function(e,t){var r=t.a;return Sl(function(t){var n=r(t);if("Bad"===n.$){var a=n.a,i=n.b;return f(Cl,a,i)}var o=n.a,u=n.b,s=n.c,c=e(u),d=c.a,h=d(s);if("Bad"===h.$){var p=h.a,i=h.b;return f(Cl,o||p,i)}var p=h.a,g=h.b,v=h.c;return l(El,o||p,g,v)})}),wl=Tl,Il={$:"ExpectingEnd"},Al=r(function(e,t){return{$:"AddRight",a:e,b:t}}),Bl=a(function(e,t,r,n){return{col:t,contextStack:n,problem:r,row:e}}),kl={$:"Empty"},Nl=r(function(e,t){return f(Al,kl,d(Bl,e.row,e.col,t,e.context))}),$l=function(e){return Sl(function(t){return $(iu(t.src),t.offset)?l(El,!1,pr,t):f(Cl,!1,f(Nl,t,e))})}(Il),Rl=n(function(e,t,r){var n=t.a,a=r.a;return Sl(function(t){var r=n(t);if("Bad"===r.$){var i=r.a,o=r.b;return f(Cl,i,o)}var u=r.a,s=r.b,c=r.c,d=a(c);if("Bad"===d.$){var h=d.a,o=d.b;return f(Cl,u||h,o)}var h=d.a,p=d.b,g=d.c;return l(El,u||h,f(e,s,p),g)})}),xl=r(function(e,t){return l(Rl,As,e,t)}),_l=xl,Ll=r(function(e,t){return l(Rl,Oa,e,t)}),Pl=Ll,Dl=r(function(e,t){return{$:"Append",a:e,b:t}}),Ul=n(function(e,t,r){for(;;){if(!r.b)return f(Cl,!1,t);var n=r.a.a,a=r.b,i=n(e);if("Good"===i.$){var o=i;return o}var o=i,u=o.a,s=o.b;if(u)return o;var c=e,l=f(Dl,t,s),d=a;e=c,t=l,r=d}}),Ol=function(e){return Sl(function(t){return l(Ul,t,kl,e)})},Ml=Ol,Fl=function(e){return Sl(function(t){return l(El,!1,e,t)})},Vl=Fl,Kl=function(e){return{$:"ExpectingSymbol",a:e}},Hl=r(function(e,t){return{$:"Token",a:e,b:t}}),jl=function(e){return""===e},ql=Qn,Gl=function(e){var t=e.a,r=e.b,n=!jl(t);return Sl(function(e){var a=h(ql,t,e.offset,e.row,e.col,e.src),i=a.a,o=a.b,u=a.c;return $(i,-1)?f(Cl,!1,f(Nl,e,r)):l(El,n,pr,{col:u,context:e.context,indent:e.indent,offset:i,row:o,src:e.src})})},zl=Gl,Wl=function(e){return zl(f(Hl,e,Kl(e)))},Yl=$r,Jl=te,Ql=Xn,Xl=i(function(e,t,r,n,a){for(;;){var i=l(Ql,e,t,a.src);if($(i,-1))return l(El,x(a.offset,t)<0,pr,{col:n,context:a.context,indent:a.indent,offset:t,row:r,src:a.src});if($(i,-2)){var o=e,u=t+1,s=r+1,c=1,f=a;e=o,t=u,r=s,n=c,a=f}else{var o=e,u=i,s=r,c=n+1,f=a;e=o,t=u,r=s,n=c,a=f}}}),Zl=function(e){return Sl(function(t){return h(Xl,e,t.offset,t.row,t.col,t)})},ed=Zl,td=r(function(e,t){var r=t.a;return Sl(function(t){var n=r(t);if("Bad"===n.$){var a=n.a,i=n.b;return f(Cl,a,i)}var a=n.a,o=n.b,u=n.c;return l(El,a,f(e,l(ou,t.offset,u.offset,t.src),o),u)})}),rd=function(e){return f(td,As,e)},nd=rd,ad=function(e){return{$:"Problem",a:e}},id=function(e){return Sl(function(t){return f(Cl,!1,f(Nl,t,e))})},od=function(e){return id(ad(e))},ud=f(wl,function(e){if(iu(e)<=9){var t=Jl("0."+e);if("Just"===t.$){var r=t.a;return Vl(Yl(1e3*r))}return od('Invalid float: "'+e+'"')}return od("Expected at most 9 digits, but got "+Ri(iu(e)))},nd(ed(Ti))),sd=o(function(e,t,r,n,a,i){return Ho(e+60*t*60*1e3+60*(r-i)*1e3+1e3*n+a)}),cd=ee,fd=function(e){return{$:"Done",a:e}},ld=function(e){return{$:"Loop",a:e}},dd={$:"UnexpectedChar"},hd=r(function(e,t){return Sl(function(r){var n=l(Ql,e,r.offset,r.src);return $(n,-1)?f(Cl,!1,f(Nl,r,t)):$(n,-2)?l(El,!0,pr,{col:1,context:r.context,indent:r.indent,offset:r.offset+1,row:r.row+1,src:r.src}):l(El,!0,pr,{col:r.col+1,context:r.context,indent:r.indent,offset:n,row:r.row,src:r.src})})}),pd=function(e){return f(hd,e,dd)},gd=r(function(e,t){var r=t.a;return Sl(function(t){var n=r(t);if("Good"===n.$){var a=n.a,i=n.b,o=n.c;return l(El,a,e(i),o)}var a=n.a,u=n.b;return f(Cl,a,u)})}),vd=gd,yd=function(e){return{$:"Done",a:e}},md=function(e){return{$:"Loop",a:e}},bd=function(e){if("Loop"===e.$){var t=e.a;return md(t)}var r=e.a;return yd(r)},Cd=a(function(e,t,r,n){e:for(;;){var a=r(t),i=a.a,o=i(n);if("Good"===o.$){var u=o.a,s=o.b,c=o.c;if("Loop"===s.$){var d=s.a,h=e||u,p=d,g=r,v=c;e=h,t=p,r=g,n=v;continue e}var y=s.a;return l(El,e||u,y,c)}var u=o.a,m=o.b;return f(Cl,e||u,m)}}),Ed=r(function(e,t){return Sl(function(r){return d(Cd,!1,e,t,r)})}),Sd=r(function(e,t){return f(Ed,e,function(e){return f(vd,bd,t(e))})}),Td=function(e){return f(Sd,"",function(t){if($(iu(t),e)){var r=cd(t);if("Just"===r.$){var n=r.a;return f(vd,fd,Vl(n))}return od('Invalid integer: "'+t+'"')}return f(vd,function(e){return ld(f(pc,t,e))},nd(pd(Ti)))})},wd=function(e){return od("Invalid day: "+Ri(e))},Id=function(e){return!f(Fs,4,e)&&(f(Fs,100,e)||!f(Fs,400,e))},Ad=function(e){var t=e-1;return(t/4|0)-(t/100|0)+(t/400|0)},Bd=function(e){var t=e.a,r=e.b,n=e.c;if(n<0)return wd(n);var a=function(e){var a=31536e6*(t-1970),i=r<3||!Id(t)?n-1:n,o=864e5*(i+(Ad(t)-Ad(1970)));return Vl(e+a+o)};switch(r){case 1:return n>31?wd(n):a(0);case 2:return n>29||29===n&&!Id(t)?wd(n):a(26784e5);case 3:return n>31?wd(n):a(50976e5);case 4:return n>30?wd(n):a(7776e6);case 5:return n>31?wd(n):a(10368e6);case 6:return n>30?wd(n):a(130464e5);case 7:return n>31?wd(n):a(156384e5);case 8:return n>31?wd(n):a(183168e5);case 9:return n>30?wd(n):a(209952e5);case 10:return n>31?wd(n):a(235872e5);case 11:return n>30?wd(n):a(262656e5);case 12:return n>31?wd(n):a(288576e5);default:return od('Invalid month: "'+Ri(r)+'"')}},kd=f(wl,Bd,f(Pl,f(Pl,f(Pl,Vl(n(function(e,t,r){return L(e,t,r)})),Td(4)),Ml(M([f(Pl,f(_l,Vl(Fa),Wl("-")),Td(2)),Td(2)]))),Ml(M([f(Pl,f(_l,Vl(Fa),Wl("-")),Td(2)),Td(2)])))),Nd=function(){var e=n(function(e,t,r){return e*(60*t)+r});return f(Pl,Vl(Fa),Ml(M([f(vd,function(e){return 0},Wl("Z")),f(Pl,f(Pl,f(Pl,Vl(e),Ml(M([f(vd,function(e){return 1},Wl("+")),f(vd,function(e){return-1},Wl("-"))]))),Td(2)),Ml(M([f(Pl,f(_l,Vl(Fa),Wl(":")),Td(2)),Td(2),Vl(0)]))),f(_l,Vl(0),$l)])))}(),$d=f(wl,function(e){return Ml(M([f(Pl,f(Pl,f(Pl,f(Pl,f(Pl,f(_l,Vl(sd(e)),Wl("T")),Td(2)),Ml(M([f(Pl,f(_l,Vl(Fa),Wl(":")),Td(2)),Td(2)]))),Ml(M([f(Pl,f(_l,Vl(Fa),Wl(":")),Td(2)),Td(2)]))),Ml(M([f(Pl,f(_l,Vl(Fa),Wl(".")),ud),Vl(0)]))),f(_l,Nd,$l)),f(_l,Vl(p(sd,e,0,0,0,0,0)),$l)]))},kd),Rd=function(e){return f(bl,$d,e)},xd=f(Cu,function(e){var t=Rd(e);if("Err"===t.$){t.a;return Eu("TODO deadEndsToString")}var r=t.a;return Ki(r)},Su),_d=l(Vi,dl,f(hl,"symbol",Su),f(hl,"quote",f(hl,"USD",l(Vi,ll,f(hl,"price",pl),f(hl,"last_updated",xd))))),Ld=function(e){return l(Ba,n(function(e,t,r){return f(Ra,t,r)}),vr,e)},Pd={$:"RBEmpty_elm_builtin"},Dd=Pd,Ud={$:"Black"},Od=i(function(e,t,r,n,a){return{$:"RBNode_elm_builtin",a:e,b:t,c:r,d:n,e:a}}),Md={$:"Red"},Fd=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(Od,Md,t,r,h(Od,Ud,c,f,l,d),h(Od,Ud,i,o,u,s))}return h(Od,e,i,o,h(Od,Md,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(Od,Md,c,f,h(Od,Ud,g,v,y,m),h(Od,Ud,t,r,d,a))}return h(Od,e,t,r,n,a)}),Vd=n(function(e,t,r){if("RBEmpty_elm_builtin"===r.$)return h(Od,Md,e,t,Pd,Pd);var n=r.a,a=r.b,i=r.c,o=r.d,u=r.e;switch(f(Ju,e,a).$){case"LT":return h(Fd,n,a,i,l(Vd,e,t,o),u);case"EQ":return h(Od,n,a,t,o,u);default:return h(Fd,n,a,i,o,l(Vd,e,t,u))}}),Kd=n(function(e,t,r){var n=l(Vd,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(Od,Ud,a,i,o,u)}return n}),Hd=function(e){return l(_a,r(function(e,t){var r=e.a,n=e.b;return l(Kd,r,n,t)}),Dd,e)},jd=ce,qd=f(Fi,Ld,function(e){return f(Fi,Hd,jd(e))}(_d)),Gd=r(function(e,t){e:for(;;){if("RBEmpty_elm_builtin"===t.$)return li;var r=t.b,n=t.c,a=t.d,i=t.e,o=f(Ju,e,r);switch(o.$){case"LT":var u=e,s=a;e=u,t=s;continue e;case"EQ":return fi(n);default:var u=e,s=i;e=u,t=s;continue e}}}),zd=function(e){for(;;){if("RBNode_elm_builtin"!==e.$||"RBNode_elm_builtin"!==e.d.$)return e;e=e.d}},Wd=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(Od,Md,p,g,h(Od,Ud,r,n,h(Od,Md,i,o,u,s),v),h(Od,Ud,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(Od,Ud,r,n,h(Od,Md,i,o,u,s),h(Od,Md,f,l,d,m))}return e},Yd=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(Od,Md,i,o,h(Od,Ud,s,c,f,l),h(Od,Ud,r,n,d,h(Od,Md,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,E=e.e,g=(E.a,E.b),v=E.c,y=E.d,m=E.e;return t.$,h(Od,Ud,r,n,h(Od,Md,i,o,C,d),h(Od,Md,g,v,y,m))}return e},Jd=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(Od,r,u,s,c,h(Od,Md,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 Yd(t)}break e}o.a,o.d;return Yd(t)}break e}return t}),Qd=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(Od,t,r,n,Qd(a),u)}var s=Wd(e);if("RBNode_elm_builtin"===s.$){var c=s.a,f=s.b,l=s.c,d=s.d,p=s.e;return h(Fd,c,f,l,Qd(d),p)}return Pd}return h(Od,t,r,n,Qd(a),u)}return Pd},Xd=r(function(e,t){if("RBEmpty_elm_builtin"===t.$)return Pd;var r=t.a,n=t.b,a=t.c,i=t.d,o=t.e;if(x(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(Od,r,n,a,f(Xd,e,i),o)}var s=Wd(t);if("RBNode_elm_builtin"===s.$){var c=s.a,l=s.b,d=s.c,p=s.d,v=s.e;return h(Fd,c,l,d,f(Xd,e,p),v)}return Pd}return h(Od,r,n,a,f(Xd,e,i),o)}return f(Zd,e,g(Jd,e,t,r,n,a,i,o))}),Zd=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=zd(o);if("RBNode_elm_builtin"===u.$){var s=u.b,c=u.c;return h(Fd,r,s,c,i,Qd(o))}return Pd}return h(Fd,r,n,a,i,f(Xd,e,o))}return Pd}),eh=r(function(e,t){var r=f(Xd,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(Od,Ud,n,a,i,o)}return r}),th=n(function(e,t,r){var n=t(f(Gd,e,r));if("Just"===n.$){var a=n.a;return l(Kd,e,a,r)}return f(eh,e,r)}),rh=function(e){return"Just"===e.$},nh=vn,ah=yn,ih=r(function(e,t){return{$:"BadStatus_",a:e,b:t}}),oh=function(e){return{$:"BadUrl_",a:e}},uh=r(function(e,t){return{$:"GoodStatus_",a:e,b:t}}),sh={$:"NetworkError_"},ch=function(e){return{$:"Receiving",a:e}},fh=function(e){return{$:"Sending",a:e}},lh={$:"Timeout_"},dh=ra,hh=r(function(e,t){if("Ok"===t.$){var r=t.a;return hi(r)}var n=t.a;return di(e(n))}),ph=r(function(e,t){return l(ea,"",Fa,f(tu,t,e))}),gh=function(e){return{$:"BadBody",a:e}},vh=function(e){return{$:"BadStatus",a:e}},yh=function(e){return{$:"BadUrl",a:e}},mh={$:"NetworkError"},bh={$:"Timeout"},Ch=r(function(e,t){switch(t.$){case"BadUrl_":var r=t.a;return di(yh(r));case"Timeout_":return di(bh);case"NetworkError_":return di(mh);case"BadStatus_":var n=t.a;return di(vh(n.statusCode));default:var a=t.b;return f(hh,gh,e(a))}}),Eh=nn,Sh=r(function(e,t){return f(ph,e,Ch(function(e){return f(hh,Oi,f(Eh,t,e))}))}),Th=function(e){return{$:"Request",a:e}},wh=we,Ih=r(function(e,t){return{reqs:e,subs:t}}),Ah=wh(f(Ih,Dd,vr)),Bh=cn,kh=Re,Nh=Ne,$h=n(function(e,t,r){e:for(;;){if(t.b){var n=t.a,a=t.b;if("Cancel"===n.$){var i=n.a,o=f(Gd,i,r);if("Nothing"===o.$){var u=e,s=a,c=r;e=u,t=s,r=c;continue e}var d=o.a;return f(Bh,function(t){return l($h,e,a,f(eh,i,r))},kh(d))}var h=n.a;return f(Bh,function(t){var n=h.tracker;if("Nothing"===n.$)return l($h,e,a,r);var i=n.a;return l($h,e,a,l(Kd,i,t,r))},Nh(l(Zn,e,nh(e),h)))}return wh(r)}}),Rh=a(function(e,t,r,n){return f(Bh,function(e){return wh(f(Ih,e,r))},l($h,e,t,n.reqs))}),xh=n(function(e,t,r){var n=e(t);if("Just"===n.$){var a=n.a;return f(Ra,a,r)}return r}),_h=r(function(e,t){return l(Da,xh(e),vr,t)}),Lh=n(function(e,t,r){return f(Bh,function(t){return f(Bh,function(r){return wh(f(e,t,r))},r)},t)}),Ph=function(e){return l(Da,Lh(Ra),wh(vr),e)},Dh=a(function(e,t,r,n){var a=n.a,i=n.b;return $(t,a)?fi(f(nh,e,i(r))):li}),Uh=n(function(e,t,r){var n=t.a,a=t.b;return f(Bh,function(e){return wh(r)},Ph(f(_h,l(Dh,e,n,a),r.subs)))}),Oh=function(e){return{$:"Cancel",a:e}},Mh=r(function(e,t){if("Cancel"===t.$){var r=t.a;return Oh(r)}var n=t.a;return Th({allowCookiesFromOtherDomains:n.allowCookiesFromOtherDomains,body:n.body,expect:f(ta,e,n.expect),headers:n.headers,method:n.method,timeout:n.timeout,tracker:n.tracker,url:n.url})}),Fh=r(function(e,t){return{$:"MySub",a:e,b:t}}),Vh=r(function(e,t){var r=t.a,n=t.b;return f(Fh,r,f(tu,n,e))});gn.Http=Ue(Ah,Rh,Uh,Mh,Vh);var Kh=Me("Http"),Hh=(Me("Http"),function(e){return Kh(Th({allowCookiesFromOtherDomains:!1,body:e.body,expect:e.expect,headers:e.headers,method:e.method,timeout:e.timeout,tracker:e.tracker,url:e.url}))}),jh=function(e){return Hh({body:dh,expect:f(Sh,e,qd),headers:vr,method:"GET",timeout:li,tracker:li,url:"https://daihard.exchange/prices.json"})},qh=r(function(e,t){return{$:"Trade",a:e,b:t}}),Gh=a(function(e,t,r,n){return{chainCmd:r,cmd:t,cmdUps:n,model:e}}),zh={$:"Descending"},Wh=function(e){return"Ascending"===e.$?zh:Oo},Yh=function(e){return d(Gh,e,Vo,zo,vr)},Jh=r(function(e,t){return _(t.a,e(t.b))}),Qh=r(function(e,t){switch(e.$){case"TradeClicked":var r=e.a,n=e.b;return d(Gh,t,Vo,zo,M([ga(f(qh,r,n))]));case"ChangeSort":var a=e.a,i=$(t.orderBy.a,a)?f(Jh,Wh,t.orderBy):_(a,Oo);return Yh(D(t,{orderBy:i}));default:return Yh(t)}}),Xh={$:"BottomRight"},Zh={$:"Caution"},ep=function(e){return zi(e)},tp={align:Xh,label:"cantFetchPrices",mainParagraphs:M([M([ep("Error encountered fetching crypto prices.")])]),noticeType:Zh},rp=function(e){return{data:e.data,from:e.from,gas:e.gas,gasPrice:e.gasPrice,nonce:e.nonce,to:e.to,value:e.value}},np=mn,ap=r(function(e,t){switch(e.$){case"Poke":var r=e.a,n=rp(tl(r)),a={onBroadcast:li,onMined:li,onSign:li},i=f(Zo,a,n);return d(qo,t,Vo,i,vr);case"TradeClicked":var o=e.a,u=e.b;return d(qo,t,Vo,zo,M([ga(f(qh,o,u))]));case"FiltersMsg":var s=e.a;return Wo(D(t,{filters:f(al,s,t.filters)}));case"TradeTableMsg":var c=e.a,l=f(Qh,c,t.tradeTable);return d(qo,D(t,{tradeTable:l.model}),f(np,Qo,l.cmd),f(ru,Qo,l.chainCmd),f(Ua,Xi(Qo),l.cmdUps));case"UpdateNow":var h=e.a;return Wo(D(t,{now:h}));case"PricesFetched":var p=e.a;if("Ok"===p.$){var g=p.a,v=f(Ua,Jh(fl(t.now)),g);return Wo(D(t,{prices:v}))}p.a;return d(qo,t,Vo,zo,M([ya(tp)]));case"Refresh":return d(qo,t,jh(Jo),zo,vr);default:return Wo(t)}}),ip={$:"ShouldBeImpossible"},op=fr,up=r(function(e,t){f(op,e,t);return{align:Xh,label:"unexpectedError",mainParagraphs:M([M([ep(e)])]),noticeType:ip}}),sp=function(e){var t=e.a;return Xf(t)},cp=be,fp=f(tu,sp,cp),lp=f(tu,qs,f(tu,Xf,cp)),dp=f(tu,Zf,cp),hp=f(tu,Hs,f(tu,Xf,cp)),pp=r(function(e,t){return l(Da,r(function(t,r){return e(t)?f(Ra,t,r):r}),vr,t)}),gp=sn,vp=function(e){return be(l(_a,r(function(e,t){var r=e.a,n=e.b;return l(un,r,n,t)}),Se(),e))},yp=function(e){return vp(f(Ua,function(e){var t=e.a,r=e.b;return _(t,f(Kc,gp,r))},f(pp,function(e){e.a;return!$(e.b,li)},e)))},mp=function(e){return yp(M([_("to",f(xo,fp,e.to)),_("from",f(xo,fp,e.from)),_("gas",f(xo,hp,e.gas)),_("gasPrice",f(xo,lp,e.gasPrice)),_("value",f(xo,lp,e.value)),_("data",f(xo,dp,e.data)),_("nonce",f(xo,hp,e.nonce))]))},bp=function(e){return{$:"TxSentry",a:e}},Cp=be,Ep=r(function(e,t){return vp(M([_("ref",Cp(e)),_("txParams",t)]))}),Sp=function(e){return{$:"Signing",a:e}},Tp=r(function(e,t){var r=t.onSign;return{onBroadcastTagger:t.onBroadcast,onMinedTagger:t.onMined,onSignedTagger:r,params:e,status:Sp(e)}}),wp=n(function(e,t,r){var n=e.a,a=mp(r),i=l(Kd,n.ref,f(Tp,r,t),n.txs);return _(bp(D(n,{ref:n.ref+1,txs:i})),f(np,n.tagger,n.outPort(f(Ep,n.ref,a))))}),Ip=wp,Ap=r(function(e,t){var r=_(e,t);if("None"===r.b.$){r.b;return L(e,Vo,vr)}if("Just"===r.a.$){var n=r.a.a,a=r.b,i=a.a,o=a.b;return function(e){var t=e.a,r=e.b;return L(fi(t),r,vr)}(l(Ip,n,i,o))}return L(li,Vo,M([f(up,"submodel sent chainCmd, but there is no txSentry to use!",li)]))}),Bp={$:"CloseAnyDropdownsOrModals"},kp=function(e){return{$:"UpdateWallet",a:e}},Np=a(function(e,t,r,n){return{category:t,event:e,label:r,value:n}}),$p=n(function(e,t,r){return{address:t,commPubkey:r,network:e}}),Rp=function(e){return"CryptoSwap"===e.$?"ZEC":"USD"},xp={$:"Day"},_p={$:"Hour"},Lp=r(function(e,t){return{num:e,unit:t}}),Pp=function(e){switch(e.$){case"CryptoSwap":if("Seller"===e.a.$){e.a;return L(f(Lp,24,_p),f(Lp,1,_p),f(Lp,24,_p))}e.a;return L(f(Lp,24,_p),f(Lp,24,_p),f(Lp,24,_p));case"OffRamp":default:return L(f(Lp,3,xp),f(Lp,3,xp),f(Lp,3,xp))}},Dp=function(e){return{$:"CryptoSwap",a:e}},Up=function(e){return{$:"DHToken",a:e}},Op=function(e){return{$:"External",a:e}},Mp={$:"OffRamp"},Fp={$:"OnRamp"},Vp={$:"KovanDai"},Kp=function(e){e:for(;;)switch(e.$){case"Mainnet":return fi(ro(eo));case"Kovan":return fi(ro(Vp));case"Private":if(100===e.a)return fi(to(no));break e;default:break e}return li},Hp=function(e){switch(e.$){case"NoneDetected":return li;case"OnlyNetwork":var t=e.a;return fi(t);default:var r=e.a;return fi(r.network)}},jp=function(e){return f($o,Kp,Hp(e))},qp=r(function(e,t){var r=Op("USD"),n=Up(f(Kc,to(no),jp(e))),a=Op("ZEC");return _($(t,Dp(yo))||$(t,Mp)?n:$(t,Dp(vo))?a:r,$(t,Dp(vo))||$(t,Fp)?n:$(t,Dp(yo))?a:r)}),Gp={$:"Even"},zp=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{amountIn:e,amountOut:r,currencySearch:a,inType:t,interval:c,margin:i,marginType:o,outType:n,paymentMethod:s,receiveAddress:u}}}}}}}}}}},Wp=r(function(e,t){return zp("")(f(qp,e,t).a)("")(f(qp,e,t).b)("")("0")(Gp)("")("")("")}),Yp=a(function(e,t,r,n){return pa(d(Np,e,t,r,n))}),Jp=function(e){return"Buyer"===e.$?"Buyer":"Seller"},Qp=function(e){switch(e.$){case"Expiry":return"Expiry";case"Payment":return"Payment";default:return"Judgment"}},Xp=function(e){return{$:"Address",a:e}},Zp=X,eg=f(tu,yu,f(tu,Zp,Xp)),tg=function(e){if("Token"===e.$){if("EthDai"===e.a.$){e.a;return eg("0x5677CFbA35a0Db0469d3d56020d556B942E9ce90")}e.a;return eg("0xbC69Aff9d93C5EA4a841166C46C68518D02aF818")}switch(e.a.$){case"Eth":e.a;return eg("0xD3b1e8F2bDe0a2DdfC9F6e2EB6e2589e5Ba955b6");case"Kovan":e.a;return eg("0xA30773FD520cdf845E1a00441aB09cE39B31F676");default:e.a;return eg("0x7E370099a7a789dC28810a72381bcd7Be834Ad74")}},rg=function(e){return eg("EthDai"===e.$?"0x89d24A6b4CcB1B6fAA2625fE562bDD9a23260359":"0xC4375B7De8af5a38a93548eb8453a498222C4fF2")},ng=function(e){return{$:"AddressE",a:e}},ag=ng,ig=function(e){return{$:"UintE",a:e}},og=ig,ug=n(function(e,t,r){return{data:fi(f(el,"approve(address,uint256)",M([ag(t),og(r)]))),decoder:wu(gu),from:li,gas:li,gasPrice:li,nonce:li,to:fi(e),value:li}}),sg=function(e){return{$:"TokenValue",a:e}},cg=function(e){return e.a},fg=r(function(e,t){return f(Kc,Es,f(xo,ei,f(Rs,e,t)))}),lg=r(function(e,t){return sg(f(fg,cg(e),Zu(t)))}),dg=function(e){return f(lg,e,12)},hg=function(e){return f(lg,e,3)},pg=sg(Zu(0)),gg=r(function(e,t){var r=pg;return{abortPunishment:dg(t.tradeAmount),autoabortInterval:t.autoabortInterval,autorecallInterval:t.autorecallInterval,autoreleaseInterval:t.autoreleaseInterval,buyerDeposit:hg(t.tradeAmount),initiatorAddress:e.address,initiatorCommPubkey:e.commPubkey,initiatorRole:t.initiatorRole,paymentMethods:t.paymentMethods,pokeReward:r,price:t.price,tradeAmount:t.tradeAmount}}),vg=function(e){return f(lg,e,200)},yg=r(function(e,t){return sg(f(os,cg(e),cg(t)))}),mg=function(e){var t=f(lg,e.tradeAmount,200);return f(yg,e.pokeReward,f(yg,vg(e.tradeAmount),f(yg,t,function(){return"Buyer"===e.initiatorRole.$?hg(e.tradeAmount):e.tradeAmount}())))},bg=Vi(Ca),Cg=n(function(e,t,r){return{id:e,initiator:r,tradeAddress:t}}),Eg=a(function(e,t,r,n){return{index:t,match:e,number:r,submatches:n}}),Sg=oa,Tg=ia,wg=function(e){return f(Tg,{caseInsensitive:!1,multiline:!1},e)},Ig=aa,Ag=Sg(f(Kc,Ig,wg("^((0[Xx]){1})?[0-9A-Fa-f]{40}$"))),Bg=r(function(e,t){return!f(fo,f(Ma,ls,e),t)}),kg=Bg(Fa),Ng=G,$g=r(function(e,t){if("Ok"===t.$){return t.a}return e}),Rg=n(function(e,t,r){if("Err"===t.$){var n=t.a;return di(n)}var a=t.a;if("Err"===r.$){var n=r.a;return di(n)}var i=r.a;return hi(f(e,a,i))}),xg=f(Da,Rg(Ra),hi(vr)),_g=function(e){if(e.b){var t=(e.a,e.b);return fi(t)}return li},Lg=n(function(e,t,r){e:for(;;){if(!t.b)return hi(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(Uu,16,e);e=i,t=o,r=u;continue e;case"2":var i=e-1,o=a,u=r+2*f(Uu,16,e);e=i,t=o,r=u;continue e;case"3":var i=e-1,o=a,u=r+3*f(Uu,16,e);e=i,t=o,r=u;continue e;case"4":var i=e-1,o=a,u=r+4*f(Uu,16,e);e=i,t=o,r=u;continue e;case"5":var i=e-1,o=a,u=r+5*f(Uu,16,e);e=i,t=o,r=u;continue e;case"6":var i=e-1,o=a,u=r+6*f(Uu,16,e);e=i,t=o,r=u;continue e;case"7":var i=e-1,o=a,u=r+7*f(Uu,16,e);e=i,t=o,r=u;continue e;case"8":var i=e-1,o=a,u=r+8*f(Uu,16,e);e=i,t=o,r=u;continue e;case"9":var i=e-1,o=a,u=r+9*f(Uu,16,e);e=i,t=o,r=u;continue e;case"a":var i=e-1,o=a,u=r+10*f(Uu,16,e);e=i,t=o,r=u;continue e;case"b":var i=e-1,o=a,u=r+11*f(Uu,16,e);e=i,t=o,r=u;continue e;case"c":var i=e-1,o=a,u=r+12*f(Uu,16,e);e=i,t=o,r=u;continue e;case"d":var i=e-1,o=a,u=r+13*f(Uu,16,e);e=i,t=o,r=u;continue e;case"e":var i=e-1,o=a,u=r+14*f(Uu,16,e);e=i,t=o,r=u;continue e;case"f":var i=e-1,o=a,u=r+15*f(Uu,16,e);e=i,t=o,r=u;continue e;default:var s=n;return di(Ls(s)+" is not a valid hexadecimal character.")}}}),Pg=function(e){if(jl(e))return di("Empty strings are not valid hexadecimal strings.");var t=function(){if(f(vu,"-",e)){var t=f(Kc,vr,_g(uc(e)));return f(du,hu,l(Lg,Ii(t)-1,t,0))}return l(Lg,iu(e)-1,uc(e),0)}();return f(hh,function(t){return f(xi," ",M(['"'+e+'"',"is not a valid hexadecimal string because",t]))},t)},Dg=function(e){var t=uc(e);return function(e){return _(t,e)}(f($g,vr,xg(f(Ua,Pg,f(Li,"",f(xi,"",f(Ua,f(tu,Hs,gc),f(bc,20,Jf(f(Ua,f(tu,Ng,bi),t))))))))))},Ug=function(e){var t=r(function(e,t){return!(t>=8&&Ci(e)||t<8&&Ei(e))}),n=Dg(yu(e)),a=n.a,i=n.b,o=l(Ai,t,a,i);return!!Ag(e)&&kg(o)},Og=Sg(f(Kc,Ig,wg("^((0[Xx]){1})?[0-9a-f]{40}$"))),Mg=Sg(f(Kc,Ig,wg("^((0[Xx]){1})?[0-9A-F]{40}$"))),Fg=function(e){return'"'+e+'"'},Vg=function(e){var t=yu(e),r=f(fu,24,t),n=f(pu,40,e);return 64===iu(t)&&f($i,Za(P("0")),r)?Mg(n)||Og(n)?hi(Xp(n)):Ug(n)?hi(Xp(n)):di("Given address "+Fg(e)+" failed the EIP-55 checksum test."):40!==iu(t)?di("Given address "+Fg(e)+" is not the correct length."):Ag(t)?Mg(t)||Og(t)?hi(Xp(t)):Ug(t)?hi(Xp(t)):di("Given address "+Fg(e)+" failed the EIP-55 checksum test."):di("Given address "+Fg(e)+" contains invalid hex characters.")},Kg=nu(function(e){var t=e.a,r=e.b;return f(du,f(cu,t,r),Vg(lu(r)))}),Hg=r(function(e,t){var r=t.a;return nu(function(t){var n=t.a,a=t.b;return r(f(au,n,f(uu,64*e,a)))})}),jg=r(function(e,t){return f(hl,"data",wu(f(Hg,e,t)))}),qg=Xr,Gg=r(function(e,t){return f(hl,"topics",f(qg,e,wu(t)))}),zg=function(e){if("Ok"===e.$){var t=e.a;return fi(t)}return li},Wg=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}}}),Yg=n(function(e,t,r){var n=f(Wg,t,r),a=Ii(r)>0;return e>0&&t>0&&a?f(Ra,f(bc,e,r),l(Yg,e,t,n)):vr}),Jg=r(function(e,t){return l(Yg,e,e,t)}),Qg=function(e){var t=r(function(t,r){var n=e(t);if("Nothing"===n.$)return li;var a=n.a;return f(xo,Ra(a),r)});return f(Da,t,fi(vr))}(Fa),Xg=function(e){return f(xo,f(tu,La,f(_a,r(function(e,t){return f(os,Zu(e),f(ms,t,xs))}),Es)),Qg(f(Ua,f(tu,La,f(tu,Ms,f(tu,Pg,zg))),f(Jg,8,La(e)))))},Zg=function(e){var t=uc(Zp(e));e:for(;;){if(!t.b)return li;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(xo,ms(Zu(-1)),Xg(a))}var i=t.b;i.b;return li}var a=t.b;return f(xo,ms(Zu(-1)),Xg(a))}return li;case"+":if(t.b.b){var a=t.b;return Xg(a)}return li;case"0":if(t.b.b&&"x"===t.b.a.valueOf()){if(t.b.b.b){var o=t.b,a=o.b;return Xg(a)}t.b;return li}break e;default:break e}}var a=t;return Xg(a)},ev=r(function(e,t){if("Just"===t.$){var r=t.a;return hi(r)}return di(e)}),tv=nu(function(e){var t=e.a,r=e.b;return f(du,f(cu,t,r),f(ev,"Error Decoding Uint into BigInt",Zg(Xf(lu(r)))))}),rv=f(bg,f(Gg,1,Kg),f(bg,f(jg,1,Kg),f(bg,f(jg,0,tv),Ki(Cg)))),nv=an,av=r(function(e,t){return be(l(_a,Te(e),Ee(),t))}),iv=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(nv,e,vp(M([_("data",cp(t.data)),_("topics",f(av,dp,t.topics))]))),topics:t.topics,transactionHash:t.transactionHash,transactionIndex:t.transactionIndex}}),ov=function(e){if(e.b){var t=e.a;e.b;return fi(t)}return li},uv=r(function(e,t){if("Ok"===t.$){return e(t.a)}var r=t.a;return di(r)}),sv=r(function(e,t){return f(du,function(e){return e.id},f(uv,function(e){return f(hh,Oi,f(iv,rv,e).returnData)},f(ev,"No log found from that factoryAddress in that txReceipt",ov(f(pp,function(t){return $(f(tu,sp,Zp)(t.address),f(tu,sp,Zp)(tg(e)))},t.logs)))))}),cv=n(function(e,t,r){return{data:fi(f(el,"allowance(address,address)",M([ag(t),ag(r)]))),decoder:wu(tv),from:li,gas:li,gasPrice:li,nonce:li,to:fi(e),value:li}}),fv=function(e){if("Token"===e.$){if("EthDai"===e.a.$){e.a;return"https://mainnet.infura.io/v3/e3eef0e2435349bf9164e6f465bd7cf9"}e.a;return"https://kovan.infura.io/v3/e3eef0e2435349bf9164e6f465bd7cf9"}switch(e.a.$){case"Eth":e.a;return"https://mainnet.infura.io/v3/e3eef0e2435349bf9164e6f465bd7cf9";case"Kovan":e.a;return"https://kovan.infura.io/v3/e3eef0e2435349bf9164e6f465bd7cf9";default:e.a;return"https://dai.poa.network"}},lv=function(e){switch(e.$){case"BlockNum":var t=e.a;return cp(Xf(Hs(t)));case"EarliestBlock":return cp("earliest");case"LatestBlock":return cp("latest");default:return cp("pending")}},dv=function(e){var t=e.to,r=e.from,n=e.gas,a=e.gasPrice,i=e.value,o=e.data;return yp(M([_("to",f(xo,fp,t)),_("from",f(xo,fp,r)),_("gas",f(xo,hp,n)),_("gasPrice",f(xo,lp,a)),_("value",f(xo,lp,i)),_("data",f(xo,dp,o))]))},hv=r(function(e,t){switch(t.$){case"BadUrl_":var r=t.a;return di(yh(r));case"Timeout_":return di(bh);case"NetworkError_":return di(mh);case"BadStatus_":var n=t.a,a=t.b;return di(vh(n.statusCode));default:var n=t.a,a=t.b,i=f(Eh,f(hl,"result",e),a);if("Ok"===i.$){var o=i.a;return hi(o)}var u=i.a;return di(gh(Oi(u)))}}),pv=n(function(e,t,r){return vp(M([_("id",Cp(e)),_("jsonrpc",cp("2.0")),_("method",cp(t)),_("params",f(av,Fa,r))]))}),gv=function(e){return f(na,"application/json",f(Di,0,e))},vv=n(function(e,t,r){return gv(l(pv,e,t,r))}),yv=f(ea,"",Fa),mv=Ie,bv=function(e){if("Ok"===e.$){var t=e.a;return wh(t)}var r=e.a;return mv(r)},Cv=function(e){return l(Zn,pr,bv,{allowCookiesFromOtherDomains:!1,body:e.body,expect:e.resolver,headers:e.headers,method:e.method,timeout:e.timeout,tracker:li,url:e.url})},Ev=function(e){var t=e.url,r=e.method,n=e.params,a=e.decoder;return Cv({body:l(vv,1,r,n),headers:vr,method:"POST",resolver:yv(hv(a)),timeout:li,url:t})},Sv=n(function(e,t,r){return Ev({decoder:t.decoder,method:"eth_call",params:M([dv(t),lv(r)]),url:e})}),Tv={$:"LatestBlock"},wv=r(function(e,t){return l(Sv,e,t,Tv)}),Iv=function(e){return{$:"Perform",a:e}},Av=wh(pr),Bv=r(function(e,t){return f(Bh,function(t){return wh(e(t))},t)}),kv=r(function(e,t){var r=t.a;return Ne(f(Bh,nh(e),r))}),Nv=n(function(e,t,r){return f(Bv,function(e){return pr},Ph(f(Ua,kv(e),t)))}),$v=n(function(e,t,r){return wh(pr)}),Rv=r(function(e,t){var r=t.a;return Iv(f(Bv,e,r))});gn.Task=Ue(Av,Nv,$v,Rv);var xv=Me("Task"),_v=fn,Lv=r(function(e,t){return xv(Iv(f(_v,f(Ma,f(Ma,wh,e),di),f(Bh,f(Ma,f(Ma,wh,e),hi),t))))}),Pv=a(function(e,t,r,n){return f(Lv,n,f(wv,fv(ro(e)),l(cv,rg(e),t,r)))}),Dv=function(e){if("Token"===e.$){if("EthDai"===e.a.$){e.a;return eg("0x61F399ED1D5AEC3Bc9d4B026352d5764181d6b35")}e.a;return eg("0xF59ed429f9753B0498436DE1a3559AEC7a0c2a21")}switch(e.a.$){case"Eth":e.a;return eg("0x61F399ED1D5AEC3Bc9d4B026352d5764181d6b35");case"Kovan":e.a;return eg("0xF59ed429f9753B0498436DE1a3559AEC7a0c2a21");default:e.a;return eg("0x092110996699c3E06e998d89F0f4586026e44F0F")}},Uv=function(e){return{$:"BoolE",a:e}},Ov=Uv,Mv=function(e){return{$:"StringE",a:e}},Fv=Mv,Vv=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:fi(f(el,"createOpenTrade(address[2],bool,uint256[8],string,string)",M([ag(t),ag(r),Ov(n),og(a),og(i),og(o),og(u),og(s),og(c),og(l),og(d),Fv(h),Fv(p)]))),decoder:wu(Kg),from:li,gas:li,gasPrice:li,nonce:li,to:fi(e),value:li}}}}}}}}}}}}}}},Kv=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:fi(f(el,"createOpenTrade(address[2],bool,uint256[8],string,string)",M([ag(t),ag(r),Ov(n),og(a),og(i),og(o),og(u),og(s),og(c),og(l),og(d),Fv(h),Fv(p)]))),decoder:wu(Kg),from:li,gas:li,gasPrice:li,nonce:li,to:fi(e),value:li}}}}}}}}}}}}}}},Hv=r(function(e,t){return{paymentMethods:t,price:e}}),jv=be,qv=function(e){return f(av,Fa,M([cp(e.symbol),jv(e.amount)]))},Gv=function(e){switch(e.$){case"Cash":return"cash";case"Bank":return"bank";default:return"custom"}},zv=function(e){return vp(M([_("type",cp(Gv(e.type_))),_("info",cp(e.info))]))},Wv=function(e){var t=qv(e.price),r=f(av,zv,e.paymentMethods);return f(Di,0,vp(M([_("paymentmethods",r),_("price",t)])))},Yv=r(function(e,t){return D(t,{value:fi(e)})}),Jv=function(e){return Zu(il(e))},Qv=function(e){return f(fg,Jv(e),Zu(1e3))},Xv=r(function(e,t){var r=function(){return"Token"===e.$?Vv:Kv}();return function(){return"Native"===e.$?Yv(cg(mg(t))):Fa}()(r(tg(e))(t.initiatorAddress)(Dv(e))($(t.initiatorRole,yo))(cg(t.tradeAmount))(cg(hg(t.tradeAmount)))(cg(dg(t.tradeAmount)))(cg(t.pokeReward))(Qv(t.autorecallInterval))(Qv(t.autoabortInterval))(Qv(t.autoreleaseInterval))(cg(vg(t.tradeAmount)))(Wv(f(Hv,t.price,t.paymentMethods)))(t.initiatorCommPubkey))}),Zv=r(function(e,t){return{$:"CreateMined",a:e,b:t}}),ey=function(e){return{$:"CreateNeedsSig",a:e}},ty=r(function(e,t){return{$:"CreateSigned",a:e,b:t}}),ry=r(function(e,t){var r=rp(f(Xv,e,t)),n={onBroadcast:li,onMined:fi(_(Zv(e),li)),onSign:fi(ty(e))};return _(fi(ey(e)),f(Zo,n,r))}),ny=function(e){if(""===e)return hi(li);var t=Jl(e);if("Just"===t.$){var r=t.a;return r>0?hi(fi(r)):di("Number must be greater than 0")}return di("Invalid amount")},ay=function(e){if(""===e)return hi(li);var t=cd(e);if("Just"===t.$){var r=t.a;return r>0?hi(fi(r)):di("Number must be greater than 0")}return di("Must be an integer")},iy={$:"Loss"},oy=r(function(e,t){return""===e?hi(li):f(du,fi,f(du,$(t,iy)?hu:Fa,f(du,function(e){return e/100},f(ev,"Invalid margin",Jl(e)))))}),uy=Z,sy=function(e){return uy(Xu(100*e))},cy=r(function(e,t){return f(xo,mu,ov(f(pp,f(tu,ei,Za(e)),t)))}),fy=function(e){return f(cy,e.foreignCurrencyType,e.prices)},ly=function(e){switch(e.$){case"CryptoSwap":return e.a;case"OffRamp":return yo;default:return vo}},dy=function(e){return"Buyer"===ly(e.mode).$?e.dhTokenAmount:e.foreignCurrencyAmount},hy=r(function(e,t){return"Seller"===ly(t.mode).$?D(t,{dhTokenAmount:e}):D(t,{foreignCurrencyAmount:e})}),py={align:Xh,label:"oldPriceDataWarning",mainParagraphs:M([M([ep("Uh oh, it looks like our price data might be out of date. You might want to double check the math...")])]),noticeType:Zh},gy=function(e){var t=fy(e);if("Just"===t.$){if("Ok"===t.a.$){var r=t.a.a,n=e.inputs,a=e.errors,i=f(xo,function(t){return"Buyer"===ly(e.mode).$?t/(1+e.margin)/r:t/(1+e.margin)*r*1.01},dy(e));return _(function(){if("Just"===i.$){var t=i.a;return f(hy,fi(t),D(e,{errors:D(a,{amountIn:li}),inputs:D(n,{amountIn:uy(t)})}))}return e}(),vr)}t.a;return _(e,M([ya(py)]))}return _(e,vr)},vy=function(e){return"Buyer"===ly(e.mode).$?e.foreignCurrencyAmount:e.dhTokenAmount},yy=r(function(e,t){return"Seller"===ly(t.mode).$?D(t,{foreignCurrencyAmount:e}):D(t,{dhTokenAmount:e})}),my=function(e){var t=fy(e);if("Just"===t.$){if("Ok"===t.a.$){var r=t.a.a,n=e.inputs,a=e.errors,i=f(xo,function(t){return"Buyer"===ly(e.mode).$?t*r*(1+e.margin):t/1.01/r*(1+e.margin)},vy(e));return _(function(){if("Just"===i.$){var t=i.a;return f(yy,fi(t),D(e,{errors:D(a,{amountOut:li}),inputs:D(n,{amountOut:uy(t)})}))}return e}(),vr)}t.a;return _(e,M([ya(py)]))}return _(e,vr)},by=function(e){var t=function(){var t=_(ly(e.mode),_(e.inputs.inType,e.inputs.outType));e:for(;;){if("Buyer"===t.a.$){if("External"===t.b.a.$&&"DHToken"===t.b.b.$){var r=(t.a,t.b),n=r.a.a,a=r.b.a;return _(n,a)}break e}if("DHToken"===t.b.a.$&&"External"===t.b.b.$){var i=(t.a,t.b),a=i.a.a,n=i.b.a;return _(n,a)}break e}f(op,"unexpected currency types in input when trying to update model currency types","");return _(e.foreignCurrencyType,e.dhTokenType)}(),r=t.a,n=t.b;return D(e,{dhTokenType:n,foreignCurrencyType:r})},Cy=r(function(e,t){return{$:"AllowanceFetched",a:e,b:t}}),Ey={$:"AmountIn"},Sy={$:"AmountOut"},Ty=n(function(e,t,r){return{$:"ApproveMining",a:e,b:t,c:r}}),wy=function(e){return{$:"ApproveNeedsSig",a:e}},Iy=n(function(e,t,r){return{$:"ApproveSigned",a:e,b:t,c:r}}),Ay=r(function(e,t){return{$:"Confirm",a:e,b:t}}),By=r(function(e,t){return{$:"CreateMining",a:e,b:t}}),ky=function(e){return{$:"PricesFetched",a:e}},Ny=a(function(e,t,r,n){return{chainCmd:r,cmd:t,cmdUps:n,model:e}}),$y=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"}},Ry=function(e){if("DHToken"===e.$){var t=e.a;return $y(t)}return e.a},xy=r(function(e,t){switch(e.$){case"Expiry":return io(t.intervals);case"Payment":return oo(t.intervals);default:return uo(t.intervals)}}),_y=function(e){switch(e.$){case"Minute":return"Minute";case"Hour":return"Hour";case"Day":return"Day";default:return"Week"}},Ly=function(e){return{chainCmd:zo,cmd:Vo,cmdUps:vr,model:e}},Py=function(e){switch(e.$){case"Loss":return"Loss";case"Even":return"Even";default:return"Profit"}},Dy=function(e){switch(e.$){case"CryptoSwap":if("Seller"===e.a.$){e.a;return"CryptoSwap Seller"}e.a;return"CryptoSwap Buyer";case"OffRamp":return"OffRamp";default:return"OnRamp"}},Uy=r(function(e,t){if("Seller"===ly(t.mode).$)return"DHToken"===e.$?D(t,{dhTokenType:e.a}):(f(op,"Trying to update inType with the wrong currency type",_(ly(t.mode),e)),t);if("External"===e.$){return D(t,{foreignCurrencyType:e.a})}f(op,"Trying to update inType with the wrong currency type",_(ly(t.mode),e));return t}),Oy=r(function(e,t){if("Seller"===ly(t.mode).$)return"External"===e.$?D(t,{foreignCurrencyType:e.a}):(f(op,"Trying to update outType with the wrong currency type",_(ly(t.mode),e)),t);if("DHToken"===e.$){return D(t,{dhTokenType:e.a})}f(op,"Trying to update outType with the wrong currency type",_(ly(t.mode),e));return t}),My=a(function(e,t,r,n){var a=n.a,i=n.b,o=n.c;return L(e(a),t(i),r(o))}),Fy=function(e){return l(My,e,Fa,Fa)},Vy=function(e){return l(My,Fa,e,Fa)},Ky=function(e){return l(My,Fa,Fa,e)},Hy=n(function(e,t,r){return D(r,{intervals:f(function(){switch(e.$){case"Expiry":return Fy;case"Payment":return Vy;default:return Ky}}(),As(t),r.intervals)})}),jy=f(Ma,f(Os,7,P("0")),Ri),qy=function(e){return f(xi,"",e)},Gy=function(e){var t=e.a,r=La(t);if(r.b){var n=r.a,a=r.b;return qy(f(Ra,Ri(n),f(Ua,jy,a)))}return"0"},zy=function(e){switch(e.$){case"Zer":return"0";case"Pos":var t=e.a;return Gy(t);default:var t=e.a;return"-"+Gy(t)}},Wy=function(e){return cd(zy(e))},Yy=function(e){return sg(e)},Jy=qr,Qy=function(e){var t=ov(f(Jy,".",e));if("Nothing"===t.$)return _(e,0);var r=t.a,n=iu(e)-1-r;return _(U(f(fu,r,e),f(uu,r+1,e)),n)},Xy=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 vr}}),Zy=function(e){var t=e.a,r=f(Xy,Za(0),t);return Iu(r.b?t:vr)},em=function(e){return f(xo,f(Ma,Zy,Iu),Qg(f(Ua,f(tu,La,f(tu,Ms,cd)),f(Jg,7,La(e)))))},tm=function(e){var t=uc(Zp(e));if(!t.b)return li;switch(t.a.valueOf()){case"-":if(t.b.b){var r=t.b;return f(xo,Lu(qu),em(r))}return li;case"+":if(t.b.b){var r=t.b;return f(xo,Lu(Gu),em(r))}return li;default:var r=t;return f(xo,Lu(Gu),em(r))}},rm=function(e){var t=function(e){return!f(Fs,2,e)};switch(e.$){case"Zer":return!0;case"Pos":default:var r=e.a.a;return t(f(Kc,0,ov(r)))}},nm=function(e){return f(ms,e,e)},am=Zu(2),im=n(function(e,t,r){e:for(;;)switch(r.$){case"Zer":return Is;case"Neg":return xu;default:if($(r,Is))return f(ms,e,t);if(rm(r)){var n=e,a=nm(t),i=f(fg,r,am);e=n,t=a,r=i;continue e}var n=f(ms,t,e),a=nm(t),i=f(fg,f(Cs,r,Is),am);e=n,t=a,r=i;continue e}}),om=r(function(e,t){return l(im,Is,e,t)}),um=r(function(e,t){return e<1?t:l(ou,0,-e,t)}),sm=function(e){if(""===e)return li;var t=Qy(e),r=t.a,n=t.b,a=18-n,i=tm(a<0?f(um,-a,r):r);if("Nothing"===i.$)return li;var o=i.a,u=f(ms,o,f(om,Zu(10),Zu(a)));return fi(u)},cm=function(e){var t=sm(uy(e));if("Just"===t.$){var r=t.a;return Yy(r)}f(op,"Error converting float to tokenValue","");return Yy(Zu(0))},fm=jr,lm=function(e){for(;;){if(f(fm,".",e))return l(ou,0,-1,e);{if(!f(fm,"0",e))return""===e?"0":e;e=l(ou,0,-1,e)}}},dm=function(e){if($(f(cs,e,Zu(0)),Sa))return"-"+dm(bs(e));var t=l(Os,18,P("0"),zy(e)),r=f(um,18,t)+"."+f(pu,18,t);return function(e){return""===e?"0":e}(lm(r))},hm=r(function(e,t){var r=dm(t),n=ov(f(Jy,".",r));if("Nothing"===n.$)return r;var a=n.a;return e?f(fu,a+1+e,r):f(fu,a,r)}),pm=r(function(e,t){if("Nothing"===e.$)return dm(cg(t));var r=e.a;return f(hm,r,cg(t))}),gm=function(e){var t=Jl(f(pm,li,e));if("Just"===t.$){return t.a}f(op,"Error converting tokenValue to float: string -> float failed",e);return 0},vm={$:"Error"},ym=r(function(e,t){f(op,e+" fetch error",t);return{align:Xh,label:"web3FetchError",mainParagraphs:M([M([ep('Failed to fetch "'+e+'". See console output for more info.')])]),noticeType:vm}}),mm=r(function(e,t){return{align:Xh,label:"web3MiningError",mainParagraphs:M([M([ep('Error mining "'+e+'" transaction: '+t)])]),noticeType:vm}}),bm=r(function(e,t){return{align:Xh,label:"web3SigError",mainParagraphs:M([M([ep('Error signing "'+e+'" transaction: '+t)])]),noticeType:Zh}}),Cm=Pr,Em=Cm(function(e){return f(fo,Za(e),M([P("1"),P("2"),P("3"),P("4"),P("5"),P("6"),P("7"),P("8"),P("9"),P("0"),P(".")]))}),Sm=function(e){if("Active"===e.$){var t=e.a;return fi(t)}return li},Tm=r(function(e,t){switch(e.$){case"UpdateNow":var r=e.a;return Ly(D(t,{now:r}));case"Refresh":var n=function(){var e=_(Sm(t.wallet),jp(t.wallet));if("Just"===e.a.$&&"Just"===e.b.$&&"Token"===e.b.a.$){var r=e.a.a,n=e.b.a.a;return d(Pv,n,r.address,tg(ro(n)),Cy(n))}return Vo}(),a=jh(ky);return d(Ny,t,Fo(M([n,a])),zo,vr);case"PricesFetched":var i=e.a;if("Ok"===i.$){var o=i.a,u=f(Ua,Jh(fl(t.now)),o),s=function(){return"AmountIn"===t.lastAmountInputChanged.$?my:gy}()(D(t,{prices:u})),c=s.a,h=s.b;return d(Ny,c,Vo,zo,h)}i.a;return d(Ny,t,Vo,zo,M([ya(tp)]));case"ChangeMode":var p=e.a,c=D(t,{mode:p});return d(Ny,$(t.mode,p)?c:by(D(c,{inputs:f(Wp,t.wallet,p),intervals:Pp(p)})),Vo,zo,M([d(Yp,"change mode","navigation",Dy(p),0)]));case"SwapClicked":var g=t.inputs,v=D(g,{amountIn:g.amountOut,amountOut:g.amountIn,inType:g.outType,outType:g.inType}),y=t.mode;if("CryptoSwap"===y.$){var m=y.a,b=function(){return"AmountIn"===t.lastAmountInputChanged.$?my:gy}()(D(t,{inputs:v,lastAmountInputChanged:function(){return"AmountIn"===t.lastAmountInputChanged.$?Sy:Ey}(),mode:function(){return Dp("Buyer"===m.$?yo:vo)}()})),c=b.a,h=b.b;return d(Ny,c,Vo,zo,U(h,M([d(Yp,"swap clicked","navigation",Jp(ly(c.mode)),0)])))}f(op,"swap button clicked, but it should be hidden right now!","");return Ly(t);case"AmountInChanged":var C=e.a,g=t.inputs,E=Em(C),S=function(){var e=t.errors,r=ny(E);if("Ok"===r.$){return _(r.a,D(e,{amountIn:li}))}var n=r.a;return _(li,D(e,{amountIn:fi(n)}))}(),T=S.a,w=S.b,I=my(f(hy,T,D(t,{errors:w,inputs:D(g,{amountIn:E}),lastAmountInputChanged:Ey}))),c=I.a,h=I.b;return d(Ny,c,Vo,zo,h);case"InTypeClicked":return d(Ny,D(t,{showInTypeDropdown:!t.showInTypeDropdown}),Vo,zo,M([d(Yp,"in currency dropdown clicked","input","",0)]));case"InTypeSelected":var A=e.a,B=t.inputs;return function(e){return D(e,{cmdUps:f(co,e.cmdUps,M([d(Yp,"in currency selected","input",Ry(A),0)]))})}(function(e){var t=e.a,r=e.b;return d(Ny,t,Vo,zo,r)}(my(f(Uy,A,D(t,{inputs:D(B,{currencySearch:"",inType:A}),showInTypeDropdown:!1})))));case"AmountOutChanged":var C=e.a,g=t.inputs,E=Em(C),k=function(){var e=t.errors,r=ny(E);if("Ok"===r.$){return _(r.a,D(e,{amountOut:li}))}var n=r.a;return _(li,D(e,{amountOut:fi(n)}))}(),N=k.a,w=k.b,R=gy(f(yy,N,D(t,{errors:w,inputs:D(g,{amountOut:E}),lastAmountInputChanged:Sy}))),c=R.a,h=R.b;return d(Ny,c,Vo,zo,h);case"OutTypeClicked":return d(Ny,D(t,{showOutTypeDropdown:!t.showOutTypeDropdown}),Vo,zo,M([d(Yp,"out currency dropdown clicked","input","",0)]));case"OutTypeSelected":var A=e.a,B=t.inputs;return function(e){return D(e,{cmdUps:f(co,e.cmdUps,M([d(Yp,"out currency selected","input",Ry(A),0)]))})}(function(e){var t=e.a,r=e.b;return d(Ny,t,Vo,zo,r)}(my(f(Oy,A,D(t,{inputs:D(B,{currencySearch:"",outType:A}),showOutTypeDropdown:!1})))));case"SearchInputChanged":var C=e.a,B=t.inputs;return Ly(D(t,{inputs:D(B,{currencySearch:C})}));case"MarginBoxClicked":return d(Ny,D(t,{showMarginModal:!t.showMarginModal}),Vo,zo,M([d(Yp,"margin box clicked","input","",0)]));case"MarginInputChanged":var C=e.a,g=t.inputs,E=Em(C),x=function(){var e=t.errors,r=f(oy,E,g.marginType);if("Ok"===r.$){var n=r.a;return L(n,$(n,fi(0))?Gp:g.marginType,D(e,{margin:li}))}var a=r.a;return L(li,g.marginType,D(e,{margin:fi(a)}))}(),P=x.a,O=x.b,w=x.c,F=function(){return"AmountIn"===t.lastAmountInputChanged.$?my:gy}()(D(t,{errors:w,inputs:D(g,{margin:E,marginType:O}),margin:f(Kc,t.margin,P)})),c=F.a,h=F.b;return d(Ny,c,Vo,zo,h);case"MarginButtonClicked":var V=e.a,g=t.inputs,P=function(){switch(V.$){case"Loss":return t.margin?-Xu(t.margin):-.01;case"Even":return 0;default:return t.margin?Xu(t.margin):.01}}(),K=function(){return"AmountIn"===t.lastAmountInputChanged.$?my:gy}()(D(t,{inputs:D(g,{margin:sy(P),marginType:V}),margin:P})),c=K.a,h=K.b;return d(Ny,c,Vo,zo,U(h,M([d(Yp,"margin button clicked","input",Py(V),0)])));case"ReceiveAddressChanged":var C=e.a,B=t.inputs;return Ly(D(t,{inputs:D(B,{receiveAddress:C})}));case"PaymentMethodChanged":var C=e.a,B=t.inputs;return Ly(D(t,{inputs:D(B,{paymentMethod:C})}));case"WindowBoxClicked":var H=e.a,g=t.inputs;return d(Ny,D(t,{inputs:D(g,{interval:Ri(f(xy,H,t).num)}),showIntervalModal:fi(H)}),Vo,zo,M([d(Yp,"window box clicked","input",Qp(H),0)]));case"IntervalInputChanged":var C=e.a,j=t.showIntervalModal;if("Just"===j.$){var H=j.a,g=t.inputs,E=Em(C),q=function(){var e=t.errors,r=ay(E);if("Ok"===r.$){var n=r.a;return _(f(Kc,f(xy,H,t),f(xo,function(e){return f(Lp,e,f(xy,H,t).unit)},n)),D(e,{interval:li}))}var a=r.a;return _(f(xy,H,t),D(e,{interval:fi(a)}))}(),G=q.a,w=q.b,c=l(Hy,H,G,D(t,{errors:w,inputs:D(g,{interval:E})}));return d(Ny,c,Vo,zo,vr)}f(op,"Interal input changed, but there is no interval modal open! Wut","");return Ly(t);case"IntervalUnitChanged":var z=e.a,W=t.showIntervalModal;if("Just"===W.$){var H=W.a;return d(Ny,l(Hy,H,f(Lp,f(xy,H,t).num,z),t),Vo,zo,M([d(Yp,"interval unit changed","input",_y(z),0)]))}f(op,"Interal unit changed, but there is no interval modal open! Wut","");return Ly(t);case"CloseModals":var B=t.inputs;return Ly(D(t,{inputs:D(B,{currencySearch:""}),showInTypeDropdown:!1,showIntervalModal:li,showMarginModal:!1,showOutTypeDropdown:!1}));case"PlaceOrderClicked":var Y=e.a,J=e.b,Q=e.c,X=f(gg,J,Q);return d(Ny,D(t,{depositAmount:function(){return"Buyer"===ly(t.mode).$?fi(mg(X)):f(xo,cm,vy(t))}(),txChainStatus:fi(f(Ay,Y,X))}),Vo,zo,M([d(Yp,"place order clicked","txchain",t.inputs.paymentMethod,ri(gm(X.tradeAmount)))]));case"AbortCreate":return d(Ny,D(t,{txChainStatus:li}),Vo,zo,M([d(Yp,"abort","txchain","",0)]));case"ConfirmCreate":var Y=e.a,X=e.b,Z=e.c,ee=function(){if("Native"===Y.$)return f(ry,Y,X);var e=Y.a,r=function(){var t=rp(l(ug,rg(e),tg(Y),cg(Z))),r={onBroadcast:li,onMined:li,onSign:fi(f(Iy,e,X))};return f(Zo,r,t)}(),n=t.userAllowance;if("Just"===n.$){var a=n.a;return $(f(cs,a,cg(Z)),Sa)?_(fi(wy(e)),r):f(ry,Y,X)}return _(fi(wy(e)),r)}(),te=ee.a,re=ee.b;return d(Ny,D(t,{txChainStatus:te}),Vo,re,M([d(Yp,"confirm","txchain","",0)]));case"ApproveSigned":var ne=e.a,X=e.b,ae=e.c;if("Ok"===ae.$){var ie=ae.a;return d(Ny,D(t,{txChainStatus:fi(l(Ty,ne,X,ie))}),Vo,zo,M([d(Yp,"approve signed","txchain","",0)]))}var oe=ae.a;return d(Ny,D(t,{txChainStatus:li}),Vo,zo,M([ya(f(bm,"appove",oe))]));case"AllowanceFetched":var ne=e.a,i=e.b;if("Ok"===i.$){var ue=i.a,c=D(t,{userAllowance:fi(ue)}),se=_(c.txChainStatus,c.depositAmount);if("Just"===se.a.$&&"ApproveMining"===se.a.a.$&&"Just"===se.b.$){var ce=se.a.a,X=ce.b,fe=se.b.a;if($(f(cs,ue,cg(fe)),Sa))return Ly(c);var le=f(ry,ro(ne),X),te=le.a,re=le.b;return d(Ny,D(c,{txChainStatus:te}),Vo,re,vr)}return Ly(c)}var de=i.a;return d(Ny,t,Vo,zo,M([ya(f(ym,"allowance",de))]));case"CreateSigned":var Y=e.a,ae=e.b;if("Ok"===ae.$){var ie=ae.a;return d(Ny,D(t,{txChainStatus:fi(f(By,Y,ie))}),Vo,zo,M([d(Yp,"create signed","txchain","",0)]))}var oe=ae.a;return d(Ny,D(t,{txChainStatus:li}),Vo,zo,M([ya(f(bm,"create",oe))]));case"CreateMined":if("Err"===e.b.$){var Y=e.a,oe=e.b.a;return d(Ny,t,Vo,zo,M([ya(f(mm,"create",oe))]))}var he=e.a,pe=e.b.a,ge=f($o,Wy,zg(f(sv,he,pe)));if("Just"===ge.$){var ve=ge.a;return d(Ny,t,Vo,zo,M([d(Yp,"create mined","txchain","",0),ga(f(qh,he,ve))]))}return d(Ny,t,Vo,zo,M([ya(f(up,'Error getting the ID of the created offer. Check the "My Trades" page for your open offer.',pe))]));case"NoOp":return Ly(t);default:var ye=e.a;return d(Ny,t,Vo,zo,M([ye]))}}),wm={$:"Refresh"},Im=a(function(e,t,r,n){return{amountIn:e,amountOut:t,interval:n,margin:r}}),Am=d(Im,li,li,li,li),Bm=r(function(e,t){return f(Tm,wm,{depositAmount:li,dhTokenAmount:li,dhTokenType:f(Kc,to(no),jp(e)),errors:Am,foreignCurrencyAmount:li,foreignCurrencyType:Rp(t),inputs:f(Wp,e,t),intervals:Pp(t),lastAmountInputChanged:Ey,margin:0,mode:t,now:Ho(0),prices:vr,showInTypeDropdown:!1,showIntervalModal:li,showMarginModal:!1,showOutTypeDropdown:!1,txChainStatus:li,userAllowance:li,wallet:e})}),km={$:"CloseModals"},Nm=r(function(e,t){if("UpdateWallet"===e.$){var r=e.a;return d(Ny,D(t,{wallet:r}),function(){var e=_(Sm(r),jp(r));if("Just"===e.a.$&&"Just"===e.b.$&&"Token"===e.b.a.$){var t=e.a.a,n=e.b.a.a;return d(Pv,n,t.address,tg(ro(n)),Cy(n))}return Vo}(),zo,vr)}return f(Tm,km,t)}),$m=r(function(e,t){return f(Bg,function(e){return f(fo,function(e){return e.checked&&e.testTrade(t)},e.options)},e)}),Rm=r(function(e,t){return $(f(ol,t.derived.phaseEndTime,e),Aa)}),xm=function(e){return f(xo,sg,sm(e))},_m=function(e){if(""===e)return hi(li);var t=xm(e);if("Nothing"===t.$)return di("I can't interpret this number");var r=t.a;return hi(fi(r))},Lm=r(function(e,t){return{maxDai:t,minDai:e}}),Pm=f(Lm,li,li),Dm=function(e){return jl(e)?li:fi(e)},Um=function(e){return l(Rg,r(function(t,r){return{dai:{max:r,min:t},fiatSymbol:Dm(e.fiatType),paymentMethodTerms:e.paymentMethodTerms}}),f(hh,function(e){return D(Pm,{minDai:fi(e)})},_m(e.minDai)),f(hh,function(e){return D(Pm,{maxDai:fi(e)})},_m(e.maxDai)))},Om=Kr,Mm=r(function(e,t){var r=function(t){return f(Bg,function(e){return f(Om,Zp(e),Zp(t))},e)};return f(fo,function(e){return r(e.info)},t)}),Fm=r(function(e,t){return D(t,{paymentMethod:e})}),Vm=r(function(e,t){return D(t,{paymentMethodTerms:e})}),Km=r(function(e,t){return f(cs,cg(e),cg(t))}),Hm=function(e){if(""===e.inputs.paymentMethod)return e;var t=e.inputs.paymentMethod,r=f(co,e.inputs.paymentMethodTerms,M([t]));return jm(D(e,{inputs:f(Vm,r,f(Fm,"",e.inputs))}))},jm=function(e){var t=Hm(e),n=Um(t.inputs);if("Err"===n.$){return D(e,{errors:n.a})}var a=n.a,i=r(function(e,t){var r=a.paymentMethodTerms;if(r.b){return f(Mm,r,t.terms.paymentMethods)}return!0}),o=function(e){var t=a.fiatSymbol;if("Nothing"===t.$)return!0;var r=t.a;return $(e.terms.price.symbol,r)},u=function(e){return function(){var t=a.dai.min;if("Nothing"===t.$)return!0;var r=t.a;return!$(f(Km,e.parameters.tradeAmount,r),Sa)}()&&function(){var t=a.dai.max;if("Nothing"===t.$)return!0;var r=t.a;return!$(f(Km,e.parameters.tradeAmount,r),Aa)}()},s=r(function(e,r){return f(Rm,e,r)&&f(i,e,r)&&u(r)&&o(r)&&f($m,t.filters,r)});return D(t,{filterFunc:s})},qm={fiatType:"",maxDai:"",minDai:"",paymentMethod:"",paymentMethodTerms:vr},Gm=function(e){return{$:"PricesFetched",a:e}},zm={$:"Expires"},Wm=function(e){return _(jm({errors:Pm,filterFunc:Rm,filters:go(M([f(Eo,!0,!0),d(Bo,!0,!1,!1,!1)])),inputs:qm,now:Ho(0),prices:vr,showCurrencyDropdown:!1,tradeTable:Uo(_(zm,Oo)),wallet:e}),jh(Gm))},Ym=r(function(e,t){var r=f(pp,xc(e),t.inputs.paymentMethodTerms);return jm(D(t,{inputs:f(Vm,r,t.inputs)}))}),Jm=function(e){return jm(D(e,{filterFunc:Rm,inputs:qm}))},Qm=function(e){return{$:"TradeTableMsg",a:e}},Xm=a(function(e,t,r,n){return{chainCmd:r,cmd:t,cmdUps:n,model:e}}),Zm=function(e){return d(Xm,e,Vo,zo,vr)},eb=r(function(e,t){return D(t,{fiatType:e})}),tb=r(function(e,t){return D(t,{maxDai:e})}),rb=r(function(e,t){return D(t,{minDai:e})}),nb=Q,ab=r(function(e,t){switch(e.$){case"UpdateNow":var r=e.a;return Zm(D(t,{now:r}));case"Refresh":return d(Xm,t,jh(Gm),zo,vr);case"PricesFetched":var n=e.a;if("Ok"===n.$){var a=n.a,i=f(Ua,Jh(fl(t.now)),a);return Zm(D(t,{prices:i}))}n.a;return d(Xm,t,Vo,zo,M([ya(tp)]));case"MinDaiChanged":var o=e.a;return Zm(D(t,{inputs:f(rb,Em(o),t.inputs)}));case"MaxDaiChanged":var o=e.a;return Zm(D(t,{inputs:f(tb,Em(o),t.inputs)}));case"FiatTypeInputChanged":var o=e.a;return Zm(D(t,{inputs:f(eb,nb(o),t.inputs)}));case"FiatTypeSelected":var o=e.a;return Zm(jm(D(t,{inputs:f(eb,o,t.inputs),showCurrencyDropdown:!1})));case"ShowCurrencyDropdown":var u=e.a;t.inputs;return Zm(D(t,{inputs:(u?eb(""):Fa)(t.inputs),showCurrencyDropdown:u}));case"FiatTypeLostFocus":return Zm(D(t,{showCurrencyDropdown:!1}));case"PaymentMethodInputChanged":var o=e.a;return Zm(D(t,{inputs:f(Fm,o,t.inputs)}));case"AddSearchTerm":return Zm(Hm(t));case"RemoveTerm":var s=e.a;return Zm(f(Ym,s,t));case"ApplyInputs":return d(Xm,jm(t),Vo,zo,vr);case"ResetSearch":return Zm(Jm(t));case"FiltersMsg":var c=e.a;return Zm(jm(D(t,{filters:f(al,c,t.filters)})));case"TradeTableMsg":var l=e.a,h=f(Qh,l,t.tradeTable);return d(Xm,D(t,{tradeTable:h.model}),f(np,Qm,h.cmd),f(ru,Qm,h.chainCmd),f(Ua,Xi(Qm),h.cmdUps));case"NoOp":return Zm(t);default:var p=e.a;return d(Xm,t,Vo,zo,M([p]))}}),ib=function(e){return{$:"ShowCurrencyDropdown",a:e}},ob=r(function(e,t){if("UpdateWallet"===e.$){var r=e.a;return Zm(D(t,{wallet:r}))}return f(ab,ib(!1),t)}),ub=a(function(e,t,r,n){return e(vp(M([_("title",cp(t)),_("body",function(){if("Nothing"===r.$)return gp;var e=r.a;return cp(e)}()),_("image",function(){if("Nothing"===n.$)return gp;var e=n.a;return cp(e)}())])))}),sb=function(e){if("Token"===e.$){if("EthDai"===e.a.$){e.a;return"dai"}e.a;return"kdai"}switch(e.a.$){case"Eth":e.a;return"eth";case"Kovan":e.a;return"keth";default:e.a;return"xdai"}},cb=function(e){return e.a+"="+e.b},fb=function(e){return e.b?"?"+f(xi,"&",f(Ua,cb,e)):""},lb=r(function(e,t){return"/"+(f(xi,"/",e)+fb(t))}),db=function(e){switch(e.$){case"InitialBlank":return f(lb,M(["DAIHard"]),vr);case"CreateCrypto":return f(lb,M(["DAIHard","create","crypto"]),vr);case"CreateFiat":return f(lb,M(["DAIHard"]),vr);case"Trade":var t=e.a,r=e.b;return f(lb,M(["DAIHard","trade",sb(t),Ri(r)]),vr);case"Marketplace":return f(lb,M(["DAIHard","marketplace"]),vr);case"AgentHistory":var n=e.a;return f(lb,M(["DAIHard","history",sp(n)]),vr);default:return f(lb,vr,vr)}},hb={$:"NotFound"},pb=function(e){return{$:"AgentHistory",a:e}},gb={$:"CreateCrypto"},vb={$:"CreateFiat"},yb={$:"Marketplace"},mb=function(e){return{$:"Parser",a:e}},bb=i(function(e,t,r,n,a){return{frag:n,params:r,unvisited:t,value:a,visited:e}}),Cb=r(function(e,t){return mb(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 M([h(bb,f(Ra,u,r),s,a,i,o(l))])}return vr}return vr})}),Eb=f(Cb,"ADDRESS",f(tu,Vg,zg)),Sb={$:"Eth"},Tb={$:"Kovan"},wb=f(Cb,"FACTORY",function(e){switch(e){case"eth":return fi(to(Sb));case"keth":return fi(to(Tb));case"dai":return fi(ro(eo));case"kdai":return fi(ro(Vp));case"xdai":return fi(to(no));default:return li}}),Ib=f(Cb,"NUMBER",cd),Ab=r(function(e,t){var r=t.visited,n=t.unvisited,a=t.params,i=t.frag,o=t.value;return h(bb,r,n,a,i,e(o))}),Bb=r(function(e,t){var r=t.a;return mb(function(t){var n=t.visited,a=t.unvisited,i=t.params,o=t.frag,u=t.value;return f(Ua,Ab(u),r(h(bb,n,a,i,o,e)))})}),kb=function(e){return l(Da,co,vr,e)},Nb=r(function(e,t){return kb(f(Ua,e,t))}),$b=function(e){return mb(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)?M([h(bb,f(Ra,u,r),s,a,i,o)]):vr}return vr})},Rb=r(function(e,t){var r=e.a,n=t.a;return mb(function(e){return f(Nb,n,r(e))})}),xb=mb(function(e){return M([e])}),_b=f(Rb,$b("DAIHard"),function(e){return mb(function(t){return f(Nb,function(e){return(0,e.a)(t)},e)})}(M([f(Bb,gb,$b("cryptoswap")),f(Bb,vb,xb),f(Bb,qh,f(Rb,$b("trade"),f(Rb,wb,Ib))),f(Bb,yb,$b("marketplace")),f(Bb,pb,f(Rb,$b("history"),Eb)),f(Bb,function(e){return pb(e)},f(Rb,$b("history"),Eb))]))),Lb=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 fi(t.value)}return fi(t.value)}return li}},Pb=function(e){if(e.b){if(""!==e.a||e.b.b){var t=e.a,r=e.b;return f(Ra,t,Pb(r))}return vr}return vr},Db=function(e){var t=f(Li,"/",e);if(t.b&&""===t.a){var r=t.b;return Pb(r)}var r=t;return Pb(r)},Ub=jt,Ob=r(function(e,t){if("Nothing"===t.$)return fi(M([e]));var r=t.a;return fi(f(Ra,e,r))}),Mb=r(function(e,t){var r=f(Li,"=",e);if(r.b&&r.b.b&&!r.b.b.b){var n=r.a,a=r.b,i=a.a,o=Ub(n);if("Nothing"===o.$)return t;var u=o.a,s=Ub(i);if("Nothing"===s.$)return t;var c=s.a;return l(th,u,Ob(c),t)}return t}),Fb=function(e){if("Nothing"===e.$)return Dd;var t=e.a;return l(Da,Mb,Dd,f(Li,"&",t))},Vb=r(function(e,t){var r=e.a;return Lb(r(h(bb,vr,Db(t.path),Fb(t.query),t.fragment,Fa)))}),Kb=function(e){return f(Kc,hb,f(Vb,_b,e))},Hb=Ge("connectToWeb3",function(e){return gp}),jb=function(e){return vp(M([_("event",cp(e.event)),_("category",cp(e.category)),_("label",cp(e.label)),_("value",Cp(e.value))]))},qb=r(function(e,t){return vp(M([_("address",cp(sp(e))),_("signSeedMsg",cp(t))]))}),Gb=Ge("gTagOut",Fa),zb=Ge("genPrivkey",Fa),Wb=r(function(e,t){for(;;){if(!t.b)return li;var r=t.a,n=t.b;if(e(r))return fi(r);var a=e,i=n;e=a,t=i}}),Yb=n(function(e,t,r){return f($o,sf(t),f(xo,function(e){return e.trades},f(Wb,function(t){return $(t.factory,e)},r)))}),Jb=Ge("notifyPort",Fa),Qb=Ge("requestNotifyPermissionPort",function(e){return gp}),Xb=u(function(e,t,r,n,a,i,o){return{creationInfo:r,factory:e,id:t,parameters:n,phaseStartInfo:o,state:a,terms:i}}),Zb=function(e){return{$:"PartiallyLoadedTrade",a:e}},eC=r(function(e,t){return Zb(g(Xb,e,t,li,li,li,li,li))}),tC=function(e){return{$:"CurrentBlockFetched",a:e}},rC=Tu(f(tu,yu,Pg)),nC=function(e){return Ev({decoder:rC,method:"eth_blockNumber",params:vr,url:e})},aC=function(e){return f(Lv,tC,nC(e))},iC=r(function(e,t){return{address_:e,blocknum:t}}),oC=function(e){return nu(function(t){return hi(_(t,e))})},uC=n(function(e,t,r){var n=t.a,a=r.a;return nu(function(t){return f(uv,function(t){var r=t.a,n=t.b;return f(du,Jh(e(n)),a(r))},n(t))})}),sC=r(function(e,t){return l(uC,r(function(e,t){return e(t)}),t,e)}),cC=wu(f(sC,tv,f(sC,Kg,oC(iC)))),fC=r(function(e,t){return{data:fi(f(el,"createdTrades(uint256)",M([og(t)]))),decoder:cC,from:li,gas:li,gasPrice:li,nonce:li,to:fi(e),value:li}}),lC=n(function(e,t,r){return f(Lv,r,f(wv,fv(e),f(fC,tg(e),t)))}),dC=function(e){return{$:"CreationInfoFetched",a:e}},hC=r(function(e,t){return l(lC,e,Zu(t),dC)}),pC=function(e){return{$:"EventSentryMsg",a:e}},gC=function(e){return{$:"BlockNumber",a:e}},vC=function(e){return{$:"EventSentry",a:e}},yC=function(e){return{$:"Set_elm_builtin",a:e}},mC=yC(Dd),bC=r(function(e,t){return _(vC({blockNumber:li,errors:vr,nodePath:t,pending:mC,ref:1,requests:Dd,tagger:e,watching:mC}),f(Lv,f(tu,gC,e),nC(t)))}),CC=function(e){return f(bC,pC,fv(e))},EC=r(function(e,t){return{initiatorPubkey:e,responderPubkey:t}}),SC=function(e){return{$:"PartiallyLoadedCommInfo",a:e}},TC=SC(f(EC,li,li)),wC=n(function(e,t,r){return{allowance:li,blocknumOnInit:li,chatHistoryModel:li,eventSentry:t,eventsWaitingForChatHistory:vr,expandedPhase:Io,secureCommInfo:TC,showChatHistory:!1,showStatsModal:!1,trade:e,txChainStatus:li,wallet:r}}),IC=a(function(e,t,r,n){return{chainCmd:r,cmd:t,cmdUps:n,model:e}}),AC=n(function(e,t,r){var n=f(hC,t,r),a=CC(t),i=a.a,o=a.b;return d(IC,l(wC,f(eC,t,r),i,e),Fo(M([n,o,aC(fv(t))])),zo,M([va]))}),BC=function(e){return{$:"LoadedTrade",a:e}},kC=function(e){return{$:"EventLogFetched",a:e}},NC=r(function(e,t){return{$:"GetLogs",a:e,b:t}}),$C=se,RC=le,xC=Yr,_C=n(function(e,t,r){var n=function(e){return RC(M([e,$C(r)]))};return f(Cu,function(a){var i=f(nv,e,a);if("Ok"===i.$){var o=i.a,u=f(nv,n(t),o);if("Ok"===u.$){var s=u.a;return Ki(s)}var c=u.a;return Eu(Oi(c))}return Ki(r)},xC)}),LC=a(function(e,t,r,n){return f(bg,l(_C,f(hl,e,xC),t,r),n)}),PC=n(function(e,t,r){return f(bg,f(hl,e,t),r)}),DC=Tu(Vg),UC=Sg(f(Kc,Ig,wg("^((0[Xx]){1})?[0-9a-fA-F]{64}$"))),OC=function(e){return{$:"BlockHash",a:e}},MC=function(e){return UC(e)?hi(OC(yu(e))):di("Given blockHash "+Fg(e)+" is not valid.")},FC=Tu(MC),VC=Sg(f(Kc,Ig,wg("^((0[Xx]){1})?[0-9a-fA-F]+$"))),KC=function(e){return VC(e)?hi(lc(yu(e))):di("Something in here is not very hexy: "+Fg(e))},HC=Tu(KC),jC=function(e){return{$:"TxHash",a:e}},qC=function(e){return UC(e)?hi(jC(yu(e))):di("Given txHash "+Fg(e)+" is not valid.")},GC=Tu(qC),zC=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}}),WC=zr,YC=ue,JC=l(PC,"blockNumber",rC,l(PC,"blockHash",FC,l(PC,"transactionHash",GC,l(PC,"transactionIndex",rC,l(PC,"logIndex",rC,d(LC,"removed",WC,!1,l(PC,"topics",YC(HC),l(PC,"data",Su,l(PC,"address",DC,Ki(zC)))))))))),QC=function(e){return f(av,function(e){if("Just"===e.$){var t=e.a;return cp(Zf(t))}return gp},e)},XC=function(e){return vp(M([_("fromBlock",lv(e.fromBlock)),_("toBlock",lv(e.toBlock)),_("address",fp(e.address)),_("topics",QC(e.topics))]))},ZC=r(function(e,t){return Ev({decoder:YC(JC),method:"eth_getLogs",params:M([XC(t)]),url:e})}),eE=function(e){return{$:"BlockNum",a:e}},tE=n(function(e,t,r){var n=r.a,a=r.b;return"BlockNum"===t.toBlock.$?f(Bh,function(r){return f(Bv,mi(r),f(ZC,e,D(t,{fromBlock:eE(n),toBlock:eE(a)})))},f(ZC,e,t)):f(ZC,e,t)}),rE=r(function(e,t){var r=t.a;return yC(l(Kd,e,pr,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=D(a,{ref:a.ref+1,requests:l(Kd,a.ref,i,a.requests)}),u=a.blockNumber;if("Just"===u.$){var s=u.a;return function(e){return L(vC(D(o,{watching:f(rE,a.ref,o.watching)})),f(Lv,f(tu,NC(a.ref),a.tagger),e),a.ref)}(l(tE,a.nodePath,n,_(s,s)))}return L(vC(D(o,{pending:f(rE,a.ref,o.pending)})),Vo,a.ref)}),aE=nE(!1),iE=r(function(e,t){var r=function(){var e=CC(t.factory),r=e.a,n=e.b;return function(e){var t=e.a,r=e.b,a=e.c;return L(t,Fo(M([n,r])),a)}(l(aE,kC,r,{address:t.creationInfo.address,fromBlock:eE(t.creationInfo.blocknum),toBlock:Tv,topics:vr}))}(),n=r.a,a=r.b;return d(IC,l(wC,BC(t),n,e),Fo(M([a,aC(fv(t.factory))])),zo,M([va]))}),oE=function(e){return{$:"AllowanceFetched",a:e}},uE=function(e){return d(IC,e,Vo,zo,vr)},sE=r(function(e,t){if("UpdateWallet"===e.$){var r=e.a;return d(IC,D(t,{wallet:r}),function(){var e=L(Sm(r),jp(r),t.trade);if("Just"===e.a.$&&"Just"===e.b.$&&"Token"===e.b.a.$&&"LoadedTrade"===e.c.$){var n=e.a.a,a=e.b.a.a,i=e.c.a;return $(jp(r),fi(i.factory))?d(Pv,a,n.address,i.creationInfo.address,oE):Vo}return Vo}(),zo,vr)}return uE(D(t,{showChatHistory:!1,showStatsModal:!1}))}),cE=function(e){return{data:fi(f(el,"abort()",vr)),decoder:Ki(pr),from:li,gas:li,gasPrice:li,nonce:li,to:fi(e),value:li}},fE=function(e){return{data:fi(f(el,"burn()",vr)),decoder:Ki(pr),from:li,gas:li,gasPrice:li,nonce:li,to:fi(e),value:li}},lE=function(e){return{data:fi(f(el,"claim()",vr)),decoder:Ki(pr),from:li,gas:li,gasPrice:li,nonce:li,to:fi(e),value:li}},dE=r(function(e,t){return{data:fi(f(el,"initiatorStatement(string)",M([Fv(t)]))),decoder:Ki(pr),from:li,gas:li,gasPrice:li,nonce:li,to:fi(e),value:li}}),hE=function(e){return{data:fi(f(el,"recall()",vr)),decoder:Ki(pr),from:li,gas:li,gasPrice:li,nonce:li,to:fi(e),value:li}},pE=function(e){return{data:fi(f(el,"release()",vr)),decoder:Ki(pr),from:li,gas:li,gasPrice:li,nonce:li,to:fi(e),value:li}},gE=r(function(e,t){return{data:fi(f(el,"responderStatement(string)",M([Fv(t)]))),decoder:Ki(pr),from:li,gas:li,gasPrice:li,nonce:li,to:fi(e),value:li}}),vE={$:"Invalid"},yE=r(function(e,t){return{amount:t,symbol:e}}),mE=f(Cu,function(e){var t=tm(e);if("Just"===t.$){var r=t.a;return Ki(r)}return Eu("Can't convert that to a BigInt")},Su),bE=RC(M([l(Vi,yE,f(qg,0,Su),f(Cu,function(e){var t=Jl(e);if("Just"===t.$){var r=t.a;return Ki(r)}return Eu("Error converting BigInt to float")},f(Fi,zy,f(qg,1,mE)))),l(Vi,yE,f(qg,0,Su),f(qg,1,pl))])),CE=r(function(e,t){return{info:t,type_:e}}),EE={$:"Bank"},SE={$:"Cash"},TE={$:"Custom"},wE=function(e){switch(e){case"cash":return fi(SE);case"bank":return fi(EE);case"custom":return fi(TE);default:return li}},IE=f(Cu,function(e){var t=wE(e);if("Just"===t.$){var r=t.a;return Ki(r)}return Eu("")},Su),AE=l(Vi,CE,f(hl,"type",IE),f(hl,"info",Su)),BE=function(e){var t=l(Vi,Hv,f(hl,"price",bE),f(hl,"paymentmethods",YC(AE)));return f(Eh,t,e)},kE=r(function(e,t){return{commPubkey:t,responder:e}}),NE=r(function(e,t){var n=r(function(t,r){return l(ou,t,t+2*r,e)}),a=f(tu,Pg,du(ai(2)));return f(uv,function(t){return f(du,function(e){return f(n,t+64,e)},Pg(l(ou,t,t+64,e)))},a(t))}),$E=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?L(0,0,f(e,o(t),i)):L(o(t),a-1,i):128&t?192==(224&t)?L(31&t,1,i):224==(240&t)?L(15&t,2,i):L(7&t,3,i):L(0,0,f(e,t,i))}),RE=n(function(e,t,r){var n=l(_a,$E(e),L(0,0,t),r);if(n.b)return di("invalid UTF-8 sequence");var a=n.c;return hi(a)}),xE=q,_E=function(e){return Ls(xE(e))},LE=function(e){return l(RE,r(function(e,t){return U(t,_E(e))}),"",e)},PE=nu(function(e){var t=e.a,r=e.b;return f(du,f(cu,t,r),f(uv,LE,f(uv,f(tu,Ua(Pg),xg),f(du,pp(f(tu,jl,ls)),f(du,cc(2),f(NE,t,lu(r)))))))}),DE=f(bg,f(jg,1,PE),f(bg,f(jg,0,Kg),Ki(kE))),UE=r(function(e,t){return{commPubkey:t,terms:e}}),OE=f(bg,f(jg,1,PE),f(bg,f(jg,0,PE),Ki(UE))),ME=function(e){return{statement:e}},FE=f(bg,f(jg,0,PE),Ki(ME)),VE=function(e){return{statement:e}},KE=f(bg,f(jg,0,PE),Ki(VE)),HE={$:"AbortedEvent"},jE={$:"BurnedEvent"},qE={$:"ClaimedEvent"},GE=function(e){return{$:"CommittedEvent",a:e}},zE=function(e){return{$:"InitiatedEvent",a:e}},WE=function(e){return{$:"InitiatorStatementLogEvent",a:e}},YE={$:"PokeEvent"},JE={$:"RecalledEvent"},QE={$:"ReleasedEvent"},XE=function(e){return{$:"ResponderStatementLogEvent",a:e}},ZE=f(hl,"topics",f(qg,0,HC)),eS=function(e){return lc(f(xi,"",f(Ua,f(tu,Hs,gc),Jf(f(Ua,bi,uc(e))))))},tS=f(Cu,function(e){return $(e,eS("Initiated(string,string)"))?f(Fi,zE,OE):$(e,eS("Committed(address,string)"))?f(Fi,GE,DE):$(e,eS("Recalled()"))?Ki(JE):$(e,eS("Claimed()"))?Ki(qE):$(e,eS("Aborted()"))?Ki(HE):$(e,eS("Released()"))?Ki(QE):$(e,eS("Burned()"))?Ki(jE):$(e,eS("InitiatorStatementLog(string)"))?f(Fi,WE,FE):$(e,eS("ResponderStatementLog(string)"))?f(Fi,XE,KE):$(e,eS("Poke()"))?Ki(YE):Eu("Unrecognized topic hash")},ZE),rS=function(e){return"Buyer"===e.initiatorRole.$?e.tradeAmount:e.buyerDeposit},nS=function(e){switch(e.$){case"Invalid":return li;case"PartiallyLoadedTrade":var t=e.a;return fi(t.factory);default:var r=e.a;return fi(r.factory)}},aS=function(e){return $(e.buyerDeposit,hg(e.tradeAmount))&&$(e.abortPunishment,dg(e.tradeAmount))},iS=s(function(e,t,r,n,a,i,o,u){return{creationInfo:r,derived:u,factory:e,id:t,parameters:n,phaseStartInfo:o,state:a,terms:i}}),oS=r(function(e,t){return Ho(il(t)+il(e))}),uS=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 Ho(0)}}();return{phaseEndTime:function(){return"Closed"===t.phase.$?Ho(f(Uu,2,53)-1):f(oS,t.phaseStartTime,n)}()}}),sS=function(e){var t=L(_(e.creationInfo,e.parameters),_(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 BC(v(iS,e.factory,e.id,n,a,o,u,s,l(uS,a,o,u)))}return Zb(e)},cS=r(function(e,t){switch(t.$){case"PartiallyLoadedTrade":var r=t.a;return sS(D(r,{creationInfo:fi(e)}));case"LoadedTrade":f(op,"Trying to update creation info on a trade that's already fully loaded!","");return t;default:return vE}}),fS=r(function(e,t){switch(t.$){case"PartiallyLoadedTrade":var r=t.a;return sS(D(r,{parameters:fi(e)}));case"LoadedTrade":t.a,f(op,"Trying to update parameters on a trade that's already fully loaded!","");return t;default:return vE}}),lS=r(function(e,t){switch(t.$){case"PartiallyLoadedTrade":var r=t.a;return sS(D(r,{phaseStartInfo:fi(e)}));case"LoadedTrade":t.a,f(op,"Trying to update phaseStartInfo on a trade that's already fully loaded!","");return t;default:return vE}}),dS=r(function(e,t){switch(t.$){case"PartiallyLoadedTrade":var r=t.a;return sS(D(r,{state:fi(e)}));case"LoadedTrade":var n=t.a;return BC(D(n,{state:e}));default:return vE}}),hS=r(function(e,t){switch(t.$){case"PartiallyLoadedTrade":var r=t.a;return sS(D(r,{terms:fi(e)}));case"LoadedTrade":t.a,f(op,"Trying to update terms on a trade that's already fully loaded!","");return t;default:return vE}}),pS=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}}),gS=wu(f(sC,tv,f(sC,tv,f(sC,tv,f(sC,tv,f(sC,tv,f(sC,tv,f(sC,tv,f(sC,gu,f(sC,Kg,oC(pS))))))))))),vS=function(e){return{data:fi(f(el,"getParameters()",vr)),decoder:gS,from:li,gas:li,gasPrice:li,nonce:li,to:fi(e),value:li}},yS=function(e){return f(xo,function(e){return Ho(1e3*e)},cd(zy(e)))},mS=a(function(e,t,r,n){if("Err"===t.$){var a=t.a;return di(a)}var i=t.a;if("Err"===r.$){var a=r.a;return di(a)}var o=r.a;if("Err"===n.$){var a=n.a;return di(a)}var u=n.a;return hi(l(e,i,o,u))}),bS=function(e){var t=f(ev,"error converting BigInt to Time.Posix",yS(e.autoabortInterval)),r=f(ev,"error converting BigInt to Time.Posix",yS(e.autoreleaseInterval)),a=f(ev,"error converting BigInt to Time.Posix",yS(e.autorecallInterval));return d(mS,n(function(t,r,n){return{abortPunishment:Yy(e.abortPunishment),autoabortInterval:r,autorecallInterval:t,autoreleaseInterval:n,buyerDeposit:Yy(e.beneficiaryDeposit),initiatorAddress:e.initiator,initiatorRole:e.initiatedByCustodian?yo:vo,pokeReward:Yy(e.pokeReward),tradeAmount:Yy(e.tradeAmount)}}),a,t,r)},CS=n(function(e,t,r){return f(Lv,r,f(Bv,bS,f(wv,fv(e),vS(t))))}),ES=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}}}}}}}}}}},SS=wu(f(sC,tv,f(sC,tv,f(sC,tv,f(sC,tv,f(sC,tv,f(sC,tv,f(sC,tv,f(sC,tv,f(sC,tv,f(sC,tv,oC(ES)))))))))))),TS=function(e){return{data:fi(f(el,"getPhaseStartInfo()",vr)),decoder:SS,from:li,gas:li,gasPrice:li,nonce:li,to:fi(e),value:li}},wS=i(function(e,t,r,n,a){if("Nothing"===t.$)return li;var i=t.a;if("Nothing"===r.$)return li;var o=r.a;if("Nothing"===n.$)return li;var u=n.a;if("Nothing"===a.$)return li;var s=a.a;return fi(d(e,i,o,u,s))}),IS=function(e){return h(wS,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}}),yS(e.v6),yS(e.v7),yS(e.v8),yS(e.v9))},AS=n(function(e,t,r){return f(Lv,r,f(Bv,IS,f(wv,fv(e),TS(t))))}),BS=i(function(e,t,r,n,a){return{balance:e,closedReason:a,phase:t,phaseStartTimestamp:r,responder:n}}),kS=wu(f(sC,tv,f(sC,Kg,f(sC,tv,f(sC,tv,f(sC,tv,oC(BS))))))),NS=function(e){return{data:fi(f(el,"getState()",vr)),decoder:kS,from:li,gas:li,gasPrice:li,nonce:li,to:fi(e),value:li}},$S={$:"Aborted"},RS={$:"Burned"},xS={$:"NotClosed"},_S={$:"Recalled"},LS={$:"Released"},PS=function(e){switch(f(Kc,99,cd(zy(e)))){case 0:return fi(xS);case 1:return fi(_S);case 2:return fi($S);case 3:return fi(LS);case 4:return fi(RS);default:return li}},DS=function(e){switch(f(Kc,99,cd(zy(e)))){case 1:return fi(Io);case 2:return fi(To);case 3:return fi(wo);case 4:return fi(So);default:return li}},US=function(e){return $(e,eg("0x0000000000000000000000000000000000000000"))?li:fi(e)},OS=a(function(e,t,r,n){if("Nothing"===t.$)return li;var a=t.a;if("Nothing"===r.$)return li;var i=r.a;if("Nothing"===n.$)return li;var o=n.a;return fi(l(e,a,i,o))}),MS=function(e){var t=yS(e.phaseStartTimestamp),r=DS(e.phase),a=PS(e.closedReason);return d(OS,n(function(t,r,n){return{balance:Yy(e.balance),closedReason:n,phase:t,phaseStartTime:r,responder:US(e.responder)}}),r,t,a)},FS=n(function(e,t,r){return f(Lv,r,f(Bv,MS,f(wv,fv(e),NS(t))))}),VS=i(function(e,t,r,n,a){return Fo(M([l(CS,e,t,r),l(FS,e,t,n),l(AS,e,t,a)]))}),KS=function(e){var t=Wy(e);if("Just"===t.$){return t.a}f(op,"Warning! BigInt to Int conversion failed!",zy(e));return 0},HS=a(function(e,t,r,n){return{encapsulatedKey:e,iv:t,message:n,tag:r}}),jS=n(function(e,t,r){for(;;){var n=f(Qa,32,e),a=n.a,i=n.b;if(x(ii(a),32)<0)return f(oi,!0,{nodeList:t,nodeListSize:r,tail:a});var o=i,u=f(Ra,Ya(a),t),s=r+1;e=o,t=u,r=s}}),qS=function(e){return e.b?l(jS,e,vr,0):Wa},GS=rn,zS=function(e){var t=h(GS,HS,f(hl,"encapsulation",Su),f(hl,"iv",Su),f(hl,"tag",Su),f(hl,"encrypted",Su)),r=YC(t),n=f(nv,r,e);if("Err"===n.$){var a=n.a;return di(Oi(a))}var i=n.a;return function(e){var t=_(f(sf,0,e),f(sf,1,e));if("Just"===t.a.$&&"Just"===t.b.$){var r=t.a.a,n=t.b.a;return hi(_(r,n))}return di("Decoded list has less than 2 items.")}(qS(i))},WS=function(e){var t=function(e){var t=iu(e);return t>1114111?di("string is too long"):hi(f(_s,xE(t),e))};return f(du,xi(""),xg(f(Ua,t,e)))},YS=function(e){var t=e.a,r=e.b;return WS(M([t.encapsulatedKey,t.iv,t.tag,t.message,r.encapsulatedKey,r.iv,r.tag,r.message]))},JS=r(function(e,t){return vp(M([_("message",cp(e)),_("pubkeyHexStrings",f(av,cp,M([t.initiatorPubkey,t.responderPubkey])))]))}),QS=function(e){return{$:"LoadedCommInfo",a:e}},XS=r(function(e,t){return{initiatorPubkey:e,responderPubkey:t}}),ZS=function(e){var t=_(e.initiatorPubkey,e.responderPubkey);if("Just"===t.a.$&&"Just"===t.b.$){var r=t.a.a,n=t.b.a;return QS(f(XS,r,n))}return SC(e)},eT=r(function(e,t){if("PartiallyLoadedCommInfo"===t.$){var r=t.a;return ZS(D(r,{initiatorPubkey:fi(e)}))}var n=t.a;return QS(D(n,{initiatorPubkey:e}))}),tT=r(function(e,t){if("PartiallyLoadedCommInfo"===t.$){var r=t.a;return ZS(D(r,{responderPubkey:fi(e)}))}var n=t.a;return QS(D(n,{responderPubkey:e}))}),rT=r(function(e,t){var r=_(t,e);if("Initiator"===r.a.$){if("Buyer"===r.b.$){r.a,r.b;return vo}r.a,r.b;return yo}if("Buyer"===r.b.$){r.a,r.b;return yo}r.a,r.b;return vo}),nT=r(function(e,t){for(;;){if(!e.b)return t;var r=e.a,n=e.b,a=bi(r),i=f(Wg,a,n),o=Ms(f(bc,a,n)),u=U(t,M([o])),s=i,c=u;e=s,t=c}}),aT=n(function(e,t,r){if("Nothing"===t.$)return li;var n=t.a;if("Nothing"===r.$)return li;var a=r.a;return fi(f(e,n,a))}),iT=function(e){var t=qS(f(nT,uc(e),vr));return l(aT,dl,h(wS,HS,f(sf,0,t),f(sf,1,t),f(sf,2,t),f(sf,3,t)),h(wS,HS,f(sf,4,t),f(sf,5,t),f(sf,6,t),f(sf,7,t)))},oT=r(function(e,t){if("Statement"===t.$){t.a;return l(ha,"New Message from Trade",li,li)}var r=t.a,n=function(){switch(r.$){case"Initiated":return"Trade Opened.";case"Committed":return e?"Someone has committed to the Trade!":"You are now committed to the Trade!";case"Recalled":return"Trade recalled.";case"Claimed":return"Payment has been confirmed by the Buyer.";case"Aborted":return"Trade aborted by Buyer.";case"Released":return"Trade released by Seller.";default:return"Trade burned by Seller."}}();return l(ha,n,li,li)}),uT={$:"Aborted"},sT={$:"Burned"},cT={$:"Claimed"},fT=function(e){return{$:"Committed",a:e}},lT=function(e){return{$:"Encrypted",a:e}},dT={$:"FailedDecode"},hT={$:"Initiated"},pT={$:"Recalled"},gT={$:"Released"},vT=function(e){return{$:"StateChange",a:e}},yT=function(e){return{$:"Statement",a:e}},mT=cr,bT=sr,CT=r(function(e,t){var r=ii(e),n=32-ii(t.tail)-r,a=l(mT,32,t.tail,e);return n<0?{nodeList:f(Ra,Ya(a),t.nodeList),nodeListSize:t.nodeListSize+1,tail:l(bT,n,r,e)}:n?{nodeList:t.nodeList,nodeListSize:t.nodeListSize,tail:a}:{nodeList:f(Ra,Ya(a),t.nodeList),nodeListSize:t.nodeListSize+1,tail:za}}),ET=ir,ST=y,TT=a(function(e,t,r,n){var a=nf&t>>>e;if(x(a,ii(n))>-1){if(5===e)return f(ET,Ya(r),n);var i=Ja(d(TT,e-Ga,t,r,za));return f(ET,i,n)}var o=f(af,a,n);if("SubTree"===o.$){var u=o.a,i=Ja(d(TT,e-Ga,t,r,u));return l(lf,a,i,n)}var i=Ja(d(TT,e-Ga,t,r,ST(o)));return l(lf,a,i,n)}),wT=r(function(e,t){var r=t.a,n=t.b,a=t.c,i=t.d,o=ii(i),u=ii(e),s=r+(u-o);if($(u,32)){if(x(s>>>Ga,1<0){var c=n+Ga,f=d(TT,c,r,e,ST(Ja(a)));return d(Ka,s,c,f,za)}return d(Ka,s,n,d(TT,n,r,e,a),za)}return d(Ka,s,n,a,e)}),IT=r(function(e,t){var r=(t.a,t.c,t.d),n=ii(e),a=32-ii(r)-n,i=l(mT,32,r,e),o=f(wT,i,t);if(a<0){var u=l(bT,a,n,e);return f(wT,u,o)}return o}),AT=or,BT=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(AT,i,t,r)}return f(Ra,e,t)});return{nodeList:l(AT,i,vr,n),nodeListSize:t/32|0,tail:a}},kT=r(function(e,t){var n=(e.d,t.a),a=t.c,i=t.d;if(x(n,128)<1){var o=r(function(e,t){if("SubTree"===e.$){var r=e.a;return l(AT,o,t,r)}var n=e.a;return f(IT,n,t)});return f(IT,i,l(AT,o,e,a))}var o=r(function(e,t){if("SubTree"===e.$){var r=e.a;return l(AT,o,t,r)}var n=e.a;return f(CT,n,t)});return f(oi,!0,f(CT,i,l(AT,o,BT(e),a)))}),NT=r(function(e,t){if("Nothing"===e.$)return t;var r=e.a;return f(Ra,r,t)}),$T=f(Da,NT,vr),RT=n(function(e,t,r){var n=rT(r.trade.parameters.initiatorRole),a=function(){switch(t.$){case"InitiatedEvent":return fi(vT(hT));case"CommittedEvent":var r=t.a;return fi(vT(fT(r.responder)));case"RecalledEvent":return fi(vT(pT));case"ClaimedEvent":return fi(vT(cT));case"AbortedEvent":return fi(vT(uT));case"ReleasedEvent":return fi(vT(gT));case"BurnedEvent":return fi(vT(sT));case"InitiatorStatementLogEvent":var r=t.a;return fi(yT({blocknum:e,message:function(){var e=iT(r.statement);if("Just"===e.$){var t=e.a;return lT(t)}return dT}(),who:n(ko)}));case"ResponderStatementLogEvent":var r=t.a;return fi(yT({blocknum:e,message:function(){var e=iT(r.statement);if("Just"===e.$){var t=e.a;return lT(t)}return dT}(),who:n(No)}));default:return li}}(),i=f(xo,function(t){return{blocknum:e,eventInfo:t,time:li}},a),o=f(kT,r.history,qS($T(M([i])))),u=x(e,r.lastNotificationBlocknum)>0?_(f(xo,oT($(r.userRole,r.trade.parameters.initiatorRole)),a),e):_(li,r.lastNotificationBlocknum),s=u.a;return L(D(r,{history:o,lastNotificationBlocknum:u.b}),function(){return"Just"===a.$&&"Statement"===a.a.$}(),$T(M([s])))}),xT=Gr,_T=function(e){var t=l(Vi,dl,f(hl,"id",xT),f(hl,"message",Su));return f(hh,Oi,f(nv,t,e))},LT=function(e){return{$:"Decrypted",a:e}},PT=a(function(e,t,r,n){return{cmdUps:n,maybeMessageSubmit:r,model:e,shouldCallDecrypt:t}}),DT=r(function(e,t){switch(e.$){case"NewEvent":var r=e.a,n=r.a,a=r.b,i=l(RT,n,a,t),o=i.a,u=i.b,s=i.c;return d(PT,o,u,li,s);case"MessageInputChanged":var c=e.a;return d(PT,D(t,{messageInput:c}),!1,li,vr);case"MessageSubmit":return d(PT,D(t,{messageInput:""}),!1,fi(t.messageInput),vr);default:var h=e.a,p=_T(h);if("Ok"===p.$){var g=p.a,v=g.a,y=g.b,m=f(sf,v,t.history);if("Just"===m.$){var b=m.a,C=b.eventInfo;if("Statement"===C.$){var E=C.a,S=D(E,{message:LT(y)}),T=D(b,{eventInfo:yT(S)}),w=l(hf,v,T,t.history);return d(PT,D(t,{history:w}),!1,li,vr)}return d(PT,t,!1,li,M([ya(f(up,"got a decryption result, but for an event that is not a message!",b))]))}return d(PT,t,!1,li,M([ya(f(up,"got a decryption result, but for an id out of bounds!",_(v,t.history)))]))}var I=p.a;return d(PT,t,!1,li,M([ya(f(up,"Error decoding decryption result",I))]))}}),UT=r(function(e,t){return{$:"ActionMined",a:e,b:t}}),OT=r(function(e,t){return{$:"ActionSigned",a:e,b:t}}),MT=function(e){return{onBroadcast:li,onMined:fi(_(UT(e),li)),onSign:fi(OT(e))}},FT=Ge("encryptToPubkeys",Fa),VT=n(function(e,t,r){return{data:fi(f(el,"commit(address,string)",M([ag(t),Fv(r)]))),decoder:Ki(pr),from:li,gas:li,gasPrice:li,nonce:li,to:fi(e),value:li}}),KT=n(function(e,t,r){return{data:fi(f(el,"commit(address,string)",M([ag(t),Fv(r)]))),decoder:Ki(pr),from:li,gas:li,gasPrice:li,nonce:li,to:fi(e),value:li}}),HT=function(e){return{$:"CommitMined",a:e}},jT={$:"CommitNeedsSig"},qT=function(e){return{$:"CommitSigned",a:e}},GT=n(function(e,t,r){var n=function(){return"Token"===e.factory.$?KT:VT}(),a=rp(function(){return"Token"===e.factory.$?Fa:Yv(cg(rS(e.parameters)))}()(l(n,e.creationInfo.address,t,r)));return _(fi(jT),f(Zo,{onBroadcast:li,onMined:fi(_(HT,li)),onSign:fi(qT)},a))}),zT=r(function(e,t){return vp(M([_("id",Cp(e)),_("encapsulation",cp(t.encapsulatedKey)),_("iv",cp(t.iv)),_("tag",cp(t.tag)),_("encrypted",cp(t.message))]))}),WT=Ge("decryptMessage",Fa),YT=function(e){var t=e.a,n=r(function(e,t){var r=t.a,n=t.b;return _(r-1,f(Ra,_(r,e),n))});return l(wa,n,_(t-1,vr),e).b},JT=r(function(e,t){return Fo(f(Ua,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 WT(f(zT,r,s))}return Vo}return Vo},YT(e.history)))}),QT=function(e){if("Just"===e.$){return e.a}return li},XT=function(e){var t=QT(l(aT,Ro,function(){var t=e.trade;if("LoadedTrade"===t.$){var r=t.a;return fi(r)}return li}(),f(xo,function(e){return e.address},Sm(e.wallet)))),r=_(e.chatHistoryModel,t);if("Just"===r.a.$&&"Just"===r.b.$){var n=r.a.a,a=r.b.a;return f(JT,n,a)}return Vo},ZT=r(function(e,t){return f(r(function(e,t){for(;;){var r=t.a,n=t.b,a=t.c;if(!e.b)return L(r,n,a);var i=e.a,o=i.a,u=i.b,s=e.b,c=l(RT,o,u,r),d=c.a,h=c.b,p=c.c,g=s,v=L(d,n||h,f(co,a,p));e=g,t=v}}),e,L(t,!1,vr))}),ew=o(function(e,t,r,n,a,i){return{history:n,lastNotificationBlocknum:a,messageInput:i,trade:t,userRole:r,wallet:e}}),tw=i(function(e,t,r,n,a){return f(ZT,n,p(ew,e,r,t,Wa,a,""))}),rw=function(e){return{$:"ChatHistoryMsg",a:e}},nw=a(function(e,t,r,n){var a=L(t,Sm(e),r);if("LoadedTrade"===a.a.$&&"Just"===a.b.$&&"Just"===a.c.$){var i=a.a.a,o=a.b.a,u=a.c.a,s=f(_o,i,o.address);if("Just"===s.$){var c=s.a;return function(e){var t=e.a,r=e.b,n=e.c;return L(fi(t),r,f(Ua,Xi(rw),n))}(h(tw,e,c,i,n,u))}return L(li,!1,vr)}return L(li,!1,vr)}),aw={$:"Abort"},iw=r(function(e,t){return{$:"ActionMining",a:e,b:t}}),ow=function(e){return{$:"ActionNeedsSig",a:e}},uw=function(e){return{$:"ApproveMining",a:e}},sw={$:"ApproveNeedsSig"},cw=function(e){return{$:"ApproveSigned",a:e}},fw={$:"Burn"},lw={$:"Claim"},dw=function(e){return{$:"CommitMining",a:e}},hw=function(e){return{$:"ConfirmingAction",a:e}},pw=r(function(e,t){return{$:"ConfirmingCommit",a:e,b:t}}),gw=function(e){return{$:"ParametersFetched",a:e}},vw=function(e){return{$:"PhaseInfoFetched",a:e}},yw={$:"Poke"},mw={$:"Recall"},bw={$:"Release"},Cw=function(e){return{$:"StartContractAction",a:e}},Ew=function(e){return{$:"StateFetched",a:e}},Sw=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"}},Tw={align:Xh,label:"cantFindTradeWillRetry",mainParagraphs:M([M([ep("Can't find a trade by that ID. I'll try again in half a second.")])]),noticeType:vm},ww=r(function(e,t){if("Err"===t.$){var r=t.a;return f(ym,e,r)}if("Nothing"===t.a.$){t.a;return f(up,"Couldn't decode the fetched \""+e+'" result.',li)}return f(up,"fromBadFetchResultMaybe being called with an 'OK (Just a)' value",t)}),Iw={align:Xh,label:"tradeParametersNotDefault",mainParagraphs:M([M([ep("Sorry, I'm not yet able to deal with this kind of trade. This must have been created by some other DAIHard interface.")])]),noticeType:vm},Aw=ro(eo),Bw=n(function(e,t,r){return l(th,e,xo(function(e){return D(e,{logCount:Ii(t)+e.logCount})}),r)}),kw=r(function(e,t){var r=t.a;return yC(f(eh,e,r))}),Nw=r(function(e,t){return xv(Iv(f(Bv,e,t)))}),$w=n(function(e,t,r){var n=e.a,a=f(Gd,t,n.requests);if("Nothing"===a.$)return _(vC(n),Vo);var i=a.a,o=_(i.watchOnce,ov(r));if("Nothing"===o.b.$){o.b;return _(vC(D(n,{requests:l(Bw,t,r,n.requests)})),Vo)}if(o.a){var u=o.b.a;return _(vC(D(n,{requests:l(Bw,t,r,n.requests),watching:f(kw,t,n.watching)})),f(Nw,i.tagger,wh(u)))}return _(vC(D(n,{requests:l(Bw,t,r,n.requests)})),Fo(f(Ua,function(e){return f(Nw,i.tagger,wh(e))},r)))}),Rw=Le,xw=r(function(e,t){return f(Lv,f(tu,gC,t),f(Bh,function(t){return nC(e)},Rw(2e3)))}),_w=n(function(e,t,r){var n=r.a,a=r.b;return f(ZC,e,D(t,{fromBlock:eE(n),toBlock:eE(a)}))}),Lw=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(Lw,e,t,i)),c=o;e=u,t=s,r=c}}),Pw=r(function(e,t){return l(Lw,Kd,t,e)}),Dw=r(function(e,t){var r=e.a,n=t.a;return yC(f(Pw,r,n))}),Uw=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 Fo(f(Ua,function(t){return f(Lv,f(tu,NC(t.ref),r.tagger),l(n,r.nodePath,t.logFilter,e))},$T(f(Ua,function(e){return f(Gd,e,r.requests)},$a(t)))))}),o=r.blockNumber;if("Just"===o.$){var u=o.a;return a-u?_(vC(D(r,{blockNumber:fi(a)})),Fo(M([f(xw,r.nodePath,r.tagger),l(i,_(u+1,a),r.watching,_w)]))):_(t,f(xw,r.nodePath,r.tagger))}return _(vC(D(r,{blockNumber:fi(a),pending:mC,watching:f(Dw,r.watching,r.pending)})),Fo(M([f(xw,r.nodePath,r.tagger),l(i,_(a,a),r.pending,tE),l(i,_(a,a),r.watching,_w)])))}var s=e.a.a;return _(vC(D(r,{errors:f(Ra,s,r.errors)})),f(xw,r.nodePath,r.tagger))}if("Ok"===e.b.$){var c=e.a,d=e.b.a;return l($w,t,c,d)}var s=e.b.a;return _(vC(D(r,{errors:f(Ra,s,r.errors)})),Vo)}),Ow=function(e){return M([e])},Mw=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(hC,r.factory,r.id):Vo}}(),function(){var e=L(Sm(t.wallet),jp(t.wallet),t.trade);if("Just"===e.a.$&&"Just"===e.b.$&&"Token"===e.b.a.$&&"LoadedTrade"===e.c.$){var r=e.a.a,n=e.b.a.a,a=e.c.a;return $(jp(t.wallet),fi(a.factory))?d(Pv,n,r.address,a.creationInfo.address,oE):Vo}return Vo}()),n=function(){return"Nothing"===t.chatHistoryModel.$?d(nw,t.wallet,t.trade,t.blocknumOnInit,t.eventsWaitingForChatHistory):L(t.chatHistoryModel,!1,vr)}(),a=n.a,i=n.b,o=n.c,u=D(t,{chatHistoryModel:a}),s=i?XT(t):Vo,c=t.trade;if("LoadedTrade"===c.$){var p=c.a;return d(IC,u,Fo(M([l(FS,p.factory,p.creationInfo.address,Ew),s,r])),zo,o)}return uE(u);case"CurrentBlockFetched":var g=e.a;if("Ok"===g.$){var v=g.a;return uE(D(t,{blocknumOnInit:fi(v)}))}var y=g.a;return d(IC,t,Vo,zo,M([ya(f(ym,"blocknum",y))]));case"AllowanceFetched":var g=e.a;if("Ok"===g.$){var m=g.a,u=D(t,{allowance:fi(m)}),b=L(u.txChainStatus,u.trade,u.wallet);if("Just"===b.a.$&&"ApproveMining"===b.a.a.$&&"LoadedTrade"===b.b.$&&"Active"===b.c.$){var C=b.b.a,E=b.c.a;if($(f(cs,m,cg(rS(C.parameters))),Sa))return uE(u);var S=l(GT,C,E.address,E.commPubkey),T=S.a,w=S.b;return d(IC,D(u,{txChainStatus:T}),Vo,w,vr)}return uE(u)}var y=g.a;return d(IC,t,Vo,zo,M([ya(f(ym,"allowance",y))]));case"CreationInfoFetched":var g=e.a;if("Ok"===g.$){var I=g.a,A={address:I.address_,blocknum:KS(I.blocknum)},B=l(aE,kC,t.eventSentry,{address:A.address,fromBlock:eE(A.blocknum),toBlock:Tv,topics:vr}),k=B.a,N=B.b,u=D(t,{eventSentry:k,trade:f(cS,A,t.trade)}),R=f(Kc,Aw,nS(u.trade)),x=Fo(M([N,h(VS,R,A.address,gw,Ew,vw)]));return d(IC,u,x,zo,vr)}if("BadBody"===g.a.$){g.a.a;return d(IC,t,Vo,zo,M([ya(Tw)]))}var y=g.a;return d(IC,t,Vo,zo,M([ya(f(ym,"trade state",y))]));case"StateFetched":var g=e.a;if("Ok"===g.$&&"Just"===g.a.$){var P=g.a.a,O=function(){var e=t.trade;switch(e.$){case"PartiallyLoadedTrade":return!0;case"LoadedTrade":return!$(e.a.state.phase,P.phase);default:return!1}}(),u=D(t,{expandedPhase:O?P.phase:t.expandedPhase,trade:f(dS,P,t.trade)});return d(IC,u,XT(u),zo,vr)}return d(IC,t,Vo,zo,M([ya(f(ww,"trade state",g))]));case"ParametersFetched":var g=e.a;if("Ok"===g.$){if("Ok"===g.a.$){var F=g.a.a;if(aS(F)){var u=D(t,{trade:f(fS,F,t.trade)});return d(IC,u,XT(u),zo,vr)}return d(IC,D(t,{trade:vE}),Vo,zo,M([ya(Iw)]))}var V=g.a.a;return d(IC,t,Vo,zo,M([ya(f(up,"Error decoding fetched trade parameters",V))]))}var K=g.a;return d(IC,t,Vo,zo,M([ya(f(ym,"trade parameters",K))]));case"PhaseInfoFetched":var g=e.a;if("Ok"===g.$&&"Just"===g.a.$){var H=g.a.a,u=D(t,{trade:f(lS,H,t.trade)});return d(IC,u,XT(u),zo,vr)}return d(IC,t,Vo,zo,M([ya(f(ww,"trade state",g))]));case"EventLogFetched":var j=e.a,q=f(iv,tS,j),G=q.returnData;if("Err"===G.$){var z=G.a;return d(IC,t,Vo,zo,M([ya(f(up,"Error decoding contract event",z))]))}var W=G.a,Y=function(){switch(W.$){case"InitiatedEvent":var e=W.a;return f(eT,e.commPubkey,t.secureCommInfo);case"CommittedEvent":var e=W.a;return f(tT,e.commPubkey,t.secureCommInfo);default:return t.secureCommInfo}}(),J=function(){if("InitiatedEvent"===W.$){var e=W.a,r=BE(e.terms);if("Ok"===r.$){var n=r.a;return _(f(hS,n,t.trade),li)}var a=r.a;return _(t.trade,fi(f(up,"Couldn't decode payment methods!",a)))}return _(t.trade,li)}(),Q=J.a,X=J.b,Z=function(){var e=t.chatHistoryModel;if("Just"===e.$){var r=e.a;return L(fi(r),!1,vr)}return d(nw,t.wallet,Q,t.blocknumOnInit,t.eventsWaitingForChatHistory)}(),ee=Z.a,te=Z.b,re=Z.c,ne=function(){if("Just"===ee.$){var e=ee.a;return _(function(e){var t=e.a,r=e.b,n=e.c;return L(fi(t),r||te,f(co,re,f(Ua,Xi(rw),n)))}(l(RT,q.blockNumber,W,e)),vr)}return _(L(li,!1,re),f(co,t.eventsWaitingForChatHistory,M([_(q.blockNumber,W)])))}(),ae=ne.a,ie=ae.a,oe=ae.b,ue=ae.c,se=ne.b,u=D(t,{chatHistoryModel:ie,eventsWaitingForChatHistory:se,secureCommInfo:Y,trade:Q}),x=oe?XT(u):Vo;return d(IC,u,x,zo,f(co,f(Ua,ya,$T(M([X]))),ue));case"ExpandPhase":var ce=e.a;return uE(D(t,{expandedPhase:ce}));case"ToggleChat":var fe=!t.showChatHistory;return uE(D(t,{showChatHistory:fe}));case"ToggleStatsModal":var le=!t.showStatsModal;return uE(D(t,{showStatsModal:le}));case"ViewUserHistory":var de=(e.a,t.trade);if("LoadedTrade"===de.$){var C=de.a;return d(IC,t,Vo,zo,M([ga(pb(C.parameters.initiatorAddress))]))}return d(IC,t,Vo,zo,M([ya(f(up,"Trying to view a user's history for a not-yet-loaded Trade",t.trade))]));case"CommitClicked":var C=e.a,E=e.b,he=e.c;return uE(D(t,{txChainStatus:fi(f(pw,E,he))}));case"AbortAction":return uE(D(t,{txChainStatus:li}));case"ConfirmCommit":var C=e.a,E=e.b,he=e.c,pe=function(){var e=C.factory;if("Native"===e.$)return l(GT,C,E.address,E.commPubkey);var r=e.a,n=function(){var e=rp(l(ug,rg(r),C.creationInfo.address,he)),t={onBroadcast:li,onMined:li,onSign:fi(cw)};return f(Zo,t,e)}(),a=t.allowance;if("Just"===a.$){var i=a.a;return $(f(cs,i,cg(rS(C.parameters))),Sa)?_(fi(sw),n):l(GT,C,E.address,E.commPubkey)}return _(fi(sw),n)}(),T=pe.a,w=pe.b;return d(IC,D(t,{txChainStatus:T}),Vo,w,vr);case"ContractActionClicked":var ge=e.a;if($(ge,yw)||$(ge,mw)){var ve=Cw(ge),ye=t;e=ve,t=ye;continue e}return uE(D(t,{txChainStatus:fi(hw(ge))}));case"StartContractAction":var me=e.a,be=function(){var e=t.trade;if("LoadedTrade"!==e.$){var r=e;return L(t.txChainStatus,zo,M([ya(f(up,"Trying to handle StartContractAction msg for a not-yet-loaded Trade",r))]))}var n=e.a;switch(me.$){case"Recall":var a=rp(hE(n.creationInfo.address));return L(fi(ow(mw)),f(Zo,MT(mw),a),vr);case"Claim":var a=rp(lE(n.creationInfo.address));return L(fi(ow(lw)),f(Zo,MT(lw),a),vr);case"Abort":var a=rp(cE(n.creationInfo.address));return L(fi(ow(aw)),f(Zo,MT(aw),a),vr);case"Release":var a=rp(pE(n.creationInfo.address));return L(fi(ow(bw)),f(Zo,MT(bw),a),vr);case"Burn":var a=rp(fE(n.creationInfo.address));return L(fi(ow(fw)),f(Zo,MT(fw),a),vr);default:var a=rp(tl(n.creationInfo.address));return L(fi(ow(yw)),f(Zo,MT(yw),a),vr)}}(),T=be.a,w=be.b,o=be.c;return d(IC,D(t,{txChainStatus:T}),Vo,w,o);case"ApproveSigned":var Ce=e.a;if("Ok"===Ce.$){var Ee=Ce.a;return uE(D(t,{txChainStatus:fi(uw(Ee))}))}var V=Ce.a;return d(IC,D(t,{txChainStatus:li}),Vo,zo,M([ya(f(bm,"approve",V))]));case"CommitSigned":var Ce=e.a;if("Ok"===Ce.$){var Ee=Ce.a;return uE(D(t,{txChainStatus:fi(dw(Ee))}))}var V=Ce.a;return d(IC,D(t,{txChainStatus:li}),Vo,zo,M([ya(f(bm,"commit",V))]));case"CommitMined":return uE(D(t,{txChainStatus:li}));case"ActionSigned":var ge=e.a,Ce=e.b;if("Ok"===Ce.$){var Ee=Ce.a;return uE(D(t,{txChainStatus:fi(f(iw,ge,Ee))}))}var V=Ce.a;return d(IC,D(t,{txChainStatus:li}),Vo,zo,M([ya(f(bm,Sw(ge),V))]));case"ActionMined":var ge=e.a;return uE(D(t,{txChainStatus:li}));case"EventSentryMsg":var Se=e.a,Te=f(Uw,Se,t.eventSentry),we=Te.a,x=Te.b;return d(IC,D(t,{eventSentry:we}),x,zo,vr);case"ChatHistoryMsg":var Ie=e.a,Ae=t.chatHistoryModel;if("Just"===Ae.$){var Be=Ae.a,ke=f(DT,Ie,Be),Ne=D(t,{chatHistoryModel:fi(ke.model)}),s=ke.shouldCallDecrypt?XT(t):Vo,$e=function(){var e=ke.maybeMessageSubmit;if("Just"===e.$){var r=e.a,n=t.secureCommInfo;if("LoadedCommInfo"===n.$){var a=n.a;return _(FT(f(JS,r,a)),li)}return _(Vo,fi(f(up,"Trying to encrypt, but commInfo is not loaded",n)))}return _(Vo,li)}(),Re=$e.a,xe=$e.b;return d(IC,Ne,Fo(M([s,Re])),zo,U(f(Zi,rw,ke.cmdUps),f(Kc,vr,f(xo,Ow,f(xo,ya,xe)))))}return d(IC,t,Vo,zo,M([ya(f(up,"Got a chat history message, but there is no chat history model!",Ie))]));case"EncryptionFinished":var _e=e.a,Le=f(uv,YS,zS(_e)),Pe=L(t.wallet,t.trade,Le);if("Ok"===Pe.c.$){if("Active"===Pe.a.$&&"LoadedTrade"===Pe.b.$){var E=Pe.a.a,p=Pe.b.a,De=Pe.c.a,Ue=f(Ro,p,E.address);if("Nothing"===Ue.$)return d(IC,t,Vo,zo,M([ya(f(up,"Trying to encrypt, but the user is not involved in this trade.",li))]));var Oe=Ue.a,Me=function(){return rp("Initiator"===Oe.$?f(dE,p.creationInfo.address,De):f(gE,p.creationInfo.address,De))}();return d(IC,t,Vo,f(Zo,{onBroadcast:li,onMined:li,onSign:li},Me),vr)}var Fe=Pe.a,Ve=Pe.b;return d(IC,t,Vo,zo,M([ya(f(up,"Encryption successful, but the user or trade is no longer valid.",_(Fe,Ve)))]))}var Ke=Pe.c.a;return d(IC,t,Vo,zo,M([ya(f(up,"Error translating JS encryption result into Elm.",Ke))]));case"MessageSubmitMined":if("Ok"===e.a.$){e.a.a;return uE(t)}var V=e.a.a;return d(IC,t,Vo,zo,M([ya(f(mm,"message",V))]));case"Web3Connect":return d(IC,t,Vo,zo,M([ma]));default:return uE(t)}}),Fw=r(function(e,t){return{address:e,blocknum:t}}),Vw=function(e){switch(e.$){case"LoadedTrade":var t=e.a;return fi(t.creationInfo);case"PartiallyLoadedTrade":return e.a.creationInfo;default:return li}},Kw=n(function(e,t,r){return function(e){return _(e.a,e.b)}(d(nE,!0,e,t,r))}),Hw=n(function(e,t,r){var n=function(e){return r(f(iv,OE,e).returnData)},a={address:t.address,fromBlock:eE(t.blocknum),toBlock:eE(t.blocknum),topics:M([fi(eS("Initiated(string,string)"))])};return l(Kw,n,e,a)}),jw=function(e){return{data:fi(f(el,"numTrades()",vr)),decoder:wu(tv),from:li,gas:li,gasPrice:li,nonce:li,to:fi(e),value:li}},qw=r(function(e,t){return f(Lv,t,f(wv,fv(e),jw(tg(e))))}),Gw=function(e){return{data:fi(f(el,"phase()",vr)),decoder:wu(tv),from:li,gas:li,gasPrice:li,nonce:li,to:fi(e),value:li}},zw=n(function(e,t,r){return f(Lv,r,f(Bv,DS,f(wv,fv(e),Gw(t))))}),Ww=function(e){return f(_h,function(e){if("LoadedTrade"===e.$){var t=e.a;return fi(t)}return li},Ia(e.trades))},Yw=function(e){return f(_a,r(function(t,r){return e(t)?r+1:r}),0)},Jw=function(e){return f(Yw,Za(vE),Ia(e.trades))},Qw=function(e){return D(e,{dataFetchState:D(e.dataFetchState,{invalid:Jw(e),loaded:Ii(Ww(e))})})},Xw=n(function(e,t,r){return{cmd:t,cmdUps:r,tradeCache:e}}),Zw=r(function(e,t){var r=f(sf,e,t.trades);if("Just"===r.$){var n=(r.a,l(hf,e,vE,t.trades));return l(Xw,Qw(D(t,{trades:n})),Vo,vr)}return l(Xw,t,Vo,M([ya(f(up,"markTradeInvalid ran into an out-of-range error",_(e,t.trades)))]))}),eI=n(function(e,t,r){var n=f(sf,e,r.trades);if("Just"===n.$){var a=n.a,i=f(cS,t,a),o=l(hf,e,i,r.trades);return _(Qw(D(r,{trades:o})),vr)}return _(r,M([f(up,"updateTradeAddress ran into an out-of-range error",_(e,r.trades))]))}),tI=n(function(e,t,r){var n=f(sf,e,r.trades);if("Just"===n.$){var a=n.a,i=f(fS,t,a),o=l(hf,e,i,r.trades);return l(Xw,Qw(D(r,{trades:o})),Vo,vr)}return l(Xw,r,Vo,M([ya(f(up,"updateTradeParameters ran into an out-of-range error",_(e,r.trades)))]))}),rI=n(function(e,t,r){var n=f(sf,e,r.trades);if("Just"===n.$){if("LoadedTrade"===n.a.$){var a=n.a.a,i=a.state,o=l(hf,e,BC(D(a,{state:D(i,{phase:t})})),r.trades);return l(Xw,Qw(D(r,{trades:o})),Vo,vr)}return l(Xw,r,Vo,M([ya(f(up,"updateTradePhase is trying to update a partially loaded trade",_(e,r.trades)))]))}return l(Xw,r,Vo,M([ya(f(up,"updateTradePhase ran into an out-of-range error",_(e,r.trades)))]))}),nI=n(function(e,t,r){var n=f(sf,e,r.trades);if("Just"===n.$){var a=n.a,i=f(lS,t,a),o=l(hf,e,i,r.trades);return l(Xw,Qw(D(r,{trades:o})),Vo,vr)}return l(Xw,r,Vo,M([ya(f(up,"updateTradePhaseTimeInfo ran into an out-of-range error",_(e,r.trades)))]))}),aI=n(function(e,t,r){var n=f(sf,e,r.trades);if("Just"===n.$){var a=n.a,i=f(dS,t,a),o=l(hf,e,i,r.trades);return l(Xw,Qw(D(r,{trades:o})),Vo,vr)}return l(Xw,r,Vo,M([ya(f(up,"updateTradeState ran into an out-of-range error",_(e,r.trades)))]))}),iI=n(function(e,t,r){var n=f(sf,e,r.trades);if("Just"===n.$){var a=n.a,i=f(hS,t,a),o=l(hf,e,i,r.trades);return l(Xw,Qw(D(r,{trades:o})),Vo,vr)}return l(Xw,r,Vo,M([ya(f(up,"updateTTPaymentMethods ran into an out-of-range error",_(e,r.trades)))]))}),oI=r(function(e,t){return{$:"CreationInfoFetched",a:e,b:t}}),uI=n(function(e,t,r){return{invalid:r,loaded:t,total:e}}),sI=r(function(e,t){return{$:"InitiatedEventDataFetched",a:e,b:t}}),cI=function(e){return{$:"NumTradesFetchedAgain",a:e}},fI=r(function(e,t){return{$:"ParametersFetched",a:e,b:t}}),lI=n(function(e,t,r){return{$:"PhaseFetched",a:e,b:t,c:r}}),dI=r(function(e,t){return{$:"PhaseStartInfoFetched",a:e,b:t}}),hI=r(function(e,t){return{$:"StateFetched",a:e,b:t}}),pI=function(e){return l(Xw,e,Vo,vr)},gI=r(function(e,t){switch(e.$){case"InitialNumTradesFetched":var r=e.a;if("Ok"===r.$){var n=r.a,a=KS(n),i=qS(f(Ua,eC(t.factory),f(ki,0,a-1))),o=Fo(f(Ua,function(e){return l(lC,t.factory,Zu(e),oI(e))},f(ki,0,a-1)));return l(Xw,D(t,{dataFetchState:l(uI,fi(a),0,0),trades:i}),o,vr)}var u=r.a;return l(Xw,t,Vo,M([ya(f(ym,"Factory numTrades",u))]));case"CheckForNewTrades":return l(Xw,t,f(qw,t.factory,cI),vr);case"UpdateTradePhases":var s=Fo($T(f(Ua,function(e){return"Closed"===e.state.phase.$?li:fi(l(zw,e.factory,e.creationInfo.address,f(lI,e.factory,e.id)))},Ww(t))));return l(Xw,t,s,vr);case"PhaseFetched":var c=e.a,d=e.b,r=e.c;if("Ok"===r.$&&"Just"===r.a.$){var p=r.a.a,g=l(rI,d,p,t),v=function(){var e=_(p,f(sf,d,t.trades));if("Just"===e.b.$){if("Committed"===e.a.$){var r=(e.a,e.b.a),n=Vw(r);if("Just"===n.$){var a=n.a;return _(l(FS,c,a.address,hI(d)),vr)}return _(Vo,M([ya(f(up,"Phase fetched for a trade that has no creationInfo",r))]))}return _(Vo,vr)}e.b;return _(Vo,M([ya(f(up,"Phase fetched for a trade, but then ran into an out-of-range error",li))]))}(),y=v.a,m=v.b;return l(Xw,g.tradeCache,Fo(M([g.cmd,y])),f(co,g.cmdUps,m))};return l(Xw,t,Vo,M([ya(f(ww,"phase",r))]));case"NumTradesFetchedAgain":var r=e.a,b=_(r,t.dataFetchState.total);if("Ok"===b.a.$){if("Just"===b.b.$){var n=b.a.a,C=b.b.a,E=KS(n);if(x(C,E)<0){var S=t.dataFetchState,o=Fo(f(Ua,function(e){return l(lC,t.factory,Zu(e),oI(e))},f(ki,C,E-1))),T=qS(f(Ua,eC(t.factory),f(ki,C,E-1)));return l(Xw,D(t,{dataFetchState:D(S,{total:fi(E)}),trades:f(kT,t.trades,T)}),o,vr)}return pI(t)}b.b;return l(Xw,t,Vo,M([ya(f(up,"Trying to fetch additional trades, but there is an unexpected Nothing in the existing numTrades.",""))]))}var u=b.a.a;return l(Xw,t,Vo,M([ya(f(ym,"Factory numTrades",u))]));case"CreationInfoFetched":var d=e.a,r=e.b;if("Ok"===r.$){var w=r.a,I=f(Fw,w.address_,KS(w.blocknum)),A=l(Hw,t.eventSentry,I,sI(d)),B=A.a,k=A.b,y=Fo(M([h(VS,t.factory,I.address,fI(d),hI(d),dI(d)),k])),N=l(eI,d,I,t),$=N.a,R=N.b;return l(Xw,Qw(D($,{eventSentry:B})),y,f(Ua,ya,R))}var u=r.a;return l(Xw,t,Vo,M([ya(f(ym,"creationInfo",u))]));case"ParametersFetched":var d=e.a,r=e.b;if("Err"===r.$){var L=r.a;return l(Xw,t,Vo,M([ya(f(ym,"parameters",L))]))}if("Ok"===r.a.$){var P=r.a.a;return l(tI,d,P,t)}var U=r.a.a;return l(Xw,t,Vo,M([ya(f(up,"Can't decode fetched trade parameters",U))]));case"StateFetched":var d=e.a,r=e.b;if("Ok"===r.$&&"Just"===r.a.$){var O=r.a.a;return l(aI,d,O,t)}return l(Xw,t,Vo,M([ya(f(ww,"state",r))]));case"PhaseStartInfoFetched":var d=e.a,r=e.b;if("Ok"===r.$&&"Just"===r.a.$){var F=r.a.a;return l(nI,d,F,t)}return l(Xw,t,Vo,M([ya(f(ww,"phaseStartInfo",r))]));case"InitiatedEventDataFetched":var d=e.a,r=e.b;if("Ok"===r.$){var V=r.a,K=BE(V.terms);if("Ok"===K.$){var H=K.a;return l(iI,d,H,t)}var j=K.a;return f(Zw,d,t)}var j=r.a;return l(Xw,t,Vo,M([ya(f(up,"Error decoding initiated event",j))]));default:var q=e.a,G=f(Uw,q,t.eventSentry),z=G.a,y=G.b;return l(Xw,D(t,{eventSentry:z}),y,vr)}}),vI=function(e){return{$:"AgentHistoryModel",a:e}},yI=function(e){return{$:"AgentHistoryMsg",a:e}},mI=function(e){return{$:"CmdUp",a:e}},bI={$:"ConnectToWeb3"},CI=function(e){return{$:"CreateModel",a:e}},EI=function(e){return{$:"CreateMsg",a:e}},SI=function(e){return{$:"GotoRoute",a:e}},TI=function(e){return{$:"MarketplaceModel",a:e}},wI=function(e){return{$:"MarketplaceMsg",a:e}},II=r(function(e,t){return{$:"TradeCacheMsg",a:e,b:t}}),AI=function(e){return{$:"TradeModel",a:e}},BI=function(e){return{$:"TradeMsg",a:e}},kI=r(function(e,t){return f(Nn,e,cp(t))}),NI=function(e){return f(kI,"href",nt(e))},$I=$n("rel"),RI=kI("target"),xI=function(e){return{$:"Height",a:e}},_I=xI,LI={$:"Content"},PI=LI,DI=function(e){return{$:"Width",a:e}},UI=DI,OI=function(e){return{$:"Attr",a:e}},MI=function(e){return{$:"NodeName",a:e}},FI=function(e){return{$:"Unkeyed",a:e}},VI={$:"AsEl"},KI=VI,HI=r(function(e,t){return{$:"Field",a:e,b:t}}),jI=f(HI,0,0),qI={$:"NoNearbyChildren"},GI={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",focusedWithin:"focus-within",fullSize:"fs",grid:"g",hasBehind:"hbh",heightContent:"hc",heightExact:"he",heightFill:"hf",heightFillPortion:"hfp",hover:"hv",imageContainer:"ic",inFront:"fr",inputMultiline:"iml",inputMultilineFiller:"imlf",inputMultilineParent:"imlp",inputMultilineWrapper:"implw",inputText:"it",italic:"i",link:"lnk",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"},zI=GI.any+" "+GI.column,WI=GI.any+" "+GI.grid,YI=GI.any+" "+GI.page,JI=GI.any+" "+GI.paragraph,QI=GI.any+" "+GI.row,XI=GI.any+" "+GI.single,ZI=function(e){switch(e.$){case"AsRow":return QI;case"AsColumn":return zI;case"AsEl":return XI;case"AsGrid":return WI;case"AsParagraph":return JI;default:return YI}},eA=function(e){return{$:"Keyed",a:e}},tA={$:"NoStyleSheet"},rA=r(function(e,t){switch(t.$){case"NoNearbyChildren":return e;case"ChildrenBehind":var r=t.a;return U(r,e);case"ChildrenInFront":var n=t.a;return U(e,n);default:var r=t.a,n=t.b;return U(r,U(e,n))}}),nA=n(function(e,t,r){switch(r.$){case"NoNearbyChildren":return t;case"ChildrenBehind":var n=r.a;return U(f(Ua,function(t){return _(e,t)},n),t);case"ChildrenInFront":var a=r.a;return U(t,f(Ua,function(t){return _(e,t)},a));default:var n=r.a,a=r.b;return U(f(Ua,function(t){return _(e,t)},n),U(t,f(Ua,function(t){return _(e,t)},a)))}}),aA={$:"AsParagraph"},iA=aA,oA=Tn("div"),uA=Tn("p"),sA=Tn("s"),cA=Tn("u"),fA=kI("className"),lA=function(e){return In(et(e))},dA=function(e){return Tn(et(e))},hA=function(e){return{$:"Flag",a:e}},pA=function(e){return{$:"Second",a:e}},gA=function(e){return e>31?pA(1< .ctr > ."+GI.any+" {\n border: 4px dashed rgb(0, 151, 167) !important;\n}\n\n",vB="@media screen and (-ms-high-contrast: active), (-ms-high-contrast: none) {"+DA(GI.any)+DA(GI.row)+" > "+DA(GI.any)+" { flex-basis: auto !important; } "+DA(GI.any)+DA(GI.row)+" > "+DA(GI.any)+DA(GI.container)+' { flex-basis: auto !important; }}\ninput[type="search"],\ninput[type="search"]::-webkit-search-decoration,\ninput[type="search"]::-webkit-search-cancel-button,\ninput[type="search"]::-webkit-search-results-button,\ninput[type="search"]::-webkit-search-results-decoration {\n -webkit-appearance:none;\n}\n\ninput[type=range] {\n -webkit-appearance: none; \n background: transparent;\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\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\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'+gB,yB=function(e){return{$:"Intermediate",a:e}},mB=r(function(e,t){return yB({closing:t,others:vr,props:vr,selector:e})}),bB=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 D(t,{props:f(Ra,_(r,a),t.props)});case"Supports":var i=e.a,o=i.a,u=i.b,s=e.b;return D(t,{others:f(Ra,yB({closing:"\n}",others:vr,props:s,selector:"@supports ("+o+":"+u+") {"+n.selector}),t.others)});case"Adjacent":var c=e.a,l=e.b;return D(t,{others:f(Ra,f(bB,f(mB,n.selector+" + "+c,""),l),t.others)});case"Child":var d=e.a,h=e.b;return D(t,{others:f(Ra,f(bB,f(mB,n.selector+" > "+d,""),h),t.others)});case"Descriptor":var p=e.a,g=e.b;return D(t,{others:f(Ra,f(bB,f(mB,U(n.selector,p),""),g),t.others)});default:var v=e.a;return D(t,{others:f(Ra,f(bB,f(mB,n.selector,""),v),t.others)})}});return yB(l(Da,a,n,t))}),CB=U(vB,function(e){var t=function(e){return qy(f(Ua,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 U(n(t),qy(f(Ua,a,t.others)))};return qy(f(Ua,a,l(Da,r(function(e,t){var r=e.a,n=e.b;return f(Ra,f(bB,f(mB,r,""),n),t)}),vr,e)))}(U(dB,pB))),EB=function(e){switch(e.mode.$){case"Layout":return l(dA,"div",vr,M([l(dA,"style",vr,M([MA(CB)]))]));case"NoStaticStyleSheet":return MA("");default:return l(dA,"elm-ui-static-rules",M([f(OA,"rules",cp(CB))]),vr)}},SB=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+'"'}},TB=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}},wB=function(e){if("FontWith"===e.$){var t=e.a;return f(fo,TB,t.variants)}return!1},IB=n(function(e,t,r){var n=t.a,a=t.b;return e?r+"\n "+n+": "+a+" !important;":r+"\n "+n+": "+a+";"}),AB=a(function(e,t,r,n){if("Nothing"===t.$)return M([r+"{"+l(_a,IB(!1),"",n)+"\n}"]);switch(t.a.$){case"Hover":switch(e.hover.$){case"NoHover":return vr;case"ForceHover":return M([r+"-hv {"+l(_a,IB(!0),"",n)+"\n}"]);default:return M([r+"-hv:hover {"+l(_a,IB(!1),"",n)+"\n}"])}case"Focus":var a=l(_a,IB(!1),"",n);return M([r+"-fs:focus {"+a+"\n}","."+GI.any+":focus ~ "+r+"-fs:not(.focus) {"+a+"\n}","."+GI.any+":focus "+r+"-fs {"+a+"\n}",r+"-fs:focus-within {"+a+"\n}",".focusable-parent:focus ~ ."+GI.any+" "+r+"-fs {"+a+"\n}"]);default:return M([r+"-act:active {"+l(_a,IB(!1),"",n)+"\n}"])}}),BB=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+'" '+Ri(r)}},kB=function(e){if("FontWith"===e.$){var t=e.a;return fi(f(xi,", ",f(Ua,BB,t.variants)))}return li},NB=function(e){switch(e.$){case"Untransformed":return li;case"Moved":var t=e.a,r=t.a,n=t.b,a=t.c;return fi("translate3d("+uy(r)+"px, "+uy(n)+"px, "+uy(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("+uy(o)+"px, "+uy(u)+"px, "+uy(s)+"px)",b="scale3d("+uy(f)+", "+uy(l)+", "+uy(d)+")",C="rotate3d("+uy(p)+", "+uy(g)+", "+uy(v)+", "+uy(y)+"rad)";return fi(m+" "+b+" "+C)}},$B=n(function(e,t,r){switch(t.$){case"Style":var a=t.a,i=t.b;return d(AB,e,r,a,i);case"Shadows":var o=t.a,u=t.b;return d(AB,e,r,"."+o,M([f(xA,"box-shadow",u)]));case"Transparency":var o=t.a,s=t.b,c=f(ni,0,f(Rc,1,1-s));return d(AB,e,r,"."+o,M([f(xA,"opacity",uy(c))]));case"FontSize":var h=t.a;return d(AB,e,r,".font-size-"+Ri(h),M([f(xA,"font-size",Ri(h)+"px")]));case"FontFamily":var o=t.a,p=t.b,g=f(xi,", ",f(_h,kB,p)),v=M([f(xA,"font-family",f(xi,", ",f(Ua,SB,p))),f(xA,"font-feature-settings",g),f(xA,"font-variant",f(fo,wB,p)?"small-caps":"normal")]);return d(AB,e,r,"."+o,v);case"Single":var y=t.a,u=t.b,m=t.c;return d(AB,e,r,"."+y,M([f(xA,u,m)]));case"Colored":var y=t.a,u=t.b,b=t.c;return d(AB,e,r,"."+y,M([f(xA,u,LA(b))]));case"SpacingStyle":var C=t.a,E=t.b,S=t.c,T=Ri(S)+"px",w=Ri(E)+"px",I="."+GI.row,A="."+(GI.wrapped+I),B="."+GI.alignRight,k="."+GI.paragraph,N="."+GI.page,$="."+GI.alignLeft,R=uy(S/2)+"px",x=uy(E/2)+"px",L="."+GI.column,y="."+C,P="."+GI.any;return kb(M([d(AB,e,r,y+(I+" > ")+P+" + "+P,M([f(xA,"margin-left",w)])),d(AB,e,r,y+(A+" > ")+P,M([f(xA,"margin",R+" "+x)])),d(AB,e,r,y+(L+" > ")+P+" + "+P,M([f(xA,"margin-top",T)])),d(AB,e,r,y+(N+" > ")+P+" + "+P,M([f(xA,"margin-top",T)])),d(AB,e,r,y+(N+" > ")+$,M([f(xA,"margin-right",w)])),d(AB,e,r,y+(N+" > ")+B,M([f(xA,"margin-left",w)])),d(AB,e,r,U(y,k),M([f(xA,"line-height","calc(1em + "+Ri(S)+"px)")])),d(AB,e,r,"textarea"+(P+y),M([f(xA,"line-height","calc(1em + "+Ri(S)+"px)"),f(xA,"height","calc(100% + "+Ri(S)+"px)")])),d(AB,e,r,y+(k+" > ")+$,M([f(xA,"margin-right",w)])),d(AB,e,r,y+(k+" > ")+B,M([f(xA,"margin-left",w)])),d(AB,e,r,y+(k+"::after"),M([f(xA,"content","''"),f(xA,"display","block"),f(xA,"height","0"),f(xA,"width","0"),f(xA,"margin-top",Ri(-1*(S/2|0))+"px")])),d(AB,e,r,y+(k+"::before"),M([f(xA,"content","''"),f(xA,"display","block"),f(xA,"height","0"),f(xA,"width","0"),f(xA,"margin-bottom",Ri(-1*(S/2|0))+"px")]))]));case"PaddingStyle":var C=t.a,D=t.b,B=t.c,O=t.d,$=t.e,y="."+C;return d(AB,e,r,y,M([f(xA,"padding",Ri(D)+"px "+Ri(B)+"px "+Ri(O)+"px "+Ri($)+"px")]));case"BorderWidth":var C=t.a,D=t.b,B=t.c,O=t.d,$=t.e,y="."+C;return d(AB,e,r,y,M([f(xA,"border-width",Ri(D)+"px "+Ri(B)+"px "+Ri(O)+"px "+Ri($)+"px")]));case"GridTemplateStyle":var F=t.a,V=n(function(e,t,r){e:for(;;)switch(r.$){case"Px":var n=r.a;return Ri(n)+"px";case"Content":var a=_(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, "+Ri(i)+"px)"}if("Nothing"===a.b.$){var o=a.a.a;a.b;return"minmax("+Ri(o)+"px, max-content)"}var o=a.a.a,i=a.b.a;return"minmax("+Ri(o)+"px, "+Ri(i)+"px)";case"Fill":var u=r.a,s=_(e,t);if("Nothing"===s.a.$){if("Nothing"===s.b.$){s.a,s.b;return Ri(u)+"fr"}var i=(s.a,s.b.a);return"minmax(max-content, "+Ri(i)+"px)"}if("Nothing"===s.b.$){var o=s.a.a;s.b;return"minmax("+Ri(o)+"px, "+Ri(u)+"frfr)"}var o=s.a.a,i=s.b.a;return"minmax("+Ri(o)+"px, "+Ri(i)+"px)";case"Min":var c=r.a,f=r.b,l=fi(c),d=t,h=f;e=l,t=d,r=h;continue e;default:var c=r.a,f=r.b,l=e,d=fi(c),h=f;e=l,t=d,r=h;continue e}}),K=function(e){return l(V,li,li,e)},H=(K(F.spacing.a),K(F.spacing.b)),j=function(e){return"grid-template-rows: "+e+";"}(f(xi," ",f(Ua,K,F.rows))),q=function(e){return"-ms-grid-rows: "+e+";"}(f(xi,H,f(Ua,K,F.columns))),G=function(e){return"-ms-grid-columns: "+e+";"}(f(xi,H,f(Ua,K,F.columns))),z="grid-row-gap:"+K(F.spacing.b)+";",W="grid-column-gap:"+K(F.spacing.a)+";",Y=function(e){return"grid-template-columns: "+e+";"}(f(xi," ",f(Ua,K,F.columns))),y=".grid-rows-"+f(xi,"-",f(Ua,BA,F.rows))+"-cols-"+f(xi,"-",f(Ua,BA,F.columns))+"-space-x-"+BA(F.spacing.a)+"-space-y-"+BA(F.spacing.b),J=y+"{"+Y+j+W+z+"}",Q="@supports (display:grid) {"+J+"}",X=y+"{"+G+q+"}";return M([X,Q]);case"GridPosition":var Z=t.a,ee=f(xi," ",M(["-ms-grid-row: "+Ri(Z.row)+";","-ms-grid-row-span: "+Ri(Z.height)+";","-ms-grid-column: "+Ri(Z.col)+";","-ms-grid-column-span: "+Ri(Z.width)+";"])),te=f(xi," ",M(["grid-row: "+Ri(Z.row)+" / "+Ri(Z.row+Z.height)+";","grid-column: "+Ri(Z.col)+" / "+Ri(Z.col+Z.width)+";"])),y=".grid-pos-"+Ri(Z.row)+"-"+Ri(Z.col)+"-"+Ri(Z.width)+"-"+Ri(Z.height),J=y+"{"+te+"}",Q="@supports (display:grid) {"+J+"}",X=y+"{"+ee+"}";return M([X,Q]);case"PseudoSelector":var y=t.a,re=t.b;return f(Nb,function(t){return l($B,e,t,fi(y))},re);default:var ne=t.a,m=NB(ne),y=NA(ne),ae=_(y,m);if("Just"===ae.a.$&&"Just"===ae.b.$){var C=ae.a.a,ie=ae.b.a;return d(AB,e,r,"."+C,M([f(xA,"transform",ie)]))}return vr}}),RB=r(function(e,t){return vp(f(Ua,function(t){var r=l($B,e,t,li);return _($A(t),f(av,cp,r))},t))}),xB=r(function(e,t){return e+" {"+f(xi,"",f(Ua,function(e){return e.a+": "+e.b+";"},t))+"}"}),_B=n(function(e,t,r){var n=r.a,a=r.b;return M([f(xB,"."+e+"."+t+", ."+e+" ."+t,n),f(xB,"."+e+"."+t+"> ."+GI.text+", ."+e+" ."+t+" > ."+GI.text,a)])}),LB=n(function(e,t,r){var n=t.a,a=t.b,i=$(e,r)?e:r+" ."+e;return f(xi," ",U(l(_B,i,GI.sizeByCapital,a),l(_B,i,GI.fullSize,n)))}),PB=r(function(e,t){var r=$(e,t)?e:t+" ."+e;return f(xi," ",M([f(xB,"."+r+"."+GI.sizeByCapital+", ."+r+" ."+GI.sizeByCapital,M([_("line-height","1")])),f(xB,"."+r+"."+GI.sizeByCapital+"> ."+GI.text+", ."+r+" ."+GI.sizeByCapital+" > ."+GI.text,M([_("vertical-align","0"),_("line-height","1")]))]))}),DB=function(e){if(e.b){var t=e.a,r=e.b;return fi(l(_a,ni,t,r))}return li},UB=function(e){if(e.b){var t=e.a,r=e.b;return fi(l(_a,Rc,t,r))}return li},OB=n(function(e,t,r){return{height:t/e,size:e,vertical:r}}),MB=function(e){var t=M([e.capital,e.baseline,e.descender,e.lowercase]),r=f(Kc,e.descender,UB(t)),n=f(Kc,e.baseline,UB(f(pp,function(e){return!$(e,r)},t))),a=f(Kc,e.capital,DB(t)),i=1/(a-n),o=1-a,u=1/(a-r),s=1-a;return{capital:l(OB,i,a-n,o),full:l(OB,u,a-r,s)}},FB=function(e){return _(M([_("display","block")]),M([_("display","inline-block"),_("line-height",uy(e.height)),_("vertical-align",uy(e.vertical)+"em"),_("font-size",uy(e.size)+"em")]))},VB=function(e){return l(_a,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 fi(_(FB(function(e){return e.full}(MB(a))),FB(function(e){return e.capital}(MB(a)))))}return t}return t}),li,e)},KB=function(e){var t=function(e){if("ImportFont"===e.$){var t=e.b;return fi("@import url('"+t+"');")}return li},r=function(e){var r=(e.a,e.b);return f(xi,"\n",f(_h,t,r))},n=f(Ua,ei,e),a=function(e){var t=e.a,r=e.b,a=VB(r);if("Nothing"===a.$)return f(xi,"",f(Ua,PB(t),n));var i=a.a;return f(xi,"",f(Ua,f(LB,t,i),n))};return U(f(xi,"\n",f(Ua,r,e)),f(xi,"\n",f(Ua,a,e)))},HB=function(e){if("FontFamily"===e.$){var t=e.a,r=e.b;return fi(_(t,r))}return li},jB=r(function(e,t){var n=r(function(t,r){return{rules:U(r.rules,l($B,e,t,li)),topLevel:function(){var e=HB(t);if("Nothing"===e.$)return r.topLevel;var n=e.a;return f(Ra,n,r.topLevel)}()}}),a=l(_a,n,{rules:vr,topLevel:vr},t),i=a.topLevel,o=a.rules;return U(KB(i),qy(o))}),qB=r(function(e,t){switch(e.mode.$){case"Layout":case"NoStaticStyleSheet":return l(dA,"div",vr,M([l(dA,"style",vr,M([MA(f(jB,e,t))]))]));default:return l(dA,"elm-ui-rules",M([f(OA,"rules",f(RB,e,t))]),vr)}}),GB=a(function(e,t,r,n){var a=f(qB,t,l(_a,RA,_(mC,UA(t.focus)),r).b);return e?f(Ra,_("static-stylesheet",EB(t)),f(Ra,_("dynamic-stylesheet",a),n)):f(Ra,_("dynamic-stylesheet",a),n)}),zB=a(function(e,t,r,n){var a=f(qB,t,l(_a,RA,_(mC,UA(t.focus)),r).b);return e?f(Ra,EB(t),f(Ra,a,n)):f(Ra,a,n)}),WB=o(function(e,t,n,a,i,o){var u=r(function(e,t){if("Keyed"===a.$){var r=a.a;return l(lA,e,t,function(){switch(i.$){case"NoStyleSheet":return r;case"OnlyDynamic":var e=i.a,t=i.b;return d(GB,!1,e,t,r);default:var e=i.a,t=i.b;return d(GB,!0,e,t,r)}}())}var n=a.a;return f(function(){switch(e){case"div":return oA;case"p":return uA;default:return dA(e)}}(),t,function(){switch(i.$){case"NoStyleSheet":return n;case"OnlyDynamic":var e=i.a,t=i.b;return d(zB,!1,e,t,n);default:var e=i.a,t=i.b;return d(zB,!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(dA,e,n,M([f(u,r,M([fA(GI.any+" "+GI.single)]))]))}}();switch(o.$){case"AsRow":return f(SA,wA,e)&&!f(SA,TA,e)?s:f(SA,yA,e)?f(cA,M([fA(f(xi," ",M([GI.any,GI.single,GI.container,GI.contentCenterY,GI.alignContainerRight])))]),M([s])):f(SA,mA,e)?f(sA,M([fA(f(xi," ",M([GI.any,GI.single,GI.container,GI.contentCenterY,GI.alignContainerCenterX])))]),M([s])):s;case"AsColumn":return f(SA,EA,e)&&!f(SA,CA,e)?s:f(SA,bA,e)?f(sA,M([fA(f(xi," ",M([GI.any,GI.single,GI.container,GI.alignContainerCenterY])))]),M([s])):f(SA,vA,e)?f(cA,M([fA(f(xi," ",M([GI.any,GI.single,GI.container,GI.alignContainerBottom])))]),M([s])):s;default:return s}}),YB=MA,JB=GI.any+" "+GI.text+" "+GI.widthContent+" "+GI.heightContent,QB=function(e){return f(oA,M([fA(JB)]),M([YB(e)]))},XB=GI.any+" "+GI.text+" "+GI.widthFill+" "+GI.heightFill,ZB=function(e){return f(oA,M([fA(XB)]),M([YB(e)]))},ek=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,iA),_(f(Ra,_(n,u(e)),i),o);case"Styled":var s=a.a;return $(e,iA),_(f(Ra,_(n,f(s.html,tA,e)),i),_u(o)?s.styles:U(s.styles,o));case"Text":var c=a.a;return _(f(Ra,_(n,$(e,KI)?ZB(c):QB(c)),i),o);default:return _(i,o)}}),i=r(function(t,r){var n=r.a,a=r.b;switch(t.$){case"Unstyled":var i=t.a;return $(e,iA),_(f(Ra,i(e),n),a);case"Styled":var o=t.a;return $(e,iA),_(f(Ra,f(o.html,tA,e),n),_u(a)?o.styles:U(o.styles,a));case"Text":var u=t.a;return _(f(Ra,$(e,KI)?ZB(u):QB(u),n),a);default:return _(n,a)}});if("Keyed"===t.$){var o=t.a,u=l(Da,a,_(vr,vr),o),s=u.a,c=u.b,p=_u(c)?n.styles:U(n.styles,c);if(p.b){var g=p;return Gi({html:d(WB,n.has,n.node,n.attributes,eA(l(nA,"nearby-element-pls",s,n.children))),styles:g})}return Wi(h(WB,n.has,n.node,n.attributes,eA(l(nA,"nearby-element-pls",s,n.children)),tA))}var v=t.a,y=l(Da,i,_(vr,vr),v),m=y.a,c=y.b,p=_u(c)?n.styles:U(n.styles,c);if(p.b){var g=p;return Gi({html:d(WB,n.has,n.node,n.attributes,FI(f(rA,m,n.children))),styles:g})}return Wi(h(WB,n.has,n.node,n.attributes,FI(f(rA,m,n.children)),tA))}),tk=r(function(e,t){return f($n,tt(e),at(t))}),rk=r(function(e,t){var r=t.a,n=t.b;if("Flag"===e.$){var a=e.a;return f(HI,a|r,n)}var i=e.a;return f(HI,r,i|n)}),nk=gA(7),ak=gA(36),ik=r(function(e,t){var r=e.a,n=e.b,a=t.a,i=t.b;return f(HI,r|a,n|i)}),ok=gA(6),uk=gA(38),sk=gA(30),ck=gA(29),fk=n(function(e,t,r){return{$:"Single",a:e,b:t,c:r}}),lk=function(e){return{$:"Transform",a:e}},dk=function(e){return{$:"ChildrenBehind",a:e}},hk=r(function(e,t){return{$:"ChildrenBehindAndInFront",a:e,b:t}}),pk=function(e){return{$:"ChildrenInFront",a:e}},gk=r(function(e,t){return f(oA,M([fA(function(){switch(e.$){case"Above":return f(xi," ",M([GI.nearby,GI.single,GI.above]));case"Below":return f(xi," ",M([GI.nearby,GI.single,GI.below]));case"OnRight":return f(xi," ",M([GI.nearby,GI.single,GI.onRight]));case"OnLeft":return f(xi," ",M([GI.nearby,GI.single,GI.onLeft]));case"InFront":return f(xi," ",M([GI.nearby,GI.single,GI.inFront]));default:return f(xi," ",M([GI.nearby,GI.single,GI.behind]))}}())]),M([function(){switch(t.$){case"Empty":return MA("");case"Text":var e=t.a;return QB(e);case"Unstyled":return(0,t.a)(KI);default:return f(t.a.html,tA,KI)}}()]))}),vk=n(function(e,t,r){var n=f(gk,e,t);switch(r.$){case"NoNearbyChildren":return"Behind"===e.$?dk(M([n])):pk(M([n]));case"ChildrenBehind":var a=r.a;return"Behind"===e.$?dk(f(Ra,n,a)):f(hk,a,M([n]));case"ChildrenInFront":var i=r.a;return"Behind"===e.$?f(hk,M([n]),i):pk(f(Ra,n,i));default:var a=r.a,i=r.b;return"Behind"===e.$?f(hk,f(Ra,n,a),i):f(hk,a,f(Ra,n,i))}}),yk=r(function(e,t){return{$:"Embedded",a:e,b:t}}),mk=r(function(e,t){switch(t.$){case"Generic":return MI(e);case"NodeName":var r=t.a;return f(yk,r,e);default:var n=t.a,a=t.b;return f(yk,n,a)}}),bk=function(e){switch(e.$){case"Left":return GI.alignedHorizontally+" "+GI.alignLeft;case"Right":return GI.alignedHorizontally+" "+GI.alignRight;default:return GI.alignedHorizontally+" "+GI.alignCenterX}},Ck=function(e){switch(e.$){case"Top":return GI.alignedVertically+" "+GI.alignTop;case"Bottom":return GI.alignedVertically+" "+GI.alignBottom;default:return GI.alignedVertically+" "+GI.alignCenterY}},Ek=a(function(e,t,r,n){return{$:"FullTransform",a:e,b:t,c:r,d:n}}),Sk=function(e){return{$:"Moved",a:e}},Tk=r(function(e,t){switch(e.$){case"Untransformed":switch(t.$){case"MoveX":var r=t.a;return Sk(L(r,0,0));case"MoveY":var n=t.a;return Sk(L(0,n,0));case"MoveZ":var a=t.a;return Sk(L(0,0,a));case"MoveXYZ":var i=t.a;return Sk(i);case"Rotate":var i=t.a,o=t.b;return d(Ek,L(0,0,0),L(1,1,1),i,o);default:var i=t.a;return d(Ek,L(0,0,0),i,L(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 Sk(L(s,n,a));case"MoveY":var c=t.a;return Sk(L(r,c,a));case"MoveZ":var f=t.a;return Sk(L(r,n,f));case"MoveXYZ":var i=t.a;return Sk(i);case"Rotate":var i=t.a,o=t.b;return d(Ek,u,L(1,1,1),i,o);default:var l=t.a;return d(Ek,u,l,L(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(Ek,L(s,n,a),h,p,o);case"MoveY":var c=t.a;return d(Ek,L(r,c,a),h,p,o);case"MoveZ":var f=t.a;return d(Ek,L(r,n,f),h,p,o);case"MoveXYZ":var g=t.a;return d(Ek,g,h,p,o);case"Rotate":var v=t.a,y=t.b;return d(Ek,u,h,v,y);default:var m=t.a;return d(Ek,u,m,p,o)}}}),wk=function(e){switch(e.$){case"Px":var t=e.a,r=Ri(t),n="height-px-"+r;return L(jI,GI.heightExact+" "+n,M([l(fk,n,"height",r+"px")]));case"Content":return L(f(rk,ak,jI),GI.heightContent,vr);case"Fill":var a=e.a;return 1===a?L(f(rk,EA,jI),GI.heightFill,vr):L(f(rk,EA,jI),GI.heightFillPortion+" height-fill-"+Ri(a),M([l(fk,GI.any+"."+GI.column+" > "+DA("height-fill-"+Ri(a)),"flex-grow",Ri(1e5*a))]));case"Min":var i=e.a,o=e.b,u="min-height-"+Ri(i),s=l(fk,u,"min-height",Ri(i)+"px"),c=wk(o),d=c.a,h=c.b,p=c.c;return L(f(rk,CA,d),u+" "+h,f(Ra,s,p));default:var g=e.a,o=e.b,u="max-height-"+Ri(g),s=l(fk,u,"max-height",Ri(g)+"px"),v=wk(o),d=v.a,h=v.b,p=v.c;return L(f(rk,CA,d),u+" "+h,f(Ra,s,p))}},Ik=function(e){switch(e.$){case"Px":var t=e.a;return L(jI,GI.widthExact+" width-px-"+Ri(t),M([l(fk,"width-px-"+Ri(t),"width",Ri(t)+"px")]));case"Content":return L(f(rk,uk,jI),GI.widthContent,vr);case"Fill":var r=e.a;return 1===r?L(f(rk,wA,jI),GI.widthFill,vr):L(f(rk,wA,jI),GI.widthFillPortion+" width-fill-"+Ri(r),M([l(fk,GI.any+"."+GI.row+" > "+DA("width-fill-"+Ri(r)),"flex-grow",Ri(1e5*r))]));case"Min":var n=e.a,a=e.b,i="min-width-"+Ri(n),o=l(fk,i,"min-width",Ri(n)+"px"),u=Ik(a),s=u.a,c=u.b,d=u.c;return L(f(rk,TA,s),i+" "+c,f(Ra,o,d));default:var h=e.a,a=e.b,i="max-width-"+Ri(h),o=l(fk,i,"max-width",Ri(h)+"px"),p=Ik(a),s=p.a,c=p.b,d=p.c;return L(f(rk,TA,s),i+" "+c,f(Ra,o,d))}},Ak=gA(27),Bk=r(function(e,t){if($(e,Ak)){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}}),kk=s(function(e,t,r,n,a,i,o,u){e:for(;;){if(!u.b){var s=NA(n);if("Nothing"===s.$)return{attributes:f(Ra,fA(e),i),children:o,has:r,node:t,styles:a};var c=s.a;return{attributes:f(Ra,fA(e+" "+c),i),children:o,has:r,node:t,styles:f(Ra,lk(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,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;case"Class":var S=d.a,T=d.b;if(f(SA,S,r)){var p=e,g=t,v=r,y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e}var p=T+" "+e,g=t,v=f(rk,S,r),y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;case"Attr":var w=d.a,p=e,g=t,v=r,y=n,m=a,b=f(Ra,w,i),C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;case"StyleClass":var S=d.a,I=d.b;if(f(SA,S,r)){var p=e,g=t,v=r,y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e}if(f(Bk,S,I)){var p=$A(I)+" "+e,g=t,v=f(rk,S,r),y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e}var p=$A(I)+" "+e,g=t,v=f(rk,S,r),y=n,m=f(Ra,I,a),b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;case"TransformComponent":var S=d.a,A=d.b,p=e,g=t,v=f(rk,S,r),y=f(Tk,n,A),m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;case"Width":var B=d.a;if(f(SA,ok,r)){var p=e,g=t,v=r,y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e}switch(B.$){case"Px":var k=B.a,p=GI.widthExact+" width-px-"+Ri(k)+" "+e,g=t,v=f(rk,ok,r),y=n,m=f(Ra,l(fk,"width-px-"+Ri(k),"width",Ri(k)+"px"),a),b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;case"Content":var p=e+" "+GI.widthContent,g=t,v=f(rk,uk,f(rk,ok,r)),y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;case"Fill":var N=B.a;if(1===N){var p=e+" "+GI.widthFill,g=t,v=f(rk,wA,f(rk,ok,r)),y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e}var p=e+" "+GI.widthFillPortion+" width-fill-"+Ri(N),g=t,v=f(rk,wA,f(rk,ok,r)),y=n,m=f(Ra,l(fk,GI.any+"."+GI.row+" > "+DA("width-fill-"+Ri(N)),"flex-grow",Ri(1e5*N)),a),b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;default:var $=Ik(B),R=$.a,x=$.b,_=$.c,p=e+" "+x,g=t,v=f(ik,R,f(rk,ok,r)),y=n,m=U(_,a),b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e}case"Height":var L=d.a;if(f(SA,nk,r)){var p=e,g=t,v=r,y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e}switch(L.$){case"Px":var k=L.a,P=Ri(k)+"px",D="height-px-"+P,p=GI.heightExact+" "+D+" "+e,g=t,v=f(rk,nk,r),y=n,m=f(Ra,l(fk,D,"height ",P),a),b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;case"Content":var p=GI.heightContent+" "+e,g=t,v=f(rk,ak,f(rk,nk,r)),y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;case"Fill":var N=L.a;if(1===N){var p=GI.heightFill+" "+e,g=t,v=f(rk,EA,f(rk,nk,r)),y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e}var p=e+" "+GI.heightFillPortion+" height-fill-"+Ri(N),g=t,v=f(rk,EA,f(rk,nk,r)),y=n,m=f(Ra,l(fk,GI.any+"."+GI.column+" > "+DA("height-fill-"+Ri(N)),"flex-grow",Ri(1e5*N)),a),b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;default:var O=wk(L),R=O.a,x=O.b,_=O.c,p=e+" "+x,g=t,v=f(ik,R,f(rk,nk,r)),y=n,m=U(_,a),b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e}case"Describe":var M=d.a;switch(M.$){case"Main":var p=e,g=f(mk,"main",t),v=r,y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;case"Navigation":var p=e,g=f(mk,"nav",t),v=r,y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;case"ContentInfo":var p=e,g=f(mk,"footer",t),v=r,y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;case"Complementary":var p=e,g=f(mk,"aside",t),v=r,y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;case"Heading":var F=M.a;if(F<=1){var p=e,g=f(mk,"h1",t),v=r,y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e}if(F<7){var p=e,g=f(mk,"h"+Ri(F),t),v=r,y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e}var p=e,g=f(mk,"h6",t),v=r,y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;case"Paragraph":var p=e,g=t,v=r,y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;case"Button":var p=e,g=t,v=r,y=n,m=a,b=f(Ra,f(tk,"role","button"),i),C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;case"Label":var V=M.a,p=e,g=t,v=r,y=n,m=a,b=f(Ra,f(tk,"aria-label",V),i),C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;case"LivePolite":var p=e,g=t,v=r,y=n,m=a,b=f(Ra,f(tk,"aria-live","polite"),i),C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;default:var p=e,g=t,v=r,y=n,m=a,b=f(Ra,f(tk,"aria-live","assertive"),i),C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e}case"Nearby":var K=d.a,H=d.b,_=function(){switch(H.$){case"Empty":return a;case"Text":H.a;return a;case"Unstyled":H.a;return a;default:var e=H.a;return U(a,e.styles)}}(),p=e,g=t,v=r,y=n,m=_,b=i,C=l(vk,K,H,o),E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;case"AlignX":var j=d.a;if(f(SA,sk,r)){var p=e,g=t,v=r,y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e}var p=bk(j)+" "+e,g=t,v=function(e){switch(j.$){case"CenterX":return f(rk,mA,e);case"Right":return f(rk,yA,e);default:return e}}(f(rk,sk,r)),y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;default:var q=d.a;if(f(SA,ck,r)){var p=e,g=t,v=r,y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e}var p=Ck(q)+" "+e,g=t,v=function(e){switch(q.$){case"CenterY":return f(rk,bA,e);case"Bottom":return f(rk,vA,e);default:return e}}(f(rk,ck,r)),y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e}}}),Nk={$:"Untransformed"},$k=Nk,Rk=a(function(e,t,r,n){return l(ek,e,n,v(kk,ZI(e),t,jI,$k,vr,vr,qI,La(r)))}),xk=function(e){return OI(fA(e))},_k=r(function(e,t){var r=t.url,n=t.label;return d(Rk,KI,MI("a"),f(Ra,OI(NI(r)),f(Ra,OI($I("noopener noreferrer")),f(Ra,OI(RI("_blank")),f(Ra,UI(PI),f(Ra,_I(PI),f(Ra,xk(GI.contentCenterX+" "+GI.contentCenterY+" "+GI.link),e)))))),FI(M([n])))}),Lk=a(function(e,t,r,n){return{$:"Rgba",a:e,b:t,c:r,d:n}}),Pk=n(function(e,t,r){return d(Lk,e,t,r,1)}),Dk=gA(14),Uk=n(function(e,t,r){return{$:"Colored",a:e,b:t,c:r}}),Ok=r(function(e,t){return{$:"StyleClass",a:e,b:t}}),Mk=function(e){var t=e.a,r=e.b,n=e.c,a=e.d;return kA(t)+"-"+kA(r)+"-"+kA(n)+"-"+kA(a)},Fk=function(e){return f(Ok,Dk,l(Uk,"fc-"+Mk(e),"color",e))},Vk={align:Xh,label:"cantConnectNoWeb3",mainParagraphs:M([M([ep("You need a web3 provider (such as "),f(_k,M([Fk(l(Pk,0,0,1))]),{label:ep("Metamask"),url:"https://metamask.io/"}),ep(") to Connect.")]),M([ep("Until you connect, DAIHard will operate in read-only mode.")])]),noticeType:Zh},Kk={align:Xh,label:"invalidUrl",mainParagraphs:M([M([ep("I don't understand that URL...")]),M([ep("I'll just set you down here. Maybe check the URL and try again?")])]),noticeType:vm},Hk=function(e){return{$:"Active",a:e}},jk=function(e){return{$:"OnlyNetwork",a:e}},qk=Tu(f(tu,Xf,f(tu,Zg,ev("Error decoding hex to BigInt")))),Gk=function(){return Tu(function(e){switch(e){case"0x0":return hi(!1);case"0x1":return hi(!0);default:return di("Error decoding "+e+"as bool.")}})}(),zk=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}}}}}}}}}}}},Wk=function(e){return RC(M([f(Fi,fi,e),Ki(li)]))},Yk=f(bg,Wk(f(hl,"status",Gk)),f(bg,Wk(f(hl,"root",Su)),l(PC,"logsBloom",Su,l(PC,"logs",YC(JC),f(bg,Wk(f(hl,"contractAddress",DC)),l(PC,"cumulativeGasUsed",qk,l(PC,"gasUsed",qk,l(PC,"blockNumber",rC,l(PC,"blockHash",FC,l(PC,"transactionIndex",rC,l(PC,"transactionHash",GC,Ki(zk)))))))))))),Jk=function(e){var t=e.a;return Xf(t)},Qk=f(tu,Jk,cp),Xk=r(function(e,t){return Ev({decoder:Yk,method:"eth_getTransactionReceipt",params:M([Qk(t)]),url:e})}),Zk=n(function(e,t,r){return{$:"TrackTx",a:e,b:t,c:r}}),eN=r(function(e,t){return{$:"TxMined",a:e,b:t}}),tN=r(function(e,t){return{$:"TxSent",a:e,b:t}}),rN=r(function(e,t){return f(xo,function(e){return e.toMsg},f($o,function(e){return e.b},f($o,function(e){return e.onMinedTagger},f(Gd,t,e))))}),nN=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}}}}}}}}}}}},aN=function(e){return RC(M([$C(li),f(Fi,fi,e)]))},iN=l(PC,"input",Su,l(PC,"gas",rC,l(PC,"gasPrice",qk,l(PC,"value",qk,l(PC,"to",aN(DC),l(PC,"from",DC,l(PC,"transactionIndex",rC,l(PC,"blockNumber",aN(rC),l(PC,"blockHash",function(e){return f(Cu,function(t){return"0x"===t||"0x0"===t?Ki(li):f($i,function(e){return $(e,P("0"))},yu(t))?Ki(li):f(Fi,fi,e)},Su)}(FC),l(PC,"nonce",rC,l(PC,"hash",GC,Ki(nN)))))))))))),oN=r(function(e,t){return Ev({decoder:iN,method:"eth_getTransactionByHash",params:M([Qk(t)]),url:e})}),uN=r(function(e,t){return{attempts:e,sleep:t}}),sN=r(function(e,t){var r=e.attempts,n=e.sleep,a=r-1;return f(_v,function(e){return a>0?f(Bh,function(e){return f(sN,f(uN,a,n),t)},Rw(1e3*n)):mv(e)},t)}),cN=r(function(e,t){return f(Bh,function(r){return f(sN,{attempts:30,sleep:1},f(oN,e,t))},Rw(250))}),fN=r(function(e,t){return f(sN,{attempts:60,sleep:5},f(Xk,e,t))}),lN=function(e){return{$:"Mined",a:e}},dN=function(e){return xo(function(t){return D(t,{status:lN(e)})})},hN=function(e){return{$:"Sent",a:e}},pN=function(e){return xo(function(t){return D(t,{status:hN(e)})})},gN=function(e){return{$:"Signed",a:e}},vN=function(e){return xo(function(t){return D(t,{status:gN(e)})})},yN=function(e){return"Nothing"!==e.$},mN=r(function(e,t){var r=t.a;switch(e.$){case"NoOp":return _(bp(r),Vo);case"TxSigned":var n=e.a,a=e.b,i=f(Gd,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(Nw,t,wh(a))}return Vo}(),s=function(e){var t=L(o.onSignedTagger,o.onBroadcastTagger,o.onMinedTagger);if("Just"===t.a.$)return Vo;if("Just"===t.b.$){var r=t.b.a;return f(Nw,r,wh(di(e)))}if("Just"===t.c.$){var n=t.c.a,a=n.a;return f(Nw,a,wh(di(e)))}t.a,t.b,t.c;return Vo};if("Ok"===a.$){var c=a.a,d=yN(o.onBroadcastTagger)||yN(o.onMinedTagger)?f(np,r.tagger,f(Lv,tN(n),f(cN,r.nodePath,c))):Vo;return _(bp(D(r,{txs:l(th,n,vN(c),r.txs)})),Fo(M([u,d])))}var h=a.a;return _(bp(r),Fo(M([u,s(h)])))}return _(bp(r),Vo);case"TxSent":var n=e.a,p=e.b,g=f(Gd,n,r.txs);if("Just"===g.$){var o=g.a;if("Ok"===p.$){var v=p.a,y=function(){return"Just"===o.onMinedTagger.$?f(np,r.tagger,f(Lv,eN(n),f(fN,r.nodePath,v.hash))):Vo}(),d=function(){var e=o.onBroadcastTagger;if("Just"===e.$){var t=e.a;return f(Nw,t,wh(hi(v)))}return Vo}();return _(bp(D(r,{txs:l(th,n,pN(v),r.txs)})),Fo(M([d,y])))}var h=p.a,s=function(){var e=_(o.onBroadcastTagger,o.onMinedTagger);if("Just"===e.a.$){var t=e.a.a;return f(Nw,t,wh(di("Error with TxSent stuff")))}if("Just"===e.b.$){var r=e.b.a,n=r.a;return f(Nw,n,wh(di("Error with TxSent stuff")))}e.a,e.b;return Vo}();return _(bp(r),s)}return _(bp(r),Vo);case"TxMined":var n=e.a,m=e.b,b=f(Gd,n,r.txs);if("Just"===b.$){var o=b.a;if("Ok"===m.$){var C=m.a,E=function(){var e=o.onMinedTagger;if("Just"===e.$){if("Nothing"===e.a.b.$){var t=e.a,a=t.a;t.b;return f(Nw,a,wh(hi(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 Fo(M([f(np,r.tagger,f(Lv,f(Zk,n,s),nC(r.nodePath))),f(Nw,a,wh(hi(C))),f(Nw,u.toMsg,wh(s))]))}return Vo}();return _(bp(D(r,{txs:l(th,n,dN(C),r.txs)})),E)}var h=m.a,S=function(){var e=o.onMinedTagger;if("Just"===e.$){var t=e.a,r=t.a;return f(Nw,r,wh(di("TxReceipt decoding failure")))}return Vo}();return _(bp(r),S)}return _(bp(r),Vo);case"TrackTx":if("Ok"===e.c.$){var n=e.a,T=e.b,w=e.c.a,I=D(T,{currentDepth:w-T.minedInBlock+1,lastCheckedBlock:w});if($(w,T.stopWatchingAtBlock)){var A=f(rN,r.txs,n);if("Just"===A.$){var B=A.a;return _(bp(r),f(Nw,B,f(_v,function(e){return wh(D(I,{doneWatching:!0,reOrg:!0}))},f(Bh,function(e){return wh(D(I,{doneWatching:!0}))},f(Xk,r.nodePath,T.txHash)))))}return _(bp(r),Vo)}if($(w,T.lastCheckedBlock))return _(bp(r),f(np,r.tagger,f(Lv,f(Zk,n,T),f(Bh,function(e){return nC(r.nodePath)},Rw(2e3)))));var k=f(rN,r.txs,n);if("Just"===k.$){var B=k.a;return _(bp(r),Fo(M([f(np,r.tagger,f(Lv,f(Zk,n,I),f(Bh,function(e){return nC(r.nodePath)},Rw(2e3)))),f(Nw,B,wh(I))])))}return _(bp(r),Vo)}var n=e.a,h=e.c.a;return _(bp(r),Vo);default:var h=e.a;return _(bp(r),Vo)}}),bN=function(e){return{$:"External",a:e}},CN=function(e){return{$:"Internal",a:e}},EN=function(e){return{$:"NotFound",a:e}},SN=function(e){for(;;){e=e.a}},TN={$:"Http"},wN={$:"Https"},IN=o(function(e,t,r,n,a,i){return{fragment:i,host:t,path:n,port_:r,protocol:e,query:a}}),AN=i(function(e,t,r,n,a){if(jl(a)||f(Om,"@",a))return li;var i=f(Jy,":",a);if(i.b){if(i.b.b)return li;var o=i.a,u=cd(f(uu,o+1,a));if("Nothing"===u.$)return li;var s=u;return fi(p(IN,e,f(fu,o,a),s,t,r,n))}return fi(p(IN,e,a,li,t,r,n))}),BN=a(function(e,t,r,n){if(jl(n))return li;var a=f(Jy,"/",n);if(a.b){var i=a.a;return h(AN,e,f(uu,i,n),t,r,f(fu,i,n))}return h(AN,e,"/",t,r,n)}),kN=n(function(e,t,r){if(jl(r))return li;var n=f(Jy,"?",r);if(n.b){var a=n.a;return d(BN,e,fi(f(uu,a+1,r)),t,f(fu,a,r))}return d(BN,e,li,t,r)}),NN=r(function(e,t){if(jl(t))return li;var r=f(Jy,"#",t);if(r.b){var n=r.a;return l(kN,e,fi(f(uu,n+1,t)),f(fu,n,t))}return l(kN,e,li,t)}),$N=function(e){return f(vu,"http://",e)?f(NN,TN,f(uu,7,e)):f(vu,"https://",e)?f(NN,wN,f(uu,8,e)):li},RN=Jt,xN=ca,_N=r(function(e,t){if("Nothing"===e.$)return t;var r=e.a;return t+":"+Ri(r)}),LN=n(function(e,t,r){return"Nothing"===t.$?r:U(r,U(e,t.a))}),PN=function(e){var t=function(){return"Http"===e.protocol.$?"http://":"https://"}();return l(LN,"#",e.fragment,l(LN,"?",e.query,U(f(_N,e.port_,U(t,e.host)),e.path)))},DN=r(function(e,t){return e<0?li:ov(f(Wg,e,t))}),UN=r(function(e,t){if(e<0)return t;var r=_g(f(Wg,e,t)),n=f(bc,e,t);if("Nothing"===r.$)return t;var a=r.a;return f(co,n,a)}),ON=n(function(e,t,r){if(e<0)return r;var n=f(Wg,e,r),a=f(bc,e,r);if(n.b){var i=n.a,o=n.b;return U(a,f(Ra,t(i),o))}return r}),MN=r(function(e,t){return f(ON,e,As(t))}),FN=r(function(e,t){var r=function(e){var r=f(Bm,t.wallet,e),n=f(Ap,t.txSentry,f(ru,EI,r.chainCmd)),a=n.a,i=n.b,o=n.c;return f(HN,U(f(Zi,EI,r.cmdUps),f(Ua,ya,o)),_(D(t,{submodel:CI(r.model),txSentry:a}),Fo(M([f(np,EI,r.cmd),i]))))};return f(Fu,function(t){return D(t,{currentRoute:e})},function(){switch(e.$){case"InitialBlank":return _(t,Vo);case"CreateFiat":return r(Mp);case"CreateCrypto":return r(Dp(yo));case"Trade":var n=e.a,a=e.b,i=function(){var e=l(Yb,n,a,t.tradeCaches);if("Just"===e.$&&"LoadedTrade"===e.a.$){var r=e.a.a;return f(iE,t.wallet,r)}return l(AC,t.wallet,n,a)}(),o=f(Ap,t.txSentry,f(ru,BI,i.chainCmd)),u=o.a,s=o.b,c=o.c;return f(HN,U(f(Zi,BI,i.cmdUps),f(Ua,ya,c)),_(D(t,{submodel:AI(i.model),txSentry:u}),Fo(M([f(np,BI,i.cmd),s]))));case"Marketplace":var d=Wm(t.wallet),h=d.a,p=d.b;return _(D(t,{submodel:TI(h)}),Fo(M([f(np,wI,p)])));case"AgentHistory":var g=e.a,v=f(jo,t.wallet,g),y=v.a,m=v.b;return _(D(t,{submodel:vI(y)}),Fo(M([f(np,yI,m)])));default:return _(f(ho,Kk,t),Vo)}}())}),VN=r(function(e,t){var r=t.submodel;switch(r.$){case"InitialBlank":return _(t,Vo);case"CreateModel":var n=r.a,a=f(Nm,e,n),i=f(Ap,t.txSentry,f(ru,EI,a.chainCmd)),o=i.a,u=i.b,s=i.c;return f(HN,U(f(Zi,EI,a.cmdUps),f(Ua,ya,s)),_(D(t,{submodel:CI(a.model),txSentry:o}),Fo(M([f(np,EI,a.cmd),u]))));case"TradeModel":var c=r.a,a=f(sE,e,c),l=f(Ap,t.txSentry,f(ru,BI,a.chainCmd)),o=l.a,u=l.b,s=l.c;return f(HN,U(f(Zi,BI,a.cmdUps),f(Ua,ya,s)),_(D(t,{submodel:AI(a.model),txSentry:o}),Fo(M([f(np,BI,a.cmd),u]))));case"MarketplaceModel":var d=r.a,a=f(ob,e,d),h=f(Ap,t.txSentry,f(ru,wI,a.chainCmd)),o=h.a,u=h.b,s=h.c;return f(HN,U(f(Zi,wI,a.cmdUps),f(Ua,ya,s)),_(D(t,{submodel:TI(a.model),txSentry:o}),Fo(M([f(np,wI,a.cmd),u]))));default:var p=r.a,a=f(Yo,e,p),g=f(Ap,t.txSentry,f(ru,yI,a.chainCmd)),o=g.a,u=g.b,s=g.c;return f(HN,U(f(Zi,yI,a.cmdUps),f(Ua,ya,s)),_(D(t,{submodel:vI(a.model),txSentry:o}),Fo(M([f(np,yI,a.cmd),u]))))}}),KN=r(function(e,t){var r=t.a,n=t.b,a=f(jN,mI(e),r),i=a.a,o=a.b;return _(i,Fo(M([n,o])))}),HN=r(function(e,t){var r=t.a,n=t.b;return l(_a,KN,_(r,n),e)}),jN=r(function(e,t){switch(e.$){case"CmdUp":var r=e.a;switch(r.$){case"Web3Connect":return f(jN,bI,t);case"GotoRoute":var n=r.a;return f(jN,SI(n),t);case"GTag":var a=r.a;return _(t,Gb(jb(a)));case"UserNotice":var i=r.a;return _(f(ho,i,t),Gb(jb(d(Np,"user notice","user notice",i.label,0))));case"BrowserNotification":var o=r.a,u=r.b,s=r.c;return _(t,d(ub,Jb,o,u,s));default:return _(t,Qb(pr))}case"DismissNotice":var c=e.a;return _(D(t,{userNotices:f(UN,c,t.userNotices)}),Vo);case"LinkClicked":var h=e.a,p=function(){if("Internal"===h.$){var e=h.a;return f(xN,t.key,PN(e))}var r=h.a;return RN(r)}();return _(t,p);case"UrlChanged":var g=e.a;return f(qN,g,t);case"GotoRoute":var v=e.a;return f(Jh,function(e){return Fo(M([e,Gb(jb(d(Np,"GotoRoute","navigation",db(v),0))),f(xN,t.key,db(v))]))},f(FN,v,t));case"Tick":var y=e.a;return _(D(t,{time:y}),Vo);case"ConnectToWeb3":return"NoneDetected"===t.wallet.$?_(f(ho,Vk,t),Vo):_(t,Hb(pr));case"WalletStatus":var m=e.a,b=function(){var e=m.account;if("Nothing"===e.$)return Vo;var t=e.a;return zb(f(qb,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 _(D(t,{userAddress:m.account,wallet:jk(m.networkId)}),b);case"UserPubkeySet":var C=e.a,E=f(nv,Su,C);if("Ok"!==E.$){var S=E.a;return _(l(Oa,ho,f(up,"error decoding commPubkey from JS",S),t),Vo)}var T=E.a,w=_(t.userAddress,t.wallet);if("Just"!==w.a.$){w.a;return _(f(ho,f(up,"User pubkey set, but I can no longer find the user address!",li),t),Vo)}switch(w.b.$){case"OnlyNetwork":var I=w.a.a,A=w.b.a,B=Hk(l($p,A,I,T));return f(VN,kp(B),D(t,{wallet:B}));case"Active":var k=w.b.a,B=Hk(D(k,{commPubkey:T}));f(op,"User pubkey set, but there's already an active userInfo! Overwriting commpubkey.",k);return f(VN,kp(B),D(t,{wallet:B}));default:return _(f(ho,f(up,"Unexpected wallet state encounted when setting commPubkey!",_(t.userAddress,t.wallet)),t),Vo)}case"CreateMsg":var N=e.a,$=t.submodel;if("CreateModel"===$.$){var R=$.a,x=f(Tm,N,R),L=f(Ap,t.txSentry,f(ru,EI,x.chainCmd)),P=L.a,O=L.b,F=L.c;return f(HN,U(f(Zi,EI,x.cmdUps),f(Ua,ya,F)),_(D(t,{submodel:CI(x.model),txSentry:P}),Fo(M([f(np,EI,x.cmd),O]))))}return _(t,Vo);case"TradeMsg":var V=e.a,K=t.submodel;if("TradeModel"===K.$){var H=K.a,x=f(Mw,V,H),j=f(Ap,t.txSentry,f(ru,BI,x.chainCmd)),P=j.a,O=j.b,F=j.c;return f(HN,U(f(Zi,BI,x.cmdUps),f(Ua,ya,F)),_(D(t,{submodel:AI(x.model),txSentry:P}),Fo(M([f(np,BI,x.cmd),O]))))}return _(t,Vo);case"MarketplaceMsg":var q=e.a,G=t.submodel;if("MarketplaceModel"===G.$){var z=G.a,x=f(ab,q,z);return f(HN,f(Zi,wI,x.cmdUps),_(D(t,{submodel:TI(x.model)}),f(np,wI,x.cmd)))}return _(t,Vo);case"AgentHistoryMsg":var W=e.a,Y=t.submodel;if("AgentHistoryModel"===Y.$){var J=Y.a,x=f(ap,W,J),Q=f(Ap,t.txSentry,f(ru,yI,x.chainCmd)),P=Q.a,O=Q.b,F=Q.c;return f(HN,U(f(Zi,yI,x.cmdUps),f(Ua,ya,F)),_(D(t,{submodel:vI(x.model),txSentry:P}),Fo(M([f(np,yI,x.cmd),O]))))}return _(t,Vo);case"TxSentryMsg":var X=e.a,Z=function(){var e=t.txSentry;if("Just"===e.$){var r=e.a;return f(Fu,fi,f(mN,X,r))}return _(li,Vo)}(),P=Z.a,ee=Z.b;return _(D(t,{txSentry:P}),ee);case"TradeCacheMsg":var te=e.a,re=e.b,ne=f(DN,te,t.tradeCaches);if("Nothing"===ne.$)return f(KN,ya(f(up,"Encountered an out-of-range error when trying to route a TradeCacheMsg",li)),_(t,Vo));var ae=ne.a,x=f(gI,re,ae);return _(D(t,{tradeCaches:l(MN,te,x.tradeCache,t.tradeCaches)}),f(np,II(te),x.cmd));case"ClickHappened":return f(VN,Bp,t);case"NoOp":return _(t,Vo);default:var S=e.a;f(op,"test",S);return _(t,Vo)}}),qN=r(function(e,t){return $(db(t.currentRoute),e.path)?_(t,Vo):f(FN,Kb(e),t)}),GN=We("txIn",xC),zN=Ge("txOut",Fa),WN=function(e){if("Token"===e.$){if("EthDai"===e.a.$){e.a;return"Dai"}e.a;return"Kovan Dai"}switch(e.a.$){case"Eth":e.a;return"Ether";case"Kovan":e.a;return"Kovan Ether";default:e.a;return"xDai"}},YN=function(e){return{$:"EventSentryMsg",a:e}},JN=function(e){var t=f(bC,YN,fv(e)),r=t.a,n=t.b;return L({dataFetchState:l(uI,li,0,0),eventSentry:r,factory:e,trades:Wa},n,M([d(Yp,"tradeCache init","processing",WN(e),0)]))},QN=function(e){return{$:"InitialNumTradesFetched",a:e}},XN=function(e){return f(qw,e.factory,QN)},ZN=function(e){var t=JN(e),r=t.a,n=t.b,a=t.c;return L(r,Fo(M([n,XN(r)])),a)},e$={$:"InitialBlank"},t$=function(e){return{$:"TxSentryMsg",a:e}},r$={align:Xh,label:"noWeb3Provider",mainParagraphs:M([M([ep("No web3 provider detected. Is "),f(_k,M([Fk(l(Pk,0,0,1))]),{label:ep("Metamask"),url:"https://metamask.io/"}),ep(" or some other web3 provider installed and unlocked?")])]),noticeType:Zh},n$={$:"TopLeft"},a$={align:n$,label:"screenToSmall",mainParagraphs:M([M([ep("Your screen is quite small--things may be very broken! We will be addressing this soon.")])]),noticeType:Zh},i$={align:Xh,label:"wrongWeb3Network",mainParagraphs:M([M([ep("Make sure your wallet is set to a compatible network.")]),M([ep(" At the moment DAIHard works on: xDai, the Kovan Ethereum Test Net, or Ethereum Main Net.")])]),noticeType:vm},o$={$:"NoneDetected"},u$=function(e){return f(xo,fv,jp(e))},s$={$:"ETCMain"},c$={$:"ETCTest"},f$={$:"Expanse"},l$={$:"Kovan"},d$={$:"Mainnet"},h$=function(e){return{$:"Private",a:e}},p$={$:"Rinkeby"},g$={$:"Ropsten"},v$={$:"RskMain"},y$={$:"RskTest"},m$=function(e){switch(e){case 1:return d$;case 2:return f$;case 3:return g$;case 4:return p$;case 30:return v$;case 31:return y$;case 42:return l$;case 41:return s$;case 62:return c$;default:return h$(e)}},b$=n(function(e,t,r){var n=e.a,a=e.b;return bp({inPort:a,nodePath:r,outPort:n,ref:1,tagger:t,txs:Dd})}),C$=n(function(e,t,n){var a=e.networkId?jk(m$(e.networkId)):o$,i=f(xo,function(e){return l(b$,_(zN,GN),t$,e)},u$(a)),o=e.width<1024?fi(a$):li,u=f(Ua,ZN,ao),s=function(){return $(a,o$)?fi(r$):"Nothing"===jp(a).$?fi(i$):li}(),c=$T(M([o,s])),d=L(f(Ua,io,u),f(Ua,oo,u),f(Ua,uo,u)),h=d.a,p=d.b,g=d.c,v=kb(f(Ni,r(function(e,t){return f(Zi,II(e),t)}),g)),y=Fo(f(Ni,r(function(e,t){return f(np,II(e),t)}),p)),m=f(HN,v,f(qN,t,{currentRoute:so,key:n,screenWidth:e.width,submodel:e$,time:Ho(0),tradeCaches:h,txSentry:i,userAddress:li,userNotices:vr,wallet:a})),b=m.a,C=m.b;return _(f(po,c,b),Fo(M([y,C])))}),E$={$:"Refresh"},S$=function(e){return{$:"UpdateNow",a:e}},T$=Fe,w$=r(function(e,t){return{$:"Every",a:e,b:t}}),I$=r(function(e,t){return{processes:t,taggers:e}}),A$=wh(f(I$,Dd,Dd)),B$=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(x(c,r)<0){var p=r,g=n,v=_(h,l(e,c,f,u));r=p,n=g,i=v;continue e}return x(c,r)>0?_(o,l(a,r,n,u)):_(h,d(t,c,f,n,u))}return _(o,l(a,r,n,u))}}),c=l(Lw,s,_(ka(i),u),o),f=c.a,h=c.b;return l(_a,r(function(t,r){var n=t.a,a=t.b;return l(e,n,a,r)}),h,f)}),k$=r(function(e,t){var r=e.a,n=e.b,a=f(Gd,r,t);if("Nothing"===a.$)return l(Kd,r,M([n]),t);var i=a.a;return l(Kd,r,f(Ra,n,i),t)}),N$=r(function(e,t){return{$:"Zone",a:e,b:t}}),$$=da,R$=n(function(e,t,r){if(t.b){var n=t.a,a=t.b,i=Nh(f($$,n,f(ah,e,n)));return f(Bh,function(t){return l(R$,e,a,l(Kd,n,t,r))},i)}return wh(r)}),x$=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 L(n,a,f(Bh,function(e){return i},kh(t)))}),u=l(_a,k$,Dd,t),s=n(function(e,t,r){var n=r.a,a=r.b,i=r.c;return L(f(Ra,e,n),a,i)}),c=a(function(e,t,r,n){var a=n.a,i=n.b,o=n.c;return L(a,l(Kd,e,r,i),o)}),d=p(B$,s,c,o,u,i,L(vr,Dd,wh(pr))),h=d.a,g=d.b,v=d.c;return f(Bh,function(e){return wh(f(I$,u,e))},f(Bh,function(t){return l(R$,e,h,g)},v))}),_$=function(e){return Ae(function(t){t(we(e(Date.now())))})}(Ho),L$=n(function(e,t,r){var n=f(Gd,t,r.taggers);if("Nothing"===n.$)return wh(r);var a=n.a,i=function(t){return Ph(f(Ua,function(r){return f(nh,e,r(t))},a))};return f(Bh,function(e){return wh(r)},f(Bh,i,_$))}),P$=r(function(e,t){var r=t.a,n=t.b;return f(w$,r,f(Ma,e,n))});gn.Time=Ue(A$,x$,L$,0,P$);var D$=Me("Time"),U$=r(function(e,t){return D$(f(w$,e,t))}),O$=function(e){return T$(M([f(U$,500,S$),f(U$,5e3,As(E$))]))},M$=function(e){return{$:"UpdateNow",a:e}},F$=function(e){return T$(M([f(U$,2e3,As(wm)),f(U$,500,M$)]))},V$={$:"Refresh"},K$=function(e){return{$:"UpdateNow",a:e}},H$=function(e){return T$(M([f(U$,500,K$),f(U$,5e3,As(V$))]))},j$=function(e){return{$:"DecryptionFinished",a:e}},q$=We("decryptionFinished",xC),G$=We("encryptionFinished",xC),z$=function(e){return{$:"EncryptionFinished",a:e}},W$=function(e){return{$:"Refresh",a:e}},Y$=function(e){return T$(M([f(U$,3e3,W$),G$(z$),q$(function(e){return rw(j$(e))})]))},J$=mn,Q$=T$(vr),X$=function(e){var t=e.submodel;switch(t.$){case"InitialBlank":return Q$;case"CreateModel":t.a;return f(J$,EI,F$());case"TradeModel":t.a;return f(J$,BI,Y$());case"MarketplaceModel":t.a;return f(J$,wI,H$());default:t.a;return f(J$,yI,O$())}},Z$=We("userPubkeyResult",xC),eR=We("walletSentryPort",xC),tR={$:"CheckForNewTrades"},rR={$:"UpdateTradePhases"},nR=function(e){return T$(M([f(U$,5e3,function(e){return tR}),f(U$,3e3,function(e){return rR})]))},aR=function(e){return{$:"Tick",a:e}},iR=function(e){return{$:"UserPubkeySet",a:e}},oR=function(e){return{$:"WalletStatus",a:e}},uR=function(e){return f(up,"Error decoding JS walletSentry: "+e,li)},sR=function(e){return{$:"ErrorDecoding",a:e}},cR=r(function(e,t){return{$:"TxSigned",a:e,b:t}}),fR=l(Vi,r(function(e,t){return{ref:e,txHash:t}}),f(hl,"ref",xT),f(hl,"txHash",Wk(GC))),lR=function(e){var t=f(nv,fR,e);if("Ok"===t.$){var r=t.a,n=r.txHash;if("Just"===n.$){var a=n.a;return f(cR,r.ref,hi(a))}return f(cR,r.ref,di("Problem signing/broadcasting Tx. Ref #"+Ri(r.ref)))}t.a;return sR("Error decoding tx data")},dR=function(e){var t=e.a;return f(J$,t.tagger,t.inPort(lR))},hR=f(Fi,m$,xT),pR=Tu(f(tu,cd,f(tu,ev("Failure decoding stringy int"),du(m$)))),gR=RC(M([pR,hR])),vR=r(function(e,t){return{account:e,networkId:t}}),yR=l(Vi,vR,f(hl,"account",Wk(DC)),f(hl,"networkId",gR)),mR=n(function(e,t,r){var n=f(nv,yR,r);if("Err"===n.$){var a=n.a;return e(Oi(a))}return t(n.a)}),bR=function(e){var t=f(tu,uR,f(tu,ya,mI));return T$(U(M([f(U$,1e3,aR),eR(f(mR,t,oR)),f(Kc,Q$,f(xo,dR,e.txSentry)),Z$(iR),T$(f(Ni,r(function(e,t){return f(J$,II(e),t)}),f(Ua,nR,e.tradeCaches)))]),M([X$(e)])))},CR=function(e){return{$:"LinkClicked",a:e}},ER=function(e){return{$:"UrlChanged",a:e}},SR={$:"ClickHappened"},TR={$:"Generic"},wR=TR,IR=r(function(e,t){return d(Rk,KI,wR,f(Ra,UI(PI),f(Ra,_I(PI),e)),FI(M([t])))}),AR=function(e){return{$:"Fill",a:e}},BR=AR(1),kR=r(function(e,t){return{$:"Nearby",a:e,b:t}}),NR={$:"NoAttribute"},$R=r(function(e,t){return"Empty"===t.$?NR:f(kR,e,t)}),RR={$:"InFront"},xR=function(e){return f($R,RR,e)},_R=qi,LR=function(e){return{$:"Px",a:e}},PR=LR,DR=n(function(e,t,r){return d(Lk,e/255,t/255,r/255,1)}),UR=gA(8),OR=function(e){return f(Ok,UR,l(Uk,"bg-"+Mk(e),"background-color",e))},MR=function(){var e=l(DR,7,27,92),t=l(DR,10,33,108);return f(IR,M([UI(BR),_I(PR(600)),OR(t),xR(f(IR,M([UI(BR),_I(PR(80)),OR(e)]),_R))]),_R)}(),FR=function(e){return{$:"JustImage",a:e}},VR=FR({description:"marketplace",src:"/DAIHard/static/img/farmer-s-market-kiosk-1.svg"}),KR=FR({description:"myTrades",src:"/DAIHard/static/img/diamond.svg"}),HR=FR({description:"newTrade",src:"/DAIHard/static/img/add-circle-bold.svg"}),jR={$:"Active"},qR={$:"Important"},GR={$:"Normal"},zR=l(DR,255,0,110),WR=l(Pk,1,1,1),YR=kI("alt"),JR=function(e){return f(kI,"src",at(e))},QR=r(function(e,t){var r=t.src,n=t.description,a=f(pp,function(e){switch(e.$){case"Width":case"Height":return!0;default:return!1}},e);return d(Rk,KI,wR,f(Ra,xk(GI.imageContainer),e),FI(M([d(Rk,KI,MI("img"),U(M([OI(JR(r)),OI(YR(n))]),a),FI(vr))])))}),XR=r(function(e,t){if("None"===t.$)return f(IR,e,_R);var r=t.a;return f(QR,e,r)}),ZR=function(e){return{$:"AlignY",a:e}},ex={$:"CenterY"},tx=ZR(ex),rx=gA(2),nx=i(function(e,t,r,n,a){return{$:"PaddingStyle",a:e,b:t,c:r,d:n,e:a}}),ax=r(function(e,t){return $(e,t)?f(Ok,rx,h(nx,"p-"+Ri(e),e,e,e,e)):f(Ok,rx,h(nx,"p-"+Ri(e)+"-"+Ri(t),t,e,t,e))}),ix=gA(21),ox=r(function(e,t){return{$:"Class",a:e,b:t}}),ux=f(ox,ix,GI.cursorPointer),sx={$:"AsRow"},cx=sx,fx=r(function(e,t){return d(Rk,cx,wR,f(Ra,xk(GI.contentLeft+" "+GI.contentCenterY),f(Ra,UI(PI),f(Ra,_I(PI),e))),FI(t))}),lx=gA(3),dx=n(function(e,t,r){return{$:"SpacingStyle",a:e,b:t,c:r}}),hx=r(function(e,t){return"spacing-"+Ri(e)+"-"+Ri(t)}),px=function(e){return f(Ok,lx,l(dx,f(hx,e,e),e,e))},gx=gA(17),vx=function(e){return f(Ok,gx,l(fk,"br-"+Ri(e),"border-radius",Ri(e)+"px"))},yx=function(e){return{$:"Normal",a:e}},mx=Bn,bx=r(function(e,t){return f(mx,e,yx(t))}),Cx=function(e){return f(bx,"click",Ki(e))},Ex=f(Ma,OI,Cx),Sx=gA(13),Tx=f(ox,Sx,GI.textSemiBold),wx=gA(4),Ix=function(e){return{$:"FontSize",a:e}},Ax=function(e){return f(Ok,wx,Ix(e))},Bx=a(function(e,t,r,n){var a=function(){switch(n.$){case"Normal":return vr;case"Active":return M([vx(4),OR(l(DR,2,172,214))]);default:return M([vx(4),OR(zR)])}}();return f(fx,U(M([f(ax,23,12),Ax(21),Tx,Fk(WR),ux,Ex(r),px(13)]),a),M([f(Kc,_R,f(xo,XR(M([_I(PR(26))])),e)),f(IR,M([tx,_I(PR(26))]),ep(t))]))}),kx=function(e){return{$:"AlignX",a:e}},Nx={$:"CenterX"},$x=kx(Nx),Rx=function(e){return{$:"Describe",a:e}},xx={$:"Paragraph"},_x=r(function(e,t){return d(Rk,iA,wR,f(Ra,Rx(xx),f(Ra,UI(BR),f(Ra,px(5),e))),FI(t))}),Lx=f(ox,Sx,GI.bold),Px=f(IR,M([Ax(29),Fk(WR),Lx,$x,ux,Ex(SI(vb))]),f(_x,vr,M([ep("DAI"),f(IR,M([Fk(zR)]),ep("Hard"))]))),Dx={$:"Right"},Ux=kx(Dx),Ox={$:"AsColumn"},Mx=Ox,Fx=r(function(e,t){return d(Rk,Mx,wR,f(Ra,xk(GI.contentTop+" "+GI.contentLeft),f(Ra,_I(PI),f(Ra,UI(PI),e))),FI(t))}),Vx=function(e){return f(fx,M([UI(BR),px(30),f(ax,30,17)]),M([d(Bx,fi(VR),"Marketplace",SI(yb),function(){var t=e.submodel;if("MarketplaceModel"===t.$){t.a;return jR}return GR}()),function(){var t=Sm(e.wallet);if("Just"===t.$){var r=t.a;return d(Bx,fi(KR),"My Trades",SI(pb(r.address)),function(){var t=e.submodel;if("AgentHistoryModel"===t.$){return $(t.a.agentAddress,r.address)?jR:GR}return GR}())}return d(Bx,li,"Connect to Wallet",bI,qR)}(),d(Bx,fi(HR),"Create New Trade",SI(vb),function(){return"CreateModel"===e.submodel.$?jR:GR}()),f(Fx,M([Ux,px(0),f(ax,8,0)]),M([Px]))]))},Kx=function(e){return function(t){return $(t.parameters.initiatorAddress,e.agentAddress)||$(t.state.responder,fi(e.agentAddress))}},Hx=function(e){return pp(e)},jx=r(function(e,t){return f(pp,$m(e),t)}),qx=function(e){return f(pp,function(e){return aS(e.parameters)},Ww(e))},Gx={$:"BurnWindow"},zx={$:"Offer"},Wx={$:"PaymentWindow"},Yx={$:"Price"},Jx={$:"ResponderProfit"},Qx=gA(20),Xx=f(ox,Qx,GI.clip),Zx=AR,e_=function(e){return f(Ok,rx,h(nx,"p-"+Ri(e),e,e,e,e))},t_=r(function(e,t){return f(IR,M([UI(Zx(e)),_I(PR(60)),Xx]),f(IR,M([e_(12),tx,UI(BR)]),t))}),r_=function(e){switch(e.$){case"Phase":case"Expires":case"Offer":return 1;case"Price":return 2;case"ResponderProfit":return 1;case"PaymentWindow":default:return 2}},n_=FR({description:"down",src:"/DAIHard/static/img/arrow-down.svg"}),a_=FR({description:"up",src:"/DAIHard/static/img/arrow-up.svg"}),i_=function(e){return{$:"ChangeSort",a:e}},o_=f(ox,Sx,GI.textMedium),u_=function(e){return f(IR,M([o_,Ax(17)]),ep(function(){switch(e.$){case"Phase":return"Phase";case"Expires":return"Expiring";case"Offer":return"Offer";case"Price":return"For";case"ResponderProfit":return"Responder Profit";case"PaymentWindow":return"Payment Window";default:return"Burn Window"}}()))},s_=r(function(e,t){return f(fx,M([px(5),ux,Ex(i_(e))]),M([u_(e),function(){if("Just"===t.$){var e=t.a;return f(IR,M([tx]),f(XR,M([UI(PR(8))]),function(){return"Ascending"===e.$?n_:a_}()))}return _R}()]))}),c_=r(function(e,t){return f(t_,r_(t),f(s_,t,e))}),f_=r(function(e,t){return f(fx,M([UI(BR)]),f(Ua,function(t){var r=$(e.a,t)?fi(e.b):li;return f(c_,r,t)},t))}),l_=l(DR,150,150,150),d_=function(e){switch(e.$){case"Open":return 1;case"Committed":return 2;case"Judgment":return 3;default:return 4}},h_=r(function(e,t){return $(e.symbol,t.symbol)?f(Ju,e.amount,t.amount):f(Ju,e.symbol,t.symbol)}),p_=function(e){if("Ok"===e.$){var t=e.a;return fi(t)}return li},g_=r(function(e,t){return f(xo,function(e){var r=t.terms.price.amount*e,n=gm(t.parameters.tradeAmount),a=function(){return"Buyer"===t.parameters.initiatorRole.$?_(n,r):_(r,n)}(),i=a.a;return(a.b-i)/i},f($o,p_,f(cy,t.terms.price.symbol,e)))}),v_=n(function(e,t,r){return f(e,r,t)}),y_=r(function(e,t){var n=t.a;return($(t.b,Oo)?Fa:v_)(function(){switch(n.$){case"Phase":return r(function(t,r){return $(t.state.phase,r.state.phase)?d(y_,e,_(zm,zh),t,r):f(Ju,d_(t.state.phase),d_(r.state.phase))});case"Expires":return r(function(e,t){return f(ol,e.derived.phaseEndTime,t.derived.phaseEndTime)});case"Offer":return r(function(e,t){return f(Km,e.parameters.tradeAmount,t.parameters.tradeAmount)});case"Price":return r(function(e,t){return f(h_,e.terms.price,t.terms.price)});case"ResponderProfit":return r(function(t,r){return f(Kc,Ea,l(aT,Ju,f(g_,e,t),f(g_,e,r)))});case"PaymentWindow":return r(function(e,t){return f(ol,e.parameters.autoabortInterval,t.parameters.autoabortInterval)});default:return r(function(e,t){return f(ol,e.parameters.autoreleaseInterval,t.parameters.autoreleaseInterval)})}}())}),m_=r(function(e,t){return{$:"TradeClicked",a:e,b:t}}),b_=function(e){return f(IR,M([UI(BR),_I(BR),Xx]),f(_x,M([Ax(12)]),M([ep(e.info)])))},C_=function(e){return f(Kc,_R,f(xo,b_,ov(e)))},E_=function(e){if("Token"===e.$){if("EthDai"===e.a.$){e.a;return"Dai"}e.a;return"(k)Dai"}switch(e.a.$){case"Eth":e.a;return"ETH";case"Kovan":e.a;return"(k)ETH";default:e.a;return"xDai"}},S_=function(e){return{$:"TimeLeft",a:e}},T_=function(e){return{$:"TimeUp",a:e}},w_=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 Ho(0)}}),I_=r(function(e,t){var r=f(w_,t.state.phase,t),n=f(ul,e,t.state.phaseStartTime),a=f(ul,r,n);return il(a)>0?S_(_(a,r)):T_(r)}),A_=function(e){switch(e.$){case"Open":return"Open";case"Committed":return"Committed";case"Judgment":return"Judgment";default:return"Closed"}},B_=l(Pk,0,0,0),k_=l(DR,51,183,2),N_=function(e){return U(e>0?"+":"",function(e){return e+"%"}(e<.1?uy(function(e){return e/10}(Yl(1e3*e))):Ri(Yl(100*e))))},$_=r(function(e,t){var r=N_(t);if("0%"===r)return f(IR,M([Ax(16)]),ep("0%"));var n=r;return f(IR,M([Fk(t>=0===e?k_:zR),Ax(16)]),ep(n))}),R_=function(e){return il(e)<0},x_=a(function(e,t,r,n){return{days:e,hours:t,min:r,sec:n}}),__=function(e){var t=Qv(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(x_,KS(t),KS(r),KS(n),KS(a))}(f(Kc,_(Zu(0),Zu(0)),f(Rs,n,Zu(60))))}(f(Kc,_(Zu(0),Zu(0)),f(Rs,r,Zu(3600))))}(f(Kc,_(Zu(0),Zu(0)),f(Rs,t,Zu(86400))))},L_=a(function(e,t,n,a){for(;;){var i=n.a,o=n.b;if(!R_(a)){var u=r(function(e,t){return U(l(Os,2,P("0"),Ri(e)),t)}),s=il(a)>0?i:o,c=__(a),d=c.days||c.hours?i:o,h=c.days?i:o;return f(fx,U(M([px(5)]),e),M([f(IR,U(M([Fk(h)]),t),ep(f(u,c.days,"d"))),f(IR,U(M([Fk(d)]),t),ep(f(u,c.hours,"h"))),f(IR,U(M([Fk(s)]),t),ep(f(u,c.min,"m")))]))}var p=e,g=t,v=_(i,o),y=Ho(0);e=p,t=g,n=v,a=y}}),P_=l(DR,233,237,242),D_={$:"Behind"},U_=function(e){return f($R,D_,e)},O_=r(function(e,t){var r=Yl(200*e),n=200-r,a=f(IR,M([UI(Zx(n))]),_R),i=M([_I(PR(3)),vx(20)]),o=f(IR,U(i,M([UI(Zx(r)),OR(t)])),_R),u=f(IR,U(i,M([UI(BR),OR(P_)])),_R);return f(fx,M([UI(BR),U_(u)]),M([o,a]))}),M_=l(Pk,1,1,0),F_=r(function(e,t){return il(e)/il(t)}),V_=a(function(e,t,r,n){var a=r.a,i=r.b,o=n.a,u=n.b,s=f(F_,o,u),c=(f(IR,M([$x]),d(L_,vr,vr,_(a,i),o)),s<.1?zR:s<.2?M_:k_);return f(Fx,U(M([px(5)]),e),M([d(L_,M([$x]),t,_(a,i),o),f(O_,1-s,c)]))}),K_=M(["BTC","ZEC","XMR","DASH"]),H_=FR,j_=Hd(f(Ua,function(e){return _(e,H_({description:e,src:"/DAIHard/static/img/currencies/crypto/"+e+".png"}))},U(K_,M(["DAI","XDAI"])))),q_=Hd(f(Ua,function(e){var t=e.a;return _(t,_(e.b,H_({description:t,src:"/DAIHard/static/img/currencies/fiat/"+t+".svg"})))},M([_("AUD","$"),_("CLP","$"),_("EUR","€"),_("IDR","Rp"),_("KRW","₩"),_("NZD","$"),_("RUB","₽"),_("TRY","₺"),_("BRL","R$"),_("CNY","¥"),_("GBP","£"),_("ILS","₪"),_("MXN","$"),_("PHP","₱"),_("SEK","kr"),_("TWD","NT$"),_("CAD","$"),_("CZK","Kč"),_("HKD","$"),_("INR","₹"),_("MYR","RM"),_("PKR","₨"),_("SGD","$"),_("USD","$"),_("CHF","Fr"),_("DKK","kr"),_("HUF","Ft"),_("JPY","¥"),_("NOK","kr"),_("PLN","zł"),_("THB","฿"),_("ZAR","R"),_("VND","₫")]))),G_=FR({description:"DAI",src:"/DAIHard/static/img/dai-symbol.png"}),z_=r(function(e,t){return"Nothing"===e.$?t:e}),W_=function(e){return"DAI"===e?fi(G_):f(z_,f(Gd,e,j_),f(xo,mu,f(Gd,e,q_)))},Y_=function(e){return f(xo,XR(M([_I(PR(26))])),W_(e))},J_=function(e){return f(xo,ei,f(Gd,e,q_))},Q_=i(function(e,t,r,n,a){return{decimals:r,integers:t,original:e,prefix:n,suffix:a}}),X_={$:"Negative"},Z_={$:"Positive"},eL={$:"Zero"},tL=function(e){return f($i,function(e){return $(e,P("0"))},qy(f(co,e.integers,Ow(e.decimals))))?eL:e.original<0?X_:Z_},rL=function(e){var t=function(e){return iu(e)>3?f(Ra,f(pu,3,e),t(f(um,3,e))):M([e])};return La(t(e))},nL=K,aL=xr,iL=n(function(e,t,r){return U(r,f(Us,e-iu(r),Ls(t)))}),oL=Y,uL=r(function(e,t){var r=f(fo,function(e){return!$(e,P("0"))&&!$(e,P("."))},uc(t));return U(e&&r?"-":"",t)}),sL=function(e){var t=e.a,r=e.b;if($(t,P("9"))){var n=_i(r);if("Nothing"===n.$)return"01";var a=n.a;return f(_s,P("0"),sL(a))}var i=bi(t);return i>=48&&i<57?f(_s,xE(i+1),r):"0"},cL=function(e){var t=f(Li,".",e);if(t.b){if(t.b.b){var r=t.a;return _(r,t.b.a)}var r=t.a;return _(r,"0")}return _("0","0")},fL=function(e){var t=f(Li,"e",uy(Xu(e)));if(t.b){if(t.b.b){var r=t.a,n=t.b,a=n.a,i=f(Kc,0,cd(f(vu,"+",a)?f(uu,1,a):a)),o=cL(r),u=o.a,s=o.b,c=U(u,s),d=i<0?f(Kc,"0",f(xo,function(e){return e.a+"."+e.b},f(xo,Fu(Ls),_i(U(f(Us,Xu(i),"0"),c))))):l(iL,i+1,P("0"),c);return U(e<0?"-":"",d)}var r=t.a;return U(e<0?"-":"",r)}return""},lL=n(function(e,t,r){if(nL(r)||aL(r))return uy(r);var n=r<0,a=cL(fL(Xu(r))),i=a.a,o=a.b,u=iu(i)+t,s=U(f(Us,1-u,"0"),l(iL,u,P("0"),U(i,o))),c=iu(s),d=f(ni,1,u),h=f(e,n,l(ou,d,c,s)),p=l(ou,0,d,s),g=h?oL(f(Kc,"1",f(xo,sL,_i(oL(p))))):p,v=iu(g),y="0"===g?g:t<=0?U(g,f(Us,Xu(t),"0")):x(t,iu(o))<0?l(ou,0,v-t,g)+"."+l(ou,v-t,v,g):U(i+".",l(iL,t,P("0"),o));return f(uL,n,y)}),dL=lL(r(function(e,t){var r=_i(t);if("Nothing"===r.$)return!1;if("5"===r.a.a.valueOf()){if(""===r.a.b){r.a;return!e}r.a;return!0}var n=r.a,a=n.a;return function(t){return t>53&&e||t>=53&&!e}(bi(a))})),hL=r(function(e,t){var r=f(Li,".",f(dL,e.decimals,t)),n=rL(f(Cm,Ti,f(Kc,"0",ov(r)))),a=f(Kc,"",ov(f(Wg,1,r))),i=h(Q_,t,n,a,"","");switch(tL(i).$){case"Negative":return D(i,{prefix:e.negativePrefix,suffix:e.negativeSuffix});case"Positive":return D(i,{prefix:e.positivePrefix,suffix:e.positiveSuffix});default:return i}}),pL=r(function(e,t){return""===t?"":U(e.decimalSeparator,t)}),gL=function(e){return"0"!==f(pu,1,e)?e:gL(f(um,1,e))},vL=n(function(e,t,r){return""===r||$(f(Us,e.decimals,"0"),r)?"":"KeepZeros"===t.$?U(e.decimalSeparator,r):f(pL,e,gL(r))}),yL=n(function(e,t,r){var n=function(){if("Just"===t.$){var r=t.a;return f(vL,e,r)}return pL(e)}(),a=f(xi,e.thousandSeparator,r.integers),i=n(r.decimals);return qy(M([r.prefix,a,i,r.suffix]))}),mL=n(function(e,t,r){return l(yL,e,fi(t),f(hL,e,r))}),bL={$:"RemoveZeros"},CL=u(function(e,t,r,n,a,i,o){return{decimalSeparator:r,decimals:e,negativePrefix:n,negativeSuffix:a,positivePrefix:i,positiveSuffix:o,thousandSeparator:t}}),EL=g(CL,2,",",".","−","","",""),SL=function(e){return f(mL,D(EL,{decimals:e}),bL)},TL=function(e){return f(Kc,"",J_(e.symbol))+(f(SL,8,e.amount)+" ")+e.symbol},wL=Lk,IL=function(e){return f(fx,M([px(4)]),M([f(Kc,_R,Y_(e.symbol)),f(IR,M([Fk(d(wL,0,0,0,.5)),o_,UI(PR(50))]),ep(e.symbol)),ep(TL(e))]))},AL=function(e){var t=ri(f(ja,10,e)+1),r=f(ni,3-t,0);return f(SL,r,e)},BL=function(e){return AL(gm(e))},kL=a(function(e,t,r,n){return f(t_,r_(r),function(){switch(r.$){case"Phase":var a=A_(n.state.phase),i=_(f(I_,e,n),n.state.phase);e:for(;;){if("TimeLeft"===i.a.$){if("Closed"===i.b.$)break e;var o=i.a.a,u=f(F_,o.a,o.b)<.05?zR:B_;return f(Fx,M([px(3)]),M([ep(a),d(V_,M([UI(BR)]),M([Ax(16)]),_(u,P_),o)]))}if("Closed"===i.b.$)break e;var s=i.a.a;return f(fx,M([px(6),Fk(l_)]),M([ep(a),f(IR,M([Ax(16)]),ep("(stale)"))]))}i.b;return ep(a);case"Expires":if("Open"===n.state.phase.$){var c=f(I_,e,n);if("TimeLeft"===c.$){var o=c.a,u=f(F_,o.a,o.b)<.05?zR:B_;return d(V_,M([UI(BR)]),M([Ax(16)]),_(u,P_),o)}var s=c.a;return d(V_,M([UI(BR)]),M([Ax(16)]),_(zR,P_),_(Ho(0),s))}return _R;case"Offer":return f(fx,M([px(5)]),M([ep(function(){return"Buyer"===n.parameters.initiatorRole.$?"Buying ":"Selling "}()+(BL(n.parameters.tradeAmount)+" ")+E_(n.factory))]));case"Price":return IL(n.terms.price);case"ResponderProfit":return f(Kc,_R,f(xo,$_(!0),f(g_,t,n)));case"PaymentWindow":var l=function(){return"Seller"===n.parameters.initiatorRole.$?zR:k_}(),h=x(il(n.parameters.autoabortInterval),216e5)<0?l:B_;return d(L_,vr,vr,_(h,P_),n.parameters.autoabortInterval);default:var l=function(){return"Seller"===n.parameters.initiatorRole.$?k_:zR}(),h=x(il(n.parameters.autoabortInterval),216e5)<0?l:B_;return d(L_,vr,vr,_(h,P_),n.parameters.autoreleaseInterval)}}())}),NL=a(function(e,t,r,n){return f(Fx,M([UI(BR),px(1),OR(WR),ux,Ex(f(m_,n.factory,n.id))]),M([f(fx,M([UI(BR),px(1)]),f(Ua,function(r){return d(kL,e,t,r,n)},r)),f(t_,1,C_(n.terms.paymentMethods))]))}),$L=Cr,RL=gA(28),xL=function(e){return f(Ok,RL,l(Uk,"bc-"+Mk(e),"border-color",e))},_L=i(function(e,t,r,n,a){return{$:"BorderWidth",a:e,b:t,c:r,d:n,e:a}}),LL=function(e){return f(Ok,Ak,h(_L,"b-"+Ri(e),e,e,e,e))},PL=i(function(e,t,r,n,a){return f(Fx,M([UI(BR),LL(2),vx(8),xL(l_),px(2),OR(l_),Xx]),f(Ua,l(NL,e,r,n),f($L,f(y_,r,t.orderBy),a)))}),DL=i(function(e,t,r,n,a){return f(Fx,M([UI(BR),_I(BR),px(5)]),M([f(f_,t.orderBy,n),h(PL,e,t,r,n,a)]))}),UL=a(function(e,t,r,n){return"pad-"+Ri(e)+"-"+Ri(t)+"-"+Ri(r)+"-"+Ri(n)}),OL=function(e){var t=e.top,r=e.right,n=e.bottom,a=e.left;return $(t,r)&&$(t,n)&&$(t,a)?f(Ok,rx,h(nx,"p-"+Ri(t),t,t,t,t)):f(Ok,rx,h(nx,d(UL,t,r,n,a),t,r,n,a))},ML=xk(GI.italic),FL=a(function(e,t,r,n){var a=f(jx,n.filters,kb(f(Ua,function(e){return f(Hx,Kx(n),qx(e))},r)));return $(a,vr)?f(IR,M([$x,Ax(24),OL({bottom:0,left:0,right:0,top:30}),ML]),ep(t?"No trades found with those filters.":"Initializing Trade Cache...")):f(Ji,Qo,h(DL,e,n.tradeTable,n.prices,M([Mo,zx,Yx,Jx,Wx,Gx]),a))}),VL=function(e){return{$:"FiltersMsg",a:e}},KL=function(e){switch(e.$){case"Phase":return"Phases";case"Role":return"Role";default:return"Offer Type"}},HL=n(function(e,t,r){return{$:"SetOption",a:e,b:t,c:r}}),jL=tk,qL={$:"Left"},GL=kx(qL),zL=n(function(e,t,r){if("HiddenLabel"===t.$){t.a;return d(Rk,Mx,MI("label"),e,FI(M([r])))}var n=t.a,a=t.b,i=t.c,o=d(Rk,KI,wR,a,FI(M([i])));switch(n.$){case"Above":return d(Rk,Mx,MI("label"),e,FI(M([o,r])));case"Below":return d(Rk,Mx,MI("label"),e,FI(M([r,o])));case"OnRight":return d(Rk,cx,MI("label"),e,FI(M([r,o])));default:return d(Rk,cx,MI("label"),e,FI(M([o,r])))}}),WL=function(e){return{$:"Label",a:e}},YL=function(e){if("HiddenLabel"===e.$){var t=e.a;return Rx(WL(t))}return NR},JL=function(e){return"HiddenLabel"===e.$},QL=function(e){var t=function(t){var r=e(t);if("Nothing"===r.$)return Eu("No key matched");var n=r.a;return Ki(n)},r=f(Cu,t,f(hl,"key",Su));return OI(f(bx,"keyup",r))},XL=function(e){return f($n,"tabIndex",Ri(e))},ZL=f(Ma,OI,XL),eP={$:"LivePolite"},tP=Rx(eP),rP=r(function(e,t){var r=t.label,n=t.icon,a=t.checked,i=t.onChange,o=U(M([JL(r)?NR:px(6),OI(Cx(i(!a))),tP,QL(function(e){return $(e,"Enter")?fi(i(!a)):$(e," ")?fi(i(!a)):li}),ZL(0),ux,GL,UI(BR)]),e);return l(zL,o,r,d(Rk,KI,wR,M([OI(f(jL,"role","checkbox")),OI(f(jL,"aria-checked",a?"true":"false")),YL(r),tx,_I(BR),UI(PI)]),FI(M([n(a)]))))}),nP=Ir,aP=function(e){return e*nP/180},iP=gA(26),oP=function(e){return{$:"MoveY",a:e}},uP=r(function(e,t){return{$:"TransformComponent",a:e,b:t}}),sP=function(e){return f(uP,iP,oP(-e))},cP=gA(24),fP=r(function(e,t){return{$:"Rotate",a:e,b:t}}),lP=function(e){return f(uP,cP,f(fP,L(0,0,1),e))},dP=gA(19),hP=function(e){return qy(M([e.inset?"box-inset":"box-",kA(e.offset.a)+"px",kA(e.offset.b)+"px",kA(e.blur)+"px",kA(e.size)+"px",Mk(e.color)]))},pP=function(e){var t={blur:e.blur,color:e.color,inset:!1,offset:e.offset,size:e.size};return f(Ok,dP,l(fk,hP(t),"box-shadow",PA(t)))},gP=r(function(e,t){return f(Ok,Ak,h(_L,"b-"+Ri(e)+"-"+Ri(t),t,e,t,e))}),vP=function(e){var t=e.bottom,r=e.top,n=e.left,a=e.right;return $(r,t)&&$(n,a)?$(r,a)?LL(r):f(gP,n,r):f(Ok,Ak,h(_L,"b-"+Ri(r)+"-"+Ri(a)+"-"+Ri(t)+"-"+Ri(n),r,a,t,n))},yP=gA(12),mP=f(ox,yP,GI.textCenter),bP=l(Pk,1,1,1),CP=function(e){return f(IR,M([xk("focusable"),UI(PR(14)),_I(PR(14)),Fk(bP),tx,Ax(9),mP,vx(3),xL(e?l(Pk,59/255,.6,252/255):l(Pk,211/255,211/255,211/255)),pP({blur:1,color:e?d(wL,238/255,238/255,238/255,0):l(Pk,238/255,238/255,238/255),offset:_(0,0),size:1}),OR(e?l(Pk,59/255,.6,252/255):bP),LL(e?0:1)]),e?f(IR,M([xL(bP),_I(PR(6)),UI(PR(9)),lP(aP(-45)),$x,tx,sP(1),vP({bottom:2,left:2,right:0,top:0})]),_R):_R)},EP=n(function(e,t,r){return{$:"Label",a:e,b:t,c:r}}),SP={$:"OnRight"},TP=EP(SP),wP=r(function(e,t){return f(rP,vr,{checked:t.checked,icon:CP,label:f(TP,vr,ep(t.label)),onChange:f(HL,e,t.label)})}),IP={$:"Top"},AP=ZR(IP),BP=function(e){return f(Fx,M([px(15),AP]),M([f(IR,M([Ax(28),o_]),ep(KL(e.type_))),f(Fx,M([px(5)]),f(Ua,wP(e.type_),e.options))]))},kP=function(e){return f(fx,M([px(20)]),f(Ua,BP,e))},NP={$:"NoneFound"},$P={$:"AllFetched"},RP={$:"FetchingTrades"},xP={$:"QueryingNumTrades"},_P=function(e){var t=e.dataFetchState.total;if("Nothing"===t.$)return xP;if(t.a){var r=t.a;return x(e.dataFetchState.loaded,r-e.dataFetchState.invalid)<0?RP:$P}return NP},LP=r(function(e,t){var r=function(e){return f(IR,M([Ax(20),Tx,Fk(l_),$x]),ep(e))},n=f(Bg,Za(NP),f(Ua,_P,e))?M([r("No trades found.")]):f(Ua,r,$T(f(Ua,function(e){switch(_P(e).$){case"QueryingNumTrades":return fi("Querying "+WN(e.factory)+" Factory...");case"NoneFound":return li;case"FetchingTrades":return fi("Fetching "+WN(e.factory)+" Trades...");default:return li}},e)));return f(IR,M([UI(BR),xR(f(Fx,M([px(5),GL]),n))]),f(IR,M([$x]),f(Ji,VL,kP(t.filters))))}),PP=r(function(e,t){return f(IR,M([vx(4),OR(d(wL,0,0,1,.1)),Fk(l(DR,16,7,234)),Ax(e),Tx,f(ax,15,13)]),ep(sp(t)))}),DP=function(e){return function(){var t=Sm(e.wallet);return"Nothing"!==t.$&&$(t.a.address,e.agentAddress)}()?_R:f(fx,M([px(10),$x,OL({bottom:20,left:20,right:20,top:10})]),M([f(IR,M([Ax(24),Tx]),ep("Trade History for User")),f(PP,18,e.agentAddress)]))},UP=r(function(e,t){return{$:"Max",a:e,b:t}}),OP=r(function(e,t){return f(UP,e,t)}),MP=r(function(e,t){return f(IR,M([OL({bottom:40,left:0,right:0,top:60}),UI(BR)]),f(IR,M([OR(WR),vx(8),$x,UI(f(OP,e,BR)),pP({blur:20,color:d(wL,0,0,0,.06),offset:_(0,3),size:0})]),t))}),FP=n(function(e,t,r){return f(MP,1800,f(Fx,M([UI(BR),e_(30)]),M([DP(r),f(LP,t,r),function(){var n=f(Bg,f(tu,_P,Za($P)),t);return d(FL,e,n,t,r)}()])))}),VP=function(e){return{$:"AmountInChanged",a:e}},KP={$:"InTypeClicked"},HP=function(e){return{$:"InTypeSelected",a:e}},jP=function(e){return{$:"SearchInputChanged",a:e}},qP={$:"NoOp"},GP=function(e){return{$:"MayStopPropagation",a:e}},zP=r(function(e,t){return f(mx,e,GP(t))}),WP=OI,YP=function(e){return WP(f(zP,"click",Ki(_(e,!0))))},JP=kn,QP=JP,XP=a(function(e,t,r,n){return f(IR,M([U_(f(IR,M([OR(e),WP(f(QP,"position","fixed")),WP(f(QP,"z-index","1000")),WP(f(QP,"top","0")),WP(f(QP,"left","0")),WP(f(QP,"width","100%")),WP(f(QP,"height","100%")),Ex(r)]),_R)),UI(BR),_I(BR),YP(t)]),n)}),ZP=gA(33),eD={$:"Hover"},tD=r(function(e,t){return{$:"PseudoSelector",a:e,b:t}}),rD=xn,nD=r(function(e,t){switch(t.$){case"NoAttribute":return NR;case"Describe":var r=t.a;return Rx(r);case"AlignX":var n=t.a;return kx(n);case"AlignY":var a=t.a;return ZR(a);case"Width":var n=t.a;return DI(n);case"Height":var n=t.a;return xI(n);case"Class":var n=t.a,a=t.b;return f(ox,n,a);case"StyleClass":var i=t.a,o=t.b;return f(Ok,i,o);case"Nearby":var u=t.a,s=t.b;return f(kR,u,f(Yi,e,s));case"Attr":var c=t.a;return OI(f(rD,e,c));default:var l=t.a,d=t.b;return f(uP,l,d)}}),aD=function(e){return f(nD,SN,e)},iD=r(function(e,t){var r=t.a,n=t.b,a=aD(e);switch(a.$){case"StyleClass":var i=a.b;return _(f(Ra,i,r),n);case"TransformComponent":var o=(a.a,a.b);return _(r,f(Tk,n,o));default:return _(r,n)}}),oD=function(e){var t=l(_a,iD,_(vr,Nk),e),r=t.a,n=t.b;return f(Ra,lk(n),r)},uD=function(e){return f(Ok,ZP,f(tD,eD,oD(e)))},sD=f(ox,Qx,GI.scrollbarsY),cD=n(function(e,t,r){return f(IR,U(e,M([OR(WR),vx(6),pP({blur:20,color:d(wL,0,0,0,.08),offset:_(0,3),size:0})])),f(Fx,M([OR(P_),px(1),UI(BR),_I(f(OP,340,PI))]),M([f(Kc,_R,t),f(Fx,M([sD,UI(BR),_I(BR),OR(P_),px(1)]),f(Ua,function(e){var t=e.a,r=e.b;return f(IR,M([f(ax,14,10),OR(WR),UI(BR),Ex(r),ux,uD(M([OR(d(wL,0,0,1,.15))]))]),t)},r))])))}),fD=l(DR,213,217,222),lD=FR({description:"search",src:"/DAIHard/static/img/search.svg"}),dD=function(e){return{$:"HiddenLabel",a:e}},hD=dD,pD=r(function(e,t){return{$:"Placeholder",a:e,b:t}}),gD=pD,vD=Tn("span"),yD=kI("type"),mD=function(e){return _(e,!0)},bD=r(function(e,t){return l(Da,hl,t,e)}),CD=f(bD,M(["target","value"]),Su),ED=function(e){return f(zP,"input",f(Fi,mD,f(Fi,e,CD)))},SD={$:"TextArea"},TD=f(Ma,OI,jL("autocomplete")),wD=function(e){var t=r(function(e,t){if("StyleClass"===e.$&&"SpacingStyle"===e.b.$){var r=e.b,n=(r.b,r.c);return"Nothing"===t.$?fi(n):t}return t}),n=l(Da,t,li,e);if("Nothing"===n.$)return NR;var a=n.a;return sP(ri(a/2))},ID=l(Pk,186/255,189/255,182/255),AD=f(ax,12,12),BD=M([AD,vx(3),xL(ID),OR(bP),LL(1),px(5),UI(BR),_I(PI)]),kD=function(e){if("Height"===e.$){var t=e.a;return fi(t)}return li},ND=function(e){if("StyleClass"===e.$&&"PseudoSelector"===e.b.$&&"Focus"===e.b.a.$){var t=e.b;t.a;return!0}return!1},$D=function(e){e:for(;;)switch(e.$){case"Content":return!1;case"Px":case"Fill":return!0;case"Min":var t=e.b,r=t;e=r;continue e;default:var t=e.b;return!0}},RD=function(e){if("Label"!==e.$)return!0;switch(e.a.$){case"OnRight":case"OnLeft":return!1;case"Above":default:return!0}},xD=function(e){return{bottom:-e.bottom,left:-e.left,right:-e.right,top:-e.top}},_D=function(e){e:for(;;)switch(e.$){case"Fill":return!0;case"Content":case"Px":return!1;case"Min":default:var t=e.b,r=t;e=r;continue e}},LD=function(e){e:for(;;)switch(e.$){case"Content":return!1;case"Px":return!0;case"Fill":return!1;case"Min":default:var t=e.b,r=t;e=r;continue e}},PD=a(function(e,t,r,n){switch(r.$){case"Nearby":return D(n,{parent:f(Ra,r,n.parent)});case"Width":var a=r.a;return _D(a)?D(n,{fullParent:f(Ra,r,n.fullParent),input:f(Ra,r,n.input),parent:f(Ra,r,n.parent)}):t?D(n,{fullParent:f(Ra,r,n.fullParent)}):D(n,{parent:f(Ra,r,n.parent)});case"Height":var i=r.a;return t?_D(i)?D(n,{fullParent:f(Ra,r,n.fullParent),parent:f(Ra,r,n.parent)}):(LD(i),D(n,{parent:f(Ra,r,n.parent)})):D(n,{fullParent:f(Ra,r,n.fullParent),parent:f(Ra,r,n.parent)});case"AlignX":case"AlignY":return D(n,{fullParent:f(Ra,r,n.fullParent)});case"StyleClass":switch(r.b.$){case"SpacingStyle":r.b;return D(n,{fullParent:f(Ra,r,n.fullParent),input:f(Ra,r,n.input),parent:f(Ra,r,n.parent),wrapper:f(Ra,r,n.wrapper)});case"PaddingStyle":var o=(r.a,r.b),u=(o.a,o.b),s=o.c,c=o.d,l=o.e;if(e)return D(n,{cover:f(Ra,r,n.cover),parent:f(Ra,r,n.parent)});var d=OL({bottom:c-f(Rc,u,c),left:l,right:s,top:u-f(Rc,u,c)}),h=WP(f(QP,"line-height","calc(1.0em + "+Ri(2*f(Rc,u,c))+"px)")),p=WP(f(QP,"height","calc(1.0em + "+Ri(2*f(Rc,u,c))+"px)"));return D(n,{cover:f(Ra,r,n.cover),input:f(Ra,p,f(Ra,h,n.input)),parent:f(Ra,d,n.parent)});case"BorderWidth":r.b;return D(n,{cover:f(Ra,r,n.cover),parent:f(Ra,r,n.parent)});case"Transform":return D(n,{cover:f(Ra,r,n.cover),parent:f(Ra,r,n.parent)});case"FontSize":return D(n,{fullParent:f(Ra,r,n.fullParent)});case"FontFamily":r.b;return D(n,{fullParent:f(Ra,r,n.fullParent)});default:r.a,r.b;return D(n,{parent:f(Ra,r,n.parent)})}case"NoAttribute":return n;case"Attr":r.a;return D(n,{input:f(Ra,r,n.input)});case"Describe":return D(n,{input:f(Ra,r,n.input)});case"Class":return D(n,{parent:f(Ra,r,n.parent)});default:return D(n,{input:f(Ra,r,n.input)})}}),DD=n(function(e,t,r){return function(e){return{cover:La(e.cover),fullParent:La(e.fullParent),input:La(e.input),parent:La(e.parent),wrapper:La(e.wrapper)}}(l(_a,f(PD,e,t),{cover:vr,fullParent:vr,input:vr,parent:vr,wrapper:vr},r))}),UD=function(e){var t=e.top,r=e.right,n=e.bottom,a=e.left;return Ri(t)+"px "+Ri(r)+"px "+Ri(n)+"px "+Ri(a)+"px"},OD=gA(0),MD=r(function(e,t){return{$:"Transparency",a:e,b:t}}),FD=function(e){var t=function(e){return 1-e}(f(Rc,1,f(ni,0,e)));return f(Ok,OD,f(MD,"transparency-"+kA(t),t))},VD=l(Pk,136/255,138/255,133/255),KD=n(function(e,t,r){var n=e.a,a=e.b;return f(IR,U(t,U(M([Fk(VD),xk(GI.noTextSelection+" "+GI.passPointerEvents),Xx,xL(d(wL,0,0,0,0)),OR(d(wL,0,0,0,0)),_I(BR),UI(BR),FD(r?1:0)]),n)),a)}),HD=be,jD=r(function(e,t){return f(Nn,e,HD(t))}),qD=jD("spellcheck"),GD=f(Ma,OI,qD),zD=kI("value"),WD=f(Ma,OI,zD),YD=f(Ma,Wi,As),JD=n(function(e,t,r){var n=U(BD,t),a=l(DD,$(e.type_,SD),RD(r.label),n),i=function(){var t=e.type_;if("TextInputNode"===t.$){t.a;return!1}return f(Kc,!1,f(xo,$D,ov(La(f(_h,kD,n)))))}(),o=function(e){if("StyleClass"===e.$&&"PaddingStyle"===e.b.$){var t=(e.a,e.b),r=(t.a,t.b),n=t.c,a=t.d,i=t.e;return fi({bottom:f(ni,0,ri(a-3)),left:f(ni,0,ri(i-3)),right:f(ni,0,ri(n-3)),top:f(ni,0,ri(r-3))})}return li},u=f(Kc,{bottom:0,left:0,right:0,top:0},ov(La(f(_h,o,n)))),s=d(Rk,KI,function(){var t=e.type_;if("TextInputNode"===t.$){t.a;return MI("input")}return MI("textarea")}(),U(function(){var t=e.type_;if("TextInputNode"===t.$){var r=t.a;return M([OI(yD(r)),xk(GI.inputText)])}return M([Xx,_I(BR),xk(GI.inputMultiline),wD(n),OL(u),OI(f(QP,"margin",UD(xD(u)))),OI(f(QP,"box-sizing","content-box"))])}(),U(M([WD(r.text),OI(ED(r.onChange)),YL(r.label),GD(e.spellchecked),f(Kc,NR,f(xo,TD,e.autofill))]),a.input)),FI(vr)),c=function(){var t=e.type_;if("TextArea"===t.$)return d(Rk,KI,wR,U((i?Ra(sD):Fa)(M([UI(BR),f(fo,ND,n)?NR:xk(GI.focusedWithin),xk(GI.inputMultilineWrapper)])),a.parent),FI(M([d(Rk,iA,wR,f(Ra,UI(BR),f(Ra,_I(BR),f(Ra,xR(s),f(Ra,xk(GI.inputMultilineParent),a.wrapper)))),FI(function(){if(""===r.text){var e=r.placeholder;if("Nothing"===e.$)return M([ep(" ")]);var t=e.a;return M([l(KD,t,vr,""===r.text)])}return M([YD(f(vD,M([fA(GI.inputMultilineFiller)]),M([YB(r.text+" ")])))])}()))])));t.a;return d(Rk,KI,wR,f(Ra,UI(BR),f(Ra,f(fo,ND,n)?NR:xk(GI.focusedWithin),kb(M([a.parent,function(){var e=r.placeholder;if("Nothing"===e.$)return vr;var t=e.a;return M([U_(l(KD,t,a.cover,""===r.text))])}()])))),FI(M([s])))}();return l(zL,f(Ra,f(ox,ix,GI.cursorText),f(Ra,JL(r.label)?NR:px(5),f(Ra,tP,a.fullParent))),r.label,c)}),QD=JD({autofill:li,spellchecked:!1,type_:function(e){return{$:"TextInputNode",a:e}}("text")}),XD=i(function(e,t,r,n,a){var i=""===n?f(Ua,function(e){var t=e.a;e.b;return _(t,e.c)},r):f(_h,function(e){var t=e.a,r=e.b,a=e.c;return f(fo,Om(Zp(n)),f(Ua,Zp,r))?fi(_(t,a)):li},r);return l(cD,e,fi(f(IR,M([UI(BR),f(ax,9,15),OR(WR)]),f(fx,M([UI(BR),OR(l(Pk,.98,.98,.98)),f(ax,13,0),px(13),vx(4)]),M([f(XR,M([UI(PR(21))]),lD),f(QD,M([LL(0),UI(BR),OR(l(Pk,.98,.98,.98))]),{label:hD("search"),onChange:a,placeholder:fi(f(gD,M([Fk(fD)]),ep(t))),text:n})])))),i)}),ZD=function(e){return f(uP,iP,oP(e))},eU=n(function(e,t,r){return d(XP,d(wL,0,0,0,.1),qP,km,h(XD,M([UI(PR(300)),ZD(18),Ux]),"search cryptocurrencies",f(Ua,function(e){return L(f(fx,M([UI(BR),px(18)]),$T(M([Y_(e),fi(ep(e))]))),M([e]),r(e))},K_),e,t))}),tU=M([to(no),ro(eo)]),rU=function(e){return d(XP,d(wL,0,0,0,.1),qP,km,l(cD,M([UI(PR(300)),ZD(10),Ux]),li,f(Ua,function(t){return _(f(fx,M([UI(BR),px(18)]),$T(M([Y_($y(t)),fi(ep(E_(t)))]))),e(t))},tU)))},nU=Na(q_),aU=n(function(e,t,r){return d(XP,d(wL,0,0,0,.1),qP,km,h(XD,M([UI(PR(300)),ZD(18),Ux]),"search currencies",f(Ua,function(e){return L(f(fx,M([UI(BR),px(18)]),$T(M([Y_(e),fi(ep(e))]))),$T(M([fi(e),J_(e)])),r(e))},nU),e,t))}),iU=function(e){var t=e.mode;switch(t.$){case"OffRamp":return rU(f(Ma,HP,Up));case"CryptoSwap":if("Seller"===t.a.$){t.a;return rU(f(Ma,HP,Up))}t.a;return l(eU,e.inputs.currencySearch,jP,f(Ma,HP,Op));default:return l(aU,e.inputs.currencySearch,jP,f(Ma,HP,Op))}},oU=function(e){return fx(U(M([OR(P_),_I(PR(55)),vx(4),LL(1),xL(P_),px(1)]),e))},uU=n(function(e,t,r){return f(fx,M([OR(l(Pk,.98,.98,.98)),_I(BR),e_(13),px(13),ux,YP(r)]),M([f(Kc,_R,Y_(Ry(t))),ep(Ry(t)),f(XR,M([UI(PR(12))]),e?a_:n_)]))}),sU=a(function(e,t,r,n){return f(Fx,U(e,M([px(10)])),M([f(fx,M([px(20)]),M([f(IR,M([Ax(18),Tx,Fk(l(DR,1,31,52)),GL]),ep(t)),function(){if("Just"===r.$){var e=r.a;return f(IR,M([Ax(12),Fk(zR)]),ep(e))}return _R}()])),n]))}),cU={$:"Below"},fU=function(e){return f($R,cU,e)},lU=function(e){return d(sU,M([UI(BR)]),"I want to Sell",e.errors.amountIn,f(oU,M([UI(BR)]),M([f(QD,M([UI(BR),_I(BR),LL(0)]),{label:hD("amount in"),onChange:VP,placeholder:fi(f(gD,M([Fk(fD)]),ep("0"))),text:e.inputs.amountIn}),f(IR,U(M([_I(BR)]),e.showInTypeDropdown?M([fU(iU(e))]):vr),l(uU,e.showInTypeDropdown,e.inputs.inType,KP))])))},dU=function(e){return{$:"AmountOutChanged",a:e}},hU={$:"OutTypeClicked"},pU=function(e){return{$:"OutTypeSelected",a:e}},gU=function(e){var t=e.mode;switch(t.$){case"CryptoSwap":if("Seller"===t.a.$){t.a;return l(eU,e.inputs.currencySearch,jP,f(Ma,pU,Op))}t.a;return rU(f(Ma,pU,Up));case"OffRamp":return l(aU,e.inputs.currencySearch,jP,f(Ma,pU,Op));default:return rU(f(Ma,pU,Up))}},vU=function(e){return d(sU,M([UI(BR)]),"In Exchange for",e.errors.amountOut,f(oU,M([UI(BR)]),M([f(QD,M([UI(BR),_I(BR),LL(0)]),{label:hD("amount out"),onChange:dU,placeholder:fi(f(gD,M([Fk(fD)]),ep("0"))),text:e.inputs.amountOut}),f(IR,U(M([_I(BR)]),e.showOutTypeDropdown?M([fU(gU(e))]):vr),l(uU,e.showOutTypeDropdown,e.inputs.outType,hU))])))},yU={$:"MarginBoxClicked"},mU=function(e){return f(IR,M([Ax(20),Tx]),ep(f(SL,2,Xu(100*e))+"%"))},bU=function(e){return f(IR,M([Ux,_I(BR),OR(l(Pk,.98,.98,.98)),e_(13)]),f(XR,M([tx]),e?a_:n_))},CU=function(e){return d(Lk,e.red,e.green,e.blue,e.alpha)},EU=function(e){var t=e.a,r=e.b,n=e.c;return{alpha:e.d,blue:n,green:r,red:t}},SU=r(function(e,t){var r=EU(t);return CU(D(r,{alpha:e}))}),TU=d(wL,1,0,0,.2),wU=a(function(e,t,r,n){return d(Lk,e/255,t/255,r/255,n)}),IU=function(e){var t=e?e>0?L("Profit",d(wU,0,188,137,.05),l(DR,0,188,137)):L("Loss",f(SU,.5,TU),TU):L("Even",d(wU,16,7,234,.05),l(DR,16,7,234)),r=t.a,n=t.b,a=t.c;return f(IR,M([e_(7)]),f(IR,M([f(ax,15,9),OR(n),vx(4),Fk(a),Ax(20),Tx]),ep(r)))},AU=n(function(e,t,r){return d(sU,e,t,li,r)}),BU=function(e){return l(AU,M([UI(BR)]),"Margin",f(oU,M([UI(BR),ux,YP(yU)]),M([f(fx,M([_I(BR),UI(BR),OR(WR),px(13)]),M([IU(e.margin),mU(e.margin)])),bU(e.showMarginModal)])))},kU=function(e){return{$:"MarginButtonClicked",a:e}},NU=function(e){return{$:"MarginInputChanged",a:e}},$U={$:"Profit"},RU=a(function(e,t,r,n){return f(IR,U(M([OR(e),vx(4),f(ax,22,16),Fk(t),Ax(20)]),function(){if("Just"===n.$){var e=n.a;return M([ux,Ex(e)])}return vr}()),ep(r))}),xU={$:"Above"},_U=function(e){return f($R,xU,e)},LU=n(function(e,t,r){return d(XP,d(wL,0,0,0,.1),qP,km,f(Fx,M([Ux,sP(10),vx(8),OR(P_),Xx,px(1),pP({blur:20,color:d(wL,0,0,0,.08),offset:_(0,3),size:0})]),M([f(IR,M([f(ax,23,18),OR(WR)]),f(Fx,M([UI(BR),px(10)]),M([f(IR,M([Ax(20),Tx,Fk(l(DR,16,7,234))]),ep("Margin")),f(_x,M([Ax(16),Fk(d(wL,0,0,0,.75))]),M([ep("This is how much you want to either make as a profit or loss from this trade. Trading at a loss can help to find a buyer fast, but it's possible to trade at a profit if your payment method is highly convenient to the other party.")]))]))),function(){var n=l(DR,10,33,108),a=d(wU,10,33,108,.04);return f(fx,M([UI(PI),OR(WR),f(ax,23,18),px(12)]),M([f(oU,M([UI(PR(140)),_U(function(){if("Just"===r.$){var e=r.a;return f(IR,M([Ax(12),Fk(zR),sP(16),GL,OR(WR),vP({bottom:0,left:1,right:1,top:0}),f(ax,5,0),xL(P_)]),ep(e))}return _R}())]),M([f(QD,M([LL(0),UI(BR),_I(BR)]),{label:hD("margin"),onChange:NU,placeholder:li,text:t+"%"})])),e<0?d(RU,TU,WR,"Loss",li):d(RU,a,n,"Loss",fi(kU(iy))),e?d(RU,a,n,"Even",fi(kU(Gp))):d(RU,l(DR,16,7,234),WR,"Even",li),e>0?d(RU,l(DR,0,188,137),WR,"Profit",li):d(RU,a,n,"Profit",fi(kU($U)))]))}()])))}),PU={$:"Bottom"},DU=ZR(PU),UU=function(e){return f(fx,M([UI(BR),px(25)]),U(M([f(IR,M([UI(Zx(2))]),vU(e))]),function(){return"CryptoSwap"===e.mode.$?M([f(IR,M([Ax(28),Fk(d(wL,.05,.1,.3,.25)),Tx,DU,OL({bottom:14,left:0,right:0,top:0})]),ep("@")),f(IR,M([UI(Zx(1)),_U(e.showMarginModal?l(LU,e.margin,e.inputs.margin,e.errors.margin):_R)]),BU(e))]):vr}()))},OU={$:"Expiry"},MU={$:"Judgment"},FU={$:"Payment"},VU=function(e){return{$:"IntervalInputChanged",a:e}},KU=function(e){return{$:"IntervalUnitChanged",a:e}},HU={$:"Minute"},jU={$:"Week"},qU=i(function(e,t,n,a,i){var o=function(){switch(e.$){case"Expiry":return _("Offer Expiry","This is how long your offer remains valid and visible in the marketplace. Note that you can manually recall the trade at any time, as long as no one has yet committed to it.");case"Payment":return _("Payment Due",function(){return"Buyer"===t.$?'Once a Seller commits, this is how long you to work with the Seller to complete the payment, and click "confirm payment". We recommend setting this to about 2X or 3X more than you expect you\'ll need!':'Once a Buyer commits, this is how long they have to work with you to complete the payment and click "confirm payment". We recommend setting this to about 2X or 3X more than you expect you\'ll need!'}());default:return _("Burn Window",function(){return"Buyer"===t.$?"Once you confirm payment, this is how long the Seller will have the option to burn the entire Dai/xDai balance (or manually release early). If the Seller makes no decision before this timer expires, the Dai/xDai balance is yours to claim.":"Once the Buyer confirms payment, this is how long you will have the option to burn the entire Dai/xDai balance (or manually release early). If you don't make a decision before this timer expires, the Buyer can then claim the Dai/xDai balance."}())}}(),u=o.a,s=o.b;return d(XP,d(wL,0,0,0,.1),qP,km,f(Fx,M([sP(10),vx(8),OR(P_),px(1),Xx,pP({blur:20,color:d(wL,0,0,0,.08),offset:_(0,3),size:0}),$(e,MU)?Ux:GL]),M([f(IR,M([f(ax,23,18),OR(WR),UI(BR)]),f(Fx,M([UI(BR),px(10)]),M([f(IR,M([Ax(20),Tx,Fk(l(DR,16,7,234))]),ep(u)),f(_x,M([Ax(16),Fk(d(wL,0,0,0,.75))]),M([ep(s)]))]))),function(){var e=r(function(e,t){return d(RU,t?l(DR,16,7,234):d(wU,10,33,108,.04),t?WR:l(DR,10,33,108),Zp(_y(e)+"s"),t?li:fi(KU(e)))});return f(fx,M([f(ax,23,18),OR(WR),px(12)]),M([f(oU,M([UI(PR(140)),_U(function(){if("Just"===i.$){var e=i.a;return f(IR,M([Ax(12),Fk(zR),sP(16),GL,OR(WR),vP({bottom:0,left:1,right:1,top:0}),f(ax,5,0),xL(P_)]),ep(e))}return _R}())]),M([f(QD,M([LL(0),UI(BR),_I(BR)]),{label:hD(u+" input"),onChange:VU,placeholder:li,text:a})])),f(e,HU,$(n.unit,HU)),f(e,_p,$(n.unit,_p)),f(e,xp,$(n.unit,xp)),f(e,jU,$(n.unit,jU))]))}()])))}),GU=function(e){return{$:"WindowBoxClicked",a:e}},zU=function(e){return f(IR,M([Ax(20),o_]),ep(Ri(e.num)+" "+_y(e.unit)+(1===e.num?"":"s")))},WU=n(function(e,t,r){return l(AU,M([UI(BR)]),function(){switch(e.$){case"Expiry":return"Offer Expiry";case"Payment":return"Payment Due";default:return"Burn Window"}}(),f(oU,M([UI(BR),ux,YP(GU(e))]),M([f(IR,M([_I(BR),UI(BR),OR(WR),f(ax,15,17)]),zU(t)),bU(r)])))}),YU=r(function(e,t){var r=$(t.showIntervalModal,fi(e));return f(IR,M([UI(BR),_U(r?h(qU,e,ly(t.mode),f(xy,e,t),t.inputs.interval,t.errors.interval):_R)]),l(WU,e,f(xy,e,t),r))}),JU=function(e){return f(fx,M([UI(BR),px(23)]),M([f(YU,OU,e),f(YU,FU,e),f(YU,MU,e)]))},QU=function(e){return{$:"ReceiveAddressChanged",a:e}},XU=r(function(e,t){return l(AU,M([UI(BR)]),e+" Receive Address",f(oU,M([UI(BR)]),M([f(QD,M([UI(BR),_I(BR),LL(0)]),{label:hD("receive address"),onChange:QU,placeholder:li,text:t})])))}),ZU=function(e){return{$:"PaymentMethodChanged",a:e}},eO=r(function(e,t){return l(JD,{autofill:li,spellchecked:t.spellcheck,type_:SD},e,{label:t.label,onChange:t.onChange,placeholder:t.placeholder,text:t.text})}),tO=r(function(e,t){return l(AU,M([UI(BR)]),function(){return"Buyer"===e.$?"Making the Payment":"Accepting the Payment"}(),f(oU,M([_I(PR(134)),UI(BR)]),M([f(eO,M([UI(BR),_I(BR),LL(0),sD]),{label:hD("payment method"),onChange:ZU,placeholder:fi(f(gD,M([Fk(fD)]),f(Fx,M([px(5)]),function(){return M("Buyer"===e.$?[ep("Indicate here how you will send payment to the Seller. Some examples:"),ep('"I can send to any EU bank"'),ep('"I\'ll reveal a hidden cash drop within 10 km of Grand Central Station"'),ep('"Can send via ecocash"')]:[ep("Indicate here how you will send payment to the Buyer. Some examples:"),ep('"I have TransferWise"'),ep('"I can pick up a cash drop within 10 km of Grand Central Station"'),ep('"I can pick up a WorldRemit payment to Zimbabwe"')])}()))),spellcheck:!0,text:t})])))}),rO=function(e){var t=e.mode;switch(t.$){case"CryptoSwap":if("Seller"===t.a.$){var r=(t.a,e.inputs.outType);if("External"===r.$){var n=r.a;return f(XU,n,e.inputs.receiveAddress)}f(op,"Unexpected currency type for outType!",e.inputs.outType);return _R}t.a;return _R;case"OffRamp":return f(tO,yo,e.inputs.paymentMethod);default:return f(tO,vo,e.inputs.paymentMethod)}},nO=function(e){if("Token"===e.$){if("EthDai"===e.a.$){e.a;return"Ethereum"}e.a;return"Kovan"}switch(e.a.$){case"Eth":e.a;return"Ethereum";case"Kovan":e.a;return"Kovan";default:e.a;return"xDai"}},aO=function(e){return{$:"CmdUp",a:e}},iO=n(function(e,t,r){return{$:"PlaceOrderClicked",a:e,b:t,c:r}}),oO=function(e){return f(xo,cm,f(xo,function(){return"Seller"===ly(e.mode).$?function(e){return e/1.01}:Fa}(),e.dhTokenAmount))},uO=function(e){return f(xo,yE(e.foreignCurrencyType),e.foreignCurrencyAmount)},sO=function(e){var t=e.mode;switch(t.$){case"CryptoSwap":if("Buyer"===t.a.$){t.a;return fi(M([f(CE,TE,"Provide your "+e.foreignCurrencyType+" address immediately upon commitment, via chat.")]))}t.a;return""===e.inputs.receiveAddress?li:fi(M([f(CE,TE,"Pay to "+e.inputs.receiveAddress+" immediately upon commitment.")]));case"OffRamp":default:return""===e.inputs.paymentMethod?li:fi(M([f(CE,TE,e.inputs.paymentMethod)]))}},cO=function(e){return Ho(e.num*function(){switch(e.unit.$){case"Minute":return 60;case"Hour":return 3600;case"Day":return 86400;default:return 604800}}()*1e3)},fO=function(e){return d(OS,n(function(t,r,n){return{autoabortInterval:cO(oo(e.intervals)),autorecallInterval:cO(io(e.intervals)),autoreleaseInterval:cO(uo(e.intervals)),initiatorRole:ly(e.mode),paymentMethods:n,price:r,tradeAmount:t}}),oO(e),uO(e),sO(e))},lO=function(e){var t=i(function(e,t,r,n,a){return f(IR,U(M([UI(BR),e_(17),vx(4),Ax(20),Tx,mP,OR(e),Fk(t),_U(function(){if("Just"===a.$){var e=a.a;return f(IR,M([Ax(12),Fk(zR),sP(16),$x]),ep(e))}return _R}())]),function(){if("Just"===n.$){var e=n.a;return M([ux,Ex(e)])}return vr}()),ep(r))}),r=Sm(e.wallet);if("Just"===r.$){var n=r.a;if($(jp(e.wallet),fi(e.dhTokenType))){var a=fO(e);if("Just"===a.$){var o=a.a;return h(t,l(DR,255,0,110),WR,"Review Terms and Place Order",fi(l(iO,e.dhTokenType,n,o)),li)}return h(t,P_,B_,"Review Terms and Place Order",li,li)}return f(_x,M([Ax(18),ML,Fk(l_),$x]),M([ep("You must switch your wallet to the "+nO(e.dhTokenType)+" network to create a trade with "+E_(e.dhTokenType)+".")]))}return h(t,zR,WR,"Connect to Wallet",fi(aO(ma)),li)},dO={$:"SwapClicked"},hO=a(function(e,t,r,n){return{$:"RgbaSpace",a:e,b:t,c:r,d:n}}),pO=a(function(e,t,r,n){return d(hO,e,t,r,n)}),gO=function(e){return function(e){return d(pO,e.red,e.green,e.blue,e.alpha)}(EU(e))},vO=YD,yO=function(e){return{$:"Circle",a:e}},mO=yO,bO=d(hO,0,0,0,1),CO={$:"Flat"},EO={$:"Sharp"},SO=function(e){return{$:"Uniform",a:e}},TO=SO,wO={cap:CO,dashPattern:vr,dashPhase:0,fill:TO(bO),join:EO,thickness:2},IO=n(function(e,t,r){return D(wO,{dashPattern:e,fill:r,thickness:t})}),AO=IO(vr),BO={$:"Transparent"},kO=BO,NO=f(AO,0,kO),$O=r(function(e,t){return{$:"Shape",a:e,b:t}}),RO=function(e){return{basic:e,handlers:vr,name:li,opacity:1,rotation:0,scale:_(1,1),shift:_(0,0)}},xO=function(e){return f(Ma,RO,$O(e))},_O=function(e){return xO(_(e,NO))},LO=function(e){return _(-e.a,-e.b)},PO=r(function(e,t){var r=e.a,n=e.b,a=t.shift;return D(t,{shift:_(a.a+r,a.b+n)})}),DO=r(function(e,t){return f(PO,LO(e(t)),t)}),UO=function(e){var t=r(function(e,t){var r=e.a,n=e.b,a=t.a,i=t.b;return _(f(Ra,r,a),f(Ra,n,i))});return l(Da,t,_(vr,vr),e)},OO=r(function(e,t){return{$:"Path",a:e,b:t}}),MO=Ar,FO=Br,VO=function(e){var t=e.shift,r=e.scale,n=e.rotation,a=function(e){var t=e.a,r=e.b,a=FO(n),i=MO(n);return _(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 _(o*t,u*r)},c=t,l=c.a,d=c.b;return f(Ma,f(Ma,function(e){var t=e.a,r=e.b;return _(t+l,r+d)},s),a)},KO=function(e){return Ua(function(t){var r=t.a,n=t.b,a=e/2;return _(r<0?r-a:r+a,n<0?n-a:n+a)})},HO=r(function(e,t){var r=t.a,n=t.b,a=n/2,i=r/2;return f(KO,e,M([_(-i,-a),_(i,-a),_(i,a),_(-i,a)]))}),jO=function(e){var t=e.toTop,r=e.toBottom,n=e.toRight,a=e.toLeft;return M([_(-a,-r),_(n,-r),_(n,t),_(-a,t)])},qO=function(e){var t=GO(e.basic),r=UO(f(Ua,VO(e),t)),n=r.a,a=r.b;return{toBottom:-f(Kc,0,UB(a)),toLeft:-f(Kc,0,UB(n)),toRight:f(Kc,0,DB(n)),toTop:f(Kc,0,DB(a))}},GO=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(HO,r,_(a,a));case"Ellipse":var i=e.a,r=i.b.thickness,o=e.b,u=o.a,s=o.b;return f(HO,r,_(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(HO,r,_(d,h));case"Polygon":var p=e.a,r=p.b.thickness,g=e.b.a;return f(KO,r,g);default:var v=e.a,y=v.b,m=e.b.a,b=f(OO,y,m);e=b;continue e}case"Path":var r=e.a.thickness,C=e.a.cap,g=e.b.a;return f(KO,$(C,CO)?0:r,g);case"Text":case"Image":case"Html":var E=e.a;return f(HO,0,E);case"Group":var S=e.a;return f(KO,0,kb(f(Ua,f(tu,qO,jO),S)));default:var T=e.b;return f(KO,0,jO(qO(T)))}},zO=function(e){var t=qO(e);return t.toTop+t.toBottom},WO=function(e){var t=qO(e);return _(-t.toLeft,t.toTop)},YO=function(e){var t=qO(e);return t.toLeft+t.toRight},JO=Sn("http://www.w3.org/2000/svg"),QO=JO("svg"),XO=$n("height"),ZO=$n("version"),eM=$n("width"),tM=JO("circle"),rM=JO("ellipse"),nM=JO("foreignObject"),aM=JO("g"),iM=JO("image"),oM=JO("polygon"),uM=JO("polyline"),sM=JO("rect"),cM=MA,fM=JO("text"),lM=$n("id"),dM=$n("points"),hM=$n("r"),pM=$n("rx"),gM=$n("ry"),vM=function(e){return l(Rn,"http://www.w3.org/1999/xlink","xlink:href",nt(e))},yM=function(e){return{$:"Group",a:e}},mM=$n("dominant-baseline"),bM=$n("fill"),CM=$n("fill-opacity"),EM=$n("font-family"),SM=$n("font-size"),TM=$n("font-style"),wM=$n("font-variant"),IM=$n("font-weight"),AM=$n("opacity"),BM=$n("stroke"),kM=$n("stroke-dasharray"),NM=$n("stroke-dashoffset"),$M=$n("stroke-linecap"),RM=$n("stroke-linejoin"),xM=$n("stroke-opacity"),_M=$n("stroke-width"),LM=$n("text-anchor"),PM=$n("text-decoration"),DM=$n("transform"),UM=function(e){switch(e.$){case"Round":return"round";case"Padded":return"square";default:return"butt"}},OM=function(e){return f(xi," ",f(Ua,function(e){var t=e.a,r=e.b;return f(xi,",",M([Ri(t),Ri(r)]))},e))},MM=n(function(e,t,r){return d(hO,e,t,r,1)}),FM=function(e){var t=e.a,r=e.b,n=e.c,a=e.d,i=function(e){return Yl(1e4*e)/100};return qy(M(["rgba(",uy(i(t)),"%,",uy(i(r)),"%,",uy(i(n)),"%,",uy(function(e){return Yl(1e3*e)/1e3}(a)),")"]))},VM=function(e){var t=e.a,r=e.b,n=e.c;return{alpha:e.d,blue:n,green:r,red:t}},KM=function(e){var t=VM(e),r=t.red,n=t.green,a=t.blue;return FM(l(MM,r,n,a))},HM=function(e){if("Uniform"===e.$){var t=e.a;return KM(t)}return"none"},jM=function(e){var t=VM(e),r=t.alpha;return uy(r)},qM=function(e){if("Uniform"===e.$){var t=e.a;return jM(t)}return"0"},GM=function(e){switch(e.$){case"Smooth":return"round";case"Sharp":return"miter";default:return"bevel"}},zM=function(e){var t=uy(e.scale.b),r=uy(e.scale.a),n=uy(-e.rotation/2/nP*360),a=uy(-e.shift.b),i=uy(e.shift.a);return qy(M(["translate(",i,",",a,") scale(",r,",",t,") rotate(",n,")"]))},WM=function(e){var t=e.basic;switch(t.$){case"Path":var r=t.a;return M([BM(HM(r.fill)),xM(qM(r.fill)),_M(uy(r.thickness)),$M(UM(r.cap)),RM(GM(r.join)),bM("none"),AM(uy(e.opacity)),DM(zM(e)),NM(Ri(r.dashPhase)),kM(OM(r.dashPattern))]);case"Shape":var n=t.a,a=n.a,r=n.b;return M([bM(HM(a)),CM(qM(a)),BM(HM(r.fill)),xM(qM(r.fill)),_M(uy(r.thickness)),$M(UM(r.cap)),RM(GM(r.join)),AM(uy(e.opacity)),DM(zM(e)),NM(Ri(r.dashPhase)),kM(OM(r.dashPattern))]);case"Text":var i=t.b,o=i.a;i.b;return M([bM(HM(SO(o.color))),EM(function(){var e=o.typeface;switch(e.$){case"Serif":return"serif";case"Sansserif":return"sans-serif";case"Monospace":return"monospace";default:return e.a}}()),SM(Ri(o.size)),IM(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"}}()),TM(function(){switch(o.shape.$){case"Upright":case"SmallCaps":return"normal";case"Slanted":return"oblique";default:return"italic"}}()),wM(function(){return"SmallCaps"===o.shape.$?"small-caps":"normal"}()),PM(function(){switch(o.line.$){case"None":return"none";case"Under":return"underline";case"Over":return"overline";default:return"line-through"}}()),LM("middle"),mM("middle"),DM(zM(e))]);default:return M([DM(zM(e))])}},YM=$n("x"),JM=$n("y"),QM=r(function(e,t){return M([eM(uy(e)),XO(uy(t)),YM(uy(-e/2)),JM(uy(-t/2))])}),XM=function(e){return f(xi," ",f(Ua,function(e){var t=e.a,r=e.b;return f(xi,",",M([uy(t),uy(-r)]))},e))},ZM=bx,eF=r(function(e,t){return f(e,t.a,t.b)}),tF=function(e){return f(Ua,eF(ZM),e)},rF=function(e){e:for(;;){var t=f(Kc,"_unnamed_",e.name),n=e.basic;switch(n.$){case"Path":var a=(n.a,n.b),i=a.a;return f(uM,U(M([lM(t),dM(XM(i))]),U(WM(e),tF(e.handlers))),vr);case"Shape":var o=n.a,u=(o.a,o.b),s=n.b;switch(s.$){case"Polygon":var i=s.a;return f(oM,U(M([lM(t),dM(XM(i))]),U(WM(e),tF(e.handlers))),vr);case"Circle":var c=s.a;return f(tM,U(M([lM(t),hM(uy(c))]),U(WM(e),tF(e.handlers))),vr);case"Ellipse":var d=s.a,h=s.b;return f(rM,U(M([lM(t),pM(uy(d)),gM(uy(h))]),U(WM(e),tF(e.handlers))),vr);case"Rectangle":var p=s.a,g=s.b,c=s.c;return f(sM,U(M([lM(t),pM(uy(c)),gM(uy(c))]),U(f(QM,p,g),U(WM(e),tF(e.handlers)))),vr);default:var a=s.a,v=D(e,{basic:f(OO,u,a)});e=v;continue e}case"Text":var y=n.b,m=(y.a,y.b);return f(fM,U(M([lM(t)]),U(WM(e),tF(e.handlers))),M([cM(m)]));case"Image":var b=n.a,p=b.a,g=b.b,C=n.b;return f(iM,U(M([lM(t),vM(C)]),U(f(QM,p,g),U(WM(e),tF(e.handlers)))),vr);case"Html":var E=n.a,p=E.a,g=E.b,S=n.b;return f(nM,U(M([lM(t)]),U(f(QM,p,g),U(WM(e),tF(e.handlers)))),M([S]));case"Group":var T=n.a;return f(aM,f(Ra,lM(t),U(WM(e),tF(e.handlers))),l(_a,r(function(e,t){return f(Ra,rF(e),t)}),vr,T));default:var w=n.a,I=n.b,v=D(e,{basic:yM(M([w,I]))});e=v;continue e}}},nF=r(function(e,t){var r=e.a,n=e.b,a=uy(r),i=uy(n);return f(oA,vr,M([f(QO,M([eM(a),XO(i),ZO("1.1")]),M([rF(t)]))]))}),aF=function(e){return f(nF,_(YO(e),zO(e)),f(DO,WO,e))},iF=a(function(e,t,r,n){var a=vO(aF(f(_O,TO(gO(r)),mO(t/2))));return f(IR,U(M([xR(f(IR,M([$x,tx]),n))]),e),a)}),oF=FR({description:"swap",src:"/DAIHard/static/img/vertical-swap.svg"}),uF=d(iF,M([ux,Ex(dO)]),52,d(wL,.05,.03,.92,.05),f(XR,M([_I(PR(30))]),oF)),sF=function(e){return f(Fx,M([UI(BR),e_(20),px(25)]),M([lU(e),function(){return"CryptoSwap"===e.mode.$?f(IR,M([$x]),uF):_R}(),UU(e),rO(e),JU(e),lO(e)]))},cF=function(e){return{$:"ChangeMode",a:e}},fF=r(function(e,t){var r=function(){switch(t.$){case"CryptoSwap":return"Crypto Portal";case"OffRamp":return"Get Fiat";default:return"Get More Dai"}}(),n=e?1:.15;return f(IR,M([Ax(28),Tx,Fk(d(wL,0,0,0,n)),ux,Ex(cF(t))]),ep(r))}),lF=function(e){var t=function(){switch(e.$){case"CryptoSwap":if("Seller"===e.a.$){e.a;return"Trade Dai/xDai for another crypto. Choose the amounts and types of crypto, and fill in your crypto receive address. Advanced users may wish to change the three trade windows."}e.a;return"Trade another crypto for Dai/xDai. Choose the amounts and types of crypto, and advanced users may wish to change the three trade windows.";case"OffRamp":return"Turn your Dai/xDai into any local currency. Choose your amounts and fiat type, describe how you can accept the fiat payment from a Buyer, and if necessary edit the three trade windows.";default:return"Deposit Dai/xDai to begin a fiat purchase to get 3X more Dai/xDai than your deposit. Choose your amounts and fiat type, describe how you can make the fiat payment to a Seller, and if necessary edit the three trade windows."}}();return f(Fx,M([UI(BR),px(20),e_(30)]),M([f(fx,M([px(40),$x]),M([f(fF,$(e,Dp(yo))||$(e,Dp(vo)),Dp(yo)),f(fF,$(e,Mp),Mp),f(fF,$(e,Fp),Fp)])),f(_x,M([Ax(16)]),M([ep(t)]))]))},dF=l(Pk,0,0,1),hF=r(function(e,t){var r=t.url,n=t.label;return d(Rk,KI,MI("a"),f(Ra,OI(NI(r)),f(Ra,OI($I("noopener noreferrer")),f(Ra,UI(PI),f(Ra,_I(PI),f(Ra,xk(GI.contentCenterX+" "+GI.contentCenterY+" "+GI.link),e))))),FI(M([n])))}),pF=f(hF,M([vx(4),UI(BR),ux,f(ax,22,15),OR(dF),Fk(WR),Tx,Ax(20),$x,UI(PI),_I(PI)]),{label:f(_x,M([mP]),M([ep("Join the Telegram Group")])),url:"https://t.me/daihardexchange_group"}),gF=function(e){return f(yg,vg(e.tradeAmount),f(lg,e.tradeAmount,200))},vF=function(e){return{abortPunishment:e.abortPunishment,autoabortInterval:e.autoabortInterval,autorecallInterval:e.autorecallInterval,autoreleaseInterval:e.autoreleaseInterval,buyerDeposit:e.buyerDeposit,initiatorAddress:e.initiatorAddress,initiatorRole:e.initiatorRole,pokeReward:e.pokeReward,tradeAmount:e.tradeAmount}},yF=function(e){return"Buyer"===e.initiatorRole.$?yo:vo},mF=function(e){return"Buyer"===yF(vF(e)).$?e.buyerDeposit:e.tradeAmount},bF={$:"AbortCreate"},CF=n(function(e,t,r){return{$:"ConfirmCreate",a:e,b:t,c:r}}),EF=function(e){return Ri(e.num)+" "+_y(e.unit)+(1!==e.num?"s":"")},SF=Ls(xE(8226)),TF=FR({description:"close",src:"/DAIHard/static/img/remove-circle.svg"}),wF=function(e){return f(IR,M([e_(10),Ex(e),ux]),f(XR,M([UI(PR(22))]),TF))},IF=a(function(e,t,r,n){return d(XP,d(wL,0,0,.3,.6),r,n,f(IR,U(M([$x,tx,UI(f(OP,700,BR)),OR(WR),vx(8),xR(f(IR,M([Ux,AP]),wF(n)))]),e),t))}),AF=r(function(e,t){if("Nothing"===t.$)return _R;var r=t.a;return f(IR,U(M([vx(5),xL(zR),LL(1),OR(l(Pk,1,.4,.4)),e_(5),$x,tx,UI(f(OP,200,PI)),Ax(14)]),e),f(_x,vr,M([ep(r)])))}),BF=r(function(e,t){return f(IR,M([vx(4),f(ax,25,17),Ax(18),Tx,OR(P_),_U(f(AF,M([sP(5)]),t))]),ep(e))}),kF=gA(32),NF={$:"Active"},$F=function(e){return f(Ok,kF,f(tD,NF,oD(e)))},RF=a(function(e,t,r,n){var a=e.a,i=e.b,o=e.c;return f(IR,M([vx(4),ux,Ex(n),f(ax,25,17),Fk(t),Ax(18),Tx,OR(a),$F(M([OR(o)])),uD(M([OR(i)]))]),ep(r))}),xF=r(function(e,t){return d(RF,L(d(wL,1,0,0,1),d(wL,1,0,0,.8),d(wL,1,0,0,.6)),WR,e,t)}),_F=n(function(e,t,r){return d(XP,d(wL,0,0,.3,.6),t,r,f(Fx,M([px(10),$x,tx,OR(d(wL,0,0,0,.5)),vx(8),e_(20)]),f(Ua,function(e){return f(_x,M([$x,tx,Ax(20),Tx,Fk(WR),mP]),M([e]))},e)))}),LF=r(function(e,t){if("Token"===e.$){if("EthDai"===e.a.$){e.a;return"https://etherscan.io/tx/"+Jk(t)}e.a;return"https://kovan.etherscan.io/tx/"+Jk(t)}switch(e.a.$){case"Eth":e.a;return"https://etherscan.io/tx/"+Jk(t);case"Kovan":e.a;return"https://kovan.etherscan.io/tx/"+Jk(t);default:e.a;return"https://blockscout.com/poa/dai/tx/"+Jk(t)}}),PF=xk(GI.underline),DF=r(function(e,t){switch(e.$){case"Confirm":var r=e.a,n=e.b,a=f(IR,M([ux,Ex(bF),f(ax,25,17),Fk(WR),Ax(18),Tx]),ep("I'm not ready yet. Go back.")),i=f(Ma,IR(M([Lx,Fk(B_)])),ep),o=i(EF(f(xy,OU,t))),u=i(EF(f(xy,MU,t))),s=i(EF(f(xy,FU,t))),c=f(Ma,IR(M([Tx,Fk(dF)])),ep),h=c(BL(n.buyerDeposit)+" "+E_(r)),p=c(BL(gF(n))+" "+E_(r)),g=c(TL(n.price)),v=c(BL(f(yg,n.tradeAmount,n.buyerDeposit))+" "+E_(r)),y=c(BL(n.tradeAmount)+" "+E_(r)),m=function(){var e=t.depositAmount;if("Just"===e.$){var a=e.a,i=BL(f(yg,gF(n),f(yg,a,mF(n))))+" "+E_(r),o=BL(a)+" "+E_(r);return L(c(o),c(i),f(xF,"Understood. Deposit "+o+" and open this trade.",l(CF,r,n,a)))}return L(c("??"),c("??"),f(BF,"(loading exact fees...)",li))}(),b=m.a,C=m.b,E=m.c;return d(IF,M([UI(PR(1200))]),f(fx,M([UI(BR)]),M([f(Fx,M([e_(90),_I(BR),OR(l(DR,10,33,108))]),M([f(Fx,M([UI(BR),px(18),Fk(WR)]),M([f(IR,M([Ax(38),Tx]),ep("Are you Ready?")),f(_x,M([Ax(16),o_]),M([ep("DAIHard is different than other exchanges. If this is your first trade here, carefully read the details to the right before proceeding with opening this trade.")])),f(_x,M([Ax(16),o_]),M([ep("You can't edit a trade once it's live (but you can abort and re-deploy, as described in point 2).")]))])),f(Fx,M([$x,px(15),DU]),M([f(IR,M([$x]),E),f(IR,M([$x]),a)]))])),f(Fx,M([px(23),e_(40),UI(BR)]),f(Ua,function(e){return f(fx,M([UI(BR),_I(BR),LL(2),xL(P_),e_(16),px(20)]),M([f(IR,M([Ax(40),tx]),ep(SF)),f(_x,M([Ax(16)]),e)]))},function(){return"Buyer"===n.initiatorRole.$?U(M([M([ep("To open this offer, you must deposit "),b,ep(". Your offer to buy "),y,ep(" for "),g,ep(" will then be listed on the marketplace.")]),M([ep("You can abort the offer any time before a Seller commits for a full refund. If no Seller commits within "),o,ep(" your offer will automatically expire. In both these cases, the full "),b,ep(" is returned to you.")]),M([ep("A Seller can commit to the trade by depositing the full "),y,ep(" into the contract, and is expected to immediately post his "),c(n.price.symbol),ep(" address in the DAIHard chat.")]),function(){return M("CryptoSwap"===t.mode.$?[ep("You will then have "),s,ep(" to send "),g,ep(' to that address and click "Confirm Payment".')]:[ep("You are then expected to send "),g,ep(' and click "Confirm Payment" within '),s,ep(".")])}(),M([ep("Once you've confirmed payment, for "),u,ep(", the Seller has the option of burning the trade's full balance of "),C,ep(". He is expected to do this if and only if you failed to send the "),g,ep(" to the address he posted.")]),M([ep("If the Seller has not burned the "),ep(E_(r)),ep(" within the "),u,ep(", "),v,ep(" is yours to claim and we take a 1% fee ("),p,ep(").")])]),function(){return"Token"===r.$?M([M([ep("(Trade creation ususally requires two Metamask signatures. Your "+E_(r)+" will not be deposited until the final transaction has been mined.)")])]):vr}()):U(M([M([ep("Of your "),b,ep(", ~1% ("),p,ep(") will be set aside, and the remaining "),y,ep(" will be listed as selling for "),g,ep(".")]),M([ep("You can abort the offer at any time before a Buyer commits, and if no Buyer commits within "),o,ep(" your offer will automatically expire. In both these cases, the full "),b,ep(" is returned to you.")])]),U(function(){return M("CryptoSwap"===t.mode.$?[M([ep("A Buyer must deposit "),h,ep(" into this contract to commit. He is then expected to send the "),g,ep(" to your receive address "),c(t.inputs.receiveAddress),ep(", and mark the payment as complete, all within "),s,ep(".")]),M([i("Make sure the above address is correct! DAIHard does not do refunds!")])]:[M([ep("A Buyer must deposit "),h,ep(" into this contract to commit. He is then expected to pay the "),g,ep(" to you, via the method you've descried in your "),i("Payment Methods"),ep(", and mark the payment as complete, all within "),s,ep(".")])])}(),U(M([M([ep("When the Buyer marks the payment complete, for "),u,ep(" you will have the option to burn the trade's balance of "),C,ep(", which you are expected to do if and only if the Buyer has not sent the payment.")]),M([ep("If the trade has resolved successfully, DAIHard takes the 1% fee of "),p,ep(" set aside earlier.")])]),function(){return"Token"===r.$?M([M([ep("(Trade creation ususally requires two Metamask signatures. Your "+E_(r)+" will not be deposited until the final transaction has been mined.)")])]):vr}())))}()))])),qP,bF);case"ApproveNeedsSig":var S=e.a;return f(IR,M([$x,tx,Ex(aO(d(Yp,"txChainModal clicked","misclick","ApproveNeedsSig",0)))]),l(_F,M([ep("Waiting for user signature for the approve call."),ep("(check Metamask!)"),ep("Note that there will be a second transaction to sign after this.")]),qP,qP));case"ApproveMining":var S=e.a,n=e.b,T=e.c;return f(IR,M([$x,tx,Ex(aO(d(Yp,"txChainModal clicked","misclick","ApproveMining",0)))]),l(_F,M([ep("Mining the initial approve transaction..."),f(_k,M([PF,Fk(dF)]),{label:ep("See the transaction on Etherscan"),url:f(LF,ro(S),T)}),ep("Funds will not leave your wallet until you sign the next transaction.")]),qP,qP));case"CreateNeedsSig":return f(IR,M([$x,tx,Ex(aO(d(Yp,"txChainModal clicked","misclick","CreateNeedsSig",0)))]),l(_F,M([ep("Waiting for user signature for the create call."),ep("(check Metamask!)")]),qP,qP));default:var r=e.a,T=e.b;return f(IR,M([$x,tx,Ex(aO(d(Yp,"txChainModal clicked","misclick","CreateMining",0)))]),l(_F,M([ep("Mining the final create call..."),f(_k,M([PF,Fk(dF)]),{label:ep("See the transaction on Etherscan"),url:f(LF,r,T)}),ep("You will be redirected when it's mined.")]),qP,qP))}}),UF=function(e){var t=e.txChainStatus;if("Just"===t.$){var r=t.a;return M([f(DF,r,e)])}return vr},OF=f(IR,M([_I(PR(1)),UI(BR),OR(d(wL,0,0,0,.2))]),_R),MF=function(e){return _(f(Fx,M([UI(BR),OL({bottom:40,left:0,right:0,top:0})]),M([f(MP,800,f(Fx,M([UI(BR),px(20)]),M([lF(e.mode),OF,sF(e)]))),pF])),UF(e))},FF=r(function(e,t){return f(Wb,f(tu,function(e){return e.type_},Za(e)),t)}),VF=r(function(e,t){return pp(t(e))}),KF=i(function(e,t,r,n,a){var i=l(VF,e,a.filterFunc,kb(f(Ua,qx,n)));return $(i,vr)?f(IR,M([$x,Ax(24),OL({bottom:0,left:0,right:0,top:30}),ML]),ep(r?"No trades found with those filters.":"Initializing Trade Cache...")):f(Ji,Qm,h(DL,e,a.tradeTable,a.prices,M([t?zm:Mo,zx,Yx,Jx,Wx,Gx]),i))}),HF=function(e){return{$:"FiltersMsg",a:e}},jF={$:"ApplyInputs"},qF=jD("disabled"),GF=function(e){return f(fo,ND,e)?NR:xk("focusable")},zF=function(e){return{$:"MayPreventDefault",a:e}},WF=r(function(e,t){return f(mx,e,zF(t))}),YF=r(function(e,t){var r=function(r){return $(r,e)?Ki(t):Eu("Not the enter key")},n=f(Cu,r,f(hl,"key",Su));return OI(f(WF,"keyup",f(Fi,function(e){return _(e,!0)},n)))}),JF=function(e){return f(YF,"Enter",e)},QF={$:"Button"},XF=r(function(e,t){var r=t.onPress,n=t.label;return d(Rk,KI,wR,f(Ra,UI(PI),f(Ra,_I(PI),f(Ra,xk(GI.contentCenterX+" "+GI.contentCenterY+" "+GI.seButton+" "+GI.noTextSelection),f(Ra,ux,f(Ra,GF(e),f(Ra,Rx(QF),f(Ra,OI(XL(0)),function(){if("Nothing"===r.$)return f(Ra,OI(qF(!0)),e);var t=r.a;return f(Ra,Ex(t),f(Ra,JF(t),e))}()))))))),FI(M([n])))}),ZF=f(XF,M([OR(dF),e_(10),vx(5)]),{label:f(IR,M([Fk(WR),$x,tx]),ep("Apply")),onPress:fi(jF)}),eV=function(e){return f(XR,f(Ra,_I(PR(26)),e),G_)},tV=function(e){var t=e.topLeft,r=e.topRight,n=e.bottomLeft,a=e.bottomRight;return f(Ok,gx,l(fk,"br-"+Ri(t)+"-"+Ri(r)+Ri(n)+"-"+Ri(a),"border-radius",Ri(t)+"px "+Ri(r)+"px "+Ri(a)+"px "+Ri(n)+"px"))},rV=function(e){return f(bx,"focus",Ki(e))},nV=f(Ma,OI,rV),aV=s(function(e,t,r,n,a,i,o,u){var s=function(){if("Nothing"===o.$)return vr;var e=o.a;return M([nV(e(!0)),YP(e(!0))])}();return f(fx,U(e,M([_I(PR(40)),pP({blur:20,color:d(wU,233,237,242,.05),offset:_(0,3),size:0})])),M([f(IR,M([OR(P_),_I(PR(40)),tV({bottomLeft:4,bottomRight:0,topLeft:4,topRight:0})]),f(IR,M([tx,f(ax,10,0)]),r)),f(QD,U(s,U(t,M([UI(PR(100)),_I(PR(40)),xL(P_),tV({bottomLeft:0,bottomRight:4,topLeft:0,topRight:4}),vP({bottom:1,left:0,right:1,top:1})]))),{label:hD(n),onChange:u,placeholder:i,text:a})]))}),iV=function(e){return{$:"MaxDaiChanged",a:e}},oV=function(e){return{$:"MinDaiChanged",a:e}},uV=r(function(e,t){return f(Fx,M([UI(BR),px(8)]),M([f(IR,M([Ax(17),o_]),ep(e)),t]))}),sV=gA(25),cV=function(e){return{$:"MoveX",a:e}},fV=function(e){return f(uP,sV,cV(-e))},lV={$:"OnLeft"},dV=function(e){return f($R,lV,e)},hV=n(function(e,t,r){var n=eV(M([tx])),a=f(fx,M([px(8),tx,UI(PR(60))]),M([n,f(IR,M([Ax(16),tx]),ep("max"))])),i=f(fx,M([px(8),tx,UI(PR(60))]),M([n,f(IR,M([Ax(16),tx]),ep("min"))]));return f(uV,"Dai Range",f(Fx,M([px(5),UI(PR(200))]),M([v(aV,M([dV(f(AF,M([fV(5),UI(PR(200))]),r.minDai))]),M([nV(ib(!1))]),i,"min Dai",e,li,li,oV),v(aV,M([dV(f(AF,M([fV(5),UI(PR(200))]),r.maxDai))]),M([nV(ib(!1))]),a,"max Dai",t,li,li,iV)])))}),pV=function(e){return{$:"FiatTypeInputChanged",a:e}},gV=function(e){return{$:"FiatTypeSelected",a:e}},vV=n(function(e,t,r){return f(fx,M([OR(l(Pk,.98,.98,.98)),_I(BR),e_(13),px(13),ux,YP(r),LL(1),xL(P_)]),M([f(Kc,_R,Y_(t)),ep(function(e){return""===e?"[any]":e}(t)),f(XR,M([UI(PR(12))]),e?a_:n_)]))}),yV=WP(f(QP,"z-index","1000")),mV={$:"NoOp"},bV=n(function(e,t,r){return d(XP,d(wL,0,0,0,.1),mV,ib(!1),function(){var n=U(nU,K_);return h(XD,M([UI(PR(300)),ZD(18),Ux,yV]),"search currencies",U(M([L(f(IR,M([UI(BR)]),ep("[any]")),vr,r(""))]),U(f(Ua,function(e){return L(f(fx,M([UI(BR),px(18)]),$T(M([Y_(e),fi(ep(e))]))),$T(M([fi(e),J_(e)])),r(e))},n),f(lo,e,n)?vr:M([L(f(IR,M([UI(BR)]),ep('"'+e+'"')),M([e]),r(e))]))),e,t)}())}),CV=n(function(e,t,r){var n=f(Kc,_R,Y_(t));f(fx,M([px(8),tx,UI(PR(60))]),M([n,f(IR,M([Ax(16),tx]),ep("max"))])),f(fx,M([px(8),tx,UI(PR(60))]),M([n,f(IR,M([Ax(16),tx]),ep("min"))]));return f(IR,M([AP,UI(PR(120)),fU(e?l(bV,t,pV,gV):_R)]),f(uV,"Currency Type",l(vV,e,t,ib(!0))))}),EV={$:"AddSearchTerm"},SV=function(e){return{$:"PaymentMethodInputChanged",a:e}},TV=f(hl,"keyCode",xT),wV=function(e){return f(bx,"keyup",f(Cu,function(t){return 13===t?Ki(e):Eu(Ri(t))},TV))},IV=function(e){return f(uV,"Search Payment Methods",f(QD,M([AP,UI(PR(250)),_I(PR(40)),xL(P_),pP({blur:20,color:d(wU,233,237,242,.05),offset:_(0,3),size:0}),WP(wV(EV))]),{label:hD("payment methods search"),onChange:SV,placeholder:li,text:e}))},AV={$:"ResetSearch"},BV=f(XF,M([OR(dF),e_(10),vx(5)]),{label:f(IR,M([Fk(WR),$x,tx]),ep("Reset")),onPress:fi(AV)}),kV=function(e){return{$:"RemoveTerm",a:e}},NV=function(e){return f(IR,M([e_(3),AP,ux,Ex(kV(e)),Ax(10),Fk(zR)]),ep("x"))},$V=function(e){if(e.b){var t=e;return f(fx,M([UI(BR),e_(10),px(10)]),f(Ua,function(e){return f(fx,M([OR(d(wU,16,7,234,.2)),vx(5),e_(4),px(3)]),M([ep(e),NV(e)]))},t))}return _R},RV=i(function(e,t,r,n,a){var i=function(e){return f(IR,M([Ax(20),Tx,Fk(l_),$x]),ep(e))},o=f(Bg,Za(NP),f(Ua,_P,e))?M([i("No trades found.")]):f(Ua,i,$T(f(Ua,function(e){switch(_P(e).$){case"QueryingNumTrades":return fi("Querying "+WN(e.factory)+" Factory...");case"NoneFound":return li;case"FetchingTrades":return fi("Fetching "+WN(e.factory)+" Trades...");default:return li}},e)));return f(IR,M([UI(BR),xR(f(Fx,M([px(5),GL]),o))]),f(fx,M([$x,px(50)]),M([f(Ji,HF,kP(t)),f(fx,M([UI(PI),px(10)]),M([f(IR,M([UI(PI),AP]),l(hV,r.minDai,r.maxDai,n)),f(IR,M([UI(PI),AP]),l(CV,a,r.fiatType,n)),f(Fx,M([UI(PI),AP,px(5)]),M([IV(r.paymentMethod),$V(r.paymentMethodTerms)])),f(uV," ",f(Fx,M([px(5),UI(PI)]),M([ZF,BV])))]))])))}),xV=n(function(e,t,r){var n=f(Bg,f(tu,_P,Za($P)),t),a=function(){return!f(Kc,0,f(xo,function(e){return f(Yw,function(e){return e.checked&&"Open"!==e.label},e.options)},f(FF,Ao,r.filters)))}();return _(f(MP,1800,f(Fx,M([UI(BR),_I(BR),e_(30)]),M([f(fx,M([UI(BR),px(10)]),M([h(RV,t,r.filters,r.inputs,r.errors,r.showCurrencyDropdown)])),h(KF,e,a,n,t,r)]))),vr)}),_V=l(Pk,.95,.98,1),LV=a(function(e,t,r,n){return f(Fx,M([OL({bottom:40,left:0,right:0,top:60}),px(60),UI(BR)]),M([f(Kc,_R,f(xo,f(Ma,IR(M([Fk(WR),Ax(38),$x])),ep),t)),f(Fx,M([OR(_V),px(20),vx(8),Xx,$x,UI(f(OP,e,BR)),pP({blur:3,color:d(wL,0,0,0,.2),offset:_(0,0),size:1})]),M([f(IR,M([UI(BR),e_(15),OR(WR),pP({blur:30,color:d(wL,0,0,0,.15),offset:_(0,0),size:0})]),f(IR,M([Ax(16),Fk(zR),Lx,$x]),ep(r))),n]))]))}),PV=pP({blur:20,color:d(wU,0,0,0,.04),offset:_(0,3),size:0}),DV=function(e){return{$:"MessageInputChanged",a:e}},UV={$:"MessageSubmit"},OV=function(e){return f(Fx,M([UI(BR),px(10)]),M([f(eO,M([UI(BR),_I(PR(100))]),{label:hD("messageInput"),onChange:DV,placeholder:li,spellcheck:!1,text:e.messageInput}),f(XF,M([$x,Ax(24)]),{label:ep("Submit"),onPress:fi(UV)})]))},MV=r(function(e,t){return f(IR,M([_I(BR),UI(BR)]),f(IR,U(M([WP(f(QP,"position","absolute")),WP(f(QP,"top","0")),WP(f(QP,"right","0")),WP(f(QP,"bottom","0")),WP(f(QP,"left","0")),sD]),e),t))}),FV=l(DR,200,205,210),VV=n(function(e,t,r){var n=M([Ux,OR(dF),Fk(WR),tV({bottomLeft:15,bottomRight:0,topLeft:15,topRight:15})]),a=M([GL,OR(FV),Fk(B_),tV({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(IR,U(M([e_(7)]),u),f(_x,vr,M([ep(U(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 fi(L(l(Pk,0,0,1),WR,"Initiator opened the trade"));case"Recalled":return fi(L(l(Pk,0,0,1),WR,"Initiator recalled the trade"));case"Committed":var t=s.a,r=f(fu,8,sp(t))+"..";return fi(L(l(Pk,1,0,1),WR,r+" committed to the trade"));case"Aborted":return fi(L(l(Pk,1,0,0),WR,"Buyer aborted the trade"));case"Claimed":return fi(L(l(Pk,0,1,0),WR,"Buyer marked the external payment complete"));case"Released":return fi(L(l(Pk,0,0,1),WR,"Seller released the "+E_(e)+" and closed the contract"));default:return fi(L(l(Pk,0,0,1),WR,"Seller burned the "+E_(e)+" and closed the contract"))}}();if("Nothing"===c.$)return _R;var d=c.a,h=d.a,p=d.b,g=d.c;return f(IR,M([vx(3),LL(1),xL(l(Pk,1,0,1)),$x,OR(h)]),f(_x,M([Fk(p)]),M([ep(g)])))}),KV=n(function(e,t,r){if(r.b){var n=r;return f(MV,M([UI(BR),_I(BR),vx(5),LL(1),xL(B_),e_(10)]),f(Fx,M([UI(BR),_I(BR),px(10)]),f(Ua,f(VV,e,t),n)))}return f(IR,M([UI(BR),_I(BR),vx(5),LL(1),xL(B_),$x,Fk(l(Pk,.5,.5,.5)),ML]),ep("no messages found."))}),HV=br,jV=function(e){return f(Fx,M([UI(BR),_I(BR),px(10),LL(1),vx(5),e_(20)]),M([l(KV,e.trade.factory,e.userRole,f(HV,function(e){return e.blocknum},Ia(e.history))),OV(e)]))},qV=function(e){return f(IR,M([OR(WR),vx(8),PV,UI(BR),_I(BR)]),jV(e))},GV={$:"NoOp"},zV={$:"ToggleChat"},WV=function(e){if(e.showChatHistory){var t=f(Kc,_R,f(xo,qV,e.chatHistoryModel));return f(IR,M([_I(BR),UI(PR(500)),e_(20),Ux]),d(IF,M([_I(BR),UI(BR)]),f(Ji,rw,t),GV,zV))}return _R},YV=d(wU,1,31,52,.8),JV={$:"AbortAction"},QV=n(function(e,t,r){return{$:"ConfirmCommit",a:e,b:t,c:r}}),XV=function(e){var t=_(e.txChainStatus,e.trade);if("Just"!==t.a.$){t.a;return _R}if("LoadedTrade"!==t.b.$)return _R;var r=t.a.a,n=t.b.a;switch(r.$){case"ConfirmingCommit":var a=r.a,i=r.b,o=TL(n.terms.price),u=BL(Yy(i)),s=BL(n.parameters.tradeAmount)+" "+E_(n.factory),c=function(){return"Buyer"===yF(n.parameters).$?_(f(IR,M([o_,Fk(B_)]),ep("buyer")),M([ep("pay the seller "),f(IR,M([Fk(dF)]),ep(o)),ep(" in exchange for the "),f(IR,M([Fk(dF)]),ep(s)),ep(" held in this contract.")])):_(f(IR,M([o_,Fk(B_)]),ep("seller")),M([ep("accept "),f(IR,M([Fk(dF)]),ep(o)),ep(" from the buyer in exchange for the "),f(IR,M([Fk(dF)]),ep(s)),ep(" held in this contract.")]))}(),h=c.a,p=c.b;return d(IF,vr,f(Fx,M([px(20),e_(20),$x,_I(BR),mP]),M([f(IR,M([Ax(26),Tx,$x,tx]),ep("Just to Confirm...")),f(Fx,M([px(20),$x,tx]),f(Ua,_x(M([$x,Ax(18),o_,Fk(YV)])),U(M([U(M([ep("You will deposit "),f(IR,M([Fk(dF)]),ep(u+" "+E_(n.factory))),ep(", thereby becoming the "),h,ep(" of this trade. By doing so, you are agreeing to ")]),p)]),function(){return"Token"===n.factory.$?M([M([ep("(This ususally requires two Metamask signatures. Your "+E_(n.factory)+" will not be deposited until the second transaction has been mined.)")])]):vr}()))),f(IR,M([DU,$x]),f(xF,"Yes, I definitely want to commit to this trade.",l(QV,n,a,i)))])),GV,JV);case"ApproveNeedsSig":return l(_F,M([ep("Waiting for user signature for the approve call."),ep("(check Metamask!)"),ep("Note that there will be a second transaction to sign after this.")]),GV,GV);case"ApproveMining":var g=r.a;return l(_F,M([ep("Mining the initial approve transaction..."),f(_k,M([PF,Fk(dF)]),{label:ep("See the transaction on Etherscan"),url:f(LF,n.factory,g)}),ep("Funds will not leave your wallet until you sign the next transaction.")]),GV,GV);case"CommitNeedsSig":return l(_F,M([ep("Waiting for user signature for the final commit call."),ep("(check Metamask!)"),ep("This will make the deposit and commit you to the trade.")]),GV,GV);case"CommitMining":var g=r.a;return l(_F,M([ep("Mining the final commit transaction..."),f(_k,M([PF,Fk(dF)]),{label:ep("See the transaction"),url:f(LF,n.factory,g)})]),GV,GV);case"ConfirmingAction":var v=r.a;return d(IF,vr,f(Fx,M([px(20),e_(20),$x,_I(BR),mP]),M([f(IR,M([Ax(26),Tx,$x,tx]),ep("Just to Confirm...")),f(Fx,M([px(20),$x,tx]),f(Ua,_x(M([$x,Ax(18),o_,Fk(YV)])),function(){switch(v.$){case"Poke":case"Recall":return vr;case"Claim":return M([M([ep('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 '+E_(n.factory)+" rather than release it to you.")])]);case"Abort":return M([M([ep("Aborting will incur a small penalty on both parties, and refund the rest of the "+E_(n.factory)+".")])]);case"Release":return M([M([ep("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 M([M([ep("This will destroy the "+E_(n.factory)+" 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(IR,M([DU,$x]),function(e){return f(xF,e,Cw(v))}(function(){switch(v.$){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 "+E_(n.factory)+".";default:return"I understand. Burn the "+E_(n.factory)+"."}}()))])),GV,JV);case"ActionNeedsSig":var v=r.a;return l(_F,M([ep("Waiting for user signature for the "+Sw(v)+" call."),ep("(check Metamask!)")]),GV,GV);default:var v=r.a,g=r.b;return _R}},ZV=r(function(e,t){return f(Fx,M([px(10)]),M([f(IR,M([Ax(17),Tx]),ep(e)),t]))}),eK=function(e){return f(fx,M([px(8)]),M([f(XR,vr,G_),f(IR,M([Ax(24),o_]),ep(BL(e)))]))},tK=r(function(e,t){var r=f($o,Ro(e),f(xo,function(e){return e.address},Sm(t)));return f(ZV,function(){var t=_(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"}(),eK(e.parameters.tradeAmount))}),rK=function(e){return f(fx,M([px(5)]),M([f(Kc,_R,Y_(e.symbol)),f(IR,M([Ax(24),o_]),ep(TL(e)))]))},nK=function(e){return f(ZV,"For",rK(e.terms.price))},aK=l(DR,250,165,22),iK=l(DR,0,255,0),oK=FR({description:"aborted",src:"/DAIHard/static/img/aborted.svg"}),uK=FR({description:"burned",src:"/DAIHard/static/img/burned.svg"}),sK=FR({description:"released",src:"/DAIHard/static/img/released.svg"}),cK={$:"ToggleStatsModal"},fK=function(e){return f(HV,Fa,e)},lK=n(function(e,t,n){var a=kb(f(Ua,function(e){return f(pp,function(e){return $(f(_o,e,n),fi(t))},f(_h,function(e){if("LoadedTrade"===e.$){var t=e.a;return fi(t)}return li},Ia(e.trades)))},e)),i=Ii(a),o=l(_a,r(function(e,t){switch(e.state.closedReason.$){case"Released":return D(t,{amountReleased:f(yg,t.amountReleased,e.parameters.tradeAmount),numReleases:t.numReleases+1});case"Burned":return D(t,{amountBurned:f(yg,t.amountBurned,e.parameters.tradeAmount),numBurns:t.numBurns+1});case"Aborted":return D(t,{numAborts:t.numAborts+1});default:return t}}),{amountBurned:pg,amountReleased:pg,numAborts:0,numBurns:0,numReleases:0},a),u=f(xo,Ho,ov(fK(f(_h,function(e){return function(e){return e?fi(e):li}(il(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}}),dK=r(function(e,t){return d(RF,L(d(wL,0,0,1,1),d(wL,0,0,1,.8),d(wL,0,0,1,.6)),WR,e,t)}),hK=function(e){return{$:"ViewUserHistory",a:e}},pK=f(N$,0,vr),gK=f(ox,Qx,GI.clipX),vK=f(ox,Qx,GI.clipY),yK=f(ox,Sx,GI.textNormalWeight),mK=r(function(e,t){return ri(e/t)}),bK=n(function(e,t,r){for(;;){if(!r.b)return t+e;var n=r.a,a=r.b;if(x(n.start,t)<0)return t+n.offset;var i=e,o=t,u=a;e=i,t=o,r=u}}),CK=r(function(e,t){var r=e.a,n=e.b;return l(bK,r,f(mK,il(t),6e4),n)}),EK=r(function(e,t){return f(Fs,24,f(mK,f(CK,e,t),60))}),SK=r(function(e,t){return f(Fs,1e3,il(t))}),TK=r(function(e,t){return f(Fs,60,f(CK,e,t))}),wK={$:"Apr"},IK={$:"Aug"},AK={$:"Dec"},BK={$:"Feb"},kK={$:"Jan"},NK={$:"Jul"},$K={$:"Jun"},RK={$:"Mar"},xK={$:"May"},_K={$:"Nov"},LK={$:"Oct"},PK={$:"Sep"},DK=function(e){var t=f(mK,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)}},UK=r(function(e,t){switch(DK(f(CK,e,t)).month){case 1:return kK;case 2:return BK;case 3:return RK;case 4:return wK;case 5:return xK;case 6:return $K;case 7:return NK;case 8:return IK;case 9:return PK;case 10:return LK;case 11:return _K;default:return AK}}),OK=r(function(e,t){return f(Fs,60,f(mK,il(t),1e3))}),MK={$:"Fri"},FK={$:"Mon"},VK={$:"Sat"},KK={$:"Sun"},HK={$:"Thu"},jK={$:"Tue"},qK={$:"Wed"},GK=r(function(e,t){switch(f(Fs,7,f(mK,f(CK,e,t),1440))){case 0:return HK;case 1:return MK;case 2:return VK;case 3:return KK;case 4:return FK;case 5:return jK;default:return qK}}),zK=n(function(e,t,r){return e.toAmPm(f(EK,t,r))}),WK=r(function(e,t){return DK(f(CK,e,t)).day}),YK=WK,JK=M([KK,FK,jK,qK,HK,MK,VK]),QK=r(function(e,t){return function(e){return e.a}(f(Kc,_(0,KK),ov(f(pp,function(r){return $(r.b,f(GK,e,t))},f(Ni,r(function(e,t){return _(e,t)}),JK)))))}),XK=function(e){return l(_a,xa,0,e)},ZK=r(function(e,t){return DK(f(CK,e,t)).year}),eH=function(e){return!f(Fs,4,e)&&(!!f(Fs,100,e)||!f(Fs,400,e))},tH=r(function(e,t){switch(t.$){case"Jan":return 31;case"Feb":return eH(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}}),rH=M([kK,BK,RK,wK,xK,$K,NK,IK,PK,LK,_K,AK]),nH=r(function(e,t){return f(Kc,_(0,kK),ov(f(pp,function(r){r.a;return $(r.b,f(UK,e,t))},f(Ni,r(function(e,t){return _(e,t)}),rH))))}),aH=r(function(e,t){return 1+function(e){var t=e.a;e.b;return t}(f(nH,e,t))}),iH=r(function(e,t){var r=f(bc,f(aH,e,t)-1,rH);return XK(f(Ua,tH(f(ZK,e,t)),r))+f(YK,e,t)}),oH=r(function(e,t){return f(aH,e,t)/4|0}),uH=r(function(e,t){var r=Ri(t),n=e-iu(r);return U(f(xi,"",f(Ua,function(e){return"0"},f(ki,1,n))),r)}),sH=function(e){return e?e<=12?e:e-12:12},cH=Yl(315576e5),fH=r(function(e,t){return Ho(cH*f(ZK,e,t))}),lH=r(function(e,t){var r=f(fH,e,t),n=f(QK,e,r);return 1+((f(iH,e,t)+n)/7|0)}),dH=r(function(e,t){return Ri(f(ZK,e,t))}),hH=a(function(e,t,r,n){switch(n.$){case"MonthNumber":return Ri(f(aH,t,r));case"MonthSuffix":return function(t){return U(Ri(t),e.toOrdinalSuffix(t))}(f(aH,t,r));case"MonthFixed":return f(uH,2,f(aH,t,r));case"MonthNameAbbreviated":return e.toMonthAbbreviation(f(UK,t,r));case"MonthNameFull":return e.toMonthName(f(UK,t,r));case"QuarterNumber":return Ri(1+f(oH,t,r));case"QuarterSuffix":return function(t){return U(Ri(t),e.toOrdinalSuffix(t))}(1+f(oH,t,r));case"DayOfMonthNumber":return Ri(f(YK,t,r));case"DayOfMonthSuffix":return function(t){return U(Ri(t),e.toOrdinalSuffix(t))}(f(YK,t,r));case"DayOfMonthFixed":return f(uH,2,f(YK,t,r));case"DayOfYearNumber":return Ri(f(iH,t,r));case"DayOfYearSuffix":return function(t){return U(Ri(t),e.toOrdinalSuffix(t))}(f(iH,t,r));case"DayOfYearFixed":return f(uH,3,f(iH,t,r));case"DayOfWeekNumber":return Ri(f(QK,t,r));case"DayOfWeekSuffix":return function(t){return U(Ri(t),e.toOrdinalSuffix(t))}(f(QK,t,r));case"DayOfWeekNameAbbreviated":return e.toWeekdayAbbreviation(f(GK,t,r));case"DayOfWeekNameFull":return e.toWeekdayName(f(GK,t,r));case"WeekOfYearNumber":return Ri(f(lH,t,r));case"WeekOfYearSuffix":return function(t){return U(Ri(t),e.toOrdinalSuffix(t))}(f(lH,t,r));case"WeekOfYearFixed":return f(uH,2,f(lH,t,r));case"YearNumberLastTwo":return f(pu,2,f(dH,t,r));case"YearNumber":return f(dH,t,r);case"AmPmUppercase":return nb(l(zK,e,t,r));case"AmPmLowercase":return Zp(l(zK,e,t,r));case"HourMilitaryNumber":return Ri(f(EK,t,r));case"HourMilitaryFixed":return f(uH,2,f(EK,t,r));case"HourNumber":return Ri(sH(f(EK,t,r)));case"HourFixed":return f(uH,2,sH(f(EK,t,r)));case"HourMilitaryFromOneNumber":return Ri(1+f(EK,t,r));case"HourMilitaryFromOneFixed":return f(uH,2,1+f(EK,t,r));case"MinuteNumber":return Ri(f(TK,t,r));case"MinuteFixed":return f(uH,2,f(TK,t,r));case"SecondNumber":return Ri(f(OK,t,r));case"SecondFixed":return f(uH,2,f(OK,t,r));case"MillisecondNumber":return Ri(f(SK,t,r));case"MillisecondFixed":return f(uH,3,f(SK,t,r));default:return n.a}}),pH=a(function(e,t,r,n){return f(xi,"",f(Ua,l(hH,e,r,n),t))}),gH=o(function(e,t,r,n,a,i){return{toAmPm:a,toMonthAbbreviation:t,toMonthName:e,toOrdinalSuffix:i,toWeekdayAbbreviation:n,toWeekdayName:r}}),vH=function(e){return e>11?"pm":"am"},yH=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"}},mH=function(e){switch(f(Fs,100,e)){case 11:case 12:case 13:return"th";default:switch(f(Fs,10,e)){case 1:return"st";case 2:return"nd";case 3:return"rd";default:return"th"}}},bH=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"}},CH=p(gH,yH,f(tu,yH,fu(3)),bH,f(tu,bH,fu(3)),vH,mH),EH=pH(CH),SH={$:"MonthNameFull"},TH=SH,wH=function(e){return{$:"Text",a:e}},IH=wH,AH={$:"YearNumber"},BH=AH,kH=n(function(e,t,n){var a=r(function(e,t){return f(Fx,M([Ax(18),px(6)]),M([f(IR,M([Lx]),ep(e)),f(IR,M([yK]),ep(t))]))}),i=EH(M([TH,IH(", "),BH])),o=f(Fx,M([px(23),UI(BR)]),U(f(Ua,function(e){var t=e.a,r=e.b;return f(a,t,r)},M([_("First Trade",function(){var e=n.firstTrade;if("Just"===e.$){var t=e.a;return f(i,pK,t)}return"No Committed Trades yet!"}()),_("Release Outcomes",Ri(n.numReleases)+" trades / "+BL(n.amountReleased)+" "+E_(e)+" Released"),_("Abort Outcomes",Ri(n.numAborts)+" trades"),_("Burn Outcomes",Ri(n.numBurns)+" trades / "+BL(n.amountBurned)+" "+E_(e)+" Burned")])),M([f(IR,M([$x]),f(dK,"View User History",hK(n.asRole)))])));return f(Fx,M([vx(8),gK,vK,OR(P_),px(1),pP({blur:20,color:d(wL,0,0,0,.08),offset:_(0,0),size:0})]),M([f(IR,M([UI(BR),OR(WR),e_(17)]),f(PP,18,t)),f(IR,M([UI(BR),OR(WR),e_(17)]),o)]))}),NH=n(function(e,t,r){var n=l(lK,t,e.parameters.initiatorRole,e.parameters.initiatorAddress),a=Jp(e.parameters.initiatorRole)+" Stats";return f(IR,r?M([fU(f(IR,M([ZD(30),Ux]),l(kH,e.factory,e.parameters.initiatorAddress,n)))]):vr,f(ZV,a,f(fx,M([UI(BR),px(20),ux,YP(cK)]),f(Ua,fx(M([px(5)])),M([M([f(XR,M([_I(PR(28))]),sK),f(IR,M([Ax(24),o_,Fk(iK)]),ep(l(Os,2,P("0"),Ri(n.numReleases))))]),M([f(XR,M([_I(PR(28))]),oK),f(IR,M([Ax(24),o_,Fk(aK)]),ep(l(Os,2,P("0"),Ri(n.numAborts))))]),M([f(XR,M([_I(PR(28))]),uK),f(IR,M([Ax(24),o_,Fk(TU)]),ep(l(Os,2,P("0"),Ri(n.numBurns))))])])))))}),$H=r(function(e,t){if("Token"===e.$){if("EthDai"===e.a.$){e.a;return"https://etherscan.io/address/"+sp(t)}e.a;return"https://kovan.etherscan.io/address/"+sp(t)}switch(e.a.$){case"Eth":e.a;return"https://etherscan.io/address/"+sp(t);case"Kovan":e.a;return"https://kovan.etherscan.io/address/"+sp(t);default:e.a;return"https://blockscout.com/poa/dai/address/"+sp(t)}}),RH=n(function(e,t,r){return f(_k,e,{label:ep(sp(r)),url:f($H,t,r)})}),xH=function(e){return f(ZV,"Trade Status",f(Fx,M([Ax(24),o_,px(8)]),M([ep(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(RH,M([Ax(12),Fk(dF),PF]),e.factory,e.creationInfo.address)])))},_H=f(ox,lx,GI.spaceEvenly),LH=i(function(e,t,r,n,a){return f(fx,M([UI(BR),_H]),M([xH(t),f(tK,t,r),nK(t),l(NH,t,n,a)]))}),PH=l(DR,9,32,107),DH=FR({description:"chat",src:"/DAIHard/static/img/chat.svg"}),UH=f(IR,M([vx(4),ux,YP(zV),e_(5),OR(l(DR,22,0,255))]),f(XR,M([UI(PR(42))]),DH)),OH=function(e){switch(e.$){case"NotClosed":return"";case"Recalled":return"Recalled";case"Aborted":return"Aborted";case"Released":return"Released";default:return"Burned"}},MH=d(wU,1,31,52,.13),FH=function(e){return f(Fx,M([vx(12),OR(P_),e_(15),px(15),$x]),M([f(IR,M([Ax(24),Tx,ML,$x]),ep("External Payment Method")),f(_x,M([Ax(18),_I(PI),OR(WR),pP({blur:5,color:d(wL,0,0,0,.2),offset:_(-3,3),size:0}),vx(3),e_(5)]),M([f(Kc,f(IR,M([Fk(MH),ML]),ep("No payment methods found.")),f(xo,ep,f(xo,function(e){return e.info},ov(e))))]))]))},VH={$:"Active"},KH=function(e){return{$:"ExpandPhase",a:e}},HH=M([OR(PH),Fk(WR)]),jH=M([OR(WR)]),qH=FR({description:"flame",src:"/DAIHard/static/img/flame.png"}),GH=r(function(e,t){return sg(f(Cs,cg(e),cg(t)))}),zH=r(function(e,t){return d(RF,L(d(wL,1,.6,.2,1),d(wL,1,.6,.2,.8),d(wL,1,.6,.2,.6)),WR,e,t)}),WH=n(function(e,t,r){return{$:"CommitClicked",a:e,b:t,c:r}}),YH=function(e){return{$:"ContractActionClicked",a:e}},JH={$:"Web3Connect"},QH=function(e){if("Token"===e.$){if("EthDai"===e.a.$){e.a;return d$}e.a;return l$}switch(e.a.$){case"Eth":e.a;return d$;case"Kovan":e.a;return l$;default:e.a;return h$(100)}},XH=n(function(e,t,r){var n=Sm(r);if("Just"===n.$){var a=n.a;if($(QH(t.factory),a.network)){return"TimeUp"===f(I_,e,t).$?_R:f(fx,M([px(8)]),function(){var e=L(t.state.phase,f(Ro,t,a.address),f(_o,t,a.address));e:for(;;)switch(e.a.$){case"Open":if("Just"===e.b.$){if("Initiator"===e.b.a.$){e.a,e.b.a;return M([f(Ji,Cw,f(dK,"Remove and Refund this Trade",mw))])}break e}var r=(e.a,e.b,cg(rS(t.parameters)));return M([f(xF,"Deposit and Commit to Trade",l(WH,t,a,r))]);case"Committed":if("Just"===e.c.$){if("Buyer"===e.c.a.$){e.a,e.c.a;return M([f(Ji,YH,f(zH,"Abort Trade",aw)),f(Ji,YH,f(xF,"Confirm Payment",lw)),UH])}e.a,e.c.a;return M([UH])}break e;case"Judgment":if("Just"===e.c.$){if("Seller"===e.c.a.$){e.a,e.c.a;return M([f(Ji,YH,f(xF,"Burn it All!",fw)),f(Ji,YH,f(dK,"Release Everything",bw)),UH])}e.a,e.c.a;return M([UH])}break e;default:break e}return vr}())}return f(_x,M([Ax(18),ML,Fk(l_)]),M([ep("You must connect to the "+nO(t.factory)+" network to interact with this trade.")]))}return f(xF,"Connect to Wallet",JH)}),ZH={$:"Finished"},ej={$:"NotStarted"},tj=r(function(e,t){var r=_(d_(t),d_(e.state.phase)),n=r.a,a=r.b;return x(n,a)>0?ej:$(n,a)?VH:ZH}),rj=n(function(e,t,r){for(;;){if(t<=0)return e;var n=f(Ra,r,e),a=t-1,i=r;e=n,t=a,r=i}}),nj=r(function(e,t){return l(rj,vr,e,t)}),aj=a(function(e,t,r,n){var a=BL(f(yg,r.parameters.tradeAmount,r.parameters.buyerDeposit))+" "+E_(r.factory),i=BL(r.parameters.tradeAmount)+" "+E_(r.factory),o=f(fx,vr,f(nj,3,f(XR,M([_I(PR(18))]),qH))),u=f(Ma,IR(M([Fk(TU)])),ep),s=TL(r.terms.price),c=$(e,r.state.phase),d=f($o,_o(r),f(xo,function(e){return e.address},Sm(n))),h=c?WR:B_,p=_x(M([Fk(h),Ax(18),Tx])),g=c?l(DR,0,226,255):l(DR,16,7,234),v=f(Ma,IR(M([Fk(g)])),ep),y=BL(r.parameters.buyerDeposit)+" "+E_(r.factory),m=r.parameters.abortPunishment,b=BL(m)+" "+E_(r.factory),C=BL(f(GH,r.parameters.buyerDeposit,m))+" "+E_(r.factory),E=BL(f(GH,r.parameters.tradeAmount,m))+" "+E_(r.factory),S=function(){var t=_(e,d);if("Just"===t.b.$)switch(t.a.$){case"Open":var n=(t.a,t.b.a);return _("And Now, We Wait",function(){return"Buyer"===n.$?f(Ua,p,M([M([ep("Your "),u("burnable deposit"),ep(" of "),v(y),ep(" is now held in this contract, and your offer to buy "),v(i),ep(" for "),v(s),ep(" is now listed in the marketplace.")]),M([ep("If another user likes your offer, they can become the Seller by depositing the full "),v(i),ep(" into this contract.")]),M([ep("If no one commits within the Open Window, your offer will expire, refunding the "),v(y),ep(" to you.")])])):f(Ua,p,M([M([ep("Your offer to sell the "),v(i),ep(" held in this contract for "),v(s),ep(" is now listed in the marketplace.")]),M([ep("If another user likes your offer, they can become the Buyer by depositing a "),u("burnable deposit"),ep(" of 1/3 of the trade amount "),v("("+y+")"),ep(" into this contract.")]),M([ep("If no one commits within the Open Window, your offer will expire, refunding the "),v(i),ep(" to you.")])]))}());case"Committed":if("Buyer"===t.b.a.$){t.a,t.b.a;return _("Time to Pay Up",f(Ua,p,M([M([ep("You must now pay the Seller "),v(s),ep(" via the External Payment Method, "),f(IR,M([Tx]),ep("and then click ")),u("Confirm Payment"),ep(" before the payment window runs out. Use the chat to coordinate.")]),M([ep("If you abort the trade, or do not confirm payment before this time is up, "),v(b),ep(" (1/4 of the "),u("burnable deposit"),ep(") will be "),u("burned"),ep(" from both parties, while the remainder of each party's deposit is refunded ("),v(E),ep(" to the Seller, "),v(C),ep(" to you).")]),M([ep("This may be your last chance to clear up any ambiguity before Judgement. Do not confirm unless you're sure the "),v(s),ep(" has been unmistakably transferred.")])])))}t.a,t.b.a;return _("Time to Get Paid",f(Ua,p,M([M([ep("Work and communicate with the Buyer to receive "),v(s),ep(" as described in External Payment Method. Then, the Buyer should confirm the payment, moving the trade to the final phase.")]),M([ep("If the Buyer aborts the trade, or doesn't confirm payment before this time is up, "),v(b),ep(" (1/4 of the "),u("burnable deposit"),ep(") will be "),u("burned"),ep(" from both parties, while the remainder of each party's deposit is refunded ("),v(E),ep(" to you, "),v(C),ep(" to the Buyer).")])])));case"Judgment":if("Buyer"===t.b.a.$){t.a,t.b.a;return _("Judgement",f(Ua,p,M([M([ep("If the Seller confirms receipt of payment, or makes no decision within the Burn Window, the combined balance of "),v(a),ep(" is yours to claim.")]),M([ep("If they cannot confirm they've received payment from you, they will probably choose to "),u("burn the contract's balance of "),v(a),u("."),ep(" In this case the "),v(a),ep(" will be lost to both parties.")]),M([ep("These are the only options the Seller has. So, fingers crossed!")])])))}t.a,t.b.a;return _("Judgement",f(Ua,p,M([M([ep("By pushing the contract to the final stage, the Buyer has indicated that the transfer has taken place, and awaits your judgement.")]),M([ep("So, have you recieved the "),v(s),ep("? If so, you can click "),v("Release Everything"),ep(".")]),M([ep("If not, the Buyer is probably trying to scam you, and you should probably "),u("burn it all"),ep(". You're not getting it back either way, and you wouldn't want the other guy to get it, would you?")]),M([ep("If you don't decide within the Burn Window, the Buyer will be able to claim the full balance.")])])));default:t.a;return _("Contract closed.",M([p(M([ep("Check the chat log for the full history.")]))]))}else switch(t.a.$){case"Open":t.a,t.b;return _("Get it while it's hot",function(){return"Seller"===r.parameters.initiatorRole.$?f(Ua,p,M([M([ep("The Seller has deposited "),v(i),ep(" into this contract, and offers to sell it for "),v(s),ep(". To become the Buyer, you must deposit 1/3 of the trade amount "),v("("+y+")"),ep(" into this contract by clicking "),u("Deposit and Commit to Trade"),ep(".")]),M([ep("If the trade is successful, the combined "+E_(r.factory)+" balance "),v("("+a+")"),ep(" will be released to you. If anything goes wrong, there are "),u("burnable punishments "),o,ep(" for both parties (see Payment Window for more on this).")]),M([ep("Don't commit unless you can fulfil one of the seller’s accepted payment methods below for "),v(s),ep(" within the payment window.")])])):f(Ua,p,M([M([ep("The Buyer is offering to buy "),v(i),ep(" for "),v(s),ep(", and has deposited "),v(y),ep(" into this contract as a "),u("burnable deposit"),ep(". To become the Seller, deposit "),v(i),ep(" into this contract by clicking "),u("Deposit and Commit to Trade"),ep(".")]),M([ep("When you receive the "),v(s),ep(" from the Buyer, the combined "+E_(r.factory)+" balance "),v("("+a+")"),ep(" will be released to the Buyer. If anything goes wrong, there are "),u("burnable punishments "),o,ep(" for both parties (see Payment Window for more on this).")]),M([ep("Don't commit unless you can receive "),v(s),ep(" via one of the Buyer's payment methods below, within the payment window.")])]))}());case"Committed":t.a,t.b;return _("Making the Payment",f(Ua,p,M([M([ep("During this phase, the Buyer is expected to transfer "),v(s),ep(" to the Seller, as described in External Payment Method, "),f(IR,M([Tx]),ep("and ")),u("Confirm the Payment "),ep(" before the payment window runs out. This would move the trade to the final phase.")]),M([ep("If the Buyer aborts the trade, or doesn't confirm payment before this time is up, "),v(b),ep(" (1/4 of the "),u("burnable deposit"),ep(" amount) will be "),u("burned"),ep(" from both parties, while the remainder of each party's deposit is refunded ("),v(E),ep(" to the Seller, "),v(C),ep(" to the Buyer).")])])));case"Judgment":t.a,t.b;return _("Judgement",f(Ua,p,M([M([ep("The Buyer has indicated that the transfer has taken place, and awaits the Seller's judgement on the fact of the matter.")]),M([ep("If the Seller can verify he has received the "),v(s),ep(", he will probably release the total balance of "),v(i),ep(" to the Buyer. If he cannot verify payment, he will probably instead "),u("burn it all"),ep(".")]),M([ep("If the Seller has not made a decision before the Burn Window expires, the "),v(i),ep(" becomes claimable by the Buyer.")])])));default:t.a,t.b;return _("Contract closed.",vr)}}(),T=S.a,w=S.b;return f(Fx,M([UI(BR),_I(BR),e_(20),px(30)]),M([f(fx,M([UI(BR)]),M([f(IR,M([Ax(24),Tx,Fk(g),GL]),ep(T))])),f(Fx,M([UI(BR),tx,px(13)]),w),f(IR,M([Ux]),function(){switch(f(tj,r,e).$){case"Active":return l(XH,t,r,n);case"NotStarted":return f(IR,M([Ax(20),Tx,ML,Fk(l_)]),ep("Phase not yet started."));default:return f(IR,M([Ax(20),Tx,ML]),ep("Phase no longer active."))}}())]))}),ij=function(e){switch(e.$){case"Open":return"Expiring...";case"Committed":return"Aborting...";case"Judgment":return"Releasing...";default:return""}},oj=FR({description:"committed phase",src:"/DAIHard/static/img/phase-committed.svg"}),uj=FR({description:"judgment phase",src:"/DAIHard/static/img/time-clock-fire.svg"}),sj={$:"None"},cj=sj,fj=FR({description:"open phase",src:"/DAIHard/static/img/diamond-give-white.svg"}),lj=function(e){switch(e.$){case"Open":return fj;case"Committed":return oj;case"Judgment":return uj;default:return cj}},dj=r(function(e,t){var r=lj(e),n=function(){switch(t.$){case"NotStarted":return l(DR,10,33,108);case"Active":return l(DR,0,100,170);default:return l(DR,1,129,104)}}(),a=vO(aF(f(_O,TO(gO(n)),mO(50))));return f(IR,M([$x,xR(f(XR,M([$x,tx,_I(PR(60))]),r))]),a)}),hj=function(e){var t=M([ML,Tx,Ax(20)]);switch(e.$){case"Active":return f(IR,U(t,M([Fk(zR)])),ep("Active"));case"NotStarted":return f(IR,U(t,M([Fk(l_)])),ep("Not Started"));default:return f(IR,t,ep("Finished"))}},pj=n(function(e,t,r){var n=f(tj,t,e),a=function(){return"Active"===n.$?l(DR,0,226,255):B_}(),i=f(IR,M([Fk(a),Ax(20),Tx,$x]),ep(function(){switch(e.$){case"Open":return"Open Window";case"Committed":return"Payment Window";case"Judgment":return"Burn Window";default:return"Closed"}}())),o=function(){if("Closed"===e.$)return _R;switch(n.$){case"NotStarted":return d(L_,M([$x]),M([Ax(22),o_]),_(B_,P_),f(w_,e,t));case"Active":var a=f(I_,r,t);if("TimeLeft"===a.$){var i=a.a;return d(V_,M([$x]),M([Ax(22),o_]),_(WR,P_),i)}return f(Fx,M([$x,px(10)]),M([f(IR,M([$x]),ep(ij(e))),f(dK,"Poke",Cw(yw))]));default:return f(IR,M([_I(PR(1))]),_R)}}();return f(Fx,M([e_(20),px(10),_I(BR)]),M([f(IR,M([AP,$x]),i),f(IR,M([_I(BR),$x]),f(IR,M([tx]),f(dj,e,n))),f(Fx,M([px(10),DU,$x]),M([f(IR,M([$x]),hj(n)),o]))]))}),gj=r(function(e,t){return{$:"Min",a:e,b:t}}),vj=r(function(e,t){return f(gj,e,t)}),yj=i(function(e,t,r,n,a){var i=f(tj,t,e),o=f(IR,M([e_(10),UI(BR),_I(BR)]),d(aj,e,a,t,r)),u=function(){switch(e.$){case"Open":return t.parameters.autorecallInterval;case"Committed":return t.parameters.autoabortInterval;case"Judgment":return t.parameters.autoreleaseInterval;default:return Ho(0)}}(),s=l(pj,e,t,a),c=(function(){switch(i.$){case"NotStarted":return u;case"Active":return f(ul,f(oS,t.state.phaseStartTime,u),a);default:Ho(0)}}(),M([vx(12),AP,_I(f(vj,380,PI)),pP({blur:8,color:d(wL,0,0,0,.2),offset:_(0,0),size:0})])),h=f(IR,M([_I(BR),UI(PR(1)),OR(function(){return"Active"===i.$?l(Pk,0,0,1):P_}())]),_R);return n?f(fx,U(c,U($(i,VH)?HH:jH,M([UI(BR)]))),M([s,h,o])):f(fx,U(c,U($(i,VH)?HH:jH,M([ux,Ex(KH(e))]))),M([s]))}),mj=a(function(e,t,r,n){return"Closed"===e.state.phase.$?f(fx,M([$x,vx(12),px(10),e_(10),OR(PH),Ax(24),Tx,Fk(WR)]),M([ep("Trade "+OH(e.state.closedReason)),UH])):f(Fx,M([UI(BR),px(10)]),M([f(fx,M([UI(BR),_I(PI),px(20)]),M([h(yj,Io,e,r,$(t,Io),n),h(yj,To,e,r,$(t,To),n),h(yj,wo,e,r,$(t,wo),n)])),FH(e.terms.paymentMethods)]))}),bj=a(function(e,t,r,n){return _(d(LV,1800,li,"Trade at "+function(){var e=Vw(n.trade);if("Just"===e.$){var t=e.a;return sp(t.address)}return"..."}(),f(IR,M([e_(30),UI(BR)]),function(){var e=n.trade;switch(e.$){case"LoadedTrade":var a=e.a;return f(Fx,M([UI(BR),_I(BR),px(40)]),M([h(LH,t,a,n.wallet,r,n.showStatsModal),f(IR,M([UI(BR),f(ax,40,0),px(40)]),d(mj,a,n.expandedPhase,n.wallet,t))]));case"PartiallyLoadedTrade":e.a;return f(IR,M([$x,tx,Ax(30)]),ep("Loading trade info..."));default:return f(IR,M([$x,tx,Ax(30)]),ep("Invalid trade"))}}())),M([WV(n),XV(n)]))}),Cj=n(function(e,t,r){var n=r.a,a=r.b;return _(e(n),t(a))}),Ej=r(function(e,t){var r=function(){var r=t.submodel;switch(r.$){case"InitialBlank":return _(_R,vr);case"CreateModel":var n=r.a;return l(Cj,Ji(EI),Ua(Ji(EI)),MF(n));case"TradeModel":var a=r.a;return l(Cj,Ji(BI),Ua(Ji(BI)),d(bj,e,t.time,t.tradeCaches,a));case"MarketplaceModel":var i=r.a;return l(Cj,Ji(wI),Ua(Ji(wI)),l(xV,t.time,t.tradeCaches,i));default:var o=r.a;return _(f(Ji,yI,l(FP,t.time,t.tradeCaches,o)),vr)}}(),n=r.a,a=r.b;return _(f(IR,M([UI(BR),_I(BR),vx(10)]),n),a)}),Sj=function(e){return{$:"DismissNotice",a:e}},Tj=function(e){return f(uP,sV,cV(e))},wj=function(e){var t=e.a,n=e.b,a=function(){return"Error"===n.noticeType.$?l(Pk,1,1,1):l(Pk,0,0,0)}(),i=function(){switch(n.noticeType.$){case"Update":return l(DR,100,200,255);case"Caution":return l(DR,255,188,0);case"Error":return l(DR,255,70,70);default:return l(DR,200,200,200)}}(),o=f(IR,M([Ux,AP,sP(5),Tj(5)]),wF(Sj(t)));return f(IR,M([OR(i),vx(10),e_(8),UI(BR),LL(1),xL(d(wL,0,0,0,.15)),PV]),f(Fx,M([px(4),UI(BR)]),f(Ni,r(function(e,t){return f(_x,M([UI(BR),Fk(a)]),e?t:f(Ra,o,t))}),n.mainParagraphs)))},Ij=function(e){return $(e,vr)?vr:M([f(Fx,M([fV(20),sP(20),px(10),Ux,DU,UI(PR(300)),Ax(15)]),f(Ua,wj,f(pp,function(e){return $(e.b.align,Xh)},f(Ni,r(function(e,t){return _(e,t)}),e)))),f(Fx,M([Tj(20),ZD(100),px(10),GL,AP,UI(PR(300)),Ax(15)]),f(Ua,wj,f(pp,function(e){return $(e.b.align,n$)},f(Ni,r(function(e,t){return _(e,t)}),e))))])},Aj=r(function(e,t){var r=f(Ej,e,t),n=r.a,a=r.b;return _(f(Fx,M([U_(MR),xR(Vx(t)),UI(BR),_I(BR),e_(30)]),M([f(IR,M([_I(PR(50))]),_R),n])),U(a,Ij(t.userNotices)))}),Bj=function(e){return{$:"FocusStyleOption",a:e}},kj=Bj,Nj=r(function(e,t){return{$:"OnlyDynamic",a:e,b:t}}),$j=r(function(e,t){return{$:"StaticRootAndDynamic",a:e,b:t}}),Rj={$:"AllowHover"},xj={$:"Layout"},_j={backgroundColor:li,borderColor:li,shadow:fi({blur:0,color:d(Lk,155/255,203/255,1,1),offset:_(0,0),size:3})},Lj=function(e){var t=r(function(e,t){switch(e.$){case"HoverOption":var r=e.a;return"Nothing"===t.hover.$?D(t,{hover:fi(r)}):t;case"FocusStyleOption":var n=e.a;return"Nothing"===t.focus.$?D(t,{focus:fi(n)}):t;default:var a=e.a;return"Nothing"===t.mode.$?D(t,{mode:fi(a)}):t}});return function(e){return{focus:function(){var t=e.focus;return"Nothing"===t.$?_j:t.a}(),hover:function(){var t=e.hover;return"Nothing"===t.$?Rj:t.a}(),mode:function(){var t=e.mode;return"Nothing"===t.$?xj:t.a}()}}(l(Da,t,{focus:li,hover:li,mode:li},e))},Pj=r(function(e,t){switch(t.$){case"Unstyled":var r=t.a;return r(KI);case"Styled":var n=t.a.styles,r=t.a.html;return f(r,e(n),KI);case"Text":var a=t.a;return QB(a);default:return QB("")}}),Dj=n(function(e,t,r){var n=Lj(e),a=function(){return"NoStaticStyleSheet"===n.mode.$?Nj(n):$j(n)}();return f(Pj,a,d(Rk,KI,wR,t,FI(M([r]))))}),Uj=gA(5),Oj=r(function(e,t){return{$:"FontFamily",a:e,b:t}}),Mj={$:"SansSerif"},Fj=function(e){return{$:"Typeface",a:e}},Vj=J,Kj=r(function(e,t){return U(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(xi,"-",Vj(Zp(t)));case"ImportFont":var t=e.a;e.b;return f(xi,"-",Vj(Zp(t)));default:var t=e.a.name;return f(xi,"-",Vj(Zp(t)))}}())}),Hj=function(){var e=M([Fj("Open Sans"),Fj("Helvetica"),Fj("Verdana"),Mj]);return M([f(Ok,UR,l(Uk,"bg-"+Mk(d(Lk,1,1,1,0)),"background-color",d(Lk,1,1,1,0))),f(Ok,Dk,l(Uk,"fc-"+Mk(d(Lk,0,0,0,1)),"color",d(Lk,0,0,0,1))),f(Ok,wx,Ix(20)),f(Ok,Uj,f(Oj,l(_a,Kj,"font-",e),e))])}(),jj=n(function(e,t,r){var n=e.options;return l(Dj,n,f(Ra,xk(f(xi," ",M([GI.root,GI.any,GI.single]))),U(Hj,t)),r)}),qj=function(e){return f(Ok,Uj,f(Oj,l(_a,Kj,"ff-",e),e))},Gj=Mj,zj=Fj,Wj=function(e){return{body:M([function(){var t=f(Aj,e.screenWidth,e),r=t.a,n=t.b,a=U(M([UI(BR),_I(BR),Ex(SR),qj(M([zj("Soleil"),Gj]))]),f(Ua,xR,n));return l(jj,{options:M([kj({backgroundColor:li,borderColor:li,shadow:li})])},a,r)}()]),title:"DAIHard"}},Yj=Gt,Jj=Yj({init:C$,onUrlChange:ER,onUrlRequest:CR,subscriptions:bR,update:jN,view:Wj});!function(t){e.Elm?Je("Elm",e.Elm,t):e.Elm=t}({App:{init:Jj(f(Cu,function(e){return f(Cu,function(t){return f(Cu,function(r){return Ki({height:r,networkId:t,width:e})},f(hl,"height",xT))},f(hl,"networkId",xT))},f(hl,"width",xT)))(0)}})}(this)},function(e,t,r){"use strict";function n(){"undefined"!=typeof web3?web3.version.getNetwork(function(e,t){var r;e?(console.log("Error initializing web3: "+e),r=0):r=parseInt(t),window.app=c.Elm.App.init({node:document.getElementById("elm"),flags:{networkId:r,width:window.innerWidth,height:window.innerHeight}}),i(app),a(app),o(app,web3)}):(window.app=c.Elm.App.init({node:document.getElementById("elm"),flags:{networkId:0,width:window.innerWidth,height:window.innerHeight}}),i(app),a(app),console.log("Metamask not detected."))}function a(e){e.ports.notifyPort.subscribe(function(e){h.notify(e.title,e.body,e.image)}),e.ports.requestNotifyPermissionPort.subscribe(function(){h.requestPermission(function(e){})})}function i(e){e.ports.gTagOut.subscribe(function(e){gtag("event",e.event,{event_category:e.category,event_label:e.label,value:e.value})})}function o(e,t){u(e,t),t.eth.getAccounts(function(r,n){n&&n.length>0&&s(e,t)})}function u(e,t){d.startWatching(e.ports.networkSentryPort,t),e.ports.connectToWeb3.subscribe(function(r){s(e,t)})}function s(e,t){window.ethereum&&!window.web3Connected&&(window.web3=new Web3(ethereum)),f.txSentry(e.ports.txOut,e.ports.txIn,t),f.walletSentry(e.ports.walletSentryPort,t),d.startWatching(e.ports.networkSentryPort,t),e.ports.genPrivkey.subscribe(function(t){l.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=l.encryptToPubkeys(t.message,t.pubkeyHexStrings);e.ports.encryptionFinished.send(r)}),e.ports.decryptMessage.subscribe(function(t){var r=t.id,n=l.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 c=r(42),f=(r.n(c),r(41)),l=r(40),d=r(39),h=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,r,f),k(n,e[0],e[1]),k(f,t[0],t[1]),R(n,n,f),R(a,e[3],t[3]),R(a,a,F),R(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),R(e[0],o,u),R(e[1],c,s),R(e[2],s,u),R(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(r,t[0],a),R(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),$(a,e[1]),R(i,a,M),N(a,a,e[2]),k(i,e[2],i),$(o,i),$(u,o),R(s,u,o),R(r,s,a),R(r,r,i),v(r,r),R(r,r,a),R(r,r,i),R(r,r,i),R(e[0],r,i),$(n,e[0]),R(n,n,i),y(n,a)&&R(e[0],e[0],j),$(n,e[0]),R(n,n,i),y(n,a)?-1:(C(e[0])===t[31]>>7&&N(e[0],U,e[0]),R(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)$(n,n),1!==r&&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 E(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 S(e,t){var r=[B(),B(),B(),B()];T(r[0],V),T(r[1],K),T(r[2],O),R(r[3],V,K),E(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)$(n,n),2!==r&&4!==r&&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(56),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/elm.json b/elm.json index 15929ef..6ddd55a 100644 --- a/elm.json +++ b/elm.json @@ -10,6 +10,7 @@ "avh4/elm-color": "1.0.0", "cmditch/elm-bigint": "1.0.1", "cmditch/elm-ethereum": "3.0.1", + "coinop-logan/elm-format-number": "1.0.0", "elm/browser": "1.0.1", "elm/core": "1.0.2", "elm/html": "1.0.0", @@ -43,6 +44,7 @@ "elm/virtual-dom": "1.0.2", "elm-community/basics-extra": "4.0.0", "elm-community/easing-functions": "2.0.0", + "myrho/elm-round": "1.0.4", "prozacchiwawa/elm-keccak": "2.0.0", "rtfeldman/elm-hex": "1.0.0", "zwilias/elm-utf-tools": "2.0.1" diff --git a/package-lock.json b/package-lock.json index 4c40092..9c63f55 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "daihard", - "version": "0.9.4", + "version": "0.9.5", "lockfileVersion": 1, "requires": true, "dependencies": { @@ -7945,4 +7945,4 @@ } } } -} +} \ No newline at end of file diff --git a/package.json b/package.json index c8938b3..8d5e506 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "daihard", "description": "decentralized fiat/crypto transfers, using threat of burn", - "version": "0.9.4", + "version": "0.9.5", "license": "UNLICENSED", "author": "Logan Brutsche", "repository": { @@ -39,4 +39,4 @@ "elm-format": "^0.8.1", "node-forge": "^0.8.1" } -} +} \ No newline at end of file diff --git a/src/AgentHistory/State.elm b/src/AgentHistory/State.elm index 1149e26..82b8162 100644 --- a/src/AgentHistory/State.elm +++ b/src/AgentHistory/State.elm @@ -22,7 +22,7 @@ import Helpers.Eth as EthHelpers import Helpers.Time as TimeHelpers import PaymentMethods exposing (PaymentMethod) import PriceFetch -import Prices exposing (Price) +import Currencies exposing (Price) import Routing import String.Extra import Time diff --git a/src/AgentHistory/Types.elm b/src/AgentHistory/Types.elm index 407b588..ae7686d 100644 --- a/src/AgentHistory/Types.elm +++ b/src/AgentHistory/Types.elm @@ -6,6 +6,7 @@ import ChainCmd exposing (ChainCmd) import CmdUp exposing (CmdUp) import CommonTypes exposing (..) import Contracts.Types as CTypes +import Currencies exposing (Price) import Dict exposing (Dict) import Eth.Net import Eth.Sentry.Event as EventSentry exposing (EventSentry) @@ -16,7 +17,6 @@ import Http import Json.Decode import PaymentMethods exposing (PaymentMethod) import PriceFetch -import Prices exposing (Price) import Routing import String.Extra import Time @@ -31,7 +31,7 @@ type alias Model = , agentAddress : Address , filters : Filters.Model , tradeTable : TradeTable.Model - , prices : List ( ForeignCrypto, PriceFetch.PriceData ) + , prices : List ( Currencies.Symbol, PriceFetch.PriceData ) , now : Time.Posix } @@ -43,7 +43,7 @@ type Msg | TradeTableMsg TradeTable.Msg | UpdateNow Time.Posix | Refresh - | PricesFetched (Result Http.Error (List ( ForeignCrypto, PriceFetch.PriceAndTimestamp ))) + | PricesFetched (Result Http.Error (List ( Currencies.Symbol, PriceFetch.PriceAndTimestamp ))) | NoOp diff --git a/src/AgentHistory/View.elm b/src/AgentHistory/View.elm index 73025c4..47127b8 100644 --- a/src/AgentHistory/View.elm +++ b/src/AgentHistory/View.elm @@ -4,6 +4,7 @@ import AgentHistory.Types exposing (..) import Array exposing (Array) import CommonTypes exposing (..) import Contracts.Types as CTypes +import Currencies exposing (Price) import Element exposing (Attribute, Element) import Element.Background import Element.Border @@ -20,7 +21,6 @@ import Html.Events.Extra import Images exposing (Image) import Maybe.Extra import PaymentMethods exposing (PaymentMethod) -import Prices exposing (Price) import Time import TokenValue exposing (TokenValue) import TradeCache.State as TradeCache @@ -32,25 +32,14 @@ import Wallet root : Time.Posix -> List TradeCache -> Model -> Element Msg root time tradeCaches model = - EH.submodelContainer + EH.simpleSubmodelContainer 1800 - Nothing - (case Wallet.userInfo model.wallet of - Nothing -> - "TRADE HISTORY FOR " ++ Eth.Utils.addressToString model.agentAddress - - Just userInfo -> - if userInfo.address == model.agentAddress then - "YOUR TRADES" - - else - "TRADE HISTORY FOR " ++ Eth.Utils.addressToString model.agentAddress - ) (Element.column [ Element.width Element.fill , Element.padding 30 ] - [ statusAndFiltersElement tradeCaches model + [ titleElement model + , statusAndFiltersElement tradeCaches model , let tcDoneLoading = List.all @@ -62,6 +51,40 @@ root time tradeCaches model = ) +titleElement : Model -> Element Msg +titleElement model = + let + viewingOwnHistory = + case Wallet.userInfo model.wallet of + Nothing -> + False + + Just userInfo -> + userInfo.address == model.agentAddress + in + if viewingOwnHistory then + Element.none + + else + Element.row + [ Element.spacing 10 + , Element.centerX + , Element.paddingEach + { top = 10 + , left = 20 + , right = 20 + , bottom = 20 + } + ] + [ Element.el + [ Element.Font.size 24 + , Element.Font.semiBold + ] + (Element.text "Trade History for User") + , EH.ethAddress 18 model.agentAddress + ] + + statusAndFiltersElement : List TradeCache -> Model -> Element Msg statusAndFiltersElement tradeCaches model = let diff --git a/src/CommonTypes.elm b/src/CommonTypes.elm index 92c2b5a..b157391 100644 --- a/src/CommonTypes.elm +++ b/src/CommonTypes.elm @@ -1,4 +1,4 @@ -module CommonTypes exposing (BuyerOrSeller(..), FactoryType(..), ForeignCrypto(..), GTagData, InitiatorOrResponder(..), NativeFactoryType(..), TokenFactoryType(..), UserInfo, buyerOrSellerToString, factoryName, foreignCryptoFromName, foreignCryptoList, foreignCryptoName, networkNameForFactory, tokenUnitName) +module CommonTypes exposing (BuyerOrSeller(..), FactoryType(..), GTagData, InitiatorOrResponder(..), IntervalType(..), NativeFactoryType(..), TokenFactoryType(..), UserInfo, buyerOrSellerToString, dhTokenList, factoryName, intervalTypeToString, networkNameForFactory, tokenSymbol, tokenUnitName) import Dict import Eth.Net @@ -48,6 +48,25 @@ type BuyerOrSeller | Seller +type IntervalType + = Expiry + | Payment + | Judgment + + +intervalTypeToString : IntervalType -> String +intervalTypeToString intervalType = + case intervalType of + Expiry -> + "Expiry" + + Payment -> + "Payment" + + Judgment -> + "Judgment" + + buyerOrSellerToString : BuyerOrSeller -> String buyerOrSellerToString role = case role of @@ -96,6 +115,25 @@ tokenUnitName factoryType = "xDai" +tokenSymbol : FactoryType -> String +tokenSymbol factoryType = + case factoryType of + Token EthDai -> + "DAI" + + Token KovanDai -> + "DAI" + + Native Eth -> + "ETH" + + Native Kovan -> + "ETH" + + Native XDai -> + "XDAI" + + networkNameForFactory : FactoryType -> String networkNameForFactory factoryType = case factoryType of @@ -115,41 +153,8 @@ networkNameForFactory factoryType = "xDai" -type ForeignCrypto - = ZEC - | XMR - | BTC - - -foreignCryptoList : List ForeignCrypto -foreignCryptoList = - [ ZEC - , XMR - , BTC +dhTokenList : List FactoryType +dhTokenList = + [ Native XDai + , Token EthDai ] - - -foreignCryptoName : ForeignCrypto -> String -foreignCryptoName crypto = - case crypto of - ZEC -> - "ZEC" - - XMR -> - "XMR" - - BTC -> - "BTC" - - -foreignCryptoFromName : String -> Maybe ForeignCrypto -foreignCryptoFromName name = - foreignCryptoList - |> List.map - (\fCrypto -> - ( foreignCryptoName fCrypto - , fCrypto - ) - ) - |> Dict.fromList - |> Dict.get name diff --git a/src/Contracts/Types.elm b/src/Contracts/Types.elm index 58f8e3e..f997629 100644 --- a/src/Contracts/Types.elm +++ b/src/Contracts/Types.elm @@ -6,6 +6,7 @@ import CommonTypes exposing (..) import Config import Contracts.Generated.DAIHardFactory as DHF import Contracts.Generated.DAIHardTrade as DHT +import Currencies exposing (Price) import Eth.Decode import Eth.Types exposing (Address) import Eth.Utils @@ -15,7 +16,6 @@ import Images exposing (Image) import Json.Decode import Json.Encode import PaymentMethods exposing (PaymentMethod) -import Prices exposing (Price) import Time import TokenValue exposing (TokenValue) @@ -812,7 +812,7 @@ encodeTerms terms = terms.paymentMethods encodedPrice = - Prices.encode terms.price + Currencies.encodePrice terms.price in Json.Encode.object [ ( "paymentmethods", encodedPaymentMethods ) @@ -827,7 +827,7 @@ decodeTerms encodedTerms = decoder = Json.Decode.map2 Terms - (Json.Decode.field "price" Prices.decoder) + (Json.Decode.field "price" Currencies.priceDecoder) (Json.Decode.field "paymentmethods" (Json.Decode.list PaymentMethods.decoder) ) diff --git a/src/Contracts/Wrappers.elm b/src/Contracts/Wrappers.elm index a838072..c8bbd25 100644 --- a/src/Contracts/Wrappers.elm +++ b/src/Contracts/Wrappers.elm @@ -21,7 +21,7 @@ import Http import Json.Decode import Json.Encode import PaymentMethods -import Prices exposing (Price) +import Currencies exposing (Price) import Task import Time import TokenValue exposing (TokenValue) diff --git a/src/Create/PMWizard/State.elm b/src/Create/PMWizard/State.elm deleted file mode 100644 index bf43e20..0000000 --- a/src/Create/PMWizard/State.elm +++ /dev/null @@ -1,72 +0,0 @@ -module Create.PMWizard.State exposing (init, update) - -import Create.PMWizard.Types exposing (..) -import PaymentMethods exposing (PaymentMethod) - - -init : Model -init = - Details <| PaymentMethods.blank PaymentMethods.Custom - - -update : Msg -> Model -> UpdateResult -update msg prevModel = - case msg of - SelectType pmType -> - justModelUpdate - (Details <| PaymentMethods.blank pmType) - - ChangeDetails s -> - case prevModel of - Details paymentMethod -> - justModelUpdate <| - Details { paymentMethod | info = s } - - _ -> - let - _ = - Debug.log "Trying to change details, but no type selected!" "" - in - justModelUpdate prevModel - - SaveAndAddAnother -> - case prevModel of - Details paymentMethod -> - UpdateResult - (Just ChooseType) - Cmd.none - (Just paymentMethod) - - _ -> - let - _ = - Debug.log "add a payment method, but no type selected!" "" - in - justModelUpdate prevModel - - Save -> - case prevModel of - Details paymentMethod -> - UpdateResult - Nothing - Cmd.none - (Just paymentMethod) - - _ -> - let - _ = - Debug.log "add a payment method, but no type selected!" "" - in - justModelUpdate prevModel - - Back -> - justModelUpdate ChooseType - - CloseClicked -> - UpdateResult - Nothing - Cmd.none - Nothing - - NoOp -> - justModelUpdate prevModel diff --git a/src/Create/PMWizard/Types.elm b/src/Create/PMWizard/Types.elm deleted file mode 100644 index 1cb2156..0000000 --- a/src/Create/PMWizard/Types.elm +++ /dev/null @@ -1,33 +0,0 @@ -module Create.PMWizard.Types exposing (Model(..), Msg(..), UpdateResult, justModelUpdate) - -import PaymentMethods exposing (PaymentMethod) - - -type Model - = ChooseType - | Details PaymentMethod - - -type Msg - = SelectType PaymentMethods.Type - | ChangeDetails String - | SaveAndAddAnother - | Save - | Back - | CloseClicked - | NoOp - - -type alias UpdateResult = - { model : Maybe Model - , cmd : Cmd Msg - , newPaymentMethod : Maybe PaymentMethod - } - - -justModelUpdate : Model -> UpdateResult -justModelUpdate model = - UpdateResult - (Just model) - Cmd.none - Nothing diff --git a/src/Create/PMWizard/View.elm b/src/Create/PMWizard/View.elm deleted file mode 100644 index 5c6104e..0000000 --- a/src/Create/PMWizard/View.elm +++ /dev/null @@ -1,243 +0,0 @@ -module Create.PMWizard.View exposing (root) - -import CommonTypes exposing (..) -import Contracts.Types as CTypes -import Create.PMWizard.Types exposing (..) -import Element exposing (Attribute, Element) -import Element.Background -import Element.Border -import Element.Events -import Element.Font -import Element.Input -import Helpers.Element as EH -import Images exposing (Image) -import PaymentMethods exposing (PaymentMethod) - - -root : Model -> BuyerOrSeller -> Element Msg -root model userRole = - Element.column - [ Element.width <| Element.px 1050 - , Element.centerX - ] - [ Element.el [ Element.height <| Element.px 60 ] Element.none - , Element.el - [ Element.width Element.fill - , Element.Background.color EH.white - , EH.roundTopCorners 8 - , Element.Border.color EH.mediumGray - , Element.Border.widthEach - { bottom = 1 - , top = 0 - , right = 0 - , left = 0 - } - , Element.paddingXY 48 39 - ] - (headerElement model) - , Element.el - [ Element.width Element.fill - , Element.height <| Element.px 610 - , Element.Background.color EH.lightGray - , EH.roundBottomCorners 8 - , Element.paddingXY 48 39 - ] - (bodyElement model userRole) - ] - - -headerElement : Model -> Element Msg -headerElement model = - let - maybeBackButtonEl = - case model of - ChooseType -> - Element.none - - Details pm -> - Images.toElement - [ Element.pointer - , Element.Events.onClick Back - ] - Images.backButton - in - Element.row - [ Element.width Element.fill - , Element.spacing 22 - ] - [ Element.el - [ Element.Font.size 24 - , Element.Font.semiBold - , Element.centerX - ] - (Element.text <| getTitle model) - , Element.el - [ Element.Font.size 40 - , Element.alignRight - , Element.pointer - , Element.padding 4 - , Element.Events.onClick CloseClicked - ] - (Element.text "x") - ] - - -getTitle : Model -> String -getTitle model = - "Add Payment Methods" - - -bodyElement : Model -> BuyerOrSeller -> Element Msg -bodyElement model userRole = - case model of - ChooseType -> - chooseTypeElement userRole - - Details paymentMethod -> - detailsElement paymentMethod userRole - - -chooseTypeElement : BuyerOrSeller -> Element Msg -chooseTypeElement userRole = - Element.column [ Element.spacing 32 ] - [ Element.row [ Element.spacing 32 ] - [ pmTypeElement PaymentMethods.Cash userRole - , pmTypeElement PaymentMethods.Bank userRole - ] - , pmTypeElement PaymentMethods.Custom userRole - ] - - -pmTypeElement : PaymentMethods.Type -> BuyerOrSeller -> Element Msg -pmTypeElement pmType userRole = - let - icon = - PaymentMethods.typeToIcon pmType - - title = - typeTitle pmType - - summary = - typeSummary pmType userRole - - onClick = - SelectType pmType - in - Element.column - [ Element.width <| Element.px 450 - , Element.height <| Element.px 250 - , Element.Border.rounded 8 - , Element.Background.color EH.white - , Element.centerX - , Element.spacing 6 - , Element.padding 50 - , Element.pointer - , Element.mouseOver [ Element.Background.color EH.lightBlue ] - , Element.Events.onClick onClick - ] - [ Images.toElement [ Element.centerX ] icon - , Element.el - [ Element.Font.size 20 - , Element.Font.semiBold - , Element.centerX - ] - (Element.text title) - , Element.paragraph - [ Element.Font.size 17 - , Element.Font.color EH.permanentTextColor - , Element.centerX - , Element.width <| Element.px 350 - , Element.Font.center - ] - [ Element.text summary ] - ] - - -detailsElement : PaymentMethod -> BuyerOrSeller -> Element Msg -detailsElement paymentMethod userRole = - Element.el - [ Element.padding 20 - , Element.Background.color EH.white - , Element.width Element.fill - , Element.height Element.fill - , EH.roundBottomCorners 5 - ] - (Element.column - [ Element.spacing 20 - , Element.width Element.fill - , Element.height Element.fill - ] - [ Element.Input.multiline - [ Element.width Element.fill - , Element.height Element.fill - ] - { onChange = ChangeDetails - , text = paymentMethod.info - , placeholder = - if paymentMethod.info == "" then - Just <| inputPlaceholder paymentMethod userRole - - else - Nothing - , label = Element.Input.labelHidden "details" - , spellcheck = True - } - , Element.row - [ Element.alignRight - , Element.spacing 18 - ] - [ EH.blueButton "Save" Save - ] - ] - ) - - -typeTitle : PaymentMethods.Type -> String -typeTitle pmType = - case pmType of - PaymentMethods.Cash -> - "Cash Drop/Handoff" - - PaymentMethods.Bank -> - "Bank Transfer" - - PaymentMethods.Custom -> - "Custom" - - -typeSummary : PaymentMethods.Type -> BuyerOrSeller -> String -typeSummary pmType userRole = - case ( pmType, userRole ) of - ( PaymentMethods.Cash, Buyer ) -> - "Indicate specific or general locations where you’re happy to meet with the seller or drop off the cash." - - ( PaymentMethods.Cash, Seller ) -> - "Indicate specific or general locations where you’re happy to meet with the buyer or pick up the cash." - - ( PaymentMethods.Bank, Buyer ) -> - "Indicate where you can make bank transfers to, either nationally or with specific banks." - - ( PaymentMethods.Bank, Seller ) -> - "Indicate where you will accept bank transfers from, either nationally or with specific banks." - - ( PaymentMethods.Custom, _ ) -> - "Indicate specific, custom terms for this trade." - - -inputPlaceholder : PaymentMethod -> BuyerOrSeller -> Element.Input.Placeholder Msg -inputPlaceholder paymentMethod userRole = - Element.Input.placeholder - [] - (Element.text """Put lots of detail here. You can provide multiple options. -If you are accepting a bank transfer, include a routing/ABA/IBAN number, to avoid ambiguity. - -Some examples for Sellers: - -I can accept transfers to a Schwab bank account (routing 121202211) -I can meet in person to accept cash in London, weekdays after 6, with a day of notice. - -Some examples for Buyers: - -I can deliver cash anywhere within an hour drive of Phoneix, AZ, with 2 days of notice. -I can send money via TransferWise -""") diff --git a/src/Create/State.elm b/src/Create/State.elm index e8d1ed1..5b20796 100644 --- a/src/Create/State.elm +++ b/src/Create/State.elm @@ -2,286 +2,753 @@ module Create.State exposing (init, runCmdDown, subscriptions, update) import BigInt exposing (BigInt) import ChainCmd exposing (ChainCmd) -import CmdDown -import CmdUp +import CmdDown exposing (CmdDown) +import CmdUp exposing (CmdUp) import CommonTypes exposing (..) import Config import Contracts.Generated.ERC20Token as TokenContract import Contracts.Types as CTypes import Contracts.Wrappers -import Create.PMWizard.State as PMWizard import Create.Types exposing (..) +import Currencies import Eth -import Eth.Types exposing (Address) -import Flip exposing (flip) import Helpers.BigInt as BigIntHelpers -import Helpers.Eth as EthHelpers -import Helpers.Time as TimeHelpers -import Helpers.Tuple exposing (extractTuple3Result, mapEachTuple3) -import Maybe.Extra -import PaymentMethods exposing (PaymentMethod) -import Prices exposing (Price) +import Helpers.Tuple as TupleHelpers +import PriceFetch import Routing -import SmoothScroll exposing (scrollToWithOptions) -import String.Extra -import Task import Time import TokenValue exposing (TokenValue) import UserNotice as UN +import Utils import Wallet -init : Wallet.State -> Maybe CTypes.UserParameters -> UpdateResult -init wallet maybeUserParameters = +init : Wallet.State -> Mode -> UpdateResult +init wallet mode = + { wallet = wallet + , mode = mode + , now = Time.millisToPosix 0 + , prices = [] + , lastAmountInputChanged = AmountIn + , inputs = initialInputs wallet mode + , errors = noErrors + , margin = 0 + , dhTokenType = + Wallet.factory wallet + |> Maybe.withDefault (Native XDai) + , dhTokenAmount = Nothing + , foreignCurrencyType = + defaultExternalCurrency mode + , foreignCurrencyAmount = Nothing + , intervals = defaultIntervals mode + , showInTypeDropdown = False + , showOutTypeDropdown = False + , showMarginModal = False + , showIntervalModal = Nothing + , userAllowance = Nothing + , depositAmount = Nothing + , txChainStatus = Nothing + } + |> update Refresh + + +initialInputs : Wallet.State -> Mode -> Inputs +initialInputs wallet mode = + Inputs + "" + (Tuple.first (defaultCurrencyInputs wallet mode)) + "" + (Tuple.second (defaultCurrencyInputs wallet mode)) + "" + "0" + Even + "" + "" + "" + + +defaultCurrencyInputs : Wallet.State -> Mode -> ( CurrencyType, CurrencyType ) +defaultCurrencyInputs wallet mode = let - dhToken = - Wallet.factory wallet - |> Maybe.withDefault (Native XDai) - - model = - { wallet = wallet - , inputs = - Maybe.map - (userParametersToInputs dhToken) - maybeUserParameters - |> Maybe.withDefault (initialInputs dhToken) - , errors = noErrors - , showFiatTypeDropdown = False - , createParameters = Nothing - , txChainStatus = Nothing - , depositAmount = Nothing - , allowance = Nothing - , showDhTypeDropdown = False - } + defaultDhToken = + DHToken <| + (Wallet.factory wallet + |> Maybe.withDefault (Native XDai) + ) + + defaultCrypto = + External "ZEC" + + defaultFiat = + External "USD" in - UpdateResult - (model |> updateInputs model.inputs) - Cmd.none - ChainCmd.none - [] - - -initialInputs : FactoryType -> Inputs -initialInputs dhToken = - { userRole = Seller - , dhToken = dhToken - , daiAmount = "" - , fiatType = "USD" - , fiatAmount = "" - , paymentMethod = "" - , autorecallInterval = Time.millisToPosix 0 - , autoabortInterval = Time.millisToPosix 0 - , autoreleaseInterval = Time.millisToPosix 0 - } + ( if mode == CryptoSwap Seller || mode == OffRamp then + defaultDhToken + + else if mode == CryptoSwap Buyer then + defaultCrypto + + else + defaultFiat + , if mode == CryptoSwap Buyer || mode == OnRamp then + defaultDhToken + + else if mode == CryptoSwap Seller then + defaultCrypto + + else + defaultFiat + ) + + +defaultExternalCurrency : Mode -> Currencies.Symbol +defaultExternalCurrency mode = + case mode of + CryptoSwap _ -> + "ZEC" + + _ -> + "USD" + + +defaultIntervals : Mode -> ( UserInterval, UserInterval, UserInterval ) +defaultIntervals mode = + case mode of + CryptoSwap Seller -> + ( UserInterval 24 Hour + , UserInterval 1 Hour + , UserInterval 24 Hour + ) + + CryptoSwap Buyer -> + ( UserInterval 24 Hour + , UserInterval 24 Hour + , UserInterval 24 Hour + ) + + OffRamp -> + ( UserInterval 3 Day + , UserInterval 3 Day + , UserInterval 3 Day + ) + + OnRamp -> + ( UserInterval 3 Day + , UserInterval 3 Day + , UserInterval 3 Day + ) update : Msg -> Model -> UpdateResult update msg prevModel = case msg of - Refresh time -> - case ( Wallet.userInfo prevModel.wallet, Wallet.factory prevModel.wallet ) of - ( Just userInfo, Just (Token tokenType) ) -> - let - cmd = + UpdateNow time -> + justModelUpdate + { prevModel | now = time } + + Refresh -> + let + maybeAllowanceCmd = + case ( Wallet.userInfo prevModel.wallet, Wallet.factory prevModel.wallet ) of + ( Just userInfo, Just (Token tokenType) ) -> Contracts.Wrappers.getAllowanceCmd tokenType userInfo.address (Config.factoryAddress (Token tokenType)) (AllowanceFetched tokenType) + + _ -> + Cmd.none + + fetchExchangeRateCmd = + PriceFetch.fetch PricesFetched + in + UpdateResult + prevModel + (Cmd.batch + [ maybeAllowanceCmd + , fetchExchangeRateCmd + ] + ) + ChainCmd.none + [] + + PricesFetched fetchResult -> + case fetchResult of + Ok pricesAndTimestamps -> + let + newPrices = + pricesAndTimestamps + |> List.map (Tuple.mapSecond (PriceFetch.checkAgainstTime prevModel.now)) + + ( newModel, appCmds ) = + { prevModel | prices = newPrices } + |> (case prevModel.lastAmountInputChanged of + AmountIn -> + tryAutofillAmountOut + + AmountOut -> + tryAutofillAmountIn + ) in + UpdateResult + newModel + Cmd.none + ChainCmd.none + appCmds + + Err httpErr -> UpdateResult prevModel - cmd + Cmd.none ChainCmd.none - [] + [ CmdUp.UserNotice UN.cantFetchPrices ] + + ChangeMode newMode -> + let + newModel = + { prevModel + | mode = newMode + } + in + UpdateResult + (if prevModel.mode /= newMode then + { newModel + | inputs = initialInputs prevModel.wallet newMode + , intervals = defaultIntervals newMode + } + |> updateCurrencyTypesFromInput + + else + newModel + ) + Cmd.none + ChainCmd.none + [ CmdUp.gTag "change mode" "navigation" (modeToString newMode) 0 ] + + SwapClicked -> + let + prevInputs = + prevModel.inputs + + newInputs = + { prevInputs + | amountIn = prevInputs.amountOut + , amountOut = prevInputs.amountIn + , inType = prevInputs.outType + , outType = prevInputs.inType + } + in + case prevModel.mode of + CryptoSwap prevInitiatorRole -> + let + ( newModel, appCmds ) = + { prevModel + | mode = + case prevInitiatorRole of + Buyer -> + CryptoSwap Seller + + Seller -> + CryptoSwap Buyer + , inputs = newInputs + , lastAmountInputChanged = + case prevModel.lastAmountInputChanged of + AmountIn -> + AmountOut + + AmountOut -> + AmountIn + } + |> (case prevModel.lastAmountInputChanged of + AmountIn -> + tryAutofillAmountOut + + AmountOut -> + tryAutofillAmountIn + ) + in + UpdateResult + newModel + Cmd.none + ChainCmd.none + (appCmds + ++ [ CmdUp.gTag "swap clicked" "navigation" (buyerOrSellerToString (initiatorRole newModel.mode)) 0 ] + ) _ -> - justModelUpdate prevModel + let + _ = + Debug.log "swap button clicked, but it should be hidden right now!" "" + in + justModelUpdate + prevModel - ChangeRole initiatorRole -> + AmountInChanged input -> let - oldInputs = + prevInputs = prevModel.inputs + + filteredInput = + input |> Utils.filterPositiveNumericInput + + ( newMaybeAmountIn, newErrors ) = + let + prevErrors = + prevModel.errors + in + case interpretAmount filteredInput of + Ok maybeAmount -> + ( maybeAmount + , { prevErrors | amountIn = Nothing } + ) + + Err errStr -> + ( Nothing + , { prevErrors | amountIn = Just errStr } + ) + + ( newModel, appCmds ) = + { prevModel + | inputs = { prevInputs | amountIn = filteredInput } + , errors = newErrors + , lastAmountInputChanged = AmountIn + } + |> updateAmountIn newMaybeAmountIn + |> tryAutofillAmountOut in UpdateResult - { prevModel | inputs = { oldInputs | userRole = initiatorRole } } + newModel Cmd.none ChainCmd.none - [ case initiatorRole of - Buyer -> - CmdUp.gTag "create offer type changed" "input" "sell dai" 0 - - Seller -> - CmdUp.gTag "create offer type changed" "input" "buy dai" 0 - ] + appCmds - DhDropdownClicked -> - justModelUpdate + InTypeClicked -> + UpdateResult { prevModel - | showDhTypeDropdown = - if prevModel.showDhTypeDropdown then + | showInTypeDropdown = + if prevModel.showInTypeDropdown then False else True } + Cmd.none + ChainCmd.none + [ CmdUp.gTag "in currency dropdown clicked" "input" "" 0 ] - DhTypeChanged newDhToken -> + InTypeSelected newType -> let oldInputs = prevModel.inputs in - justModelUpdate - { prevModel - | showDhTypeDropdown = False - , inputs = { oldInputs | dhToken = newDhToken } - } + { prevModel + | inputs = + { oldInputs + | inType = newType + , currencySearch = "" + } + , showInTypeDropdown = False + } + |> updateInType newType + |> tryAutofillAmountOut + |> (\( model, cmdUps ) -> + UpdateResult + model + Cmd.none + ChainCmd.none + cmdUps + ) + |> (\updateResult -> + { updateResult + | cmdUps = + List.append + updateResult.cmdUps + [ CmdUp.gTag "in currency selected" "input" (currencySymbol newType) 0 ] + } + ) - TradeAmountChanged newAmountStr -> + AmountOutChanged input -> let - oldInputs = + prevInputs = prevModel.inputs + + filteredInput = + input |> Utils.filterPositiveNumericInput + + ( newMaybeAmountOut, newErrors ) = + let + prevErrors = + prevModel.errors + in + case interpretAmount filteredInput of + Ok maybeAmount -> + ( maybeAmount + , { prevErrors | amountOut = Nothing } + ) + + Err errStr -> + ( Nothing + , { prevErrors | amountOut = Just errStr } + ) + + ( newModel, appCmds ) = + { prevModel + | inputs = { prevInputs | amountOut = filteredInput } + , errors = newErrors + , lastAmountInputChanged = AmountOut + } + |> updateAmountOut newMaybeAmountOut + |> tryAutofillAmountIn in - justModelUpdate - (prevModel - |> updateInputs - { oldInputs - | daiAmount = newAmountStr - } - ) + UpdateResult + newModel + Cmd.none + ChainCmd.none + appCmds + + OutTypeClicked -> + UpdateResult + { prevModel + | showOutTypeDropdown = + if prevModel.showOutTypeDropdown then + False - FiatAmountChanged newAmountStr -> + else + True + } + Cmd.none + ChainCmd.none + [ CmdUp.gTag "out currency dropdown clicked" "input" "" 0 ] + + OutTypeSelected newType -> let oldInputs = prevModel.inputs in - justModelUpdate - (prevModel - |> updateInputs - { oldInputs - | fiatAmount = newAmountStr + { prevModel + | inputs = + { oldInputs + | outType = newType + , currencySearch = "" + } + , showOutTypeDropdown = False + } + |> updateOutType newType + |> tryAutofillAmountOut + |> (\( model, cmdUps ) -> + UpdateResult + model + Cmd.none + ChainCmd.none + cmdUps + ) + |> (\updateResult -> + { updateResult + | cmdUps = + List.append + updateResult.cmdUps + [ CmdUp.gTag "out currency selected" "input" (currencySymbol newType) 0 ] } - ) + ) - FiatTypeChanged newTypeStr -> + SearchInputChanged input -> let oldInputs = prevModel.inputs in justModelUpdate - (prevModel - |> updateInputs + { prevModel + | inputs = { oldInputs - | fiatType = newTypeStr + | currencySearch = input } - ) + } - FiatTypeLostFocus -> - justModelUpdate + MarginBoxClicked -> + UpdateResult { prevModel - | showFiatTypeDropdown = False + | showMarginModal = + if prevModel.showMarginModal then + False + + else + True } + Cmd.none + ChainCmd.none + [ CmdUp.gTag "margin box clicked" "input" "" 0 ] - ChangePaymentMethodText newText -> + MarginInputChanged input -> let - oldInputs = + prevInputs = prevModel.inputs + + filteredInput = + input |> Utils.filterPositiveNumericInput + + ( newMargin, newMarginType, newErrors ) = + let + prevErrors = + prevModel.errors + in + case interpretMargin filteredInput prevInputs.marginType of + Ok maybeMargin -> + ( maybeMargin + , if maybeMargin == Just 0 then + Even + + else + prevInputs.marginType + , { prevErrors | margin = Nothing } + ) + + Err errStr -> + ( Nothing + , prevInputs.marginType + , { prevErrors | margin = Just errStr } + ) + + ( newModel, appCmds ) = + { prevModel + | inputs = + { prevInputs + | margin = filteredInput + , marginType = newMarginType + } + , margin = + newMargin + |> Maybe.withDefault prevModel.margin + , errors = newErrors + } + |> (case prevModel.lastAmountInputChanged of + AmountIn -> + tryAutofillAmountOut + + AmountOut -> + tryAutofillAmountIn + ) in - justModelUpdate - (prevModel - |> updateInputs - { oldInputs - | paymentMethod = newText - } - ) + UpdateResult + newModel + Cmd.none + ChainCmd.none + appCmds - AutorecallIntervalChanged newTime -> + MarginButtonClicked typeClicked -> let - oldInputs = + prevInputs = prevModel.inputs + + newMargin = + case typeClicked of + Loss -> + if prevModel.margin == 0 then + -0.01 + + else + negate (abs prevModel.margin) + + Even -> + 0 + + Profit -> + if prevModel.margin == 0 then + 0.01 + + else + abs prevModel.margin + + ( newModel, appCmds ) = + { prevModel + | inputs = + { prevInputs + | margin = marginToInputString newMargin + , marginType = typeClicked + } + , margin = newMargin + } + |> (case prevModel.lastAmountInputChanged of + AmountIn -> + tryAutofillAmountOut + + AmountOut -> + tryAutofillAmountIn + ) in - justModelUpdate (prevModel |> updateInputs { oldInputs | autorecallInterval = newTime }) + UpdateResult + newModel + Cmd.none + ChainCmd.none + (appCmds + ++ [ CmdUp.gTag "margin button clicked" "input" (marginButtonTypeToString typeClicked) 0 ] + ) - AutoabortIntervalChanged newTime -> + ReceiveAddressChanged input -> let oldInputs = prevModel.inputs in - justModelUpdate (prevModel |> updateInputs { oldInputs | autoabortInterval = newTime }) + justModelUpdate + { prevModel + | inputs = + { oldInputs + | receiveAddress = input + } + } - AutoreleaseIntervalChanged newTime -> + PaymentMethodChanged input -> let oldInputs = prevModel.inputs in - justModelUpdate (prevModel |> updateInputs { oldInputs | autoreleaseInterval = newTime }) + justModelUpdate + { prevModel + | inputs = + { oldInputs + | paymentMethod = input + } + } - ShowCurrencyDropdown flag -> + WindowBoxClicked intervalType -> let - oldInputs = + prevInputs = prevModel.inputs in UpdateResult - ({ prevModel - | showFiatTypeDropdown = flag - } - |> (if flag then - updateInputs { oldInputs | fiatType = "" } - - else - identity - ) - ) + { prevModel + | showIntervalModal = Just intervalType + , inputs = + { prevInputs + | interval = + getUserInterval intervalType prevModel + |> .num + |> String.fromInt + } + } Cmd.none ChainCmd.none - (if flag then - [ CmdUp.gTag "currency-selector-clicked" "input" "" 0 ] + [ CmdUp.gTag "window box clicked" "input" (intervalTypeToString intervalType) 0 ] - else - [] - ) + IntervalInputChanged input -> + case prevModel.showIntervalModal of + Just intervalType -> + let + prevInputs = + prevModel.inputs + + filteredInput = + input |> Utils.filterPositiveNumericInput + + ( newInterval, newErrors ) = + let + prevErrors = + prevModel.errors + in + case interpretInterval filteredInput of + Ok maybeInt -> + ( maybeInt + |> Maybe.map + (\num -> + UserInterval + num + (getUserInterval intervalType prevModel |> .unit) + ) + |> Maybe.withDefault (getUserInterval intervalType prevModel) + , { prevErrors | interval = Nothing } + ) + + Err errStr -> + ( getUserInterval intervalType prevModel + , { prevErrors | interval = Just errStr } + ) + + newModel = + { prevModel + | inputs = { prevInputs | interval = filteredInput } + , errors = newErrors + } + |> updateUserInterval intervalType newInterval + in + UpdateResult + newModel + Cmd.none + ChainCmd.none + [] - CreateClicked factoryType userInfo -> - case validateInputs prevModel.inputs of - Ok userParameters -> + Nothing -> let - createParameters = - CTypes.buildCreateParameters userInfo userParameters + _ = + Debug.log "Interal input changed, but there is no interval modal open! Wut" "" in - justModelUpdate - { prevModel - | txChainStatus = Just <| Confirm factoryType createParameters - , depositAmount = - Just <| - (CTypes.calculateFullInitialDeposit createParameters - |> TokenValue.getEvmValue - ) - } + justModelUpdate prevModel - Err inputErrors -> + IntervalUnitChanged newUnit -> + case prevModel.showIntervalModal of + Just intervalType -> UpdateResult - { prevModel | errors = inputErrors } - (Task.attempt (always NoOp) - (let - defaultConfig = - SmoothScroll.defaultConfig - in - scrollToWithOptions - { defaultConfig - | offset = 60 - } - "inputError" - ) + (prevModel + |> updateUserInterval + intervalType + (UserInterval + (getUserInterval intervalType prevModel |> .num) + newUnit + ) ) + Cmd.none ChainCmd.none - [] + [ CmdUp.gTag "interval unit changed" "input" (intervalUnitToString newUnit) 0 ] + + Nothing -> + let + _ = + Debug.log "Interal unit changed, but there is no interval modal open! Wut" "" + in + justModelUpdate prevModel + + CloseModals -> + let + oldInputs = + prevModel.inputs + in + justModelUpdate + { prevModel + | showInTypeDropdown = False + , showOutTypeDropdown = False + , showMarginModal = False + , showIntervalModal = Nothing + , inputs = + { oldInputs | currencySearch = "" } + } + + PlaceOrderClicked factoryType userInfo userParameters -> + let + createParameters = + CTypes.buildCreateParameters userInfo userParameters + in + UpdateResult + { prevModel + | txChainStatus = Just <| Confirm factoryType createParameters + , depositAmount = + case initiatorRole prevModel.mode of + Buyer -> + Just <| CTypes.calculateFullInitialDeposit createParameters + + Seller -> + Maybe.map + TokenValue.fromFloatWithWarning + (getAmountIn prevModel) + } + Cmd.none + ChainCmd.none + [ CmdUp.gTag "place order clicked" "txchain" prevModel.inputs.paymentMethod (createParameters.tradeAmount |> TokenValue.getFloatValueWithWarning |> floor) ] AbortCreate -> UpdateResult { prevModel | txChainStatus = Nothing } Cmd.none ChainCmd.none - [ CmdUp.gTag "abort" "abort" "create" 0 ] + [ CmdUp.gTag "abort" "txchain" "" 0 ] ConfirmCreate factoryType createParameters fullDepositAmount -> let @@ -298,7 +765,7 @@ update msg prevModel = TokenContract.approve (Config.tokenContractAddress tokenType) (Config.factoryAddress factoryType) - fullDepositAmount + (TokenValue.getEvmValue fullDepositAmount) |> Eth.toSend customSend = @@ -309,9 +776,9 @@ update msg prevModel = in ChainCmd.custom customSend txParams in - case prevModel.allowance of + case prevModel.userAllowance of Just allowance -> - if BigInt.compare allowance fullDepositAmount /= LT then + if BigInt.compare allowance (TokenValue.getEvmValue fullDepositAmount) /= LT then initiateCreateCall factoryType createParameters else @@ -324,12 +791,16 @@ update msg prevModel = { prevModel | txChainStatus = txChainStatus } Cmd.none chainCmd - [] + [ CmdUp.gTag "confirm" "txchain" "" 0 ] ApproveSigned tokenType createParameters result -> case result of Ok txHash -> - justModelUpdate { prevModel | txChainStatus = Just <| ApproveMining tokenType createParameters txHash } + UpdateResult + { prevModel | txChainStatus = Just <| ApproveMining tokenType createParameters txHash } + Cmd.none + ChainCmd.none + [ CmdUp.gTag "approve signed" "txchain" "" 0 ] Err s -> UpdateResult @@ -344,12 +815,12 @@ update msg prevModel = let newModel = { prevModel - | allowance = Just allowance + | userAllowance = Just allowance } in case ( newModel.txChainStatus, newModel.depositAmount ) of ( Just (ApproveMining _ createParameters _), Just depositAmount ) -> - if BigInt.compare allowance depositAmount /= LT then + if BigInt.compare allowance (TokenValue.getEvmValue depositAmount) /= LT then let ( txChainStatus, chainCmd ) = initiateCreateCall (Token tokenType) createParameters @@ -376,7 +847,11 @@ update msg prevModel = CreateSigned factoryType result -> case result of Ok txHash -> - justModelUpdate { prevModel | txChainStatus = Just <| CreateMining factoryType txHash } + UpdateResult + { prevModel | txChainStatus = Just <| CreateMining factoryType txHash } + Cmd.none + ChainCmd.none + [ CmdUp.gTag "create signed" "txchain" "" 0 ] Err s -> UpdateResult @@ -405,7 +880,9 @@ update msg prevModel = prevModel Cmd.none ChainCmd.none - [ CmdUp.GotoRoute (Routing.Trade factory id) ] + [ CmdUp.gTag "create mined" "txchain" "" 0 + , CmdUp.GotoRoute (Routing.Trade factory id) + ] Nothing -> UpdateResult @@ -416,13 +893,6 @@ update msg prevModel = UN.unexpectedError "Error getting the ID of the created offer. Check the \"My Trades\" page for your open offer." txReceipt ] - Web3Connect -> - UpdateResult - prevModel - Cmd.none - ChainCmd.none - [ CmdUp.Web3Connect ] - NoOp -> justModelUpdate prevModel @@ -434,12 +904,12 @@ update msg prevModel = [ cmdUp ] -runCmdDown : CmdDown.CmdDown -> Model -> UpdateResult +runCmdDown : CmdDown -> Model -> UpdateResult runCmdDown cmdDown prevModel = case cmdDown of CmdDown.UpdateWallet wallet -> UpdateResult - ({ prevModel | wallet = wallet } |> updateInputs prevModel.inputs) + { prevModel | wallet = wallet } (case ( Wallet.userInfo wallet, Wallet.factory wallet ) of ( Just uInfo, Just (Token tokenType) ) -> Contracts.Wrappers.getAllowanceCmd @@ -455,192 +925,249 @@ runCmdDown cmdDown prevModel = [] CmdDown.CloseAnyDropdownsOrModals -> - justModelUpdate - { prevModel | showFiatTypeDropdown = False } + prevModel + |> update CloseModals -initiateCreateCall : FactoryType -> CTypes.CreateParameters -> ( Maybe TxChainStatus, ChainCmd Msg ) -initiateCreateCall factoryType parameters = - let - txParams = - Contracts.Wrappers.openTrade - factoryType - parameters - |> Eth.toSend +interpretAmount : String -> Result String (Maybe Float) +interpretAmount input = + if input == "" then + Ok Nothing - customSend = - { onMined = Just ( CreateMined factoryType, Nothing ) - , onSign = Just (CreateSigned factoryType) - , onBroadcast = Nothing - } - in - ( Just (CreateNeedsSig factoryType) - , ChainCmd.custom customSend txParams - ) + else + case String.toFloat input of + Just value -> + if value > 0 then + Ok (Just value) + + else + Err "Number must be greater than 0" + Nothing -> + Err "Invalid amount" -updateInputs : Inputs -> Model -> Model -updateInputs newInputs model = - { model | inputs = newInputs } - |> updateParameters +interpretMargin : String -> MarginButtonType -> Result String (Maybe Float) +interpretMargin input marginType = + if input == "" then + Ok Nothing -updateParameters : Model -> Model -updateParameters model = - let - validateResult = - validateInputs model.inputs - - -- Don't log errors right away (wait until the user tries to submit) - -- But if there are already errors displaying, update them accordingly - newErrors = - if model.errors == noErrors then - noErrors - - else - case validateResult of - Ok _ -> - noErrors - - Err errors -> - errors - in - { model - | createParameters = - Maybe.map2 - CTypes.buildCreateParameters - (Wallet.userInfo model.wallet) - (Result.toMaybe validateResult) - , errors = newErrors - } + else + String.toFloat input + |> Result.fromMaybe "Invalid margin" + |> Result.map (\percent -> percent / 100.0) + |> Result.map + (if marginType == Loss then + negate + else + identity + ) + |> Result.map Just -validateInputs : Inputs -> Result Errors CTypes.UserParameters -validateInputs inputs = - Result.map5 - (\daiAmount fiatAmount fiatType paymentMethod ( autorecallInterval, autoabortInterval, autoreleaseInterval ) -> - { initiatorRole = inputs.userRole - , tradeAmount = daiAmount - , price = - Price - fiatType - fiatAmount - , autorecallInterval = autorecallInterval - , autoabortInterval = autoabortInterval - , autoreleaseInterval = autoreleaseInterval - , paymentMethods = - [ PaymentMethod - PaymentMethods.Custom - paymentMethod - ] - } - ) - (interpretDaiAmount inputs.daiAmount - |> Result.mapError (\e -> { noErrors | daiAmount = Just e }) - ) - (interpretFiatAmount inputs.fiatAmount - |> Result.mapError (\e -> { noErrors | fiatAmount = Just e }) - ) - (interpretFiatType inputs.fiatType - |> Result.mapError (\e -> { noErrors | fiatType = Just e }) - ) - (interpretPaymentMethods inputs.paymentMethod - |> Result.mapError (\e -> { noErrors | paymentMethod = Just e }) - ) - (mapEachTuple3 - (\time -> - if Time.posixToMillis time > 0 then - Ok time + +interpretInterval : String -> Result String (Maybe Int) +interpretInterval input = + if input == "" then + Ok Nothing + + else + case String.toInt input of + Just value -> + if value > 0 then + Ok (Just value) else - Err { noErrors | autorecallInterval = Just "Must specify a non-zero time for this window" } + Err "Number must be greater than 0" + + Nothing -> + Err "Must be an integer" + + +tryAutofillAmountOut : Model -> ( Model, List (CmdUp Msg) ) +tryAutofillAmountOut prevModel = + case externalCurrencyPrice prevModel of + Just (PriceFetch.Ok price) -> + let + newAmountOut = + Maybe.map + (\amountIn -> + case initiatorRole prevModel.mode of + Buyer -> + (amountIn * price) * (1 + prevModel.margin) + + Seller -> + let + tradeAmountAfterDevFee = + amountIn / 1.01 + + equivalentForeignCrypto = + tradeAmountAfterDevFee / price + in + equivalentForeignCrypto * (1 + prevModel.margin) + ) + (getAmountIn prevModel) + + oldInputs = + prevModel.inputs + + oldErrors = + prevModel.errors + in + ( case newAmountOut of + Just amountOut -> + { prevModel + | inputs = { oldInputs | amountOut = String.fromFloat amountOut } + , errors = { oldErrors | amountOut = Nothing } + } + |> updateAmountOut (Just amountOut) + + Nothing -> + prevModel + , [] ) - (\time -> - if Time.posixToMillis time > 0 then - Ok time - else - Err { noErrors | autoabortInterval = Just "Must specify a non-zero time for this window" } + Just PriceFetch.Outdated -> + ( prevModel + , [ CmdUp.UserNotice UN.oldPriceDataWarning ] ) - (\time -> - if Time.posixToMillis time > 0 then - Ok time - else - Err { noErrors | autoreleaseInterval = Just "Must specify a non-zero time for this window" } + Nothing -> + ( prevModel + , [] ) - ( inputs.autorecallInterval, inputs.autoabortInterval, inputs.autoreleaseInterval ) - |> extractTuple3Result - ) - - -userParametersToInputs : FactoryType -> CTypes.UserParameters -> Inputs -userParametersToInputs dhToken parameters = - { userRole = parameters.initiatorRole - , dhToken = dhToken - , daiAmount = - TokenValue.toFloatString Nothing parameters.tradeAmount - , fiatType = parameters.price.symbol - , fiatAmount = - String.fromFloat parameters.price.amount - , paymentMethod = - parameters.paymentMethods - |> List.head - |> Maybe.map .info - |> Maybe.withDefault "" - , autorecallInterval = parameters.autorecallInterval - , autoabortInterval = parameters.autoabortInterval - , autoreleaseInterval = parameters.autoreleaseInterval - } -interpretDaiAmount : String -> Result String TokenValue -interpretDaiAmount input = - if input == "" then - Err "You must specify a trade amount." +tryAutofillAmountIn : Model -> ( Model, List (CmdUp Msg) ) +tryAutofillAmountIn prevModel = + case externalCurrencyPrice prevModel of + Just (PriceFetch.Ok price) -> + let + newAmountIn = + Maybe.map + (\amountOut -> + case initiatorRole prevModel.mode of + Buyer -> + (amountOut / (1 + prevModel.margin)) / price + + Seller -> + let + amountOutMinusMargin = + amountOut / (1 + prevModel.margin) - else - case TokenValue.fromString input of - Nothing -> - Err "I don't understand this number." + equivalentDai = + amountOutMinusMargin * price + in + equivalentDai * 1.01 + ) + (getAmountOut prevModel) - Just value -> - if TokenValue.getFloatValueWithWarning value < 1 then - Err <| "Trade amount can't be less than 1." + oldInputs = + prevModel.inputs - else - Ok value + oldErrors = + prevModel.errors + in + ( case newAmountIn of + Just amountIn -> + { prevModel + | inputs = + { oldInputs | amountIn = String.fromFloat amountIn } + , errors = { oldErrors | amountIn = Nothing } + } + |> updateAmountIn (Just amountIn) + Nothing -> + prevModel + , [] + ) -interpretFiatType : String -> Result String String -interpretFiatType input = - String.Extra.nonEmpty input - |> Result.fromMaybe "You must specify a fiat type." + Just PriceFetch.Outdated -> + ( prevModel + , [ CmdUp.UserNotice UN.oldPriceDataWarning ] + ) + Nothing -> + ( prevModel + , [] + ) -interpretFiatAmount : String -> Result String Float -interpretFiatAmount input = - if input == "" then - Err "You must specify a fiat price." - else - case String.toFloat input of - Nothing -> - Err "I don't understand this number." +tryAutofillDhTokenAmount : Model -> ( Model, List (CmdUp Msg) ) +tryAutofillDhTokenAmount prevModel = + case initiatorRole prevModel.mode of + Buyer -> + tryAutofillAmountOut prevModel - Just value -> - Ok value + Seller -> + tryAutofillAmountIn prevModel -interpretPaymentMethods : String -> Result String String -interpretPaymentMethods paymentMethod = - if paymentMethod == "" then - Err "Must specify a payment method." +tryAutofillForeignCurrencyAmount : Model -> ( Model, List (CmdUp Msg) ) +tryAutofillForeignCurrencyAmount prevModel = + case initiatorRole prevModel.mode of + Buyer -> + tryAutofillAmountIn prevModel - else - Ok paymentMethod + Seller -> + tryAutofillAmountOut prevModel + + +marginToInputString : Float -> String +marginToInputString float = + float + * 100 + |> abs + |> String.fromFloat + + +initiateCreateCall : FactoryType -> CTypes.CreateParameters -> ( Maybe TxChainStatus, ChainCmd Msg ) +initiateCreateCall factoryType parameters = + let + txParams = + Contracts.Wrappers.openTrade + factoryType + parameters + |> Eth.toSend + + customSend = + { onMined = Just ( CreateMined factoryType, Nothing ) + , onSign = Just (CreateSigned factoryType) + , onBroadcast = Nothing + } + in + ( Just (CreateNeedsSig factoryType) + , ChainCmd.custom customSend txParams + ) + + +updateCurrencyTypesFromInput : Model -> Model +updateCurrencyTypesFromInput prevModel = + let + ( newForeignCurrency, newDhTokenType ) = + case ( initiatorRole prevModel.mode, ( prevModel.inputs.inType, prevModel.inputs.outType ) ) of + ( Buyer, ( External externalSymbol, DHToken dhTokenType ) ) -> + ( externalSymbol, dhTokenType ) + + ( Seller, ( DHToken dhTokenType, External externalSymbol ) ) -> + ( externalSymbol, dhTokenType ) + + _ -> + let + _ = + Debug.log "unexpected currency types in input when trying to update model currency types" "" + in + ( prevModel.foreignCurrencyType, prevModel.dhTokenType ) + in + { prevModel + | foreignCurrencyType = newForeignCurrency + , dhTokenType = newDhTokenType + } subscriptions : Model -> Sub Msg subscriptions model = - Time.every 2000 Refresh + Sub.batch + [ Time.every 2000 (always Refresh) + , Time.every 500 UpdateNow + ] diff --git a/src/Create/Types.elm b/src/Create/Types.elm index 2db0abc..edf61c3 100644 --- a/src/Create/Types.elm +++ b/src/Create/Types.elm @@ -1,16 +1,16 @@ -module Create.Types exposing (Errors, Inputs, Model, Msg(..), TxChainStatus(..), UpdateResult, justModelUpdate, noErrors) +module Create.Types exposing (AmountInputType(..), CurrencyType(..), Errors, Inputs, IntervalUnit(..), MarginButtonType(..), Mode(..), Model, Msg(..), TradeType(..), TxChainStatus(..), UpdateResult, UserInterval, currencySymbol, externalCurrencyPrice, getAmountIn, getAmountOut, getTradeAmount, getTradePrice, getUserInterval, initiatorRole, intervalUnitToString, justModelUpdate, marginButtonTypeToString, maybeBuildPaymentMethods, maybeUserParameters, modeToString, noErrors, tradeType, updateAmountIn, updateAmountOut, updateForeignCurrencyType, updateInType, updateOutType, updateUserInterval, userIntervalToPosix, userIntervalToString) import BigInt exposing (BigInt) import ChainCmd exposing (ChainCmd) import CmdUp exposing (CmdUp) import CommonTypes exposing (..) import Contracts.Types as CTypes -import Create.PMWizard.Types as PMWizard +import Currencies import Eth.Types exposing (Address, TxHash, TxReceipt) -import Helpers.Eth as EthHelpers +import Helpers.Tuple as TupleHelpers import Http import PaymentMethods exposing (PaymentMethod) -import Routing +import PriceFetch import Time import TokenValue exposing (TokenValue) import Wallet @@ -18,79 +18,136 @@ import Wallet type alias Model = { wallet : Wallet.State + , mode : Mode + , now : Time.Posix + , prices : List ( Currencies.Symbol, PriceFetch.PriceData ) + , lastAmountInputChanged : AmountInputType , inputs : Inputs , errors : Errors - , showDhTypeDropdown : Bool - , showFiatTypeDropdown : Bool - , createParameters : Maybe CTypes.CreateParameters - , depositAmount : Maybe BigInt - , allowance : Maybe BigInt + , dhTokenType : FactoryType + , dhTokenAmount : Maybe Float + , foreignCurrencyType : Currencies.Symbol + , foreignCurrencyAmount : Maybe Float + , margin : Float + , intervals : ( UserInterval, UserInterval, UserInterval ) + , showInTypeDropdown : Bool + , showOutTypeDropdown : Bool + , showMarginModal : Bool + , showIntervalModal : Maybe IntervalType + , userAllowance : Maybe BigInt + , depositAmount : Maybe TokenValue , txChainStatus : Maybe TxChainStatus } +type TxChainStatus + = Confirm FactoryType CTypes.CreateParameters + | ApproveNeedsSig TokenFactoryType + | ApproveMining TokenFactoryType CTypes.CreateParameters TxHash + | CreateNeedsSig FactoryType + | CreateMining FactoryType TxHash + + type Msg - = Refresh Time.Posix - | ChangeRole BuyerOrSeller - | TradeAmountChanged String - | FiatTypeChanged String - | FiatAmountChanged String - | FiatTypeLostFocus - | DhDropdownClicked - | DhTypeChanged FactoryType - | ShowCurrencyDropdown Bool - | AutorecallIntervalChanged Time.Posix - | AutoabortIntervalChanged Time.Posix - | AutoreleaseIntervalChanged Time.Posix - | ChangePaymentMethodText String - | CreateClicked FactoryType UserInfo + = Refresh + | UpdateNow Time.Posix + | PricesFetched (Result Http.Error (List ( Currencies.Symbol, PriceFetch.PriceAndTimestamp ))) + | ChangeMode Mode + | SwapClicked + | AmountInChanged String + | InTypeClicked + | InTypeSelected CurrencyType + | AmountOutChanged String + | OutTypeClicked + | OutTypeSelected CurrencyType + | SearchInputChanged String + | MarginBoxClicked + | MarginInputChanged String + | MarginButtonClicked MarginButtonType + | ReceiveAddressChanged String + | PaymentMethodChanged String + | WindowBoxClicked IntervalType + | IntervalInputChanged String + | IntervalUnitChanged IntervalUnit + | CloseModals + | PlaceOrderClicked FactoryType UserInfo CTypes.UserParameters | AbortCreate - | ConfirmCreate FactoryType CTypes.CreateParameters BigInt + | ConfirmCreate FactoryType CTypes.CreateParameters TokenValue | AllowanceFetched TokenFactoryType (Result Http.Error BigInt) | ApproveSigned TokenFactoryType CTypes.CreateParameters (Result String TxHash) | CreateSigned FactoryType (Result String TxHash) | CreateMined FactoryType (Result String TxReceipt) - | Web3Connect | NoOp | CmdUp (CmdUp Msg) -type TxChainStatus - = Confirm FactoryType CTypes.CreateParameters - | ApproveNeedsSig TokenFactoryType - | ApproveMining TokenFactoryType CTypes.CreateParameters TxHash - | CreateNeedsSig FactoryType - | CreateMining FactoryType TxHash - - type alias Inputs = - { userRole : BuyerOrSeller - , dhToken : FactoryType - , daiAmount : String - , fiatType : String - , fiatAmount : String + { amountIn : String + , inType : CurrencyType + , amountOut : String + , outType : CurrencyType + , currencySearch : String + , margin : String + , marginType : MarginButtonType + , receiveAddress : String , paymentMethod : String - , autorecallInterval : Time.Posix - , autoabortInterval : Time.Posix - , autoreleaseInterval : Time.Posix + , interval : String } +type AmountInputType + = AmountIn + | AmountOut + + type alias Errors = - { dhToken : Maybe String - , daiAmount : Maybe String - , fiatAmount : Maybe String - , fiatType : Maybe String - , paymentMethod : Maybe String - , autorecallInterval : Maybe String - , autoabortInterval : Maybe String - , autoreleaseInterval : Maybe String + { amountIn : Maybe String + , amountOut : Maybe String + , margin : Maybe String + , interval : Maybe String } noErrors : Errors noErrors = - Errors Nothing Nothing Nothing Nothing Nothing Nothing Nothing Nothing + Errors Nothing Nothing Nothing Nothing + + +type Mode + = CryptoSwap BuyerOrSeller + | OnRamp + | OffRamp + + +modeToString : Mode -> String +modeToString mode = + case mode of + CryptoSwap Seller -> + "CryptoSwap Seller" + + CryptoSwap Buyer -> + "CryptoSwap Buyer" + + OffRamp -> + "OffRamp" + + OnRamp -> + "OnRamp" + + +type CurrencyType + = DHToken FactoryType + | External Currencies.Symbol + + +currencySymbol : CurrencyType -> String +currencySymbol currencyType = + case currencyType of + DHToken tokenType -> + tokenSymbol tokenType + + External symbol -> + symbol type alias UpdateResult = @@ -108,3 +165,351 @@ justModelUpdate model = , chainCmd = ChainCmd.none , cmdUps = [] } + + +type alias UserInterval = + { num : Int + , unit : IntervalUnit + } + + +type IntervalUnit + = Minute + | Hour + | Day + | Week + + +intervalUnitToString : IntervalUnit -> String +intervalUnitToString intervalUnit = + case intervalUnit of + Minute -> + "Minute" + + Hour -> + "Hour" + + Day -> + "Day" + + Week -> + "Week" + + +userIntervalToString : UserInterval -> String +userIntervalToString interval = + String.fromInt interval.num + ++ " " + ++ intervalUnitToString interval.unit + ++ (if interval.num /= 1 then + "s" + + else + "" + ) + + +externalCurrencyPrice : Model -> Maybe PriceFetch.PriceData +externalCurrencyPrice model = + PriceFetch.getPriceData model.foreignCurrencyType model.prices + + +initiatorRole : Mode -> BuyerOrSeller +initiatorRole mode = + case mode of + CryptoSwap i -> + i + + OffRamp -> + Seller + + OnRamp -> + Buyer + + +getAmountIn : Model -> Maybe Float +getAmountIn model = + case initiatorRole model.mode of + Buyer -> + model.foreignCurrencyAmount + + Seller -> + model.dhTokenAmount + + +getAmountOut : Model -> Maybe Float +getAmountOut model = + case initiatorRole model.mode of + Buyer -> + model.dhTokenAmount + + Seller -> + model.foreignCurrencyAmount + + +updateAmountOut : Maybe Float -> Model -> Model +updateAmountOut newMaybeAmount model = + case initiatorRole model.mode of + Seller -> + { model | foreignCurrencyAmount = newMaybeAmount } + + Buyer -> + { model | dhTokenAmount = newMaybeAmount } + + +updateAmountIn : Maybe Float -> Model -> Model +updateAmountIn newMaybeAmount model = + case initiatorRole model.mode of + Seller -> + { model | dhTokenAmount = newMaybeAmount } + + Buyer -> + { model | foreignCurrencyAmount = newMaybeAmount } + + +updateInType : CurrencyType -> Model -> Model +updateInType newType prevModel = + case initiatorRole prevModel.mode of + Seller -> + case newType of + DHToken tokenType -> + { prevModel | dhTokenType = tokenType } + + _ -> + let + _ = + Debug.log "Trying to update inType with the wrong currency type" ( initiatorRole prevModel.mode, newType ) + in + prevModel + + Buyer -> + case newType of + External symbol -> + { prevModel | foreignCurrencyType = symbol } + + _ -> + let + _ = + Debug.log "Trying to update inType with the wrong currency type" ( initiatorRole prevModel.mode, newType ) + in + prevModel + + +updateOutType : CurrencyType -> Model -> Model +updateOutType newType prevModel = + case initiatorRole prevModel.mode of + Seller -> + case newType of + External symbol -> + { prevModel | foreignCurrencyType = symbol } + + _ -> + let + _ = + Debug.log "Trying to update outType with the wrong currency type" ( initiatorRole prevModel.mode, newType ) + in + prevModel + + Buyer -> + case newType of + DHToken tokenType -> + { prevModel | dhTokenType = tokenType } + + _ -> + let + _ = + Debug.log "Trying to update outType with the wrong currency type" ( initiatorRole prevModel.mode, newType ) + in + prevModel + + +updateUserInterval : IntervalType -> UserInterval -> Model -> Model +updateUserInterval intervalType interval prevModel = + let + mapper = + case intervalType of + Expiry -> + TupleHelpers.tuple3MapFirst + + Payment -> + TupleHelpers.tuple3MapSecond + + Judgment -> + TupleHelpers.tuple3MapThird + in + { prevModel + | intervals = + prevModel.intervals + |> mapper (always interval) + } + + +type TradeType + = Fiat + | Crypto + + +tradeType : Mode -> TradeType +tradeType mode = + case mode of + CryptoSwap _ -> + Crypto + + _ -> + Fiat + + +updateForeignCurrencyType : Currencies.Symbol -> Model -> Model +updateForeignCurrencyType symbol prevModel = + let + prevInputs = + prevModel.inputs + in + { prevModel + | foreignCurrencyType = symbol + , inputs = + case initiatorRole prevModel.mode of + Buyer -> + { prevInputs | inType = External symbol } + + Seller -> + { prevInputs | outType = External symbol } + } + + +type MarginButtonType + = Loss + | Even + | Profit + + +marginButtonTypeToString : MarginButtonType -> String +marginButtonTypeToString t = + case t of + Loss -> + "Loss" + + Even -> + "Even" + + Profit -> + "Profit" + + +getUserInterval : IntervalType -> Model -> UserInterval +getUserInterval intervalType model = + case intervalType of + Expiry -> + TupleHelpers.tuple3First model.intervals + + Payment -> + TupleHelpers.tuple3Second model.intervals + + Judgment -> + TupleHelpers.tuple3Third model.intervals + + +maybeUserParameters : Model -> Maybe CTypes.UserParameters +maybeUserParameters model = + Maybe.map3 + (\tradeAmount price paymentMethods -> + { initiatorRole = initiatorRole model.mode + , tradeAmount = tradeAmount + , price = price + , paymentMethods = paymentMethods + , autorecallInterval = userIntervalToPosix (TupleHelpers.tuple3First model.intervals) + , autoabortInterval = userIntervalToPosix (TupleHelpers.tuple3Second model.intervals) + , autoreleaseInterval = userIntervalToPosix (TupleHelpers.tuple3Third model.intervals) + } + ) + (getTradeAmount model) + (getTradePrice model) + (maybeBuildPaymentMethods model) + + +userIntervalToPosix : UserInterval -> Time.Posix +userIntervalToPosix interval = + interval.num + * (case interval.unit of + Minute -> + 60 + + Hour -> + 60 * 60 + + Day -> + 60 * 60 * 24 + + Week -> + 60 * 60 * 24 * 7 + ) + |> (*) 1000 + |> Time.millisToPosix + + +getTradeAmount : Model -> Maybe TokenValue +getTradeAmount model = + model.dhTokenAmount + |> Maybe.map + (case initiatorRole model.mode of + Seller -> + \f -> f / 1.01 + + Buyer -> + identity + ) + |> Maybe.map TokenValue.fromFloatWithWarning + + +getTradePrice : Model -> Maybe Currencies.Price +getTradePrice model = + Maybe.map + (Currencies.Price model.foreignCurrencyType) + model.foreignCurrencyAmount + + +maybeBuildPaymentMethods : Model -> Maybe (List PaymentMethod) +maybeBuildPaymentMethods model = + case model.mode of + CryptoSwap Buyer -> + Just + [ PaymentMethod + PaymentMethods.Custom + <| + "Provide your " + ++ model.foreignCurrencyType + ++ " address immediately upon commitment, via chat." + ] + + CryptoSwap Seller -> + if model.inputs.receiveAddress == "" then + Nothing + + else + Just + [ PaymentMethod + PaymentMethods.Custom + ("Pay to " ++ model.inputs.receiveAddress ++ " immediately upon commitment.") + ] + + OffRamp -> + if model.inputs.paymentMethod == "" then + Nothing + + else + Just + [ PaymentMethod + PaymentMethods.Custom + model.inputs.paymentMethod + ] + + OnRamp -> + if model.inputs.paymentMethod == "" then + Nothing + + else + Just + [ PaymentMethod + PaymentMethods.Custom + model.inputs.paymentMethod + ] diff --git a/src/Create/View.elm b/src/Create/View.elm index 0891719..e83d16b 100644 --- a/src/Create/View.elm +++ b/src/Create/View.elm @@ -1,558 +1,1161 @@ module Create.View exposing (root) -import BigInt exposing (BigInt) import CmdUp exposing (CmdUp) import CommonTypes exposing (..) -import Config import Contracts.Types as CTypes -import Create.PMWizard.View as PMWizard import Create.Types exposing (..) -import Element exposing (Attribute, Element) +import Currencies +import Element exposing (Element) import Element.Background import Element.Border import Element.Events import Element.Font import Element.Input +import FormatFloat exposing (formatFloat) import Helpers.Element as EH import Helpers.Eth as EthHelpers -import Helpers.Time as TimeHelpers -import Html.Attributes -import Images exposing (Image) -import List.Extra +import Helpers.Tuple as TupleHelpers +import Images import Maybe.Extra -import PaymentMethods exposing (PaymentMethod) -import Prices -import Time +import Routing import TokenValue exposing (TokenValue) import Wallet root : Model -> ( Element Msg, List (Element Msg) ) root model = - ( EH.submodelContainer - 1000 - (Just "Trade Dai/xDai for any asset! No bank account or KYC required.") - "CUSTOM TRADE" - (Element.column - [ Element.width Element.fill - , Element.spacing 20 - , Element.padding 20 - ] - [ mainInputElement model - , phasesElement model - , openButtonElement model.inputs.dhToken model.wallet - ] - ) + ( Element.column + [ Element.width Element.fill + , Element.paddingEach + { bottom = 40 + , top = 0 + , right = 0 + , left = 0 + } + ] + [ EH.simpleSubmodelContainer + 800 + (Element.column + [ Element.width Element.fill + , Element.spacing 20 + ] + [ header model.mode + , EH.thinGrayHRuler + , body model + ] + ) + , telegramButton + ] , viewModals model ) -mainInputElement : Model -> Element Msg -mainInputElement model = +telegramButton : Element Msg +telegramButton = + Element.link + [ Element.Border.rounded 4 + , Element.width Element.fill + , Element.pointer + , Element.paddingXY 22 15 + , Element.Background.color EH.blue + , Element.Font.color EH.white + , Element.Font.semiBold + , Element.Font.size 20 + , Element.centerX + , Element.width Element.shrink + , Element.height Element.shrink + ] + { url = "https://t.me/daihardexchange_group" + , label = + Element.paragraph + [ Element.Font.center ] + [ Element.text "Join the Telegram Group" ] + } + + +header : Mode -> Element Msg +header mode = let - factory = - Wallet.factoryWithDefault model.wallet + descriptionText = + case mode of + CryptoSwap Seller -> + "Trade Dai/xDai for another crypto. Choose the amounts and types of crypto, and fill in your crypto receive address. Advanced users may wish to change the three trade windows." + + CryptoSwap Buyer -> + "Trade another crypto for Dai/xDai. Choose the amounts and types of crypto, and advanced users may wish to change the three trade windows." + + OffRamp -> + "Turn your Dai/xDai into any local currency. Choose your amounts and fiat type, describe how you can accept the fiat payment from a Buyer, and if necessary edit the three trade windows." + + OnRamp -> + "Deposit Dai/xDai to begin a fiat purchase to get 3X more Dai/xDai than your deposit. Choose your amounts and fiat type, describe how you can make the fiat payment to a Seller, and if necessary edit the three trade windows." in Element.column [ Element.width Element.fill , Element.spacing 20 - , Element.Border.rounded 5 - , Element.paddingXY 20 0 + , Element.padding 30 ] [ Element.row - [ Element.width Element.fill - , Element.spaceEvenly + [ Element.spacing 40 + , Element.centerX ] - [ tradeTypeElement factory model - , daiElement factory model - , fiatElement model + [ modeHeader (mode == CryptoSwap Seller || mode == CryptoSwap Buyer) (CryptoSwap Seller) + , modeHeader (mode == OffRamp) OffRamp + , modeHeader (mode == OnRamp) OnRamp ] - , feeNotifyElement model + , Element.paragraph + [ Element.Font.size 16 ] + [ Element.text descriptionText ] ] -tradeTypeElement : FactoryType -> Model -> Element Msg -tradeTypeElement factory model = - EH.withInputHeader - [ Element.alignTop ] - "Trade Type" - (roleToggleElement - (tokenUnitName factory) - model.inputs.userRole - ) +modeHeader : Bool -> Mode -> Element Msg +modeHeader selected mode = + let + fontAlpha = + if selected then + 1.0 + else + 0.15 -roleToggleElement : String -> BuyerOrSeller -> Element Msg -roleToggleElement tokenName userRole = - let - baseStyles = - [ Element.Font.size 24 - , Element.Font.medium - , Element.pointer - ] + text = + case mode of + CryptoSwap _ -> + "Crypto Portal" - ( buyDaiEl, sellDaiEl ) = - ( EH.withSelectedUnderline [] (userRole == Buyer) <| - Element.el - ([ Element.Events.onClick <| ChangeRole Buyer ] ++ baseStyles) - (Element.text <| "Buy " ++ tokenName) - , EH.withSelectedUnderline [] (userRole == Seller) <| - Element.el - ([ Element.Events.onClick <| ChangeRole Seller ] ++ baseStyles) - (Element.text <| "Sell " ++ tokenName) - ) + OffRamp -> + "Get Fiat" + + OnRamp -> + "Get More Dai" in - Element.row - [ Element.spacing 20 - , Element.paddingEach - { top = 10 - , bottom = 0 - , right = 0 - , left = 0 - } - ] - [ sellDaiEl - , buyDaiEl + Element.el + [ Element.Font.size 28 + , Element.Font.semiBold + , Element.Font.color <| Element.rgba 0 0 0 fontAlpha + , Element.pointer + , Element.Events.onClick <| ChangeMode mode ] + (Element.text text) -daiElement : FactoryType -> Model -> Element Msg -daiElement factory model = - EH.withInputHeader - [ Element.alignTop ] - (case model.inputs.userRole of - Buyer -> - "You're buying" +body : Model -> Element Msg +body model = + Element.column + [ Element.width Element.fill + , Element.padding 20 + , Element.spacing 25 + ] + [ amountAndTypeIn model + , case model.mode of + CryptoSwap _ -> + Element.el [ Element.centerX ] swapButton + + _ -> + Element.none + , amountOutRow model + , moreInfoInput model + , intervalsRow model + , placeOrderButton model + ] - Seller -> - "You're selling" - ) - (EH.roundedComplexInputBox - [ Element.width <| Element.px 200 - , Element.below <| - EH.maybeErrorElement - [ inputErrorTag - , Element.moveDown 5 - ] - model.errors.daiAmount + +amountAndTypeIn : Model -> Element Msg +amountAndTypeIn model = + EH.withInputHeaderAndMaybeError + [ Element.width Element.fill ] + "I want to Sell" + model.errors.amountIn + (inputContainer + [ Element.width Element.fill ] + [ Element.Input.text + [ Element.width Element.fill + , Element.height Element.fill + , Element.Border.width 0 + ] + { onChange = AmountInChanged + , text = model.inputs.amountIn + , placeholder = + Just <| + Element.Input.placeholder + [ Element.Font.color EH.placeholderTextColor ] + (Element.text "0") + , label = Element.Input.labelHidden "amount in" + } + , Element.el + ([ Element.height Element.fill ] + ++ (if model.showInTypeDropdown then + [ Element.below + (inTypeDropdown model) + ] + + else + [] + ) + ) + (typeDropdownButton + model.showInTypeDropdown + model.inputs.inType + InTypeClicked + ) ] - [ EH.dhTokenTypeSelector model.inputs.dhToken model.showDhTypeDropdown DhDropdownClicked DhTypeChanged ] - { onChange = TradeAmountChanged - , text = model.inputs.daiAmount - , placeholder = Nothing - , label = Element.Input.labelHidden "dai input" - } - [] ) -fiatElement : Model -> Element Msg -fiatElement model = - let - fiatCharElement = - case Prices.char model.inputs.fiatType of - Just char -> - Element.el - [ Element.Events.onClick <| - CmdUp <| - CmdUp.gTag "click" "misclick" "currency symbol" 0 - ] - (Element.text <| char) +swapButton : Element Msg +swapButton = + EH.elOnCircle + [ Element.pointer + , Element.Events.onClick SwapClicked + ] + 52 + (Element.rgba 0.05 0.03 0.92 0.05) + (Images.toElement + [ Element.height <| Element.px 30 ] + Images.verticalSwapArrows + ) - Nothing -> - Element.none - in - EH.withInputHeader - [ Element.alignTop ] - "For:" - (EH.roundedComplexInputBox - [ Element.width <| Element.px 250 - , Element.padding 8 - , Element.below <| - EH.maybeErrorElement - [ inputErrorTag - , Element.moveDown 5 - ] - (Maybe.Extra.or - model.errors.fiatAmount - model.errors.fiatType - ) - ] - [ EH.currencySelector - model.showFiatTypeDropdown - model.inputs.fiatType - (ShowCurrencyDropdown True) - FiatTypeChanged - (CmdUp <| CmdUp.gTag "click" "misclick" "currency flag" 0) - , fiatCharElement - ] - { onChange = FiatAmountChanged - , text = model.inputs.fiatAmount - , placeholder = - Just <| - Element.Input.placeholder - [ Element.Font.color EH.placeholderTextColor + +amountOutRow : Model -> Element Msg +amountOutRow model = + Element.row + [ Element.width Element.fill + , Element.spacing 25 + ] + ([ Element.el [ Element.width <| Element.fillPortion 2 ] + (amountAndTypeOut model) + ] + ++ (case model.mode of + CryptoSwap _ -> + [ Element.el + [ Element.Font.size 28 + , Element.Font.color <| Element.rgba 0.05 0.1 0.3 0.25 + , Element.Font.semiBold + , Element.alignBottom + , Element.paddingEach + { bottom = 14 + , top = 0 + , right = 0 + , left = 0 + } + ] + (Element.text "@") + , Element.el + [ Element.width <| Element.fillPortion 1 + , Element.above + (if model.showMarginModal then + marginModal model.margin model.inputs.margin model.errors.margin + + else + Element.none + ) + ] + (marginBox model) ] - (Element.text "0") - , label = Element.Input.labelHidden "price input" - } - [] + + _ -> + [] + ) ) -fiatInputElement : Prices.Symbol -> String -> Bool -> Maybe String -> Maybe String -> Element Msg -fiatInputElement symbol amountString showFiatTypeDropdown maybeAmountError maybeTypeError = - let - fiatCharElement = - case Prices.char symbol of - Just char -> - Element.el - [ Element.Events.onClick <| - CmdUp <| - CmdUp.gTag "click" "misclick" "currency symbol" 0 - ] - (Element.text <| char) +moreInfoInput : Model -> Element Msg +moreInfoInput model = + case model.mode of + CryptoSwap Seller -> + case model.inputs.outType of + External cryptoSymbol -> + cryptoAddressInput cryptoSymbol model.inputs.receiveAddress - Nothing -> + _ -> + let + _ = + Debug.log "Unexpected currency type for outType!" model.inputs.outType + in Element.none - flagClickedMsg = - CmdUp <| CmdUp.gTag "click" "misclick" "currency flag" 0 + CryptoSwap Buyer -> + Element.none - currencySelector = - Element.el - [ Element.below <| - EH.maybeErrorElement - [ inputErrorTag - , Element.moveDown 5 - ] - maybeTypeError - ] - (EH.currencySelector showFiatTypeDropdown symbol (ShowCurrencyDropdown True) FiatTypeChanged flagClickedMsg) - in - EH.fancyInput - [ Element.width <| Element.px 250 - , Element.Font.medium - , Element.Font.size 24 - , Element.Background.color EH.submodelBackgroundColor - , Element.below <| - EH.maybeErrorElement - [ inputErrorTag - , Element.moveDown 5 - ] - maybeAmountError - ] - ( Just fiatCharElement, Just currencySelector ) - "price input" - Nothing - amountString - FiatAmountChanged - - -openButtonElement : FactoryType -> Wallet.State -> Element Msg -openButtonElement dhTypeInput wallet = - Element.el [ Element.centerX ] <| - case ( Wallet.userInfo wallet, Wallet.factory wallet ) of - ( Just userInfo, Just factory ) -> - if factory == dhTypeInput then - EH.redButton "Open Trade" (CreateClicked factory userInfo) - - else - EH.disabledButton "Open Trade" - (Just <| - "You must switch your wallet to the " - ++ networkNameForFactory dhTypeInput - ++ " network to create a trade with " - ++ tokenUnitName dhTypeInput - ) - - ( Nothing, _ ) -> - EH.redButton "Connect to Wallet" Web3Connect + OffRamp -> + paymentMethodInput Seller model.inputs.paymentMethod - ( _, Nothing ) -> - EH.disabledButton "Unsupported Network" Nothing + OnRamp -> + paymentMethodInput Buyer model.inputs.paymentMethod -feeNotifyElement : Model -> Element Msg -feeNotifyElement model = - let - blueText = - case TokenValue.fromString model.inputs.daiAmount of - Just daiAmount -> - "There is a 1% fee of " - ++ TokenValue.toConciseString - (TokenValue.div daiAmount 100) - ++ " " - ++ tokenUnitName (Wallet.factoryWithDefault model.wallet) - ++ "." - - Nothing -> - "There is a 1% fee." - - regularText = - "We only collect this fee when trades resolve successfully." - in - Element.row - [ Element.centerX - , Element.paddingXY 20 10 - , Element.Background.color <| Element.rgb255 10 33 108 - , Element.Border.rounded 8 - , Element.spacing 5 - , Element.Events.onClick <| - CmdUp <| - CmdUp.gTag "click" "misclick" "fee notify element" 0 - ] - [ Element.el - [ Element.Font.size 18 - , Element.Font.color <| Element.rgb255 0 226 255 - , Element.Font.semiBold - ] - (Element.text blueText) - , Element.el - [ Element.Font.size 17 - , Element.Font.color EH.white - , Element.Font.medium +amountAndTypeOut : Model -> Element Msg +amountAndTypeOut model = + EH.withInputHeaderAndMaybeError + [ Element.width Element.fill ] + "In Exchange for" + model.errors.amountOut + (inputContainer + [ Element.width Element.fill ] + [ Element.Input.text + [ Element.width Element.fill + , Element.height Element.fill + , Element.Border.width 0 + ] + { onChange = AmountOutChanged + , text = model.inputs.amountOut + , placeholder = + Just <| + Element.Input.placeholder + [ Element.Font.color EH.placeholderTextColor ] + (Element.text "0") + , label = Element.Input.labelHidden "amount out" + } + , Element.el + ([ Element.height Element.fill ] + ++ (if model.showOutTypeDropdown then + [ Element.below + (outTypeDropdown model) + ] + + else + [] + ) + ) + (typeDropdownButton + model.showOutTypeDropdown + model.inputs.outType + OutTypeClicked + ) ] - (Element.text regularText) - ] + ) -phasesElement : Model -> Element Msg -phasesElement model = - Element.column - [ Element.width Element.fill - , Element.spacing 15 - ] - [ phaseHorizontalSpacer - , openPhaseElement - model.inputs.autorecallInterval - model.errors.autorecallInterval - model.inputs.userRole - , phaseHorizontalSpacer - , committedPhaseElement - model.inputs.paymentMethod - model.errors.paymentMethod - model.inputs.autoabortInterval - model.errors.autoabortInterval - model.inputs.userRole - , phaseHorizontalSpacer - , judgmentPhaseElement - model.inputs.autoreleaseInterval - model.errors.autoreleaseInterval - model.inputs.userRole - , phaseHorizontalSpacer - ] +marginBox : Model -> Element Msg +marginBox model = + EH.withInputHeader + [ Element.width Element.fill ] + "Margin" + (inputContainer + [ Element.width Element.fill + , Element.pointer + , EH.onClickNoPropagation MarginBoxClicked + ] + [ Element.row + [ Element.height Element.fill + , Element.width Element.fill + , Element.Background.color EH.white + , Element.spacing 13 + ] + [ profitLossOrEven model.margin + , absMarginPercentage model.margin + ] + , dropdownArrow model.showMarginModal + ] + ) -phaseHorizontalSpacer : Element Msg -phaseHorizontalSpacer = - Element.el - [ Element.width Element.fill - , Element.height <| Element.px 2 - , Element.Background.color EH.black - ] - Element.none +marginModal : Float -> String -> Maybe String -> Element Msg +marginModal margin marginInput maybeError = + EH.modal + (Element.rgba 0 0 0 0.1) + NoOp + CloseModals + <| + Element.column + [ Element.alignRight + , Element.moveUp 10 + , Element.Border.rounded 8 + , Element.Background.color EH.lightGray + , Element.clip + , Element.spacing 1 + , Element.Border.shadow + { offset = ( 0, 3 ) + , size = 0 + , blur = 20 + , color = Element.rgba 0 0 0 0.08 + } + ] + [ Element.el + [ Element.paddingXY 23 18 + , Element.Background.color EH.white + ] + <| + Element.column + [ Element.width Element.fill + , Element.spacing 10 + ] + [ Element.el + [ Element.Font.size 20 + , Element.Font.semiBold + , Element.Font.color <| Element.rgb255 16 7 234 + ] + (Element.text "Margin") + , Element.paragraph + [ Element.Font.size 16 + , Element.Font.color <| Element.rgba 0 0 0 0.75 + ] + [ Element.text "This is how much you want to either make as a profit or loss from this trade. Trading at a loss can help to find a buyer fast, but it's possible to trade at a profit if your payment method is highly convenient to the other party." ] + ] + , let + inactiveBgColor = + Element.rgba255 10 33 108 0.04 + + inactiveTextColor = + Element.rgb255 10 33 108 + in + Element.row + [ Element.width Element.shrink + , Element.Background.color EH.white + , Element.paddingXY 23 18 + , Element.spacing 12 + ] + [ inputContainer + [ Element.width <| Element.px 140 + , Element.above <| + case maybeError of + Just error -> + Element.el + [ Element.Font.size 12 + , Element.Font.color EH.softRed + , Element.moveUp 16 + , Element.alignLeft + , Element.Background.color EH.white + , Element.Border.widthEach + { top = 0 + , bottom = 0 + , right = 1 + , left = 1 + } + , Element.paddingXY 5 0 + , Element.Border.color EH.lightGray + ] + (Element.text error) + + Nothing -> + Element.none + ] + [ Element.Input.text + [ Element.Border.width 0 + , Element.width Element.fill + , Element.height Element.fill + ] + { onChange = MarginInputChanged + , text = marginInput ++ "%" + , placeholder = Nothing + , label = Element.Input.labelHidden "margin" + } + ] + , if margin < 0 then + button + EH.lightRed + EH.white + "Loss" + Nothing + else + button + inactiveBgColor + inactiveTextColor + "Loss" + (Just <| MarginButtonClicked Loss) + , if margin == 0 then + button + (Element.rgb255 16 7 234) + EH.white + "Even" + Nothing -openPhaseElement : Time.Posix -> Maybe String -> BuyerOrSeller -> Element Msg -openPhaseElement interval maybeError userRole = - phaseElement - Images.openWindowIcon - "Open Window" - (openWindowSummary userRole) - interval - maybeError - AutorecallIntervalChanged + else + button + inactiveBgColor + inactiveTextColor + "Even" + (Just <| MarginButtonClicked Even) + , if margin > 0 then + button + (Element.rgb255 0 188 137) + EH.white + "Profit" + Nothing + else + button + inactiveBgColor + inactiveTextColor + "Profit" + (Just <| MarginButtonClicked Profit) + ] + ] -committedPhaseElement : String -> Maybe String -> Time.Posix -> Maybe String -> BuyerOrSeller -> Element Msg -committedPhaseElement paymentMethodText maybeTextError interval maybeIntervalError userRole = - Element.column - [ Element.spacing 15 ] - [ phaseElement - Images.fiatBag - "Payment Window" - (paymentWindowSummary userRole) - interval - maybeIntervalError - AutoabortIntervalChanged - , paymentMethodsElement maybeTextError userRole paymentMethodText - ] +button : Element.Color -> Element.Color -> String -> Maybe Msg -> Element Msg +button bgColor textColor text maybeOnClick = + Element.el + ([ Element.Background.color bgColor + , Element.Border.rounded 4 + , Element.paddingXY 22 16 + , Element.Font.color textColor + , Element.Font.size 20 + ] + ++ (case maybeOnClick of + Just onClick -> + [ Element.pointer + , Element.Events.onClick onClick + ] -judgmentPhaseElement : Time.Posix -> Maybe String -> BuyerOrSeller -> Element Msg -judgmentPhaseElement interval maybeError userRole = - phaseElement - Images.releaseWindowIcon - "Burn/Release Window" - (releaseWindowSummary userRole) - interval - maybeError - AutoreleaseIntervalChanged + Nothing -> + [] + ) + ) + (Element.text text) -openWindowSummary : BuyerOrSeller -> String -openWindowSummary userRole = +profitLossOrEven : Float -> Element Msg +profitLossOrEven margin = let - committingParty = - case userRole of - Buyer -> - "Seller" + ( text, bgColor, textColor ) = + if margin == 0 then + ( "Even" + , Element.rgba255 16 7 234 0.05 + , Element.rgb255 16 7 234 + ) - Seller -> - "Buyer" + else if margin > 0 then + ( "Profit" + , Element.rgba255 0 188 137 0.05 + , Element.rgb255 0 188 137 + ) + + else + ( "Loss" + , EH.lightRed |> EH.addAlpha 0.5 + , EH.lightRed + ) in - "The offer will expire by this time window if a " - ++ committingParty - ++ " 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 " - ++ committingParty - ++ " commits." + Element.el + [ Element.padding 7 ] + <| + Element.el + [ Element.paddingXY 15 9 + , Element.Background.color bgColor + , Element.Border.rounded 4 + , Element.Font.color textColor + , Element.Font.size 20 + , Element.Font.semiBold + ] + (Element.text text) -paymentWindowSummary : BuyerOrSeller -> String -paymentWindowSummary userRole = - case userRole of - Buyer -> - "After committing, you and the Seller have this long to complete the external 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." +absMarginPercentage : Float -> Element Msg +absMarginPercentage margin = + Element.el + [ Element.Font.size 20 + , Element.Font.semiBold + ] + (Element.text + (((margin * 100) + |> abs + |> formatFloat 2 + ) + ++ "%" + ) + ) - Seller -> - "After committing, you and the Buyer have this long to complete the external 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." +inTypeDropdown : Model -> Element Msg +inTypeDropdown model = + case model.mode of + CryptoSwap Seller -> + dhTokenTypeDropdown + (InTypeSelected << DHToken) + + OffRamp -> + dhTokenTypeDropdown + (InTypeSelected << DHToken) + + CryptoSwap Buyer -> + cryptoTypeDropdown + model.inputs.currencySearch + SearchInputChanged + (InTypeSelected << External) + + OnRamp -> + fiatTypeDropdown + model.inputs.currencySearch + SearchInputChanged + (InTypeSelected << External) + + +outTypeDropdown : Model -> Element Msg +outTypeDropdown model = + case model.mode of + CryptoSwap Seller -> + cryptoTypeDropdown + model.inputs.currencySearch + SearchInputChanged + (OutTypeSelected << External) + + CryptoSwap Buyer -> + dhTokenTypeDropdown + (OutTypeSelected << DHToken) + + OffRamp -> + fiatTypeDropdown + model.inputs.currencySearch + SearchInputChanged + (OutTypeSelected << External) + + OnRamp -> + dhTokenTypeDropdown + (OutTypeSelected << DHToken) + + +dhTokenTypeDropdown : (FactoryType -> Msg) -> Element Msg +dhTokenTypeDropdown msgConstructor = + EH.modal + (Element.rgba 0 0 0 0.1) + NoOp + CloseModals + <| + EH.basicOpenDropdown + [ Element.width <| Element.px 300 + , Element.moveDown 10 + , Element.alignRight + ] + Nothing + (dhTokenList + |> List.map + (\tokenType -> + ( Element.row + [ Element.width Element.fill + , Element.spacing 18 + ] + (Maybe.Extra.values + [ Currencies.icon <| tokenSymbol tokenType + , Just <| Element.text <| tokenUnitName tokenType + ] + ) + , msgConstructor tokenType + ) + ) + ) -releaseWindowSummary : BuyerOrSeller -> String -releaseWindowSummary userRole = - case userRole of - Buyer -> - "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." - Seller -> - "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." +cryptoTypeDropdown : String -> (String -> Msg) -> (Currencies.Symbol -> Msg) -> Element Msg +cryptoTypeDropdown searchInput searchChangedMsg selectedMsg = + EH.modal + (Element.rgba 0 0 0 0.1) + NoOp + CloseModals + <| + EH.searchableOpenDropdown + [ Element.width <| Element.px 300 + , Element.moveDown 18 + , Element.alignRight + ] + "search cryptocurrencies" + (Currencies.foreignCryptoList + |> List.map + (\symbol -> + ( Element.row + [ Element.width Element.fill + , Element.spacing 18 + ] + (Maybe.Extra.values + [ Currencies.icon symbol + , Just <| Element.text symbol + ] + ) + , [ symbol ] + , selectedMsg symbol + ) + ) + ) + searchInput + searchChangedMsg + + +fiatTypeDropdown : String -> (String -> Msg) -> (Currencies.Symbol -> Msg) -> Element Msg +fiatTypeDropdown searchInput searchChangedMsg selectedMsg = + EH.modal + (Element.rgba 0 0 0 0.1) + NoOp + CloseModals + <| + EH.searchableOpenDropdown + [ Element.width <| Element.px 300 + , Element.moveDown 18 + , Element.alignRight + ] + "search currencies" + (Currencies.fiatList + |> List.map + (\fiatSymbol -> + ( Element.row + [ Element.width Element.fill + , Element.spacing 18 + ] + (Maybe.Extra.values + [ Currencies.icon fiatSymbol + , Just <| Element.text fiatSymbol + ] + ) + , Maybe.Extra.values [ Just fiatSymbol, Currencies.fiatChar fiatSymbol ] + , selectedMsg fiatSymbol + ) + ) + ) + searchInput + searchChangedMsg -paymentMethodsElement : Maybe String -> BuyerOrSeller -> String -> Element Msg -paymentMethodsElement maybeError initiatorRole inputText = - let - titleElement = - Element.el - [ Element.Font.size 22 - , Element.Font.semiBold +typeDropdownButton : Bool -> CurrencyType -> Msg -> Element Msg +typeDropdownButton dropdownOpen currencyType onClick = + Element.row + [ Element.Background.color <| Element.rgb 0.98 0.98 0.98 + , Element.height Element.fill + , Element.padding 13 + , Element.spacing 13 + , Element.pointer + , EH.onClickNoPropagation onClick + ] + [ Currencies.icon (currencySymbol currencyType) + |> Maybe.withDefault Element.none + , Element.text <| currencySymbol currencyType + , Images.toElement + [ Element.width <| Element.px 12 ] + <| + if dropdownOpen then + Images.upArrow + + else + Images.downArrow + ] + + +cryptoAddressInput : Currencies.Symbol -> String -> Element Msg +cryptoAddressInput symbol input = + EH.withInputHeader + [ Element.width Element.fill ] + (symbol ++ " Receive Address") + <| + inputContainer + [ Element.width Element.fill + ] + [ Element.Input.text + [ Element.width Element.fill + , Element.height Element.fill + , Element.Border.width 0 ] - (Element.text "Payment Method") + { onChange = ReceiveAddressChanged + , text = input + , placeholder = Nothing + , label = Element.Input.labelHidden "receive address" + } + ] - inputElement = - Element.Input.multiline + +paymentMethodInput : BuyerOrSeller -> String -> Element Msg +paymentMethodInput initiatorRole input = + EH.withInputHeader + [ Element.width Element.fill ] + (case initiatorRole of + Buyer -> + "Making the Payment" + + Seller -> + "Accepting the Payment" + ) + <| + inputContainer + [ Element.height <| Element.px 134 + , Element.width Element.fill + ] + [ Element.Input.multiline [ Element.width Element.fill - , Element.height <| Element.px 150 - , Element.Background.color <| Element.rgba255 155 203 255 0.2 + , Element.height Element.fill , Element.Border.width 0 + , Element.scrollbarY ] - { onChange = ChangePaymentMethodText - , text = inputText + { onChange = PaymentMethodChanged + , text = input , placeholder = - if inputText == "" then - Just <| inputPlaceholder initiatorRole - - else - Nothing + Just <| + Element.Input.placeholder + [ Element.Font.color EH.placeholderTextColor ] + <| + Element.column [ Element.spacing 5 ] <| + case initiatorRole of + Buyer -> + [ Element.text "Indicate here how you will send payment to the Seller. Some examples:" + , Element.text "\"I can send to any EU bank\"" + , Element.text "\"I'll reveal a hidden cash drop within 10 km of Grand Central Station\"" + , Element.text "\"Can send via ecocash\"" + ] + + Seller -> + [ Element.text "Indicate here how you will send payment to the Buyer. Some examples:" + , Element.text "\"I have TransferWise\"" + , Element.text "\"I can pick up a cash drop within 10 km of Grand Central Station\"" + , Element.text "\"I can pick up a WorldRemit payment to Zimbabwe\"" + ] , label = Element.Input.labelHidden "payment method" , spellcheck = True } + ] + + +intervalsRow : Model -> Element Msg +intervalsRow model = + Element.row + [ Element.width Element.fill + , Element.spacing 23 + ] + [ phaseWindowBoxAndMaybeModal Expiry model + , phaseWindowBoxAndMaybeModal Payment model + , phaseWindowBoxAndMaybeModal Judgment model + ] + + +phaseWindowBoxAndMaybeModal : IntervalType -> Model -> Element Msg +phaseWindowBoxAndMaybeModal intervalType model = + let + showModal = + model.showIntervalModal == Just intervalType in - Element.column - [ Element.spacing 20 - , Element.paddingEach - { left = 45 - , right = 45 - , top = 0 - , bottom = 15 - } - , Element.width Element.fill + Element.el + [ Element.width Element.fill , Element.above <| - EH.maybeErrorElement - [ inputErrorTag - , Element.moveDown 30 - , Element.padding 10 - , Element.Font.size 20 - , Element.width <| Element.px 400 - ] - maybeError + if showModal then + intervalModal + intervalType + (initiatorRole model.mode) + (getUserInterval intervalType model) + model.inputs.interval + model.errors.interval + + else + Element.none ] - [ titleElement - , inputElement + <| + phaseWindowBox + intervalType + (getUserInterval intervalType model) + showModal + + +phaseWindowBox : IntervalType -> UserInterval -> Bool -> Element Msg +phaseWindowBox intervalType interval modalIsOpen = + EH.withInputHeader + [ Element.width Element.fill ] + (case intervalType of + Expiry -> + "Offer Expiry" + + Payment -> + "Payment Due" + + Judgment -> + "Burn Window" + ) + <| + inputContainer + [ Element.width Element.fill + , Element.pointer + , EH.onClickNoPropagation (WindowBoxClicked intervalType) + ] + [ Element.el + [ Element.height Element.fill + , Element.width Element.fill + , Element.Background.color EH.white + , Element.paddingXY 15 17 + ] + (userInterval interval) + , dropdownArrow modalIsOpen + ] + + +userInterval : UserInterval -> Element Msg +userInterval interval = + Element.el + [ Element.Font.size 20 + , Element.Font.medium ] + <| + Element.text <| + String.fromInt interval.num + ++ " " + ++ intervalUnitToString interval.unit + ++ (if interval.num == 1 then + "" + + else + "s" + ) -phaseElement : Image -> String -> String -> Time.Posix -> Maybe String -> (Time.Posix -> Msg) -> Element Msg -phaseElement icon title summary interval maybeError newIntervalMsg = +intervalModal : IntervalType -> BuyerOrSeller -> UserInterval -> String -> Maybe String -> Element Msg +intervalModal intervalType userRole value input maybeError = let - iconAndTitleElement = - Element.row - [ Element.spacing 30 ] - [ Images.toElement - [ Element.height <| Element.px 40 - , Element.Events.onClick <| - CmdUp <| - CmdUp.gTag "click" "misclick" ("symbol for " ++ title) 0 - ] - icon - , Element.el - [ Element.Font.size 22 - , Element.Font.semiBold - ] - (Element.text title) - ] + ( title, text ) = + case intervalType of + Expiry -> + ( "Offer Expiry" + , "This is how long your offer remains valid and visible in the marketplace. Note that you can manually recall the trade at any time, as long as no one has yet committed to it." + ) - descriptionElement = - Element.paragraph - [ Element.Font.size 17 - , Element.Font.medium - , Element.Font.color EH.permanentTextColor - ] - [ Element.text summary ] + Payment -> + ( "Payment Due" + , case userRole of + Buyer -> + "Once a Seller commits, this is how long you to work with the Seller to complete the payment, and click \"confirm payment\". We recommend setting this to about 2X or 3X more than you expect you'll need!" - intervalElement = - Element.el - [ Element.Background.color <| Element.rgba255 155 203 255 0.2 - , Element.Border.rounded 5 - , Element.padding 15 - , Element.above <| - EH.maybeErrorElement - [ inputErrorTag ] - maybeError - ] - (EH.intervalInput EH.black interval newIntervalMsg) + Seller -> + "Once a Buyer commits, this is how long they have to work with you to complete the payment and click \"confirm payment\". We recommend setting this to about 2X or 3X more than you expect you'll need!" + ) + + Judgment -> + ( "Burn Window" + , case userRole of + Buyer -> + "Once you confirm payment, this is how long the Seller will have the option to burn the entire Dai/xDai balance (or manually release early). If the Seller makes no decision before this timer expires, the Dai/xDai balance is yours to claim." + + Seller -> + "Once the Buyer confirms payment, this is how long you will have the option to burn the entire Dai/xDai balance (or manually release early). If you don't make a decision before this timer expires, the Buyer can then claim the Dai/xDai balance." + ) in - Element.column - [ Element.width Element.fill - , Element.spacing 2 - ] - (List.map - (Element.el - [ Element.paddingXY 45 18 + EH.modal + (Element.rgba 0 0 0 0.1) + NoOp + CloseModals + <| + Element.column + [ Element.moveUp 10 + , Element.Border.rounded 8 + , Element.Background.color EH.lightGray + , Element.spacing 1 + , Element.clip + , Element.Border.shadow + { offset = ( 0, 3 ) + , size = 0 + , blur = 20 + , color = Element.rgba 0 0 0 0.08 + } + , if intervalType == Judgment then + Element.alignRight + + else + Element.alignLeft + ] + [ Element.el + [ Element.paddingXY 23 18 + , Element.Background.color EH.white , Element.width Element.fill ] - ) - [ iconAndTitleElement - , Element.row - [ Element.width Element.fill - , Element.spacing 25 + <| + Element.column + [ Element.width Element.fill + , Element.spacing 10 + ] + [ Element.el + [ Element.Font.size 20 + , Element.Font.semiBold + , Element.Font.color <| Element.rgb255 16 7 234 + ] + (Element.text title) + , Element.paragraph + [ Element.Font.size 16 + , Element.Font.color <| Element.rgba 0 0 0 0.75 + ] + [ Element.text text ] + ] + , let + timeUnitButton : IntervalUnit -> Bool -> Element Msg + timeUnitButton unit selected = + button + (if selected then + Element.rgb255 16 7 234 + + else + Element.rgba255 10 33 108 0.04 + ) + (if selected then + EH.white + + else + Element.rgb255 10 33 108 + ) + (intervalUnitToString unit + ++ "s" + |> String.toLower + ) + (if selected then + Nothing + + else + Just <| + IntervalUnitChanged unit + ) + in + Element.row + [ Element.paddingXY 23 18 + , Element.Background.color EH.white + , Element.spacing 12 ] - [ intervalElement - , descriptionElement + [ inputContainer + [ Element.width <| Element.px 140 + , Element.above <| + case maybeError of + Just error -> + Element.el + [ Element.Font.size 12 + , Element.Font.color EH.softRed + , Element.moveUp 16 + , Element.alignLeft + , Element.Background.color EH.white + , Element.Border.widthEach + { top = 0 + , bottom = 0 + , right = 1 + , left = 1 + } + , Element.paddingXY 5 0 + , Element.Border.color EH.lightGray + ] + (Element.text error) + + Nothing -> + Element.none + ] + [ Element.Input.text + [ Element.Border.width 0 + , Element.width Element.fill + , Element.height Element.fill + ] + { onChange = IntervalInputChanged + , text = input + , placeholder = Nothing + , label = Element.Input.labelHidden (title ++ " input") + } + ] + , timeUnitButton Minute (value.unit == Minute) + , timeUnitButton Hour (value.unit == Hour) + , timeUnitButton Day (value.unit == Day) + , timeUnitButton Week (value.unit == Week) ] ] - ) -viewModals : Model -> List (Element Msg) -viewModals model = - model.txChainStatus - |> Maybe.map - (\txChainStatus -> - txChainStatusModal txChainStatus model +dropdownArrow : Bool -> Element Msg +dropdownArrow pointUp = + Element.el + [ Element.alignRight + , Element.height Element.fill + , Element.Background.color <| Element.rgb 0.98 0.98 0.98 + , Element.padding 13 + ] + <| + Images.toElement + [ Element.centerY ] + (if pointUp then + Images.upArrow + + else + Images.downArrow ) - |> List.singleton - |> Maybe.Extra.values + + +inputContainer : List (Element.Attribute Msg) -> List (Element Msg) -> Element Msg +inputContainer attributes = + Element.row <| + [ Element.Background.color EH.lightGray + , Element.height <| Element.px 55 + , Element.Border.rounded 4 + , Element.Border.width 1 + , Element.Border.color EH.lightGray + , Element.spacing 1 + ] + ++ attributes + + +placeOrderButton : Model -> Element Msg +placeOrderButton model = + let + buttonBuilder bgColor textColor text maybeOnClick maybeError = + Element.el + ([ Element.width Element.fill + , Element.padding 17 + , Element.Border.rounded 4 + , Element.Font.size 20 + , Element.Font.semiBold + , Element.Font.center + , Element.Background.color bgColor + , Element.Font.color textColor + , Element.above <| + case maybeError of + Just error -> + Element.el + [ Element.Font.size 12 + , Element.Font.color EH.softRed + , Element.moveUp 16 + , Element.centerX + ] + (Element.text error) + + Nothing -> + Element.none + ] + ++ (case maybeOnClick of + Just onClick -> + [ Element.pointer + , Element.Events.onClick onClick + ] + + Nothing -> + [] + ) + ) + (Element.text text) + in + case Wallet.userInfo model.wallet of + Just userInfo -> + if Wallet.factory model.wallet == Just model.dhTokenType then + case maybeUserParameters model of + Just userParameters -> + buttonBuilder + (Element.rgb255 255 0 110) + EH.white + "Review Terms and Place Order" + (Just <| PlaceOrderClicked model.dhTokenType userInfo userParameters) + Nothing + + Nothing -> + buttonBuilder + EH.lightGray + EH.black + "Review Terms and Place Order" + Nothing + Nothing + + else + Element.paragraph + [ Element.Font.size 18 + , Element.Font.italic + , Element.Font.color EH.darkGray + , Element.centerX + ] + [ Element.text <| + "You must switch your wallet to the " + ++ networkNameForFactory model.dhTokenType + ++ " network to create a trade with " + ++ tokenUnitName model.dhTokenType + ++ "." + ] + + Nothing -> + buttonBuilder + EH.softRed + EH.white + "Connect to Wallet" + (Just <| CmdUp CmdUp.Web3Connect) + Nothing txChainStatusModal : TxChainStatus -> Model -> Element Msg @@ -560,69 +1163,303 @@ txChainStatusModal txChainStatus model = case txChainStatus of Confirm factoryType createParameters -> let - ( depositAmountEl, confirmButton ) = + ( depositAmountEl, totalBurnableEl, confirmButton ) = case model.depositAmount of Just depositAmount -> - ( TokenValue.tokenValue depositAmount - |> TokenValue.toConciseString - |> Element.text - , EH.redButton "Yes, I definitely want to open this trade." (ConfirmCreate factoryType createParameters depositAmount) + let + depositAmountText = + TokenValue.toConciseString depositAmount + ++ " " + ++ tokenUnitName factoryType + + totalBurnableText = + TokenValue.toConciseString + (TokenValue.add + depositAmount + (CTypes.getResponderDeposit createParameters) + |> TokenValue.add (CTypes.calculateDHFee createParameters) + ) + ++ " " + ++ tokenUnitName factoryType + in + ( blueText depositAmountText + , blueText totalBurnableText + , EH.redButton + ("Understood. Deposit " + ++ depositAmountText + ++ " and open this trade." + ) + (ConfirmCreate factoryType createParameters depositAmount) ) Nothing -> - ( Element.text "??" + ( blueText "??" + , blueText "??" , EH.disabledButton "(loading exact fees...)" Nothing ) + + feeAmountEl = + blueText <| + TokenValue.toConciseString (CTypes.calculateDHFee createParameters) + ++ " " + ++ tokenUnitName factoryType + + tradeAmountEl = + blueText <| + TokenValue.toConciseString createParameters.tradeAmount + ++ " " + ++ tokenUnitName factoryType + + notYetButton = + Element.el + [ Element.pointer + , Element.Events.onClick AbortCreate + , Element.paddingXY 25 17 + , Element.Font.color EH.white + , Element.Font.size 18 + , Element.Font.semiBold + ] + (Element.text "I'm not ready yet. Go back.") + + buyerDepositEl = + blueText <| + TokenValue.toConciseString createParameters.buyerDeposit + ++ " " + ++ tokenUnitName factoryType + + totalReleaseableEl = + blueText <| + TokenValue.toConciseString (TokenValue.add createParameters.tradeAmount createParameters.buyerDeposit) + ++ " " + ++ tokenUnitName factoryType + + expiryWindowEl = + emphasizedText <| + userIntervalToString <| + getUserInterval Expiry model + + paymentWindowEl = + emphasizedText <| + userIntervalToString <| + getUserInterval Payment model + + judgmentWindowEl = + emphasizedText <| + userIntervalToString <| + getUserInterval Judgment model + + priceEl = + blueText <| Currencies.toString createParameters.price + + emphasizedText = + Element.el + [ Element.Font.bold + , Element.Font.color EH.black + ] + << Element.text + + blueText = + Element.el + [ Element.Font.semiBold + , Element.Font.color EH.blue + ] + << Element.text in EH.closeableModal - [] - (Element.column - [ Element.spacing 20 - , Element.padding 20 - , Element.centerX - , Element.height Element.fill - , Element.Font.center - ] - [ Element.el - [ Element.Font.size 26 - , Element.Font.semiBold - , Element.centerX - , Element.centerY + [ Element.width <| Element.px 1200 ] + (Element.row + [ Element.width Element.fill ] + [ Element.column + [ Element.padding 90 + , Element.height Element.fill + , Element.Background.color <| Element.rgb255 10 33 108 + ] + [ Element.column + [ Element.width Element.fill + , Element.spacing 18 + , Element.Font.color EH.white + ] + [ Element.el + [ Element.Font.size 38 + , Element.Font.semiBold + ] + (Element.text "Are you Ready?") + , Element.paragraph + [ Element.Font.size 16 + , Element.Font.medium + ] + [ Element.text "DAIHard is different than other exchanges. If this is your first trade here, carefully read the details to the right before proceeding with opening this trade." ] + , Element.paragraph + [ Element.Font.size 16 + , Element.Font.medium + ] + [ Element.text "You can't edit a trade once it's live (but you can abort and re-deploy, as described in point 2)." ] + ] + , Element.column + [ Element.centerX + , Element.spacing 15 + , Element.alignBottom + ] + [ Element.el [ Element.centerX ] confirmButton + , Element.el [ Element.centerX ] notYetButton + ] ] - (Element.text "Just to Confirm...") , Element.column - [ Element.spacing 20 - , Element.centerX - , Element.centerY + [ Element.spacing 23 + , Element.padding 40 + , Element.width Element.fill ] (List.map - (Element.paragraph - [ Element.centerX - , Element.Font.size 18 - , Element.Font.medium - , Element.Font.color EH.permanentTextColor - ] + (\lines -> + Element.row + [ Element.width Element.fill + , Element.height Element.fill + , Element.Border.width 2 + , Element.Border.color EH.lightGray + , Element.padding 16 + , Element.spacing 20 + ] + [ Element.el + [ Element.Font.size 40 + , Element.centerY + ] + (Element.text EH.bulletPointString) + , Element.paragraph + [ Element.Font.size 16 ] + lines + ] ) - (getWarningParagraphs createParameters - ++ [ [ Element.text <| "You will deposit " - , depositAmountEl - , Element.text <| " " ++ tokenUnitName factoryType ++ " (this includes the 1% dev fee) to open this trade." - ] - ] - ++ (case factoryType of - Token _ -> - [ [ Element.text <| "This ususally requires two Metamask signatures. Your " ++ tokenUnitName factoryType ++ " will not be deposited until the final transaction has been mined." ] ] - - Native _ -> - [] - ) + (case createParameters.initiatorRole of + Buyer -> + [ [ Element.text "To open this offer, you must deposit " + , depositAmountEl + , Element.text ". Your offer to buy " + , tradeAmountEl + , Element.text " for " + , priceEl + , Element.text " will then be listed on the marketplace." + ] + , [ Element.text "You can abort the offer any time before a Seller commits for a full refund. If no Seller commits within " + , expiryWindowEl + , Element.text " your offer will automatically expire. In both these cases, the full " + , depositAmountEl + , Element.text " is returned to you." + ] + , [ Element.text "A Seller can commit to the trade by depositing the full " + , tradeAmountEl + , Element.text " into the contract, and is expected to immediately post his " + , blueText <| createParameters.price.symbol + , Element.text " address in the DAIHard chat." + ] + , case model.mode of + CryptoSwap _ -> + [ Element.text "You will then have " + , paymentWindowEl + , Element.text " to send " + , priceEl + , Element.text " to that address and click \"Confirm Payment\"." + ] + + _ -> + [ Element.text "You are then expected to send " + , priceEl + , Element.text " and click \"Confirm Payment\" within " + , paymentWindowEl + , Element.text "." + ] + , [ Element.text "Once you've confirmed payment, for " + , judgmentWindowEl + , Element.text ", the Seller has the option of burning the trade's full balance of " + , totalBurnableEl + , Element.text ". He is expected to do this if and only if you failed to send the " + , priceEl + , Element.text " to the address he posted." + ] + , [ Element.text "If the Seller has not burned the " + , Element.text <| tokenUnitName factoryType + , Element.text " within the " + , judgmentWindowEl + , Element.text ", " + , totalReleaseableEl + , Element.text " is yours to claim and we take a 1% fee (" + , feeAmountEl + , Element.text ")." + ] + ] + ++ (case factoryType of + Token _ -> + [ [ Element.text <| "(Trade creation ususally requires two Metamask signatures. Your " ++ tokenUnitName factoryType ++ " will not be deposited until the final transaction has been mined.)" ] ] + + Native _ -> + [] + ) + + Seller -> + [ [ Element.text "Of your " + , depositAmountEl + , Element.text ", ~1% (" + , feeAmountEl + , Element.text ") will be set aside, and the remaining " + , tradeAmountEl + , Element.text " will be listed as selling for " + , priceEl + , Element.text "." + ] + , [ Element.text "You can abort the offer at any time before a Buyer commits, and if no Buyer commits within " + , expiryWindowEl + , Element.text " your offer will automatically expire. In both these cases, the full " + , depositAmountEl + , Element.text " is returned to you." + ] + ] + ++ (case model.mode of + CryptoSwap _ -> + [ [ Element.text "A Buyer must deposit " + , buyerDepositEl + , Element.text <| " into this contract to commit. He is then expected to send the " + , priceEl + , Element.text <| " to your receive address " + , blueText model.inputs.receiveAddress + , Element.text ", and mark the payment as complete, all within " + , paymentWindowEl + , Element.text "." + ] + , [ emphasizedText "Make sure the above address is correct! DAIHard does not do refunds!" ] + ] + + _ -> + [ [ Element.text "A Buyer must deposit " + , buyerDepositEl + , Element.text <| " into this contract to commit. He is then expected to pay the " + , priceEl + , Element.text " to you, via the method you've descried in your " + , emphasizedText "Payment Methods" + , Element.text ", and mark the payment as complete, all within " + , paymentWindowEl + , Element.text "." + ] + ] + ) + ++ [ [ Element.text <| "When the Buyer marks the payment complete, for " + , judgmentWindowEl + , Element.text " you will have the option to burn the trade's balance of " + , totalBurnableEl + , Element.text <| ", which you are expected to do if and only if the Buyer has not sent the payment." + ] + , [ Element.text "If the trade has resolved successfully, DAIHard takes the 1% fee of " + , feeAmountEl + , Element.text " set aside earlier." + ] + ] + ++ (case factoryType of + Token _ -> + [ [ Element.text <| "(Trade creation ususally requires two Metamask signatures. Your " ++ tokenUnitName factoryType ++ " will not be deposited until the final transaction has been mined.)" ] ] + + Native _ -> + [] + ) ) ) - , Element.el - [ Element.alignBottom - , Element.centerX - ] - confirmButton ] ) NoOp @@ -702,62 +1539,11 @@ txChainStatusModal txChainStatus model = NoOp -getWarningParagraphs : CTypes.CreateParameters -> List (List (Element Msg)) -getWarningParagraphs createParameters = - [ if TimeHelpers.compare createParameters.autoreleaseInterval (Time.millisToPosix (1000 * 60 * 20)) == LT then - Just <| - case createParameters.initiatorRole of - Buyer -> - "That Burn/Release Window time is quite small! It might take a while to find a committed Seller." - - Seller -> - "That Burn/Release Window time is quite small! This may attract scammers. Only create this trade if you know what you're doing." - - else - Nothing - , if TimeHelpers.compare createParameters.autoabortInterval (Time.millisToPosix (1000 * 60 * 60)) == LT then - Just <| - case createParameters.initiatorRole of - Buyer -> - "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." - - Seller -> - "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." - - else - Nothing - ] - |> Maybe.Extra.values - |> List.map - (\message -> - [ Element.el [ Element.Font.color EH.red ] <| Element.text "Caution! " - , Element.text message - ] - ) - - -inputPlaceholder : BuyerOrSeller -> Element.Input.Placeholder Msg -inputPlaceholder initiatorRole = - Element.Input.placeholder - [ Element.Font.color <| Element.rgba 0 0 0 0.2 ] - (case initiatorRole of - Seller -> - Element.text """Some examples: - -I can accept transfers to a Schwab bank account (routing 121202211) -I can meet in person to accept cash in London, weekdays after 6, with a day of notice. -Hide the cash in Hume Park, Bulawayo, and tell me the location over chat.""" - - Buyer -> - Element.text """Some examples: - -I can deliver cash anywhere within an hour drive of Phoneix, AZ, with 2 days of notice. -TransferWise -Interac e-Transfer -""" - ) - +viewModals : Model -> List (Element Msg) +viewModals model = + case model.txChainStatus of + Just txChainStatus -> + [ txChainStatusModal txChainStatus model ] -inputErrorTag : Attribute Msg -inputErrorTag = - Element.htmlAttribute <| Html.Attributes.id "inputError" + Nothing -> + [] diff --git a/src/CryptoSwap/State.elm b/src/CryptoSwap/State.elm deleted file mode 100644 index 99f458d..0000000 --- a/src/CryptoSwap/State.elm +++ /dev/null @@ -1,683 +0,0 @@ -module CryptoSwap.State exposing (init, runCmdDown, subscriptions, update) - -import Base58 -import BigInt exposing (BigInt) -import ChainCmd exposing (ChainCmd) -import CmdDown -import CmdUp exposing (CmdUp) -import CommonTypes exposing (..) -import Config -import Contracts.Generated.ERC20Token as TokenContract -import Contracts.Types as CTypes -import Contracts.Wrappers -import CryptoSwap.Types exposing (..) -import Dict -import Eth -import Helpers.BigInt as BigIntHelpers -import Helpers.Time as TimeHelpers -import Maybe.Extra -import PriceFetch -import Routing -import Time -import TokenValue exposing (TokenValue) -import UserNotice as UN exposing (UserNotice) -import Wallet - - -init : Wallet.State -> UpdateResult -init wallet = - { wallet = wallet - , initiatorRole = Seller - , amountInInput = "" - , amountIn = Nothing - , amountOutInput = "" - , dhToken = - Wallet.factory wallet - |> Maybe.withDefault (Native XDai) - , foreignCrypto = ZEC - , responderProfitInput = "2" - , responderProfit = Just 0.02 - , amountOut = Nothing - , receiveAddress = "" - , showDhTokenDropdown = False - , showForeignCryptoDropdown = False - , errors = noErrors - , txChainStatus = Nothing - , depositAmount = Nothing - , allowance = Nothing - , prices = [] - , now = Time.millisToPosix 0 - } - |> update Refresh - - -update : Msg -> Model -> UpdateResult -update msg prevModel = - case msg of - UpdateNow time -> - justModelUpdate - { prevModel | now = time } - - Refresh -> - let - maybeAllowanceCmd = - case ( Wallet.userInfo prevModel.wallet, Wallet.factory prevModel.wallet ) of - ( Just userInfo, Just (Token tokenType) ) -> - Contracts.Wrappers.getAllowanceCmd - tokenType - userInfo.address - (Config.factoryAddress (Token tokenType)) - (AllowanceFetched tokenType) - - _ -> - Cmd.none - - fetchExchangeRateCmd = - PriceFetch.fetch PricesFetched - in - UpdateResult - prevModel - (Cmd.batch - [ maybeAllowanceCmd - , fetchExchangeRateCmd - ] - ) - ChainCmd.none - [] - - PricesFetched fetchResult -> - case fetchResult of - Ok pricesAndTimestamps -> - let - newPrices = - pricesAndTimestamps - |> List.map (Tuple.mapSecond (PriceFetch.checkAgainstTime prevModel.now)) - - ( newModel, appCmds ) = - { prevModel | prices = newPrices } - |> tryUpdateAmountOut - in - UpdateResult - newModel - Cmd.none - ChainCmd.none - appCmds - - Err httpErr -> - UpdateResult - prevModel - Cmd.none - ChainCmd.none - [ CmdUp.UserNotice UN.cantFetchPrices ] - - AmountInChanged input -> - let - ( newMaybeAmountIn, newErrors ) = - let - prevErrors = - prevModel.errors - in - case interpretAmount input of - Ok maybeAmount -> - ( maybeAmount - , { prevErrors | amountIn = Nothing } - ) - - Err errStr -> - ( Nothing - , { prevErrors | amountIn = Just errStr } - ) - - ( newModel, appCmds ) = - { prevModel - | amountInInput = input - , amountIn = newMaybeAmountIn - , errors = newErrors - } - |> tryUpdateAmountOut - in - UpdateResult - newModel - Cmd.none - ChainCmd.none - appCmds - - AmountOutChanged input -> - let - ( newMaybeAmountOut, newErrors ) = - let - prevErrors = - prevModel.errors - in - case interpretAmount input of - Ok maybeAmount -> - ( maybeAmount - , { prevErrors | amountOut = Nothing } - ) - - Err errStr -> - ( Nothing - , { prevErrors | amountOut = Just errStr } - ) - - ( newModel, appCmds ) = - { prevModel - | amountOutInput = input - , amountOut = newMaybeAmountOut - , errors = newErrors - } - |> tryUpdateAmountIn - in - UpdateResult - newModel - Cmd.none - ChainCmd.none - appCmds - - ResponderProfitChanged input -> - let - ( newMaybeResponderProfit, newErrors ) = - let - prevErrors = - prevModel.errors - in - case interpretResponderProfit input of - Ok maybeResponderProfit -> - ( maybeResponderProfit - , { prevErrors | responderProfit = Nothing } - ) - - Err errStr -> - ( Nothing - , { prevErrors | responderProfit = Just errStr } - ) - - ( newModel, appCmds ) = - { prevModel - | responderProfitInput = input - , responderProfit = newMaybeResponderProfit - , errors = newErrors - } - |> tryUpdateAmountOut - in - UpdateResult - newModel - Cmd.none - ChainCmd.none - appCmds - - SwapClicked -> - let - ( newModel, appCmds ) = - { prevModel - | initiatorRole = - case prevModel.initiatorRole of - Buyer -> - Seller - - Seller -> - Buyer - , amountInInput = prevModel.amountOutInput - , amountIn = prevModel.amountOut - , amountOutInput = prevModel.amountInInput - , amountOut = prevModel.amountIn - } - |> tryUpdateDaiAmount - in - UpdateResult - newModel - Cmd.none - ChainCmd.none - appCmds - - TokenTypeClicked -> - justModelUpdate - { prevModel - | showDhTokenDropdown = - not prevModel.showDhTokenDropdown - } - - ChangeTokenType factory -> - let - ( newModel, appCmds ) = - { prevModel - | dhToken = factory - , showDhTokenDropdown = False - } - |> tryUpdateDaiAmount - in - UpdateResult - newModel - Cmd.none - ChainCmd.none - appCmds - - ForeignCryptoTypeClicked -> - justModelUpdate - { prevModel - | showForeignCryptoDropdown = - not prevModel.showForeignCryptoDropdown - } - - ChangeForeignCrypto crypto -> - let - ( newModel, appCmds ) = - { prevModel - | foreignCrypto = crypto - , showForeignCryptoDropdown = False - } - |> tryUpdateForeignCryptoAmount - in - UpdateResult - newModel - Cmd.none - ChainCmd.none - appCmds - - ReceiveAddressChanged input -> - justModelUpdate - { prevModel - | receiveAddress = - input - } - - PlaceOrderClicked factoryType userInfo userParameters -> - let - createParameters = - CTypes.buildCreateParameters userInfo userParameters - in - justModelUpdate - { prevModel - | txChainStatus = Just <| Confirm factoryType createParameters prevModel.receiveAddress - , depositAmount = - Just <| - (CTypes.calculateFullInitialDeposit createParameters - |> TokenValue.getEvmValue - ) - } - - AbortCreate -> - UpdateResult - { prevModel | txChainStatus = Nothing } - Cmd.none - ChainCmd.none - [ CmdUp.gTag "abort" "abort" "create" 0 ] - - ConfirmCreate factoryType createParameters fullDepositAmount -> - let - ( txChainStatus, chainCmd ) = - case factoryType of - Native _ -> - initiateCreateCall factoryType createParameters - - Token tokenType -> - let - approveChainCmd = - let - txParams = - TokenContract.approve - (Config.tokenContractAddress tokenType) - (Config.factoryAddress factoryType) - fullDepositAmount - |> Eth.toSend - - customSend = - { onMined = Nothing - , onSign = Just (ApproveSigned tokenType createParameters) - , onBroadcast = Nothing - } - in - ChainCmd.custom customSend txParams - in - case prevModel.allowance of - Just allowance -> - if BigInt.compare allowance fullDepositAmount /= LT then - initiateCreateCall factoryType createParameters - - else - ( Just (ApproveNeedsSig tokenType), approveChainCmd ) - - Nothing -> - ( Just (ApproveNeedsSig tokenType), approveChainCmd ) - in - UpdateResult - { prevModel | txChainStatus = txChainStatus } - Cmd.none - chainCmd - [] - - ApproveSigned tokenType createParameters result -> - case result of - Ok txHash -> - justModelUpdate { prevModel | txChainStatus = Just <| ApproveMining tokenType createParameters txHash } - - Err s -> - UpdateResult - { prevModel | txChainStatus = Nothing } - Cmd.none - ChainCmd.none - [ CmdUp.UserNotice <| UN.web3SigError "appove" s ] - - AllowanceFetched tokenType fetchResult -> - case fetchResult of - Ok allowance -> - let - newModel = - { prevModel - | allowance = Just allowance - } - in - case ( newModel.txChainStatus, newModel.depositAmount ) of - ( Just (ApproveMining _ createParameters _), Just depositAmount ) -> - if BigInt.compare allowance depositAmount /= LT then - let - ( txChainStatus, chainCmd ) = - initiateCreateCall (Token tokenType) createParameters - in - UpdateResult - { newModel | txChainStatus = txChainStatus } - Cmd.none - chainCmd - [] - - else - justModelUpdate newModel - - _ -> - justModelUpdate newModel - - Err httpError -> - UpdateResult - prevModel - Cmd.none - ChainCmd.none - [ CmdUp.UserNotice <| UN.web3FetchError "allowance" httpError ] - - CreateSigned factoryType result -> - case result of - Ok txHash -> - justModelUpdate { prevModel | txChainStatus = Just <| CreateMining factoryType txHash } - - Err s -> - UpdateResult - { prevModel | txChainStatus = Nothing } - Cmd.none - ChainCmd.none - [ CmdUp.UserNotice <| UN.web3SigError "create" s ] - - CreateMined factoryType (Err s) -> - UpdateResult - prevModel - Cmd.none - ChainCmd.none - [ CmdUp.UserNotice <| UN.web3MiningError "create" s ] - - CreateMined factory (Ok txReceipt) -> - let - maybeId = - CTypes.txReceiptToCreatedTradeSellId factory txReceipt - |> Result.toMaybe - |> Maybe.andThen BigIntHelpers.toInt - in - case maybeId of - Just id -> - UpdateResult - prevModel - Cmd.none - ChainCmd.none - [ CmdUp.GotoRoute (Routing.Trade factory id) ] - - Nothing -> - UpdateResult - prevModel - Cmd.none - ChainCmd.none - [ CmdUp.UserNotice <| - UN.unexpectedError "Error getting the ID of the created offer. Check the \"My Trades\" page for your open offer." txReceipt - ] - - CmdUp cmdUp -> - UpdateResult - prevModel - Cmd.none - ChainCmd.none - [ cmdUp ] - - NoOp -> - justModelUpdate - prevModel - - -runCmdDown : CmdDown.CmdDown -> Model -> UpdateResult -runCmdDown cmdDown prevModel = - case cmdDown of - CmdDown.UpdateWallet wallet -> - UpdateResult - { prevModel | wallet = wallet } - (case ( Wallet.userInfo wallet, Wallet.factory wallet ) of - ( Just uInfo, Just (Token tokenType) ) -> - Contracts.Wrappers.getAllowanceCmd - tokenType - uInfo.address - (Config.factoryAddress (Token tokenType)) - (AllowanceFetched tokenType) - - _ -> - Cmd.none - ) - ChainCmd.none - [] - - CmdDown.CloseAnyDropdownsOrModals -> - justModelUpdate - { prevModel - | showDhTokenDropdown = False - , showForeignCryptoDropdown = False - } - - -tryUpdateAmountOut : Model -> ( Model, List (CmdUp Msg) ) -tryUpdateAmountOut prevModel = - case PriceFetch.getPriceData prevModel.foreignCrypto prevModel.prices of - Just (PriceFetch.Ok price) -> - let - newAmountOut = - Maybe.map2 - (\amountIn responderProfit -> - case prevModel.initiatorRole of - Buyer -> - (amountIn * price) / (responderProfit + 1) - - Seller -> - let - tradeAmountAfterDevFee = - amountIn / 1.01 - - equivalentForeignCrypto = - tradeAmountAfterDevFee / price - in - equivalentForeignCrypto / (responderProfit + 1) - ) - prevModel.amountIn - prevModel.responderProfit - in - ( { prevModel - | amountOut = - case newAmountOut of - Just _ -> - newAmountOut - - Nothing -> - prevModel.amountOut - , amountOutInput = - newAmountOut - |> Maybe.map String.fromFloat - |> Maybe.withDefault prevModel.amountOutInput - } - , [] - ) - - Just PriceFetch.Outdated -> - ( prevModel - , [ CmdUp.UserNotice UN.oldPriceDataWarning ] - ) - - Nothing -> - ( prevModel - , [] - ) - - -tryUpdateAmountIn : Model -> ( Model, List (CmdUp Msg) ) -tryUpdateAmountIn prevModel = - case PriceFetch.getPriceData prevModel.foreignCrypto prevModel.prices of - Just (PriceFetch.Ok price) -> - let - newAmountIn = - Maybe.map2 - (\amountOut responderProfit -> - case prevModel.initiatorRole of - Buyer -> - (amountOut * (responderProfit + 1)) / price - - Seller -> - let - amountOutPlusResponderProfit = - amountOut * (responderProfit + 1) - - equivalentDai = - amountOutPlusResponderProfit * price - in - equivalentDai * 1.01 - ) - prevModel.amountOut - prevModel.responderProfit - in - ( { prevModel - | amountIn = - case newAmountIn of - Just _ -> - newAmountIn - - Nothing -> - prevModel.amountIn - , amountInInput = - newAmountIn - |> Maybe.map String.fromFloat - |> Maybe.withDefault prevModel.amountInInput - } - , [] - ) - - Just PriceFetch.Outdated -> - ( prevModel - , [ CmdUp.UserNotice UN.oldPriceDataWarning ] - ) - - Nothing -> - ( prevModel - , [] - ) - - -tryUpdateDaiAmount : Model -> ( Model, List (CmdUp Msg) ) -tryUpdateDaiAmount prevModel = - case prevModel.initiatorRole of - Buyer -> - tryUpdateAmountOut prevModel - - Seller -> - tryUpdateAmountIn prevModel - - -tryUpdateForeignCryptoAmount : Model -> ( Model, List (CmdUp Msg) ) -tryUpdateForeignCryptoAmount prevModel = - case prevModel.initiatorRole of - Buyer -> - tryUpdateAmountIn prevModel - - Seller -> - tryUpdateAmountOut prevModel - - -interpretAmount : String -> Result String (Maybe Float) -interpretAmount input = - if input == "" then - Ok Nothing - - else - case String.toFloat input of - Just value -> - Ok (Just value) - - Nothing -> - Err "Invalid amount" - - -interpretResponderProfit : String -> Result String (Maybe Float) -interpretResponderProfit input = - if input == "" then - Ok Nothing - - else - String.toFloat input - |> Result.fromMaybe "Invalid responderProfit" - |> Result.map (\percent -> percent / 100.0) - |> Result.map Just - - - --- interpretReceiveAddress : ForeignCrypto -> String -> Result String (Maybe String) --- interpretReceiveAddress crypto input = --- if input == "" then --- Ok Nothing --- else --- let --- b58Validate s = --- case Base58.decode s of --- Ok _ -> --- Ok (Just input) --- Err _ -> --- Err "Invalid address (b58 decode failed)" --- in --- case crypto of --- ZEC -> --- b58Validate input --- XMR -> --- if --- (String.length input == 106 || String.length input == 95) --- && (String.startsWith "4" input || String.startsWith "8" input) --- then --- Ok (Just input) --- else --- Err "Invalid address" --- BTC -> --- b58Validate input - - -initiateCreateCall : FactoryType -> CTypes.CreateParameters -> ( Maybe TxChainStatus, ChainCmd Msg ) -initiateCreateCall factoryType parameters = - let - txParams = - Contracts.Wrappers.openTrade - factoryType - parameters - |> Eth.toSend - - customSend = - { onMined = Just ( CreateMined factoryType, Nothing ) - , onSign = Just (CreateSigned factoryType) - , onBroadcast = Nothing - } - in - ( Just (CreateNeedsSig factoryType) - , ChainCmd.custom customSend txParams - ) - - -subscriptions : Model -> Sub Msg -subscriptions model = - Sub.batch - [ Time.every 10000 (always Refresh) - , Time.every 500 UpdateNow - ] diff --git a/src/CryptoSwap/Types.elm b/src/CryptoSwap/Types.elm deleted file mode 100644 index 1ed130e..0000000 --- a/src/CryptoSwap/Types.elm +++ /dev/null @@ -1,168 +0,0 @@ -module CryptoSwap.Types exposing (Errors, Model, Msg(..), TxChainStatus(..), UpdateResult, exampleAddressForForeignCrypto, justModelUpdate, maybeUserParameters, noErrors) - -import BigInt exposing (BigInt) -import ChainCmd exposing (ChainCmd) -import CmdUp exposing (CmdUp) -import CommonTypes exposing (..) -import Contracts.Types as CTypes -import Dict exposing (Dict) -import Eth.Types exposing (Address, TxHash, TxReceipt) -import Http -import PaymentMethods exposing (PaymentMethod) -import PriceFetch -import Prices exposing (Price) -import Time -import TokenValue exposing (TokenValue) -import Wallet - - -type alias Model = - { wallet : Wallet.State - , initiatorRole : BuyerOrSeller - , amountInInput : String - , amountIn : Maybe Float - , dhToken : FactoryType - , foreignCrypto : ForeignCrypto - , responderProfitInput : String - , responderProfit : Maybe Float - , amountOutInput : String - , amountOut : Maybe Float - , receiveAddress : String - , showDhTokenDropdown : Bool - , showForeignCryptoDropdown : Bool - , errors : Errors - , txChainStatus : Maybe TxChainStatus - , depositAmount : Maybe BigInt - , allowance : Maybe BigInt - , prices : List ( ForeignCrypto, PriceFetch.PriceData ) - , now : Time.Posix - } - - -type TxChainStatus - = Confirm FactoryType CTypes.CreateParameters String - | ApproveNeedsSig TokenFactoryType - | ApproveMining TokenFactoryType CTypes.CreateParameters TxHash - | CreateNeedsSig FactoryType - | CreateMining FactoryType TxHash - - -type Msg - = UpdateNow Time.Posix - | Refresh - | PricesFetched (Result Http.Error (List ( ForeignCrypto, PriceFetch.PriceAndTimestamp ))) - | AmountInChanged String - | AmountOutChanged String - | ResponderProfitChanged String - | SwapClicked - | TokenTypeClicked - | ChangeTokenType FactoryType - | ForeignCryptoTypeClicked - | ChangeForeignCrypto ForeignCrypto - | ReceiveAddressChanged String - | PlaceOrderClicked FactoryType UserInfo CTypes.UserParameters - | AbortCreate - | ConfirmCreate FactoryType CTypes.CreateParameters BigInt - | AllowanceFetched TokenFactoryType (Result Http.Error BigInt) - | ApproveSigned TokenFactoryType CTypes.CreateParameters (Result String TxHash) - | CreateSigned FactoryType (Result String TxHash) - | CreateMined FactoryType (Result String TxReceipt) - | CmdUp (CmdUp Msg) - | NoOp - - -type alias UpdateResult = - { model : Model - , cmd : Cmd Msg - , chainCmd : ChainCmd Msg - , cmdUps : List (CmdUp Msg) - } - - -justModelUpdate : Model -> UpdateResult -justModelUpdate model = - UpdateResult - model - Cmd.none - ChainCmd.none - [] - - -type alias Errors = - { amountIn : Maybe String - , amountOut : Maybe String - , responderProfit : Maybe String - } - - -noErrors : Errors -noErrors = - Errors Nothing Nothing Nothing - - -exampleAddressForForeignCrypto : ForeignCrypto -> String -exampleAddressForForeignCrypto crypto = - case crypto of - ZEC -> - "zs... / zc... / t..." - - XMR -> - "4..." - - BTC -> - "1... / 3... / bc1..." - - -maybeUserParameters : Model -> Maybe CTypes.UserParameters -maybeUserParameters model = - case model.initiatorRole of - Buyer -> - Maybe.map3 - (\amountIn responderProfit amountOut -> - { initiatorRole = model.initiatorRole - , tradeAmount = TokenValue.fromFloatWithWarning amountOut - , price = Prices.fromForeignCrypto model.foreignCrypto amountIn - , paymentMethods = - [ PaymentMethod - PaymentMethods.Custom - ("Provide your " - ++ foreignCryptoName model.foreignCrypto - ++ " address immediately upon commitment, via chat." - ) - ] - , autorecallInterval = Time.millisToPosix (1000 * 60 * 60 * 24) - , autoabortInterval = Time.millisToPosix (1000 * 60 * 60 * 24) - , autoreleaseInterval = Time.millisToPosix (1000 * 60 * 60 * 24) - } - ) - model.amountIn - model.responderProfit - model.amountOut - - Seller -> - Maybe.map4 - (\amountIn responderProfit receiveAddress amountOut -> - { initiatorRole = model.initiatorRole - , tradeAmount = - (amountIn - (amountIn / 101)) - |> TokenValue.fromFloatWithWarning - , price = Prices.fromForeignCrypto model.foreignCrypto amountOut - , paymentMethods = - [ PaymentMethod - PaymentMethods.Custom - ("Pay to " ++ receiveAddress ++ " immediately upon commitment.") - ] - , autorecallInterval = Time.millisToPosix (1000 * 60 * 60 * 24) - , autoabortInterval = Time.millisToPosix (1000 * 60 * 60 * 1) - , autoreleaseInterval = Time.millisToPosix (1000 * 60 * 60 * 24) - } - ) - model.amountIn - model.responderProfit - (if model.receiveAddress == "" then - Nothing - - else - Just model.receiveAddress - ) - model.amountOut diff --git a/src/CryptoSwap/View.elm b/src/CryptoSwap/View.elm deleted file mode 100644 index cab0731..0000000 --- a/src/CryptoSwap/View.elm +++ /dev/null @@ -1,628 +0,0 @@ -module CryptoSwap.View exposing (root) - -import CmdUp exposing (CmdUp) -import CommonTypes exposing (..) -import Contracts.Types as CTypes -import CryptoSwap.Types exposing (..) -import Element exposing (Element) -import Element.Background -import Element.Border -import Element.Events -import Element.Font -import Element.Input -import Helpers.Element as EH -import Helpers.Eth as EthHelpers -import Html.Attributes -import Images exposing (Image) -import Prices -import Routing exposing (Route) -import TokenValue exposing (TokenValue) -import Wallet - - -root : Model -> ( Element Msg, List (Element Msg) ) -root model = - ( Element.column - [ Element.spacing 30 - , Element.width Element.fill - ] - [ EH.submodelContainer - 1000 - (Just "Trade Dai/xDai for ZEC, XMR, or BTC") - "CRYPTO SWAP" - (Element.column - [ Element.spacing 20 - , Element.padding 15 - , Element.width Element.fill - ] - [ fromToElement model - , Element.row - [ Element.width Element.fill ] - [ Element.el [ Element.width (Element.fillPortion 1) ] Element.none - , Element.el [ Element.width (Element.fillPortion 2) ] <| maybeAddressInput model - , Element.el [ Element.width (Element.fillPortion 1) ] Element.none - ] - , Element.el [ Element.centerX ] (placeOrderButton model) - ] - ) - , Element.link - [ Element.Border.rounded 4 - , Element.width Element.fill - , Element.pointer - , Element.paddingXY 22 15 - , Element.Background.color EH.blue - , Element.Font.color EH.white - , Element.Font.semiBold - , Element.Font.size 20 - , Element.centerX - , Element.width Element.shrink - , Element.height Element.shrink - ] - { url = "https://t.me/daihardexchange_group" - , label = - Element.paragraph - [ Element.Font.center ] - [ Element.text "Join the Telegram Group" ] - } - ] - , [ getModalOrNone model ] - ) - - -fromToElement : Model -> Element Msg -fromToElement model = - Element.column - [ Element.width Element.fill - , Element.spacing 10 - ] - [ Element.row - [ Element.spacing 10 - , Element.width Element.fill - ] - [ EH.withInputHeader - [ Element.alignBottom - , Element.width Element.fill - ] - "From:" - (fromInputBox model) - , swapAndResponderProfitElement model - , EH.withInputHeader - [ Element.alignBottom - , Element.width Element.fill - ] - "To:" - (toInputBox model) - ] - , Element.row - [ Element.width Element.fill - , Element.spacing 10 - ] - [ Element.el - [ Element.width Element.fill ] - (case model.errors.amountIn of - Just errStr -> - Element.el - [ Element.Font.color EH.red - , Element.Font.size 14 - , Element.centerX - ] - (Element.text errStr) - - Nothing -> - Element.none - ) - , Element.el - [ Element.width <| Element.px 24 ] - Element.none - , Element.el - [ Element.width Element.fill ] - (case model.errors.responderProfit of - Just errStr -> - Element.el - [ Element.Font.color EH.red - , Element.Font.size 14 - , Element.centerX - ] - (Element.text errStr) - - Nothing -> - Element.none - ) - ] - ] - - -fromInputBox : Model -> Element Msg -fromInputBox model = - let - tokenSelector = - case model.initiatorRole of - Buyer -> - EH.foreignCryptoTypeSelector model.foreignCrypto model.showForeignCryptoDropdown ForeignCryptoTypeClicked ChangeForeignCrypto - - Seller -> - EH.dhTokenTypeSelector model.dhToken model.showDhTokenDropdown TokenTypeClicked ChangeTokenType - in - EH.roundedComplexInputBox - [ Element.width Element.fill - , Element.centerY - ] - [ tokenSelector ] - { onChange = AmountInChanged - , text = model.amountInInput - , placeholder = - Just <| - Element.Input.placeholder - [ Element.Font.color EH.placeholderTextColor - ] - (Element.text "0") - , label = Element.Input.labelHidden "amount in" - } - [] - - -swapAndResponderProfitElement : Model -> Element Msg -swapAndResponderProfitElement model = - Element.column - [ Element.spacing 5 - , Element.alignBottom - ] - [ responderProfitElement model - , Images.toElement - [ Element.centerX - , Element.width <| Element.px 24 - , Element.pointer - , Element.Events.onClick SwapClicked - , Element.paddingEach - { bottom = 6 - , top = 0 - , right = 0 - , left = 0 - } - ] - Images.swapArrows - ] - - -responderProfitElement : Model -> Element Msg -responderProfitElement model = - Element.row - [ Element.centerX ] - [ Element.row - [ Element.Font.size 16 ] - [ Element.text "-" - , Element.Input.text - [ Element.Border.width 0 - , Element.padding 0 - , Element.height Element.shrink - , Element.width <| Element.px 20 - ] - { onChange = ResponderProfitChanged - , text = model.responderProfitInput - , placeholder = - Nothing - , label = Element.Input.labelHidden "responderProfit" - } - , Element.text "%" - ] - ] - - -toInputBox : Model -> Element Msg -toInputBox model = - let - tokenSelector = - case model.initiatorRole of - Buyer -> - EH.dhTokenTypeSelector model.dhToken model.showDhTokenDropdown TokenTypeClicked ChangeTokenType - - Seller -> - EH.foreignCryptoTypeSelector model.foreignCrypto model.showForeignCryptoDropdown ForeignCryptoTypeClicked ChangeForeignCrypto - in - EH.roundedComplexInputBox - [ Element.spacing 15 - , Element.width Element.fill - , Element.centerY - ] - [ tokenSelector - ] - { onChange = AmountOutChanged - , text = model.amountOutInput - , placeholder = - Just <| - Element.Input.placeholder - [ Element.Font.color EH.placeholderTextColor - ] - (Element.text "0") - , label = Element.Input.labelHidden "amount out" - } - [] - - -maybeAddressInput : Model -> Element Msg -maybeAddressInput model = - case model.initiatorRole of - Buyer -> - Element.none - - Seller -> - EH.withInputHeader - [ Element.alignBottom - , Element.width Element.fill - ] - ("Send " - ++ foreignCryptoName model.foreignCrypto - ++ " To:" - ) - (addressInputElement model.receiveAddress model.foreignCrypto) - - -addressInputElement : String -> ForeignCrypto -> Element Msg -addressInputElement input foreignCrypto = - EH.roundedComplexInputBox - [ Element.width Element.fill - , Element.paddingXY 10 0 - ] - [] - { onChange = ReceiveAddressChanged - , text = input - , placeholder = - Just <| - Element.Input.placeholder - [ Element.Font.color EH.placeholderTextColor ] - (Element.text <| exampleAddressForForeignCrypto foreignCrypto) - , label = Element.Input.labelHidden "receive address" - } - [] - - -placeOrderButton : Model -> Element Msg -placeOrderButton model = - case ( Wallet.userInfo model.wallet, maybeUserParameters model ) of - ( Just userInfo, Just userParameters ) -> - if Wallet.factory model.wallet == Just model.dhToken then - EH.redButton "Place Order" (PlaceOrderClicked model.dhToken userInfo userParameters) - - else - EH.disabledButton "Place Order" - (Just <| - "You must switch your wallet to the " - ++ networkNameForFactory model.dhToken - ++ " network to create a trade with " - ++ tokenUnitName model.dhToken - ) - - ( Nothing, _ ) -> - EH.redButton "Connect to Wallet" (CmdUp CmdUp.Web3Connect) - - ( _, Nothing ) -> - EH.disabledButton "Place Order" Nothing - - -getModalOrNone : Model -> Element Msg -getModalOrNone model = - case model.txChainStatus of - Nothing -> - Element.none - - Just txChainStatus -> - txChainStatusModal txChainStatus model - - -txChainStatusModal : TxChainStatus -> Model -> Element Msg -txChainStatusModal txChainStatus model = - case txChainStatus of - Confirm factoryType createParameters receiveAddress -> - let - ( depositAmountEl, totalBurnableEl, confirmButton ) = - case model.depositAmount of - Just depositAmount -> - let - depositAmountText = - (TokenValue.toConciseString <| TokenValue.tokenValue depositAmount) - ++ " " - ++ tokenUnitName factoryType - - totalBurnableText = - TokenValue.toConciseString - (TokenValue.add - (TokenValue.tokenValue depositAmount) - (CTypes.getResponderDeposit createParameters) - |> TokenValue.add (CTypes.calculateDHFee createParameters) - ) - ++ " " - ++ tokenUnitName factoryType - in - ( blueText depositAmountText - , blueText totalBurnableText - , EH.redButton - ("Yes. Deposit " - ++ depositAmountText - ++ " and open this trade." - ) - (ConfirmCreate factoryType createParameters depositAmount) - ) - - Nothing -> - ( blueText "??" - , blueText "??" - , EH.disabledButton "(loading exact fees...)" Nothing - ) - - feeAmountEl = - blueText <| - TokenValue.toConciseString (CTypes.calculateDHFee createParameters) - ++ " " - ++ tokenUnitName factoryType - - tradeAmountEl = - blueText <| - TokenValue.toConciseString createParameters.tradeAmount - ++ " " - ++ tokenUnitName factoryType - - customizeButton = - EH.blueButton - "Customize Contract Terms" - (CmdUp <| CmdUp.GotoRoute <| Routing.Create (Just <| CTypes.createParametersToUserParameters createParameters)) - - notYetButton = - EH.blueButton - "Not yet. Go back." - AbortCreate - - buyerDepositEl = - blueText <| - TokenValue.toConciseString createParameters.buyerDeposit - ++ " " - ++ tokenUnitName factoryType - - totalReleaseableEl = - blueText - (TokenValue.toConciseString (TokenValue.add createParameters.tradeAmount createParameters.buyerDeposit) - ++ " " - ++ tokenUnitName factoryType - ) - - priceEl = - blueText <| Prices.toString createParameters.price - - emphasizedText = - Element.el - [ Element.Font.bold - , Element.Font.color EH.black - ] - << Element.text - - blueText = - Element.el - [ Element.Font.semiBold - , Element.Font.color EH.blue - ] - << Element.text - in - EH.closeableModal - [] - (Element.column - [ Element.spacing 20 - , Element.padding 20 - , Element.centerX - , Element.height Element.fill - , Element.width Element.fill - , Element.Font.center - ] - [ Element.el - [ Element.Font.size 26 - , Element.Font.semiBold - , Element.centerX - , Element.centerY - ] - (case createParameters.initiatorRole of - Buyer -> - Element.text "Opening a DAIHard Buy Offer" - - Seller -> - Element.text "Opening a DAIHard Sell Offer" - ) - , Element.column - [ Element.spacing 20 - , Element.centerX - , Element.centerY - ] - (List.map - (Element.paragraph - [ Element.centerX - , Element.Font.size 18 - , Element.Font.medium - , Element.Font.color EH.permanentTextColor - ] - ) - (case createParameters.initiatorRole of - Buyer -> - [ [ Element.text "To open this offer, you must deposit " - , depositAmountEl - , Element.text ". Your offer to buy " - , tradeAmountEl - , Element.text " for " - , priceEl - , Element.text " will then be listed on the marketplace." - ] - , [ Element.text "You can abort the offer any time before a Seller commits for a full refund. If no Seller commits within " - , emphasizedText "24 hours" - , Element.text " your offer will automatically expire. In both these cases, the full " - , depositAmountEl - , Element.text " is returned to you." - ] - , [ Element.text "A Seller can commit to the trade by depositing the full " - , tradeAmountEl - , Element.text " into the contract, and is expected to immediately post his " - , blueText <| createParameters.price.symbol - , Element.text " address in the DAIHard chat." - ] - , [ Element.text "You will then have " - , emphasizedText "24 hours" - , Element.text " to send " - , priceEl - , Element.text " to that address and click \"Confirm Payment\"." - ] - , [ Element.text "Once you've confirmed payment, for " - , emphasizedText "24 hours" - , Element.text ", the Seller has the option of burning the trade's full balance of " - , totalBurnableEl - , Element.text ". He is expected to do this if and only if you failed to send the " - , priceEl - , Element.text " to the address he posted." - ] - , [ Element.text "If the Seller has not burned the " - , Element.text <| tokenUnitName factoryType - , Element.text " within 24 hours, " - , totalReleaseableEl - , Element.text " is yours to claim and we take a 1% fee (" - , feeAmountEl - , Element.text ")." - ] - , [ Element.text <| "Are you ready?" ] - ] - ++ (case factoryType of - Token _ -> - [ [ Element.text <| "(Trade creation ususally requires two Metamask signatures. Your " ++ tokenUnitName factoryType ++ " will not be deposited until the final transaction has been mined.)" ] ] - - Native _ -> - [] - ) - - Seller -> - [ [ Element.text "Of your " - , depositAmountEl - , Element.text ", 1% (" - , feeAmountEl - , Element.text ") will be set aside, and " - , tradeAmountEl - , Element.text " will be listed as selling for " - , priceEl - , Element.text "." - ] - , [ Element.text "You can abort the offer at any time before a Buyer commits for a full refund. If no Buyer commits within " - , emphasizedText "24 hours" - , Element.text " your offer will automatically expire. In both these cases, the full " - , depositAmountEl - , Element.text " is returned to you." - ] - , [ Element.text "A Buyer must deposit " - , buyerDepositEl - , Element.text <| " into this contract to commit. He is then expected to send the " - , priceEl - , Element.text <| " to your receive address " - , blueText receiveAddress - , Element.text ", and mark the payment as complete, all within " - , emphasizedText "1 hour." - ] - , [ emphasizedText "Make sure the above address is correct! DAIHard does not do refunds!" ] - , [ Element.text <| "When the Buyer marks the payment complete, for " - , emphasizedText "24 hours" - , Element.text " you will have the option to burn the trade's balance of " - , totalBurnableEl - , Element.text <| ", which you are expected to do if and only if the Buyer has not sent the payment." - ] - , [ Element.text "If the trade has resolved successfully, DAIHard takes the 1% fee of " - , feeAmountEl - , Element.text " set aside earlier." - ] - , [ Element.text <| "Are you ready?" ] - ] - ++ (case factoryType of - Token _ -> - [ [ Element.text <| "(Trade creation ususally requires two Metamask signatures. Your " ++ tokenUnitName factoryType ++ " will not be deposited until the final transaction has been mined.)" ] ] - - Native _ -> - [] - ) - ) - ) - , Element.column - [ Element.centerX - , Element.spacing 15 - ] - ([ confirmButton - , notYetButton - , customizeButton - ] - |> List.map (Element.el [ Element.centerX ]) - ) - ] - ) - NoOp - AbortCreate - - ApproveNeedsSig tokenType -> - Element.el - [ Element.centerX - , Element.centerY - , Element.Events.onClick <| - CmdUp <| - CmdUp.gTag "txChainModal clicked" "misclick" "ApproveNeedsSig" 0 - ] - <| - EH.txProcessModal - [ Element.text "Waiting for user signature for the approve call." - , Element.text "(check Metamask!)" - , Element.text "Note that there will be a second transaction to sign after this." - ] - NoOp - NoOp - - ApproveMining tokenType createParameters txHash -> - Element.el - [ Element.centerX - , Element.centerY - , Element.Events.onClick <| - CmdUp <| - CmdUp.gTag "txChainModal clicked" "misclick" "ApproveMining" 0 - ] - <| - EH.txProcessModal - [ Element.text "Mining the initial approve transaction..." - , Element.newTabLink [ Element.Font.underline, Element.Font.color EH.blue ] - { url = EthHelpers.makeViewTxUrl (Token tokenType) txHash - , label = Element.text "See the transaction on Etherscan" - } - , Element.text "Funds will not leave your wallet until you sign the next transaction." - ] - NoOp - NoOp - - CreateNeedsSig _ -> - Element.el - [ Element.centerX - , Element.centerY - , Element.Events.onClick <| - CmdUp <| - CmdUp.gTag "txChainModal clicked" "misclick" "CreateNeedsSig" 0 - ] - <| - EH.txProcessModal - [ Element.text "Waiting for user signature for the create call." - , Element.text "(check Metamask!)" - ] - NoOp - NoOp - - CreateMining factoryType txHash -> - Element.el - [ Element.centerX - , Element.centerY - , Element.Events.onClick <| - CmdUp <| - CmdUp.gTag "txChainModal clicked" "misclick" "CreateMining" 0 - ] - <| - EH.txProcessModal - [ Element.text "Mining the final create call..." - , Element.newTabLink [ Element.Font.underline, Element.Font.color EH.blue ] - { url = EthHelpers.makeViewTxUrl factoryType txHash - , label = Element.text "See the transaction on Etherscan" - } - , Element.text "You will be redirected when it's mined." - ] - NoOp - NoOp diff --git a/src/Currencies.elm b/src/Currencies.elm new file mode 100644 index 0000000..71ff557 --- /dev/null +++ b/src/Currencies.elm @@ -0,0 +1,206 @@ +module Currencies exposing (Price, Symbol, charAndImage, compare, cryptoImages, encodePrice, fiatChar, fiatCharsAndImages, fiatList, foreignCryptoList, icon, image, priceDecoder, toString, usd) + +import BigInt exposing (BigInt) +import CommonTypes exposing (..) +import Dict exposing (Dict) +import Element exposing (Element) +import FormatFloat exposing (formatFloat) +import Helpers.BigInt as BigIntHelpers +import Images exposing (Image) +import Json.Decode +import Json.Encode +import Maybe.Extra + + +type alias Price = + { symbol : Symbol + , amount : Float + } + + +type alias Symbol = + String + + +usd : Float -> Price +usd = + Price "USD" + + +fiatCharsAndImages : Dict Symbol ( String, Image ) +fiatCharsAndImages = + [ ( "AUD", "$" ) + , ( "CLP", "$" ) + , ( "EUR", "€" ) + , ( "IDR", "Rp" ) + , ( "KRW", "₩" ) + , ( "NZD", "$" ) + , ( "RUB", "₽" ) + , ( "TRY", "₺" ) + , ( "BRL", "R$" ) + , ( "CNY", "¥" ) + , ( "GBP", "£" ) + , ( "ILS", "₪" ) + , ( "MXN", "$" ) + , ( "PHP", "₱" ) + , ( "SEK", "kr" ) + , ( "TWD", "NT$" ) + , ( "CAD", "$" ) + , ( "CZK", "Kč" ) + , ( "HKD", "$" ) + , ( "INR", "₹" ) + , ( "MYR", "RM" ) + , ( "PKR", "₨" ) + , ( "SGD", "$" ) + , ( "USD", "$" ) + , ( "CHF", "Fr" ) + , ( "DKK", "kr" ) + , ( "HUF", "Ft" ) + , ( "JPY", "¥" ) + , ( "NOK", "kr" ) + , ( "PLN", "zł" ) + , ( "THB", "฿" ) + , ( "ZAR", "R" ) + , ( "VND", "₫" ) + ] + |> List.map + (\( typeString, typeChar ) -> + ( typeString + , ( typeChar + , Images.image + { src = "/DAIHard/static/img/currencies/fiat/" ++ typeString ++ ".svg" + , description = typeString + } + ) + ) + ) + |> Dict.fromList + + +cryptoImages : Dict Symbol Image +cryptoImages = + (foreignCryptoList + ++ [ "DAI" + , "XDAI" + ] + ) + |> List.map + (\symbol -> + ( symbol + , Images.image + { src = "/DAIHard/static/img/currencies/crypto/" ++ symbol ++ ".png" + , description = symbol + } + ) + ) + |> Dict.fromList + + +fiatList : List Symbol +fiatList = + Dict.keys fiatCharsAndImages + + +foreignCryptoList : List Symbol +foreignCryptoList = + [ "BTC" + , "ZEC" + , "XMR" + , "DASH" + ] + + + +-- searchPriceTypes : String -> Dict Symbol ( Maybe String, Maybe Image ) +-- searchPriceTypes input = +-- charsAndImages +-- |> Dict.filter +-- (\typeString _ -> +-- String.contains input typeString +-- ) + + +fiatChar : Symbol -> Maybe String +fiatChar symbol = + Dict.get symbol fiatCharsAndImages + |> Maybe.map Tuple.first + + +charAndImage : Symbol -> ( Maybe String, Maybe Image ) +charAndImage symbol = + ( fiatChar symbol + , image symbol + ) + + +image : Symbol -> Maybe Image +image symbol = + if symbol == "DAI" then + Just Images.daiSymbol + + else + Maybe.Extra.or + (Dict.get symbol cryptoImages) + (Dict.get symbol fiatCharsAndImages + |> Maybe.map Tuple.second + ) + + +toString : Price -> String +toString p = + (fiatChar p.symbol + |> Maybe.withDefault "" + ) + ++ (formatFloat 8 p.amount + ++ " " + ++ p.symbol + ) + + +icon : Symbol -> Maybe (Element msg) +icon symbol = + image symbol + |> Maybe.map (Images.toElement [ Element.height <| Element.px 26 ]) + + +compare : Price -> Price -> Order +compare p1 p2 = + if p1.symbol == p2.symbol then + Basics.compare p1.amount p2.amount + + else + Basics.compare p1.symbol p2.symbol + + +encodePrice : Price -> Json.Encode.Value +encodePrice p = + Json.Encode.list identity + [ Json.Encode.string p.symbol + , Json.Encode.float p.amount + ] + + +priceDecoder : Json.Decode.Decoder Price +priceDecoder = + Json.Decode.oneOf + [ Json.Decode.map2 + -- For an older encoding + Price + (Json.Decode.index 0 Json.Decode.string) + (Json.Decode.index 1 BigIntHelpers.decoder + |> Json.Decode.map BigInt.toString + |> Json.Decode.andThen + (\string -> + case String.toFloat string of + Just f -> + Json.Decode.succeed f + + Nothing -> + Json.Decode.fail "Error converting BigInt to float" + ) + ) + , Json.Decode.map2 + Price + (Json.Decode.index 0 Json.Decode.string) + (Json.Decode.index 1 Json.Decode.float) + ] diff --git a/src/FormatFloat.elm b/src/FormatFloat.elm new file mode 100644 index 0000000..f4b044e --- /dev/null +++ b/src/FormatFloat.elm @@ -0,0 +1,30 @@ +module FormatFloat exposing (autoFormatFloat, formatFloat) + +import FormatNumber +import FormatNumber.Humanize exposing (ZeroStrategy(..)) +import FormatNumber.Locales exposing (usLocale) + + +formatFloat : Int -> Float -> String +formatFloat numDecimals = + FormatNumber.humanize + { usLocale + | decimals = numDecimals + } + RemoveZeros + + +autoFormatFloat : Float -> String +autoFormatFloat f = + let + magnitude = + floor <| logBase 10 f + 1 + + numDecimals = + max + (3 - magnitude) + 0 + in + formatFloat + numDecimals + f diff --git a/src/Helpers/Element.elm b/src/Helpers/Element.elm index 2a0550e..e4a9ce8 100644 --- a/src/Helpers/Element.elm +++ b/src/Helpers/Element.elm @@ -1,4 +1,4 @@ -module Helpers.Element exposing (abortedIconColor, activePhaseBackgroundColor, bigTimeUnitElement, black, blue, blueButton, bulletPointString, burnedIconColor, button, closeButton, closeableModal, coloredResponderProfit, comingSoonMsg, coolCurrencyHbreak, currencyLabelColor, currencySelector, daiSymbol, daiSymbolAndLabel, daiValue, daiYellow, darkGray, darkYellow, dhTokenTypeSelector, disabledButton, disabledTextColor, dollarGreen, dropdownSelector, elOnCircle, elapsedBar, elementColorToAvh4Color, ethAddress, etherscanAddressLink, fakeLink, fancyInput, foreignCryptoTypeSelector, green, interval, intervalInput, intervalWithElapsedBar, inverseBlueButton, lightBlue, lightGray, lightRed, maybeErrorElement, mediumGray, modal, niceBottomBorderEl, niceFloatingRow, onClickNoPropagation, orangeButton, pageBackgroundColor, permanentTextColor, placeholderTextColor, pokeButton, price, priceSymbolToImageElement, red, redButton, releasedIconColor, responderProfitFloatToConciseString, responderProfitSymbol, roundBottomCorners, roundTopCorners, roundedComplexInputBox, scrollbarYEl, submodelBackgroundColor, submodelContainer, subtleShadow, testBorderStyles, textInputWithElement, textWithoutTextCursor, txProcessModal, uncoloredResponderProfit, white, withHeader, withInputHeader, withSelectedUnderline, yellow) +module Helpers.Element exposing (abortedIconColor, activePhaseBackgroundColor, addAlpha, basicOpenDropdown, bigTimeUnitElement, black, blue, blueButton, bulletPointString, burnedIconColor, button, closeButton, closeableModal, coloredResponderProfit, comingSoonMsg, coolCurrencyHbreak, currencyLabelColor, daiSymbol, daiSymbolAndLabel, daiValue, daiYellow, darkGray, darkYellow, disabledButton, disabledTextColor, dollarGreen, dropdownSelector, elOnCircle, elapsedBar, elementColorToAvh4Color, ethAddress, etherscanAddressLink, fakeLink, fancyInput, green, interval, intervalInput, intervalWithElapsedBar, inverseBlueButton, lightBlue, lightGray, lightRed, maybeErrorElement, mediumGray, modal, moveToFront, niceBottomBorderEl, niceFloatingRow, onClickNoPropagation, orangeButton, pageBackgroundColor, permanentTextColor, placeholderTextColor, pokeButton, price, redButton, releasedIconColor, responderProfitFloatToConciseString, responderProfitSymbol, roundBottomCorners, roundTopCorners, roundedComplexInputBox, scrollbarYEl, searchableOpenDropdown, simpleSubmodelContainer, softRed, submodelBackgroundColor, submodelContainer, subtleShadow, testBorderStyles, textInputWithElement, textWithoutTextCursor, thinGrayHRuler, txProcessModal, uncoloredResponderProfit, white, withHeader, withInputHeader, withInputHeaderAndMaybeError, withSelectedUnderline, yellow) import Browser.Dom import Collage exposing (Collage) @@ -7,6 +7,7 @@ import Color exposing (Color) import CommonTypes exposing (..) import Config import Css +import Currencies exposing (Price) import Dict import Element exposing (Attribute, Element) import Element.Background @@ -26,7 +27,6 @@ import Json.Decode import List import List.Extra import Maybe.Extra -import Prices exposing (Price) import Task import Time import TokenValue exposing (TokenValue) @@ -44,8 +44,8 @@ white = Element.rgb 1 1 1 -red = - Element.rgb255 244 0 103 +softRed = + Element.rgb255 255 0 110 lightRed = @@ -132,6 +132,18 @@ burnedIconColor = Element.rgb255 255 0 0 +addAlpha : Float -> Element.Color -> Element.Color +addAlpha a color = + let + oldRgba = + Element.toRgb color + in + Element.fromRgb + { oldRgba + | alpha = a + } + + -- LINKS @@ -165,26 +177,15 @@ daiValue tv = price : Price -> Element msg price p = - let - currencyElement = - case Dict.get p.symbol Prices.charsAndImages of - Nothing -> - Element.none - - Just ( _, maybeImage ) -> - Images.toElement - [ Element.height <| Element.px 26 ] - (maybeImage |> Maybe.withDefault Images.none) - in Element.row [ Element.spacing 4 ] - [ currencyElement + [ Currencies.icon p.symbol |> Maybe.withDefault Element.none , Element.el [ Element.Font.color <| Element.rgba 0 0 0 0.5 , Element.Font.medium , Element.width <| Element.px 50 ] (Element.text p.symbol) - , Element.text <| Prices.toString p + , Element.text <| Currencies.toString p ] @@ -207,7 +208,7 @@ coloredResponderProfit upIsGreen responderProfitFloat = green else - red + softRed in Element.el [ Element.Font.color textColor, Element.Font.size 16 ] (Element.text unsignedPercentString) @@ -295,7 +296,7 @@ intervalWithElapsedBar containerAttributes textAttributes ( defaultColor, zeroCo color = if timeLeftRatio < 0.1 then - red + softRed else if timeLeftRatio < 0.2 then yellow @@ -376,20 +377,17 @@ bigTimeUnitElement numDigits color labelString num = (Element.text <| numStr ++ labelString) -priceSymbolToImageElement : Prices.Symbol -> Element msg -priceSymbolToImageElement symbol = - case Dict.get symbol Prices.charsAndImages of - Nothing -> - Element.text "*" - - Just ( _, maybeImage ) -> - Images.toElement [ Element.height <| Element.px 26 ] - (maybeImage - |> Maybe.withDefault Images.none - ) - - +-- priceSymbolToImageElement : Currencies.Symbol -> Element msg +-- priceSymbolToImageElement symbol = +-- case Dict.get symbol Currencies.charsAndImages of +-- Nothing -> +-- Element.text "*" +-- Just ( _, maybeImage ) -> +-- Images.toElement [ Element.height <| Element.px 26 ] +-- (maybeImage +-- |> Maybe.withDefault Images.none +-- ) -- INPUTS @@ -580,78 +578,6 @@ textInputWithElement attributes inputAttributes addedElement labelStr value plac ] -dhTokenTypeSelector : FactoryType -> Bool -> msg -> (FactoryType -> msg) -> Element msg -dhTokenTypeSelector currentToken showDropdown onClickMsg onSelectMsg = - Element.row - [ Element.spacing 8 - , Element.pointer - , onClickNoPropagation onClickMsg - , Element.centerY - , Element.inFront <| - if showDropdown then - Element.el - [ Element.moveUp 15 - , Element.moveLeft 10 - , Element.htmlAttribute <| Html.Attributes.style "position" "fixed" - , Element.htmlAttribute <| Html.Attributes.style "z-index" "1000" - ] - <| - dropdownSelector - ([ Token EthDai, Native XDai ] - |> List.map - (\token -> - ( Element.text (tokenUnitName token) - , onSelectMsg token - ) - ) - ) - - else - Element.none - ] - [ Element.text <| tokenUnitName currentToken - , Images.toElement - [ Element.width <| Element.px 12 ] - Images.downArrow - ] - - -foreignCryptoTypeSelector : ForeignCrypto -> Bool -> msg -> (ForeignCrypto -> msg) -> Element msg -foreignCryptoTypeSelector currentCrypto showDropdown onClickMsg onSelectMsg = - Element.row - [ Element.spacing 8 - , Element.pointer - , onClickNoPropagation onClickMsg - , Element.centerY - , Element.inFront <| - if showDropdown then - Element.el - [ Element.moveUp 15 - , Element.moveLeft 10 - , Element.htmlAttribute <| Html.Attributes.style "position" "fixed" - , Element.htmlAttribute <| Html.Attributes.style "z-index" "1000" - ] - <| - dropdownSelector - (foreignCryptoList - |> List.map - (\crypto -> - ( Element.text (foreignCryptoName crypto) - , onSelectMsg crypto - ) - ) - ) - - else - Element.none - ] - [ Element.text <| foreignCryptoName currentCrypto - , Images.toElement - [ Element.width <| Element.px 12 ] - Images.downArrow - ] - - dropdownSelector : List ( Element msg, msg ) -> Element msg dropdownSelector itemsAndMsgs = Element.column @@ -682,76 +608,6 @@ dropdownSelector itemsAndMsgs = ) -currencySelector : Bool -> String -> msg -> (String -> msg) -> msg -> Element msg -currencySelector showDropdown symbolInput openCurrencySelectorMsg typeStringChangedMsgConstructor flagClickedMsg = - let - maybeCharAndImage = - Dict.get symbolInput Prices.charsAndImages - - inputElement = - Element.Input.text - [ Element.width <| Element.px 80 - , Element.height <| Element.px 40 - , Element.Font.size 24 - , Element.Font.medium - , Element.Border.color lightGray - , onClickNoPropagation openCurrencySelectorMsg - ] - { onChange = String.toUpper >> typeStringChangedMsgConstructor - , text = symbolInput - , placeholder = Nothing - , label = Element.Input.labelHidden "currency type" - } - - dropdownEl = - case ( showDropdown, maybeCharAndImage ) of - ( False, _ ) -> - Element.none - - ( True, Just _ ) -> - Element.none - - ( True, Nothing ) -> - Element.wrappedRow - [ Element.width <| Element.px 350 - , Element.Border.color black - , Element.Border.width 1 - , Element.Background.color white - , Element.padding 10 - , Element.centerX - , Element.htmlAttribute <| Html.Attributes.style "position" "fixed" - , Element.htmlAttribute <| Html.Attributes.style "z-index" "1000" - ] - (Prices.searchPriceTypes symbolInput - |> Dict.toList - |> List.map - (\( symbol, ( _, maybeImage ) ) -> - Element.row - [ Element.width <| Element.px 80 - , Element.spacing 9 - , Element.paddingXY 0 5 - , onClickNoPropagation <| typeStringChangedMsgConstructor symbol - , Element.mouseOver [ Element.Background.color <| Element.rgb 0.8 0.8 1 ] - ] - [ Images.toElement - [ Element.height <| Element.px 26 - ] - (maybeImage |> Maybe.withDefault Images.none) - , Element.el [ Element.Font.size 16, Element.Font.semiBold ] <| textWithoutTextCursor symbol - ] - ) - ) - in - Element.row - [ Element.spacing 4 - , Element.below dropdownEl - ] - [ Element.el [ Element.Events.onClick flagClickedMsg ] - (Prices.getIcon symbolInput |> Maybe.withDefault Element.none) - , inputElement - ] - - -- BUTTONS @@ -776,23 +632,12 @@ button ( bgColor, bgHoverColor, bgPressedColor ) textColor text msg = closeButton : msg -> Element msg closeButton msg = Element.el - [ Element.paddingEach - { top = 0 - , left = 5 - , right = 5 - , bottom = 5 - } + [ Element.padding 10 , Element.Events.onClick msg - , Element.Border.rounded 30 - , Element.Background.color <| Element.rgba 1 1 1 0.4 - , Element.Border.width 1 - , Element.Border.color <| Element.rgba 0 0 0 0.3 , Element.pointer - , Element.Font.size 14 ] - (Element.el - [ Element.Font.color <| Element.rgba 0 0 0 0.7 ] - (Element.text "x") + (Images.toElement [ Element.width <| Element.px 22 ] + Images.closeIcon ) @@ -1116,7 +961,7 @@ comingSoonMsg : List (Attribute msg) -> String -> Element msg comingSoonMsg attributes text = Element.paragraph ([ Element.Font.size 12 - , Element.Font.color red + , Element.Font.color softRed ] ++ attributes ) @@ -1145,7 +990,15 @@ elOnCircle attributes width color el = |> Element.html in Element.el - ([ Element.inFront el ] ++ attributes) + ([ Element.inFront <| + Element.el + [ Element.centerX + , Element.centerY + ] + el + ] + ++ attributes + ) circleElement @@ -1170,7 +1023,7 @@ maybeErrorElement attributes maybeError = Just errorString -> Element.el ([ Element.Border.rounded 5 - , Element.Border.color <| Element.rgb 0.9 0 0 + , Element.Border.color softRed , Element.Border.width 1 , Element.Background.color <| Element.rgb 1 0.4 0.4 , Element.padding 5 @@ -1201,10 +1054,9 @@ coolCurrencyHbreak reversed length = Element.el [ Element.width Element.fill , Element.inFront - (Prices.charsAndImages + (Currencies.fiatCharsAndImages |> Dict.toList |> List.map (Tuple.second >> Tuple.first) - |> Maybe.Extra.values |> List.Extra.unique |> (if reversed then List.reverse @@ -1262,6 +1114,33 @@ scrollbarYEl attrs body = body +simpleSubmodelContainer : Int -> Element msg -> Element msg +simpleSubmodelContainer maxWidth el = + Element.el + [ Element.paddingEach + { top = 60 + , bottom = 40 + , right = 0 + , left = 0 + } + , Element.width Element.fill + ] + <| + Element.el + [ Element.Background.color white + , Element.Border.rounded 8 + , Element.centerX + , Element.width (Element.fill |> Element.maximum maxWidth) + , Element.Border.shadow + { offset = ( 0, 3 ) + , size = 0 + , blur = 20 + , color = Element.rgba 0 0 0 0.06 + } + ] + el + + submodelContainer : Int -> Maybe String -> String -> Element msg -> Element msg submodelContainer maxWidth maybeBigTitleText smallTitleText el = Element.column @@ -1312,7 +1191,7 @@ submodelContainer maxWidth maybeBigTitleText smallTitleText el = <| Element.el [ Element.Font.size 16 - , Element.Font.color red + , Element.Font.color softRed , Element.Font.bold , Element.centerX ] @@ -1324,17 +1203,37 @@ submodelContainer maxWidth maybeBigTitleText smallTitleText el = withInputHeader : List (Attribute msg) -> String -> Element msg -> Element msg withInputHeader attributes titleStr el = + withInputHeaderAndMaybeError attributes titleStr Nothing el + + +withInputHeaderAndMaybeError : List (Attribute msg) -> String -> Maybe String -> Element msg -> Element msg +withInputHeaderAndMaybeError attributes titleStr maybeError el = Element.column (attributes - ++ [ Element.spacing 5 + ++ [ Element.spacing 10 ] ) - [ Element.el - [ Element.Font.size 20 - , Element.paddingXY 20 0 - , Element.Font.color red + [ Element.row + [ Element.spacing 20 + ] + [ Element.el + [ Element.Font.size 18 + , Element.Font.semiBold + , Element.Font.color <| Element.rgb255 1 31 52 + , Element.alignLeft + ] + (Element.text titleStr) + , case maybeError of + Just error -> + Element.el + [ Element.Font.size 12 + , Element.Font.color softRed + ] + (Element.text error) + + Nothing -> + Element.none ] - (Element.text titleStr) , el ] @@ -1365,3 +1264,122 @@ withSelectedUnderline attributes selected el = ] ) el + + +thinGrayHRuler : Element msg +thinGrayHRuler = + Element.el + [ Element.height <| Element.px 1 + , Element.width Element.fill + , Element.Background.color <| Element.rgba 0 0 0 0.2 + ] + Element.none + + +basicOpenDropdown : List (Attribute msg) -> Maybe (Element msg) -> List ( Element msg, msg ) -> Element msg +basicOpenDropdown attributes maybeFirstEl items = + Element.el + (attributes + ++ [ Element.Background.color white + , Element.Border.rounded 6 + , Element.Border.shadow + { offset = ( 0, 3 ) + , size = 0 + , blur = 20 + , color = Element.rgba 0 0 0 0.08 + } + ] + ) + <| + Element.column + [ Element.Background.color lightGray + , Element.spacing 1 + , Element.width Element.fill + , Element.height (Element.shrink |> Element.maximum 340) + ] + [ maybeFirstEl |> Maybe.withDefault Element.none + , Element.column + [ Element.scrollbarY + , Element.width Element.fill + , Element.height Element.fill + , Element.Background.color lightGray + , Element.spacing 1 + ] + (items + |> List.map + (\( el, onClick ) -> + Element.el + [ Element.paddingXY 14 10 + , Element.Background.color white + , Element.width Element.fill + , Element.Events.onClick onClick + , Element.pointer + , Element.mouseOver + [ Element.Background.color <| Element.rgba 0 0 1 0.15 ] + ] + el + ) + ) + ] + + +searchableOpenDropdown : List (Attribute msg) -> String -> List ( Element msg, List String, msg ) -> String -> (String -> msg) -> Element msg +searchableOpenDropdown attributes placeholderText items searchInput searchInputChangedMsg = + let + filteredItems = + if searchInput == "" then + items + |> List.map (\( a, b, c ) -> ( a, c )) + + else + items + |> List.filterMap + (\( el, searchables, onClick ) -> + if List.any (String.contains (String.toLower searchInput)) (List.map String.toLower searchables) then + Just ( el, onClick ) + + else + Nothing + ) + in + basicOpenDropdown + attributes + (Just <| + Element.el + [ Element.width Element.fill + , Element.paddingXY 9 15 + , Element.Background.color white + ] + <| + Element.row + [ Element.width Element.fill + , Element.Background.color <| Element.rgb 0.98 0.98 0.98 + , Element.paddingXY 13 0 + , Element.spacing 13 + , Element.Border.rounded 4 + ] + [ Images.toElement + [ Element.width <| Element.px 21 ] + Images.searchIcon + , Element.Input.text + [ Element.Border.width 0 + , Element.width Element.fill + , Element.Background.color <| Element.rgb 0.98 0.98 0.98 + ] + { onChange = searchInputChangedMsg + , text = searchInput + , placeholder = + Just <| + Element.Input.placeholder + [ Element.Font.color placeholderTextColor ] + (Element.text placeholderText) + , label = Element.Input.labelHidden "search" + } + ] + ) + filteredItems + + +moveToFront : Attribute msg +moveToFront = + Element.htmlAttribute <| Html.Attributes.style "z-index" "1000" diff --git a/src/Helpers/Tuple.elm b/src/Helpers/Tuple.elm index 729b4c0..6a2e19d 100644 --- a/src/Helpers/Tuple.elm +++ b/src/Helpers/Tuple.elm @@ -1,4 +1,4 @@ -module Helpers.Tuple exposing (extractTuple3Result, mapEachTuple3, mapTuple2, mapTuple3, tuple3First, tuple3Second, tuple3Third) +module Helpers.Tuple exposing (extractTuple3Result, mapEachTuple3, mapTuple2, mapTuple3, tuple3First, tuple3MapFirst, tuple3MapSecond, tuple3MapThird, tuple3Second, tuple3Third) mapTuple2 : (a -> b) -> ( a, a ) -> ( b, b ) @@ -40,6 +40,18 @@ mapEachTuple3 f1 f2 f3 ( v1, v2, v3 ) = ) +tuple3MapFirst f = + mapEachTuple3 f identity identity + + +tuple3MapSecond f = + mapEachTuple3 identity f identity + + +tuple3MapThird f = + mapEachTuple3 identity identity f + + tuple3First : ( a, b, c ) -> a tuple3First ( a, b, c ) = a diff --git a/src/Images.elm b/src/Images.elm index a1be2cc..2d793c4 100644 --- a/src/Images.elm +++ b/src/Images.elm @@ -1,4 +1,4 @@ -module Images exposing (Image, aborted, addButton, backButton, burned, chatIcon, closeIcon, committedPhase, daiSymbol, downArrow, fiatBag, flame, image, judgmentPhase, loadingArrows, marginSymbol, none, numberOnCircleEl, openPhase, openWindowIcon, pmBank, pmCash, pmCustom, qmarkCircle, release, releaseWindowIcon, released, stopWhite, swapArrows, toElement, upArrow) +module Images exposing (Image(..), aborted, addButton, backButton, burned, chatIcon, closeIcon, committedPhase, daiSymbol, downArrow, fiatBag, flame, image, judgmentPhase, loadingArrows, marginSymbol, marketplace, myTrades, newTrade, none, numberOnCircleEl, openPhase, openWindowIcon, pmBank, pmCash, pmCustom, qmarkCircle, release, releaseWindowIcon, released, searchIcon, stopWhite, swapArrows, toElement, upArrow, verticalSwapArrows) import Element exposing (Attribute, Element) import Time @@ -16,7 +16,7 @@ toElement : List (Attribute msg) -> Image -> Element msg toElement attributes image_ = case image_ of None -> - Element.none + Element.el attributes Element.none JustImage img -> Element.image attributes img @@ -265,3 +265,43 @@ swapArrows = { src = "/DAIHard/static/img/swap-arrows.svg" , description = "switch order type" } + + +searchIcon : Image +searchIcon = + JustImage + { src = "/DAIHard/static/img/search.svg" + , description = "search" + } + + +verticalSwapArrows : Image +verticalSwapArrows = + JustImage + { src = "/DAIHard/static/img/vertical-swap.svg" + , description = "swap" + } + + +marketplace : Image +marketplace = + JustImage + { src = "/DAIHard/static/img/farmer-s-market-kiosk-1.svg" + , description = "marketplace" + } + + +myTrades : Image +myTrades = + JustImage + { src = "/DAIHard/static/img/diamond.svg" + , description = "myTrades" + } + + +newTrade : Image +newTrade = + JustImage + { src = "/DAIHard/static/img/add-circle-bold.svg" + , description = "newTrade" + } diff --git a/src/Marketplace/State.elm b/src/Marketplace/State.elm index 0fbbe50..fe18e0f 100644 --- a/src/Marketplace/State.elm +++ b/src/Marketplace/State.elm @@ -9,6 +9,7 @@ import CommonTypes exposing (..) import Config import Contracts.Types as CTypes import Contracts.Wrappers +import Currencies exposing (Price) import Eth.Sentry.Event as EventSentry exposing (EventSentry) import Eth.Types exposing (Address) import Filters.State as Filters @@ -20,7 +21,6 @@ import Helpers.Time as TimeHelpers import Marketplace.Types exposing (..) import PaymentMethods exposing (PaymentMethod) import PriceFetch -import Prices exposing (Price) import Routing import String.Extra import Time @@ -30,6 +30,7 @@ import TradeCache.Types as TradeCache exposing (TradeCache) import TradeTable.State as TradeTable import TradeTable.Types as TradeTable import UserNotice as UN +import Utils import Wallet @@ -100,15 +101,24 @@ update msg prevModel = MinDaiChanged input -> justModelUpdate - { prevModel | inputs = prevModel.inputs |> updateMinDaiInput input } + { prevModel | inputs = prevModel.inputs |> updateMinDaiInput (Utils.filterPositiveNumericInput input) } MaxDaiChanged input -> justModelUpdate - { prevModel | inputs = prevModel.inputs |> updateMaxDaiInput input } + { prevModel | inputs = prevModel.inputs |> updateMaxDaiInput (Utils.filterPositiveNumericInput input) } FiatTypeInputChanged input -> justModelUpdate - { prevModel | inputs = prevModel.inputs |> updateFiatTypeInput input } + { prevModel | inputs = prevModel.inputs |> updateFiatTypeInput (String.toUpper input) } + + FiatTypeSelected input -> + justModelUpdate + ({ prevModel + | inputs = prevModel.inputs |> updateFiatTypeInput input + , showCurrencyDropdown = False + } + |> applyInputs + ) ShowCurrencyDropdown flag -> let diff --git a/src/Marketplace/Types.elm b/src/Marketplace/Types.elm index b79f2b4..7117af0 100644 --- a/src/Marketplace/Types.elm +++ b/src/Marketplace/Types.elm @@ -6,6 +6,7 @@ import ChainCmd exposing (ChainCmd) import CmdUp exposing (CmdUp) import CommonTypes exposing (..) import Contracts.Types as CTypes +import Currencies exposing (Price) import Dict exposing (Dict) import Eth.Net import Eth.Sentry.Event as EventSentry exposing (EventSentry) @@ -16,7 +17,6 @@ import Http import Json.Decode import PaymentMethods exposing (PaymentMethod) import PriceFetch -import Prices exposing (Price) import String.Extra import Time import TokenValue exposing (TokenValue) @@ -33,7 +33,7 @@ type alias Model = , tradeTable : TradeTable.Model , filters : Filters.Model , filterFunc : Time.Posix -> CTypes.FullTradeInfo -> Bool - , prices : List ( ForeignCrypto, PriceFetch.PriceData ) + , prices : List ( Currencies.Symbol, PriceFetch.PriceData ) , now : Time.Posix } @@ -41,10 +41,11 @@ type alias Model = type Msg = UpdateNow Time.Posix | Refresh - | PricesFetched (Result Http.Error (List ( ForeignCrypto, PriceFetch.PriceAndTimestamp ))) + | PricesFetched (Result Http.Error (List ( Currencies.Symbol, PriceFetch.PriceAndTimestamp ))) | MinDaiChanged String | MaxDaiChanged String | FiatTypeInputChanged String + | FiatTypeSelected String | PaymentMethodInputChanged String | ShowCurrencyDropdown Bool | FiatTypeLostFocus @@ -78,7 +79,7 @@ justModelUpdate model = type alias SearchInputs = { minDai : String , maxDai : String - , fiatType : Prices.Symbol + , fiatType : Currencies.Symbol , paymentMethod : String , paymentMethodTerms : List String } @@ -96,7 +97,7 @@ noErrors = type alias Query = { dai : TokenRange - , fiatSymbol : Maybe Prices.Symbol + , fiatSymbol : Maybe Currencies.Symbol , paymentMethodTerms : List String } diff --git a/src/Marketplace/View.elm b/src/Marketplace/View.elm index 3a1204d..a8232ff 100644 --- a/src/Marketplace/View.elm +++ b/src/Marketplace/View.elm @@ -5,6 +5,7 @@ import CmdUp exposing (CmdUp) import CommonTypes exposing (..) import Config import Contracts.Types as CTypes +import Currencies exposing (Price) import Element exposing (Attribute, Element) import Element.Background import Element.Border @@ -21,7 +22,6 @@ import List.Extra import Marketplace.Types exposing (..) import Maybe.Extra import PaymentMethods exposing (PaymentMethod) -import Prices exposing (Price) import Time import TradeCache.State as TradeCache import TradeCache.Types as TradeCache exposing (TradeCache) @@ -54,10 +54,8 @@ root time tradeCaches model = (TradeCache.loadingStatus >> (==) TradeCache.AllFetched) tradeCaches in - ( EH.submodelContainer + ( EH.simpleSubmodelContainer 1800 - (Just "Browse Offers. Local or Worldwide, Cash or Crypto.") - "MARKETPLACE" (Element.column [ Element.width Element.fill , Element.height Element.fill @@ -199,7 +197,7 @@ removeSearchTermButton term = , Element.pointer , Element.Events.onClick <| RemoveTerm term , Element.Font.size 10 - , Element.Font.color EH.red + , Element.Font.color EH.softRed ] (Element.text "x") @@ -301,11 +299,11 @@ daiRangeInput minDai maxDai errors = |> withInputHeader "Dai Range" -fiatInput : Bool -> Prices.Symbol -> Errors -> Element Msg +fiatInput : Bool -> Currencies.Symbol -> Errors -> Element Msg fiatInput showTypeDropdown symbol errors = let fiatLabelElement = - Prices.getIcon symbol + Currencies.icon symbol |> Maybe.withDefault Element.none minElement = @@ -319,17 +317,119 @@ fiatInput showTypeDropdown symbol errors = [ fiatLabelElement , Element.el [ Element.Font.size 16, Element.centerY ] (Element.text "max") ] - - flagClickedMsg = - CmdUp <| CmdUp.gTag "click" "misclick" "currency flag" 0 in Element.el - [ Element.alignTop, Element.width <| Element.px 120 ] - (EH.currencySelector showTypeDropdown symbol (ShowCurrencyDropdown True) FiatTypeInputChanged flagClickedMsg - |> withInputHeader "Currency Type" + [ Element.alignTop + , Element.width <| Element.px 120 + , Element.below + (if showTypeDropdown then + currencyTypeDropdown + symbol + FiatTypeInputChanged + FiatTypeSelected + + else + Element.none + ) + ] + (withInputHeader "Currency Type" <| + currencyTypeButton + showTypeDropdown + symbol + (ShowCurrencyDropdown True) ) +currencyTypeButton : Bool -> Currencies.Symbol -> Msg -> Element Msg +currencyTypeButton dropdownOpen symbol onClick = + Element.row + [ Element.Background.color <| Element.rgb 0.98 0.98 0.98 + , Element.height Element.fill + , Element.padding 13 + , Element.spacing 13 + , Element.pointer + , EH.onClickNoPropagation onClick + , Element.Border.width 1 + , Element.Border.color EH.lightGray + ] + [ Currencies.icon symbol + |> Maybe.withDefault Element.none + , Element.text + (symbol + |> (\s -> + if s == "" then + "[any]" + + else + s + ) + ) + , Images.toElement + [ Element.width <| Element.px 12 ] + <| + if dropdownOpen then + Images.upArrow + + else + Images.downArrow + ] + + +currencyTypeDropdown : String -> (String -> Msg) -> (Currencies.Symbol -> Msg) -> Element Msg +currencyTypeDropdown searchInput searchChangedMsg selectedMsg = + EH.modal + (Element.rgba 0 0 0 0.1) + NoOp + (ShowCurrencyDropdown False) + <| + let + currenciesList = + Currencies.fiatList ++ Currencies.foreignCryptoList + in + EH.searchableOpenDropdown + [ Element.width <| Element.px 300 + , Element.moveDown 18 + , Element.alignRight + , EH.moveToFront + ] + "search currencies" + ([ ( Element.el [ Element.width Element.fill ] (Element.text "[any]") + , [] + , selectedMsg "" + ) + ] + ++ (currenciesList + |> List.map + (\fiatSymbol -> + ( Element.row + [ Element.width Element.fill + , Element.spacing 18 + ] + (Maybe.Extra.values + [ Currencies.icon fiatSymbol + , Just <| Element.text fiatSymbol + ] + ) + , Maybe.Extra.values [ Just fiatSymbol, Currencies.fiatChar fiatSymbol ] + , selectedMsg fiatSymbol + ) + ) + ) + ++ (if not (List.member searchInput currenciesList) then + [ ( Element.el [ Element.width Element.fill ] (Element.text <| "\"" ++ searchInput ++ "\"") + , [ searchInput ] + , selectedMsg <| searchInput + ) + ] + + else + [] + ) + ) + searchInput + searchChangedMsg + + paymentMethodsInput : String -> Element Msg paymentMethodsInput searchString = Element.Input.text diff --git a/src/PriceFetch.elm b/src/PriceFetch.elm index 880b4f9..90ade0b 100644 --- a/src/PriceFetch.elm +++ b/src/PriceFetch.elm @@ -1,6 +1,7 @@ module PriceFetch exposing (PriceAndTimestamp, PriceData(..), checkAgainstTime, fetch, getPriceData, priceDataToMaybe) -import CommonTypes exposing (ForeignCrypto, foreignCryptoFromName) +import CommonTypes exposing (..) +import Currencies import Dict exposing (Dict) import Helpers.Time as TimeHelpers import Http @@ -20,7 +21,7 @@ type PriceData | Outdated -fetch : (Result Http.Error (List ( ForeignCrypto, PriceAndTimestamp )) -> msg) -> Cmd msg +fetch : (Result Http.Error (List ( Currencies.Symbol, PriceAndTimestamp )) -> msg) -> Cmd msg fetch msgConstructor = Http.request { method = "GET" @@ -52,17 +53,17 @@ checkAgainstTime now priceAndTimestamp = Ok priceAndTimestamp.price -responseDecoder : Json.Decode.Decoder (List ( ForeignCrypto, PriceAndTimestamp )) +responseDecoder : Json.Decode.Decoder (List ( Currencies.Symbol, PriceAndTimestamp )) responseDecoder = Json.Decode.dict dataToPriceTupleDecoder |> Json.Decode.map Dict.values -dataToPriceTupleDecoder : Json.Decode.Decoder ( ForeignCrypto, PriceAndTimestamp ) +dataToPriceTupleDecoder : Json.Decode.Decoder ( Currencies.Symbol, PriceAndTimestamp ) dataToPriceTupleDecoder = Json.Decode.map2 Tuple.pair - (Json.Decode.field "symbol" foreignCryptoDecoder) + (Json.Decode.field "symbol" Json.Decode.string) (Json.Decode.field "quote" <| Json.Decode.field "USD" <| Json.Decode.map2 @@ -72,20 +73,10 @@ dataToPriceTupleDecoder = ) -foreignCryptoDecoder : Json.Decode.Decoder ForeignCrypto -foreignCryptoDecoder = - Json.Decode.string - |> Json.Decode.andThen - (foreignCryptoFromName - >> Maybe.map Json.Decode.succeed - >> Maybe.withDefault (Json.Decode.fail "") - ) - - -getPriceData : ForeignCrypto -> List ( ForeignCrypto, PriceData ) -> Maybe PriceData -getPriceData crypto prices = +getPriceData : Currencies.Symbol -> List ( Currencies.Symbol, PriceData ) -> Maybe PriceData +getPriceData symbol prices = prices - |> List.filter (Tuple.first >> (==) crypto) + |> List.filter (Tuple.first >> (==) symbol) |> List.head |> Maybe.map Tuple.second diff --git a/src/Prices.elm b/src/Prices.elm deleted file mode 100644 index cc80612..0000000 --- a/src/Prices.elm +++ /dev/null @@ -1,169 +0,0 @@ -module Prices exposing (Price, Symbol, char, charsAndImages, compare, decoder, encode, fromForeignCrypto, getIcon, searchPriceTypes, toString, usd) - -import BigInt exposing (BigInt) -import CommonTypes exposing (..) -import Dict exposing (Dict) -import Element exposing (Element) -import Helpers.BigInt as BigIntHelpers -import Images exposing (Image) -import Json.Decode -import Json.Encode -import Maybe.Extra - - -type alias Price = - { symbol : Symbol - , amount : Float - } - - -type alias Symbol = - String - - -usd : Float -> Price -usd = - Price "USD" - - -charsAndImages : Dict Symbol ( Maybe String, Maybe Image ) -charsAndImages = - [ ( "AUD", Just "$" ) - , ( "CLP", Just "$" ) - , ( "EUR", Just "€" ) - , ( "IDR", Just "Rp" ) - , ( "KRW", Just "₩" ) - , ( "NZD", Just "$" ) - , ( "RUB", Just "₽" ) - , ( "TRY", Just "₺" ) - , ( "BRL", Just "R$" ) - , ( "CNY", Just "¥" ) - , ( "GBP", Just "£" ) - , ( "ILS", Just "₪" ) - , ( "MXN", Just "$" ) - , ( "PHP", Just "₱" ) - , ( "SEK", Just "kr" ) - , ( "TWD", Just "NT$" ) - , ( "CAD", Just "$" ) - , ( "CZK", Just "Kč" ) - , ( "HKD", Just "$" ) - , ( "INR", Just "₹" ) - , ( "MYR", Just "RM" ) - , ( "PKR", Just "₨" ) - , ( "SGD", Just "$" ) - , ( "USD", Just "$" ) - , ( "CHF", Just "Fr" ) - , ( "DKK", Just "kr" ) - , ( "HUF", Just "Ft" ) - , ( "JPY", Just "¥" ) - , ( "NOK", Just "kr" ) - , ( "PLN", Just "zł" ) - , ( "THB", Just "฿" ) - , ( "ZAR", Just "R" ) - , ( "VND", Just "₫" ) - ] - |> List.map - (\( typeString, typeChar ) -> - ( typeString - , ( typeChar - , Just <| - Images.image - { src = "/DAIHard/static/img/currencies/" ++ typeString ++ ".svg" - , description = typeString - } - ) - ) - ) - |> Dict.fromList - - -searchPriceTypes : String -> Dict Symbol ( Maybe String, Maybe Image ) -searchPriceTypes input = - charsAndImages - |> Dict.filter - (\typeString _ -> - String.contains input typeString - ) - - -char : Symbol -> Maybe String -char symbol = - Dict.get symbol charsAndImages - |> Maybe.andThen Tuple.first - - -toString : Price -> String -toString p = - let - numAndSymbol = - String.fromFloat p.amount - ++ " " - ++ p.symbol - in - case Dict.get p.symbol charsAndImages of - Just ( maybeChar, _ ) -> - (maybeChar - |> Maybe.withDefault "" - ) - ++ numAndSymbol - - Nothing -> - numAndSymbol - - -getIcon : Symbol -> Maybe (Element msg) -getIcon symbol = - Dict.get symbol charsAndImages - |> Maybe.map Tuple.second - |> Maybe.Extra.join - |> Maybe.map (Images.toElement [ Element.height <| Element.px 26 ]) - - -compare : Price -> Price -> Order -compare p1 p2 = - if p1.symbol == p2.symbol then - Basics.compare p1.amount p2.amount - - else - Basics.compare p1.symbol p2.symbol - - -encode : Price -> Json.Encode.Value -encode p = - Json.Encode.list identity - [ Json.Encode.string p.symbol - , Json.Encode.float p.amount - ] - - -decoder : Json.Decode.Decoder Price -decoder = - Json.Decode.oneOf - [ Json.Decode.map2 - -- For an older encoding - Price - (Json.Decode.index 0 Json.Decode.string) - (Json.Decode.index 1 BigIntHelpers.decoder - |> Json.Decode.map BigInt.toString - |> Json.Decode.andThen - (\string -> - case String.toFloat string of - Just f -> - Json.Decode.succeed f - - Nothing -> - Json.Decode.fail "Error converting BigInt to float" - ) - ) - , Json.Decode.map2 - Price - (Json.Decode.index 0 Json.Decode.string) - (Json.Decode.index 1 Json.Decode.float) - ] - - -fromForeignCrypto : ForeignCrypto -> Float -> Price -fromForeignCrypto crypto amount = - Price - (foreignCryptoName crypto) - amount diff --git a/src/ResponderProfit.elm b/src/ResponderProfit.elm index 9f99269..9cb9aac 100644 --- a/src/ResponderProfit.elm +++ b/src/ResponderProfit.elm @@ -2,11 +2,12 @@ module ResponderProfit exposing (calculate) import CommonTypes exposing (..) import Contracts.Types as CTypes +import Currencies import PriceFetch import TokenValue -calculate : List ( ForeignCrypto, PriceFetch.PriceData ) -> CTypes.FullTradeInfo -> Maybe Float +calculate : List ( Currencies.Symbol, PriceFetch.PriceData ) -> CTypes.FullTradeInfo -> Maybe Float calculate prices trade = Maybe.map (\foreignCurrencyPrice -> @@ -28,7 +29,6 @@ calculate prices trade = in (responderGain - responderCost) / responderCost ) - (foreignCryptoFromName trade.terms.price.symbol - |> Maybe.andThen (\crypto -> PriceFetch.getPriceData crypto prices) + (PriceFetch.getPriceData trade.terms.price.symbol prices |> Maybe.andThen PriceFetch.priceDataToMaybe ) diff --git a/src/Routing.elm b/src/Routing.elm index 682318a..6b00917 100644 --- a/src/Routing.elm +++ b/src/Routing.elm @@ -11,8 +11,9 @@ import Url.Parser exposing ((), (), Parser) type Route - = CryptoSwap - | Create (Maybe CTypes.UserParameters) + = InitialBlank + | CreateCrypto + | CreateFiat | Trade FactoryType Int | Marketplace | AgentHistory Address @@ -23,9 +24,8 @@ routeParser : Parser (Route -> a) a routeParser = Url.Parser.s "DAIHard" Url.Parser.oneOf - [ Url.Parser.map CryptoSwap Url.Parser.top - , Url.Parser.map CryptoSwap (Url.Parser.s "cryptoswap") - , Url.Parser.map (Create Nothing) (Url.Parser.s "create") + [ Url.Parser.map CreateCrypto (Url.Parser.s "cryptoswap") + , Url.Parser.map CreateFiat Url.Parser.top , Url.Parser.map Trade (Url.Parser.s "trade" factoryParser Url.Parser.int) , Url.Parser.map Marketplace (Url.Parser.s "marketplace") , Url.Parser.map AgentHistory (Url.Parser.s "history" addressParser) @@ -120,11 +120,14 @@ urlToRoute url = routeToString : Route -> String routeToString route = case route of - CryptoSwap -> - Url.Builder.absolute [ "DAIHard", "cryptoswap" ] [] + InitialBlank -> + Url.Builder.absolute [ "DAIHard" ] [] - Create _ -> - Url.Builder.absolute [ "DAIHard", "create" ] [] + CreateCrypto -> + Url.Builder.absolute [ "DAIHard", "create", "crypto" ] [] + + CreateFiat -> + Url.Builder.absolute [ "DAIHard" ] [] Trade factory id -> Url.Builder.absolute [ "DAIHard", "trade", factoryToString factory, String.fromInt id ] [] diff --git a/src/State.elm b/src/State.elm index c141219..931b6b3 100644 --- a/src/State.elm +++ b/src/State.elm @@ -1,7 +1,5 @@ port module State exposing (init, subscriptions, update) --- import CryptoSwap.State - import AgentHistory.State import Array exposing (Array) import BigInt @@ -15,8 +13,7 @@ import CommonTypes exposing (..) import Config import Contracts.Types as CTypes import Create.State -import CryptoSwap.State -import CryptoSwap.Types as CryptoSwap +import Create.Types as Create import Element import Eth.Net import Eth.Sentry.Tx as TxSentry @@ -108,21 +105,15 @@ init flags url key = ) |> Cmd.batch - submodelInitResult = - CryptoSwap.State.init wallet - - ( newTxSentry, chainCmd, chainCmdUserNotices ) = - ChainCmd.execute txSentry (ChainCmd.map CryptoSwapMsg submodelInitResult.chainCmd) - ( model, fromUrlCmd ) = { key = key , wallet = wallet , userAddress = Nothing , time = Time.millisToPosix 0 - , txSentry = newTxSentry + , txSentry = txSentry , tradeCaches = tradeCaches - , submodel = CryptoSwapModel submodelInitResult.model - , currentRoute = Routing.CryptoSwap + , submodel = InitialBlank + , currentRoute = Routing.InitialBlank , userNotices = [] , screenWidth = flags.width } @@ -130,16 +121,12 @@ init flags url key = |> runCmdUps cmdUps in ( model - |> addUserNotices - (userNotices ++ chainCmdUserNotices) + |> addUserNotices userNotices , Cmd.batch [ tcCmd , fromUrlCmd - , Cmd.map CryptoSwapMsg submodelInitResult.cmd - , chainCmd ] ) - |> runCmdUps (List.map (CmdUp.map CryptoSwapMsg) submodelInitResult.cmdUps) type alias EncryptedMessage = @@ -291,6 +278,18 @@ update msg model = , Cmd.none ) + ( _, Wallet.Active userInfo ) -> + let + _ = + Debug.log "User pubkey set, but there's already an active userInfo! Overwriting commpubkey." userInfo + + wallet = + Wallet.Active + { userInfo | commPubkey = commPubkey } + in + { model | wallet = wallet } + |> runCmdDown (CmdDown.UpdateWallet wallet) + ( _, _ ) -> ( model |> addUserNotice @@ -333,33 +332,6 @@ update msg model = _ -> ( model, Cmd.none ) - CryptoSwapMsg cryptoSwapMsg -> - case model.submodel of - CryptoSwapModel cryptoSwapModel -> - let - updateResult = - CryptoSwap.State.update cryptoSwapMsg cryptoSwapModel - - ( newTxSentry, chainCmd, userNotices ) = - ChainCmd.execute model.txSentry (ChainCmd.map CryptoSwapMsg updateResult.chainCmd) - in - ( { model - | submodel = CryptoSwapModel updateResult.model - , txSentry = newTxSentry - } - , Cmd.batch - [ Cmd.map CryptoSwapMsg updateResult.cmd - , chainCmd - ] - ) - |> runCmdUps - (CmdUp.mapList CryptoSwapMsg updateResult.cmdUps - ++ List.map CmdUp.UserNotice userNotices - ) - - _ -> - ( model, Cmd.none ) - TradeMsg tradeMsg -> case model.submodel of TradeModel tradeModel -> @@ -512,12 +484,16 @@ addUserNotices userNotices prevModel = addUserNotice : UserNotice Msg -> Model -> Model addUserNotice userNotice prevModel = - { prevModel - | userNotices = - List.append - prevModel.userNotices - [ userNotice ] - } + if List.member userNotice prevModel.userNotices then + prevModel + + else + { prevModel + | userNotices = + List.append + prevModel.userNotices + [ userNotice ] + } encodeGTag : GTagData -> Json.Decode.Value @@ -551,11 +527,12 @@ updateFromUrl url model = gotoRoute : Routing.Route -> Model -> ( Model, Cmd Msg ) gotoRoute route oldModel = - (case route of - Routing.Create maybeCreateParameters -> + let + initCreate : Create.Mode -> ( Model, Cmd Msg ) + initCreate mode = let updateResult = - Create.State.init oldModel.wallet maybeCreateParameters + Create.State.init oldModel.wallet mode ( newTxSentry, chainCmd, userNotices ) = ChainCmd.execute oldModel.txSentry (ChainCmd.map CreateMsg updateResult.chainCmd) @@ -573,28 +550,18 @@ gotoRoute route oldModel = (CmdUp.mapList CreateMsg updateResult.cmdUps ++ List.map CmdUp.UserNotice userNotices ) + in + (case route of + Routing.InitialBlank -> + ( oldModel + , Cmd.none + ) - Routing.CryptoSwap -> - let - updateResult = - CryptoSwap.State.init oldModel.wallet + Routing.CreateFiat -> + initCreate Create.OffRamp - ( newTxSentry, chainCmd, userNotices ) = - ChainCmd.execute oldModel.txSentry (ChainCmd.map CryptoSwapMsg updateResult.chainCmd) - in - ( { oldModel - | submodel = CryptoSwapModel updateResult.model - , txSentry = newTxSentry - } - , Cmd.batch - [ Cmd.map CryptoSwapMsg updateResult.cmd - , chainCmd - ] - ) - |> runCmdUps - (CmdUp.mapList CryptoSwapMsg updateResult.cmdUps - ++ List.map CmdUp.UserNotice userNotices - ) + Routing.CreateCrypto -> + initCreate (Create.CryptoSwap Seller) Routing.Trade factory id -> let @@ -669,6 +636,9 @@ getTradeFromCaches factory id tradeCaches = runCmdDown : CmdDown.CmdDown -> Model -> ( Model, Cmd Msg ) runCmdDown cmdDown oldModel = case oldModel.submodel of + InitialBlank -> + ( oldModel, Cmd.none ) + CreateModel createModel -> let updateResult = @@ -691,28 +661,6 @@ runCmdDown cmdDown oldModel = ++ List.map CmdUp.UserNotice userNotices ) - CryptoSwapModel cryptoSwapModel -> - let - updateResult = - cryptoSwapModel |> CryptoSwap.State.runCmdDown cmdDown - - ( newTxSentry, chainCmd, userNotices ) = - ChainCmd.execute oldModel.txSentry (ChainCmd.map CryptoSwapMsg updateResult.chainCmd) - in - ( { oldModel - | submodel = CryptoSwapModel updateResult.model - , txSentry = newTxSentry - } - , Cmd.batch - [ Cmd.map CryptoSwapMsg updateResult.cmd - , chainCmd - ] - ) - |> runCmdUps - (CmdUp.mapList CryptoSwapMsg updateResult.cmdUps - ++ List.map CmdUp.UserNotice userNotices - ) - TradeModel tradeModel -> let updateResult = @@ -806,12 +754,12 @@ subscriptions model = submodelSubscriptions : Model -> Sub Msg submodelSubscriptions model = case model.submodel of + InitialBlank -> + Sub.none + CreateModel createModel -> Sub.map CreateMsg <| Create.State.subscriptions createModel - CryptoSwapModel cryptoSwapModel -> - Sub.map CryptoSwapMsg <| CryptoSwap.State.subscriptions cryptoSwapModel - TradeModel tradeModel -> Sub.map TradeMsg <| Trade.State.subscriptions tradeModel diff --git a/src/TokenValue.elm b/src/TokenValue.elm index 00080a5..a7ab827 100644 --- a/src/TokenValue.elm +++ b/src/TokenValue.elm @@ -1,7 +1,8 @@ -module TokenValue exposing (TokenValue, add, compare, decoder, div, divFloatWithWarning, encode, fromFloatWithWarning, fromIntTokenValue, fromString, getEvmValue, getFloatValueWithWarning, isZero, mul, mulFloatWithWarning, sub, toConciseString, toFloatString, tokenValue, zero) +module TokenValue exposing (TokenValue(..), add, compare, decoder, div, divFloatWithWarning, encode, evmValueToTruncatedUserFloatString, evmValueToUserFloatString, fromFloatWithWarning, fromIntTokenValue, fromString, getEvmValue, getFloatValueWithWarning, isZero, mul, mulFloatWithWarning, negate, pullAnyFirstDecimalOffToRight, removeUnnecessaryZerosAndDots, sub, toConciseString, toFloatString, tokenValue, userStringToEvmValue, zero) import BigInt exposing (BigInt) import Config +import FormatFloat exposing (..) import Helpers.BigInt as BigIntHelpers import Json.Decode import Json.Encode @@ -86,48 +87,48 @@ toFloatString maxDigitsAfterDecimal tokens = toConciseString : TokenValue -> String toConciseString tv = - if BigInt.compare (getEvmValue tv) (BigInt.fromInt 0) == LT then - "-" ++ toConciseString (negate tv) - - else - let - hackyRoundFloatString s = - String.toFloat s - |> Maybe.map ((*) 100.0) - |> Maybe.map round - |> Maybe.map toFloat - |> Maybe.map (\f -> f / 100.0) - |> Maybe.map String.fromFloat - |> Maybe.withDefault s - |> String.left 4 - - floatStr = - evmValueToUserFloatString (getEvmValue tv) - in - case String.indexes "." floatStr of - [] -> - floatStr - - [ 0 ] -> - "0" - ++ floatStr - |> hackyRoundFloatString - - [ 1 ] -> - hackyRoundFloatString floatStr - - [ i ] -> - String.toFloat floatStr - |> Maybe.map round - |> Maybe.map String.fromInt - |> Maybe.withDefault (String.left i floatStr) - - _ -> - let - _ = - Debug.log "Error interpreting evmValueToString result. More than one decimal??" - in - "???" + getFloatValueWithWarning tv + |> autoFormatFloat + + + +-- oldToConciseString tv = +-- if BigInt.compare (getEvmValue tv) (BigInt.fromInt 0) == LT then +-- "-" ++ toConciseString (negate tv) +-- else +-- let +-- hackyRoundFloatString s = +-- String.toFloat s +-- |> Maybe.map ((*) 100.0) +-- |> Maybe.map round +-- |> Maybe.map toFloat +-- |> Maybe.map (\f -> f / 100.0) +-- |> Maybe.map String.fromFloat +-- |> Maybe.withDefault s +-- |> String.left 4 +-- floatStr = +-- evmValueToUserFloatString (getEvmValue tv) +-- in +-- case String.indexes "." floatStr of +-- [] -> +-- floatStr +-- [ 0 ] -> +-- "0" +-- ++ floatStr +-- |> hackyRoundFloatString +-- [ 1 ] -> +-- hackyRoundFloatString floatStr +-- [ i ] -> +-- String.toFloat floatStr +-- |> Maybe.map round +-- |> Maybe.map String.fromInt +-- |> Maybe.withDefault (String.left i floatStr) +-- _ -> +-- let +-- _ = +-- Debug.log "Error interpreting evmValueToString result. More than one decimal??" +-- in +-- "???" negate : TokenValue -> TokenValue diff --git a/src/Trade/View.elm b/src/Trade/View.elm index caf0a4d..0d9b557 100644 --- a/src/Trade/View.elm +++ b/src/Trade/View.elm @@ -7,6 +7,7 @@ import Collage.Render import CommonTypes exposing (..) import Config import Contracts.Types as CTypes exposing (FullTradeInfo) +import Currencies exposing (Price) import DateFormat import Element exposing (Attribute, Element) import Element.Background @@ -22,7 +23,6 @@ import Helpers.Eth as EthHelpers import Helpers.Time as TimeHelpers import Images exposing (Image) import PaymentMethods exposing (PaymentMethod) -import Prices exposing (Price) import Time import TokenValue exposing (TokenValue) import Trade.ChatHistory.View as ChatHistory @@ -189,13 +189,13 @@ renderPrice : Price -> Element Msg renderPrice price = Element.row [ Element.spacing 5 ] - [ Prices.getIcon price.symbol + [ Currencies.icon price.symbol |> Maybe.withDefault Element.none , Element.el [ Element.Font.size 24 , Element.Font.medium ] - (Element.text <| Prices.toString price) + (Element.text <| Currencies.toString price) ] @@ -369,7 +369,7 @@ statsElement trade tradeCaches showModal = , Element.el [ Element.Font.size 24 , Element.Font.medium - , Element.Font.color <| EH.burnedIconColor + , Element.Font.color <| EH.lightRed ] (Element.text (String.padLeft 2 '0' <| String.fromInt userStats.numBurns)) ] @@ -708,7 +708,7 @@ phaseStatusElement viewPhase trade currentTime = "Payment Window" CTypes.Judgment -> - "Burn/Release Window" + "Burn Window" CTypes.Closed -> "Closed" @@ -830,7 +830,7 @@ phaseStateElement pState = Active -> Element.el (commonAttributes - ++ [ Element.Font.color <| EH.red ] + ++ [ Element.Font.color <| EH.softRed ] ) (Element.text "Active") @@ -883,13 +883,13 @@ phaseBodyElement viewPhase currentTime trade wallet = Element.el [ Element.Font.color emphasizedColor ] << Element.text scaryText = - Element.el [ Element.Font.color <| Element.rgb 1 0 0 ] << Element.text + Element.el [ Element.Font.color EH.lightRed ] << Element.text tradeAmountString = TokenValue.toConciseString trade.parameters.tradeAmount ++ " " ++ tokenUnitName trade.factory priceString = - Prices.toString trade.terms.price + Currencies.toString trade.terms.price buyerDepositString = TokenValue.toConciseString trade.parameters.buyerDeposit ++ " " ++ tokenUnitName trade.factory @@ -1121,11 +1121,11 @@ phaseBodyElement viewPhase currentTime trade wallet = ( CTypes.Judgment, Just Buyer ) -> ( "Judgement" , List.map makeParagraph - [ [ Element.text "If the Seller confirms receipt of payment, or fails to decide within the Burn/Release Window, the combined balance of " + [ [ Element.text "If the Seller confirms receipt of payment, or makes no decision within the Burn Window, the combined balance of " , emphasizedText tradePlusDepositString - , Element.text " will be released to you." + , Element.text " is yours to claim." ] - , [ Element.text "If they cannot confirm they've received payment from you, they will probably instead " + , [ Element.text "If they cannot confirm they've received payment from you, they will probably choose to " , scaryText "burn the contract's balance of " , emphasizedText tradePlusDepositString , scaryText "." @@ -1153,7 +1153,7 @@ phaseBodyElement viewPhase currentTime trade wallet = , scaryText "burn it all" , Element.text ". You're not getting it back either way, and you wouldn't want the other guy to get it, would you?" ] - , [ Element.text "If you don't decide within the Burn/Release Window, the balance will be automatically released." + , [ Element.text "If you don't decide within the Burn Window, the Buyer will be able to claim the full balance." ] ] ) @@ -1171,9 +1171,9 @@ phaseBodyElement viewPhase currentTime trade wallet = , scaryText "burn it all" , Element.text "." ] - , [ Element.text "If the Seller has not made a decision before the Burn/Release Window expires, the " + , [ Element.text "If the Seller has not made a decision before the Burn Window expires, the " , emphasizedText tradeAmountString - , Element.text " will be automaticall released." + , Element.text " becomes claimable by the Buyer." ] ] ) @@ -1360,7 +1360,7 @@ getModalOrNone model = |> TokenValue.toConciseString priceString = - Prices.toString trade.terms.price + Currencies.toString trade.terms.price daiAmountString = TokenValue.toConciseString trade.parameters.tradeAmount ++ " " ++ tokenUnitName trade.factory diff --git a/src/TradeTable/View.elm b/src/TradeTable/View.elm index fd73894..95a8959 100644 --- a/src/TradeTable/View.elm +++ b/src/TradeTable/View.elm @@ -2,6 +2,7 @@ module TradeTable.View exposing (view) import CommonTypes exposing (..) import Contracts.Types as CTypes +import Currencies import Element exposing (Element) import Element.Background import Element.Border @@ -13,14 +14,13 @@ import Helpers.Time as TimeHelpers import Images exposing (Image) import PaymentMethods exposing (PaymentMethod) import PriceFetch -import Prices import ResponderProfit import Time import TokenValue exposing (TokenValue) import TradeTable.Types exposing (..) -view : Time.Posix -> Model -> List ( ForeignCrypto, PriceFetch.PriceData ) -> List ColType -> List CTypes.FullTradeInfo -> Element Msg +view : Time.Posix -> Model -> List ( Currencies.Symbol, PriceFetch.PriceData ) -> List ColType -> List CTypes.FullTradeInfo -> Element Msg view time model prices colTypes trades = Element.column [ Element.width Element.fill @@ -136,7 +136,7 @@ colTitleEl colType = "Burn Window" -viewTradeRows : Time.Posix -> Model -> List ( ForeignCrypto, PriceFetch.PriceData ) -> List ColType -> List CTypes.FullTradeInfo -> Element Msg +viewTradeRows : Time.Posix -> Model -> List ( Currencies.Symbol, PriceFetch.PriceData ) -> List ColType -> List CTypes.FullTradeInfo -> Element Msg viewTradeRows time model prices colTypes trades = Element.column [ Element.width Element.fill @@ -153,7 +153,7 @@ viewTradeRows time model prices colTypes trades = ) -viewTradeRow : Time.Posix -> List ( ForeignCrypto, PriceFetch.PriceData ) -> List ColType -> CTypes.FullTradeInfo -> Element Msg +viewTradeRow : Time.Posix -> List ( Currencies.Symbol, PriceFetch.PriceData ) -> List ColType -> CTypes.FullTradeInfo -> Element Msg viewTradeRow time prices colTypes trade = Element.column [ Element.width Element.fill @@ -184,7 +184,7 @@ viewPaymentMethods paymentMethods = |> Maybe.withDefault Element.none -viewTradeCell : Time.Posix -> List ( ForeignCrypto, PriceFetch.PriceData ) -> ColType -> CTypes.FullTradeInfo -> Element Msg +viewTradeCell : Time.Posix -> List ( Currencies.Symbol, PriceFetch.PriceData ) -> ColType -> CTypes.FullTradeInfo -> Element Msg viewTradeCell time prices colType trade = cellMaker (colTypePortion colType) @@ -202,7 +202,7 @@ viewTradeCell time prices colType trade = let baseIntervalColor = if TimeHelpers.getRatio (Tuple.first timeoutInfo) (Tuple.second timeoutInfo) < 0.05 then - EH.red + EH.softRed else EH.black @@ -234,7 +234,7 @@ viewTradeCell time prices colType trade = let baseIntervalColor = if TimeHelpers.getRatio (Tuple.first timeoutInfo) (Tuple.second timeoutInfo) < 0.05 then - EH.red + EH.softRed else EH.black @@ -249,7 +249,7 @@ viewTradeCell time prices colType trade = EH.intervalWithElapsedBar [ Element.width Element.fill ] [ Element.Font.size 16 ] - ( EH.red, EH.lightGray ) + ( EH.softRed, EH.lightGray ) ( Time.millisToPosix 0, totalInterval ) _ -> @@ -285,7 +285,7 @@ viewTradeCell time prices colType trade = lowValColor = case trade.parameters.initiatorRole of Seller -> - EH.red + EH.softRed Buyer -> EH.green @@ -311,7 +311,7 @@ viewTradeCell time prices colType trade = EH.green Buyer -> - EH.red + EH.softRed baseColor = if Time.posixToMillis trade.parameters.autoabortInterval < (1000 * 60 * 60 * 6) then @@ -344,7 +344,7 @@ cellMaker portion cellElement = cellElement -sortByFunc : List ( ForeignCrypto, PriceFetch.PriceData ) -> ( ColType, Ordering ) -> (CTypes.FullTradeInfo -> CTypes.FullTradeInfo -> Order) +sortByFunc : List ( Currencies.Symbol, PriceFetch.PriceData ) -> ( ColType, Ordering ) -> (CTypes.FullTradeInfo -> CTypes.FullTradeInfo -> Order) sortByFunc prices ( sortCol, ordering ) = (case sortCol of Phase -> @@ -362,7 +362,7 @@ sortByFunc prices ( sortCol, ordering ) = \a b -> TokenValue.compare a.parameters.tradeAmount b.parameters.tradeAmount Price -> - \a b -> Prices.compare a.terms.price b.terms.price + \a b -> Currencies.compare a.terms.price b.terms.price ResponderProfit -> \a b -> diff --git a/src/Types.elm b/src/Types.elm index 30a9cc5..64e3b06 100644 --- a/src/Types.elm +++ b/src/Types.elm @@ -9,7 +9,6 @@ import CmdDown import CmdUp import CommonTypes exposing (..) import Create.Types -import CryptoSwap.Types import Eth.Net import Eth.Sentry.Tx as TxSentry exposing (TxSentry) import Eth.Sentry.Wallet as WalletSentry exposing (WalletSentry) @@ -48,8 +47,8 @@ type alias Model = type Submodel - = CreateModel Create.Types.Model - | CryptoSwapModel CryptoSwap.Types.Model + = InitialBlank + | CreateModel Create.Types.Model | TradeModel Trade.Types.Model | MarketplaceModel Marketplace.Types.Model | AgentHistoryModel AgentHistory.Types.Model @@ -66,7 +65,6 @@ type Msg | TxSentryMsg TxSentry.Msg | UserPubkeySet Json.Decode.Value | CreateMsg Create.Types.Msg - | CryptoSwapMsg CryptoSwap.Types.Msg | TradeCacheMsg Int TradeCache.Msg | TradeMsg Trade.Types.Msg | MarketplaceMsg Marketplace.Types.Msg diff --git a/src/Utils.elm b/src/Utils.elm new file mode 100644 index 0000000..2e4c611 --- /dev/null +++ b/src/Utils.elm @@ -0,0 +1,9 @@ +module Utils exposing (filterPositiveNumericInput) + + +filterPositiveNumericInput : String -> String +filterPositiveNumericInput = + String.filter + (\c -> + List.any ((==) c) [ '1', '2', '3', '4', '5', '6', '7', '8', '9', '0', '.' ] + ) diff --git a/src/View.elm b/src/View.elm index d7432db..299220b 100644 --- a/src/View.elm +++ b/src/View.elm @@ -6,7 +6,7 @@ import CommonTypes exposing (..) import Config import Contracts.Types as CTypes import Create.View -import CryptoSwap.View +import Currencies import Dict import Element exposing (Attribute, Element) import Element.Background @@ -16,9 +16,9 @@ import Element.Font import Element.Input import Helpers.Element as EH import Helpers.Tuple exposing (mapTuple2) +import Images exposing (Image) import Marketplace.Types import Marketplace.View -import Prices import Routing import Trade.View import Types exposing (..) @@ -86,29 +86,20 @@ headerBackground : Element Msg headerBackground = let bottomBackgroundColor = - Element.rgb255 255 144 0 + Element.rgb255 10 33 108 + + headerColor = + Element.rgb255 7 27 92 in Element.el [ Element.width Element.fill - , Element.height <| Element.px 400 + , Element.height <| Element.px 600 , Element.Background.color bottomBackgroundColor - , Element.Border.shadow - { offset = ( 0, 0 ) - , size = 30 - , blur = 30 - , color = bottomBackgroundColor - } , Element.inFront <| Element.el [ Element.width Element.fill , Element.height <| Element.px 80 - , Element.Background.color <| Element.rgb255 10 33 108 - , Element.Border.shadow - { offset = ( 0, 0 ) - , size = 8 - , blur = 20 - , color = Element.rgba 0 0 0 0.4 - } + , Element.Background.color headerColor ] Element.none ] @@ -123,26 +114,7 @@ headerContent model = , Element.paddingXY 30 17 ] [ headerLink - "Crypto Swap" - (GotoRoute <| Routing.CryptoSwap) - (case model.submodel of - CryptoSwapModel _ -> - Active - - _ -> - Normal - ) - , headerLink - "Custom Trade" - (GotoRoute <| Routing.Create Nothing) - (case model.submodel of - CreateModel _ -> - Active - - _ -> - Normal - ) - , headerLink + (Just Images.marketplace) "Marketplace" (GotoRoute Routing.Marketplace) (case model.submodel of @@ -155,6 +127,7 @@ headerContent model = , case Wallet.userInfo model.wallet of Just userInfo -> headerLink + (Just Images.myTrades) "My Trades" (GotoRoute <| Routing.AgentHistory userInfo.address) (case model.submodel of @@ -171,9 +144,21 @@ headerContent model = Nothing -> headerLink + Nothing "Connect to Wallet" ConnectToWeb3 Important + , headerLink + (Just Images.newTrade) + "Create New Trade" + (GotoRoute <| Routing.CreateFiat) + (case model.submodel of + CreateModel _ -> + Active + + _ -> + Normal + ) , Element.column [ Element.alignRight , Element.spacing 0 @@ -190,8 +175,8 @@ type HeaderLinkStyle | Important -headerLink : String -> Msg -> HeaderLinkStyle -> Element Msg -headerLink title onClick style = +headerLink : Maybe Image -> String -> Msg -> HeaderLinkStyle -> Element Msg +headerLink maybeIcon title onClick style = let extraStyles = case style of @@ -200,25 +185,38 @@ headerLink title onClick style = Active -> [ Element.Border.rounded 4 - , Element.Background.color <| Element.rgb 0 0 1 + , Element.Background.color <| Element.rgb255 2 172 214 ] Important -> [ Element.Border.rounded 4 - , Element.Background.color <| Element.rgb 0.9 0 0 + , Element.Background.color EH.softRed ] in - Element.el + Element.row ([ Element.paddingXY 23 12 - , Element.Font.size 22 + , Element.Font.size 21 , Element.Font.semiBold , Element.Font.color EH.white , Element.pointer , Element.Events.onClick onClick + , Element.spacing 13 ] ++ extraStyles ) - (Element.text title) + [ Maybe.map + (Images.toElement + [ Element.height <| Element.px 26 ] + ) + maybeIcon + |> Maybe.withDefault Element.none + , Element.el + [ Element.centerY + , Element.height <| Element.px 26 + ] + <| + Element.text title + ] logoElement : Element Msg @@ -229,11 +227,11 @@ logoElement = , Element.Font.bold , Element.centerX , Element.pointer - , Element.Events.onClick <| GotoRoute Routing.CryptoSwap + , Element.Events.onClick <| GotoRoute Routing.CreateFiat ] (Element.paragraph [] [ Element.text "DAI" - , Element.el [ Element.Font.color EH.red ] <| Element.text "Hard" + , Element.el [ Element.Font.color EH.softRed ] <| Element.text "Hard" ] ) @@ -369,18 +367,17 @@ submodelElementAndModal screenWidth model = let ( submodelEl, modalEls ) = case model.submodel of + InitialBlank -> + ( Element.none + , [] + ) + CreateModel createModel -> Create.View.root createModel |> Tuple.mapBoth (Element.map CreateMsg) (List.map (Element.map CreateMsg)) - CryptoSwapModel cryptoSwapModel -> - CryptoSwap.View.root cryptoSwapModel - |> Tuple.mapBoth - (Element.map CryptoSwapMsg) - (List.map (Element.map CryptoSwapMsg)) - TradeModel tradeModel -> Trade.View.root screenWidth model.time model.tradeCaches tradeModel |> Tuple.mapBoth