text: // Generated by purs bundle 0.13.8
  var PS = {};
  (function($PS) {
    // Generated by purs version 0.13.8
    "use strict";
    $PS["Control.Semigroupoid"] = $PS["Control.Semigroupoid"] || {};
    var exports = $PS["Control.Semigroupoid"];
    var Semigroupoid = function (compose) {
        this.compose = compose;
    };
    var semigroupoidFn = new Semigroupoid(function (f) {
        return function (g) {
            return function (x) {
                return f(g(x));
            };
        };
    });
    var compose = function (dict) {
        return dict.compose;
    };
    exports["compose"] = compose;
    exports["semigroupoidFn"] = semigroupoidFn;
  })(PS);
  (function($PS) {
    // Generated by purs version 0.13.8
    "use strict";
    $PS["Control.Category"] = $PS["Control.Category"] || {};
    var exports = $PS["Control.Category"];
    var Control_Semigroupoid = $PS["Control.Semigroupoid"];                
    var Category = function (Semigroupoid0, identity) {
        this.Semigroupoid0 = Semigroupoid0;
        this.identity = identity;
    };
    var identity = function (dict) {
        return dict.identity;
    };
    var categoryFn = new Category(function () {
        return Control_Semigroupoid.semigroupoidFn;
    }, function (x) {
        return x;
    });
    exports["identity"] = identity;
    exports["categoryFn"] = categoryFn;
  })(PS);
  (function($PS) {
    // Generated by purs version 0.13.8
    "use strict";
    $PS["Concur.Core.LiftWidget"] = $PS["Concur.Core.LiftWidget"] || {};
    var exports = $PS["Concur.Core.LiftWidget"];
    var Control_Category = $PS["Control.Category"];                                    
    var LiftWidget = function (liftWidget) {
        this.liftWidget = liftWidget;
    };
    var widgetLiftWidget = new LiftWidget(Control_Category.identity(Control_Category.categoryFn));
    var liftWidget = function (dict) {
        return dict.liftWidget;
    };
    exports["liftWidget"] = liftWidget;
    exports["widgetLiftWidget"] = widgetLiftWidget;
  })(PS);
  (function($PS) {
    // Generated by purs version 0.13.8
    "use strict";
    $PS["Control.Alt"] = $PS["Control.Alt"] || {};
    var exports = $PS["Control.Alt"];                          
    var Alt = function (Functor0, alt) {
        this.Functor0 = Functor0;
        this.alt = alt;
    };                                                       
    var alt = function (dict) {
        return dict.alt;
    };
    exports["Alt"] = Alt;
    exports["alt"] = alt;
  })(PS);
  (function($PS) {
    // Generated by purs version 0.13.8
    "use strict";
    $PS["Control.Alternative"] = $PS["Control.Alternative"] || {};
    var exports = $PS["Control.Alternative"];              
    var Alternative = function (Applicative0, Plus1) {
        this.Applicative0 = Applicative0;
        this.Plus1 = Plus1;
    };
    exports["Alternative"] = Alternative;
  })(PS);
  (function($PS) {
    // Generated by purs version 0.13.8
    "use strict";
    $PS["Data.Function"] = $PS["Data.Function"] || {};
    var exports = $PS["Data.Function"];
    var flip = function (f) {
        return function (b) {
            return function (a) {
                return f(a)(b);
            };
        };
    };
    var $$const = function (a) {
        return function (v) {
            return a;
        };
    };
    exports["flip"] = flip;
    exports["const"] = $$const;
  })(PS);
  (function(exports) {
    "use strict";
  
    exports.arrayMap = function (f) {
      return function (arr) {
        var l = arr.length;
        var result = new Array(l);
        for (var i = 0; i < l; i++) {
          result[i] = f(arr[i]);
        }
        return result;
      };
    };
  })(PS["Data.Functor"] = PS["Data.Functor"] || {});
  (function(exports) {
    "use strict";
  
    exports.unit = {};
  })(PS["Data.Unit"] = PS["Data.Unit"] || {});
  (function($PS) {
    // Generated by purs version 0.13.8
    "use strict";
    $PS["Data.Unit"] = $PS["Data.Unit"] || {};
    var exports = $PS["Data.Unit"];
    var $foreign = $PS["Data.Unit"];
    exports["unit"] = $foreign.unit;
  })(PS);
  (function($PS) {
    // Generated by purs version 0.13.8
    "use strict";
    $PS["Data.Functor"] = $PS["Data.Functor"] || {};
    var exports = $PS["Data.Functor"];
    var $foreign = $PS["Data.Functor"];
    var Control_Semigroupoid = $PS["Control.Semigroupoid"];
    var Data_Function = $PS["Data.Function"];
    var Data_Unit = $PS["Data.Unit"];                
    var Functor = function (map) {
        this.map = map;
    };
    var map = function (dict) {
        return dict.map;
    };
    var $$void = function (dictFunctor) {
        return map(dictFunctor)(Data_Function["const"](Data_Unit.unit));
    };
    var voidRight = function (dictFunctor) {
        return function (x) {
            return map(dictFunctor)(Data_Function["const"](x));
        };
    };
    var functorFn = new Functor(Control_Semigroupoid.compose(Control_Semigroupoid.semigroupoidFn));
    var functorArray = new Functor($foreign.arrayMap);
    exports["Functor"] = Functor;
    exports["map"] = map;
    exports["void"] = $$void;
    exports["voidRight"] = voidRight;
    exports["functorFn"] = functorFn;
    exports["functorArray"] = functorArray;
  })(PS);
  (function($PS) {
    // Generated by purs version 0.13.8
    "use strict";
    $PS["Control.Apply"] = $PS["Control.Apply"] || {};
    var exports = $PS["Control.Apply"];
    var Control_Category = $PS["Control.Category"];
    var Data_Function = $PS["Data.Function"];
    var Data_Functor = $PS["Data.Functor"];                
    var Apply = function (Functor0, apply) {
        this.Functor0 = Functor0;
        this.apply = apply;
    };                      
    var apply = function (dict) {
        return dict.apply;
    };
    var applySecond = function (dictApply) {
        return function (a) {
            return function (b) {
                return apply(dictApply)(Data_Functor.map(dictApply.Functor0())(Data_Function["const"](Control_Category.identity(Control_Category.categoryFn)))(a))(b);
            };
        };
    };
    exports["Apply"] = Apply;
    exports["apply"] = apply;
    exports["applySecond"] = applySecond;
  })(PS);
  (function($PS) {
    // Generated by purs version 0.13.8
    "use strict";
    $PS["Control.Applicative"] = $PS["Control.Applicative"] || {};
    var exports = $PS["Control.Applicative"];
    var Control_Apply = $PS["Control.Apply"];        
    var Applicative = function (Apply0, pure) {
        this.Apply0 = Apply0;
        this.pure = pure;
    };
    var pure = function (dict) {
        return dict.pure;
    };
    var liftA1 = function (dictApplicative) {
        return function (f) {
            return function (a) {
                return Control_Apply.apply(dictApplicative.Apply0())(pure(dictApplicative)(f))(a);
            };
        };
    };
    exports["Applicative"] = Applicative;
    exports["pure"] = pure;
    exports["liftA1"] = liftA1;
  })(PS);
  (function($PS) {
    // Generated by purs version 0.13.8
    "use strict";
    $PS["Control.Bind"] = $PS["Control.Bind"] || {};
    var exports = $PS["Control.Bind"];
    var Data_Function = $PS["Data.Function"];                
    var Discard = function (discard) {
        this.discard = discard;
    };
    var Bind = function (Apply0, bind) {
        this.Apply0 = Apply0;
        this.bind = bind;
    };
    var discard = function (dict) {
        return dict.discard;
    };                     
    var bind = function (dict) {
        return dict.bind;
    };
    var bindFlipped = function (dictBind) {
        return Data_Function.flip(bind(dictBind));
    };
    var composeKleisliFlipped = function (dictBind) {
        return function (f) {
            return function (g) {
                return function (a) {
                    return bindFlipped(dictBind)(f)(g(a));
                };
            };
        };
    };
    var discardUnit = new Discard(function (dictBind) {
        return bind(dictBind);
    });
    exports["Bind"] = Bind;
    exports["bind"] = bind;
    exports["bindFlipped"] = bindFlipped;
    exports["discard"] = discard;
    exports["composeKleisliFlipped"] = composeKleisliFlipped;
    exports["discardUnit"] = discardUnit;
  })(PS);
  (function($PS) {
    // Generated by purs version 0.13.8
    "use strict";
    $PS["Control.Monad"] = $PS["Control.Monad"] || {};
    var exports = $PS["Control.Monad"];
    var Control_Applicative = $PS["Control.Applicative"];
    var Control_Bind = $PS["Control.Bind"];                
    var Monad = function (Applicative0, Bind1) {
        this.Applicative0 = Applicative0;
        this.Bind1 = Bind1;
    };
    var ap = function (dictMonad) {
        return function (f) {
            return function (a) {
                return Control_Bind.bind(dictMonad.Bind1())(f)(function (f$prime) {
                    return Control_Bind.bind(dictMonad.Bind1())(a)(function (a$prime) {
                        return Control_Applicative.pure(dictMonad.Applicative0())(f$prime(a$prime));
                    });
                });
            };
        };
    };
    exports["Monad"] = Monad;
    exports["ap"] = ap;
  })(PS);
  (function(exports) {
    "use strict";
  
    exports.foldrArray = function (f) {
      return function (init) {
        return function (xs) {
          var acc = init;
          var len = xs.length;
          for (var i = len - 1; i >= 0; i--) {
            acc = f(xs[i])(acc);
          }
          return acc;
        };
      };
    };
  
    exports.foldlArray = function (f) {
      return function (init) {
        return function (xs) {
          var acc = init;
          var len = xs.length;
          for (var i = 0; i < len; i++) {
            acc = f(acc)(xs[i]);
          }
          return acc;
        };
      };
    };
  })(PS["Data.Foldable"] = PS["Data.Foldable"] || {});
  (function(exports) {
    "use strict";
  
    exports.concatString = function (s1) {
      return function (s2) {
        return s1 + s2;
      };
    };
  
    exports.concatArray = function (xs) {
      return function (ys) {
        if (xs.length === 0) return ys;
        if (ys.length === 0) return xs;
        return xs.concat(ys);
      };
    };
  })(PS["Data.Semigroup"] = PS["Data.Semigroup"] || {});
  (function($PS) {
    // Generated by purs version 0.13.8
    "use strict";
    $PS["Data.Semigroup"] = $PS["Data.Semigroup"] || {};
    var exports = $PS["Data.Semigroup"];
    var $foreign = $PS["Data.Semigroup"];
    var Data_Unit = $PS["Data.Unit"];
    var Semigroup = function (append) {
        this.append = append;
    }; 
    var semigroupUnit = new Semigroup(function (v) {
        return function (v1) {
            return Data_Unit.unit;
        };
    });
    var semigroupString = new Semigroup($foreign.concatString);
    var semigroupArray = new Semigroup($foreign.concatArray);
    var append = function (dict) {
        return dict.append;
    };
    exports["Semigroup"] = Semigroup;
    exports["append"] = append;
    exports["semigroupString"] = semigroupString;
    exports["semigroupUnit"] = semigroupUnit;
    exports["semigroupArray"] = semigroupArray;
  })(PS);
  (function($PS) {
    // Generated by purs version 0.13.8
    "use strict";
    $PS["Data.Monoid"] = $PS["Data.Monoid"] || {};
    var exports = $PS["Data.Monoid"];
    var Data_Semigroup = $PS["Data.Semigroup"];
    var Data_Unit = $PS["Data.Unit"];
    var Monoid = function (Semigroup0, mempty) {
        this.Semigroup0 = Semigroup0;
        this.mempty = mempty;
    };
    var monoidUnit = new Monoid(function () {
        return Data_Semigroup.semigroupUnit;
    }, Data_Unit.unit);
    var monoidString = new Monoid(function () {
        return Data_Semigroup.semigroupString;
    }, "");                    
    var monoidArray = new Monoid(function () {
        return Data_Semigroup.semigroupArray;
    }, [  ]);
    var mempty = function (dict) {
        return dict.mempty;
    };
    exports["Monoid"] = Monoid;
    exports["mempty"] = mempty;
    exports["monoidUnit"] = monoidUnit;
    exports["monoidString"] = monoidString;
    exports["monoidArray"] = monoidArray;
  })(PS);
  (function($PS) {
    // Generated by purs version 0.13.8
    "use strict";
    $PS["Data.Foldable"] = $PS["Data.Foldable"] || {};
    var exports = $PS["Data.Foldable"];
    var $foreign = $PS["Data.Foldable"];
    var Control_Applicative = $PS["Control.Applicative"];
    var Control_Apply = $PS["Control.Apply"];
    var Control_Category = $PS["Control.Category"];
    var Data_Monoid = $PS["Data.Monoid"];
    var Data_Semigroup = $PS["Data.Semigroup"];
    var Data_Unit = $PS["Data.Unit"];                
    var Foldable = function (foldMap, foldl, foldr) {
        this.foldMap = foldMap;
        this.foldl = foldl;
        this.foldr = foldr;
    };
    var foldr = function (dict) {
        return dict.foldr;
    };
    var traverse_ = function (dictApplicative) {
        return function (dictFoldable) {
            return function (f) {
                return foldr(dictFoldable)((function () {
                    var $197 = Control_Apply.applySecond(dictApplicative.Apply0());
                    return function ($198) {
                        return $197(f($198));
                    };
                })())(Control_Applicative.pure(dictApplicative)(Data_Unit.unit));
            };
        };
    };
    var foldl = function (dict) {
        return dict.foldl;
    }; 
    var foldMapDefaultR = function (dictFoldable) {
        return function (dictMonoid) {
            return function (f) {
                return foldr(dictFoldable)(function (x) {
                    return function (acc) {
                        return Data_Semigroup.append(dictMonoid.Semigroup0())(f(x))(acc);
                    };
                })(Data_Monoid.mempty(dictMonoid));
            };
        };
    };
    var foldableArray = new Foldable(function (dictMonoid) {
        return foldMapDefaultR(foldableArray)(dictMonoid);
    }, $foreign.foldlArray, $foreign.foldrArray);
    var foldMap = function (dict) {
        return dict.foldMap;
    };
    var fold = function (dictFoldable) {
        return function (dictMonoid) {
            return foldMap(dictFoldable)(dictMonoid)(Control_Category.identity(Control_Category.categoryFn));
        };
    };
    exports["Foldable"] = Foldable;
    exports["foldr"] = foldr;
    exports["foldl"] = foldl;
    exports["foldMap"] = foldMap;
    exports["fold"] = fold;
    exports["traverse_"] = traverse_;
    exports["foldableArray"] = foldableArray;
  })(PS);
  (function($PS) {
    // Generated by purs version 0.13.8
    "use strict";
    $PS["Data.Maybe"] = $PS["Data.Maybe"] || {};
    var exports = $PS["Data.Maybe"];
    var Control_Apply = $PS["Control.Apply"];
    var Control_Bind = $PS["Control.Bind"];
    var Control_Category = $PS["Control.Category"];
    var Data_Function = $PS["Data.Function"];
    var Data_Functor = $PS["Data.Functor"];          
    var Nothing = (function () {
        function Nothing() {
  
        };
        Nothing.value = new Nothing();
        return Nothing;
    })();
    var Just = (function () {
        function Just(value0) {
            this.value0 = value0;
        };
        Just.create = function (value0) {
            return new Just(value0);
        };
        return Just;
    })();
    var maybe = function (v) {
        return function (v1) {
            return function (v2) {
                if (v2 instanceof Nothing) {
                    return v;
                };
                if (v2 instanceof Just) {
                    return v1(v2.value0);
                };
                throw new Error("Failed pattern match at Data.Maybe (line 217, column 1 - line 217, column 51): " + [ v.constructor.name, v1.constructor.name, v2.constructor.name ]);
            };
        };
    };
    var isNothing = maybe(true)(Data_Function["const"](false));
    var functorMaybe = new Data_Functor.Functor(function (v) {
        return function (v1) {
            if (v1 instanceof Just) {
                return new Just(v(v1.value0));
            };
            return Nothing.value;
        };
    });
    var fromMaybe = function (a) {
        return maybe(a)(Control_Category.identity(Control_Category.categoryFn));
    };
    var fromJust = function (dictPartial) {
        return function (v) {
            if (v instanceof Just) {
                return v.value0;
            };
            throw new Error("Failed pattern match at Data.Maybe (line 268, column 1 - line 268, column 46): " + [ v.constructor.name ]);
        };
    };
    var applyMaybe = new Control_Apply.Apply(function () {
        return functorMaybe;
    }, function (v) {
        return function (v1) {
            if (v instanceof Just) {
                return Data_Functor.map(functorMaybe)(v.value0)(v1);
            };
            if (v instanceof Nothing) {
                return Nothing.value;
            };
            throw new Error("Failed pattern match at Data.Maybe (line 67, column 1 - line 69, column 30): " + [ v.constructor.name, v1.constructor.name ]);
        };
    });
    var bindMaybe = new Control_Bind.Bind(function () {
        return applyMaybe;
    }, function (v) {
        return function (v1) {
            if (v instanceof Just) {
                return v1(v.value0);
            };
            if (v instanceof Nothing) {
                return Nothing.value;
            };
            throw new Error("Failed pattern match at Data.Maybe (line 125, column 1 - line 127, column 28): " + [ v.constructor.name, v1.constructor.name ]);
        };
    });
    exports["Nothing"] = Nothing;
    exports["Just"] = Just;
    exports["maybe"] = maybe;
    exports["fromMaybe"] = fromMaybe;
    exports["isNothing"] = isNothing;
    exports["fromJust"] = fromJust;
    exports["functorMaybe"] = functorMaybe;
    exports["bindMaybe"] = bindMaybe;
  })(PS);
  (function(exports) {
    "use strict";
  
    exports.unfoldrArrayImpl = function (isNothing) {
      return function (fromJust) {
        return function (fst) {
          return function (snd) {
            return function (f) {
              return function (b) {
                var result = [];
                var value = b;
                while (true) { // eslint-disable-line no-constant-condition
                  var maybe = f(value);
                  if (isNothing(maybe)) return result;
                  var tuple = fromJust(maybe);
                  result.push(fst(tuple));
                  value = snd(tuple);
                }
              };
            };
          };
        };
      };
    };
  })(PS["Data.Unfoldable"] = PS["Data.Unfoldable"] || {});
  (function($PS) {
    // Generated by purs version 0.13.8
    "use strict";
    $PS["Data.Tuple"] = $PS["Data.Tuple"] || {};
    var exports = $PS["Data.Tuple"];
    var Data_Functor = $PS["Data.Functor"];                  
    var Tuple = (function () {
        function Tuple(value0, value1) {
            this.value0 = value0;
            this.value1 = value1;
        };
        Tuple.create = function (value0) {
            return function (value1) {
                return new Tuple(value0, value1);
            };
        };
        return Tuple;
    })();
    var uncurry = function (f) {
        return function (v) {
            return f(v.value0)(v.value1);
        };
    };
    var snd = function (v) {
        return v.value1;
    };
    var functorTuple = new Data_Functor.Functor(function (f) {
        return function (m) {
            return new Tuple(m.value0, f(m.value1));
        };
    });                                                                                                   
    var fst = function (v) {
        return v.value0;
    };
    exports["Tuple"] = Tuple;
    exports["fst"] = fst;
    exports["snd"] = snd;
    exports["uncurry"] = uncurry;
    exports["functorTuple"] = functorTuple;
  })(PS);
  (function(exports) {
    "use strict";
  
    exports.unfoldr1ArrayImpl = function (isNothing) {
      return function (fromJust) {
        return function (fst) {
          return function (snd) {
            return function (f) {
              return function (b) {
                var result = [];
                var value = b;
                while (true) { // eslint-disable-line no-constant-condition
                  var tuple = f(value);
                  result.push(fst(tuple));
                  var maybe = snd(tuple);
                  if (isNothing(maybe)) return result;
                  value = fromJust(maybe);
                }
              };
            };
          };
        };
      };
    };
  })(PS["Data.Unfoldable1"] = PS["Data.Unfoldable1"] || {});
  (function($PS) {
    // Generated by purs version 0.13.8
    "use strict";
    $PS["Data.Unfoldable1"] = $PS["Data.Unfoldable1"] || {};
    var exports = $PS["Data.Unfoldable1"];
    var $foreign = $PS["Data.Unfoldable1"];
    var Data_Maybe = $PS["Data.Maybe"];
    var Data_Tuple = $PS["Data.Tuple"];                
    var Unfoldable1 = function (unfoldr1) {
        this.unfoldr1 = unfoldr1;
    }; 
    var unfoldable1Array = new Unfoldable1($foreign.unfoldr1ArrayImpl(Data_Maybe.isNothing)(Data_Maybe.fromJust())(Data_Tuple.fst)(Data_Tuple.snd));
    exports["Unfoldable1"] = Unfoldable1;
    exports["unfoldable1Array"] = unfoldable1Array;
  })(PS);
  (function($PS) {
    // Generated by purs version 0.13.8
    "use strict";
    $PS["Data.Unfoldable"] = $PS["Data.Unfoldable"] || {};
    var exports = $PS["Data.Unfoldable"];
    var $foreign = $PS["Data.Unfoldable"];
    var Data_Maybe = $PS["Data.Maybe"];
    var Data_Tuple = $PS["Data.Tuple"];
    var Data_Unfoldable1 = $PS["Data.Unfoldable1"];  
    var Unfoldable = function (Unfoldable10, unfoldr) {
        this.Unfoldable10 = Unfoldable10;
        this.unfoldr = unfoldr;
    };
    var unfoldr = function (dict) {
        return dict.unfoldr;
    }; 
    var unfoldableArray = new Unfoldable(function () {
        return Data_Unfoldable1.unfoldable1Array;
    }, $foreign.unfoldrArrayImpl(Data_Maybe.isNothing)(Data_Maybe.fromJust())(Data_Tuple.fst)(Data_Tuple.snd));
    exports["Unfoldable"] = Unfoldable;
    exports["unfoldr"] = unfoldr;
    exports["unfoldableArray"] = unfoldableArray;
  })(PS);
  (function($PS) {
    // Generated by purs version 0.13.8
    "use strict";
    $PS["Data.List.Types"] = $PS["Data.List.Types"] || {};
    var exports = $PS["Data.List.Types"];
    var Control_Applicative = $PS["Control.Applicative"];
    var Control_Apply = $PS["Control.Apply"];
    var Data_Foldable = $PS["Data.Foldable"];
    var Data_Function = $PS["Data.Function"];
    var Data_Functor = $PS["Data.Functor"];
    var Data_Maybe = $PS["Data.Maybe"];
    var Data_Monoid = $PS["Data.Monoid"];
    var Data_Semigroup = $PS["Data.Semigroup"];
    var Data_Unfoldable = $PS["Data.Unfoldable"];
    var Data_Unfoldable1 = $PS["Data.Unfoldable1"];                
    var Nil = (function () {
        function Nil() {
  
        };
        Nil.value = new Nil();
        return Nil;
    })();
    var Cons = (function () {
        function Cons(value0, value1) {
            this.value0 = value0;
            this.value1 = value1;
        };
        Cons.create = function (value0) {
            return function (value1) {
                return new Cons(value0, value1);
            };
        };
        return Cons;
    })();
    var listMap = function (f) {
        var chunkedRevMap = function ($copy_chunksAcc) {
            return function ($copy_v) {
                var $tco_var_chunksAcc = $copy_chunksAcc;
                var $tco_done = false;
                var $tco_result;
                function $tco_loop(chunksAcc, v) {
                    if (v instanceof Cons && (v.value1 instanceof Cons && v.value1.value1 instanceof Cons)) {
                        $tco_var_chunksAcc = new Cons(v, chunksAcc);
                        $copy_v = v.value1.value1.value1;
                        return;
                    };
                    var unrolledMap = function (v1) {
                        if (v1 instanceof Cons && (v1.value1 instanceof Cons && v1.value1.value1 instanceof Nil)) {
                            return new Cons(f(v1.value0), new Cons(f(v1.value1.value0), Nil.value));
                        };
                        if (v1 instanceof Cons && v1.value1 instanceof Nil) {
                            return new Cons(f(v1.value0), Nil.value);
                        };
                        return Nil.value;
                    };
                    var reverseUnrolledMap = function ($copy_v1) {
                        return function ($copy_acc) {
                            var $tco_var_v1 = $copy_v1;
                            var $tco_done = false;
                            var $tco_result;
                            function $tco_loop(v1, acc) {
                                if (v1 instanceof Cons && (v1.value0 instanceof Cons && (v1.value0.value1 instanceof Cons && v1.value0.value1.value1 instanceof Cons))) {
                                    $tco_var_v1 = v1.value1;
                                    $copy_acc = new Cons(f(v1.value0.value0), new Cons(f(v1.value0.value1.value0), new Cons(f(v1.value0.value1.value1.value0), acc)));
                                    return;
                                };
                                $tco_done = true;
                                return acc;
                            };
                            while (!$tco_done) {
                                $tco_result = $tco_loop($tco_var_v1, $copy_acc);
                            };
                            return $tco_result;
                        };
                    };
                    $tco_done = true;
                    return reverseUnrolledMap(chunksAcc)(unrolledMap(v));
                };
                while (!$tco_done) {
                    $tco_result = $tco_loop($tco_var_chunksAcc, $copy_v);
                };
                return $tco_result;
            };
        };
        return chunkedRevMap(Nil.value);
    };
    var functorList = new Data_Functor.Functor(listMap);                 
    var foldableList = new Data_Foldable.Foldable(function (dictMonoid) {
        return function (f) {
            return Data_Foldable.foldl(foldableList)(function (acc) {
                var $202 = Data_Semigroup.append(dictMonoid.Semigroup0())(acc);
                return function ($203) {
                    return $202(f($203));
                };
            })(Data_Monoid.mempty(dictMonoid));
        };
    }, function (f) {
        var go = function ($copy_b) {
            return function ($copy_v) {
                var $tco_var_b = $copy_b;
                var $tco_done = false;
                var $tco_result;
                function $tco_loop(b, v) {
                    if (v instanceof Nil) {
                        $tco_done = true;
                        return b;
                    };
                    if (v instanceof Cons) {
                        $tco_var_b = f(b)(v.value0);
                        $copy_v = v.value1;
                        return;
                    };
                    throw new Error("Failed pattern match at Data.List.Types (line 109, column 12 - line 111, column 30): " + [ v.constructor.name ]);
                };
                while (!$tco_done) {
                    $tco_result = $tco_loop($tco_var_b, $copy_v);
                };
                return $tco_result;
            };
        };
        return go;
    }, function (f) {
        return function (b) {
            var rev = Data_Foldable.foldl(foldableList)(Data_Function.flip(Cons.create))(Nil.value);
            var $204 = Data_Foldable.foldl(foldableList)(Data_Function.flip(f))(b);
            return function ($205) {
                return $204(rev($205));
            };
        };
    });
    var semigroupList = new Data_Semigroup.Semigroup(function (xs) {
        return function (ys) {
            return Data_Foldable.foldr(foldableList)(Cons.create)(ys)(xs);
        };
    });
    var unfoldable1List = new Data_Unfoldable1.Unfoldable1(function (f) {
        return function (b) {
            var go = function ($copy_source) {
                return function ($copy_memo) {
                    var $tco_var_source = $copy_source;
                    var $tco_done = false;
                    var $tco_result;
                    function $tco_loop(source, memo) {
                        var v = f(source);
                        if (v.value1 instanceof Data_Maybe.Just) {
                            $tco_var_source = v.value1.value0;
                            $copy_memo = new Cons(v.value0, memo);
                            return;
                        };
                        if (v.value1 instanceof Data_Maybe.Nothing) {
                            $tco_done = true;
                            return Data_Foldable.foldl(foldableList)(Data_Function.flip(Cons.create))(Nil.value)(new Cons(v.value0, memo));
                        };
                        throw new Error("Failed pattern match at Data.List.Types (line 133, column 22 - line 135, column 61): " + [ v.constructor.name ]);
                    };
                    while (!$tco_done) {
                        $tco_result = $tco_loop($tco_var_source, $copy_memo);
                    };
                    return $tco_result;
                };
            };
            return go(b)(Nil.value);
        };
    });
    var unfoldableList = new Data_Unfoldable.Unfoldable(function () {
        return unfoldable1List;
    }, function (f) {
        return function (b) {
            var go = function ($copy_source) {
                return function ($copy_memo) {
                    var $tco_var_source = $copy_source;
                    var $tco_done = false;
                    var $tco_result;
                    function $tco_loop(source, memo) {
                        var v = f(source);
                        if (v instanceof Data_Maybe.Nothing) {
                            $tco_done = true;
                            return Data_Foldable.foldl(foldableList)(Data_Function.flip(Cons.create))(Nil.value)(memo);
                        };
                        if (v instanceof Data_Maybe.Just) {
                            $tco_var_source = v.value0.value1;
                            $copy_memo = new Cons(v.value0.value0, memo);
                            return;
                        };
                        throw new Error("Failed pattern match at Data.List.Types (line 140, column 22 - line 142, column 52): " + [ v.constructor.name ]);
                    };
                    while (!$tco_done) {
                        $tco_result = $tco_loop($tco_var_source, $copy_memo);
                    };
                    return $tco_result;
                };
            };
            return go(b)(Nil.value);
        };
    });
    var applyList = new Control_Apply.Apply(function () {
        return functorList;
    }, function (v) {
        return function (v1) {
            if (v instanceof Nil) {
                return Nil.value;
            };
            if (v instanceof Cons) {
                return Data_Semigroup.append(semigroupList)(Data_Functor.map(functorList)(v.value0)(v1))(Control_Apply.apply(applyList)(v.value1)(v1));
            };
            throw new Error("Failed pattern match at Data.List.Types (line 155, column 1 - line 157, column 48): " + [ v.constructor.name, v1.constructor.name ]);
        };
    });
    var applicativeList = new Control_Applicative.Applicative(function () {
        return applyList;
    }, function (a) {
        return new Cons(a, Nil.value);
    });
    exports["Nil"] = Nil;
    exports["Cons"] = Cons;
    exports["semigroupList"] = semigroupList;
    exports["foldableList"] = foldableList;
    exports["unfoldableList"] = unfoldableList;
    exports["applicativeList"] = applicativeList;
  })(PS);
  (function($PS) {
    // Generated by purs version 0.13.8
    "use strict";
    $PS["Data.List"] = $PS["Data.List"] || {};
    var exports = $PS["Data.List"];
    var Data_List_Types = $PS["Data.List.Types"];
    var reverse = (function () {
        var go = function ($copy_acc) {
            return function ($copy_v) {
                var $tco_var_acc = $copy_acc;
                var $tco_done = false;
                var $tco_result;
                function $tco_loop(acc, v) {
                    if (v instanceof Data_List_Types.Nil) {
                        $tco_done = true;
                        return acc;
                    };
                    if (v instanceof Data_List_Types.Cons) {
                        $tco_var_acc = new Data_List_Types.Cons(v.value0, acc);
                        $copy_v = v.value1;
                        return;
                    };
                    throw new Error("Failed pattern match at Data.List (line 368, column 3 - line 368, column 19): " + [ acc.constructor.name, v.constructor.name ]);
                };
                while (!$tco_done) {
                    $tco_result = $tco_loop($tco_var_acc, $copy_v);
                };
                return $tco_result;
            };
        };
        return go(Data_List_Types.Nil.value);
    })();
    exports["reverse"] = reverse;
  })(PS);
  (function($PS) {
    // Generated by purs version 0.13.8
    "use strict";
    $PS["Data.CatQueue"] = $PS["Data.CatQueue"] || {};
    var exports = $PS["Data.CatQueue"];
    var Data_List = $PS["Data.List"];
    var Data_List_Types = $PS["Data.List.Types"];
    var Data_Maybe = $PS["Data.Maybe"];
    var Data_Tuple = $PS["Data.Tuple"];                            
    var CatQueue = (function () {
        function CatQueue(value0, value1) {
            this.value0 = value0;
            this.value1 = value1;
        };
        CatQueue.create = function (value0) {
            return function (value1) {
                return new CatQueue(value0, value1);
            };
        };
        return CatQueue;
    })();
    var uncons = function ($copy_v) {
        var $tco_done = false;
        var $tco_result;
        function $tco_loop(v) {
            if (v.value0 instanceof Data_List_Types.Nil && v.value1 instanceof Data_List_Types.Nil) {
                $tco_done = true;
                return Data_Maybe.Nothing.value;
            };
            if (v.value0 instanceof Data_List_Types.Nil) {
                $copy_v = new CatQueue(Data_List.reverse(v.value1), Data_List_Types.Nil.value);
                return;
            };
            if (v.value0 instanceof Data_List_Types.Cons) {
                $tco_done = true;
                return new Data_Maybe.Just(new Data_Tuple.Tuple(v.value0.value0, new CatQueue(v.value0.value1, v.value1)));
            };
            throw new Error("Failed pattern match at Data.CatQueue (line 83, column 1 - line 83, column 63): " + [ v.constructor.name ]);
        };
        while (!$tco_done) {
            $tco_result = $tco_loop($copy_v);
        };
        return $tco_result;
    };
    var snoc = function (v) {
        return function (a) {
            return new CatQueue(v.value0, new Data_List_Types.Cons(a, v.value1));
        };
    };
    var $$null = function (v) {
        if (v.value0 instanceof Data_List_Types.Nil && v.value1 instanceof Data_List_Types.Nil) {
            return true;
        };
        return false;
    };                                                                                                
    var empty = new CatQueue(Data_List_Types.Nil.value, Data_List_Types.Nil.value);
    exports["empty"] = empty;
    exports["null"] = $$null;
    exports["snoc"] = snoc;
    exports["uncons"] = uncons;
  })(PS);
  (function($PS) {
    // Generated by purs version 0.13.8
    "use strict";
    $PS["Data.CatList"] = $PS["Data.CatList"] || {};
    var exports = $PS["Data.CatList"];
    var Data_CatQueue = $PS["Data.CatQueue"];
    var Data_List_Types = $PS["Data.List.Types"];
    var Data_Maybe = $PS["Data.Maybe"];
    var Data_Semigroup = $PS["Data.Semigroup"];
    var Data_Tuple = $PS["Data.Tuple"];                            
    var CatNil = (function () {
        function CatNil() {
  
        };
        CatNil.value = new CatNil();
        return CatNil;
    })();
    var CatCons = (function () {
        function CatCons(value0, value1) {
            this.value0 = value0;
            this.value1 = value1;
        };
        CatCons.create = function (value0) {
            return function (value1) {
                return new CatCons(value0, value1);
            };
        };
        return CatCons;
    })();
    var link = function (v) {
        return function (v1) {
            if (v instanceof CatNil) {
                return v1;
            };
            if (v1 instanceof CatNil) {
                return v;
            };
            if (v instanceof CatCons) {
                return new CatCons(v.value0, Data_CatQueue.snoc(v.value1)(v1));
            };
            throw new Error("Failed pattern match at Data.CatList (line 109, column 1 - line 109, column 54): " + [ v.constructor.name, v1.constructor.name ]);
        };
    };
    var foldr = function (k) {
        return function (b) {
            return function (q) {
                var foldl = function ($copy_v) {
                    return function ($copy_c) {
                        return function ($copy_v1) {
                            var $tco_var_v = $copy_v;
                            var $tco_var_c = $copy_c;
                            var $tco_done = false;
                            var $tco_result;
                            function $tco_loop(v, c, v1) {
                                if (v1 instanceof Data_List_Types.Nil) {
                                    $tco_done = true;
                                    return c;
                                };
                                if (v1 instanceof Data_List_Types.Cons) {
                                    $tco_var_v = v;
                                    $tco_var_c = v(c)(v1.value0);
                                    $copy_v1 = v1.value1;
                                    return;
                                };
                                throw new Error("Failed pattern match at Data.CatList (line 125, column 3 - line 125, column 59): " + [ v.constructor.name, c.constructor.name, v1.constructor.name ]);
                            };
                            while (!$tco_done) {
                                $tco_result = $tco_loop($tco_var_v, $tco_var_c, $copy_v1);
                            };
                            return $tco_result;
                        };
                    };
                };
                var go = function ($copy_xs) {
                    return function ($copy_ys) {
                        var $tco_var_xs = $copy_xs;
                        var $tco_done = false;
                        var $tco_result;
                        function $tco_loop(xs, ys) {
                            var v = Data_CatQueue.uncons(xs);
                            if (v instanceof Data_Maybe.Nothing) {
                                $tco_done = true;
                                return foldl(function (x) {
                                    return function (i) {
                                        return i(x);
                                    };
                                })(b)(ys);
                            };
                            if (v instanceof Data_Maybe.Just) {
                                $tco_var_xs = v.value0.value1;
                                $copy_ys = new Data_List_Types.Cons(k(v.value0.value0), ys);
                                return;
                            };
                            throw new Error("Failed pattern match at Data.CatList (line 121, column 14 - line 123, column 67): " + [ v.constructor.name ]);
                        };
                        while (!$tco_done) {
                            $tco_result = $tco_loop($tco_var_xs, $copy_ys);
                        };
                        return $tco_result;
                    };
                };
                return go(q)(Data_List_Types.Nil.value);
            };
        };
    };
    var uncons = function (v) {
        if (v instanceof CatNil) {
            return Data_Maybe.Nothing.value;
        };
        if (v instanceof CatCons) {
            return new Data_Maybe.Just(new Data_Tuple.Tuple(v.value0, (function () {
                var $44 = Data_CatQueue["null"](v.value1);
                if ($44) {
                    return CatNil.value;
                };
                return foldr(link)(CatNil.value)(v.value1);
            })()));
        };
        throw new Error("Failed pattern match at Data.CatList (line 100, column 1 - line 100, column 61): " + [ v.constructor.name ]);
    };
    var empty = CatNil.value;
    var append = link;
    var semigroupCatList = new Data_Semigroup.Semigroup(append);
    var snoc = function (cat) {
        return function (a) {
            return append(cat)(new CatCons(a, Data_CatQueue.empty));
        };
    };
    exports["empty"] = empty;
    exports["snoc"] = snoc;
    exports["uncons"] = uncons;
    exports["semigroupCatList"] = semigroupCatList;
  })(PS);
  (function($PS) {
    // Generated by purs version 0.13.8
    "use strict";
    $PS["Data.Either"] = $PS["Data.Either"] || {};
    var exports = $PS["Data.Either"];
    var Data_Functor = $PS["Data.Functor"];          
    var Left = (function () {
        function Left(value0) {
            this.value0 = value0;
        };
        Left.create = function (value0) {
            return new Left(value0);
        };
        return Left;
    })();
    var Right = (function () {
        function Right(value0) {
            this.value0 = value0;
        };
        Right.create = function (value0) {
            return new Right(value0);
        };
        return Right;
    })();
    var functorEither = new Data_Functor.Functor(function (f) {
        return function (m) {
            if (m instanceof Left) {
                return new Left(m.value0);
            };
            if (m instanceof Right) {
                return new Right(f(m.value0));
            };
            throw new Error("Failed pattern match at Data.Either (line 38, column 1 - line 38, column 52): " + [ m.constructor.name ]);
        };
    });
    var either = function (v) {
        return function (v1) {
            return function (v2) {
                if (v2 instanceof Left) {
                    return v(v2.value0);
                };
                if (v2 instanceof Right) {
                    return v1(v2.value0);
                };
                throw new Error("Failed pattern match at Data.Either (line 238, column 1 - line 238, column 64): " + [ v.constructor.name, v1.constructor.name, v2.constructor.name ]);
            };
        };
    };
    exports["Left"] = Left;
    exports["Right"] = Right;
    exports["either"] = either;
    exports["functorEither"] = functorEither;
  })(PS);
  (function(exports) {
    "use strict";
  
    // module Unsafe.Coerce
  
    exports.unsafeCoerce = function (x) {
      return x;
    };
  })(PS["Unsafe.Coerce"] = PS["Unsafe.Coerce"] || {});
  (function($PS) {
    // Generated by purs version 0.13.8
    "use strict";
    $PS["Unsafe.Coerce"] = $PS["Unsafe.Coerce"] || {};
    var exports = $PS["Unsafe.Coerce"];
    var $foreign = $PS["Unsafe.Coerce"];
    exports["unsafeCoerce"] = $foreign.unsafeCoerce;
  })(PS);
  (function($PS) {
    // Generated by purs version 0.13.8
    "use strict";
    $PS["Control.Monad.Free"] = $PS["Control.Monad.Free"] || {};
    var exports = $PS["Control.Monad.Free"];
    var Control_Applicative = $PS["Control.Applicative"];
    var Control_Apply = $PS["Control.Apply"];
    var Control_Bind = $PS["Control.Bind"];
    var Control_Monad = $PS["Control.Monad"];
    var Data_CatList = $PS["Data.CatList"];
    var Data_Either = $PS["Data.Either"];
    var Data_Functor = $PS["Data.Functor"];
    var Data_Maybe = $PS["Data.Maybe"];
    var Data_Semigroup = $PS["Data.Semigroup"];
    var Unsafe_Coerce = $PS["Unsafe.Coerce"];
    var Free = (function () {
        function Free(value0, value1) {
            this.value0 = value0;
            this.value1 = value1;
        };
        Free.create = function (value0) {
            return function (value1) {
                return new Free(value0, value1);
            };
        };
        return Free;
    })();
    var Return = (function () {
        function Return(value0) {
            this.value0 = value0;
        };
        Return.create = function (value0) {
            return new Return(value0);
        };
        return Return;
    })();
    var Bind = (function () {
        function Bind(value0, value1) {
            this.value0 = value0;
            this.value1 = value1;
        };
        Bind.create = function (value0) {
            return function (value1) {
                return new Bind(value0, value1);
            };
        };
        return Bind;
    })();
    var toView = function ($copy_v) {
        var $tco_done = false;
        var $tco_result;
        function $tco_loop(v) {
            var runExpF = function (v2) {
                return v2;
            };
            var concatF = function (v2) {
                return function (r) {
                    return new Free(v2.value0, Data_Semigroup.append(Data_CatList.semigroupCatList)(v2.value1)(r));
                };
            };
            if (v.value0 instanceof Return) {
                var v2 = Data_CatList.uncons(v.value1);
                if (v2 instanceof Data_Maybe.Nothing) {
                    $tco_done = true;
                    return new Return(v.value0.value0);
                };
                if (v2 instanceof Data_Maybe.Just) {
                    $copy_v = concatF(runExpF(v2.value0.value0)(v.value0.value0))(v2.value0.value1);
                    return;
                };
                throw new Error("Failed pattern match at Control.Monad.Free (line 227, column 7 - line 231, column 64): " + [ v2.constructor.name ]);
            };
            if (v.value0 instanceof Bind) {
                $tco_done = true;
                return new Bind(v.value0.value0, function (a) {
                    return concatF(v.value0.value1(a))(v.value1);
                });
            };
            throw new Error("Failed pattern match at Control.Monad.Free (line 225, column 3 - line 233, column 56): " + [ v.value0.constructor.name ]);
        };
        while (!$tco_done) {
            $tco_result = $tco_loop($copy_v);
        };
        return $tco_result;
    };
    var resume$prime = function (k) {
        return function (j) {
            return function (f) {
                var v = toView(f);
                if (v instanceof Return) {
                    return j(v.value0);
                };
                if (v instanceof Bind) {
                    return k(v.value0)(v.value1);
                };
                throw new Error("Failed pattern match at Control.Monad.Free (line 213, column 17 - line 215, column 20): " + [ v.constructor.name ]);
            };
        };
    };
    var resume = function (dictFunctor) {
        return resume$prime(function (g) {
            return function (i) {
                return new Data_Either.Left(Data_Functor.map(dictFunctor)(i)(g));
            };
        })(Data_Either.Right.create);
    };
    var fromView = function (f) {
        return new Free(f, Data_CatList.empty);
    };
    var wrap = function (f) {
        return fromView(new Bind(f, Unsafe_Coerce.unsafeCoerce));
    };
    var freeMonad = new Control_Monad.Monad(function () {
        return freeApplicative;
    }, function () {
        return freeBind;
    });
    var freeFunctor = new Data_Functor.Functor(function (k) {
        return function (f) {
            return Control_Bind.bindFlipped(freeBind)((function () {
                var $120 = Control_Applicative.pure(freeApplicative);
                return function ($121) {
                    return $120(k($121));
                };
            })())(f);
        };
    });
    var freeBind = new Control_Bind.Bind(function () {
        return freeApply;
    }, function (v) {
        return function (k) {
            return new Free(v.value0, Data_CatList.snoc(v.value1)(k));
        };
    });
    var freeApply = new Control_Apply.Apply(function () {
        return freeFunctor;
    }, Control_Monad.ap(freeMonad));
    var freeApplicative = new Control_Applicative.Applicative(function () {
        return freeApply;
    }, function ($122) {
        return fromView(Return.create($122));
    });
    var liftF = function (f) {
        return fromView(new Bind(f, (function () {
            var $123 = Control_Applicative.pure(freeApplicative);
            return function ($124) {
                return $123($124);
            };
        })()));
    };
    exports["wrap"] = wrap;
    exports["liftF"] = liftF;
    exports["resume"] = resume;
    exports["resume'"] = resume$prime;
    exports["freeFunctor"] = freeFunctor;
    exports["freeBind"] = freeBind;
    exports["freeApplicative"] = freeApplicative;
  })(PS);
  (function($PS) {
    // Generated by purs version 0.13.8
    "use strict";
    $PS["Control.MultiAlternative"] = $PS["Control.MultiAlternative"] || {};
    var exports = $PS["Control.MultiAlternative"];         
    var MultiAlternative = function (Plus0, orr) {
        this.Plus0 = Plus0;
        this.orr = orr;
    };
    var orr = function (dict) {
        return dict.orr;
    };
    exports["orr"] = orr;
    exports["MultiAlternative"] = MultiAlternative;
  })(PS);
  (function($PS) {
    // Generated by purs version 0.13.8
    "use strict";
    $PS["Control.Parallel.Class"] = $PS["Control.Parallel.Class"] || {};
    var exports = $PS["Control.Parallel.Class"];
    var Parallel = function (Applicative1, Monad0, parallel, sequential) {
        this.Applicative1 = Applicative1;
        this.Monad0 = Monad0;
        this.parallel = parallel;
        this.sequential = sequential;
    };
    var sequential = function (dict) {
        return dict.sequential;
    };
    var parallel = function (dict) {
        return dict.parallel;
    };
    exports["parallel"] = parallel;
    exports["sequential"] = sequential;
    exports["Parallel"] = Parallel;
  })(PS);
  (function($PS) {
    // Generated by purs version 0.13.8
    "use strict";
    $PS["Control.Plus"] = $PS["Control.Plus"] || {};
    var exports = $PS["Control.Plus"];                   
    var Plus = function (Alt0, empty) {
        this.Alt0 = Alt0;
        this.empty = empty;
    };       
    var empty = function (dict) {
        return dict.empty;
    };
    exports["Plus"] = Plus;
    exports["empty"] = empty;
  })(PS);
  (function($PS) {
    // Generated by purs version 0.13.8
    "use strict";
    $PS["Control.ShiftMap"] = $PS["Control.ShiftMap"] || {};
    var exports = $PS["Control.ShiftMap"];             
    var ShiftMap = function (shiftMap) {
        this.shiftMap = shiftMap;
    };
    var shiftMap = function (dict) {
        return dict.shiftMap;
    };
    exports["shiftMap"] = shiftMap;
    exports["ShiftMap"] = ShiftMap;
  })(PS);
  (function(exports) {
    "use strict";
  
    //------------------------------------------------------------------------------
    // Array creation --------------------------------------------------------------
    //------------------------------------------------------------------------------
  
    exports.range = function (start) {
      return function (end) {
        var step = start > end ? -1 : 1;
        var result = new Array(step * (end - start) + 1);
        var i = start, n = 0;
        while (i !== end) {
          result[n++] = i;
          i += step;
        }
        result[n] = i;
        return result;
      };
    };
  
    var replicateFill = function (count) {
      return function (value) {
        if (count < 1) {
          return [];
        }
        var result = new Array(count);
        return result.fill(value);
      };
    };
  
    var replicatePolyfill = function (count) {
      return function (value) {
        var result = [];
        var n = 0;
        for (var i = 0; i < count; i++) {
          result[n++] = value;
        }
        return result;
      };
    };
  
    // In browsers that have Array.prototype.fill we use it, as it's faster.
    exports.replicate = typeof Array.prototype.fill === "function" ? replicateFill : replicatePolyfill;
  
    //------------------------------------------------------------------------------
    // Array size ------------------------------------------------------------------
    //------------------------------------------------------------------------------
  
    exports.length = function (xs) {
      return xs.length;
    };
  
    //------------------------------------------------------------------------------
    // Extending arrays ------------------------------------------------------------
    //------------------------------------------------------------------------------
  
    exports.cons = function (e) {
      return function (l) {
        return [e].concat(l);
      };
    };
  
    exports.snoc = function (l) {
      return function (e) {
        var l1 = l.slice();
        l1.push(e);
        return l1;
      };
    };
  
    //------------------------------------------------------------------------------
    // Non-indexed reads -----------------------------------------------------------
    //------------------------------------------------------------------------------
  
    exports["uncons'"] = function (empty) {
      return function (next) {
        return function (xs) {
          return xs.length === 0 ? empty({}) : next(xs[0])(xs.slice(1));
        };
      };
    };
  
    //------------------------------------------------------------------------------
    // Indexed operations ----------------------------------------------------------
    //------------------------------------------------------------------------------
  
    exports.indexImpl = function (just) {
      return function (nothing) {
        return function (xs) {
          return function (i) {
            return i < 0 || i >= xs.length ? nothing :  just(xs[i]);
          };
        };
      };
    };
  
    exports.findIndexImpl = function (just) {
      return function (nothing) {
        return function (f) {
          return function (xs) {
            for (var i = 0, l = xs.length; i < l; i++) {
              if (f(xs[i])) return just(i);
            }
            return nothing;
          };
        };
      };
    };
  
    exports._deleteAt = function (just) {
      return function (nothing) {
        return function (i) {
          return function (l) {
            if (i < 0 || i >= l.length) return nothing;
            var l1 = l.slice();
            l1.splice(i, 1);
            return just(l1);
          };
        };
      };
    };
  
    exports._updateAt = function (just) {
      return function (nothing) {
        return function (i) {
          return function (a) {
            return function (l) {
              if (i < 0 || i >= l.length) return nothing;
              var l1 = l.slice();
              l1[i] = a;
              return just(l1);
            };
          };
        };
      };
    };
  
    exports.concat = function (xss) {
      if (xss.length <= 10000) {
        // This method is faster, but it crashes on big arrays.
        // So we use it when can and fallback to simple variant otherwise.
        return Array.prototype.concat.apply([], xss);
      }
  
      var result = [];
      for (var i = 0, l = xss.length; i < l; i++) {
        var xs = xss[i];
        for (var j = 0, m = xs.length; j < m; j++) {
          result.push(xs[j]);
        }
      }
      return result;
    };
  
    //------------------------------------------------------------------------------
    // Zipping ---------------------------------------------------------------------
    //------------------------------------------------------------------------------
  
    exports.zipWith = function (f) {
      return function (xs) {
        return function (ys) {
          var l = xs.length < ys.length ? xs.length : ys.length;
          var result = new Array(l);
          for (var i = 0; i < l; i++) {
            result[i] = f(xs[i])(ys[i]);
          }
          return result;
        };
      };
    };
  })(PS["Data.Array"] = PS["Data.Array"] || {});
  (function(exports) {
    "use strict";
  
    var refEq = function (r1) {
      return function (r2) {
        return r1 === r2;
      };
    };
  
    exports.eqBooleanImpl = refEq;
    exports.eqIntImpl = refEq;
    exports.eqNumberImpl = refEq;
    exports.eqCharImpl = refEq;
  })(PS["Data.Eq"] = PS["Data.Eq"] || {});
  (function($PS) {
    // Generated by purs version 0.13.8
    "use strict";
    $PS["Data.Eq"] = $PS["Data.Eq"] || {};
    var exports = $PS["Data.Eq"];
    var $foreign = $PS["Data.Eq"];
    var Eq = function (eq) {
        this.eq = eq;
    };
    var eqNumber = new Eq($foreign.eqNumberImpl);
    var eqInt = new Eq($foreign.eqIntImpl);
    var eqChar = new Eq($foreign.eqCharImpl);
    var eqBoolean = new Eq($foreign.eqBooleanImpl);
    var eq = function (dict) {
        return dict.eq;
    };
    var notEq = function (dictEq) {
        return function (x) {
            return function (y) {
                return eq(eqBoolean)(eq(dictEq)(x)(y))(false);
            };
        };
    };
    exports["Eq"] = Eq;
    exports["eq"] = eq;
    exports["notEq"] = notEq;
    exports["eqInt"] = eqInt;
    exports["eqNumber"] = eqNumber;
    exports["eqChar"] = eqChar;
  })(PS);
  (function($PS) {
    // Generated by purs version 0.13.8
    "use strict";
    $PS["Data.Array"] = $PS["Data.Array"] || {};
    var exports = $PS["Data.Array"];
    var $foreign = $PS["Data.Array"];
    var Data_Eq = $PS["Data.Eq"];
    var Data_Foldable = $PS["Data.Foldable"];
    var Data_Function = $PS["Data.Function"];
    var Data_Maybe = $PS["Data.Maybe"];
    var updateAt = $foreign["_updateAt"](Data_Maybe.Just.create)(Data_Maybe.Nothing.value);
    var uncons = $foreign["uncons'"](Data_Function["const"](Data_Maybe.Nothing.value))(function (x) {
        return function (xs) {
            return new Data_Maybe.Just({
                head: x,
                tail: xs
            });
        };
    });
    var singleton = function (a) {
        return [ a ];
    };
    var mapWithIndex = function (f) {
        return function (xs) {
            return $foreign.zipWith(f)($foreign.range(0)($foreign.length(xs) - 1 | 0))(xs);
        };
    };
    var index = $foreign.indexImpl(Data_Maybe.Just.create)(Data_Maybe.Nothing.value);
    var findIndex = $foreign.findIndexImpl(Data_Maybe.Just.create)(Data_Maybe.Nothing.value);
    var elemIndex = function (dictEq) {
        return function (x) {
            return findIndex(function (v) {
                return Data_Eq.eq(dictEq)(v)(x);
            });
        };
    };
    var deleteAt = $foreign["_deleteAt"](Data_Maybe.Just.create)(Data_Maybe.Nothing.value);
    var deleteBy = function (v) {
        return function (v1) {
            return function (v2) {
                if (v2.length === 0) {
                    return [  ];
                };
                return Data_Maybe.maybe(v2)(function (i) {
                    return Data_Maybe.fromJust()(deleteAt(i)(v2));
                })(findIndex(v(v1))(v2));
            };
        };
    };
    var $$delete = function (dictEq) {
        return deleteBy(Data_Eq.eq(dictEq));
    };
    var difference = function (dictEq) {
        return Data_Foldable.foldr(Data_Foldable.foldableArray)($$delete(dictEq));
    };
    exports["singleton"] = singleton;
    exports["uncons"] = uncons;
    exports["index"] = index;
    exports["elemIndex"] = elemIndex;
    exports["updateAt"] = updateAt;
    exports["mapWithIndex"] = mapWithIndex;
    exports["difference"] = difference;
    exports["range"] = $foreign.range;
    exports["replicate"] = $foreign.replicate;
    exports["length"] = $foreign.length;
    exports["cons"] = $foreign.cons;
    exports["snoc"] = $foreign.snoc;
    exports["concat"] = $foreign.concat;
  })(PS);
  (function($PS) {
    // Generated by purs version 0.13.8
    "use strict";
    $PS["Data.Boolean"] = $PS["Data.Boolean"] || {};
    var exports = $PS["Data.Boolean"];
    var otherwise = true;
    exports["otherwise"] = otherwise;
  })(PS);
  (function($PS) {
    // Generated by purs version 0.13.8
    "use strict";
    $PS["Data.Array.NonEmpty"] = $PS["Data.Array.NonEmpty"] || {};
    var exports = $PS["Data.Array.NonEmpty"];
    var Data_Array = $PS["Data.Array"];
    var Data_Boolean = $PS["Data.Boolean"];
    var Data_Maybe = $PS["Data.Maybe"];
    var Unsafe_Coerce = $PS["Unsafe.Coerce"];                
    var unsafeFromArrayF = Unsafe_Coerce.unsafeCoerce;
    var unsafeFromArray = Unsafe_Coerce.unsafeCoerce;
    var toArray = Unsafe_Coerce.unsafeCoerce;
    var updateAt = function (i) {
        return function (x) {
            var $45 = Data_Array.updateAt(i)(x);
            return function ($46) {
                return unsafeFromArrayF($45(toArray($46)));
            };
        };
    };
    var snoc = function (xs) {
        return function (x) {
            return unsafeFromArray(Data_Array.snoc(toArray(xs))(x));
        };
    };
    var singleton = function ($49) {
        return unsafeFromArray(Data_Array.singleton($49));
    };
    var fromArray = function (xs) {
        if (Data_Array.length(xs) > 0) {
            return new Data_Maybe.Just(unsafeFromArray(xs));
        };
        if (Data_Boolean.otherwise) {
            return Data_Maybe.Nothing.value;
        };
        throw new Error("Failed pattern match at Data.Array.NonEmpty (line 134, column 1 - line 134, column 58): " + [ xs.constructor.name ]);
    };
    var cons$prime = function (x) {
        return function (xs) {
            return unsafeFromArray(Data_Array.cons(x)(xs));
        };
    };
    var adaptMaybe = function (f) {
        var $64 = Data_Maybe.fromJust();
        return function ($65) {
            return $64(f(toArray($65)));
        };
    };                                     
    var uncons = adaptMaybe(Data_Array.uncons);
    var adaptAny = function (f) {
        return function ($67) {
            return f(toArray($67));
        };
    };                                     
    var length = adaptAny(Data_Array.length);
    var unsafeAdapt = function (f) {
        var $68 = adaptAny(f);
        return function ($69) {
            return unsafeFromArray($68($69));
        };
    };
    var cons = function (x) {
        return unsafeAdapt(Data_Array.cons(x));
    };
    exports["fromArray"] = fromArray;
    exports["singleton"] = singleton;
    exports["cons'"] = cons$prime;
    exports["snoc"] = snoc;
    exports["uncons"] = uncons;
    exports["updateAt"] = updateAt;
  })(PS);
  (function(exports) {
    "use strict";
  
    exports.fold1Impl = function (f) {
      return function (xs) {
        var acc = xs[0];
        var len = xs.length;
        for (var i = 1; i < len; i++) {
          acc = f(acc)(xs[i]);
        }
        return acc;
      };
    };
  })(PS["Data.Array.NonEmpty.Internal"] = PS["Data.Array.NonEmpty.Internal"] || {});
  (function(exports) {
    "use strict";
  
    exports.mapWithIndexArray = function (f) {
      return function (xs) {
        var l = xs.length;
        var result = Array(l);
        for (var i = 0; i < l; i++) {
          result[i] = f(i)(xs[i]);
        }
        return result;
      };
    };
  })(PS["Data.FunctorWithIndex"] = PS["Data.FunctorWithIndex"] || {});
  (function($PS) {
    // Generated by purs version 0.13.8
    "use strict";
    $PS["Data.FunctorWithIndex"] = $PS["Data.FunctorWithIndex"] || {};
    var exports = $PS["Data.FunctorWithIndex"];
    var $foreign = $PS["Data.FunctorWithIndex"];
    var Data_Functor = $PS["Data.Functor"];          
    var FunctorWithIndex = function (Functor0, mapWithIndex) {
        this.Functor0 = Functor0;
        this.mapWithIndex = mapWithIndex;
    };
    var mapWithIndex = function (dict) {
        return dict.mapWithIndex;
    }; 
    var functorWithIndexArray = new FunctorWithIndex(function () {
        return Data_Functor.functorArray;
    }, $foreign.mapWithIndexArray);
    exports["mapWithIndex"] = mapWithIndex;
    exports["functorWithIndexArray"] = functorWithIndexArray;
  })(PS);
  (function($PS) {
    // Generated by purs version 0.13.8
    "use strict";
    $PS["Data.FoldableWithIndex"] = $PS["Data.FoldableWithIndex"] || {};
    var exports = $PS["Data.FoldableWithIndex"];
    var Data_Foldable = $PS["Data.Foldable"];
    var Data_FunctorWithIndex = $PS["Data.FunctorWithIndex"];
    var Data_Monoid = $PS["Data.Monoid"];
    var Data_Semigroup = $PS["Data.Semigroup"];      
    var Tuple = (function () {
        function Tuple(value0, value1) {
            this.value0 = value0;
            this.value1 = value1;
        };
        Tuple.create = function (value0) {
            return function (value1) {
                return new Tuple(value0, value1);
            };
        };
        return Tuple;
    })();
    var FoldableWithIndex = function (Foldable0, foldMapWithIndex, foldlWithIndex, foldrWithIndex) {
        this.Foldable0 = Foldable0;
        this.foldMapWithIndex = foldMapWithIndex;
        this.foldlWithIndex = foldlWithIndex;
        this.foldrWithIndex = foldrWithIndex;
    };
    var foldrWithIndex = function (dict) {
        return dict.foldrWithIndex;
    };
    var foldlWithIndex = function (dict) {
        return dict.foldlWithIndex;
    };
    var foldMapWithIndexDefaultR = function (dictFoldableWithIndex) {
        return function (dictMonoid) {
            return function (f) {
                return foldrWithIndex(dictFoldableWithIndex)(function (i) {
                    return function (x) {
                        return function (acc) {
                            return Data_Semigroup.append(dictMonoid.Semigroup0())(f(i)(x))(acc);
                        };
                    };
                })(Data_Monoid.mempty(dictMonoid));
            };
        };
    };
    var foldableWithIndexArray = new FoldableWithIndex(function () {
        return Data_Foldable.foldableArray;
    }, function (dictMonoid) {
        return foldMapWithIndexDefaultR(foldableWithIndexArray)(dictMonoid);
    }, function (f) {
        return function (z) {
            var $49 = Data_Foldable.foldl(Data_Foldable.foldableArray)(function (y) {
                return function (v) {
                    return f(v.value0)(y)(v.value1);
                };
            })(z);
            var $50 = Data_FunctorWithIndex.mapWithIndex(Data_FunctorWithIndex.functorWithIndexArray)(Tuple.create);
            return function ($51) {
                return $49($50($51));
            };
        };
    }, function (f) {
        return function (z) {
            var $52 = Data_Foldable.foldr(Data_Foldable.foldableArray)(function (v) {
                return function (y) {
                    return f(v.value0)(v.value1)(y);
                };
            })(z);
            var $53 = Data_FunctorWithIndex.mapWithIndex(Data_FunctorWithIndex.functorWithIndexArray)(Tuple.create);
            return function ($54) {
                return $52($53($54));
            };
        };
    });
    exports["FoldableWithIndex"] = FoldableWithIndex;
    exports["foldrWithIndex"] = foldrWithIndex;
    exports["foldlWithIndex"] = foldlWithIndex;
    exports["foldableWithIndexArray"] = foldableWithIndexArray;
  })(PS);
  (function($PS) {
    // Generated by purs version 0.13.8
    "use strict";
    $PS["Data.Semigroup.Foldable"] = $PS["Data.Semigroup.Foldable"] || {};
    var exports = $PS["Data.Semigroup.Foldable"];
    var Data_Functor = $PS["Data.Functor"];
    var Foldable1 = function (Foldable0, fold1, foldMap1) {
        this.Foldable0 = Foldable0;
        this.fold1 = fold1;
        this.foldMap1 = foldMap1;
    };
    var foldMap1 = function (dict) {
        return dict.foldMap1;
    }; 
    var fold1 = function (dict) {
        return dict.fold1;
    };
    var foldMap1Default = function (dictFoldable1) {
        return function (dictFunctor) {
            return function (dictSemigroup) {
                return function (f) {
                    var $45 = fold1(dictFoldable1)(dictSemigroup);
                    var $46 = Data_Functor.map(dictFunctor)(f);
                    return function ($47) {
                        return $45($46($47));
                    };
                };
            };
        };
    };
    exports["Foldable1"] = Foldable1;
    exports["foldMap1"] = foldMap1;
    exports["foldMap1Default"] = foldMap1Default;
  })(PS);
  (function($PS) {
    // Generated by purs version 0.13.8
    "use strict";
    $PS["Data.Array.NonEmpty.Internal"] = $PS["Data.Array.NonEmpty.Internal"] || {};
    var exports = $PS["Data.Array.NonEmpty.Internal"];
    var $foreign = $PS["Data.Array.NonEmpty.Internal"];
    var Data_Foldable = $PS["Data.Foldable"];
    var Data_FoldableWithIndex = $PS["Data.FoldableWithIndex"];
    var Data_Functor = $PS["Data.Functor"];
    var Data_Semigroup = $PS["Data.Semigroup"];
    var Data_Semigroup_Foldable = $PS["Data.Semigroup.Foldable"];                   
    var functorNonEmptyArray = Data_Functor.functorArray;
    var foldableWithIndexNonEmptyArray = Data_FoldableWithIndex.foldableWithIndexArray;
    var foldableNonEmptyArray = Data_Foldable.foldableArray;
    var foldable1NonEmptyArray = new Data_Semigroup_Foldable.Foldable1(function () {
        return foldableNonEmptyArray;
    }, function (dictSemigroup) {
        return $foreign.fold1Impl(Data_Semigroup.append(dictSemigroup));
    }, function (dictSemigroup) {
        return Data_Semigroup_Foldable.foldMap1Default(foldable1NonEmptyArray)(functorNonEmptyArray)(dictSemigroup);
    });
    exports["functorNonEmptyArray"] = functorNonEmptyArray;
    exports["foldableWithIndexNonEmptyArray"] = foldableWithIndexNonEmptyArray;
    exports["foldable1NonEmptyArray"] = foldable1NonEmptyArray;
  })(PS);
  (function(exports) {
    "use strict";
  
    exports.showIntImpl = function (n) {
      return n.toString();
    };
  
    exports.showNumberImpl = function (n) {
      var str = n.toString();
      return isNaN(str + ".0") ? str : str + ".0";
    };
  })(PS["Data.Show"] = PS["Data.Show"] || {});
  (function($PS) {
    // Generated by purs version 0.13.8
    "use strict";
    $PS["Data.Show"] = $PS["Data.Show"] || {};
    var exports = $PS["Data.Show"];
    var $foreign = $PS["Data.Show"];
    var Show = function (show) {
        this.show = show;
    };
    var showNumber = new Show($foreign.showNumberImpl);
    var showInt = new Show($foreign.showIntImpl);  
    var showBoolean = new Show(function (v) {
        if (v) {
            return "true";
        };
        if (!v) {
            return "false";
        };
        throw new Error("Failed pattern match at Data.Show (line 20, column 1 - line 22, column 23): " + [ v.constructor.name ]);
    });
    var show = function (dict) {
        return dict.show;
    };
    exports["Show"] = Show;
    exports["show"] = show;
    exports["showBoolean"] = showBoolean;
    exports["showInt"] = showInt;
    exports["showNumber"] = showNumber;
  })(PS);
  (function(exports) {
    "use strict";
  
    exports.pureE = function (a) {
      return function () {
        return a;
      };
    };
  
    exports.bindE = function (a) {
      return function (f) {
        return function () {
          return f(a())();
        };
      };
    };
  })(PS["Effect"] = PS["Effect"] || {});
  (function($PS) {
    // Generated by purs version 0.13.8
    "use strict";
    $PS["Effect"] = $PS["Effect"] || {};
    var exports = $PS["Effect"];
    var $foreign = $PS["Effect"];
    var Control_Applicative = $PS["Control.Applicative"];
    var Control_Apply = $PS["Control.Apply"];
    var Control_Bind = $PS["Control.Bind"];
    var Control_Monad = $PS["Control.Monad"];
    var Data_Functor = $PS["Data.Functor"];                    
    var monadEffect = new Control_Monad.Monad(function () {
        return applicativeEffect;
    }, function () {
        return bindEffect;
    });
    var bindEffect = new Control_Bind.Bind(function () {
        return applyEffect;
    }, $foreign.bindE);
    var applyEffect = new Control_Apply.Apply(function () {
        return functorEffect;
    }, Control_Monad.ap(monadEffect));
    var applicativeEffect = new Control_Applicative.Applicative(function () {
        return applyEffect;
    }, $foreign.pureE);
    var functorEffect = new Data_Functor.Functor(Control_Applicative.liftA1(applicativeEffect));
    exports["functorEffect"] = functorEffect;
    exports["applicativeEffect"] = applicativeEffect;
    exports["bindEffect"] = bindEffect;
    exports["monadEffect"] = monadEffect;
  })(PS);
  (function(exports) {
    /* globals exports, setTimeout */
    "use strict";
  
    var AVar = function () {
  
      function MutableQueue () {
        this.head = null;
        this.last = null;
        this.size = 0;
      }
  
      function MutableCell (queue, value) {
        this.queue = queue;
        this.value = value;
        this.next  = null;
        this.prev  = null;
      }
  
      function AVar (value) {
        this.draining = false;
        this.error    = null;
        this.value    = value;
        this.takes    = new MutableQueue();
        this.reads    = new MutableQueue();
        this.puts     = new MutableQueue();
      }
  
      var EMPTY = {};
  
      function runEff(eff) {
        try {
          eff();
        } catch (error) {
          setTimeout(function () {
            throw error;
          }, 0);
        }
      }
  
      function putLast (queue, value) {
        var cell = new MutableCell(queue, value);
        switch (queue.size) {
        case 0:
          queue.head = cell;
          break;
        case 1:
          cell.prev = queue.head;
          queue.head.next = cell;
          queue.last = cell;
          break;
        default:
          cell.prev = queue.last;
          queue.last.next = cell;
          queue.last = cell;
        }
        queue.size++;
        return cell;
      }
  
      function takeLast (queue) {
        var cell;
        switch (queue.size) {
        case 0:
          return null;
        case 1:
          cell = queue.head;
          queue.head = null;
          break;
        case 2:
          cell = queue.last;
          queue.head.next = null;
          queue.last = null;
          break;
        default:
          cell = queue.last;
          queue.last = cell.prev;
          queue.last.next = null;
        }
        cell.prev = null;
        cell.queue = null;
        queue.size--;
        return cell.value;
      }
  
      function takeHead (queue) {
        var cell;
        switch (queue.size) {
        case 0:
          return null;
        case 1:
          cell = queue.head;
          queue.head = null;
          break;
        case 2:
          cell = queue.head;
          queue.last.prev = null;
          queue.head = queue.last;
          queue.last = null;
          break;
        default:
          cell = queue.head;
          queue.head = cell.next;
          queue.head.prev = null;
        }
        cell.next = null;
        cell.queue = null;
        queue.size--;
        return cell.value;
      }
  
      function deleteCell (cell) {
        if (cell.queue === null) {
          return;
        }
        if (cell.queue.last === cell) {
          takeLast(cell.queue);
          return;
        }
        if (cell.queue.head === cell) {
          takeHead(cell.queue);
          return;
        }
        if (cell.prev) {
          cell.prev.next = cell.next;
        }
        if (cell.next) {
          cell.next.prev = cell.prev;
        }
        cell.queue.size--;
        cell.queue = null;
        cell.value = null;
        cell.next  = null;
        cell.prev  = null;
      }
  
      function drainVar (util, avar) {
        if (avar.draining) {
          return;
        }
  
        var ps = avar.puts;
        var ts = avar.takes;
        var rs = avar.reads;
        var p, r, t, value, rsize;
  
        avar.draining = true;
  
        while (1) { // eslint-disable-line no-constant-condition
          p = null;
          r = null;
          t = null;
          value = avar.value;
          rsize = rs.size;
  
          if (avar.error !== null) {
            value = util.left(avar.error);
            while (p = takeHead(ps)) { // eslint-disable-line no-cond-assign
              runEff(p.cb(value));
            }
            while (r = takeHead(rs)) { // eslint-disable-line no-cond-assign
              runEff(r(value));
            }
            while (t = takeHead(ts)) { // eslint-disable-line no-cond-assign
              runEff(t(value));
            }
            break;
          }
  
          // Process the next put. We do not immediately invoke the callback
          // because we want to preserve ordering. If there are takes/reads
          // we want to run those first.
          if (value === EMPTY && (p = takeHead(ps))) {
            avar.value = value = p.value;
          }
  
          if (value !== EMPTY) {
            // We go ahead and queue up the next take for the same reasons as
            // above. Invoking the read callbacks can affect the mutable queue.
            t = takeHead(ts);
            // We only want to process the reads queued up before running these
            // callbacks so we guard on rsize.
            while (rsize-- && (r = takeHead(rs))) {
              runEff(r(util.right(value)));
            }
            if (t !== null) {
              avar.value = EMPTY;
              runEff(t(util.right(value)));
            }
          }
  
          if (p !== null) {
            runEff(p.cb(util.right(void 0)));
          }
  
          // Callbacks could have queued up more items so we need to guard on the
          // actual mutable properties.
          if (avar.value === EMPTY && ps.size === 0 || avar.value !== EMPTY && ts.size === 0) {
            break;
          }
        }
        avar.draining = false;
      }
  
      AVar.EMPTY      = EMPTY;
      AVar.putLast    = putLast;
      AVar.takeLast   = takeLast;
      AVar.takeHead   = takeHead;
      AVar.deleteCell = deleteCell;
      AVar.drainVar   = drainVar;
  
      return AVar;
    }();
  
    exports.empty = function () {
      return new AVar(AVar.EMPTY);
    };
  
    exports._takeVar = function (util, avar, cb) {
      return function () {
        var cell = AVar.putLast(avar.takes, cb);
        AVar.drainVar(util, avar);
        return function () {
          AVar.deleteCell(cell);
        };
      };
    };
  
    exports._tryPutVar = function (util, value, avar) {
      return function () {
        if (avar.value === AVar.EMPTY && avar.error === null) {
          avar.value = value;
          AVar.drainVar(util, avar);
          return true;
        } else {
          return false;
        }
      };
    };
  
    exports._tryTakeVar = function (util, avar) {
      return function () {
        var value = avar.value;
        if (value === AVar.EMPTY) {
          return util.nothing;
        } else {
          avar.value = AVar.EMPTY;
          AVar.drainVar(util, avar);
          return util.just(value);
        }
      };
    };
  })(PS["Effect.AVar"] = PS["Effect.AVar"] || {});
  (function($PS) {
    // Generated by purs version 0.13.8
    "use strict";
    $PS["Effect.AVar"] = $PS["Effect.AVar"] || {};
    var exports = $PS["Effect.AVar"];
    var $foreign = $PS["Effect.AVar"];
    var Data_Either = $PS["Data.Either"];
    var Data_Maybe = $PS["Data.Maybe"];                
    var Killed = (function () {
        function Killed(value0) {
            this.value0 = value0;
        };
        Killed.create = function (value0) {
            return new Killed(value0);
        };
        return Killed;
    })();
    var Filled = (function () {
        function Filled(value0) {
            this.value0 = value0;
        };
        Filled.create = function (value0) {
            return new Filled(value0);
        };
        return Filled;
    })();
    var Empty = (function () {
        function Empty() {
  
        };
        Empty.value = new Empty();
        return Empty;
    })();
    var ffiUtil = {
        left: Data_Either.Left.create,
        right: Data_Either.Right.create,
        nothing: Data_Maybe.Nothing.value,
        just: Data_Maybe.Just.create,
        killed: Killed.create,
        filled: Filled.create,
        empty: Empty.value
    };
    var take = function (avar) {
        return function (cb) {
            return $foreign["_takeVar"](ffiUtil, avar, cb);
        };
    };
    var tryPut = function (value) {
        return function (avar) {
            return $foreign["_tryPutVar"](ffiUtil, value, avar);
        };
    };
    var tryTake = function (avar) {
        return $foreign["_tryTakeVar"](ffiUtil, avar);
    };
    exports["take"] = take;
    exports["tryTake"] = tryTake;
    exports["tryPut"] = tryPut;
    exports["empty"] = $foreign.empty;
  })(PS);
  (function(exports) {
    /* globals setImmediate, clearImmediate, setTimeout, clearTimeout */
    /* jshint -W083, -W098, -W003 */
    "use strict";
  
    var Aff = function () {
      // A unique value for empty.
      var EMPTY = {};
  
      /*
  
    An awkward approximation. We elide evidence we would otherwise need in PS for
    efficiency sake.
  
    data Aff eff a
      = Pure a
      | Throw Error
      | Catch (Aff eff a) (Error -> Aff eff a)
      | Sync (Eff eff a)
      | Async ((Either Error a -> Eff eff Unit) -> Eff eff (Canceler eff))
      | forall b. Bind (Aff eff b) (b -> Aff eff a)
      | forall b. Bracket (Aff eff b) (BracketConditions eff b) (b -> Aff eff a)
      | forall b. Fork Boolean (Aff eff b) ?(Fiber eff b -> a)
      | Sequential (ParAff aff a)
  
    */  
      var PURE    = "Pure";
      var THROW   = "Throw";
      var CATCH   = "Catch";
      var SYNC    = "Sync";
      var ASYNC   = "Async";
      var BIND    = "Bind";
      var BRACKET = "Bracket";
      var FORK    = "Fork";
      var SEQ     = "Sequential";
  
      /*
  
    data ParAff eff a
      = forall b. Map (b -> a) (ParAff eff b)
      | forall b. Apply (ParAff eff (b -> a)) (ParAff eff b)
      | Alt (ParAff eff a) (ParAff eff a)
      | ?Par (Aff eff a)
  
    */  
      var MAP   = "Map";
      var APPLY = "Apply";
      var ALT   = "Alt";
  
      // Various constructors used in interpretation
      var CONS      = "Cons";      // Cons-list, for stacks
      var RESUME    = "Resume";    // Continue indiscriminately
      var RELEASE   = "Release";   // Continue with bracket finalizers
      var FINALIZER = "Finalizer"; // A non-interruptible effect
      var FINALIZED = "Finalized"; // Marker for finalization
      var FORKED    = "Forked";    // Reference to a forked fiber, with resumption stack
      var FIBER     = "Fiber";     // Actual fiber reference
      var THUNK     = "Thunk";     // Primed effect, ready to invoke
  
      function Aff(tag, _1, _2, _3) {
        this.tag = tag;
        this._1  = _1;
        this._2  = _2;
        this._3  = _3;
      }
  
      function AffCtr(tag) {
        var fn = function (_1, _2, _3) {
          return new Aff(tag, _1, _2, _3);
        };
        fn.tag = tag;
        return fn;
      }
  
      function nonCanceler(error) {
        return new Aff(PURE, void 0);
      }
  
      function runEff(eff) {
        try {
          eff();
        } catch (error) {
          setTimeout(function () {
            throw error;
          }, 0);
        }
      }
  
      function runSync(left, right, eff) {
        try {
          return right(eff());
        } catch (error) {
          return left(error);
        }
      }
  
      function runAsync(left, eff, k) {
        try {
          return eff(k)();
        } catch (error) {
          k(left(error))();
          return nonCanceler;
        }
      }
  
      var Scheduler = function () {
        var limit    = 1024;
        var size     = 0;
        var ix       = 0;
        var queue    = new Array(limit);
        var draining = false;
  
        function drain() {
          var thunk;
          draining = true;
          while (size !== 0) {
            size--;
            thunk     = queue[ix];
            queue[ix] = void 0;
            ix        = (ix + 1) % limit;
            thunk();
          }
          draining = false;
        }
  
        return {
          isDraining: function () {
            return draining;
          },
          enqueue: function (cb) {
            var i, tmp;
            if (size === limit) {
              tmp = draining;
              drain();
              draining = tmp;
            }
  
            queue[(ix + size) % limit] = cb;
            size++;
  
            if (!draining) {
              drain();
            }
          }
        };
      }();
  
      function Supervisor(util) {
        var fibers  = {};
        var fiberId = 0;
        var count   = 0;
  
        return {
          register: function (fiber) {
            var fid = fiberId++;
            fiber.onComplete({
              rethrow: true,
              handler: function (result) {
                return function () {
                  count--;
                  delete fibers[fid];
                };
              }
            })();
            fibers[fid] = fiber;
            count++;
          },
          isEmpty: function () {
            return count === 0;
          },
          killAll: function (killError, cb) {
            return function () {
              if (count === 0) {
                return cb();
              }
  
              var killCount = 0;
              var kills     = {};
  
              function kill(fid) {
                kills[fid] = fibers[fid].kill(killError, function (result) {
                  return function () {
                    delete kills[fid];
                    killCount--;
                    if (util.isLeft(result) && util.fromLeft(result)) {
                      setTimeout(function () {
                        throw util.fromLeft(result);
                      }, 0);
                    }
                    if (killCount === 0) {
                      cb();
                    }
                  };
                })();
              }
  
              for (var k in fibers) {
                if (fibers.hasOwnProperty(k)) {
                  killCount++;
                  kill(k);
                }
              }
  
              fibers  = {};
              fiberId = 0;
              count   = 0;
  
              return function (error) {
                return new Aff(SYNC, function () {
                  for (var k in kills) {
                    if (kills.hasOwnProperty(k)) {
                      kills[k]();
                    }
                  }
                });
              };
            };
          }
        };
      }
  
      // Fiber state machine
      var SUSPENDED   = 0; // Suspended, pending a join.
      var CONTINUE    = 1; // Interpret the next instruction.
      var STEP_BIND   = 2; // Apply the next bind.
      var STEP_RESULT = 3; // Handle potential failure from a result.
      var PENDING     = 4; // An async effect is running.
      var RETURN      = 5; // The current stack has returned.
      var COMPLETED   = 6; // The entire fiber has completed.
  
      function Fiber(util, supervisor, aff) {
        // Monotonically increasing tick, increased on each asynchronous turn.
        var runTick = 0;
  
        // The current branch of the state machine.
        var status = SUSPENDED;
  
        // The current point of interest for the state machine branch.
        var step      = aff;  // Successful step
        var fail      = null; // Failure step
        var interrupt = null; // Asynchronous interrupt
  
        // Stack of continuations for the current fiber.
        var bhead = null;
        var btail = null;
  
        // Stack of attempts and finalizers for error recovery. Every `Cons` is also
        // tagged with current `interrupt` state. We use this to track which items
        // should be ignored or evaluated as a result of a kill.
        var attempts = null;
  
        // A special state is needed for Bracket, because it cannot be killed. When
        // we enter a bracket acquisition or finalizer, we increment the counter,
        // and then decrement once complete.
        var bracketCount = 0;
  
        // Each join gets a new id so they can be revoked.
        var joinId  = 0;
        var joins   = null;
        var rethrow = true;
  
        // Each invocation of `run` requires a tick. When an asynchronous effect is
        // resolved, we must check that the local tick coincides with the fiber
        // tick before resuming. This prevents multiple async continuations from
        // accidentally resuming the same fiber. A common example may be invoking
        // the provided callback in `makeAff` more than once, but it may also be an
        // async effect resuming after the fiber was already cancelled.
        function run(localRunTick) {
          var tmp, result, attempt;
          while (true) {
            tmp       = null;
            result    = null;
            attempt   = null;
  
            switch (status) {
            case STEP_BIND:
              status = CONTINUE;
              try {
                step   = bhead(step);
                if (btail === null) {
                  bhead = null;
                } else {
                  bhead = btail._1;
                  btail = btail._2;
                }
              } catch (e) {
                status = RETURN;
                fail   = util.left(e);
                step   = null;
              }
              break;
  
            case STEP_RESULT:
              if (util.isLeft(step)) {
                status = RETURN;
                fail   = step;
                step   = null;
              } else if (bhead === null) {
                status = RETURN;
              } else {
                status = STEP_BIND;
                step   = util.fromRight(step);
              }
              break;
  
            case CONTINUE:
              switch (step.tag) {
              case BIND:
                if (bhead) {
                  btail = new Aff(CONS, bhead, btail);
                }
                bhead  = step._2;
                status = CONTINUE;
                step   = step._1;
                break;
  
              case PURE:
                if (bhead === null) {
                  status = RETURN;
                  step   = util.right(step._1);
                } else {
                  status = STEP_BIND;
                  step   = step._1;
                }
                break;
  
              case SYNC:
                status = STEP_RESULT;
                step   = runSync(util.left, util.right, step._1);
                break;
  
              case ASYNC:
                status = PENDING;
                step   = runAsync(util.left, step._1, function (result) {
                  return function () {
                    if (runTick !== localRunTick) {
                      return;
                    }
                    runTick++;
                    Scheduler.enqueue(function () {
                      // It's possible to interrupt the fiber between enqueuing and
                      // resuming, so we need to check that the runTick is still
                      // valid.
                      if (runTick !== localRunTick + 1) {
                        return;
                      }
                      status = STEP_RESULT;
                      step   = result;
                      run(runTick);
                    });
                  };
                });
                return;
  
              case THROW:
                status = RETURN;
                fail   = util.left(step._1);
                step   = null;
                break;
  
              // Enqueue the Catch so that we can call the error handler later on
              // in case of an exception.
              case CATCH:
                if (bhead === null) {
                  attempts = new Aff(CONS, step, attempts, interrupt);
                } else {
                  attempts = new Aff(CONS, step, new Aff(CONS, new Aff(RESUME, bhead, btail), attempts, interrupt), interrupt);
                }
                bhead    = null;
                btail    = null;
                status   = CONTINUE;
                step     = step._1;
                break;
  
              // Enqueue the Bracket so that we can call the appropriate handlers
              // after resource acquisition.
              case BRACKET:
                bracketCount++;
                if (bhead === null) {
                  attempts = new Aff(CONS, step, attempts, interrupt);
                } else {
                  attempts = new Aff(CONS, step, new Aff(CONS, new Aff(RESUME, bhead, btail), attempts, interrupt), interrupt);
                }
                bhead  = null;
                btail  = null;
                status = CONTINUE;
                step   = step._1;
                break;
  
              case FORK:
                status = STEP_RESULT;
                tmp    = Fiber(util, supervisor, step._2);
                if (supervisor) {
                  supervisor.register(tmp);
                }
                if (step._1) {
                  tmp.run();
                }
                step = util.right(tmp);
                break;
  
              case SEQ:
                status = CONTINUE;
                step   = sequential(util, supervisor, step._1);
                break;
              }
              break;
  
            case RETURN:
              bhead = null;
              btail = null;
              // If the current stack has returned, and we have no other stacks to
              // resume or finalizers to run, the fiber has halted and we can
              // invoke all join callbacks. Otherwise we need to resume.
              if (attempts === null) {
                status = COMPLETED;
                step   = interrupt || fail || step;
              } else {
                // The interrupt status for the enqueued item.
                tmp      = attempts._3;
                attempt  = attempts._1;
                attempts = attempts._2;
  
                switch (attempt.tag) {
                // We cannot recover from an unmasked interrupt. Otherwise we should
                // continue stepping, or run the exception handler if an exception
                // was raised.
                case CATCH:
                  // We should compare the interrupt status as well because we
                  // only want it to apply if there has been an interrupt since
                  // enqueuing the catch.
                  if (interrupt && interrupt !== tmp && bracketCount === 0) {
                    status = RETURN;
                  } else if (fail) {
                    status = CONTINUE;
                    step   = attempt._2(util.fromLeft(fail));
                    fail   = null;
                  }
                  break;
  
                // We cannot resume from an unmasked interrupt or exception.
                case RESUME:
                  // As with Catch, we only want to ignore in the case of an
                  // interrupt since enqueing the item.
                  if (interrupt && interrupt !== tmp && bracketCount === 0 || fail) {
                    status = RETURN;
                  } else {
                    bhead  = attempt._1;
                    btail  = attempt._2;
                    status = STEP_BIND;
                    step   = util.fromRight(step);
                  }
                  break;
  
                // If we have a bracket, we should enqueue the handlers,
                // and continue with the success branch only if the fiber has
                // not been interrupted. If the bracket acquisition failed, we
                // should not run either.
                case BRACKET:
                  bracketCount--;
                  if (fail === null) {
                    result   = util.fromRight(step);
                    // We need to enqueue the Release with the same interrupt
                    // status as the Bracket that is initiating it.
                    attempts = new Aff(CONS, new Aff(RELEASE, attempt._2, result), attempts, tmp);
                    // We should only coninue as long as the interrupt status has not changed or
                    // we are currently within a non-interruptable finalizer.
                    if (interrupt === tmp || bracketCount > 0) {
                      status = CONTINUE;
                      step   = attempt._3(result);
                    }
                  }
                  break;
  
                // Enqueue the appropriate handler. We increase the bracket count
                // because it should not be cancelled.
                case RELEASE:
                  attempts = new Aff(CONS, new Aff(FINALIZED, step, fail), attempts, interrupt);
                  status   = CONTINUE;
                  // It has only been killed if the interrupt status has changed
                  // since we enqueued the item, and the bracket count is 0. If the
                  // bracket count is non-zero then we are in a masked state so it's
                  // impossible to be killed.
                  if (interrupt && interrupt !== tmp && bracketCount === 0) {
                    step = attempt._1.killed(util.fromLeft(interrupt))(attempt._2);
                  } else if (fail) {
                    step = attempt._1.failed(util.fromLeft(fail))(attempt._2);
                  } else {
                    step = attempt._1.completed(util.fromRight(step))(attempt._2);
                  }
                  fail = null;
                  bracketCount++;
                  break;
  
                case FINALIZER:
                  bracketCount++;
                  attempts = new Aff(CONS, new Aff(FINALIZED, step, fail), attempts, interrupt);
                  status   = CONTINUE;
                  step     = attempt._1;
                  break;
  
                case FINALIZED:
                  bracketCount--;
                  status = RETURN;
                  step   = attempt._1;
                  fail   = attempt._2;
                  break;
                }
              }
              break;
  
            case COMPLETED:
              for (var k in joins) {
                if (joins.hasOwnProperty(k)) {
                  rethrow = rethrow && joins[k].rethrow;
                  runEff(joins[k].handler(step));
                }
              }
              joins = null;
              // If we have an interrupt and a fail, then the thread threw while
              // running finalizers. This should always rethrow in a fresh stack.
              if (interrupt && fail) {
                setTimeout(function () {
                  throw util.fromLeft(fail);
                }, 0);
              // If we have an unhandled exception, and no other fiber has joined
              // then we need to throw the exception in a fresh stack.
              } else if (util.isLeft(step) && rethrow) {
                setTimeout(function () {
                  // Guard on reathrow because a completely synchronous fiber can
                  // still have an observer which was added after-the-fact.
                  if (rethrow) {
                    throw util.fromLeft(step);
                  }
                }, 0);
              }
              return;
            case SUSPENDED:
              status = CONTINUE;
              break;
            case PENDING: return;
            }
          }
        }
  
        function onComplete(join) {
          return function () {
            if (status === COMPLETED) {
              rethrow = rethrow && join.rethrow;
              join.handler(step)();
              return function () {};
            }
  
            var jid    = joinId++;
            joins      = joins || {};
            joins[jid] = join;
  
            return function() {
              if (joins !== null) {
                delete joins[jid];
              }
            };
          };
        }
  
        function kill(error, cb) {
          return function () {
            if (status === COMPLETED) {
              cb(util.right(void 0))();
              return function () {};
            }
  
            var canceler = onComplete({
              rethrow: false,
              handler: function (/* unused */) {
                return cb(util.right(void 0));
              }
            })();
  
            switch (status) {
            case SUSPENDED:
              interrupt = util.left(error);
              status    = COMPLETED;
              step      = interrupt;
              run(runTick);
              break;
            case PENDING:
              if (interrupt === null) {
                interrupt = util.left(error);
              }
              if (bracketCount === 0) {
                if (status === PENDING) {
                  attempts = new Aff(CONS, new Aff(FINALIZER, step(error)), attempts, interrupt);
                }
                status   = RETURN;
                step     = null;
                fail     = null;
                run(++runTick);
              }
              break;
            default:
              if (interrupt === null) {
                interrupt = util.left(error);
              }
              if (bracketCount === 0) {
                status = RETURN;
                step   = null;
                fail   = null;
              }
            }
  
            return canceler;
          };
        }
  
        function join(cb) {
          return function () {
            var canceler = onComplete({
              rethrow: false,
              handler: cb
            })();
            if (status === SUSPENDED) {
              run(runTick);
            }
            return canceler;
          };
        }
  
        return {
          kill: kill,
          join: join,
          onComplete: onComplete,
          isSuspended: function () {
            return status === SUSPENDED;
          },
          run: function () {
            if (status === SUSPENDED) {
              if (!Scheduler.isDraining()) {
                Scheduler.enqueue(function () {
                  run(runTick);
                });
              } else {
                run(runTick);
              }
            }
          }
        };
      }
  
      function runPar(util, supervisor, par, cb) {
        // Table of all forked fibers.
        var fiberId   = 0;
        var fibers    = {};
  
        // Table of currently running cancelers, as a product of `Alt` behavior.
        var killId    = 0;
        var kills     = {};
  
        // Error used for early cancelation on Alt branches.
        var early     = new Error("[ParAff] Early exit");
  
        // Error used to kill the entire tree.
        var interrupt = null;
  
        // The root pointer of the tree.
        var root      = EMPTY;
  
        // Walks a tree, invoking all the cancelers. Returns the table of pending
        // cancellation fibers.
        function kill(error, par, cb) {
          var step  = par;
          var head  = null;
          var tail  = null;
          var count = 0;
          var kills = {};
          var tmp, kid;
  
          loop: while (true) {
            tmp = null;
  
            switch (step.tag) {
            case FORKED:
              if (step._3 === EMPTY) {
                tmp = fibers[step._1];
                kills[count++] = tmp.kill(error, function (result) {
                  return function () {
                    count--;
                    if (count === 0) {
                      cb(result)();
                    }
                  };
                });
              }
              // Terminal case.
              if (head === null) {
                break loop;
              }
              // Go down the right side of the tree.
              step = head._2;
              if (tail === null) {
                head = null;
              } else {
                head = tail._1;
                tail = tail._2;
              }
              break;
            case MAP:
              step = step._2;
              break;
            case APPLY:
            case ALT:
              if (head) {
                tail = new Aff(CONS, head, tail);
              }
              head = step;
              step = step._1;
              break;
            }
          }
  
          if (count === 0) {
            cb(util.right(void 0))();
          } else {
            // Run the cancelation effects. We alias `count` because it's mutable.
            kid = 0;
            tmp = count;
            for (; kid < tmp; kid++) {
              kills[kid] = kills[kid]();
            }
          }
  
          return kills;
        }
  
        // When a fiber resolves, we need to bubble back up the tree with the
        // result, computing the applicative nodes.
        function join(result, head, tail) {
          var fail, step, lhs, rhs, tmp, kid;
  
          if (util.isLeft(result)) {
            fail = result;
            step = null;
          } else {
            step = result;
            fail = null;
          }
  
          loop: while (true) {
            lhs = null;
            rhs = null;
            tmp = null;
            kid = null;
  
            // We should never continue if the entire tree has been interrupted.
            if (interrupt !== null) {
              return;
            }
  
            // We've made it all the way to the root of the tree, which means
            // the tree has fully evaluated.
            if (head === null) {
              cb(fail || step)();
              return;
            }
  
            // The tree has already been computed, so we shouldn't try to do it
            // again. This should never happen.
            // TODO: Remove this?
            if (head._3 !== EMPTY) {
              return;
            }
  
            switch (head.tag) {
            case MAP:
              if (fail === null) {
                head._3 = util.right(head._1(util.fromRight(step)));
                step    = head._3;
              } else {
                head._3 = fail;
              }
              break;
            case APPLY:
              lhs = head._1._3;
              rhs = head._2._3;
              // If we have a failure we should kill the other side because we
              // can't possible yield a result anymore.
              if (fail) {
                head._3 = fail;
                tmp     = true;
                kid     = killId++;
  
                kills[kid] = kill(early, fail === lhs ? head._2 : head._1, function (/* unused */) {
                  return function () {
                    delete kills[kid];
                    if (tmp) {
                      tmp = false;
                    } else if (tail === null) {
                      join(fail, null, null);
                    } else {
                      join(fail, tail._1, tail._2);
                    }
                  };
                });
  
                if (tmp) {
                  tmp = false;
                  return;
                }
              } else if (lhs === EMPTY || rhs === EMPTY) {
                // We can only proceed if both sides have resolved.
                return;
              } else {
                step    = util.right(util.fromRight(lhs)(util.fromRight(rhs)));
                head._3 = step;
              }
              break;
            case ALT:
              lhs = head._1._3;
              rhs = head._2._3;
              // We can only proceed if both have resolved or we have a success
              if (lhs === EMPTY && util.isLeft(rhs) || rhs === EMPTY && util.isLeft(lhs)) {
                return;
              }
              // If both sides resolve with an error, we should continue with the
              // first error
              if (lhs !== EMPTY && util.isLeft(lhs) && rhs !== EMPTY && util.isLeft(rhs)) {
                fail    = step === lhs ? rhs : lhs;
                step    = null;
                head._3 = fail;
              } else {
                head._3 = step;
                tmp     = true;
                kid     = killId++;
                // Once a side has resolved, we need to cancel the side that is still
                // pending before we can continue.
                kills[kid] = kill(early, step === lhs ? head._2 : head._1, function (/* unused */) {
                  return function () {
                    delete kills[kid];
                    if (tmp) {
                      tmp = false;
                    } else if (tail === null) {
                      join(step, null, null);
                    } else {
                      join(step, tail._1, tail._2);
                    }
                  };
                });
  
                if (tmp) {
                  tmp = false;
                  return;
                }
              }
              break;
            }
  
            if (tail === null) {
              head = null;
            } else {
              head = tail._1;
              tail = tail._2;
            }
          }
        }
  
        function resolve(fiber) {
          return function (result) {
            return function () {
              delete fibers[fiber._1];
              fiber._3 = result;
              join(result, fiber._2._1, fiber._2._2);
            };
          };
        }
  
        // Walks the applicative tree, substituting non-applicative nodes with
        // `FORKED` nodes. In this tree, all applicative nodes use the `_3` slot
        // as a mutable slot for memoization. In an unresolved state, the `_3`
        // slot is `EMPTY`. In the cases of `ALT` and `APPLY`, we always walk
        // the left side first, because both operations are left-associative. As
        // we `RETURN` from those branches, we then walk the right side.
        function run() {
          var status = CONTINUE;
          var step   = par;
          var head   = null;
          var tail   = null;
          var tmp, fid;
  
          loop: while (true) {
            tmp = null;
            fid = null;
  
            switch (status) {
            case CONTINUE:
              switch (step.tag) {
              case MAP:
                if (head) {
                  tail = new Aff(CONS, head, tail);
                }
                head = new Aff(MAP, step._1, EMPTY, EMPTY);
                step = step._2;
                break;
              case APPLY:
                if (head) {
                  tail = new Aff(CONS, head, tail);
                }
                head = new Aff(APPLY, EMPTY, step._2, EMPTY);
                step = step._1;
                break;
              case ALT:
                if (head) {
                  tail = new Aff(CONS, head, tail);
                }
                head = new Aff(ALT, EMPTY, step._2, EMPTY);
                step = step._1;
                break;
              default:
                // When we hit a leaf value, we suspend the stack in the `FORKED`.
                // When the fiber resolves, it can bubble back up the tree.
                fid    = fiberId++;
                status = RETURN;
                tmp    = step;
                step   = new Aff(FORKED, fid, new Aff(CONS, head, tail), EMPTY);
                tmp    = Fiber(util, supervisor, tmp);
                tmp.onComplete({
                  rethrow: false,
                  handler: resolve(step)
                })();
                fibers[fid] = tmp;
                if (supervisor) {
                  supervisor.register(tmp);
                }
              }
              break;
            case RETURN:
              // Terminal case, we are back at the root.
              if (head === null) {
                break loop;
              }
              // If we are done with the right side, we need to continue down the
              // left. Otherwise we should continue up the stack.
              if (head._1 === EMPTY) {
                head._1 = step;
                status  = CONTINUE;
                step    = head._2;
                head._2 = EMPTY;
              } else {
                head._2 = step;
                step    = head;
                if (tail === null) {
                  head  = null;
                } else {
                  head  = tail._1;
                  tail  = tail._2;
                }
              }
            }
          }
  
          // Keep a reference to the tree root so it can be cancelled.
          root = step;
  
          for (fid = 0; fid < fiberId; fid++) {
            fibers[fid].run();
          }
        }
  
        // Cancels the entire tree. If there are already subtrees being canceled,
        // we need to first cancel those joins. We will then add fresh joins for
        // all pending branches including those that were in the process of being
        // canceled.
        function cancel(error, cb) {
          interrupt = util.left(error);
          var innerKills;
          for (var kid in kills) {
            if (kills.hasOwnProperty(kid)) {
              innerKills = kills[kid];
              for (kid in innerKills) {
                if (innerKills.hasOwnProperty(kid)) {
                  innerKills[kid]();
                }
              }
            }
          }
  
          kills = null;
          var newKills = kill(error, root, cb);
  
          return function (killError) {
            return new Aff(ASYNC, function (killCb) {
              return function () {
                for (var kid in newKills) {
                  if (newKills.hasOwnProperty(kid)) {
                    newKills[kid]();
                  }
                }
                return nonCanceler;
              };
            });
          };
        }
  
        run();
  
        return function (killError) {
          return new Aff(ASYNC, function (killCb) {
            return function () {
              return cancel(killError, killCb);
            };
          });
        };
      }
  
      function sequential(util, supervisor, par) {
        return new Aff(ASYNC, function (cb) {
          return function () {
            return runPar(util, supervisor, par, cb);
          };
        });
      }
  
      Aff.EMPTY       = EMPTY;
      Aff.Pure        = AffCtr(PURE);
      Aff.Throw       = AffCtr(THROW);
      Aff.Catch       = AffCtr(CATCH);
      Aff.Sync        = AffCtr(SYNC);
      Aff.Async       = AffCtr(ASYNC);
      Aff.Bind        = AffCtr(BIND);
      Aff.Bracket     = AffCtr(BRACKET);
      Aff.Fork        = AffCtr(FORK);
      Aff.Seq         = AffCtr(SEQ);
      Aff.ParMap      = AffCtr(MAP);
      Aff.ParApply    = AffCtr(APPLY);
      Aff.ParAlt      = AffCtr(ALT);
      Aff.Fiber       = Fiber;
      Aff.Supervisor  = Supervisor;
      Aff.Scheduler   = Scheduler;
      Aff.nonCanceler = nonCanceler;
  
      return Aff;
    }();
  
    exports._pure = Aff.Pure;
  
    exports._throwError = Aff.Throw;
  
    exports._catchError = function (aff) {
      return function (k) {
        return Aff.Catch(aff, k);
      };
    };
  
    exports._map = function (f) {
      return function (aff) {
        if (aff.tag === Aff.Pure.tag) {
          return Aff.Pure(f(aff._1));
        } else {
          return Aff.Bind(aff, function (value) {
            return Aff.Pure(f(value));
          });
        }
      };
    };
  
    exports._bind = function (aff) {
      return function (k) {
        return Aff.Bind(aff, k);
      };
    };
  
    exports._liftEffect = Aff.Sync;
  
    exports._parAffMap = function (f) {
      return function (aff) {
        return Aff.ParMap(f, aff);
      };
    };
  
    exports._parAffApply = function (aff1) {
      return function (aff2) {
        return Aff.ParApply(aff1, aff2);
      };
    };
  
    exports._parAffAlt = function (aff1) {
      return function (aff2) {
        return Aff.ParAlt(aff1, aff2);
      };
    };
  
    exports.makeAff = Aff.Async;
  
    exports._makeFiber = function (util, aff) {
      return function () {
        return Aff.Fiber(util, null, aff);
      };
    };
  
    exports._delay = function () {
      function setDelay(n, k) {
        if (n === 0 && typeof setImmediate !== "undefined") {
          return setImmediate(k);
        } else {
          return setTimeout(k, n);
        }
      }
  
      function clearDelay(n, t) {
        if (n === 0 && typeof clearImmediate !== "undefined") {
          return clearImmediate(t);
        } else {
          return clearTimeout(t);
        }
      }
  
      return function (right, ms) {
        return Aff.Async(function (cb) {
          return function () {
            var timer = setDelay(ms, cb(right()));
            return function () {
              return Aff.Sync(function () {
                return right(clearDelay(ms, timer));
              });
            };
          };
        });
      };
    }();
  
    exports._sequential = Aff.Seq;
  })(PS["Effect.Aff"] = PS["Effect.Aff"] || {});
  (function($PS) {
    // Generated by purs version 0.13.8
    "use strict";
    $PS["Control.Monad.Error.Class"] = $PS["Control.Monad.Error.Class"] || {};
    var exports = $PS["Control.Monad.Error.Class"];
    var Control_Applicative = $PS["Control.Applicative"];
    var Data_Either = $PS["Data.Either"];
    var Data_Functor = $PS["Data.Functor"];                        
    var MonadThrow = function (Monad0, throwError) {
        this.Monad0 = Monad0;
        this.throwError = throwError;
    };
    var MonadError = function (MonadThrow0, catchError) {
        this.MonadThrow0 = MonadThrow0;
        this.catchError = catchError;
    };
    var throwError = function (dict) {
        return dict.throwError;
    };                                                      
    var catchError = function (dict) {
        return dict.catchError;
    };
    var $$try = function (dictMonadError) {
        return function (a) {
            return catchError(dictMonadError)(Data_Functor.map(((((dictMonadError.MonadThrow0()).Monad0()).Bind1()).Apply0()).Functor0())(Data_Either.Right.create)(a))((function () {
                var $17 = Control_Applicative.pure(((dictMonadError.MonadThrow0()).Monad0()).Applicative0());
                return function ($18) {
                    return $17(Data_Either.Left.create($18));
                };
            })());
        };
    };
    exports["catchError"] = catchError;
    exports["throwError"] = throwError;
    exports["MonadThrow"] = MonadThrow;
    exports["MonadError"] = MonadError;
    exports["try"] = $$try;
  })(PS);
  (function($PS) {
    // Generated by purs version 0.13.8
    "use strict";
    $PS["Control.Parallel"] = $PS["Control.Parallel"] || {};
    var exports = $PS["Control.Parallel"];
    var Control_Category = $PS["Control.Category"];
    var Control_Parallel_Class = $PS["Control.Parallel.Class"];
    var Data_Foldable = $PS["Data.Foldable"];                      
    var parTraverse_ = function (dictParallel) {
        return function (dictFoldable) {
            return function (f) {
                var $17 = Control_Parallel_Class.sequential(dictParallel);
                var $18 = Data_Foldable.traverse_(dictParallel.Applicative1())(dictFoldable)((function () {
                    var $20 = Control_Parallel_Class.parallel(dictParallel);
                    return function ($21) {
                        return $20(f($21));
                    };
                })());
                return function ($19) {
                    return $17($18($19));
                };
            };
        };
    };
    var parSequence_ = function (dictParallel) {
        return function (dictFoldable) {
            return parTraverse_(dictParallel)(dictFoldable)(Control_Category.identity(Control_Category.categoryFn));
        };
    };
    exports["parSequence_"] = parSequence_;
  })(PS);
  (function($PS) {
    // Generated by purs version 0.13.8
    "use strict";
    $PS["Effect.Class"] = $PS["Effect.Class"] || {};
    var exports = $PS["Effect.Class"];
    var Control_Category = $PS["Control.Category"];
    var Effect = $PS["Effect"];                
    var MonadEffect = function (Monad0, liftEffect) {
        this.Monad0 = Monad0;
        this.liftEffect = liftEffect;
    };
    var monadEffectEffect = new MonadEffect(function () {
        return Effect.monadEffect;
    }, Control_Category.identity(Control_Category.categoryFn));
    var liftEffect = function (dict) {
        return dict.liftEffect;
    };
    exports["liftEffect"] = liftEffect;
    exports["MonadEffect"] = MonadEffect;
    exports["monadEffectEffect"] = monadEffectEffect;
  })(PS);
  (function(exports) {
    "use strict";
  
    exports.showErrorImpl = function (err) {
      return err.stack || err.toString();
    };
  
    exports.error = function (msg) {
      return new Error(msg);
    };
  
    exports.throwException = function (e) {
      return function () {
        throw e;
      };
    };
  })(PS["Effect.Exception"] = PS["Effect.Exception"] || {});
  (function($PS) {
    // Generated by purs version 0.13.8
    "use strict";
    $PS["Effect.Exception"] = $PS["Effect.Exception"] || {};
    var exports = $PS["Effect.Exception"];
    var $foreign = $PS["Effect.Exception"];
    var Data_Show = $PS["Data.Show"];                                                
    var showError = new Data_Show.Show($foreign.showErrorImpl);
    exports["showError"] = showError;
    exports["error"] = $foreign.error;
    exports["throwException"] = $foreign.throwException;
  })(PS);
  (function(exports) {
    "use strict";
  
    // module Partial.Unsafe
  
    exports.unsafePartial = function (f) {
      return f();
    };
  })(PS["Partial.Unsafe"] = PS["Partial.Unsafe"] || {});
  (function(exports) {
    "use strict";
  
    // module Partial
  
    exports.crashWith = function () {
      return function (msg) {
        throw new Error(msg);
      };
    };
  })(PS["Partial"] = PS["Partial"] || {});
  (function($PS) {
    // Generated by purs version 0.13.8
    "use strict";
    $PS["Partial"] = $PS["Partial"] || {};
    var exports = $PS["Partial"];
    var $foreign = $PS["Partial"];
    exports["crashWith"] = $foreign.crashWith;
  })(PS);
  (function($PS) {
    // Generated by purs version 0.13.8
    "use strict";
    $PS["Partial.Unsafe"] = $PS["Partial.Unsafe"] || {};
    var exports = $PS["Partial.Unsafe"];
    var $foreign = $PS["Partial.Unsafe"];
    var Partial = $PS["Partial"];
    var unsafeCrashWith = function (msg) {
        return $foreign.unsafePartial(function (dictPartial) {
            return Partial.crashWith()(msg);
        });
    };
    exports["unsafeCrashWith"] = unsafeCrashWith;
  })(PS);
  (function($PS) {
    // Generated by purs version 0.13.8
    "use strict";
    $PS["Effect.Aff"] = $PS["Effect.Aff"] || {};
    var exports = $PS["Effect.Aff"];
    var $foreign = $PS["Effect.Aff"];
    var Control_Alt = $PS["Control.Alt"];
    var Control_Applicative = $PS["Control.Applicative"];
    var Control_Apply = $PS["Control.Apply"];
    var Control_Bind = $PS["Control.Bind"];
    var Control_Monad = $PS["Control.Monad"];
    var Control_Monad_Error_Class = $PS["Control.Monad.Error.Class"];
    var Control_Parallel = $PS["Control.Parallel"];
    var Control_Parallel_Class = $PS["Control.Parallel.Class"];
    var Control_Plus = $PS["Control.Plus"];
    var Data_Either = $PS["Data.Either"];
    var Data_Foldable = $PS["Data.Foldable"];
    var Data_Function = $PS["Data.Function"];
    var Data_Functor = $PS["Data.Functor"];
    var Data_Monoid = $PS["Data.Monoid"];
    var Data_Semigroup = $PS["Data.Semigroup"];
    var Data_Unit = $PS["Data.Unit"];
    var Effect = $PS["Effect"];
    var Effect_Class = $PS["Effect.Class"];
    var Effect_Exception = $PS["Effect.Exception"];
    var Partial_Unsafe = $PS["Partial.Unsafe"];
    var Unsafe_Coerce = $PS["Unsafe.Coerce"];
    var Canceler = function (x) {
        return x;
    };           
    var functorParAff = new Data_Functor.Functor($foreign["_parAffMap"]);
    var functorAff = new Data_Functor.Functor($foreign["_map"]);
    var ffiUtil = (function () {
        var unsafeFromRight = function (v) {
            if (v instanceof Data_Either.Right) {
                return v.value0;
            };
            if (v instanceof Data_Either.Left) {
                return Partial_Unsafe.unsafeCrashWith("unsafeFromRight: Left");
            };
            throw new Error("Failed pattern match at Effect.Aff (line 400, column 21 - line 402, column 54): " + [ v.constructor.name ]);
        };
        var unsafeFromLeft = function (v) {
            if (v instanceof Data_Either.Left) {
                return v.value0;
            };
            if (v instanceof Data_Either.Right) {
                return Partial_Unsafe.unsafeCrashWith("unsafeFromLeft: Right");
            };
            throw new Error("Failed pattern match at Effect.Aff (line 395, column 20 - line 397, column 54): " + [ v.constructor.name ]);
        };
        var isLeft = function (v) {
            if (v instanceof Data_Either.Left) {
                return true;
            };
            if (v instanceof Data_Either.Right) {
                return false;
            };
            throw new Error("Failed pattern match at Effect.Aff (line 390, column 12 - line 392, column 20): " + [ v.constructor.name ]);
        };
        return {
            isLeft: isLeft,
            fromLeft: unsafeFromLeft,
            fromRight: unsafeFromRight,
            left: Data_Either.Left.create,
            right: Data_Either.Right.create
        };
    })();
    var makeFiber = function (aff) {
        return $foreign["_makeFiber"](ffiUtil, aff);
    };
    var launchAff = function (aff) {
        return function __do() {
            var fiber = makeFiber(aff)();
            fiber.run();
            return fiber;
        };
    };                                 
    var delay = function (v) {
        return $foreign["_delay"](Data_Either.Right.create, v);
    };
    var applyParAff = new Control_Apply.Apply(function () {
        return functorParAff;
    }, $foreign["_parAffApply"]);
    var monadAff = new Control_Monad.Monad(function () {
        return applicativeAff;
    }, function () {
        return bindAff;
    });
    var bindAff = new Control_Bind.Bind(function () {
        return applyAff;
    }, $foreign["_bind"]);
    var applyAff = new Control_Apply.Apply(function () {
        return functorAff;
    }, Control_Monad.ap(monadAff));
    var applicativeAff = new Control_Applicative.Applicative(function () {
        return applyAff;
    }, $foreign["_pure"]);
    var monadEffectAff = new Effect_Class.MonadEffect(function () {
        return monadAff;
    }, $foreign["_liftEffect"]);
    var effectCanceler = (function () {
        var $45 = Effect_Class.liftEffect(monadEffectAff);
        return function ($46) {
            return Canceler(Data_Function["const"]($45($46)));
        };
    })();
    var monadThrowAff = new Control_Monad_Error_Class.MonadThrow(function () {
        return monadAff;
    }, $foreign["_throwError"]);
    var monadErrorAff = new Control_Monad_Error_Class.MonadError(function () {
        return monadThrowAff;
    }, $foreign["_catchError"]);                                  
    var runAff = function (k) {
        return function (aff) {
            return launchAff(Control_Bind.bindFlipped(bindAff)((function () {
                var $49 = Effect_Class.liftEffect(monadEffectAff);
                return function ($50) {
                    return $49(k($50));
                };
            })())(Control_Monad_Error_Class["try"](monadErrorAff)(aff)));
        };
    };
    var runAff_ = function (k) {
        return function (aff) {
            return Data_Functor["void"](Effect.functorEffect)(runAff(k)(aff));
        };
    };
    var parallelAff = new Control_Parallel_Class.Parallel(function () {
        return applicativeParAff;
    }, function () {
        return monadAff;
    }, Unsafe_Coerce.unsafeCoerce, $foreign["_sequential"]);
    var applicativeParAff = new Control_Applicative.Applicative(function () {
        return applyParAff;
    }, (function () {
        var $53 = Control_Parallel_Class.parallel(parallelAff);
        var $54 = Control_Applicative.pure(applicativeAff);
        return function ($55) {
            return $53($54($55));
        };
    })());
    var semigroupCanceler = new Data_Semigroup.Semigroup(function (v) {
        return function (v1) {
            return function (err) {
                return Control_Parallel.parSequence_(parallelAff)(Data_Foldable.foldableArray)([ v(err), v1(err) ]);
            };
        };
    });
    var nonCanceler = Data_Function["const"](Control_Applicative.pure(applicativeAff)(Data_Unit.unit));
    var monoidCanceler = new Data_Monoid.Monoid(function () {
        return semigroupCanceler;
    }, nonCanceler);
    var never = $foreign.makeAff(function (v) {
        return Control_Applicative.pure(Effect.applicativeEffect)(Data_Monoid.mempty(monoidCanceler));
    });  
    var altParAff = new Control_Alt.Alt(function () {
        return functorParAff;
    }, $foreign["_parAffAlt"]);
    var altAff = new Control_Alt.Alt(function () {
        return functorAff;
    }, function (a1) {
        return function (a2) {
            return Control_Monad_Error_Class.catchError(monadErrorAff)(a1)(Data_Function["const"](a2));
        };
    });
    var plusAff = new Control_Plus.Plus(function () {
        return altAff;
    }, Control_Monad_Error_Class.throwError(monadThrowAff)(Effect_Exception.error("Always fails")));
    var plusParAff = new Control_Plus.Plus(function () {
        return altParAff;
    }, Control_Parallel_Class.parallel(parallelAff)(Control_Plus.empty(plusAff)));
    exports["runAff_"] = runAff_;
    exports["delay"] = delay;
    exports["never"] = never;
    exports["nonCanceler"] = nonCanceler;
    exports["effectCanceler"] = effectCanceler;
    exports["functorAff"] = functorAff;
    exports["applicativeAff"] = applicativeAff;
    exports["bindAff"] = bindAff;
    exports["monadEffectAff"] = monadEffectAff;
    exports["altParAff"] = altParAff;
    exports["plusParAff"] = plusParAff;
    exports["parallelAff"] = parallelAff;
    exports["makeAff"] = $foreign.makeAff;
  })(PS);
  (function($PS) {
    // Generated by purs version 0.13.8
    "use strict";
    $PS["Effect.Aff.AVar"] = $PS["Effect.Aff.AVar"] || {};
    var exports = $PS["Effect.Aff.AVar"];
    var Effect_AVar = $PS["Effect.AVar"];
    var Effect_Aff = $PS["Effect.Aff"];
    var take = function (avar) {
        return Effect_Aff.makeAff(function (k) {
            return function __do() {
                var c = Effect_AVar.take(avar)(k)();
                return Effect_Aff.effectCanceler(c);
            };
        });
    };
    exports["take"] = take;
  })(PS);
  (function($PS) {
    // Generated by purs version 0.13.8
    "use strict";
    $PS["Effect.Aff.Class"] = $PS["Effect.Aff.Class"] || {};
    var exports = $PS["Effect.Aff.Class"];
    var Control_Category = $PS["Control.Category"];
    var Effect_Aff = $PS["Effect.Aff"];                
    var MonadAff = function (MonadEffect0, liftAff) {
        this.MonadEffect0 = MonadEffect0;
        this.liftAff = liftAff;
    };
    var monadAffAff = new MonadAff(function () {
        return Effect_Aff.monadEffectAff;
    }, Control_Category.identity(Control_Category.categoryFn));
    var liftAff = function (dict) {
        return dict.liftAff;
    };
    exports["liftAff"] = liftAff;
    exports["MonadAff"] = MonadAff;
    exports["monadAffAff"] = monadAffAff;
  })(PS);
  (function(exports) {
    "use strict";
  
    exports.log = function (s) {
      return function () {
        console.log(s);
        return {};
      };
    };
  })(PS["Effect.Console"] = PS["Effect.Console"] || {});
  (function($PS) {
    // Generated by purs version 0.13.8
    "use strict";
    $PS["Effect.Console"] = $PS["Effect.Console"] || {};
    var exports = $PS["Effect.Console"];
    var $foreign = $PS["Effect.Console"];
    exports["log"] = $foreign.log;
  })(PS);
  (function($PS) {
    // Generated by purs version 0.13.8
    "use strict";
    $PS["Concur.Core.Types"] = $PS["Concur.Core.Types"] || {};
    var exports = $PS["Concur.Core.Types"];
    var Control_Alt = $PS["Control.Alt"];
    var Control_Alternative = $PS["Control.Alternative"];
    var Control_Applicative = $PS["Control.Applicative"];
    var Control_Bind = $PS["Control.Bind"];
    var Control_Category = $PS["Control.Category"];
    var Control_Monad = $PS["Control.Monad"];
    var Control_Monad_Free = $PS["Control.Monad.Free"];
    var Control_MultiAlternative = $PS["Control.MultiAlternative"];
    var Control_Parallel_Class = $PS["Control.Parallel.Class"];
    var Control_Plus = $PS["Control.Plus"];
    var Control_ShiftMap = $PS["Control.ShiftMap"];
    var Data_Array_NonEmpty = $PS["Data.Array.NonEmpty"];
    var Data_Array_NonEmpty_Internal = $PS["Data.Array.NonEmpty.Internal"];
    var Data_Either = $PS["Data.Either"];
    var Data_FoldableWithIndex = $PS["Data.FoldableWithIndex"];
    var Data_Functor = $PS["Data.Functor"];
    var Data_Maybe = $PS["Data.Maybe"];
    var Data_Monoid = $PS["Data.Monoid"];
    var Data_Semigroup = $PS["Data.Semigroup"];
    var Data_Semigroup_Foldable = $PS["Data.Semigroup.Foldable"];
    var Data_Show = $PS["Data.Show"];
    var Data_Tuple = $PS["Data.Tuple"];
    var Effect = $PS["Effect"];
    var Effect_AVar = $PS["Effect.AVar"];
    var Effect_Aff = $PS["Effect.Aff"];
    var Effect_Aff_AVar = $PS["Effect.Aff.AVar"];
    var Effect_Aff_Class = $PS["Effect.Aff.Class"];
    var Effect_Class = $PS["Effect.Class"];
    var Effect_Console = $PS["Effect.Console"];
    var Effect_Exception = $PS["Effect.Exception"];                
    var WidgetStep = function (x) {
        return x;
    };
    var Widget = function (x) {
        return x;
    };
    var widgetShiftMap = new Control_ShiftMap.ShiftMap(function (f) {
        return f(Control_Category.identity(Control_Category.categoryFn));
    });                                                  
    var widgetFunctor = Control_Monad_Free.freeFunctor;
    var widgetBind = Control_Monad_Free.freeBind;  
    var widgetApplicative = Control_Monad_Free.freeApplicative;
    var widgetMonad = new Control_Monad.Monad(function () {
        return widgetApplicative;
    }, function () {
        return widgetBind;
    });
    var unWidget = function (v) {
        return v;
    };
    var resume = function (dictFunctor) {
        return Control_Monad_Free["resume'"](function (g) {
            return function (i) {
                return new Data_Either.Right(Data_Functor.map(dictFunctor)(i)(g));
            };
        })(Data_Either.Left.create);
    };
    var functorWidgetStep = new Data_Functor.Functor(function (f) {
        return function (v) {
            var mod = function (v1) {
                if (v1 instanceof Data_Either.Right) {
                    return new Data_Either.Right({
                        cont: Data_Functor.map(Effect_Aff.functorAff)(f)(v1.value0.cont),
                        view: v1.value0.view
                    });
                };
                if (v1 instanceof Data_Either.Left) {
                    return new Data_Either.Left(Data_Functor.map(Effect.functorEffect)(f)(v1.value0));
                };
                throw new Error("Failed pattern match at Concur.Core.Types (line 45, column 5 - line 45, column 57): " + [ v1.constructor.name ]);
            };
            return mod(v);
        };
    });
    var effAction = function ($82) {
        return Widget(Control_Monad_Free.liftF(WidgetStep(Data_Either.Left.create($82))));
    };
    var widgetMonadEff = function (dictMonoid) {
        return new Effect_Class.MonadEffect(function () {
            return widgetMonad;
        }, effAction);
    };
    var displayStep = function (v) {
        return new Data_Either.Right({
            view: v,
            cont: Effect_Aff.never
        });
    };
    var display = function (v) {
        return Control_Monad_Free.liftF(displayStep(v));
    };
    var widgetSemigroup = function (dictMonoid) {
        return new Data_Semigroup.Semigroup(function (w1) {
            return function (w2) {
                return Control_MultiAlternative.orr(widgetMultiAlternative(dictMonoid))([ w1, w2 ]);
            };
        });
    };
    var widgetPlus = function (dictMonoid) {
        return new Control_Plus.Plus(function () {
            return widgetAlt(dictMonoid);
        }, display(Data_Monoid.mempty(dictMonoid)));
    };
    var widgetMultiAlternative = function (dictMonoid) {
        return new Control_MultiAlternative.MultiAlternative(function () {
            return widgetPlus(dictMonoid);
        }, function (wss) {
            var merge = function (dictMonoid1) {
                return function (ws) {
                    return function (wscs) {
                        var wsm = Data_Functor.map(Data_Array_NonEmpty_Internal.functorNonEmptyArray)(function ($83) {
                            return Control_Monad_Free.wrap(WidgetStep(Data_Either.Right.create($83)));
                        })(ws);
                        return Control_Bind.bind(Effect_Aff.bindAff)(Control_Parallel_Class.sequential(Effect_Aff.parallelAff)(Data_FoldableWithIndex.foldlWithIndex(Data_Array_NonEmpty_Internal.foldableWithIndexNonEmptyArray)(function (i) {
                            return function (r) {
                                return function (w) {
                                    return Control_Alt.alt(Effect_Aff.altParAff)(Control_Parallel_Class.parallel(Effect_Aff.parallelAff)(Data_Functor.map(Effect_Aff.functorAff)(Data_Tuple.Tuple.create(i))(w)))(r);
                                };
                            };
                        })(Control_Plus.empty(Effect_Aff.plusParAff))(wscs)))(function (v) {
                            return Control_Applicative.pure(Effect_Aff.applicativeAff)(combine(dictMonoid1)(Data_Maybe.fromMaybe(wsm)(Data_Array_NonEmpty.updateAt(v.value0)(v.value1)(wsm))));
                        });
                    };
                };
            };
            var combineViewsConts = function (dictMonoid1) {
                return function (ws) {
                    return Control_Monad_Free.wrap(WidgetStep(new Data_Either.Right({
                        view: Data_Semigroup_Foldable.foldMap1(Data_Array_NonEmpty_Internal.foldable1NonEmptyArray)(dictMonoid1.Semigroup0())(function (v) {
                            return v.view;
                        })(ws),
                        cont: merge(dictMonoid1)(ws)(Data_Functor.map(Data_Array_NonEmpty_Internal.functorNonEmptyArray)(function (v) {
                            return v.cont;
                        })(ws))
                    })));
                };
            };
            var combineInner1 = function (dictMonoid1) {
                return function (ws) {
                    return function (freeNarr) {
                        var x = Data_Array_NonEmpty.uncons(freeNarr);
                        var v = resume(functorWidgetStep)(x.head);
                        if (v instanceof Data_Either.Left) {
                            return Control_Applicative.pure(Control_Monad_Free.freeApplicative)(v.value0);
                        };
                        if (v instanceof Data_Either.Right) {
                            if (v.value0 instanceof Data_Either.Left) {
                                return Control_Monad_Free.wrap(WidgetStep(new Data_Either.Left(function __do() {
                                    var w = v.value0.value0();
                                    return combineInner1(dictMonoid1)(ws)(Data_Array_NonEmpty["cons'"](w)(x.tail));
                                })));
                            };
                            if (v.value0 instanceof Data_Either.Right) {
                                return combineInner(dictMonoid1)(Data_Array_NonEmpty.snoc(ws)(v.value0.value0))(x.tail);
                            };
                            throw new Error("Failed pattern match at Concur.Core.Types (line 138, column 34 - line 142, column 61): " + [ v.value0.constructor.name ]);
                        };
                        throw new Error("Failed pattern match at Concur.Core.Types (line 136, column 10 - line 142, column 61): " + [ v.constructor.name ]);
                    };
                };
            };
            var combineInner = function (dictMonoid1) {
                return function (ws) {
                    return function (freeArr) {
                        var v = Data_Array_NonEmpty.fromArray(freeArr);
                        if (v instanceof Data_Maybe.Nothing) {
                            return combineViewsConts(dictMonoid1)(ws);
                        };
                        if (v instanceof Data_Maybe.Just) {
                            return combineInner1(dictMonoid1)(ws)(v.value0);
                        };
                        throw new Error("Failed pattern match at Concur.Core.Types (line 113, column 31 - line 116, column 49): " + [ v.constructor.name ]);
                    };
                };
            };
            var combine = function (dictMonoid1) {
                return function (wfs) {
                    var x = Data_Array_NonEmpty.uncons(wfs);
                    var v = resume(functorWidgetStep)(x.head);
                    if (v instanceof Data_Either.Left) {
                        return Control_Applicative.pure(Control_Monad_Free.freeApplicative)(v.value0);
                    };
                    if (v instanceof Data_Either.Right) {
                        if (v.value0 instanceof Data_Either.Left) {
                            return Control_Monad_Free.wrap(WidgetStep(new Data_Either.Left(function __do() {
                                var w = v.value0.value0();
                                return combine(dictMonoid1)(Data_Array_NonEmpty["cons'"](w)(x.tail));
                            })));
                        };
                        if (v.value0 instanceof Data_Either.Right) {
                            return combineInner(dictMonoid1)(Data_Array_NonEmpty.singleton(v.value0.value0))(x.tail);
                        };
                        throw new Error("Failed pattern match at Concur.Core.Types (line 101, column 34 - line 105, column 63): " + [ v.value0.constructor.name ]);
                    };
                    throw new Error("Failed pattern match at Concur.Core.Types (line 99, column 10 - line 105, column 63): " + [ v.constructor.name ]);
                };
            };
            var v = Data_Array_NonEmpty.fromArray(wss);
            if (v instanceof Data_Maybe.Just) {
                return Widget(combine(dictMonoid)(Data_Functor.map(Data_Array_NonEmpty_Internal.functorNonEmptyArray)(unWidget)(v.value0)));
            };
            if (v instanceof Data_Maybe.Nothing) {
                return Control_Plus.empty(widgetPlus(dictMonoid));
            };
            throw new Error("Failed pattern match at Concur.Core.Types (line 88, column 13 - line 90, column 21): " + [ v.constructor.name ]);
        });
    };
    var widgetAlt = function (dictMonoid) {
        return new Control_Alt.Alt(function () {
            return widgetFunctor;
        }, Data_Semigroup.append(widgetSemigroup(dictMonoid)));
    };
    var widgetAlternative = function (dictMonoid) {
        return new Control_Alternative.Alternative(function () {
            return widgetApplicative;
        }, function () {
            return widgetPlus(dictMonoid);
        });
    };
    var affAction = function (v) {
        return function (aff) {
            var handler = function (v1) {
                return function (v2) {
                    if (v2 instanceof Data_Either.Left) {
                        return Effect_Console.log("Aff failed - " + Data_Show.show(Effect_Exception.showError)(v2.value0));
                    };
                    if (v2 instanceof Data_Either.Right) {
                        return Data_Functor["void"](Effect.functorEffect)(Effect_AVar.tryPut(v2.value0)(v1));
                    };
                    throw new Error("Failed pattern match at Concur.Core.Types (line 237, column 3 - line 237, column 55): " + [ v1.constructor.name, v2.constructor.name ]);
                };
            };
            return Widget(Control_Monad_Free.wrap(WidgetStep(new Data_Either.Left(function __do() {
                var $$var = Effect_AVar.empty();
                Effect_Aff.runAff_(handler($$var))(aff)();
                var ma = Effect_AVar.tryTake($$var)();
                if (ma instanceof Data_Maybe.Just) {
                    return Control_Applicative.pure(Control_Monad_Free.freeApplicative)(ma.value0);
                };
                if (ma instanceof Data_Maybe.Nothing) {
                    return Control_Monad_Free.liftF(WidgetStep(new Data_Either.Right({
                        view: v,
                        cont: Effect_Aff_AVar.take($$var)
                    })));
                };
                throw new Error("Failed pattern match at Concur.Core.Types (line 232, column 8 - line 234, column 75): " + [ ma.constructor.name ]);
            }))));
        };
    };
    var widgetMonadAff = function (dictMonoid) {
        return new Effect_Aff_Class.MonadAff(function () {
            return widgetMonadEff(dictMonoid);
        }, affAction(Data_Monoid.mempty(dictMonoid)));
    };
    exports["WidgetStep"] = WidgetStep;
    exports["Widget"] = Widget;
    exports["unWidget"] = unWidget;
    exports["resume"] = resume;
    exports["display"] = display;
    exports["functorWidgetStep"] = functorWidgetStep;
    exports["widgetBind"] = widgetBind;
    exports["widgetMonad"] = widgetMonad;
    exports["widgetShiftMap"] = widgetShiftMap;
    exports["widgetMultiAlternative"] = widgetMultiAlternative;
    exports["widgetAlt"] = widgetAlt;
    exports["widgetAlternative"] = widgetAlternative;
    exports["widgetMonadEff"] = widgetMonadEff;
    exports["widgetMonadAff"] = widgetMonadAff;
  })(PS);
  (function($PS) {
    // Generated by purs version 0.13.8
    "use strict";
    $PS["Concur.Core"] = $PS["Concur.Core"] || {};
    var exports = $PS["Concur.Core"];
    var Concur_Core_Types = $PS["Concur.Core.Types"];
    var Control_Alt = $PS["Control.Alt"];
    var Control_Applicative = $PS["Control.Applicative"];
    var Control_Monad_Free = $PS["Control.Monad.Free"];
    var Control_Parallel_Class = $PS["Control.Parallel.Class"];
    var Data_Either = $PS["Data.Either"];
    var Data_Functor = $PS["Data.Functor"];
    var Effect = $PS["Effect"];
    var Effect_AVar = $PS["Effect.AVar"];
    var Effect_Aff = $PS["Effect.Aff"];
    var Effect_Aff_AVar = $PS["Effect.Aff.AVar"];
    var Effect_Aff_Class = $PS["Effect.Aff.Class"];                
    var mkNodeWidget$prime = function (mkView) {
        return function (w) {
            var v = Concur_Core_Types.resume(Concur_Core_Types.functorWidgetStep)(w);
            if (v instanceof Data_Either.Left) {
                return Control_Applicative.pure(Control_Monad_Free.freeApplicative)(v.value0);
            };
            if (v instanceof Data_Either.Right) {
                if (v.value0 instanceof Data_Either.Left) {
                    return Control_Monad_Free.wrap(Concur_Core_Types.WidgetStep(new Data_Either.Left(function __do() {
                        var w$prime = v.value0.value0();
                        return mkNodeWidget$prime(mkView)(w$prime);
                    })));
                };
                if (v.value0 instanceof Data_Either.Right) {
                    return Control_Monad_Free.wrap(Concur_Core_Types.WidgetStep(new Data_Either.Left(function __do() {
                        var $$var = Effect_AVar.empty();
                        var eventHandler = function (a) {
                            return Data_Functor["void"](Effect.functorEffect)(Effect_AVar.tryPut(Control_Applicative.pure(Control_Monad_Free.freeApplicative)(a))($$var));
                        };
                        var cont$prime = Control_Parallel_Class.sequential(Effect_Aff.parallelAff)(Control_Alt.alt(Effect_Aff.altParAff)(Control_Parallel_Class.parallel(Effect_Aff.parallelAff)(Effect_Aff_Class.liftAff(Effect_Aff_Class.monadAffAff)(Effect_Aff_AVar.take($$var))))(Control_Parallel_Class.parallel(Effect_Aff.parallelAff)(Data_Functor.map(Effect_Aff.functorAff)(mkNodeWidget$prime(mkView))(v.value0.value0.cont))));
                        return Control_Monad_Free.wrap(Concur_Core_Types.WidgetStep(new Data_Either.Right({
                            view: mkView(eventHandler)(v.value0.value0.view),
                            cont: cont$prime
                        })));
                    })));
                };
                throw new Error("Failed pattern match at Concur.Core (line 36, column 28 - line 49, column 10): " + [ v.value0.constructor.name ]);
            };
            throw new Error("Failed pattern match at Concur.Core (line 34, column 26 - line 49, column 10): " + [ v.constructor.name ]);
        };
    };
    var mkNodeWidget = function (mkView) {
        return function (v) {
            return mkNodeWidget$prime(mkView)(v);
        };
    };
    exports["mkNodeWidget"] = mkNodeWidget;
  })(PS);
  (function($PS) {
    // Generated by purs version 0.13.8
    "use strict";
    $PS["Concur.Core.Props"] = $PS["Concur.Core.Props"] || {};
    var exports = $PS["Concur.Core.Props"];
    var Control_Applicative = $PS["Control.Applicative"];
    var Data_Functor = $PS["Data.Functor"];
    var Data_Unit = $PS["Data.Unit"];
    var Effect = $PS["Effect"];                
    var PrimProp = (function () {
        function PrimProp(value0) {
            this.value0 = value0;
        };
        PrimProp.create = function (value0) {
            return new PrimProp(value0);
        };
        return PrimProp;
    })();
    var Handler = (function () {
        function Handler(value0) {
            this.value0 = value0;
        };
        Handler.create = function (value0) {
            return new Handler(value0);
        };
        return Handler;
    })();
    var mkProp = function (v) {
        return function (v1) {
            if (v1 instanceof PrimProp) {
                return v1.value0;
            };
            if (v1 instanceof Handler) {
                return v1.value0(v);
            };
            throw new Error("Failed pattern match at Concur.Core.Props (line 18, column 1 - line 22, column 7): " + [ v.constructor.name, v1.constructor.name ]);
        };
    };
    var functorProps = new Data_Functor.Functor(function (v) {
        return function (v1) {
            if (v1 instanceof PrimProp) {
                return new PrimProp(v1.value0);
            };
            if (v1 instanceof Handler) {
                return new Handler(function (k) {
                    return v1.value0(function ($25) {
                        return k(v($25));
                    });
                });
            };
            throw new Error("Failed pattern match at Concur.Core.Props (line 13, column 1 - line 15, column 48): " + [ v.constructor.name, v1.constructor.name ]);
        };
    });
    var filterProp = function (v) {
        return function (v1) {
            if (v1 instanceof PrimProp) {
                return v1;
            };
            if (v1 instanceof Handler) {
                return new Handler(function (h) {
                    return v1.value0(function (a) {
                        var $23 = v(a);
                        if ($23) {
                            return h(a);
                        };
                        return Control_Applicative.pure(Effect.applicativeEffect)(Data_Unit.unit);
                    });
                });
            };
            throw new Error("Failed pattern match at Concur.Core.Props (line 37, column 1 - line 41, column 12): " + [ v.constructor.name, v1.constructor.name ]);
        };
    };
    exports["PrimProp"] = PrimProp;
    exports["Handler"] = Handler;
    exports["mkProp"] = mkProp;
    exports["filterProp"] = filterProp;
    exports["functorProps"] = functorProps;
  })(PS);
  (function($PS) {
    // Generated by purs version 0.13.8
    "use strict";
    $PS["Concur.Core.DOM"] = $PS["Concur.Core.DOM"] || {};
    var exports = $PS["Concur.Core.DOM"];
    var Concur_Core = $PS["Concur.Core"];
    var Concur_Core_Props = $PS["Concur.Core.Props"];
    var Control_MultiAlternative = $PS["Control.MultiAlternative"];
    var Control_ShiftMap = $PS["Control.ShiftMap"];
    var Data_Functor = $PS["Data.Functor"];
    var el = function (dictShiftMap) {
        return function (dictFunctor) {
            return function (e) {
                return function (props) {
                    return Control_ShiftMap.shiftMap(dictShiftMap)(function (f) {
                        return function (w) {
                            return Concur_Core.mkNodeWidget(function (h) {
                                return function (v) {
                                    return e(Data_Functor.map(dictFunctor)((function () {
                                        var $7 = Concur_Core_Props.mkProp(h);
                                        var $8 = Data_Functor.map(Concur_Core_Props.functorProps)(f);
                                        return function ($9) {
                                            return $7($8($9));
                                        };
                                    })())(props))(v);
                                };
                            })(w);
                        };
                    });
                };
            };
        };
    };
    var el$prime = function (dictShiftMap) {
        return function (dictMultiAlternative) {
            return function (dictFunctor) {
                return function (e) {
                    return function (props) {
                        var $10 = el(dictShiftMap)(dictFunctor)(e)(props);
                        var $11 = Control_MultiAlternative.orr(dictMultiAlternative);
                        return function ($12) {
                            return $10($11($12));
                        };
                    };
                };
            };
        };
    };
    exports["el'"] = el$prime;
  })(PS);
  (function($PS) {
    // Generated by purs version 0.13.8
    "use strict";
    $PS["Concur.VDom.Types"] = $PS["Concur.VDom.Types"] || {};
    var exports = $PS["Concur.VDom.Types"];
    var HTMLNode = function (x) {
        return x;
    };
    var unHTMLNode = function (v) {
        return v;
    };
    var unHTML = function (x) {
        return x;
    };
    var mkHTMLNode = HTMLNode;
    exports["unHTMLNode"] = unHTMLNode;
    exports["mkHTMLNode"] = mkHTMLNode;
    exports["unHTML"] = unHTML;
  })(PS);
  (function($PS) {
    // Generated by purs version 0.13.8
    "use strict";
    $PS["Data.Bifunctor"] = $PS["Data.Bifunctor"] || {};
    var exports = $PS["Data.Bifunctor"];                           
    var Bifunctor = function (bimap) {
        this.bimap = bimap;
    };
    var bimap = function (dict) {
        return dict.bimap;
    };
    exports["bimap"] = bimap;
    exports["Bifunctor"] = Bifunctor;
  })(PS);
  (function($PS) {
    // Generated by purs version 0.13.8
    "use strict";
    $PS["Halogen.VDom.Types"] = $PS["Halogen.VDom.Types"] || {};
    var exports = $PS["Halogen.VDom.Types"];
    var Data_Bifunctor = $PS["Data.Bifunctor"];
    var Data_Functor = $PS["Data.Functor"];
    var Data_Tuple = $PS["Data.Tuple"];
    var Unsafe_Coerce = $PS["Unsafe.Coerce"];
    var Text = (function () {
        function Text(value0) {
            this.value0 = value0;
        };
        Text.create = function (value0) {
            return new Text(value0);
        };
        return Text;
    })();
    var Elem = (function () {
        function Elem(value0, value1, value2, value3) {
            this.value0 = value0;
            this.value1 = value1;
            this.value2 = value2;
            this.value3 = value3;
        };
        Elem.create = function (value0) {
            return function (value1) {
                return function (value2) {
                    return function (value3) {
                        return new Elem(value0, value1, value2, value3);
                    };
                };
            };
        };
        return Elem;
    })();
    var Keyed = (function () {
        function Keyed(value0, value1, value2, value3) {
            this.value0 = value0;
            this.value1 = value1;
            this.value2 = value2;
            this.value3 = value3;
        };
        Keyed.create = function (value0) {
            return function (value1) {
                return function (value2) {
                    return function (value3) {
                        return new Keyed(value0, value1, value2, value3);
                    };
                };
            };
        };
        return Keyed;
    })();
    var Widget = (function () {
        function Widget(value0) {
            this.value0 = value0;
        };
        Widget.create = function (value0) {
            return new Widget(value0);
        };
        return Widget;
    })();
    var Grafted = (function () {
        function Grafted(value0) {
            this.value0 = value0;
        };
        Grafted.create = function (value0) {
            return new Grafted(value0);
        };
        return Grafted;
    })();
    var Graft = (function () {
        function Graft(value0, value1, value2) {
            this.value0 = value0;
            this.value1 = value1;
            this.value2 = value2;
        };
        Graft.create = function (value0) {
            return function (value1) {
                return function (value2) {
                    return new Graft(value0, value1, value2);
                };
            };
        };
        return Graft;
    })();
    var unGraft = function (f) {
        return function ($58) {
            return f($58);
        };
    };           
    var graft = Unsafe_Coerce.unsafeCoerce;
    var bifunctorGraft = new Data_Bifunctor.Bifunctor(function (f) {
        return function (g) {
            return unGraft(function (v) {
                return graft(new Graft(function ($60) {
                    return f(v.value0($60));
                }, function ($61) {
                    return g(v.value1($61));
                }, v.value2));
            });
        };
    });
    var runGraft = unGraft(function (v) {
        var go = function (v2) {
            if (v2 instanceof Text) {
                return new Text(v2.value0);
            };
            if (v2 instanceof Elem) {
                return new Elem(v2.value0, v2.value1, v.value0(v2.value2), Data_Functor.map(Data_Functor.functorArray)(go)(v2.value3));
            };
            if (v2 instanceof Keyed) {
                return new Keyed(v2.value0, v2.value1, v.value0(v2.value2), Data_Functor.map(Data_Functor.functorArray)(Data_Functor.map(Data_Tuple.functorTuple)(go))(v2.value3));
            };
            if (v2 instanceof Widget) {
                return new Widget(v.value1(v2.value0));
            };
            if (v2 instanceof Grafted) {
                return new Grafted(Data_Bifunctor.bimap(bifunctorGraft)(v.value0)(v.value1)(v2.value0));
            };
            throw new Error("Failed pattern match at Halogen.VDom.Types (line 86, column 7 - line 86, column 27): " + [ v2.constructor.name ]);
        };
        return go(v.value2);
    });
    exports["Text"] = Text;
    exports["Elem"] = Elem;
    exports["Keyed"] = Keyed;
    exports["Widget"] = Widget;
    exports["Grafted"] = Grafted;
    exports["runGraft"] = runGraft;
  })(PS);
  (function($PS) {
    // Generated by purs version 0.13.8
    "use strict";
    $PS["Concur.VDom.DOM"] = $PS["Concur.VDom.DOM"] || {};
    var exports = $PS["Concur.VDom.DOM"];
    var Concur_Core_DOM = $PS["Concur.Core.DOM"];
    var Concur_Core_LiftWidget = $PS["Concur.Core.LiftWidget"];
    var Concur_Core_Types = $PS["Concur.Core.Types"];
    var Concur_VDom_Types = $PS["Concur.VDom.Types"];
    var Data_Functor = $PS["Data.Functor"];
    var Data_Maybe = $PS["Data.Maybe"];
    var Halogen_VDom_Types = $PS["Halogen.VDom.Types"];                
    var viewAdapter = function (f) {
        return function (ps) {
            return function (vs) {
                return [ f(ps)(vs) ];
            };
        };
    };
    var text = function (dictLiftWidget) {
        return function (str) {
            var wid = Concur_Core_Types.display([ Concur_VDom_Types.mkHTMLNode(new Halogen_VDom_Types.Text(str)) ]);
            return Concur_Core_LiftWidget.liftWidget(dictLiftWidget)(wid);
        };
    };
    var nodeBuilder = function (s) {
        return function (prop) {
            return function (c) {
                return Concur_VDom_Types.mkHTMLNode(new Halogen_VDom_Types.Elem(Data_Maybe.Nothing.value, s, prop, Concur_VDom_Types.unHTML(c)));
            };
        };
    };
    var el$prime = function (dictShiftMap) {
        return function (dictMultiAlternative) {
            return function (f) {
                return Concur_Core_DOM["el'"](dictShiftMap)(dictMultiAlternative)(Data_Functor.functorArray)(viewAdapter(f));
            };
        };
    };
    var node = function (s) {
        return function (dictMultiAlternative) {
            return function (dictShiftMap) {
                return el$prime(dictShiftMap)(dictMultiAlternative)(nodeBuilder(s));
            };
        };
    };
    var em = function (dictMultiAlternative) {
        return function (dictShiftMap) {
            return node("em")(dictMultiAlternative)(dictShiftMap);
        };
    };
    var h1 = function (dictMultiAlternative) {
        return function (dictShiftMap) {
            return node("h1")(dictMultiAlternative)(dictShiftMap);
        };
    };
    var hr = function (dictMultiAlternative) {
        return function (dictShiftMap) {
            return function (ps) {
                return node("hr")(dictMultiAlternative)(dictShiftMap)(ps)([  ]);
            };
        };
    };
    var hr$prime = function (dictMultiAlternative) {
        return function (dictShiftMap) {
            return hr(dictMultiAlternative)(dictShiftMap)([  ]);
        };
    };
    var input = function (dictMultiAlternative) {
        return function (dictShiftMap) {
            return function (ps) {
                return node("input")(dictMultiAlternative)(dictShiftMap)(ps)([  ]);
            };
        };
    };
    var label = function (dictMultiAlternative) {
        return function (dictShiftMap) {
            return node("label")(dictMultiAlternative)(dictShiftMap);
        };
    };
    var li = function (dictMultiAlternative) {
        return function (dictShiftMap) {
            return node("li")(dictMultiAlternative)(dictShiftMap);
        };
    };
    var node$prime = function (s) {
        return function (dictMultiAlternative) {
            return function (dictShiftMap) {
                return node(s)(dictMultiAlternative)(dictShiftMap)([  ]);
            };
        };
    };
    var label$prime = function (dictMultiAlternative) {
        return function (dictShiftMap) {
            return node$prime("label")(dictMultiAlternative)(dictShiftMap);
        };
    };
    var ul = function (dictMultiAlternative) {
        return function (dictShiftMap) {
            return node("ul")(dictMultiAlternative)(dictShiftMap);
        };
    };
    var div$prime = function (dictMultiAlternative) {
        return function (dictShiftMap) {
            return node$prime("div")(dictMultiAlternative)(dictShiftMap);
        };
    };
    var div = function (dictMultiAlternative) {
        return function (dictShiftMap) {
            return node("div")(dictMultiAlternative)(dictShiftMap);
        };
    };
    var br = function (dictMultiAlternative) {
        return function (dictShiftMap) {
            return node("br")(dictMultiAlternative)(dictShiftMap);
        };
    };
    var b = function (dictMultiAlternative) {
        return function (dictShiftMap) {
            return node("b")(dictMultiAlternative)(dictShiftMap);
        };
    };
    exports["el'"] = el$prime;
    exports["text"] = text;
    exports["node"] = node;
    exports["nodeBuilder"] = nodeBuilder;
    exports["div"] = div;
    exports["div'"] = div$prime;
    exports["h1"] = h1;
    exports["em"] = em;
    exports["b"] = b;
    exports["br"] = br;
    exports["label"] = label;
    exports["label'"] = label$prime;
    exports["ul"] = ul;
    exports["li"] = li;
    exports["hr'"] = hr$prime;
    exports["input"] = input;
  })(PS);
  (function(exports) {
    "use strict";
  
    exports["null"] = null;
  
    exports.nullable = function (a, r, f) {
      return a == null ? r : f(a);
    };
  
    exports.notNull = function (x) {
      return x;
    };
  })(PS["Data.Nullable"] = PS["Data.Nullable"] || {});
  (function($PS) {
    // Generated by purs version 0.13.8
    "use strict";
    $PS["Data.Nullable"] = $PS["Data.Nullable"] || {};
    var exports = $PS["Data.Nullable"];
    var $foreign = $PS["Data.Nullable"];
    var Data_Maybe = $PS["Data.Maybe"];              
    var toNullable = Data_Maybe.maybe($foreign["null"])($foreign.notNull);
    var toMaybe = function (n) {
        return $foreign.nullable(n, Data_Maybe.Nothing.value, Data_Maybe.Just.create);
    };
    exports["toMaybe"] = toMaybe;
    exports["toNullable"] = toNullable;
    exports["null"] = $foreign["null"];
  })(PS);
  (function(exports) {
    "use strict";
  
    exports.new = function (val) {
      return function () {
        return { value: val };
      };
    };
  
    exports.read = function (ref) {
      return function () {
        return ref.value;
      };
    };
  
    exports.write = function (val) {
      return function (ref) {
        return function () {
          ref.value = val;
          return {};
        };
      };
    };
  })(PS["Effect.Ref"] = PS["Effect.Ref"] || {});
  (function($PS) {
    // Generated by purs version 0.13.8
    "use strict";
    $PS["Effect.Ref"] = $PS["Effect.Ref"] || {};
    var exports = $PS["Effect.Ref"];
    var $foreign = $PS["Effect.Ref"];
    exports["new"] = $foreign["new"];
    exports["read"] = $foreign.read;
    exports["write"] = $foreign.write;
  })(PS);
  (function(exports) {
    "use strict";
  
    exports.typeOf = function (value) {
      return typeof value;
    };
  })(PS["Foreign"] = PS["Foreign"] || {});
  (function($PS) {
    // Generated by purs version 0.13.8
    "use strict";
    $PS["Foreign"] = $PS["Foreign"] || {};
    var exports = $PS["Foreign"];
    var $foreign = $PS["Foreign"];
    exports["typeOf"] = $foreign.typeOf;
  })(PS);
  (function(exports) {
    "use strict";
  
    exports._lookup = function (no, yes, k, m) {
      return k in m ? yes(m[k]) : no;
    };
  
    function toArrayWithKey(f) {
      return function (m) {
        var r = [];
        for (var k in m) {
          if (hasOwnProperty.call(m, k)) {
            r.push(f(k)(m[k]));
          }
        }
        return r;
      };
    }
  })(PS["Foreign.Object"] = PS["Foreign.Object"] || {});
  (function(exports) {
    "use strict";
  
    exports.runFn4 = function (fn) {
      return function (a) {
        return function (b) {
          return function (c) {
            return function (d) {
              return fn(a, b, c, d);
            };
          };
        };
      };
    };
  })(PS["Data.Function.Uncurried"] = PS["Data.Function.Uncurried"] || {});
  (function($PS) {
    // Generated by purs version 0.13.8
    "use strict";
    $PS["Data.Function.Uncurried"] = $PS["Data.Function.Uncurried"] || {};
    var exports = $PS["Data.Function.Uncurried"];
    var $foreign = $PS["Data.Function.Uncurried"];
    exports["runFn4"] = $foreign.runFn4;
  })(PS);
  (function($PS) {
    // Generated by purs version 0.13.8
    "use strict";
    $PS["Foreign.Object"] = $PS["Foreign.Object"] || {};
    var exports = $PS["Foreign.Object"];
    var $foreign = $PS["Foreign.Object"];
    var Data_Function_Uncurried = $PS["Data.Function.Uncurried"];
    var Data_Maybe = $PS["Data.Maybe"];
    var lookup = Data_Function_Uncurried.runFn4($foreign["_lookup"])(Data_Maybe.Nothing.value)(Data_Maybe.Just.create);
    exports["lookup"] = lookup;
  })(PS);
  (function($PS) {
    // Generated by purs version 0.13.8
    "use strict";
    $PS["Halogen.VDom.Machine"] = $PS["Halogen.VDom.Machine"] || {};
    var exports = $PS["Halogen.VDom.Machine"];
    var Unsafe_Coerce = $PS["Unsafe.Coerce"];                
    var Step = (function () {
        function Step(value0, value1, value2, value3) {
            this.value0 = value0;
            this.value1 = value1;
            this.value2 = value2;
            this.value3 = value3;
        };
        Step.create = function (value0) {
            return function (value1) {
                return function (value2) {
                    return function (value3) {
                        return new Step(value0, value1, value2, value3);
                    };
                };
            };
        };
        return Step;
    })();
    var unStep = Unsafe_Coerce.unsafeCoerce;
    var step = function (v, a) {
        return v.value2(v.value1, a);
    };
    var mkStep = Unsafe_Coerce.unsafeCoerce;
    var halt = function (v) {
        return v.value3(v.value1);
    };
    var extract = unStep(function (v) {
        return v.value0;
    });
    exports["Step"] = Step;
    exports["mkStep"] = mkStep;
    exports["unStep"] = unStep;
    exports["extract"] = extract;
    exports["step"] = step;
    exports["halt"] = halt;
  })(PS);
  (function(exports) {
    "use strict";
  
    exports.unsafeGetAny = function (key, obj) {
      return obj[key];
    };
  
    exports.unsafeHasAny = function (key, obj) {
      return obj.hasOwnProperty(key);
    };
  
    exports.unsafeSetAny = function (key, val, obj) {
        obj[key] = val;
    };
  
    exports.forE = function (a, f) {
      var b = [];
      for (var i = 0; i < a.length; i++) {
        b.push(f(i, a[i]));
      }
      return b;
    };
  
    exports.forEachE = function (a, f) {
      for (var i = 0; i < a.length; i++) {
        f(a[i]);
      }
    };
  
    exports.forInE = function (o, f) {
      var ks = Object.keys(o);
      for (var i = 0; i < ks.length; i++) {
        var k = ks[i];
        f(k, o[k]);
      }
    };
  
    exports.diffWithIxE = function (a1, a2, f1, f2, f3) {
      var a3 = [];
      var l1 = a1.length;
      var l2 = a2.length;
      var i  = 0;
      while (1) {
        if (i < l1) {
          if (i < l2) {
            a3.push(f1(i, a1[i], a2[i]));
          } else {
            f2(i, a1[i]);
          }
        } else if (i < l2) {
          a3.push(f3(i, a2[i]));
        } else {
          break;
        }
        i++;
      }
      return a3;
    };
  
    exports.strMapWithIxE = function (as, fk, f) {
      var o = {};
      for (var i = 0; i < as.length; i++) {
        var a = as[i];
        var k = fk(a);
        o[k] = f(k, i, a);
      }
      return o;
    };
  
    exports.diffWithKeyAndIxE = function (o1, as, fk, f1, f2, f3) {
      var o2 = {};
      for (var i = 0; i < as.length; i++) {
        var a = as[i];
        var k = fk(a);
        if (o1.hasOwnProperty(k)) {
          o2[k] = f1(k, i, o1[k], a);
        } else {
          o2[k] = f3(k, i, a);
        }
      }
      for (var k in o1) {
        if (k in o2) {
          continue;
        }
        f2(k, o1[k]);
      }
      return o2;
    };
  
    exports.refEq = function (a, b) {
      return a === b;
    };
  
    exports.createTextNode = function (s, doc) {
      return doc.createTextNode(s);
    };
  
    exports.setTextContent = function (s, n) {
      n.textContent = s;
    };
  
    exports.createElement = function (ns, name, doc) {
      if (ns != null) {
        return doc.createElementNS(ns, name);
      } else {
        return doc.createElement(name)
      }
    };
  
    exports.insertChildIx = function (i, a, b) {
      var n = b.childNodes.item(i) || null;
      if (n !== a) {
        b.insertBefore(a, n);
      }
    };
  
    exports.removeChild = function (a, b) {
      if (b && a.parentNode === b) {
        b.removeChild(a);
      }
    };
  
    exports.parentNode = function (a) {
      return a.parentNode;
    };
  
    exports.setAttribute = function (ns, attr, val, el) {
      if (ns != null) {
        el.setAttributeNS(ns, attr, val);
      } else {
        el.setAttribute(attr, val);
      }
    };
  
    exports.removeAttribute = function (ns, attr, el) {
      if (ns != null) {
        el.removeAttributeNS(ns, attr);
      } else {
        el.removeAttribute(attr);
      }
    };
  
    exports.hasAttribute = function (ns, attr, el) {
      if (ns != null) {
        return el.hasAttributeNS(ns, attr);
      } else {
        return el.hasAttribute(attr);
      }
    };
  
    exports.addEventListener = function (ev, listener, el) {
      el.addEventListener(ev, listener, false);
    };
  
    exports.removeEventListener = function (ev, listener, el) {
      el.removeEventListener(ev, listener, false);
    };
  
    exports.jsUndefined = void 0;
  })(PS["Halogen.VDom.Util"] = PS["Halogen.VDom.Util"] || {});
  (function(exports) {
    "use strict";
  
    exports["new"] = function () {
      return {};
    };
  })(PS["Foreign.Object.ST"] = PS["Foreign.Object.ST"] || {});
  (function($PS) {
    // Generated by purs version 0.13.8
    "use strict";
    $PS["Foreign.Object.ST"] = $PS["Foreign.Object.ST"] || {};
    var exports = $PS["Foreign.Object.ST"];
    var $foreign = $PS["Foreign.Object.ST"];
    exports["new"] = $foreign["new"];
  })(PS);
  (function($PS) {
    // Generated by purs version 0.13.8
    "use strict";
    $PS["Halogen.VDom.Util"] = $PS["Halogen.VDom.Util"] || {};
    var exports = $PS["Halogen.VDom.Util"];
    var $foreign = $PS["Halogen.VDom.Util"];
    var Foreign_Object_ST = $PS["Foreign.Object.ST"];
    var Unsafe_Coerce = $PS["Unsafe.Coerce"];                
    var unsafeLookup = $foreign.unsafeGetAny;
    var unsafeFreeze = Unsafe_Coerce.unsafeCoerce;
    var pokeMutMap = $foreign.unsafeSetAny;
    var newMutMap = Foreign_Object_ST["new"];
    exports["newMutMap"] = newMutMap;
    exports["pokeMutMap"] = pokeMutMap;
    exports["unsafeFreeze"] = unsafeFreeze;
    exports["unsafeLookup"] = unsafeLookup;
    exports["unsafeGetAny"] = $foreign.unsafeGetAny;
    exports["unsafeHasAny"] = $foreign.unsafeHasAny;
    exports["unsafeSetAny"] = $foreign.unsafeSetAny;
    exports["forE"] = $foreign.forE;
    exports["forEachE"] = $foreign.forEachE;
    exports["forInE"] = $foreign.forInE;
    exports["diffWithIxE"] = $foreign.diffWithIxE;
    exports["diffWithKeyAndIxE"] = $foreign.diffWithKeyAndIxE;
    exports["strMapWithIxE"] = $foreign.strMapWithIxE;
    exports["refEq"] = $foreign.refEq;
    exports["createTextNode"] = $foreign.createTextNode;
    exports["setTextContent"] = $foreign.setTextContent;
    exports["createElement"] = $foreign.createElement;
    exports["insertChildIx"] = $foreign.insertChildIx;
    exports["removeChild"] = $foreign.removeChild;
    exports["parentNode"] = $foreign.parentNode;
    exports["setAttribute"] = $foreign.setAttribute;
    exports["removeAttribute"] = $foreign.removeAttribute;
    exports["hasAttribute"] = $foreign.hasAttribute;
    exports["addEventListener"] = $foreign.addEventListener;
    exports["removeEventListener"] = $foreign.removeEventListener;
    exports["jsUndefined"] = $foreign.jsUndefined;
  })(PS);
  (function(exports) {
    "use strict";
  
    exports.eventListener = function (fn) {
      return function () {
        return function (event) {
          return fn(event)();
        };
      };
    };
  
    exports.addEventListener = function (type) {
      return function (listener) {
        return function (useCapture) {
          return function (target) {
            return function () {
              return target.addEventListener(type, listener, useCapture);
            };
          };
        };
      };
    };
  
    exports.removeEventListener = function (type) {
      return function (listener) {
        return function (useCapture) {
          return function (target) {
            return function () {
              return target.removeEventListener(type, listener, useCapture);
            };
          };
        };
      };
    };
  })(PS["Web.Event.EventTarget"] = PS["Web.Event.EventTarget"] || {});
  (function($PS) {
    // Generated by purs version 0.13.8
    "use strict";
    $PS["Web.Event.EventTarget"] = $PS["Web.Event.EventTarget"] || {};
    var exports = $PS["Web.Event.EventTarget"];
    var $foreign = $PS["Web.Event.EventTarget"];
    exports["eventListener"] = $foreign.eventListener;
    exports["addEventListener"] = $foreign.addEventListener;
    exports["removeEventListener"] = $foreign.removeEventListener;
  })(PS);
  (function($PS) {
    // Generated by purs version 0.13.8
    "use strict";
    $PS["Concur.VDom.Props.Internal"] = $PS["Concur.VDom.Props.Internal"] || {};
    var exports = $PS["Concur.VDom.Props.Internal"];
    var Data_Maybe = $PS["Data.Maybe"];
    var Data_Nullable = $PS["Data.Nullable"];
    var Data_Tuple = $PS["Data.Tuple"];
    var Data_Unit = $PS["Data.Unit"];
    var Effect_Ref = $PS["Effect.Ref"];
    var Foreign = $PS["Foreign"];
    var Foreign_Object = $PS["Foreign.Object"];
    var Halogen_VDom_Machine = $PS["Halogen.VDom.Machine"];
    var Halogen_VDom_Util = $PS["Halogen.VDom.Util"];
    var Unsafe_Coerce = $PS["Unsafe.Coerce"];
    var Web_Event_EventTarget = $PS["Web.Event.EventTarget"];                
    var Created = (function () {
        function Created(value0) {
            this.value0 = value0;
        };
        Created.create = function (value0) {
            return new Created(value0);
        };
        return Created;
    })();
    var Removed = (function () {
        function Removed(value0) {
            this.value0 = value0;
        };
        Removed.create = function (value0) {
            return new Removed(value0);
        };
        return Removed;
    })();
    var Attribute = (function () {
        function Attribute(value0, value1, value2) {
            this.value0 = value0;
            this.value1 = value1;
            this.value2 = value2;
        };
        Attribute.create = function (value0) {
            return function (value1) {
                return function (value2) {
                    return new Attribute(value0, value1, value2);
                };
            };
        };
        return Attribute;
    })();
    var Property = (function () {
        function Property(value0, value1) {
            this.value0 = value0;
            this.value1 = value1;
        };
        Property.create = function (value0) {
            return function (value1) {
                return new Property(value0, value1);
            };
        };
        return Property;
    })();
    var Handler = (function () {
        function Handler(value0, value1) {
            this.value0 = value0;
            this.value1 = value1;
        };
        Handler.create = function (value0) {
            return function (value1) {
                return new Handler(value0, value1);
            };
        };
        return Handler;
    })();
    var Ref = (function () {
        function Ref(value0) {
            this.value0 = value0;
        };
        Ref.create = function (value0) {
            return new Ref(value0);
        };
        return Ref;
    })();
    var unsafeGetProperty = Halogen_VDom_Util.unsafeGetAny;
    var setProperty = Halogen_VDom_Util.unsafeSetAny;
    var removeProperty = function (key, el) {
        var v = Halogen_VDom_Util.hasAttribute(Data_Nullable["null"], key, el);
        if (v) {
            return Halogen_VDom_Util.removeAttribute(Data_Nullable["null"], key, el);
        };
        var v1 = Foreign.typeOf(Halogen_VDom_Util.unsafeGetAny(key, el));
        if (v1 === "string") {
            return Halogen_VDom_Util.unsafeSetAny(key, "", el);
        };
        if (key === "rowSpan") {
            return Halogen_VDom_Util.unsafeSetAny(key, 1, el);
        };
        if (key === "colSpan") {
            return Halogen_VDom_Util.unsafeSetAny(key, 1, el);
        };
        return Halogen_VDom_Util.unsafeSetAny(key, Halogen_VDom_Util.jsUndefined, el);
    };
    var propValue = Unsafe_Coerce.unsafeCoerce;
    var propToStrKey = function (v) {
        if (v instanceof Attribute && v.value0 instanceof Data_Maybe.Just) {
            return "attr/" + (v.value0.value0 + (":" + v.value1));
        };
        if (v instanceof Attribute) {
            return "attr/:" + v.value1;
        };
        if (v instanceof Property) {
            return "prop/" + v.value0;
        };
        if (v instanceof Handler) {
            return "handler/" + v.value0;
        };
        if (v instanceof Ref) {
            return "ref";
        };
        throw new Error("Failed pattern match at Concur.VDom.Props.Internal (line 160, column 16 - line 165, column 16): " + [ v.constructor.name ]);
    }; 
    var buildProp = function (el) {
        var removeProp = function (prevEvents) {
            return function (v, v1) {
                if (v1 instanceof Attribute) {
                    return Halogen_VDom_Util.removeAttribute(Data_Nullable.toNullable(v1.value0), v1.value1, el);
                };
                if (v1 instanceof Property) {
                    return removeProperty(v1.value0, el);
                };
                if (v1 instanceof Handler) {
                    var handler = Halogen_VDom_Util.unsafeLookup(v1.value0, prevEvents);
                    return Halogen_VDom_Util.removeEventListener(v1.value0, Data_Tuple.fst(handler), el);
                };
                if (v1 instanceof Ref) {
                    return Data_Unit.unit;
                };
                throw new Error("Failed pattern match at Concur.VDom.Props.Internal (line 147, column 5 - line 157, column 18): " + [ v1.constructor.name ]);
            };
        };
        var haltProp = function (state) {
            var v = Foreign_Object.lookup("ref")(state.props);
            if (v instanceof Data_Maybe.Just && v.value0 instanceof Ref) {
                return v.value0.value0(new Removed(el));
            };
            return Data_Unit.unit;
        };
        var diffProp = function (prevEvents, events) {
            return function (v, v1, v11, v2) {
                if (v11 instanceof Attribute && v2 instanceof Attribute) {
                    var $47 = v11.value2 === v2.value2;
                    if ($47) {
                        return v2;
                    };
                    Halogen_VDom_Util.setAttribute(Data_Nullable.toNullable(v2.value0), v2.value1, v2.value2, el);
                    return v2;
                };
                if (v11 instanceof Property && v2 instanceof Property) {
                    var v4 = Halogen_VDom_Util.refEq(v11.value1, v2.value1);
                    if (v4) {
                        return v2;
                    };
                    if (v2.value0 === "value") {
                        var elVal = unsafeGetProperty("value", el);
                        var $56 = Halogen_VDom_Util.refEq(elVal, v2.value1);
                        if ($56) {
                            return v2;
                        };
                        setProperty(v2.value0, v2.value1, el);
                        return v2;
                    };
                    setProperty(v2.value0, v2.value1, el);
                    return v2;
                };
                if (v11 instanceof Handler && v2 instanceof Handler) {
                    var handler = Halogen_VDom_Util.unsafeLookup(v2.value0, prevEvents);
                    Effect_Ref.write(v2.value1)(Data_Tuple.snd(handler))();
                    Halogen_VDom_Util.pokeMutMap(v2.value0, handler, events);
                    return v2;
                };
                return v2;
            };
        };
        var applyProp = function (events) {
            return function (v, v1, v2) {
                if (v2 instanceof Attribute) {
                    Halogen_VDom_Util.setAttribute(Data_Nullable.toNullable(v2.value0), v2.value1, v2.value2, el);
                    return v2;
                };
                if (v2 instanceof Property) {
                    setProperty(v2.value0, v2.value1, el);
                    return v2;
                };
                if (v2 instanceof Handler) {
                    var v3 = Halogen_VDom_Util.unsafeGetAny(v2.value0, events);
                    if (Halogen_VDom_Util.unsafeHasAny(v2.value0, events)) {
                        Effect_Ref.write(v2.value1)(Data_Tuple.snd(v3))();
                        return v2;
                    };
                    var ref = Effect_Ref["new"](v2.value1)();
                    var listener = Web_Event_EventTarget.eventListener(function (ev) {
                        return function __do() {
                            var f$prime = Effect_Ref.read(ref)();
                            return f$prime(ev);
                        };
                    })();
                    Halogen_VDom_Util.pokeMutMap(v2.value0, new Data_Tuple.Tuple(listener, ref), events);
                    Halogen_VDom_Util.addEventListener(v2.value0, listener, el);
                    return v2;
                };
                if (v2 instanceof Ref) {
                    v2.value0(new Created(el));
                    return v2;
                };
                throw new Error("Failed pattern match at Concur.VDom.Props.Internal (line 91, column 5 - line 113, column 15): " + [ v2.constructor.name ]);
            };
        };
        var patchProp = function (state, ps2) {
            var events = Halogen_VDom_Util.newMutMap();
            var onThis = removeProp(state.events);
            var onThese = diffProp(state.events, events);
            var onThat = applyProp(events);
            var props = Halogen_VDom_Util.diffWithKeyAndIxE(state.props, ps2, propToStrKey, onThese, onThis, onThat);
            var nextState = {
                events: Halogen_VDom_Util.unsafeFreeze(events),
                props: props
            };
            return Halogen_VDom_Machine.mkStep(new Halogen_VDom_Machine.Step(Data_Unit.unit, nextState, patchProp, haltProp));
        };
        var renderProp = function (ps1) {
            var events = Halogen_VDom_Util.newMutMap();
            var ps1$prime = Halogen_VDom_Util.strMapWithIxE(ps1, propToStrKey, applyProp(events));
            var state = {
                events: Halogen_VDom_Util.unsafeFreeze(events),
                props: ps1$prime
            };
            return Halogen_VDom_Machine.mkStep(new Halogen_VDom_Machine.Step(Data_Unit.unit, state, patchProp, haltProp));
        };
        return renderProp;
    };
    exports["Attribute"] = Attribute;
    exports["Property"] = Property;
    exports["Handler"] = Handler;
    exports["propValue"] = propValue;
    exports["buildProp"] = buildProp;
  })(PS);
  (function($PS) {
    // Generated by purs version 0.13.8
    "use strict";
    $PS["Data.Newtype"] = $PS["Data.Newtype"] || {};
    var exports = $PS["Data.Newtype"];                                   
    var Newtype = function (unwrap, wrap) {
        this.unwrap = unwrap;
        this.wrap = wrap;
    };
    var wrap = function (dict) {
        return dict.wrap;
    };
    var unwrap = function (dict) {
        return dict.unwrap;
    };
    exports["unwrap"] = unwrap;
    exports["wrap"] = wrap;
    exports["Newtype"] = Newtype;
  })(PS);
  (function(exports) {
    "use strict";
  
    exports.mkEffectFn1 = function mkEffectFn1(fn) {
      return function(x) {
        return fn(x)();
      };
    };
  })(PS["Effect.Uncurried"] = PS["Effect.Uncurried"] || {});
  (function($PS) {
    // Generated by purs version 0.13.8
    "use strict";
    $PS["Effect.Uncurried"] = $PS["Effect.Uncurried"] || {};
    var exports = $PS["Effect.Uncurried"];
    var $foreign = $PS["Effect.Uncurried"];
    exports["mkEffectFn1"] = $foreign.mkEffectFn1;
  })(PS);
  (function(exports) {
    "use strict";
  
    exports.unsafePerformEffect = function (f) {
      return f();
    };
  })(PS["Effect.Unsafe"] = PS["Effect.Unsafe"] || {});
  (function($PS) {
    // Generated by purs version 0.13.8
    "use strict";
    $PS["Effect.Unsafe"] = $PS["Effect.Unsafe"] || {};
    var exports = $PS["Effect.Unsafe"];
    var $foreign = $PS["Effect.Unsafe"];
    exports["unsafePerformEffect"] = $foreign.unsafePerformEffect;
  })(PS);
  (function(exports) {
    "use strict";
  
    exports._unsafeReadProtoTagged = function (nothing, just, name, value) {
      if (typeof window !== "undefined") {
        var ty = window[name];
        if (ty != null && value instanceof ty) {
          return just(value);
        }
        return nothing;
      } 
      var obj = value;
      while (obj != null) {
        var proto = Object.getPrototypeOf(obj);
        var constructorName = proto.constructor.name;
        if (constructorName === name) {
          return just(value);
        } else if (constructorName === "Object") {
          return nothing;
        }
        obj = proto;
      }
      return nothing;
    };
  })(PS["Web.Internal.FFI"] = PS["Web.Internal.FFI"] || {});
  (function($PS) {
    // Generated by purs version 0.13.8
    "use strict";
    $PS["Web.Internal.FFI"] = $PS["Web.Internal.FFI"] || {};
    var exports = $PS["Web.Internal.FFI"];
    var $foreign = $PS["Web.Internal.FFI"];
    var Data_Maybe = $PS["Data.Maybe"];                
    var unsafeReadProtoTagged = function (name) {
        return function (value) {
            return $foreign["_unsafeReadProtoTagged"](Data_Maybe.Nothing.value, Data_Maybe.Just.create, name, value);
        };
    };
    exports["unsafeReadProtoTagged"] = unsafeReadProtoTagged;
  })(PS);
  (function($PS) {
    // Generated by purs version 0.13.8
    "use strict";
    $PS["Web.DOM.Element"] = $PS["Web.DOM.Element"] || {};
    var exports = $PS["Web.DOM.Element"];
    var Unsafe_Coerce = $PS["Unsafe.Coerce"];
    var Web_Internal_FFI = $PS["Web.Internal.FFI"];             
    var toNode = Unsafe_Coerce.unsafeCoerce;                         
    var fromEventTarget = Web_Internal_FFI.unsafeReadProtoTagged("Element");
    exports["fromEventTarget"] = fromEventTarget;
    exports["toNode"] = toNode;
  })(PS);
  (function(exports) {
    "use strict";
  
    exports._target = function (e) {
      return e.target;
    };
  })(PS["Web.Event.Event"] = PS["Web.Event.Event"] || {});
  (function($PS) {
    // Generated by purs version 0.13.8
    "use strict";
    $PS["Web.Event.Event"] = $PS["Web.Event.Event"] || {};
    var exports = $PS["Web.Event.Event"];
    var $foreign = $PS["Web.Event.Event"];
    var Data_Newtype = $PS["Data.Newtype"];
    var Data_Nullable = $PS["Data.Nullable"];                              
    var EventType = function (x) {
        return x;
    };
    var target = function ($4) {
        return Data_Nullable.toMaybe($foreign["_target"]($4));
    };                                    
    var newtypeEventType = new Data_Newtype.Newtype(function (n) {
        return n;
    }, EventType);
    exports["target"] = target;
    exports["newtypeEventType"] = newtypeEventType;
  })(PS);
  (function(exports) {
    "use strict";
  
    // ----------------------------------------------------------------------------
  
    exports.value = function (input) {
      return function () {
        return input.value;
      };
    };
  })(PS["Web.HTML.HTMLInputElement"] = PS["Web.HTML.HTMLInputElement"] || {});
  (function($PS) {
    // Generated by purs version 0.13.8
    "use strict";
    $PS["Web.HTML.HTMLInputElement"] = $PS["Web.HTML.HTMLInputElement"] || {};
    var exports = $PS["Web.HTML.HTMLInputElement"];
    var $foreign = $PS["Web.HTML.HTMLInputElement"];
    var Web_Internal_FFI = $PS["Web.Internal.FFI"];                                  
    var fromElement = Web_Internal_FFI.unsafeReadProtoTagged("HTMLInputElement");
    exports["fromElement"] = fromElement;
    exports["value"] = $foreign.value;
  })(PS);
  (function($PS) {
    // Generated by purs version 0.13.8
    "use strict";
    $PS["Concur.VDom.Props"] = $PS["Concur.VDom.Props"] || {};
    var exports = $PS["Concur.VDom.Props"];
    var Concur_Core_Props = $PS["Concur.Core.Props"];
    var Concur_VDom_Props_Internal = $PS["Concur.VDom.Props.Internal"];
    var Control_Applicative = $PS["Control.Applicative"];
    var Control_Bind = $PS["Control.Bind"];
    var Data_Maybe = $PS["Data.Maybe"];
    var Data_Newtype = $PS["Data.Newtype"];
    var Effect = $PS["Effect"];
    var Effect_Uncurried = $PS["Effect.Uncurried"];
    var Effect_Unsafe = $PS["Effect.Unsafe"];
    var Web_DOM_Element = $PS["Web.DOM.Element"];
    var Web_Event_Event = $PS["Web.Event.Event"];
    var Web_HTML_HTMLInputElement = $PS["Web.HTML.HTMLInputElement"];
    var unsafeTargetValue = function (ev) {
        return Effect_Unsafe.unsafePerformEffect(Data_Maybe.maybe(Control_Applicative.pure(Effect.applicativeEffect)(""))(Web_HTML_HTMLInputElement.value)(Control_Bind.bindFlipped(Data_Maybe.bindMaybe)(Web_HTML_HTMLInputElement.fromElement)(Control_Bind.bindFlipped(Data_Maybe.bindMaybe)(Web_DOM_Element.fromEventTarget)(Web_Event_Event.target(ev)))));
    };
    var prop = function (s) {
        return function (v) {
            return new Concur_Core_Props.PrimProp(new Concur_VDom_Props_Internal.Property(s, Concur_VDom_Props_Internal.propValue(v)));
        };
    };
    var size = prop("size");
    var value = prop("value");
    var isEnterEvent = function (e) {
        return e.keyCode === 13;
    };
    var handle = function (s) {
        return new Concur_Core_Props.Handler(function (f) {
            return new Concur_VDom_Props_Internal.Handler(Data_Newtype.wrap(Web_Event_Event.newtypeEventType)(s), Effect_Uncurried.mkEffectFn1(f));
        });
    };
    var onChange = handle("input");
    var onKeyDown = handle("keydown");
    var onKeyEnter = Concur_Core_Props.filterProp(isEnterEvent)(onKeyDown);
    var dangerouslySetInnerHTML = prop("innerHTML");
    var autoFocus = prop("autofocus");
    var attr = function (s) {
        return function (v) {
            return new Concur_Core_Props.PrimProp(new Concur_VDom_Props_Internal.Attribute(Data_Maybe.Nothing.value, s, v));
        };
    };
    exports["onChange"] = onChange;
    exports["onKeyEnter"] = onKeyEnter;
    exports["unsafeTargetValue"] = unsafeTargetValue;
    exports["autoFocus"] = autoFocus;
    exports["size"] = size;
    exports["dangerouslySetInnerHTML"] = dangerouslySetInnerHTML;
    exports["attr"] = attr;
  })(PS);
  (function($PS) {
    // Generated by purs version 0.13.8
    "use strict";
    $PS["Concur.VDom.SVG"] = $PS["Concur.VDom.SVG"] || {};
    var exports = $PS["Concur.VDom.SVG"];
    var Concur_Core_Props = $PS["Concur.Core.Props"];
    var Concur_VDom_DOM = $PS["Concur.VDom.DOM"];
    var Concur_VDom_Props_Internal = $PS["Concur.VDom.Props.Internal"];
    var Concur_VDom_Types = $PS["Concur.VDom.Types"];
    var Data_Maybe = $PS["Data.Maybe"];
    var Data_Show = $PS["Data.Show"];
    var Halogen_VDom_Types = $PS["Halogen.VDom.Types"];                
    var svgNS = "http://www.w3.org/2000/svg";
    var text = function (dictMultiAlternative) {
        return function (dictShiftMap) {
            return Concur_VDom_DOM["el'"](dictShiftMap)(dictMultiAlternative)(function (p) {
                return function (c) {
                    return Concur_VDom_Types.mkHTMLNode(new Halogen_VDom_Types.Elem(Data_Maybe.Just.create(svgNS), "text", p, Concur_VDom_Types.unHTML(c)));
                };
            });
        };
    };
    var svg = function (dictMultiAlternative) {
        return function (dictShiftMap) {
            return Concur_VDom_DOM["el'"](dictShiftMap)(dictMultiAlternative)(function (p) {
                return function (c) {
                    return Concur_VDom_Types.mkHTMLNode(new Halogen_VDom_Types.Elem(Data_Maybe.Just.create(svgNS), "svg", p, Concur_VDom_Types.unHTML(c)));
                };
            });
        };
    };
    var path = function (dictMultiAlternative) {
        return function (dictShiftMap) {
            return Concur_VDom_DOM["el'"](dictShiftMap)(dictMultiAlternative)(function (p) {
                return function (v) {
                    return Concur_VDom_Types.mkHTMLNode(new Halogen_VDom_Types.Elem(Data_Maybe.Just.create(svgNS), "path", p, [  ]));
                };
            });
        };
    };
    var line = function (dictMultiAlternative) {
        return function (dictShiftMap) {
            return Concur_VDom_DOM["el'"](dictShiftMap)(dictMultiAlternative)(function (p) {
                return function (v) {
                    return Concur_VDom_Types.mkHTMLNode(new Halogen_VDom_Types.Elem(Data_Maybe.Just.create(svgNS), "line", p, [  ]));
                };
            });
        };
    };
    var attr = function (s) {
        return function (v) {
            return new Concur_Core_Props.PrimProp(new Concur_VDom_Props_Internal.Attribute(Data_Maybe.Nothing.value, s, v));
        };
    };
    var d = attr("d");      
    var height = attr("height");
    var stroke = attr("stroke");
    var style = attr("style");
    var transform = attr("transform");
    var unsafeMkProp = function (dictShow) {
        return function (s) {
            return function (v) {
                return attr(s)(Data_Show.show(dictShow)(v));
            };
        };
    };
    var strokeWidth = unsafeMkProp(Data_Show.showInt)("stroke-width");
    var width = attr("width");
    exports["svg"] = svg;
    exports["line"] = line;
    exports["path"] = path;
    exports["text"] = text;
    exports["attr"] = attr;
    exports["width"] = width;
    exports["height"] = height;
    exports["unsafeMkProp"] = unsafeMkProp;
    exports["strokeWidth"] = strokeWidth;
    exports["stroke"] = stroke;
    exports["d"] = d;
    exports["style"] = style;
    exports["transform"] = transform;
  })(PS);
  (function($PS) {
    // Generated by purs version 0.13.8
    "use strict";
    $PS["Data.Identity"] = $PS["Data.Identity"] || {};
    var exports = $PS["Data.Identity"];
    var Control_Applicative = $PS["Control.Applicative"];
    var Control_Apply = $PS["Control.Apply"];
    var Control_Bind = $PS["Control.Bind"];
    var Control_Monad = $PS["Control.Monad"];
    var Data_Functor = $PS["Data.Functor"];
    var Data_Newtype = $PS["Data.Newtype"];          
    var Identity = function (x) {
        return x;
    };
    var newtypeIdentity = new Data_Newtype.Newtype(function (n) {
        return n;
    }, Identity);
    var functorIdentity = new Data_Functor.Functor(function (f) {
        return function (m) {
            return f(m);
        };
    });
    var applyIdentity = new Control_Apply.Apply(function () {
        return functorIdentity;
    }, function (v) {
        return function (v1) {
            return v(v1);
        };
    });
    var bindIdentity = new Control_Bind.Bind(function () {
        return applyIdentity;
    }, function (v) {
        return function (f) {
            return f(v);
        };
    });
    var applicativeIdentity = new Control_Applicative.Applicative(function () {
        return applyIdentity;
    }, Identity);
    var monadIdentity = new Control_Monad.Monad(function () {
        return applicativeIdentity;
    }, function () {
        return bindIdentity;
    });
    exports["newtypeIdentity"] = newtypeIdentity;
    exports["functorIdentity"] = functorIdentity;
    exports["monadIdentity"] = monadIdentity;
  })(PS);
  (function($PS) {
    // Generated by purs version 0.13.8
    "use strict";
    $PS["Control.Monad.State"] = $PS["Control.Monad.State"] || {};
    var exports = $PS["Control.Monad.State"];
    var Data_Identity = $PS["Data.Identity"];
    var Data_Newtype = $PS["Data.Newtype"];              
    var runState = function (v) {
        var $16 = Data_Newtype.unwrap(Data_Identity.newtypeIdentity);
        return function ($17) {
            return $16(v($17));
        };
    };
    exports["runState"] = runState;
  })(PS);
  (function($PS) {
    // Generated by purs version 0.13.8
    "use strict";
    $PS["Control.Monad.State.Class"] = $PS["Control.Monad.State.Class"] || {};
    var exports = $PS["Control.Monad.State.Class"];
    var Data_Tuple = $PS["Data.Tuple"];              
    var MonadState = function (Monad0, state) {
        this.Monad0 = Monad0;
        this.state = state;
    };
    var state = function (dict) {
        return dict.state;
    };
    var modify = function (dictMonadState) {
        return function (f) {
            return state(dictMonadState)(function (s) {
                var s$prime = f(s);
                return new Data_Tuple.Tuple(s$prime, s$prime);
            });
        };
    };
    var get = function (dictMonadState) {
        return state(dictMonadState)(function (s) {
            return new Data_Tuple.Tuple(s, s);
        });
    };
    exports["MonadState"] = MonadState;
    exports["get"] = get;
    exports["modify"] = modify;
  })(PS);
  (function($PS) {
    // Generated by purs version 0.13.8
    "use strict";
    $PS["Control.Monad.State.Trans"] = $PS["Control.Monad.State.Trans"] || {};
    var exports = $PS["Control.Monad.State.Trans"];
    var Control_Applicative = $PS["Control.Applicative"];
    var Control_Apply = $PS["Control.Apply"];
    var Control_Bind = $PS["Control.Bind"];
    var Control_Monad = $PS["Control.Monad"];
    var Control_Monad_State_Class = $PS["Control.Monad.State.Class"];
    var Data_Functor = $PS["Data.Functor"];
    var Data_Tuple = $PS["Data.Tuple"];                    
    var StateT = function (x) {
        return x;
    }; 
    var functorStateT = function (dictFunctor) {
        return new Data_Functor.Functor(function (f) {
            return function (v) {
                return function (s) {
                    return Data_Functor.map(dictFunctor)(function (v1) {
                        return new Data_Tuple.Tuple(f(v1.value0), v1.value1);
                    })(v(s));
                };
            };
        });
    };
    var monadStateT = function (dictMonad) {
        return new Control_Monad.Monad(function () {
            return applicativeStateT(dictMonad);
        }, function () {
            return bindStateT(dictMonad);
        });
    };
    var bindStateT = function (dictMonad) {
        return new Control_Bind.Bind(function () {
            return applyStateT(dictMonad);
        }, function (v) {
            return function (f) {
                return function (s) {
                    return Control_Bind.bind(dictMonad.Bind1())(v(s))(function (v1) {
                        var v3 = f(v1.value0);
                        return v3(v1.value1);
                    });
                };
            };
        });
    };
    var applyStateT = function (dictMonad) {
        return new Control_Apply.Apply(function () {
            return functorStateT(((dictMonad.Bind1()).Apply0()).Functor0());
        }, Control_Monad.ap(monadStateT(dictMonad)));
    };
    var applicativeStateT = function (dictMonad) {
        return new Control_Applicative.Applicative(function () {
            return applyStateT(dictMonad);
        }, function (a) {
            return function (s) {
                return Control_Applicative.pure(dictMonad.Applicative0())(new Data_Tuple.Tuple(a, s));
            };
        });
    };
    var monadStateStateT = function (dictMonad) {
        return new Control_Monad_State_Class.MonadState(function () {
            return monadStateT(dictMonad);
        }, function (f) {
            return StateT((function () {
                var $112 = Control_Applicative.pure(dictMonad.Applicative0());
                return function ($113) {
                    return $112(f($113));
                };
            })());
        });
    };
    exports["functorStateT"] = functorStateT;
    exports["applicativeStateT"] = applicativeStateT;
    exports["bindStateT"] = bindStateT;
    exports["monadStateStateT"] = monadStateStateT;
  })(PS);
  (function(exports) {
    "use strict";
  
    exports.intSub = function (x) {
      return function (y) {
        /* jshint bitwise: false */
        return x - y | 0;
      };
    };
  
    exports.numSub = function (n1) {
      return function (n2) {
        return n1 - n2;
      };
    };
  })(PS["Data.Ring"] = PS["Data.Ring"] || {});
  (function(exports) {
    "use strict";
  
    exports.intAdd = function (x) {
      return function (y) {
        /* jshint bitwise: false */
        return x + y | 0;
      };
    };
  
    exports.intMul = function (x) {
      return function (y) {
        /* jshint bitwise: false */
        return x * y | 0;
      };
    };
  
    exports.numAdd = function (n1) {
      return function (n2) {
        return n1 + n2;
      };
    };
  
    exports.numMul = function (n1) {
      return function (n2) {
        return n1 * n2;
      };
    };
  })(PS["Data.Semiring"] = PS["Data.Semiring"] || {});
  (function($PS) {
    // Generated by purs version 0.13.8
    "use strict";
    $PS["Data.Semiring"] = $PS["Data.Semiring"] || {};
    var exports = $PS["Data.Semiring"];
    var $foreign = $PS["Data.Semiring"];
    var Semiring = function (add, mul, one, zero) {
        this.add = add;
        this.mul = mul;
        this.one = one;
        this.zero = zero;
    };
    var zero = function (dict) {
        return dict.zero;
    }; 
    var semiringNumber = new Semiring($foreign.numAdd, $foreign.numMul, 1.0, 0.0);
    var semiringInt = new Semiring($foreign.intAdd, $foreign.intMul, 1, 0);
    var one = function (dict) {
        return dict.one;
    };
    var mul = function (dict) {
        return dict.mul;
    };
    var add = function (dict) {
        return dict.add;
    };
    exports["Semiring"] = Semiring;
    exports["add"] = add;
    exports["zero"] = zero;
    exports["mul"] = mul;
    exports["one"] = one;
    exports["semiringInt"] = semiringInt;
    exports["semiringNumber"] = semiringNumber;
  })(PS);
  (function($PS) {
    // Generated by purs version 0.13.8
    "use strict";
    $PS["Data.Ring"] = $PS["Data.Ring"] || {};
    var exports = $PS["Data.Ring"];
    var $foreign = $PS["Data.Ring"];
    var Data_Semiring = $PS["Data.Semiring"];
    var Ring = function (Semiring0, sub) {
        this.Semiring0 = Semiring0;
        this.sub = sub;
    };
    var sub = function (dict) {
        return dict.sub;
    };
    var ringNumber = new Ring(function () {
        return Data_Semiring.semiringNumber;
    }, $foreign.numSub);
    var ringInt = new Ring(function () {
        return Data_Semiring.semiringInt;
    }, $foreign.intSub);
    var negate = function (dictRing) {
        return function (a) {
            return sub(dictRing)(Data_Semiring.zero(dictRing.Semiring0()))(a);
        };
    };
    exports["Ring"] = Ring;
    exports["sub"] = sub;
    exports["negate"] = negate;
    exports["ringInt"] = ringInt;
    exports["ringNumber"] = ringNumber;
  })(PS);
  (function(exports) {
    "use strict";
  
    exports.defer = function (thunk) {
      var v = null;
      return function() {
        if (thunk === undefined) return v;
  
        v = thunk();
        thunk = undefined; // eslint-disable-line no-param-reassign
        return v;
      };
    };
  
    exports.force = function (l) {
      return l();
    };
  })(PS["Data.Lazy"] = PS["Data.Lazy"] || {});
  (function($PS) {
    // Generated by purs version 0.13.8
    "use strict";
    $PS["Data.Lazy"] = $PS["Data.Lazy"] || {};
    var exports = $PS["Data.Lazy"];
    var $foreign = $PS["Data.Lazy"];
    var Data_Functor = $PS["Data.Functor"];
    var functorLazy = new Data_Functor.Functor(function (f) {
        return function (l) {
            return $foreign.defer(function (v) {
                return f($foreign.force(l));
            });
        };
    });
    exports["functorLazy"] = functorLazy;
    exports["defer"] = $foreign.defer;
    exports["force"] = $foreign.force;
  })(PS);
  (function($PS) {
    // Generated by purs version 0.13.8
    "use strict";
    $PS["Control.Lazy"] = $PS["Control.Lazy"] || {};
    var exports = $PS["Control.Lazy"];               
    var Lazy = function (defer) {
        this.defer = defer;
    }; 
    var defer = function (dict) {
        return dict.defer;
    };
    exports["defer"] = defer;
    exports["Lazy"] = Lazy;
  })(PS);
  (function($PS) {
    // Generated by purs version 0.13.8
    "use strict";
    $PS["Data.List.Lazy.Types"] = $PS["Data.List.Lazy.Types"] || {};
    var exports = $PS["Data.List.Lazy.Types"];
    var Control_Lazy = $PS["Control.Lazy"];
    var Data_Foldable = $PS["Data.Foldable"];
    var Data_Function = $PS["Data.Function"];
    var Data_Lazy = $PS["Data.Lazy"];
    var Data_Maybe = $PS["Data.Maybe"];
    var Data_Monoid = $PS["Data.Monoid"];
    var Data_Newtype = $PS["Data.Newtype"];
    var Data_Semigroup = $PS["Data.Semigroup"];
    var Data_Unfoldable = $PS["Data.Unfoldable"];
    var Data_Unfoldable1 = $PS["Data.Unfoldable1"];                
    var List = function (x) {
        return x;
    };
    var Nil = (function () {
        function Nil() {
  
        };
        Nil.value = new Nil();
        return Nil;
    })();
    var Cons = (function () {
        function Cons(value0, value1) {
            this.value0 = value0;
            this.value1 = value1;
        };
        Cons.create = function (value0) {
            return function (value1) {
                return new Cons(value0, value1);
            };
        };
        return Cons;
    })();
    var nil = List(Data_Lazy.defer(function (v) {
        return Nil.value;
    }));             
    var newtypeList = new Data_Newtype.Newtype(function (n) {
        return n;
    }, List);
    var step = (function () {
        var $215 = Data_Newtype.unwrap(newtypeList);
        return function ($216) {
            return Data_Lazy.force($215($216));
        };
    })();   
    var lazyList = new Control_Lazy.Lazy(function (f) {
        return List(Data_Lazy.defer(function ($217) {
            return step(f($217));
        }));
    });
    var cons = function (x) {
        return function (xs) {
            return List(Data_Lazy.defer(function (v) {
                return new Cons(x, xs);
            }));
        };
    };
    var foldableList = new Data_Foldable.Foldable(function (dictMonoid) {
        return function (f) {
            return Data_Foldable.foldl(foldableList)(function (b) {
                return function (a) {
                    return Data_Semigroup.append(dictMonoid.Semigroup0())(b)(f(a));
                };
            })(Data_Monoid.mempty(dictMonoid));
        };
    }, function (op) {
        var go = function ($copy_b) {
            return function ($copy_xs) {
                var $tco_var_b = $copy_b;
                var $tco_done = false;
                var $tco_result;
                function $tco_loop(b, xs) {
                    var v = step(xs);
                    if (v instanceof Nil) {
                        $tco_done = true;
                        return b;
                    };
                    if (v instanceof Cons) {
                        $tco_var_b = op(b)(v.value0);
                        $copy_xs = v.value1;
                        return;
                    };
                    throw new Error("Failed pattern match at Data.List.Lazy.Types (line 122, column 7 - line 124, column 40): " + [ v.constructor.name ]);
                };
                while (!$tco_done) {
                    $tco_result = $tco_loop($tco_var_b, $copy_xs);
                };
                return $tco_result;
            };
        };
        return go;
    }, function (op) {
        return function (z) {
            return function (xs) {
                var rev = Data_Foldable.foldl(foldableList)(Data_Function.flip(cons))(nil);
                return Data_Foldable.foldl(foldableList)(Data_Function.flip(op))(z)(rev(xs));
            };
        };
    });
    var unfoldable1List = new Data_Unfoldable1.Unfoldable1((function () {
        var go = function (f) {
            return function (b) {
                return Control_Lazy.defer(lazyList)(function (v) {
                    var v1 = f(b);
                    if (v1.value1 instanceof Data_Maybe.Just) {
                        return cons(v1.value0)(go(f)(v1.value1.value0));
                    };
                    if (v1.value1 instanceof Data_Maybe.Nothing) {
                        return cons(v1.value0)(nil);
                    };
                    throw new Error("Failed pattern match at Data.List.Lazy.Types (line 146, column 28 - line 148, column 33): " + [ v1.constructor.name ]);
                });
            };
        };
        return go;
    })());
    var unfoldableList = new Data_Unfoldable.Unfoldable(function () {
        return unfoldable1List;
    }, (function () {
        var go = function (f) {
            return function (b) {
                return Control_Lazy.defer(lazyList)(function (v) {
                    var v1 = f(b);
                    if (v1 instanceof Data_Maybe.Nothing) {
                        return nil;
                    };
                    if (v1 instanceof Data_Maybe.Just) {
                        return cons(v1.value0.value0)(go(f)(v1.value0.value1));
                    };
                    throw new Error("Failed pattern match at Data.List.Lazy.Types (line 152, column 28 - line 154, column 39): " + [ v1.constructor.name ]);
                });
            };
        };
        return go;
    })());
    exports["List"] = List;
    exports["Nil"] = Nil;
    exports["Cons"] = Cons;
    exports["step"] = step;
    exports["newtypeList"] = newtypeList;
    exports["foldableList"] = foldableList;
    exports["unfoldableList"] = unfoldableList;
  })(PS);
  (function($PS) {
    // Generated by purs version 0.13.8
    "use strict";
    $PS["Data.List.Lazy"] = $PS["Data.List.Lazy"] || {};
    var exports = $PS["Data.List.Lazy"];
    var Data_Boolean = $PS["Data.Boolean"];
    var Data_Functor = $PS["Data.Functor"];
    var Data_Lazy = $PS["Data.Lazy"];
    var Data_List_Lazy_Types = $PS["Data.List.Lazy.Types"];
    var Data_Newtype = $PS["Data.Newtype"];
    var filter = function (p) {
        var go = function ($copy_v) {
            var $tco_done = false;
            var $tco_result;
            function $tco_loop(v) {
                if (v instanceof Data_List_Lazy_Types.Nil) {
                    $tco_done = true;
                    return Data_List_Lazy_Types.Nil.value;
                };
                if (v instanceof Data_List_Lazy_Types.Cons) {
                    if (p(v.value0)) {
                        $tco_done = true;
                        return new Data_List_Lazy_Types.Cons(v.value0, filter(p)(v.value1));
                    };
                    if (Data_Boolean.otherwise) {
                        $copy_v = Data_List_Lazy_Types.step(v.value1);
                        return;
                    };
                };
                throw new Error("Failed pattern match at Data.List.Lazy (line 428, column 3 - line 428, column 15): " + [ v.constructor.name ]);
            };
            while (!$tco_done) {
                $tco_result = $tco_loop($copy_v);
            };
            return $tco_result;
        };
        var $256 = Data_Functor.map(Data_Lazy.functorLazy)(go);
        var $257 = Data_Newtype.unwrap(Data_List_Lazy_Types.newtypeList);
        return function ($258) {
            return Data_List_Lazy_Types.List($256($257($258)));
        };
    };
    exports["filter"] = filter;
  })(PS);
  (function(exports) {
    "use strict";
  
    var unsafeCompareImpl = function (lt) {
      return function (eq) {
        return function (gt) {
          return function (x) {
            return function (y) {
              return x < y ? lt : x === y ? eq : gt;
            };
          };
        };
      };
    };                                         
    exports.ordIntImpl = unsafeCompareImpl;   
    exports.ordCharImpl = unsafeCompareImpl;
  })(PS["Data.Ord"] = PS["Data.Ord"] || {});
  (function($PS) {
    // Generated by purs version 0.13.8
    "use strict";
    $PS["Data.Ordering"] = $PS["Data.Ordering"] || {};
    var exports = $PS["Data.Ordering"];              
    var LT = (function () {
        function LT() {
  
        };
        LT.value = new LT();
        return LT;
    })();
    var GT = (function () {
        function GT() {
  
        };
        GT.value = new GT();
        return GT;
    })();
    var EQ = (function () {
        function EQ() {
  
        };
        EQ.value = new EQ();
        return EQ;
    })();
    exports["LT"] = LT;
    exports["GT"] = GT;
    exports["EQ"] = EQ;
  })(PS);
  (function($PS) {
    // Generated by purs version 0.13.8
    "use strict";
    $PS["Data.Ord"] = $PS["Data.Ord"] || {};
    var exports = $PS["Data.Ord"];
    var $foreign = $PS["Data.Ord"];
    var Data_Eq = $PS["Data.Eq"];
    var Data_Ordering = $PS["Data.Ordering"];
    var Data_Ring = $PS["Data.Ring"];
    var Data_Semiring = $PS["Data.Semiring"];
    var Ord = function (Eq0, compare) {
        this.Eq0 = Eq0;
        this.compare = compare;
    };                                                                                                 
    var ordInt = new Ord(function () {
        return Data_Eq.eqInt;
    }, $foreign.ordIntImpl(Data_Ordering.LT.value)(Data_Ordering.EQ.value)(Data_Ordering.GT.value));
    var ordChar = new Ord(function () {
        return Data_Eq.eqChar;
    }, $foreign.ordCharImpl(Data_Ordering.LT.value)(Data_Ordering.EQ.value)(Data_Ordering.GT.value));
    var compare = function (dict) {
        return dict.compare;
    };
    var greaterThanOrEq = function (dictOrd) {
        return function (a1) {
            return function (a2) {
                var v = compare(dictOrd)(a1)(a2);
                if (v instanceof Data_Ordering.LT) {
                    return false;
                };
                return true;
            };
        };
    };
    var signum = function (dictOrd) {
        return function (dictRing) {
            return function (x) {
                var $43 = greaterThanOrEq(dictOrd)(x)(Data_Semiring.zero(dictRing.Semiring0()));
                if ($43) {
                    return Data_Semiring.one(dictRing.Semiring0());
                };
                return Data_Ring.negate(dictRing)(Data_Semiring.one(dictRing.Semiring0()));
            };
        };
    };
    var max = function (dictOrd) {
        return function (x) {
            return function (y) {
                var v = compare(dictOrd)(x)(y);
                if (v instanceof Data_Ordering.LT) {
                    return y;
                };
                if (v instanceof Data_Ordering.EQ) {
                    return x;
                };
                if (v instanceof Data_Ordering.GT) {
                    return x;
                };
                throw new Error("Failed pattern match at Data.Ord (line 167, column 3 - line 170, column 12): " + [ v.constructor.name ]);
            };
        };
    };
    var abs = function (dictOrd) {
        return function (dictRing) {
            return function (x) {
                var $53 = greaterThanOrEq(dictOrd)(x)(Data_Semiring.zero(dictRing.Semiring0()));
                if ($53) {
                    return x;
                };
                return Data_Ring.negate(dictRing)(x);
            };
        };
    };
    exports["Ord"] = Ord;
    exports["compare"] = compare;
    exports["max"] = max;
    exports["abs"] = abs;
    exports["signum"] = signum;
    exports["ordInt"] = ordInt;
    exports["ordChar"] = ordChar;
  })(PS);
  (function($PS) {
    // Generated by purs version 0.13.8
    "use strict";
    $PS["Data.Map.Internal"] = $PS["Data.Map.Internal"] || {};
    var exports = $PS["Data.Map.Internal"];
    var Control_Applicative = $PS["Control.Applicative"];
    var Control_Category = $PS["Control.Category"];
    var Data_Foldable = $PS["Data.Foldable"];
    var Data_FoldableWithIndex = $PS["Data.FoldableWithIndex"];
    var Data_Function = $PS["Data.Function"];
    var Data_List_Lazy = $PS["Data.List.Lazy"];
    var Data_List_Lazy_Types = $PS["Data.List.Lazy.Types"];
    var Data_List_Types = $PS["Data.List.Types"];
    var Data_Maybe = $PS["Data.Maybe"];
    var Data_Ord = $PS["Data.Ord"];
    var Data_Ordering = $PS["Data.Ordering"];
    var Data_Semigroup = $PS["Data.Semigroup"];
    var Data_Tuple = $PS["Data.Tuple"];
    var Data_Unfoldable = $PS["Data.Unfoldable"];                
    var Leaf = (function () {
        function Leaf() {
  
        };
        Leaf.value = new Leaf();
        return Leaf;
    })();
    var Two = (function () {
        function Two(value0, value1, value2, value3) {
            this.value0 = value0;
            this.value1 = value1;
            this.value2 = value2;
            this.value3 = value3;
        };
        Two.create = function (value0) {
            return function (value1) {
                return function (value2) {
                    return function (value3) {
                        return new Two(value0, value1, value2, value3);
                    };
                };
            };
        };
        return Two;
    })();
    var Three = (function () {
        function Three(value0, value1, value2, value3, value4, value5, value6) {
            this.value0 = value0;
            this.value1 = value1;
            this.value2 = value2;
            this.value3 = value3;
            this.value4 = value4;
            this.value5 = value5;
            this.value6 = value6;
        };
        Three.create = function (value0) {
            return function (value1) {
                return function (value2) {
                    return function (value3) {
                        return function (value4) {
                            return function (value5) {
                                return function (value6) {
                                    return new Three(value0, value1, value2, value3, value4, value5, value6);
                                };
                            };
                        };
                    };
                };
            };
        };
        return Three;
    })();
    var TwoLeft = (function () {
        function TwoLeft(value0, value1, value2) {
            this.value0 = value0;
            this.value1 = value1;
            this.value2 = value2;
        };
        TwoLeft.create = function (value0) {
            return function (value1) {
                return function (value2) {
                    return new TwoLeft(value0, value1, value2);
                };
            };
        };
        return TwoLeft;
    })();
    var TwoRight = (function () {
        function TwoRight(value0, value1, value2) {
            this.value0 = value0;
            this.value1 = value1;
            this.value2 = value2;
        };
        TwoRight.create = function (value0) {
            return function (value1) {
                return function (value2) {
                    return new TwoRight(value0, value1, value2);
                };
            };
        };
        return TwoRight;
    })();
    var ThreeLeft = (function () {
        function ThreeLeft(value0, value1, value2, value3, value4, value5) {
            this.value0 = value0;
            this.value1 = value1;
            this.value2 = value2;
            this.value3 = value3;
            this.value4 = value4;
            this.value5 = value5;
        };
        ThreeLeft.create = function (value0) {
            return function (value1) {
                return function (value2) {
                    return function (value3) {
                        return function (value4) {
                            return function (value5) {
                                return new ThreeLeft(value0, value1, value2, value3, value4, value5);
                            };
                        };
                    };
                };
            };
        };
        return ThreeLeft;
    })();
    var ThreeMiddle = (function () {
        function ThreeMiddle(value0, value1, value2, value3, value4, value5) {
            this.value0 = value0;
            this.value1 = value1;
            this.value2 = value2;
            this.value3 = value3;
            this.value4 = value4;
            this.value5 = value5;
        };
        ThreeMiddle.create = function (value0) {
            return function (value1) {
                return function (value2) {
                    return function (value3) {
                        return function (value4) {
                            return function (value5) {
                                return new ThreeMiddle(value0, value1, value2, value3, value4, value5);
                            };
                        };
                    };
                };
            };
        };
        return ThreeMiddle;
    })();
    var ThreeRight = (function () {
        function ThreeRight(value0, value1, value2, value3, value4, value5) {
            this.value0 = value0;
            this.value1 = value1;
            this.value2 = value2;
            this.value3 = value3;
            this.value4 = value4;
            this.value5 = value5;
        };
        ThreeRight.create = function (value0) {
            return function (value1) {
                return function (value2) {
                    return function (value3) {
                        return function (value4) {
                            return function (value5) {
                                return new ThreeRight(value0, value1, value2, value3, value4, value5);
                            };
                        };
                    };
                };
            };
        };
        return ThreeRight;
    })();
    var KickUp = (function () {
        function KickUp(value0, value1, value2, value3) {
            this.value0 = value0;
            this.value1 = value1;
            this.value2 = value2;
            this.value3 = value3;
        };
        KickUp.create = function (value0) {
            return function (value1) {
                return function (value2) {
                    return function (value3) {
                        return new KickUp(value0, value1, value2, value3);
                    };
                };
            };
        };
        return KickUp;
    })();
    var values = function (v) {
        if (v instanceof Leaf) {
            return Data_List_Types.Nil.value;
        };
        if (v instanceof Two) {
            return Data_Semigroup.append(Data_List_Types.semigroupList)(values(v.value0))(Data_Semigroup.append(Data_List_Types.semigroupList)(Control_Applicative.pure(Data_List_Types.applicativeList)(v.value2))(values(v.value3)));
        };
        if (v instanceof Three) {
            return Data_Semigroup.append(Data_List_Types.semigroupList)(values(v.value0))(Data_Semigroup.append(Data_List_Types.semigroupList)(Control_Applicative.pure(Data_List_Types.applicativeList)(v.value2))(Data_Semigroup.append(Data_List_Types.semigroupList)(values(v.value3))(Data_Semigroup.append(Data_List_Types.semigroupList)(Control_Applicative.pure(Data_List_Types.applicativeList)(v.value5))(values(v.value6)))));
        };
        throw new Error("Failed pattern match at Data.Map.Internal (line 612, column 1 - line 612, column 40): " + [ v.constructor.name ]);
    };
    var singleton = function (k) {
        return function (v) {
            return new Two(Leaf.value, k, v, Leaf.value);
        };
    };
    var toUnfoldable = function (dictUnfoldable) {
        return function (m) {
            var go = function ($copy_v) {
                var $tco_done = false;
                var $tco_result;
                function $tco_loop(v) {
                    if (v instanceof Data_List_Types.Nil) {
                        $tco_done = true;
                        return Data_Maybe.Nothing.value;
                    };
                    if (v instanceof Data_List_Types.Cons) {
                        if (v.value0 instanceof Leaf) {
                            $copy_v = v.value1;
                            return;
                        };
                        if (v.value0 instanceof Two && (v.value0.value0 instanceof Leaf && v.value0.value3 instanceof Leaf)) {
                            $tco_done = true;
                            return Data_Maybe.Just.create(new Data_Tuple.Tuple(new Data_Tuple.Tuple(v.value0.value1, v.value0.value2), v.value1));
                        };
                        if (v.value0 instanceof Two && v.value0.value0 instanceof Leaf) {
                            $tco_done = true;
                            return Data_Maybe.Just.create(new Data_Tuple.Tuple(new Data_Tuple.Tuple(v.value0.value1, v.value0.value2), new Data_List_Types.Cons(v.value0.value3, v.value1)));
                        };
                        if (v.value0 instanceof Two) {
                            $copy_v = new Data_List_Types.Cons(v.value0.value0, new Data_List_Types.Cons(singleton(v.value0.value1)(v.value0.value2), new Data_List_Types.Cons(v.value0.value3, v.value1)));
                            return;
                        };
                        if (v.value0 instanceof Three) {
                            $copy_v = new Data_List_Types.Cons(v.value0.value0, new Data_List_Types.Cons(singleton(v.value0.value1)(v.value0.value2), new Data_List_Types.Cons(v.value0.value3, new Data_List_Types.Cons(singleton(v.value0.value4)(v.value0.value5), new Data_List_Types.Cons(v.value0.value6, v.value1)))));
                            return;
                        };
                        throw new Error("Failed pattern match at Data.Map.Internal (line 577, column 18 - line 586, column 71): " + [ v.value0.constructor.name ]);
                    };
                    throw new Error("Failed pattern match at Data.Map.Internal (line 576, column 3 - line 576, column 19): " + [ v.constructor.name ]);
                };
                while (!$tco_done) {
                    $tco_result = $tco_loop($copy_v);
                };
                return $tco_result;
            };
            return Data_Unfoldable.unfoldr(dictUnfoldable)(go)(new Data_List_Types.Cons(m, Data_List_Types.Nil.value));
        };
    };
    var lookup = function (dictOrd) {
        return function (k) {
            var comp = Data_Ord.compare(dictOrd);
            var go = function ($copy_v) {
                var $tco_done = false;
                var $tco_result;
                function $tco_loop(v) {
                    if (v instanceof Leaf) {
                        $tco_done = true;
                        return Data_Maybe.Nothing.value;
                    };
                    if (v instanceof Two) {
                        var v2 = comp(k)(v.value1);
                        if (v2 instanceof Data_Ordering.EQ) {
                            $tco_done = true;
                            return new Data_Maybe.Just(v.value2);
                        };
                        if (v2 instanceof Data_Ordering.LT) {
                            $copy_v = v.value0;
                            return;
                        };
                        $copy_v = v.value3;
                        return;
                    };
                    if (v instanceof Three) {
                        var v3 = comp(k)(v.value1);
                        if (v3 instanceof Data_Ordering.EQ) {
                            $tco_done = true;
                            return new Data_Maybe.Just(v.value2);
                        };
                        var v4 = comp(k)(v.value4);
                        if (v4 instanceof Data_Ordering.EQ) {
                            $tco_done = true;
                            return new Data_Maybe.Just(v.value5);
                        };
                        if (v3 instanceof Data_Ordering.LT) {
                            $copy_v = v.value0;
                            return;
                        };
                        if (v4 instanceof Data_Ordering.GT) {
                            $copy_v = v.value6;
                            return;
                        };
                        $copy_v = v.value3;
                        return;
                    };
                    throw new Error("Failed pattern match at Data.Map.Internal (line 200, column 5 - line 200, column 22): " + [ v.constructor.name ]);
                };
                while (!$tco_done) {
                    $tco_result = $tco_loop($copy_v);
                };
                return $tco_result;
            };
            return go;
        };
    }; 
    var fromZipper = function ($copy_dictOrd) {
        return function ($copy_v) {
            return function ($copy_tree) {
                var $tco_var_dictOrd = $copy_dictOrd;
                var $tco_var_v = $copy_v;
                var $tco_done = false;
                var $tco_result;
                function $tco_loop(dictOrd, v, tree) {
                    if (v instanceof Data_List_Types.Nil) {
                        $tco_done = true;
                        return tree;
                    };
                    if (v instanceof Data_List_Types.Cons) {
                        if (v.value0 instanceof TwoLeft) {
                            $tco_var_dictOrd = dictOrd;
                            $tco_var_v = v.value1;
                            $copy_tree = new Two(tree, v.value0.value0, v.value0.value1, v.value0.value2);
                            return;
                        };
                        if (v.value0 instanceof TwoRight) {
                            $tco_var_dictOrd = dictOrd;
                            $tco_var_v = v.value1;
                            $copy_tree = new Two(v.value0.value0, v.value0.value1, v.value0.value2, tree);
                            return;
                        };
                        if (v.value0 instanceof ThreeLeft) {
                            $tco_var_dictOrd = dictOrd;
                            $tco_var_v = v.value1;
                            $copy_tree = new Three(tree, v.value0.value0, v.value0.value1, v.value0.value2, v.value0.value3, v.value0.value4, v.value0.value5);
                            return;
                        };
                        if (v.value0 instanceof ThreeMiddle) {
                            $tco_var_dictOrd = dictOrd;
                            $tco_var_v = v.value1;
                            $copy_tree = new Three(v.value0.value0, v.value0.value1, v.value0.value2, tree, v.value0.value3, v.value0.value4, v.value0.value5);
                            return;
                        };
                        if (v.value0 instanceof ThreeRight) {
                            $tco_var_dictOrd = dictOrd;
                            $tco_var_v = v.value1;
                            $copy_tree = new Three(v.value0.value0, v.value0.value1, v.value0.value2, v.value0.value3, v.value0.value4, v.value0.value5, tree);
                            return;
                        };
                        throw new Error("Failed pattern match at Data.Map.Internal (line 418, column 3 - line 423, column 88): " + [ v.value0.constructor.name ]);
                    };
                    throw new Error("Failed pattern match at Data.Map.Internal (line 415, column 1 - line 415, column 80): " + [ v.constructor.name, tree.constructor.name ]);
                };
                while (!$tco_done) {
                    $tco_result = $tco_loop($tco_var_dictOrd, $tco_var_v, $copy_tree);
                };
                return $tco_result;
            };
        };
    };
    var insert = function (dictOrd) {
        return function (k) {
            return function (v) {
                var up = function ($copy_v1) {
                    return function ($copy_v2) {
                        var $tco_var_v1 = $copy_v1;
                        var $tco_done = false;
                        var $tco_result;
                        function $tco_loop(v1, v2) {
                            if (v1 instanceof Data_List_Types.Nil) {
                                $tco_done = true;
                                return new Two(v2.value0, v2.value1, v2.value2, v2.value3);
                            };
                            if (v1 instanceof Data_List_Types.Cons) {
                                if (v1.value0 instanceof TwoLeft) {
                                    $tco_done = true;
                                    return fromZipper(dictOrd)(v1.value1)(new Three(v2.value0, v2.value1, v2.value2, v2.value3, v1.value0.value0, v1.value0.value1, v1.value0.value2));
                                };
                                if (v1.value0 instanceof TwoRight) {
                                    $tco_done = true;
                                    return fromZipper(dictOrd)(v1.value1)(new Three(v1.value0.value0, v1.value0.value1, v1.value0.value2, v2.value0, v2.value1, v2.value2, v2.value3));
                                };
                                if (v1.value0 instanceof ThreeLeft) {
                                    $tco_var_v1 = v1.value1;
                                    $copy_v2 = new KickUp(new Two(v2.value0, v2.value1, v2.value2, v2.value3), v1.value0.value0, v1.value0.value1, new Two(v1.value0.value2, v1.value0.value3, v1.value0.value4, v1.value0.value5));
                                    return;
                                };
                                if (v1.value0 instanceof ThreeMiddle) {
                                    $tco_var_v1 = v1.value1;
                                    $copy_v2 = new KickUp(new Two(v1.value0.value0, v1.value0.value1, v1.value0.value2, v2.value0), v2.value1, v2.value2, new Two(v2.value3, v1.value0.value3, v1.value0.value4, v1.value0.value5));
                                    return;
                                };
                                if (v1.value0 instanceof ThreeRight) {
                                    $tco_var_v1 = v1.value1;
                                    $copy_v2 = new KickUp(new Two(v1.value0.value0, v1.value0.value1, v1.value0.value2, v1.value0.value3), v1.value0.value4, v1.value0.value5, new Two(v2.value0, v2.value1, v2.value2, v2.value3));
                                    return;
                                };
                                throw new Error("Failed pattern match at Data.Map.Internal (line 454, column 5 - line 459, column 108): " + [ v1.value0.constructor.name, v2.constructor.name ]);
                            };
                            throw new Error("Failed pattern match at Data.Map.Internal (line 451, column 3 - line 451, column 56): " + [ v1.constructor.name, v2.constructor.name ]);
                        };
                        while (!$tco_done) {
                            $tco_result = $tco_loop($tco_var_v1, $copy_v2);
                        };
                        return $tco_result;
                    };
                };
                var comp = Data_Ord.compare(dictOrd);
                var down = function ($copy_ctx) {
                    return function ($copy_v1) {
                        var $tco_var_ctx = $copy_ctx;
                        var $tco_done = false;
                        var $tco_result;
                        function $tco_loop(ctx, v1) {
                            if (v1 instanceof Leaf) {
                                $tco_done = true;
                                return up(ctx)(new KickUp(Leaf.value, k, v, Leaf.value));
                            };
                            if (v1 instanceof Two) {
                                var v2 = comp(k)(v1.value1);
                                if (v2 instanceof Data_Ordering.EQ) {
                                    $tco_done = true;
                                    return fromZipper(dictOrd)(ctx)(new Two(v1.value0, k, v, v1.value3));
                                };
                                if (v2 instanceof Data_Ordering.LT) {
                                    $tco_var_ctx = new Data_List_Types.Cons(new TwoLeft(v1.value1, v1.value2, v1.value3), ctx);
                                    $copy_v1 = v1.value0;
                                    return;
                                };
                                $tco_var_ctx = new Data_List_Types.Cons(new TwoRight(v1.value0, v1.value1, v1.value2), ctx);
                                $copy_v1 = v1.value3;
                                return;
                            };
                            if (v1 instanceof Three) {
                                var v3 = comp(k)(v1.value1);
                                if (v3 instanceof Data_Ordering.EQ) {
                                    $tco_done = true;
                                    return fromZipper(dictOrd)(ctx)(new Three(v1.value0, k, v, v1.value3, v1.value4, v1.value5, v1.value6));
                                };
                                var v4 = comp(k)(v1.value4);
                                if (v4 instanceof Data_Ordering.EQ) {
                                    $tco_done = true;
                                    return fromZipper(dictOrd)(ctx)(new Three(v1.value0, v1.value1, v1.value2, v1.value3, k, v, v1.value6));
                                };
                                if (v3 instanceof Data_Ordering.LT) {
                                    $tco_var_ctx = new Data_List_Types.Cons(new ThreeLeft(v1.value1, v1.value2, v1.value3, v1.value4, v1.value5, v1.value6), ctx);
                                    $copy_v1 = v1.value0;
                                    return;
                                };
                                if (v3 instanceof Data_Ordering.GT && v4 instanceof Data_Ordering.LT) {
                                    $tco_var_ctx = new Data_List_Types.Cons(new ThreeMiddle(v1.value0, v1.value1, v1.value2, v1.value4, v1.value5, v1.value6), ctx);
                                    $copy_v1 = v1.value3;
                                    return;
                                };
                                $tco_var_ctx = new Data_List_Types.Cons(new ThreeRight(v1.value0, v1.value1, v1.value2, v1.value3, v1.value4, v1.value5), ctx);
                                $copy_v1 = v1.value6;
                                return;
                            };
                            throw new Error("Failed pattern match at Data.Map.Internal (line 434, column 3 - line 434, column 55): " + [ ctx.constructor.name, v1.constructor.name ]);
                        };
                        while (!$tco_done) {
                            $tco_result = $tco_loop($tco_var_ctx, $copy_v1);
                        };
                        return $tco_result;
                    };
                };
                return down(Data_List_Types.Nil.value);
            };
        };
    };
    var pop = function (dictOrd) {
        return function (k) {
            var up = function ($copy_ctxs) {
                return function ($copy_tree) {
                    var $tco_var_ctxs = $copy_ctxs;
                    var $tco_done = false;
                    var $tco_result;
                    function $tco_loop(ctxs, tree) {
                        if (ctxs instanceof Data_List_Types.Nil) {
                            $tco_done = true;
                            return tree;
                        };
                        if (ctxs instanceof Data_List_Types.Cons) {
                            if (ctxs.value0 instanceof TwoLeft && (ctxs.value0.value2 instanceof Leaf && tree instanceof Leaf)) {
                                $tco_done = true;
                                return fromZipper(dictOrd)(ctxs.value1)(new Two(Leaf.value, ctxs.value0.value0, ctxs.value0.value1, Leaf.value));
                            };
                            if (ctxs.value0 instanceof TwoRight && (ctxs.value0.value0 instanceof Leaf && tree instanceof Leaf)) {
                                $tco_done = true;
                                return fromZipper(dictOrd)(ctxs.value1)(new Two(Leaf.value, ctxs.value0.value1, ctxs.value0.value2, Leaf.value));
                            };
                            if (ctxs.value0 instanceof TwoLeft && ctxs.value0.value2 instanceof Two) {
                                $tco_var_ctxs = ctxs.value1;
                                $copy_tree = new Three(tree, ctxs.value0.value0, ctxs.value0.value1, ctxs.value0.value2.value0, ctxs.value0.value2.value1, ctxs.value0.value2.value2, ctxs.value0.value2.value3);
                                return;
                            };
                            if (ctxs.value0 instanceof TwoRight && ctxs.value0.value0 instanceof Two) {
                                $tco_var_ctxs = ctxs.value1;
                                $copy_tree = new Three(ctxs.value0.value0.value0, ctxs.value0.value0.value1, ctxs.value0.value0.value2, ctxs.value0.value0.value3, ctxs.value0.value1, ctxs.value0.value2, tree);
                                return;
                            };
                            if (ctxs.value0 instanceof TwoLeft && ctxs.value0.value2 instanceof Three) {
                                $tco_done = true;
                                return fromZipper(dictOrd)(ctxs.value1)(new Two(new Two(tree, ctxs.value0.value0, ctxs.value0.value1, ctxs.value0.value2.value0), ctxs.value0.value2.value1, ctxs.value0.value2.value2, new Two(ctxs.value0.value2.value3, ctxs.value0.value2.value4, ctxs.value0.value2.value5, ctxs.value0.value2.value6)));
                            };
                            if (ctxs.value0 instanceof TwoRight && ctxs.value0.value0 instanceof Three) {
                                $tco_done = true;
                                return fromZipper(dictOrd)(ctxs.value1)(new Two(new Two(ctxs.value0.value0.value0, ctxs.value0.value0.value1, ctxs.value0.value0.value2, ctxs.value0.value0.value3), ctxs.value0.value0.value4, ctxs.value0.value0.value5, new Two(ctxs.value0.value0.value6, ctxs.value0.value1, ctxs.value0.value2, tree)));
                            };
                            if (ctxs.value0 instanceof ThreeLeft && (ctxs.value0.value2 instanceof Leaf && (ctxs.value0.value5 instanceof Leaf && tree instanceof Leaf))) {
                                $tco_done = true;
                                return fromZipper(dictOrd)(ctxs.value1)(new Three(Leaf.value, ctxs.value0.value0, ctxs.value0.value1, Leaf.value, ctxs.value0.value3, ctxs.value0.value4, Leaf.value));
                            };
                            if (ctxs.value0 instanceof ThreeMiddle && (ctxs.value0.value0 instanceof Leaf && (ctxs.value0.value5 instanceof Leaf && tree instanceof Leaf))) {
                                $tco_done = true;
                                return fromZipper(dictOrd)(ctxs.value1)(new Three(Leaf.value, ctxs.value0.value1, ctxs.value0.value2, Leaf.value, ctxs.value0.value3, ctxs.value0.value4, Leaf.value));
                            };
                            if (ctxs.value0 instanceof ThreeRight && (ctxs.value0.value0 instanceof Leaf && (ctxs.value0.value3 instanceof Leaf && tree instanceof Leaf))) {
                                $tco_done = true;
                                return fromZipper(dictOrd)(ctxs.value1)(new Three(Leaf.value, ctxs.value0.value1, ctxs.value0.value2, Leaf.value, ctxs.value0.value4, ctxs.value0.value5, Leaf.value));
                            };
                            if (ctxs.value0 instanceof ThreeLeft && ctxs.value0.value2 instanceof Two) {
                                $tco_done = true;
                                return fromZipper(dictOrd)(ctxs.value1)(new Two(new Three(tree, ctxs.value0.value0, ctxs.value0.value1, ctxs.value0.value2.value0, ctxs.value0.value2.value1, ctxs.value0.value2.value2, ctxs.value0.value2.value3), ctxs.value0.value3, ctxs.value0.value4, ctxs.value0.value5));
                            };
                            if (ctxs.value0 instanceof ThreeMiddle && ctxs.value0.value0 instanceof Two) {
                                $tco_done = true;
                                return fromZipper(dictOrd)(ctxs.value1)(new Two(new Three(ctxs.value0.value0.value0, ctxs.value0.value0.value1, ctxs.value0.value0.value2, ctxs.value0.value0.value3, ctxs.value0.value1, ctxs.value0.value2, tree), ctxs.value0.value3, ctxs.value0.value4, ctxs.value0.value5));
                            };
                            if (ctxs.value0 instanceof ThreeMiddle && ctxs.value0.value5 instanceof Two) {
                                $tco_done = true;
                                return fromZipper(dictOrd)(ctxs.value1)(new Two(ctxs.value0.value0, ctxs.value0.value1, ctxs.value0.value2, new Three(tree, ctxs.value0.value3, ctxs.value0.value4, ctxs.value0.value5.value0, ctxs.value0.value5.value1, ctxs.value0.value5.value2, ctxs.value0.value5.value3)));
                            };
                            if (ctxs.value0 instanceof ThreeRight && ctxs.value0.value3 instanceof Two) {
                                $tco_done = true;
                                return fromZipper(dictOrd)(ctxs.value1)(new Two(ctxs.value0.value0, ctxs.value0.value1, ctxs.value0.value2, new Three(ctxs.value0.value3.value0, ctxs.value0.value3.value1, ctxs.value0.value3.value2, ctxs.value0.value3.value3, ctxs.value0.value4, ctxs.value0.value5, tree)));
                            };
                            if (ctxs.value0 instanceof ThreeLeft && ctxs.value0.value2 instanceof Three) {
                                $tco_done = true;
                                return fromZipper(dictOrd)(ctxs.value1)(new Three(new Two(tree, ctxs.value0.value0, ctxs.value0.value1, ctxs.value0.value2.value0), ctxs.value0.value2.value1, ctxs.value0.value2.value2, new Two(ctxs.value0.value2.value3, ctxs.value0.value2.value4, ctxs.value0.value2.value5, ctxs.value0.value2.value6), ctxs.value0.value3, ctxs.value0.value4, ctxs.value0.value5));
                            };
                            if (ctxs.value0 instanceof ThreeMiddle && ctxs.value0.value0 instanceof Three) {
                                $tco_done = true;
                                return fromZipper(dictOrd)(ctxs.value1)(new Three(new Two(ctxs.value0.value0.value0, ctxs.value0.value0.value1, ctxs.value0.value0.value2, ctxs.value0.value0.value3), ctxs.value0.value0.value4, ctxs.value0.value0.value5, new Two(ctxs.value0.value0.value6, ctxs.value0.value1, ctxs.value0.value2, tree), ctxs.value0.value3, ctxs.value0.value4, ctxs.value0.value5));
                            };
                            if (ctxs.value0 instanceof ThreeMiddle && ctxs.value0.value5 instanceof Three) {
                                $tco_done = true;
                                return fromZipper(dictOrd)(ctxs.value1)(new Three(ctxs.value0.value0, ctxs.value0.value1, ctxs.value0.value2, new Two(tree, ctxs.value0.value3, ctxs.value0.value4, ctxs.value0.value5.value0), ctxs.value0.value5.value1, ctxs.value0.value5.value2, new Two(ctxs.value0.value5.value3, ctxs.value0.value5.value4, ctxs.value0.value5.value5, ctxs.value0.value5.value6)));
                            };
                            if (ctxs.value0 instanceof ThreeRight && ctxs.value0.value3 instanceof Three) {
                                $tco_done = true;
                                return fromZipper(dictOrd)(ctxs.value1)(new Three(ctxs.value0.value0, ctxs.value0.value1, ctxs.value0.value2, new Two(ctxs.value0.value3.value0, ctxs.value0.value3.value1, ctxs.value0.value3.value2, ctxs.value0.value3.value3), ctxs.value0.value3.value4, ctxs.value0.value3.value5, new Two(ctxs.value0.value3.value6, ctxs.value0.value4, ctxs.value0.value5, tree)));
                            };
                            throw new Error("Failed pattern match at Data.Map.Internal (line 511, column 9 - line 528, column 136): " + [ ctxs.value0.constructor.name, tree.constructor.name ]);
                        };
                        throw new Error("Failed pattern match at Data.Map.Internal (line 508, column 5 - line 528, column 136): " + [ ctxs.constructor.name ]);
                    };
                    while (!$tco_done) {
                        $tco_result = $tco_loop($tco_var_ctxs, $copy_tree);
                    };
                    return $tco_result;
                };
            };
            var removeMaxNode = function ($copy_ctx) {
                return function ($copy_m) {
                    var $tco_var_ctx = $copy_ctx;
                    var $tco_done = false;
                    var $tco_result;
                    function $tco_loop(ctx, m) {
                        if (m instanceof Two && (m.value0 instanceof Leaf && m.value3 instanceof Leaf)) {
                            $tco_done = true;
                            return up(ctx)(Leaf.value);
                        };
                        if (m instanceof Two) {
                            $tco_var_ctx = new Data_List_Types.Cons(new TwoRight(m.value0, m.value1, m.value2), ctx);
                            $copy_m = m.value3;
                            return;
                        };
                        if (m instanceof Three && (m.value0 instanceof Leaf && (m.value3 instanceof Leaf && m.value6 instanceof Leaf))) {
                            $tco_done = true;
                            return up(new Data_List_Types.Cons(new TwoRight(Leaf.value, m.value1, m.value2), ctx))(Leaf.value);
                        };
                        if (m instanceof Three) {
                            $tco_var_ctx = new Data_List_Types.Cons(new ThreeRight(m.value0, m.value1, m.value2, m.value3, m.value4, m.value5), ctx);
                            $copy_m = m.value6;
                            return;
                        };
                        throw new Error("Failed pattern match at Data.Map.Internal (line 540, column 5 - line 544, column 107): " + [ m.constructor.name ]);
                    };
                    while (!$tco_done) {
                        $tco_result = $tco_loop($tco_var_ctx, $copy_m);
                    };
                    return $tco_result;
                };
            };
            var maxNode = function ($copy_m) {
                var $tco_done = false;
                var $tco_result;
                function $tco_loop(m) {
                    if (m instanceof Two && m.value3 instanceof Leaf) {
                        $tco_done = true;
                        return {
                            key: m.value1,
                            value: m.value2
                        };
                    };
                    if (m instanceof Two) {
                        $copy_m = m.value3;
                        return;
                    };
                    if (m instanceof Three && m.value6 instanceof Leaf) {
                        $tco_done = true;
                        return {
                            key: m.value4,
                            value: m.value5
                        };
                    };
                    if (m instanceof Three) {
                        $copy_m = m.value6;
                        return;
                    };
                    throw new Error("Failed pattern match at Data.Map.Internal (line 531, column 33 - line 535, column 45): " + [ m.constructor.name ]);
                };
                while (!$tco_done) {
                    $tco_result = $tco_loop($copy_m);
                };
                return $tco_result;
            };
            var comp = Data_Ord.compare(dictOrd);
            var down = function ($copy_ctx) {
                return function ($copy_m) {
                    var $tco_var_ctx = $copy_ctx;
                    var $tco_done = false;
                    var $tco_result;
                    function $tco_loop(ctx, m) {
                        if (m instanceof Leaf) {
                            $tco_done = true;
                            return Data_Maybe.Nothing.value;
                        };
                        if (m instanceof Two) {
                            var v = comp(k)(m.value1);
                            if (m.value3 instanceof Leaf && v instanceof Data_Ordering.EQ) {
                                $tco_done = true;
                                return new Data_Maybe.Just(new Data_Tuple.Tuple(m.value2, up(ctx)(Leaf.value)));
                            };
                            if (v instanceof Data_Ordering.EQ) {
                                var max = maxNode(m.value0);
                                $tco_done = true;
                                return new Data_Maybe.Just(new Data_Tuple.Tuple(m.value2, removeMaxNode(new Data_List_Types.Cons(new TwoLeft(max.key, max.value, m.value3), ctx))(m.value0)));
                            };
                            if (v instanceof Data_Ordering.LT) {
                                $tco_var_ctx = new Data_List_Types.Cons(new TwoLeft(m.value1, m.value2, m.value3), ctx);
                                $copy_m = m.value0;
                                return;
                            };
                            $tco_var_ctx = new Data_List_Types.Cons(new TwoRight(m.value0, m.value1, m.value2), ctx);
                            $copy_m = m.value3;
                            return;
                        };
                        if (m instanceof Three) {
                            var leaves = (function () {
                                if (m.value0 instanceof Leaf && (m.value3 instanceof Leaf && m.value6 instanceof Leaf)) {
                                    return true;
                                };
                                return false;
                            })();
                            var v = comp(k)(m.value4);
                            var v3 = comp(k)(m.value1);
                            if (leaves && v3 instanceof Data_Ordering.EQ) {
                                $tco_done = true;
                                return new Data_Maybe.Just(new Data_Tuple.Tuple(m.value2, fromZipper(dictOrd)(ctx)(new Two(Leaf.value, m.value4, m.value5, Leaf.value))));
                            };
                            if (leaves && v instanceof Data_Ordering.EQ) {
                                $tco_done = true;
                                return new Data_Maybe.Just(new Data_Tuple.Tuple(m.value5, fromZipper(dictOrd)(ctx)(new Two(Leaf.value, m.value1, m.value2, Leaf.value))));
                            };
                            if (v3 instanceof Data_Ordering.EQ) {
                                var max = maxNode(m.value0);
                                $tco_done = true;
                                return new Data_Maybe.Just(new Data_Tuple.Tuple(m.value2, removeMaxNode(new Data_List_Types.Cons(new ThreeLeft(max.key, max.value, m.value3, m.value4, m.value5, m.value6), ctx))(m.value0)));
                            };
                            if (v instanceof Data_Ordering.EQ) {
                                var max = maxNode(m.value3);
                                $tco_done = true;
                                return new Data_Maybe.Just(new Data_Tuple.Tuple(m.value5, removeMaxNode(new Data_List_Types.Cons(new ThreeMiddle(m.value0, m.value1, m.value2, max.key, max.value, m.value6), ctx))(m.value3)));
                            };
                            if (v3 instanceof Data_Ordering.LT) {
                                $tco_var_ctx = new Data_List_Types.Cons(new ThreeLeft(m.value1, m.value2, m.value3, m.value4, m.value5, m.value6), ctx);
                                $copy_m = m.value0;
                                return;
                            };
                            if (v3 instanceof Data_Ordering.GT && v instanceof Data_Ordering.LT) {
                                $tco_var_ctx = new Data_List_Types.Cons(new ThreeMiddle(m.value0, m.value1, m.value2, m.value4, m.value5, m.value6), ctx);
                                $copy_m = m.value3;
                                return;
                            };
                            $tco_var_ctx = new Data_List_Types.Cons(new ThreeRight(m.value0, m.value1, m.value2, m.value3, m.value4, m.value5), ctx);
                            $copy_m = m.value6;
                            return;
                        };
                        throw new Error("Failed pattern match at Data.Map.Internal (line 481, column 34 - line 504, column 80): " + [ m.constructor.name ]);
                    };
                    while (!$tco_done) {
                        $tco_result = $tco_loop($tco_var_ctx, $copy_m);
                    };
                    return $tco_result;
                };
            };
            return down(Data_List_Types.Nil.value);
        };
    };
    var foldableMap = new Data_Foldable.Foldable(function (dictMonoid) {
        return function (f) {
            return function (m) {
                return Data_Foldable.foldMap(Data_List_Types.foldableList)(dictMonoid)(f)(values(m));
            };
        };
    }, function (f) {
        return function (z) {
            return function (m) {
                return Data_Foldable.foldl(Data_List_Types.foldableList)(f)(z)(values(m));
            };
        };
    }, function (f) {
        return function (z) {
            return function (m) {
                return Data_Foldable.foldr(Data_List_Types.foldableList)(f)(z)(values(m));
            };
        };
    });
    var empty = Leaf.value;
    var fromFoldable = function (dictOrd) {
        return function (dictFoldable) {
            return Data_Foldable.foldl(dictFoldable)(function (m) {
                return function (v) {
                    return insert(dictOrd)(v.value0)(v.value1)(m);
                };
            })(empty);
        };
    };
    var filterWithKey = function (dictOrd) {
        return function (predicate) {
            var $758 = fromFoldable(dictOrd)(Data_List_Lazy_Types.foldableList);
            var $759 = Data_List_Lazy.filter(Data_Tuple.uncurry(predicate));
            var $760 = toUnfoldable(Data_List_Lazy_Types.unfoldableList);
            return function ($761) {
                return $758($759($760($761)));
            };
        };
    };
    var filter = function (dictOrd) {
        return function (predicate) {
            return filterWithKey(dictOrd)(Data_Function["const"](predicate));
        };
    };
    var $$delete = function (dictOrd) {
        return function (k) {
            return function (m) {
                return Data_Maybe.maybe(m)(Data_Tuple.snd)(pop(dictOrd)(k)(m));
            };
        };
    };
    var asList = Control_Category.identity(Control_Category.categoryFn);
    var foldableWithIndexMap = new Data_FoldableWithIndex.FoldableWithIndex(function () {
        return foldableMap;
    }, function (dictMonoid) {
        return function (f) {
            return function (m) {
                return Data_Foldable.foldMap(Data_List_Types.foldableList)(dictMonoid)(Data_Tuple.uncurry(f))(asList(toUnfoldable(Data_List_Types.unfoldableList)(m)));
            };
        };
    }, function (f) {
        return function (z) {
            return function (m) {
                return Data_Foldable.foldl(Data_List_Types.foldableList)((function () {
                    var $763 = Data_Function.flip(f);
                    return function ($764) {
                        return Data_Tuple.uncurry($763($764));
                    };
                })())(z)(asList(toUnfoldable(Data_List_Types.unfoldableList)(m)));
            };
        };
    }, function (f) {
        return function (z) {
            return function (m) {
                return Data_Foldable.foldr(Data_List_Types.foldableList)(Data_Tuple.uncurry(f))(z)(asList(toUnfoldable(Data_List_Types.unfoldableList)(m)));
            };
        };
    });
    var mapMaybeWithKey = function (dictOrd) {
        return function (f) {
            return Data_FoldableWithIndex.foldrWithIndex(foldableWithIndexMap)(function (k) {
                return function (a) {
                    return function (acc) {
                        return Data_Maybe.maybe(acc)(function (b) {
                            return insert(dictOrd)(k)(b)(acc);
                        })(f(k)(a));
                    };
                };
            })(empty);
        };
    };
    var mapMaybe = function (dictOrd) {
        var $765 = mapMaybeWithKey(dictOrd);
        return function ($766) {
            return $765(Data_Function["const"]($766));
        };
    }; 
    var alter = function (dictOrd) {
        return function (f) {
            return function (k) {
                return function (m) {
                    var v = f(lookup(dictOrd)(k)(m));
                    if (v instanceof Data_Maybe.Nothing) {
                        return $$delete(dictOrd)(k)(m);
                    };
                    if (v instanceof Data_Maybe.Just) {
                        return insert(dictOrd)(k)(v.value0)(m);
                    };
                    throw new Error("Failed pattern match at Data.Map.Internal (line 549, column 15 - line 551, column 25): " + [ v.constructor.name ]);
                };
            };
        };
    };
    var unionWith = function (dictOrd) {
        return function (f) {
            return function (m1) {
                return function (m2) {
                    var go = function (m) {
                        return function (v) {
                            return alter(dictOrd)((function () {
                                var $769 = Data_Maybe.maybe(v.value1)(f(v.value1));
                                return function ($770) {
                                    return Data_Maybe.Just.create($769($770));
                                };
                            })())(v.value0)(m);
                        };
                    };
                    return Data_Foldable.foldl(Data_List_Types.foldableList)(go)(m2)(toUnfoldable(Data_List_Types.unfoldableList)(m1));
                };
            };
        };
    };
    exports["empty"] = empty;
    exports["singleton"] = singleton;
    exports["insert"] = insert;
    exports["lookup"] = lookup;
    exports["toUnfoldable"] = toUnfoldable;
    exports["unionWith"] = unionWith;
    exports["filter"] = filter;
    exports["mapMaybe"] = mapMaybe;
    exports["foldableWithIndexMap"] = foldableWithIndexMap;
  })(PS);
  (function($PS) {
    // Generated by purs version 0.13.8
    "use strict";
    $PS["Data.Sparse.Polynomial"] = $PS["Data.Sparse.Polynomial"] || {};
    var exports = $PS["Data.Sparse.Polynomial"];
    var Data_Eq = $PS["Data.Eq"];
    var Data_Foldable = $PS["Data.Foldable"];
    var Data_FoldableWithIndex = $PS["Data.FoldableWithIndex"];
    var Data_Functor = $PS["Data.Functor"];
    var Data_Map_Internal = $PS["Data.Map.Internal"];
    var Data_Maybe = $PS["Data.Maybe"];
    var Data_Ord = $PS["Data.Ord"];
    var Data_Ring = $PS["Data.Ring"];
    var Data_Semiring = $PS["Data.Semiring"];
    var Data_Unfoldable = $PS["Data.Unfoldable"];
    var Poly = (function () {
        function Poly(value0) {
            this.value0 = value0;
        };
        Poly.create = function (value0) {
            return new Poly(value0);
        };
        return Poly;
    })();
    var semiringPoly = function (dictEq) {
        return function (dictSemiring) {
            return new Data_Semiring.Semiring(function (v) {
                return function (v1) {
                    return Poly.create(Data_Map_Internal.filter(Data_Ord.ordInt)(function (v2) {
                        return Data_Eq.notEq(dictEq)(v2)(Data_Semiring.zero(dictSemiring));
                    })(Data_Map_Internal.unionWith(Data_Ord.ordInt)(Data_Semiring.add(dictSemiring))(v.value0)(v1.value0)));
                };
            }, function (v) {
                return function (v1) {
                    return Poly.create(Data_Map_Internal.filter(Data_Ord.ordInt)(function (v2) {
                        return Data_Eq.notEq(dictEq)(v2)(Data_Semiring.zero(dictSemiring));
                    })(Data_Foldable.foldr(Data_Foldable.foldableArray)(Data_Map_Internal.unionWith(Data_Ord.ordInt)(Data_Semiring.add(dictSemiring)))(Data_Map_Internal.empty)(Data_Functor.map(Data_Functor.functorArray)(function (v2) {
                        return Data_FoldableWithIndex.foldrWithIndex(Data_Map_Internal.foldableWithIndexMap)(function (j) {
                            return function (w) {
                                return function (acc) {
                                    return Data_Map_Internal.insert(Data_Ord.ordInt)(v2.value0 + j | 0)(Data_Semiring.mul(dictSemiring)(v2.value1)(w))(acc);
                                };
                            };
                        })(Data_Map_Internal.empty)(v1.value0);
                    })(Data_Map_Internal.toUnfoldable(Data_Unfoldable.unfoldableArray)(v.value0)))));
                };
            }, Poly.create(Data_Map_Internal.singleton(0)(Data_Semiring.one(dictSemiring))), new Poly(Data_Map_Internal.empty));
        };
    }; 
    var query = function (dictSemiring) {
        return function (v) {
            return function (n) {
                return Data_Maybe.fromMaybe(Data_Semiring.zero(dictSemiring))(Data_Map_Internal.lookup(Data_Ord.ordInt)(n)(v.value0));
            };
        };
    };                                                         
    var monoPol = function (x) {
        return function (n) {
            return Poly.create(Data_Map_Internal.insert(Data_Ord.ordInt)(n)(x)(Data_Map_Internal.empty));
        };
    };                                                                                           
    var functorPoly = new Data_Functor.Functor(function (f) {
        return function (v) {
            return Poly.create(Data_Map_Internal.mapMaybe(Data_Ord.ordInt)(function (v1) {
                return Data_Maybe.Just.create(f(v1));
            })(v.value0));
        };
    });
    var ringPoly = function (dictEq) {
        return function (dictSemiring) {
            return function (dictRing) {
                return new Data_Ring.Ring(function () {
                    return semiringPoly(dictEq)(dictRing.Semiring0());
                }, function (p1) {
                    return function (p2) {
                        return Data_Semiring.add(semiringPoly(dictEq)(dictRing.Semiring0()))(p1)(Data_Functor.map(functorPoly)(function (v) {
                            return Data_Semiring.mul(dictRing.Semiring0())(v)(Data_Ring.negate(dictRing)(Data_Semiring.one(dictRing.Semiring0())));
                        })(p2));
                    };
                });
            };
        };
    };
    exports["monoPol"] = monoPol;
    exports["query"] = query;
    exports["semiringPoly"] = semiringPoly;
    exports["ringPoly"] = ringPoly;
  })(PS);
  (function(exports) {
    "use strict";          
  
    exports.acos = Math.acos;
  
    exports.atan2 = function (y) {
      return function (x) {
        return Math.atan2(y, x);
      };
    };                       
  
    exports.cos = Math.cos;
  
    exports.round = Math.round;
  
    exports.sin = Math.sin;
  
    exports.sqrt = Math.sqrt;    
  
    exports.pi = Math.PI;
  })(PS["Math"] = PS["Math"] || {});
  (function($PS) {
    // Generated by purs version 0.13.8
    "use strict";
    $PS["Math"] = $PS["Math"] || {};
    var exports = $PS["Math"];
    var $foreign = $PS["Math"];
    exports["acos"] = $foreign.acos;
    exports["atan2"] = $foreign.atan2;
    exports["cos"] = $foreign.cos;
    exports["round"] = $foreign.round;
    exports["sin"] = $foreign.sin;
    exports["sqrt"] = $foreign.sqrt;
    exports["pi"] = $foreign.pi;
  })(PS);
  (function($PS) {
    // Generated by purs version 0.13.8
    "use strict";
    $PS["Data.Geometry.Plane"] = $PS["Data.Geometry.Plane"] || {};
    var exports = $PS["Data.Geometry.Plane"];
    var Data_Boolean = $PS["Data.Boolean"];
    var Data_Eq = $PS["Data.Eq"];
    var Data_Ring = $PS["Data.Ring"];
    var Data_Semiring = $PS["Data.Semiring"];
    var Data_Sparse_Polynomial = $PS["Data.Sparse.Polynomial"];
    var Data_Unit = $PS["Data.Unit"];
    var $$Math = $PS["Math"];                
    var Vector = function (x) {
        return x;
    };
    var Point = function (x) {
        return x;
    };
    var Line = function (x) {
        return x;
    };
    var Summable = function (plus) {
        this.plus = plus;
    };
    var Measurable = function (length) {
        this.length = length;
    };
    var Intersectable = function (meets) {
        this.meets = meets;
    };
    var Based = function (abs, coords, ord) {
        this.abs = abs;
        this.coords = coords;
        this.ord = ord;
    };
    var vector = function (v) {
        return function (v1) {
            return Vector(Data_Ring.sub(Data_Sparse_Polynomial.ringPoly(Data_Eq.eqNumber)(Data_Semiring.semiringNumber)(Data_Ring.ringNumber))(v1.coordinates)(v.coordinates));
        };
    };
    var summableVectorVector = new Summable(function (v) {
        return function (v1) {
            return Vector(Data_Semiring.add(Data_Sparse_Polynomial.semiringPoly(Data_Eq.eqNumber)(Data_Semiring.semiringNumber))(v)(v1));
        };
    });
    var segment = function (origin) {
        return function (extremity) {
            return function (asOriented) {
                return {
                    origin: origin,
                    extremity: extremity,
                    asOriented: asOriented
                };
            };
        };
    };
    var scale = function (k) {
        return function (v) {
            return Vector(Data_Semiring.mul(Data_Sparse_Polynomial.semiringPoly(Data_Eq.eqNumber)(Data_Semiring.semiringNumber))(Data_Sparse_Polynomial.monoPol(k)(0))(v));
        };
    };
    var rightangle = function (origin) {
        return function (center) {
            return function (extremity) {
                return function (radius) {
                    return {
                        origin: origin,
                        center: center,
                        extremity: extremity,
                        radius: radius
                    };
                };
            };
        };
    };
    var rename = function (str) {
        return function (v) {
            return Point({
                name: str,
                coordinates: v.coordinates
            });
        };
    };
    var point = function (name) {
        return function (x) {
            return function (y) {
                return Point({
                    name: name,
                    coordinates: Data_Semiring.add(Data_Sparse_Polynomial.semiringPoly(Data_Eq.eqNumber)(Data_Semiring.semiringNumber))(Data_Sparse_Polynomial.monoPol(x)(0))(Data_Sparse_Polynomial.monoPol(y)(1))
                });
            };
        };
    };
    var plus = function (dict) {
        return dict.plus;
    };
    var ord = function (dict) {
        return dict.ord;
    };
    var middle = function (name) {
        return function (v) {
            return {
                name: name,
                coordinates: Data_Semiring.mul(Data_Sparse_Polynomial.semiringPoly(Data_Eq.eqNumber)(Data_Semiring.semiringNumber))(Data_Semiring.add(Data_Sparse_Polynomial.semiringPoly(Data_Eq.eqNumber)(Data_Semiring.semiringNumber))(v.origin.coordinates)(v.extremity.coordinates))(Data_Sparse_Polynomial.monoPol(0.5)(0))
            };
        };
    };
    var meets = function (dict) {
        return dict.meets;
    };
    var length = function (dict) {
        return dict.length;
    };
    var interLineLine = new Intersectable(function (v) {
        return function (v1) {
            var delta = v.a * v1.b - v1.a * v.b;
            if (delta === 0.0) {
                return [  ];
            };
            if (Data_Boolean.otherwise) {
                return [ point("")((v.b * v1.c - v1.b * v.c) / delta)((v1.a * v.c - v.a * v1.c) / delta) ];
            };
            throw new Error("Failed pattern match at Data.Geometry.Plane (line 189, column 8 - line 192, column 65): " + [ Data_Unit.unit.constructor.name ]);
        };
    });
    var halfline = function (origin) {
        return function (direction) {
            return {
                origin: origin,
                direction: direction
            };
        };
    }; 
    var coords = function (dict) {
        return dict.coords;
    };
    var circle = function (p) {
        return function (r) {
            return {
                center: p,
                radius: r
            };
        };
    };
    var basedVector = new Based(function (v) {
        return Data_Sparse_Polynomial.query(Data_Semiring.semiringNumber)(v)(0);
    }, function (v) {
        return v;
    }, function (v) {
        return Data_Sparse_Polynomial.query(Data_Semiring.semiringNumber)(v)(1);
    });
    var basedPoint = new Based(function (v) {
        return Data_Sparse_Polynomial.query(Data_Semiring.semiringNumber)(v.coordinates)(0);
    }, function (v) {
        return v.coordinates;
    }, function (v) {
        return Data_Sparse_Polynomial.query(Data_Semiring.semiringNumber)(v.coordinates)(1);
    });
    var summublePointVector = new Summable(function (p) {
        return function (v) {
            return {
                name: "",
                coordinates: Data_Semiring.add(Data_Sparse_Polynomial.semiringPoly(Data_Eq.eqNumber)(Data_Semiring.semiringNumber))(coords(basedPoint)(p))(coords(basedVector)(v))
            };
        };
    });
    var arc = function (origin) {
        return function (center) {
            return function (extremity) {
                return function (radius) {
                    return function (flag) {
                        return function (flipped) {
                            return function (swapped) {
                                return function (asOriented) {
                                    return {
                                        origin: origin,
                                        center: center,
                                        extremity: extremity,
                                        radius: radius,
                                        flag: flag,
                                        flipped: flipped,
                                        swapped: swapped,
                                        asOriented: asOriented
                                    };
                                };
                            };
                        };
                    };
                };
            };
        };
    };
    var abs = function (dict) {
        return dict.abs;
    };
    var line = function (m) {
        return function (n) {
            return Line({
                a: ord(basedPoint)(m) - ord(basedPoint)(n),
                b: abs(basedPoint)(n) - abs(basedPoint)(m),
                c: abs(basedPoint)(m) * ord(basedPoint)(n) - ord(basedPoint)(m) * abs(basedPoint)(n)
            });
        };
    };
    var measurableVector = new Measurable(function (v) {
        return $$Math.sqrt(abs(basedVector)(v) * abs(basedVector)(v) + ord(basedVector)(v) * ord(basedVector)(v));
    });
    var cosAngle = function (u) {
        return function (v) {
            return (abs(basedVector)(u) * abs(basedVector)(v) + ord(basedVector)(u) * ord(basedVector)(v)) / (length(measurableVector)(u) * length(measurableVector)(v));
        };
    }; 
    var normalized = function (v) {
        return scale(1.0 / length(measurableVector)(v))(v);
    };
    var normalTo = function (v) {
        return Vector(Data_Semiring.add(Data_Sparse_Polynomial.semiringPoly(Data_Eq.eqNumber)(Data_Semiring.semiringNumber))(Data_Sparse_Polynomial.monoPol(-ord(basedVector)(v))(0))(Data_Sparse_Polynomial.monoPol(abs(basedVector)(v))(1)));
    };
    var projection = function (direction) {
        return function (v) {
            return scale((abs(basedVector)(v) * abs(basedVector)(direction) + ord(basedVector)(v) * ord(basedVector)(direction)) / (length(measurableVector)(direction) * length(measurableVector)(direction)))(direction);
        };
    };
    var rotated = function (ang) {
        return function (v) {
            return Vector(Data_Semiring.add(Data_Sparse_Polynomial.semiringPoly(Data_Eq.eqNumber)(Data_Semiring.semiringNumber))(Data_Sparse_Polynomial.monoPol(abs(basedVector)(v) * $$Math.cos(ang) - ord(basedVector)(v) * $$Math.sin(ang))(0))(Data_Sparse_Polynomial.monoPol(abs(basedVector)(v) * $$Math.sin(ang) + ord(basedVector)(v) * $$Math.cos(ang))(1)));
        };
    }; 
    var aVectorOfLine = function (v) {
        return Vector(Data_Semiring.add(Data_Sparse_Polynomial.semiringPoly(Data_Eq.eqNumber)(Data_Semiring.semiringNumber))(Data_Sparse_Polynomial.monoPol(-v.b)(0))(Data_Sparse_Polynomial.monoPol(v.a)(1)));
    };
    var aPointOnLine = function (v) {
        return point("")((-v.a * v.c) / (v.a * v.a + v.b * v.b))((-v.b * v.c) / (v.a * v.a + v.b * v.b));
    };
    var interLineCircle = new Intersectable(function (v) {
        return function (v1) {
            var u = aVectorOfLine(v);
            var m = aPointOnLine(v);
            var n = plus(summublePointVector)(m)(projection(u)(vector(m)(v1.center)));
            var ob = length(measurableVector)(vector(v1.center)(n));
            if (ob > v1.radius) {
                return [  ];
            };
            if (ob === v1.radius) {
                return [ n ];
            };
            if (Data_Boolean.otherwise) {
                var om = $$Math.sqrt(v1.radius * v1.radius - ob * ob);
                var v2 = scale(om / length(measurableVector)(u))(u);
                return [ plus(summublePointVector)(n)(v2), plus(summublePointVector)(n)(scale(-1.0)(v2)) ];
            };
            throw new Error("Failed pattern match at Data.Geometry.Plane (line 209, column 10 - line 215, column 55): " + [ Data_Unit.unit.constructor.name ]);
        };
    });
    exports["abs"] = abs;
    exports["length"] = length;
    exports["meets"] = meets;
    exports["ord"] = ord;
    exports["plus"] = plus;
    exports["point"] = point;
    exports["rename"] = rename;
    exports["segment"] = segment;
    exports["middle"] = middle;
    exports["Vector"] = Vector;
    exports["vector"] = vector;
    exports["scale"] = scale;
    exports["normalized"] = normalized;
    exports["normalTo"] = normalTo;
    exports["rotated"] = rotated;
    exports["cosAngle"] = cosAngle;
    exports["halfline"] = halfline;
    exports["line"] = line;
    exports["aPointOnLine"] = aPointOnLine;
    exports["aVectorOfLine"] = aVectorOfLine;
    exports["circle"] = circle;
    exports["arc"] = arc;
    exports["rightangle"] = rightangle;
    exports["basedPoint"] = basedPoint;
    exports["basedVector"] = basedVector;
    exports["measurableVector"] = measurableVector;
    exports["summableVectorVector"] = summableVectorVector;
    exports["summublePointVector"] = summublePointVector;
    exports["interLineLine"] = interLineLine;
    exports["interLineCircle"] = interLineCircle;
  })(PS);
  (function(exports) {
    "use strict";
  
    exports.fromNumberImpl = function (just) {
      return function (nothing) {
        return function (n) {
          /* jshint bitwise: false */
          return (n | 0) === n ? just(n) : nothing;
        };
      };
    };
  
    exports.toNumber = function (n) {
      return n;
    };
  })(PS["Data.Int"] = PS["Data.Int"] || {});
  (function(exports) {
    "use strict";
  
    exports.topInt = 2147483647;
    exports.bottomInt = -2147483648;
  
    exports.topChar = String.fromCharCode(65535);
    exports.bottomChar = String.fromCharCode(0);
  })(PS["Data.Bounded"] = PS["Data.Bounded"] || {});
  (function($PS) {
    // Generated by purs version 0.13.8
    "use strict";
    $PS["Data.Bounded"] = $PS["Data.Bounded"] || {};
    var exports = $PS["Data.Bounded"];
    var $foreign = $PS["Data.Bounded"];
    var Data_Ord = $PS["Data.Ord"];                  
    var Bounded = function (Ord0, bottom, top) {
        this.Ord0 = Ord0;
        this.bottom = bottom;
        this.top = top;
    };
    var top = function (dict) {
        return dict.top;
    };                                            
    var boundedInt = new Bounded(function () {
        return Data_Ord.ordInt;
    }, $foreign.bottomInt, $foreign.topInt);
    var boundedChar = new Bounded(function () {
        return Data_Ord.ordChar;
    }, $foreign.bottomChar, $foreign.topChar);
    var bottom = function (dict) {
        return dict.bottom;
    };
    exports["Bounded"] = Bounded;
    exports["bottom"] = bottom;
    exports["top"] = top;
    exports["boundedInt"] = boundedInt;
    exports["boundedChar"] = boundedChar;
  })(PS);
  (function(exports) {
    /* globals exports */
    "use strict";     
  
    exports.isNaN = isNaN;
  
    exports.infinity = Infinity;
  
    exports.readFloat = parseFloat;
  })(PS["Global"] = PS["Global"] || {});
  (function($PS) {
    // Generated by purs version 0.13.8
    "use strict";
    $PS["Global"] = $PS["Global"] || {};
    var exports = $PS["Global"];
    var $foreign = $PS["Global"];
    exports["isNaN"] = $foreign["isNaN"];
    exports["infinity"] = $foreign.infinity;
    exports["readFloat"] = $foreign.readFloat;
  })(PS);
  (function($PS) {
    // Generated by purs version 0.13.8
    "use strict";
    $PS["Data.Int"] = $PS["Data.Int"] || {};
    var exports = $PS["Data.Int"];
    var $foreign = $PS["Data.Int"];
    var Data_Boolean = $PS["Data.Boolean"];
    var Data_Bounded = $PS["Data.Bounded"];
    var Data_Maybe = $PS["Data.Maybe"];
    var Global = $PS["Global"];
    var $$Math = $PS["Math"];         
    var fromNumber = $foreign.fromNumberImpl(Data_Maybe.Just.create)(Data_Maybe.Nothing.value);
    var unsafeClamp = function (x) {
        if (x === Global.infinity) {
            return 0;
        };
        if (x === -Global.infinity) {
            return 0;
        };
        if (x >= $foreign.toNumber(Data_Bounded.top(Data_Bounded.boundedInt))) {
            return Data_Bounded.top(Data_Bounded.boundedInt);
        };
        if (x <= $foreign.toNumber(Data_Bounded.bottom(Data_Bounded.boundedInt))) {
            return Data_Bounded.bottom(Data_Bounded.boundedInt);
        };
        if (Data_Boolean.otherwise) {
            return Data_Maybe.fromMaybe(0)(fromNumber(x));
        };
        throw new Error("Failed pattern match at Data.Int (line 66, column 1 - line 66, column 29): " + [ x.constructor.name ]);
    };
    var round = function ($23) {
        return unsafeClamp($$Math.round($23));
    };
    exports["round"] = round;
  })(PS);
  (function(exports) {
    exports.inline = function (content){
      return function (){
        return katex.renderToString(content);
      };
    };
  })(PS["KaTeX"] = PS["KaTeX"] || {});
  (function($PS) {
    // Generated by purs version 0.13.8
    "use strict";
    $PS["KaTeX"] = $PS["KaTeX"] || {};
    var exports = $PS["KaTeX"];
    var $foreign = $PS["KaTeX"];
    exports["inline"] = $foreign.inline;
  })(PS);
  (function($PS) {
    // Generated by purs version 0.13.8
    "use strict";
    $PS["Article"] = $PS["Article"] || {};
    var exports = $PS["Article"];
    var Concur_Core_LiftWidget = $PS["Concur.Core.LiftWidget"];
    var Concur_Core_Types = $PS["Concur.Core.Types"];
    var Concur_VDom_DOM = $PS["Concur.VDom.DOM"];
    var Concur_VDom_Props = $PS["Concur.VDom.Props"];
    var Concur_VDom_SVG = $PS["Concur.VDom.SVG"];
    var Control_Bind = $PS["Control.Bind"];
    var Control_Monad_State = $PS["Control.Monad.State"];
    var Control_Monad_State_Class = $PS["Control.Monad.State.Class"];
    var Control_Monad_State_Trans = $PS["Control.Monad.State.Trans"];
    var Data_Array = $PS["Data.Array"];
    var Data_Eq = $PS["Data.Eq"];
    var Data_Foldable = $PS["Data.Foldable"];
    var Data_Function = $PS["Data.Function"];
    var Data_Functor = $PS["Data.Functor"];
    var Data_Geometry_Plane = $PS["Data.Geometry.Plane"];
    var Data_Identity = $PS["Data.Identity"];
    var Data_Int = $PS["Data.Int"];
    var Data_Maybe = $PS["Data.Maybe"];
    var Data_Monoid = $PS["Data.Monoid"];
    var Data_Show = $PS["Data.Show"];
    var Data_Tuple = $PS["Data.Tuple"];
    var Effect_Class = $PS["Effect.Class"];
    var Global = $PS["Global"];
    var KaTeX = $PS["KaTeX"];
    var $$Math = $PS["Math"];                
    var validateInput = function (v) {
        if (v instanceof Data_Maybe.Just) {
            var r = Global.readFloat(v.value0);
            var $8 = Global["isNaN"](r);
            if ($8) {
                return Data_Maybe.Nothing.value;
            };
            return Data_Maybe.Just.create(Data_Int.round(r));
        };
        return Data_Maybe.Nothing.value;
    };
    var put = function (dictFunctor) {
        return function (dictMonadState) {
            return function (x) {
                return Data_Functor["void"](dictFunctor)(Control_Monad_State_Class.modify(dictMonadState)(Data_Function.flip(Data_Array.snoc)(x)));
            };
        };
    };
    var setTitle = function (str) {
        return put(Control_Monad_State_Trans.functorStateT(Data_Identity.functorIdentity))(Control_Monad_State_Trans.monadStateStateT(Data_Identity.monadIdentity))(Concur_VDom_DOM.h1(Concur_Core_Types.widgetMultiAlternative(Data_Monoid.monoidArray))(Concur_Core_Types.widgetShiftMap)([  ])([ Concur_VDom_DOM.text(Concur_Core_LiftWidget.widgetLiftWidget)(str) ]));
    };
    var t = function (str) {
        return put(Control_Monad_State_Trans.functorStateT(Data_Identity.functorIdentity))(Control_Monad_State_Trans.monadStateStateT(Data_Identity.monadIdentity))(Concur_VDom_DOM["label'"](Concur_Core_Types.widgetMultiAlternative(Data_Monoid.monoidArray))(Concur_Core_Types.widgetShiftMap)([ Concur_VDom_DOM.text(Concur_Core_LiftWidget.widgetLiftWidget)(str) ]));
    };
    var nl = put(Control_Monad_State_Trans.functorStateT(Data_Identity.functorIdentity))(Control_Monad_State_Trans.monadStateStateT(Data_Identity.monadIdentity))(Concur_VDom_DOM.br(Concur_Core_Types.widgetMultiAlternative(Data_Monoid.monoidArray))(Concur_Core_Types.widgetShiftMap)([  ])([  ]));
    var measure = function (p) {
        return function (q) {
            return function (howFar) {
                var v = Data_Geometry_Plane.vector(p)(q);
                var n = Data_Geometry_Plane.normalTo(v);
                var mid = Data_Geometry_Plane.plus(Data_Geometry_Plane.summublePointVector)(Data_Geometry_Plane.middle("")(Data_Geometry_Plane.segment(p)(q)(Data_Maybe.Nothing.value)))(Data_Geometry_Plane.scale(howFar)(Data_Geometry_Plane.normalized(n)));
                var x = Data_Int.round(Data_Geometry_Plane.abs(Data_Geometry_Plane.basedPoint)(mid));
                var y = Data_Int.round(Data_Geometry_Plane.ord(Data_Geometry_Plane.basedPoint)(mid));
                var pos = Data_Show.show(Data_Show.showInt)(x) + ("," + Data_Show.show(Data_Show.showInt)(y));
                var grow = (Data_Geometry_Plane.ord(Data_Geometry_Plane.basedPoint)(q) - Data_Geometry_Plane.ord(Data_Geometry_Plane.basedPoint)(p)) * (Data_Geometry_Plane.abs(Data_Geometry_Plane.basedPoint)(q) - Data_Geometry_Plane.abs(Data_Geometry_Plane.basedPoint)(p)) > 0.0;
                var a = Data_Int.round((function (v1) {
                    return v1 / $$Math.pi;
                })((function (v1) {
                    return v1 * 180.0;
                })($$Math.acos(Data_Geometry_Plane.cosAngle(v)(Data_Geometry_Plane.vector(Data_Geometry_Plane.point("")(0.0)(0.0))(Data_Geometry_Plane.point("")(1.0)(0.0)))))));
                return [ Concur_VDom_SVG.attr("x")(Data_Show.show(Data_Show.showInt)(x)), Concur_VDom_SVG.attr("y")(Data_Show.show(Data_Show.showInt)(y)), Concur_VDom_SVG.transform("rotate(" + (Data_Show.show(Data_Show.showInt)((function () {
                    if (grow) {
                        return a;
                    };
                    return -a | 0;
                })()) + ("," + (pos + ") ")))) ];
            };
        };
    };
    var mImpl = function (str) {
        return Control_Bind.bind(Concur_Core_Types.widgetBind)(Effect_Class.liftEffect(Concur_Core_Types.widgetMonadEff(Data_Monoid.monoidArray))(KaTeX.inline(str)))(function (ktx) {
            return Concur_VDom_DOM.label(Concur_Core_Types.widgetMultiAlternative(Data_Monoid.monoidArray))(Concur_Core_Types.widgetShiftMap)([ Concur_VDom_Props.dangerouslySetInnerHTML(ktx) ])([  ]);
        });
    };
    var m = function (str) {
        return put(Control_Monad_State_Trans.functorStateT(Data_Identity.functorIdentity))(Control_Monad_State_Trans.monadStateStateT(Data_Identity.monadIdentity))(mImpl(str));
    };
    var invPerm = function (ps) {
        return Data_Foldable.foldr(Data_Foldable.foldableArray)(function (i) {
            return function (acc) {
                return Data_Array.cons(Data_Maybe.fromJust()(Data_Array.elemIndex(Data_Eq.eqInt)(i)(ps)))(acc);
            };
        })([  ])(Data_Array.range(0)(Data_Array.length(ps) - 1 | 0));
    };
    var get = function (dictMonadState) {
        return Control_Monad_State_Class.get(dictMonadState);
    };
    var fromIncremental = function (seq) {
        return Data_Tuple.fst(Control_Monad_State.runState(seq)([  ]));
    };
    var b = function (str) {
        return put(Control_Monad_State_Trans.functorStateT(Data_Identity.functorIdentity))(Control_Monad_State_Trans.monadStateStateT(Data_Identity.monadIdentity))(Concur_VDom_DOM.b(Concur_Core_Types.widgetMultiAlternative(Data_Monoid.monoidArray))(Concur_Core_Types.widgetShiftMap)([  ])([ Concur_VDom_DOM.text(Concur_Core_LiftWidget.widgetLiftWidget)(str) ]));
    };
    exports["measure"] = measure;
    exports["invPerm"] = invPerm;
    exports["validateInput"] = validateInput;
    exports["get"] = get;
    exports["put"] = put;
    exports["fromIncremental"] = fromIncremental;
    exports["m"] = m;
    exports["t"] = t;
    exports["nl"] = nl;
    exports["b"] = b;
    exports["setTitle"] = setTitle;
  })(PS);
  (function($PS) {
    // Generated by purs version 0.13.8
    "use strict";
    $PS["Concur.Core.Discharge"] = $PS["Concur.Core.Discharge"] || {};
    var exports = $PS["Concur.Core.Discharge"];
    var Concur_Core_Types = $PS["Concur.Core.Types"];
    var Control_Applicative = $PS["Control.Applicative"];
    var Control_Monad_Free = $PS["Control.Monad.Free"];
    var Data_Either = $PS["Data.Either"];
    var Data_Functor = $PS["Data.Functor"];
    var Data_Monoid = $PS["Data.Monoid"];
    var Data_Tuple = $PS["Data.Tuple"];
    var Effect = $PS["Effect"];
    var Effect_Aff = $PS["Effect.Aff"];                
    var dischargePartialEffect = function (dictMonoid) {
        return function (w) {
            var v = Control_Monad_Free.resume(Concur_Core_Types.functorWidgetStep)(Concur_Core_Types.unWidget(w));
            if (v instanceof Data_Either.Right) {
                return Control_Applicative.pure(Effect.applicativeEffect)(new Data_Tuple.Tuple(w, Data_Monoid.mempty(dictMonoid)));
            };
            if (v instanceof Data_Either.Left) {
                if (v.value0 instanceof Data_Either.Left) {
                    return function __do() {
                        var w$prime = v.value0.value0();
                        return dischargePartialEffect(dictMonoid)(w$prime)();
                    };
                };
                if (v.value0 instanceof Data_Either.Right) {
                    return Control_Applicative.pure(Effect.applicativeEffect)(new Data_Tuple.Tuple(Control_Monad_Free.wrap(new Data_Either.Right(v.value0.value0)), v.value0.value0.view));
                };
                throw new Error("Failed pattern match at Concur.Core.Discharge (line 43, column 27 - line 47, column 77): " + [ v.value0.constructor.name ]);
            };
            throw new Error("Failed pattern match at Concur.Core.Discharge (line 41, column 28 - line 47, column 77): " + [ v.constructor.name ]);
        };
    };
    var discharge = function (dictMonoid) {
        return function (handler) {
            return function (v) {
                var v1 = Control_Monad_Free.resume(Concur_Core_Types.functorWidgetStep)(v);
                if (v1 instanceof Data_Either.Right) {
                    return Control_Applicative.pure(Effect.applicativeEffect)(Data_Monoid.mempty(dictMonoid));
                };
                if (v1 instanceof Data_Either.Left) {
                    if (v1.value0 instanceof Data_Either.Left) {
                        return function __do() {
                            var w$prime = v1.value0.value0();
                            return discharge(dictMonoid)(handler)(w$prime)();
                        };
                    };
                    if (v1.value0 instanceof Data_Either.Right) {
                        return function __do() {
                            Effect_Aff.runAff_((function () {
                                var $19 = Data_Functor.map(Data_Either.functorEither)(Concur_Core_Types.Widget);
                                return function ($20) {
                                    return handler($19($20));
                                };
                            })())(v1.value0.value0.cont)();
                            return v1.value0.value0.view;
                        };
                    };
                    throw new Error("Failed pattern match at Concur.Core.Discharge (line 26, column 28 - line 32, column 19): " + [ v1.value0.constructor.name ]);
                };
                throw new Error("Failed pattern match at Concur.Core.Discharge (line 24, column 32 - line 32, column 19): " + [ v1.constructor.name ]);
            };
        };
    };
    exports["discharge"] = discharge;
    exports["dischargePartialEffect"] = dischargePartialEffect;
  })(PS);
  (function($PS) {
    // Generated by purs version 0.13.8
    "use strict";
    $PS["Control.Cofree"] = $PS["Control.Cofree"] || {};
    var exports = $PS["Control.Cofree"];
    var Control_Alt = $PS["Control.Alt"];
    var Control_Applicative = $PS["Control.Applicative"];
    var Control_Apply = $PS["Control.Apply"];
    var Control_Bind = $PS["Control.Bind"];
    var Control_Monad = $PS["Control.Monad"];
    var Control_Plus = $PS["Control.Plus"];
    var Data_Functor = $PS["Data.Functor"];
    var Data_Lazy = $PS["Data.Lazy"];
    var Data_Tuple = $PS["Data.Tuple"];
    var tail = function (v) {
        return Data_Tuple.snd(Data_Lazy.force(v));
    };
    var mkCofree = function (a) {
        return function (t) {
            return Data_Lazy.defer(function (v) {
                return new Data_Tuple.Tuple(a, t);
            });
        };
    };
    var head = function (v) {
        return Data_Tuple.fst(Data_Lazy.force(v));
    };
    var functorCofree = function (dictFunctor) {
        return new Data_Functor.Functor(function (f) {
            var loop = function (v) {
                return Data_Functor.map(Data_Lazy.functorLazy)(function (v1) {
                    return new Data_Tuple.Tuple(f(v1.value0), Data_Functor.map(dictFunctor)(loop)(v1.value1));
                })(v);
            };
            return loop;
        });
    };
    var monadCofree = function (dictAlternative) {
        return new Control_Monad.Monad(function () {
            return applicativeCofree(dictAlternative);
        }, function () {
            return bindCofree(dictAlternative);
        });
    };
    var bindCofree = function (dictAlternative) {
        return new Control_Bind.Bind(function () {
            return applyCofree(dictAlternative);
        }, function (sa$prime) {
            return function (f) {
                var go$prime = function (sa) {
                    return function (sb) {
                        var msplit = Data_Functor.map(((dictAlternative.Plus1()).Alt0()).Functor0())(go$prime(sa))(tail(sb));
                        var mrestart = Data_Functor.map(((dictAlternative.Plus1()).Alt0()).Functor0())(go)(tail(sa));
                        return mkCofree(head(sb))(Control_Alt.alt((dictAlternative.Plus1()).Alt0())(mrestart)(msplit));
                    };
                };
                var go = function (sa) {
                    return go$prime(sa)(f(head(sa)));
                };
                return go(sa$prime);
            };
        });
    };
    var applyCofree = function (dictAlternative) {
        return new Control_Apply.Apply(function () {
            return functorCofree(((dictAlternative.Plus1()).Alt0()).Functor0());
        }, Control_Monad.ap(monadCofree(dictAlternative)));
    };
    var applicativeCofree = function (dictAlternative) {
        return new Control_Applicative.Applicative(function () {
            return applyCofree(dictAlternative);
        }, function (a) {
            return mkCofree(a)(Control_Plus.empty(dictAlternative.Plus1()));
        });
    };
    exports["mkCofree"] = mkCofree;
    exports["tail"] = tail;
    exports["bindCofree"] = bindCofree;
  })(PS);
  (function($PS) {
    // Generated by purs version 0.13.8
    "use strict";
    $PS["Concur.Core.FRP"] = $PS["Concur.Core.FRP"] || {};
    var exports = $PS["Concur.Core.FRP"];
    var Control_Alt = $PS["Control.Alt"];
    var Control_Applicative = $PS["Control.Applicative"];
    var Control_Bind = $PS["Control.Bind"];
    var Control_Cofree = $PS["Control.Cofree"];
    var Data_Functor = $PS["Data.Functor"];
    var Data_Maybe = $PS["Data.Maybe"];
    var Data_Unit = $PS["Data.Unit"];
    var Effect_Aff = $PS["Effect.Aff"];
    var Effect_Aff_Class = $PS["Effect.Aff.Class"];        
    var update = Control_Cofree.tail;
    var step = Control_Cofree.mkCofree;
    var dyn = function (dictMonad) {
        return function (s) {
            return Control_Bind.bind(dictMonad.Bind1())(update(s))(dyn(dictMonad));
        };
    };
    var display = function (w) {
        return step(Data_Unit.unit)(w);
    };
    var debounce = function (dictMonad) {
        return function (dictAlt) {
            return function (dictMonadAff) {
                return function (timeoutMs) {
                    return function (ainit) {
                        return function (winit) {
                            var go$prime = function (a) {
                                return function (w) {
                                    return Control_Bind.bind(dictMonad.Bind1())(Control_Alt.alt(dictAlt)(Data_Functor.map(dictAlt.Functor0())(Data_Maybe.Just.create)(w(a)))(Data_Functor.voidRight(dictAlt.Functor0())(Data_Maybe.Nothing.value)(Effect_Aff_Class.liftAff(dictMonadAff)(Effect_Aff.delay(timeoutMs)))))(function (res) {
                                        if (res instanceof Data_Maybe.Nothing) {
                                            return Control_Applicative.pure(dictMonad.Applicative0())(go(a)(w));
                                        };
                                        if (res instanceof Data_Maybe.Just) {
                                            return go$prime(res.value0)(w);
                                        };
                                        throw new Error("Failed pattern match at Concur.Core.FRP (line 214, column 7 - line 218, column 28): " + [ res.constructor.name ]);
                                    });
                                };
                            };
                            var go = function (a) {
                                return function (w) {
                                    return step(a)(Control_Bind.bind(dictMonad.Bind1())(w(a))(function (a$prime) {
                                        return go$prime(a$prime)(w);
                                    }));
                                };
                            };
                            return go(ainit)(winit);
                        };
                    };
                };
            };
        };
    };
    exports["display"] = display;
    exports["dyn"] = dyn;
    exports["debounce"] = debounce;
  })(PS);
  (function($PS) {
    // Generated by purs version 0.13.8
    "use strict";
    $PS["Halogen.VDom.DOM"] = $PS["Halogen.VDom.DOM"] || {};
    var exports = $PS["Halogen.VDom.DOM"];
    var Data_Array = $PS["Data.Array"];
    var Data_Boolean = $PS["Data.Boolean"];
    var Data_Maybe = $PS["Data.Maybe"];
    var Data_Nullable = $PS["Data.Nullable"];
    var Data_Tuple = $PS["Data.Tuple"];
    var Halogen_VDom_Machine = $PS["Halogen.VDom.Machine"];
    var Halogen_VDom_Types = $PS["Halogen.VDom.Types"];
    var Halogen_VDom_Util = $PS["Halogen.VDom.Util"];
    var Web_DOM_Element = $PS["Web.DOM.Element"];
    var haltWidget = function (v) {
        return Halogen_VDom_Machine.halt(v.widget);
    };
    var patchWidget = function (state, vdom) {
        if (vdom instanceof Halogen_VDom_Types.Grafted) {
            return patchWidget(state, Halogen_VDom_Types.runGraft(vdom.value0));
        };
        if (vdom instanceof Halogen_VDom_Types.Widget) {
            var res = Halogen_VDom_Machine.step(state.widget, vdom.value0);
            var res$prime = Halogen_VDom_Machine.unStep(function (v) {
                return Halogen_VDom_Machine.mkStep(new Halogen_VDom_Machine.Step(v.value0, {
                    build: state.build,
                    widget: res
                }, patchWidget, haltWidget));
            })(res);
            return res$prime;
        };
        haltWidget(state);
        return state.build(vdom);
    };
    var haltText = function (v) {
        var parent = Halogen_VDom_Util.parentNode(v.node);
        return Halogen_VDom_Util.removeChild(v.node, parent);
    };
    var patchText = function (state, vdom) {
        if (vdom instanceof Halogen_VDom_Types.Grafted) {
            return patchText(state, Halogen_VDom_Types.runGraft(vdom.value0));
        };
        if (vdom instanceof Halogen_VDom_Types.Text) {
            if (state.value === vdom.value0) {
                return Halogen_VDom_Machine.mkStep(new Halogen_VDom_Machine.Step(state.node, state, patchText, haltText));
            };
            if (Data_Boolean.otherwise) {
                var nextState = {
                    build: state.build,
                    node: state.node,
                    value: vdom.value0
                };
                Halogen_VDom_Util.setTextContent(vdom.value0, state.node);
                return Halogen_VDom_Machine.mkStep(new Halogen_VDom_Machine.Step(state.node, nextState, patchText, haltText));
            };
        };
        haltText(state);
        return state.build(vdom);
    };
    var haltKeyed = function (v) {
        var parent = Halogen_VDom_Util.parentNode(v.node);
        Halogen_VDom_Util.removeChild(v.node, parent);
        Halogen_VDom_Util.forInE(v.children, function (v1, s) {
            return Halogen_VDom_Machine.halt(s);
        });
        return Halogen_VDom_Machine.halt(v.attrs);
    };
    var haltElem = function (v) {
        var parent = Halogen_VDom_Util.parentNode(v.node);
        Halogen_VDom_Util.removeChild(v.node, parent);
        Halogen_VDom_Util.forEachE(v.children, Halogen_VDom_Machine.halt);
        return Halogen_VDom_Machine.halt(v.attrs);
    };
    var eqElemSpec = function (ns1, v, ns2, v1) {
        var $56 = v === v1;
        if ($56) {
            if (ns1 instanceof Data_Maybe.Just && (ns2 instanceof Data_Maybe.Just && ns1.value0 === ns2.value0)) {
                return true;
            };
            if (ns1 instanceof Data_Maybe.Nothing && ns2 instanceof Data_Maybe.Nothing) {
                return true;
            };
            return false;
        };
        return false;
    };
    var patchElem = function (state, vdom) {
        if (vdom instanceof Halogen_VDom_Types.Grafted) {
            return patchElem(state, Halogen_VDom_Types.runGraft(vdom.value0));
        };
        if (vdom instanceof Halogen_VDom_Types.Elem && eqElemSpec(state.ns, state.name, vdom.value0, vdom.value1)) {
            var v = Data_Array.length(vdom.value3);
            var v1 = Data_Array.length(state.children);
            if (v1 === 0 && v === 0) {
                var attrs2 = Halogen_VDom_Machine.step(state.attrs, vdom.value2);
                var nextState = {
                    build: state.build,
                    node: state.node,
                    attrs: attrs2,
                    ns: vdom.value0,
                    name: vdom.value1,
                    children: state.children
                };
                return Halogen_VDom_Machine.mkStep(new Halogen_VDom_Machine.Step(state.node, nextState, patchElem, haltElem));
            };
            var onThis = function (ix, s) {
                return Halogen_VDom_Machine.halt(s);
            };
            var onThese = function (ix, s, v2) {
                var res = Halogen_VDom_Machine.step(s, v2);
                Halogen_VDom_Util.insertChildIx(ix, Halogen_VDom_Machine.extract(res), state.node);
                return res;
            };
            var onThat = function (ix, v2) {
                var res = state.build(v2);
                Halogen_VDom_Util.insertChildIx(ix, Halogen_VDom_Machine.extract(res), state.node);
                return res;
            };
            var children2 = Halogen_VDom_Util.diffWithIxE(state.children, vdom.value3, onThese, onThis, onThat);
            var attrs2 = Halogen_VDom_Machine.step(state.attrs, vdom.value2);
            var nextState = {
                build: state.build,
                node: state.node,
                attrs: attrs2,
                ns: vdom.value0,
                name: vdom.value1,
                children: children2
            };
            return Halogen_VDom_Machine.mkStep(new Halogen_VDom_Machine.Step(state.node, nextState, patchElem, haltElem));
        };
        haltElem(state);
        return state.build(vdom);
    };
    var patchKeyed = function (state, vdom) {
        if (vdom instanceof Halogen_VDom_Types.Grafted) {
            return patchKeyed(state, Halogen_VDom_Types.runGraft(vdom.value0));
        };
        if (vdom instanceof Halogen_VDom_Types.Keyed && eqElemSpec(state.ns, state.name, vdom.value0, vdom.value1)) {
            var v = Data_Array.length(vdom.value3);
            if (state.length === 0 && v === 0) {
                var attrs2 = Halogen_VDom_Machine.step(state.attrs, vdom.value2);
                var nextState = {
                    build: state.build,
                    node: state.node,
                    attrs: attrs2,
                    ns: vdom.value0,
                    name: vdom.value1,
                    children: state.children,
                    length: 0
                };
                return Halogen_VDom_Machine.mkStep(new Halogen_VDom_Machine.Step(state.node, nextState, patchKeyed, haltKeyed));
            };
            var onThis = function (v2, s) {
                return Halogen_VDom_Machine.halt(s);
            };
            var onThese = function (v2, ix$prime, s, v3) {
                var res = Halogen_VDom_Machine.step(s, v3.value1);
                Halogen_VDom_Util.insertChildIx(ix$prime, Halogen_VDom_Machine.extract(res), state.node);
                return res;
            };
            var onThat = function (v2, ix, v3) {
                var res = state.build(v3.value1);
                Halogen_VDom_Util.insertChildIx(ix, Halogen_VDom_Machine.extract(res), state.node);
                return res;
            };
            var children2 = Halogen_VDom_Util.diffWithKeyAndIxE(state.children, vdom.value3, Data_Tuple.fst, onThese, onThis, onThat);
            var attrs2 = Halogen_VDom_Machine.step(state.attrs, vdom.value2);
            var nextState = {
                build: state.build,
                node: state.node,
                attrs: attrs2,
                ns: vdom.value0,
                name: vdom.value1,
                children: children2,
                length: v
            };
            return Halogen_VDom_Machine.mkStep(new Halogen_VDom_Machine.Step(state.node, nextState, patchKeyed, haltKeyed));
        };
        haltKeyed(state);
        return state.build(vdom);
    };
    var buildWidget = function (v, build, w) {
        var res = v.buildWidget(v)(w);
        var res$prime = Halogen_VDom_Machine.unStep(function (v1) {
            return Halogen_VDom_Machine.mkStep(new Halogen_VDom_Machine.Step(v1.value0, {
                build: build,
                widget: res
            }, patchWidget, haltWidget));
        })(res);
        return res$prime;
    };
    var buildText = function (v, build, s) {
        var node = Halogen_VDom_Util.createTextNode(s, v.document);
        var state = {
            build: build,
            node: node,
            value: s
        };
        return Halogen_VDom_Machine.mkStep(new Halogen_VDom_Machine.Step(node, state, patchText, haltText));
    };
    var buildKeyed = function (v, build, ns1, name1, as1, ch1) {
        var el = Halogen_VDom_Util.createElement(Data_Nullable.toNullable(ns1), name1, v.document);
        var node = Web_DOM_Element.toNode(el);
        var onChild = function (k, ix, v1) {
            var res = build(v1.value1);
            Halogen_VDom_Util.insertChildIx(ix, Halogen_VDom_Machine.extract(res), node);
            return res;
        };
        var children = Halogen_VDom_Util.strMapWithIxE(ch1, Data_Tuple.fst, onChild);
        var attrs = v.buildAttributes(el)(as1);
        var state = {
            build: build,
            node: node,
            attrs: attrs,
            ns: ns1,
            name: name1,
            children: children,
            length: Data_Array.length(ch1)
        };
        return Halogen_VDom_Machine.mkStep(new Halogen_VDom_Machine.Step(node, state, patchKeyed, haltKeyed));
    };
    var buildElem = function (v, build, ns1, name1, as1, ch1) {
        var el = Halogen_VDom_Util.createElement(Data_Nullable.toNullable(ns1), name1, v.document);
        var node = Web_DOM_Element.toNode(el);
        var onChild = function (ix, child) {
            var res = build(child);
            Halogen_VDom_Util.insertChildIx(ix, Halogen_VDom_Machine.extract(res), node);
            return res;
        };
        var children = Halogen_VDom_Util.forE(ch1, onChild);
        var attrs = v.buildAttributes(el)(as1);
        var state = {
            build: build,
            node: node,
            attrs: attrs,
            ns: ns1,
            name: name1,
            children: children
        };
        return Halogen_VDom_Machine.mkStep(new Halogen_VDom_Machine.Step(node, state, patchElem, haltElem));
    };
    var buildVDom = function (spec) {
        var build = function (v) {
            if (v instanceof Halogen_VDom_Types.Text) {
                return buildText(spec, build, v.value0);
            };
            if (v instanceof Halogen_VDom_Types.Elem) {
                return buildElem(spec, build, v.value0, v.value1, v.value2, v.value3);
            };
            if (v instanceof Halogen_VDom_Types.Keyed) {
                return buildKeyed(spec, build, v.value0, v.value1, v.value2, v.value3);
            };
            if (v instanceof Halogen_VDom_Types.Widget) {
                return buildWidget(spec, build, v.value0);
            };
            if (v instanceof Halogen_VDom_Types.Grafted) {
                return build(Halogen_VDom_Types.runGraft(v.value0));
            };
            throw new Error("Failed pattern match at Halogen.VDom.DOM (line 58, column 27 - line 63, column 52): " + [ v.constructor.name ]);
        };
        return build;
    };
    exports["buildVDom"] = buildVDom;
  })(PS);
  (function($PS) {
    // Generated by purs version 0.13.8
    "use strict";
    $PS["Concur.Thunk.Internal"] = $PS["Concur.Thunk.Internal"] || {};
    var exports = $PS["Concur.Thunk.Internal"];
    var Halogen_VDom_DOM = $PS["Halogen.VDom.DOM"];
    var Halogen_VDom_Machine = $PS["Halogen.VDom.Machine"];
    var Halogen_VDom_Util = $PS["Halogen.VDom.Util"];        
    var Thunk = (function () {
        function Thunk(value0, value1, value2, value3) {
            this.value0 = value0;
            this.value1 = value1;
            this.value2 = value2;
            this.value3 = value3;
        };
        Thunk.create = function (value0) {
            return function (value1) {
                return function (value2) {
                    return function (value3) {
                        return new Thunk(value0, value1, value2, value3);
                    };
                };
            };
        };
        return Thunk;
    })();                                          
    var unsafeEqThunk = function (v, v1) {
        return Halogen_VDom_Util.refEq(v.value0, v1.value0) && (Halogen_VDom_Util.refEq(v.value1, v1.value1) && v.value1(v.value3, v1.value3));
    };
    var thunk = function (tid, eqFn, f, a) {
        return new Thunk(tid, eqFn, f, a);
    };
    var runThunk = function (v) {
        return v.value2(v.value3);
    }; 
    var buildThunk = function (toVDom) {
        var haltThunk = function (state) {
            return Halogen_VDom_Machine.halt(state.vdom);
        };
        var patchThunk = function (state, t2) {
            var $35 = unsafeEqThunk(state.thunk, t2);
            if ($35) {
                return Halogen_VDom_Machine.mkStep(new Halogen_VDom_Machine.Step(Halogen_VDom_Machine.extract(state.vdom), state, patchThunk, haltThunk));
            };
            var vdom = Halogen_VDom_Machine.step(state.vdom, toVDom(runThunk(t2)));
            return Halogen_VDom_Machine.mkStep(new Halogen_VDom_Machine.Step(Halogen_VDom_Machine.extract(vdom), {
                vdom: vdom,
                thunk: t2
            }, patchThunk, haltThunk));
        };
        var renderThunk = function (spec) {
            return function (t) {
                var vdom = Halogen_VDom_DOM.buildVDom(spec)(toVDom(runThunk(t)));
                return Halogen_VDom_Machine.mkStep(new Halogen_VDom_Machine.Step(Halogen_VDom_Machine.extract(vdom), {
                    thunk: t,
                    vdom: vdom
                }, patchThunk, haltThunk));
            };
        };
        return renderThunk;
    };
    exports["buildThunk"] = buildThunk;
  })(PS);
  (function(exports) {
    "use strict";
  
    exports.toCharCode = function (c) {
      return c.charCodeAt(0);
    };
  
    exports.fromCharCode = function (c) {
      return String.fromCharCode(c);
    };
  })(PS["Data.Enum"] = PS["Data.Enum"] || {});
  (function($PS) {
    // Generated by purs version 0.13.8
    "use strict";
    $PS["Data.Enum"] = $PS["Data.Enum"] || {};
    var exports = $PS["Data.Enum"];
    var $foreign = $PS["Data.Enum"];
    var Data_Bounded = $PS["Data.Bounded"];
    var Data_Maybe = $PS["Data.Maybe"];
    var Data_Ord = $PS["Data.Ord"];
    var Enum = function (Ord0, pred, succ) {
        this.Ord0 = Ord0;
        this.pred = pred;
        this.succ = succ;
    };
    var BoundedEnum = function (Bounded0, Enum1, cardinality, fromEnum, toEnum) {
        this.Bounded0 = Bounded0;
        this.Enum1 = Enum1;
        this.cardinality = cardinality;
        this.fromEnum = fromEnum;
        this.toEnum = toEnum;
    };
    var toEnum = function (dict) {
        return dict.toEnum;
    };
    var succ = function (dict) {
        return dict.succ;
    };              
    var fromEnum = function (dict) {
        return dict.fromEnum;
    };
    var toEnumWithDefaults = function (dictBoundedEnum) {
        return function (low) {
            return function (high) {
                return function (x) {
                    var v = toEnum(dictBoundedEnum)(x);
                    if (v instanceof Data_Maybe.Just) {
                        return v.value0;
                    };
                    if (v instanceof Data_Maybe.Nothing) {
                        var $54 = x < fromEnum(dictBoundedEnum)(Data_Bounded.bottom(dictBoundedEnum.Bounded0()));
                        if ($54) {
                            return low;
                        };
                        return high;
                    };
                    throw new Error("Failed pattern match at Data.Enum (line 158, column 33 - line 160, column 62): " + [ v.constructor.name ]);
                };
            };
        };
    };
    var defaultSucc = function (toEnum$prime) {
        return function (fromEnum$prime) {
            return function (a) {
                return toEnum$prime(fromEnum$prime(a) + 1 | 0);
            };
        };
    };
    var defaultPred = function (toEnum$prime) {
        return function (fromEnum$prime) {
            return function (a) {
                return toEnum$prime(fromEnum$prime(a) - 1 | 0);
            };
        };
    };
    var charToEnum = function (v) {
        if (v >= Data_Bounded.bottom(Data_Bounded.boundedInt) && v <= Data_Bounded.top(Data_Bounded.boundedInt)) {
            return new Data_Maybe.Just($foreign.fromCharCode(v));
        };
        return Data_Maybe.Nothing.value;
    };
    var enumChar = new Enum(function () {
        return Data_Ord.ordChar;
    }, defaultPred(charToEnum)($foreign.toCharCode), defaultSucc(charToEnum)($foreign.toCharCode));
    var boundedEnumChar = new BoundedEnum(function () {
        return Data_Bounded.boundedChar;
    }, function () {
        return enumChar;
    }, $foreign.toCharCode(Data_Bounded.top(Data_Bounded.boundedChar)) - $foreign.toCharCode(Data_Bounded.bottom(Data_Bounded.boundedChar)) | 0, $foreign.toCharCode, charToEnum);
    exports["Enum"] = Enum;
    exports["succ"] = succ;
    exports["BoundedEnum"] = BoundedEnum;
    exports["toEnum"] = toEnum;
    exports["fromEnum"] = fromEnum;
    exports["toEnumWithDefaults"] = toEnumWithDefaults;
    exports["defaultSucc"] = defaultSucc;
    exports["defaultPred"] = defaultPred;
    exports["boundedEnumChar"] = boundedEnumChar;
  })(PS);
  (function(exports) {
    "use strict";                                             
    var hasFromCodePoint = typeof String.prototype.fromCodePoint === "function";
  
    exports._fromCodePointArray = function (singleton) {
      return hasFromCodePoint
        ? function (cps) {
          // Function.prototype.apply will fail for very large second parameters,
          // so we don't use it for arrays with 10,000 or more entries.
          if (cps.length < 10e3) {
            return String.fromCodePoint.apply(String, cps);
          }
          return cps.map(singleton).join("");
        }
        : function (cps) {
          return cps.map(singleton).join("");
        };
    };
  
    exports._singleton = function (fallback) {
      return hasFromCodePoint ? String.fromCodePoint : fallback;
    };
  })(PS["Data.String.CodePoints"] = PS["Data.String.CodePoints"] || {});
  (function(exports) {
    "use strict";
  
    exports.intDegree = function (x) {
      return Math.min(Math.abs(x), 2147483647);
    };
  
    // See the Euclidean definition in
    // https://en.m.wikipedia.org/wiki/Modulo_operation.
    exports.intDiv = function (x) {
      return function (y) {
        if (y === 0) return 0;
        return y > 0 ? Math.floor(x / y) : -Math.floor(x / -y);
      };
    };
  
    exports.intMod = function (x) {
      return function (y) {
        if (y === 0) return 0;
        var yy = Math.abs(y);
        return ((x % yy) + yy) % yy;
      };
    };
  })(PS["Data.EuclideanRing"] = PS["Data.EuclideanRing"] || {});
  (function($PS) {
    // Generated by purs version 0.13.8
    "use strict";
    $PS["Data.CommutativeRing"] = $PS["Data.CommutativeRing"] || {};
    var exports = $PS["Data.CommutativeRing"];
    var Data_Ring = $PS["Data.Ring"];
    var CommutativeRing = function (Ring0) {
        this.Ring0 = Ring0;
    }; 
    var commutativeRingInt = new CommutativeRing(function () {
        return Data_Ring.ringInt;
    });
    exports["CommutativeRing"] = CommutativeRing;
    exports["commutativeRingInt"] = commutativeRingInt;
  })(PS);
  (function($PS) {
    // Generated by purs version 0.13.8
    "use strict";
    $PS["Data.EuclideanRing"] = $PS["Data.EuclideanRing"] || {};
    var exports = $PS["Data.EuclideanRing"];
    var $foreign = $PS["Data.EuclideanRing"];
    var Data_CommutativeRing = $PS["Data.CommutativeRing"];
    var Data_Eq = $PS["Data.Eq"];
    var Data_Semiring = $PS["Data.Semiring"];                
    var EuclideanRing = function (CommutativeRing0, degree, div, mod) {
        this.CommutativeRing0 = CommutativeRing0;
        this.degree = degree;
        this.div = div;
        this.mod = mod;
    };
    var mod = function (dict) {
        return dict.mod;
    };
    var gcd = function ($copy_dictEq) {
        return function ($copy_dictEuclideanRing) {
            return function ($copy_a) {
                return function ($copy_b) {
                    var $tco_var_dictEq = $copy_dictEq;
                    var $tco_var_dictEuclideanRing = $copy_dictEuclideanRing;
                    var $tco_var_a = $copy_a;
                    var $tco_done = false;
                    var $tco_result;
                    function $tco_loop(dictEq, dictEuclideanRing, a, b) {
                        var $7 = Data_Eq.eq(dictEq)(b)(Data_Semiring.zero(((dictEuclideanRing.CommutativeRing0()).Ring0()).Semiring0()));
                        if ($7) {
                            $tco_done = true;
                            return a;
                        };
                        $tco_var_dictEq = dictEq;
                        $tco_var_dictEuclideanRing = dictEuclideanRing;
                        $tco_var_a = b;
                        $copy_b = mod(dictEuclideanRing)(a)(b);
                        return;
                    };
                    while (!$tco_done) {
                        $tco_result = $tco_loop($tco_var_dictEq, $tco_var_dictEuclideanRing, $tco_var_a, $copy_b);
                    };
                    return $tco_result;
                };
            };
        };
    }; 
    var euclideanRingInt = new EuclideanRing(function () {
        return Data_CommutativeRing.commutativeRingInt;
    }, $foreign.intDegree, $foreign.intDiv, $foreign.intMod);
    var div = function (dict) {
        return dict.div;
    };
    exports["EuclideanRing"] = EuclideanRing;
    exports["div"] = div;
    exports["mod"] = mod;
    exports["gcd"] = gcd;
    exports["euclideanRingInt"] = euclideanRingInt;
  })(PS);
  (function(exports) {
    "use strict";
  
    exports.singleton = function (c) {
      return c;
    };
  })(PS["Data.String.CodeUnits"] = PS["Data.String.CodeUnits"] || {});
  (function($PS) {
    // Generated by purs version 0.13.8
    "use strict";
    $PS["Data.String.CodeUnits"] = $PS["Data.String.CodeUnits"] || {};
    var exports = $PS["Data.String.CodeUnits"];
    var $foreign = $PS["Data.String.CodeUnits"];
    exports["singleton"] = $foreign.singleton;
  })(PS);
  (function($PS) {
    // Generated by purs version 0.13.8
    "use strict";
    $PS["Data.String.CodePoints"] = $PS["Data.String.CodePoints"] || {};
    var exports = $PS["Data.String.CodePoints"];
    var $foreign = $PS["Data.String.CodePoints"];
    var Data_Boolean = $PS["Data.Boolean"];
    var Data_Bounded = $PS["Data.Bounded"];
    var Data_Enum = $PS["Data.Enum"];
    var Data_Eq = $PS["Data.Eq"];
    var Data_EuclideanRing = $PS["Data.EuclideanRing"];
    var Data_Maybe = $PS["Data.Maybe"];
    var Data_Ord = $PS["Data.Ord"];
    var Data_String_CodeUnits = $PS["Data.String.CodeUnits"];    
    var CodePoint = function (x) {
        return x;
    };
    var fromCharCode = (function () {
        var $53 = Data_Enum.toEnumWithDefaults(Data_Enum.boundedEnumChar)(Data_Bounded.bottom(Data_Bounded.boundedChar))(Data_Bounded.top(Data_Bounded.boundedChar));
        return function ($54) {
            return Data_String_CodeUnits.singleton($53($54));
        };
    })();
    var singletonFallback = function (v) {
        if (v <= 65535) {
            return fromCharCode(v);
        };
        var lead = Data_EuclideanRing.div(Data_EuclideanRing.euclideanRingInt)(v - 65536 | 0)(1024) + 55296 | 0;
        var trail = Data_EuclideanRing.mod(Data_EuclideanRing.euclideanRingInt)(v - 65536 | 0)(1024) + 56320 | 0;
        return fromCharCode(lead) + fromCharCode(trail);
    };
    var fromCodePointArray = $foreign["_fromCodePointArray"](singletonFallback);
    var singleton = $foreign["_singleton"](singletonFallback);
    var eqCodePoint = new Data_Eq.Eq(function (x) {
        return function (y) {
            return x === y;
        };
    });
    var ordCodePoint = new Data_Ord.Ord(function () {
        return eqCodePoint;
    }, function (x) {
        return function (y) {
            return Data_Ord.compare(Data_Ord.ordInt)(x)(y);
        };
    });
    var codePointFromChar = (function () {
        var $55 = Data_Enum.fromEnum(Data_Enum.boundedEnumChar);
        return function ($56) {
            return CodePoint($55($56));
        };
    })();
    var boundedCodePoint = new Data_Bounded.Bounded(function () {
        return ordCodePoint;
    }, 0, 1114111);
    var boundedEnumCodePoint = new Data_Enum.BoundedEnum(function () {
        return boundedCodePoint;
    }, function () {
        return enumCodePoint;
    }, 1114111 + 1 | 0, function (v) {
        return v;
    }, function (n) {
        if (n >= 0 && n <= 1114111) {
            return new Data_Maybe.Just(n);
        };
        if (Data_Boolean.otherwise) {
            return Data_Maybe.Nothing.value;
        };
        throw new Error("Failed pattern match at Data.String.CodePoints (line 63, column 1 - line 68, column 26): " + [ n.constructor.name ]);
    });
    var enumCodePoint = new Data_Enum.Enum(function () {
        return ordCodePoint;
    }, Data_Enum.defaultPred(Data_Enum.toEnum(boundedEnumCodePoint))(Data_Enum.fromEnum(boundedEnumCodePoint)), Data_Enum.defaultSucc(Data_Enum.toEnum(boundedEnumCodePoint))(Data_Enum.fromEnum(boundedEnumCodePoint)));
    exports["codePointFromChar"] = codePointFromChar;
    exports["singleton"] = singleton;
    exports["fromCodePointArray"] = fromCodePointArray;
    exports["enumCodePoint"] = enumCodePoint;
    exports["boundedEnumCodePoint"] = boundedEnumCodePoint;
  })(PS);
  (function($PS) {
    // Generated by purs version 0.13.8
    "use strict";
    $PS["Concur.VDom.GeometryRender"] = $PS["Concur.VDom.GeometryRender"] || {};
    var exports = $PS["Concur.VDom.GeometryRender"];
    var Concur_Core_LiftWidget = $PS["Concur.Core.LiftWidget"];
    var Concur_Core_Types = $PS["Concur.Core.Types"];
    var Concur_VDom_DOM = $PS["Concur.VDom.DOM"];
    var Concur_VDom_SVG = $PS["Concur.VDom.SVG"];
    var Data_Array = $PS["Data.Array"];
    var Data_Enum = $PS["Data.Enum"];
    var Data_Functor = $PS["Data.Functor"];
    var Data_Geometry_Plane = $PS["Data.Geometry.Plane"];
    var Data_Int = $PS["Data.Int"];
    var Data_Maybe = $PS["Data.Maybe"];
    var Data_Monoid = $PS["Data.Monoid"];
    var Data_Semigroup = $PS["Data.Semigroup"];
    var Data_Show = $PS["Data.Show"];
    var Data_Sparse_Polynomial = $PS["Data.Sparse.Polynomial"];
    var Data_String_CodePoints = $PS["Data.String.CodePoints"];
    var $$Math = $PS["Math"];                
    var Render = function (render$prime) {
        this["render'"] = render$prime;
    };
    var text = function (x) {
        return function (y) {
            return function (color) {
                return function (fontStyle) {
                    return function (str) {
                        return Concur_VDom_SVG.text(Concur_Core_Types.widgetMultiAlternative(Data_Monoid.monoidArray))(Concur_Core_Types.widgetShiftMap)([ Concur_VDom_SVG.unsafeMkProp(Data_Show.showInt)("x")(Data_Int.round(x)), Concur_VDom_SVG.unsafeMkProp(Data_Show.showInt)("y")(Data_Int.round(y)), Concur_VDom_SVG.style("fill:" + (color + ("; font:" + (fontStyle + "; ")))) ])([ Concur_VDom_DOM.text(Concur_Core_LiftWidget.widgetLiftWidget)(str) ]);
                    };
                };
            };
        };
    };
    var render$prime = function (dict) {
        return dict["render'"];
    };
    var renderSequence = function (dictRender) {
        return new Render(function (ctx) {
            return function (arr) {
                return Data_Array.concat(Data_Functor.map(Data_Functor.functorArray)(render$prime(dictRender)(ctx))(arr));
            };
        });
    };
    var pathCoord = function (p) {
        return " " + (Data_Show.show(Data_Show.showNumber)(Data_Geometry_Plane.abs(Data_Geometry_Plane.basedPoint)(p)) + (" " + (Data_Show.show(Data_Show.showNumber)(Data_Geometry_Plane.ord(Data_Geometry_Plane.basedPoint)(p)) + " ")));
    };
    var path = function (stroke) {
        return function (strokeWidth) {
            return function (fill) {
                return function (content) {
                    return Concur_VDom_SVG.path(Concur_Core_Types.widgetMultiAlternative(Data_Monoid.monoidArray))(Concur_Core_Types.widgetShiftMap)([ Concur_VDom_SVG.d(content), Concur_VDom_SVG.style("stroke:" + (stroke + ("; stroke-width:" + (Data_Show.show(Data_Show.showInt)(Data_Int.round(strokeWidth)) + ("; fill:" + (fill + ";")))))) ])([  ]);
                };
            };
        };
    }; 
    var renderRightAngle = new Render(function (v) {
        return function (v1) {
            var w = Data_Geometry_Plane.scale(v1.radius / Data_Geometry_Plane.length(Data_Geometry_Plane.measurableVector)(v1.origin))(v1.origin);
            var v2 = Data_Geometry_Plane.scale(v1.radius / Data_Geometry_Plane.length(Data_Geometry_Plane.measurableVector)(v1.extremity))(v1.extremity);
            var u = Data_Geometry_Plane.plus(Data_Geometry_Plane.summableVectorVector)(v2)(w);
            var o = Data_Geometry_Plane.plus(Data_Geometry_Plane.summublePointVector)(v1.center)(w);
            var n = Data_Geometry_Plane.plus(Data_Geometry_Plane.summublePointVector)(v1.center)(v2);
            var m = Data_Geometry_Plane.plus(Data_Geometry_Plane.summublePointVector)(v1.center)(u);
            return [ path(v.stroke)(v.strokeWidth)(v.fill)("M" + (pathCoord(o) + ("L" + (pathCoord(m) + ("L" + pathCoord(n)))))) ];
        };
    });
    var line = function (x1) {
        return function (y1) {
            return function (x2) {
                return function (y2) {
                    return function (color) {
                        return function (size) {
                            return Concur_VDom_SVG.line(Concur_Core_Types.widgetMultiAlternative(Data_Monoid.monoidArray))(Concur_Core_Types.widgetShiftMap)([ Concur_VDom_SVG.unsafeMkProp(Data_Show.showInt)("x1")(Data_Int.round(x1)), Concur_VDom_SVG.unsafeMkProp(Data_Show.showInt)("x2")(Data_Int.round(x2)), Concur_VDom_SVG.unsafeMkProp(Data_Show.showInt)("y1")(Data_Int.round(y1)), Concur_VDom_SVG.unsafeMkProp(Data_Show.showInt)("y2")(Data_Int.round(y2)), Concur_VDom_SVG.stroke(color), Concur_VDom_SVG.strokeWidth(Data_Int.round(size)) ])([  ]);
                        };
                    };
                };
            };
        };
    };
    var renderHalfLine = new Render(function (v) {
        return function (v1) {
            var far = Data_Geometry_Plane.plus(Data_Geometry_Plane.summublePointVector)(v1.origin)(Data_Geometry_Plane.scale(10.0)(v1.direction));
            return [ line(Data_Geometry_Plane.abs(Data_Geometry_Plane.basedPoint)(v1.origin))(Data_Geometry_Plane.ord(Data_Geometry_Plane.basedPoint)(v1.origin))(Data_Geometry_Plane.abs(Data_Geometry_Plane.basedPoint)(far))(Data_Geometry_Plane.ord(Data_Geometry_Plane.basedPoint)(far))(v.stroke)(v.strokeWidth) ];
        };
    });
    var renderLine = new Render(function (ctx) {
        return function (l) {
            var v = Data_Geometry_Plane.aVectorOfLine(l);
            var m = Data_Geometry_Plane.aPointOnLine(l);
            return Data_Semigroup.append(Data_Semigroup.semigroupArray)(render$prime(renderHalfLine)(ctx)(Data_Geometry_Plane.halfline(m)(v)))(render$prime(renderHalfLine)(ctx)(Data_Geometry_Plane.halfline(m)(Data_Geometry_Plane.scale(-1.0)(v))));
        };
    });
    var renderPoint = new Render(function (v) {
        return function (v1) {
            return [ line(Data_Geometry_Plane.abs(Data_Geometry_Plane.basedPoint)(v1) - 5.0)(Data_Geometry_Plane.ord(Data_Geometry_Plane.basedPoint)(v1) - 5.0)(Data_Geometry_Plane.abs(Data_Geometry_Plane.basedPoint)(v1) + 5.0)(Data_Geometry_Plane.ord(Data_Geometry_Plane.basedPoint)(v1) + 5.0)(v.stroke)(v.strokeWidth), line(Data_Geometry_Plane.abs(Data_Geometry_Plane.basedPoint)(v1) - 5.0)(Data_Geometry_Plane.ord(Data_Geometry_Plane.basedPoint)(v1) + 5.0)(Data_Geometry_Plane.abs(Data_Geometry_Plane.basedPoint)(v1) + 5.0)(Data_Geometry_Plane.ord(Data_Geometry_Plane.basedPoint)(v1) - 5.0)(v.stroke)(v.strokeWidth), text(Data_Geometry_Plane.abs(Data_Geometry_Plane.basedPoint)(v1) + 10.0)(Data_Geometry_Plane.ord(Data_Geometry_Plane.basedPoint)(v1) - 10.0)(v.textFill)(v.fontStyle)(v1.name) ];
        };
    });
    var defaultContext = {
        stroke: "#000",
        fill: "#00000000",
        strokeWidth: 1.5,
        fontStyle: "italic 15px sans-serif",
        textFill: "#000"
    };
    var arrowLength = 20.0;
    var arrowBluntness = 0.2;
    var arrowTip = function (v) {
        var v1 = Data_Geometry_Plane.vector(v.origin)(v.extremity);
        var v0 = Data_Geometry_Plane.Vector(Data_Sparse_Polynomial.monoPol(Data_Geometry_Plane.length(Data_Geometry_Plane.measurableVector)(v1))(0));
        var ang = $$Math.atan2(Data_Geometry_Plane.ord(Data_Geometry_Plane.basedVector)(v1))(Data_Geometry_Plane.abs(Data_Geometry_Plane.basedVector)(v1));
        var f = function (theta) {
            var v11 = Data_Geometry_Plane.rotated(theta)(Data_Geometry_Plane.Vector(Data_Sparse_Polynomial.monoPol(arrowLength)(0)));
            return Data_Geometry_Plane.plus(Data_Geometry_Plane.summublePointVector)(v.origin)(Data_Geometry_Plane.rotated(ang)(Data_Geometry_Plane.plus(Data_Geometry_Plane.summableVectorVector)(v11)(v0)));
        };
        return {
            at1: f($$Math.pi - arrowBluntness),
            at2: f($$Math.pi + arrowBluntness)
        };
    };
    var renderArc = new Render(function (v) {
        return function (v1) {
            var v2 = Data_Geometry_Plane.scale(v1.radius / Data_Geometry_Plane.length(Data_Geometry_Plane.measurableVector)(v1.extremity))(v1.extremity);
            var u = Data_Geometry_Plane.scale(v1.radius / Data_Geometry_Plane.length(Data_Geometry_Plane.measurableVector)(v1.origin))(v1.origin);
            var pO = Data_Geometry_Plane.plus(Data_Geometry_Plane.summublePointVector)(v1.center)(u);
            var pE = Data_Geometry_Plane.plus(Data_Geometry_Plane.summublePointVector)(v1.center)(v2);
            var b = (function () {
                var $55 = v1.flipped && v1.swapped;
                if ($55) {
                    return !v1.flag;
                };
                return v1.flag;
            })();
            var a3 = (function () {
                if (b) {
                    return 1.0;
                };
                return -1.0;
            })();
            var n = Data_Geometry_Plane.plus(Data_Geometry_Plane.summublePointVector)(pE)(Data_Geometry_Plane.scale(-a3)(Data_Geometry_Plane.normalTo(v1.extremity)));
            var a2 = (function () {
                if (v1.flipped) {
                    return "0 ";
                };
                return "1 ";
            })();
            var a1 = (function () {
                if (b) {
                    return "1 ";
                };
                return "0 ";
            })();
            var v3 = arrowTip(Data_Geometry_Plane.segment(n)(pE)(Data_Maybe.Nothing.value));
            var uv = Data_Geometry_Plane.plus(Data_Geometry_Plane.summableVectorVector)(u)(v2);
            var i = Data_Geometry_Plane.plus(Data_Geometry_Plane.summublePointVector)(v1.center)(Data_Geometry_Plane.scale((v1.radius * 0.8) / Data_Geometry_Plane.length(Data_Geometry_Plane.measurableVector)(uv))(uv));
            return Data_Semigroup.append(Data_Semigroup.semigroupArray)([ path(v.stroke)(v.strokeWidth)(v.fill)("M" + (pathCoord(pO) + ("a " + (Data_Show.show(Data_Show.showNumber)(v1.radius) + (" " + (Data_Show.show(Data_Show.showNumber)(v1.radius) + (" " + ("0 " + (a1 + (a2 + (" " + (Data_Show.show(Data_Show.showNumber)(Data_Geometry_Plane.abs(Data_Geometry_Plane.basedPoint)(pE) - Data_Geometry_Plane.abs(Data_Geometry_Plane.basedPoint)(pO)) + (" " + Data_Show.show(Data_Show.showNumber)(Data_Geometry_Plane.ord(Data_Geometry_Plane.basedPoint)(pE) - Data_Geometry_Plane.ord(Data_Geometry_Plane.basedPoint)(pO))))))))))))))) ])(Data_Semigroup.append(Data_Semigroup.semigroupArray)(Data_Maybe.maybe([  ])(function (str) {
                return [ path(v.stroke)(v.strokeWidth)(v.stroke)("M" + (pathCoord(v3.at2) + ("L" + (pathCoord(pE) + ("L" + (pathCoord(v3.at1) + "Z")))))) ];
            })(v1.asOriented))(Data_Maybe.maybe([  ])(function (str) {
                return [ text(Data_Geometry_Plane.abs(Data_Geometry_Plane.basedPoint)(i))(Data_Geometry_Plane.ord(Data_Geometry_Plane.basedPoint)(i))(v.textFill)(v.fontStyle)(str) ];
            })(v1.asOriented)));
        };
    });
    var renderSegment = new Render(function (v) {
        return function (v1) {
            var m = Data_Geometry_Plane.middle("")(v1);
            return Data_Semigroup.append(Data_Semigroup.semigroupArray)([ line(Data_Geometry_Plane.abs(Data_Geometry_Plane.basedPoint)(v1.origin))(Data_Geometry_Plane.ord(Data_Geometry_Plane.basedPoint)(v1.origin))(Data_Geometry_Plane.abs(Data_Geometry_Plane.basedPoint)(v1.extremity))(Data_Geometry_Plane.ord(Data_Geometry_Plane.basedPoint)(v1.extremity))(v.stroke)(v.strokeWidth) ])(Data_Semigroup.append(Data_Semigroup.semigroupArray)(Data_Maybe.maybe([  ])(function (str) {
                var v2 = arrowTip(v1);
                return [ path(v.stroke)(v.strokeWidth)(v.stroke)("M" + (pathCoord(v2.at1) + ("L" + (pathCoord(v1.extremity) + ("L" + (pathCoord(v2.at2) + "Z")))))) ];
            })(v1.asOriented))(Data_Maybe.maybe([  ])(function (str) {
                return [ text(Data_Geometry_Plane.abs(Data_Geometry_Plane.basedPoint)(m) + 10.0)(Data_Geometry_Plane.ord(Data_Geometry_Plane.basedPoint)(m) - 10.0)(v.textFill)(v.fontStyle)(str), text(Data_Geometry_Plane.abs(Data_Geometry_Plane.basedPoint)(m) + 10.0)(Data_Geometry_Plane.ord(Data_Geometry_Plane.basedPoint)(m) - 23.0)(v.textFill)(v.fontStyle)((function () {
                    var $80 = str === "";
                    if ($80) {
                        return "";
                    };
                    return Data_String_CodePoints.singleton(Data_Maybe.fromJust()(Data_Enum.toEnum(Data_String_CodePoints.boundedEnumCodePoint)(8594)));
                })()) ];
            })(v1.asOriented)));
        };
    });
    exports["render'"] = render$prime;
    exports["defaultContext"] = defaultContext;
    exports["renderPoint"] = renderPoint;
    exports["renderLine"] = renderLine;
    exports["renderSegment"] = renderSegment;
    exports["renderArc"] = renderArc;
    exports["renderRightAngle"] = renderRightAngle;
    exports["renderSequence"] = renderSequence;
  })(PS);
  (function($PS) {
    // Generated by purs version 0.13.8
    "use strict";
    $PS["Effect.Class.Console"] = $PS["Effect.Class.Console"] || {};
    var exports = $PS["Effect.Class.Console"];
    var Effect_Class = $PS["Effect.Class"];
    var Effect_Console = $PS["Effect.Console"];
    var log = function (dictMonadEffect) {
        var $30 = Effect_Class.liftEffect(dictMonadEffect);
        return function ($31) {
            return $30(Effect_Console.log($31));
        };
    };
    exports["log"] = log;
  })(PS);
  (function(exports) {
    "use strict";
  
    exports.appendChild = function (node) {
      return function (parent) {
        return function () {
          return parent.appendChild(node);
        };
      };
    };
  })(PS["Web.DOM.Node"] = PS["Web.DOM.Node"] || {});
  (function($PS) {
    // Generated by purs version 0.13.8
    "use strict";
    $PS["Web.DOM.Node"] = $PS["Web.DOM.Node"] || {};
    var exports = $PS["Web.DOM.Node"];
    var $foreign = $PS["Web.DOM.Node"];
    exports["appendChild"] = $foreign.appendChild;
  })(PS);
  (function(exports) {
    "use strict";                                               
  
    exports._querySelector = function (selector) {
      return function (node) {
        return function () {
          return node.querySelector(selector);
        };
      };
    };
  })(PS["Web.DOM.ParentNode"] = PS["Web.DOM.ParentNode"] || {});
  (function($PS) {
    // Generated by purs version 0.13.8
    "use strict";
    $PS["Web.DOM.ParentNode"] = $PS["Web.DOM.ParentNode"] || {};
    var exports = $PS["Web.DOM.ParentNode"];
    var $foreign = $PS["Web.DOM.ParentNode"];
    var Data_Functor = $PS["Data.Functor"];
    var Data_Nullable = $PS["Data.Nullable"];
    var Effect = $PS["Effect"];
    var querySelector = function (qs) {
        var $3 = Data_Functor.map(Effect.functorEffect)(Data_Nullable.toMaybe);
        var $4 = $foreign["_querySelector"](qs);
        return function ($5) {
            return $3($4($5));
        };
    };
    exports["querySelector"] = querySelector;
  })(PS);
  (function(exports) {
    /* global window */
    "use strict";
  
    exports.window = function () {
      return window;
    };
  })(PS["Web.HTML"] = PS["Web.HTML"] || {});
  (function($PS) {
    // Generated by purs version 0.13.8
    "use strict";
    $PS["Web.HTML"] = $PS["Web.HTML"] || {};
    var exports = $PS["Web.HTML"];
    var $foreign = $PS["Web.HTML"];
    exports["window"] = $foreign.window;
  })(PS);
  (function($PS) {
    // Generated by purs version 0.13.8
    "use strict";
    $PS["Web.HTML.Event.EventTypes"] = $PS["Web.HTML.Event.EventTypes"] || {};
    var exports = $PS["Web.HTML.Event.EventTypes"];
    var domcontentloaded = "DOMContentLoaded";
    exports["domcontentloaded"] = domcontentloaded;
  })(PS);
  (function(exports) {
    "use strict";
  
    exports._readyState = function (doc) {
      return function () {
        return doc.readyState;
      };
    };
  })(PS["Web.HTML.HTMLDocument"] = PS["Web.HTML.HTMLDocument"] || {});
  (function($PS) {
    // Generated by purs version 0.13.8
    "use strict";
    $PS["Web.HTML.HTMLDocument.ReadyState"] = $PS["Web.HTML.HTMLDocument.ReadyState"] || {};
    var exports = $PS["Web.HTML.HTMLDocument.ReadyState"];
    var Data_Maybe = $PS["Data.Maybe"];              
    var Loading = (function () {
        function Loading() {
  
        };
        Loading.value = new Loading();
        return Loading;
    })();
    var Interactive = (function () {
        function Interactive() {
  
        };
        Interactive.value = new Interactive();
        return Interactive;
    })();
    var Complete = (function () {
        function Complete() {
  
        };
        Complete.value = new Complete();
        return Complete;
    })();
    var parse = function (v) {
        if (v === "loading") {
            return new Data_Maybe.Just(Loading.value);
        };
        if (v === "interactive") {
            return new Data_Maybe.Just(Interactive.value);
        };
        if (v === "complete") {
            return new Data_Maybe.Just(Complete.value);
        };
        return Data_Maybe.Nothing.value;
    };
    exports["Loading"] = Loading;
    exports["parse"] = parse;
  })(PS);
  (function($PS) {
    // Generated by purs version 0.13.8
    "use strict";
    $PS["Web.HTML.HTMLDocument"] = $PS["Web.HTML.HTMLDocument"] || {};
    var exports = $PS["Web.HTML.HTMLDocument"];
    var $foreign = $PS["Web.HTML.HTMLDocument"];
    var Data_Functor = $PS["Data.Functor"];
    var Data_Maybe = $PS["Data.Maybe"];
    var Effect = $PS["Effect"];
    var Unsafe_Coerce = $PS["Unsafe.Coerce"];
    var Web_HTML_HTMLDocument_ReadyState = $PS["Web.HTML.HTMLDocument.ReadyState"];
    var toParentNode = Unsafe_Coerce.unsafeCoerce; 
    var toDocument = Unsafe_Coerce.unsafeCoerce;
    var readyState = (function () {
        var $0 = Data_Functor.map(Effect.functorEffect)((function () {
            var $2 = Data_Maybe.fromMaybe(Web_HTML_HTMLDocument_ReadyState.Loading.value);
            return function ($3) {
                return $2(Web_HTML_HTMLDocument_ReadyState.parse($3));
            };
        })());
        return function ($1) {
            return $0($foreign["_readyState"]($1));
        };
    })();
    exports["toDocument"] = toDocument;
    exports["toParentNode"] = toParentNode;
    exports["readyState"] = readyState;
  })(PS);
  (function(exports) {
    "use strict";
  
    exports._read = function (nothing, just, value) {
      var tag = Object.prototype.toString.call(value);
      if (tag.indexOf("[object HTML") === 0 && tag.indexOf("Element]") === tag.length - 8) {
        return just(value);
      } else {
        return nothing;
      }
    };
  })(PS["Web.HTML.HTMLElement"] = PS["Web.HTML.HTMLElement"] || {});
  (function($PS) {
    // Generated by purs version 0.13.8
    "use strict";
    $PS["Web.HTML.HTMLElement"] = $PS["Web.HTML.HTMLElement"] || {};
    var exports = $PS["Web.HTML.HTMLElement"];
    var $foreign = $PS["Web.HTML.HTMLElement"];
    var Data_Maybe = $PS["Data.Maybe"];
    var Unsafe_Coerce = $PS["Unsafe.Coerce"];                   
    var toNode = Unsafe_Coerce.unsafeCoerce;
    var fromElement = function (x) {
        return $foreign["_read"](Data_Maybe.Nothing.value, Data_Maybe.Just.create, x);
    };
    exports["fromElement"] = fromElement;
    exports["toNode"] = toNode;
  })(PS);
  (function(exports) {
    "use strict";
  
    exports.document = function (window) {
      return function () {
        return window.document;
      };
    };
  })(PS["Web.HTML.Window"] = PS["Web.HTML.Window"] || {});
  (function($PS) {
    // Generated by purs version 0.13.8
    "use strict";
    $PS["Web.HTML.Window"] = $PS["Web.HTML.Window"] || {};
    var exports = $PS["Web.HTML.Window"];
    var $foreign = $PS["Web.HTML.Window"];
    var Unsafe_Coerce = $PS["Unsafe.Coerce"];
    var toEventTarget = Unsafe_Coerce.unsafeCoerce;
    exports["toEventTarget"] = toEventTarget;
    exports["document"] = $foreign.document;
  })(PS);
  (function($PS) {
    // Generated by purs version 0.13.8
    "use strict";
    $PS["Concur.VDom.Run"] = $PS["Concur.VDom.Run"] || {};
    var exports = $PS["Concur.VDom.Run"];
    var Concur_Core_Discharge = $PS["Concur.Core.Discharge"];
    var Concur_Thunk_Internal = $PS["Concur.Thunk.Internal"];
    var Concur_VDom_DOM = $PS["Concur.VDom.DOM"];
    var Concur_VDom_Props_Internal = $PS["Concur.VDom.Props.Internal"];
    var Concur_VDom_Types = $PS["Concur.VDom.Types"];
    var Control_Applicative = $PS["Control.Applicative"];
    var Control_Bind = $PS["Control.Bind"];
    var Data_Either = $PS["Data.Either"];
    var Data_Function = $PS["Data.Function"];
    var Data_Functor = $PS["Data.Functor"];
    var Data_Maybe = $PS["Data.Maybe"];
    var Data_Monoid = $PS["Data.Monoid"];
    var Data_Show = $PS["Data.Show"];
    var Data_Unit = $PS["Data.Unit"];
    var Effect = $PS["Effect"];
    var Effect_Aff = $PS["Effect.Aff"];
    var Effect_Class = $PS["Effect.Class"];
    var Effect_Class_Console = $PS["Effect.Class.Console"];
    var Effect_Exception = $PS["Effect.Exception"];
    var Effect_Ref = $PS["Effect.Ref"];
    var Halogen_VDom_DOM = $PS["Halogen.VDom.DOM"];
    var Halogen_VDom_Machine = $PS["Halogen.VDom.Machine"];
    var Web_DOM_Node = $PS["Web.DOM.Node"];
    var Web_DOM_ParentNode = $PS["Web.DOM.ParentNode"];
    var Web_Event_EventTarget = $PS["Web.Event.EventTarget"];
    var Web_HTML = $PS["Web.HTML"];
    var Web_HTML_Event_EventTypes = $PS["Web.HTML.Event.EventTypes"];
    var Web_HTML_HTMLDocument = $PS["Web.HTML.HTMLDocument"];
    var Web_HTML_HTMLDocument_ReadyState = $PS["Web.HTML.HTMLDocument.ReadyState"];
    var Web_HTML_HTMLElement = $PS["Web.HTML.HTMLElement"];
    var Web_HTML_Window = $PS["Web.HTML.Window"];                
    var selectElement = function (query) {
        return Control_Bind.bind(Effect_Aff.bindAff)(Effect_Class.liftEffect(Effect_Aff.monadEffectAff)(Control_Bind.bindFlipped(Effect.bindEffect)(Control_Bind.composeKleisliFlipped(Effect.bindEffect)((function () {
            var $12 = Web_DOM_ParentNode.querySelector(query);
            return function ($13) {
                return $12(Web_HTML_HTMLDocument.toParentNode($13));
            };
        })())(Web_HTML_Window.document))(Web_HTML.window)))(function (mel) {
            return Control_Applicative.pure(Effect_Aff.applicativeAff)(Control_Bind.bindFlipped(Data_Maybe.bindMaybe)(Web_HTML_HTMLElement.fromElement)(mel));
        });
    };
    var runAffX = Effect_Aff.runAff_(Data_Either.either(Effect_Exception.throwException)(Data_Function["const"](Control_Applicative.pure(Effect.applicativeEffect)(Data_Unit.unit))));
    var renderComponent = function (spec) {
        return function (parent) {
            return function (winit) {
                var render = function (v) {
                    return Concur_VDom_Types.unHTMLNode(Concur_VDom_DOM.nodeBuilder("div")([  ])(v));
                };
                var handler = function (ref) {
                    var go = function (v) {
                        if (v instanceof Data_Either.Left) {
                            return Effect_Class_Console.log(Effect_Class.monadEffectEffect)("FAILED! " + Data_Show.show(Effect_Exception.showError)(v.value0));
                        };
                        if (v instanceof Data_Either.Right) {
                            return function __do() {
                                var machine = Effect_Ref.read(ref)();
                                var v1 = Concur_Core_Discharge.discharge(Data_Monoid.monoidArray)(handler(ref))(v.value0)();
                                var res = Halogen_VDom_Machine.step(machine, render(v1));
                                return Effect_Ref.write(res)(ref)();
                            };
                        };
                        throw new Error("Failed pattern match at Concur.VDom.Run (line 75, column 9 - line 75, column 53): " + [ v.constructor.name ]);
                    };
                    return go;
                };
                return function __do() {
                    var v = Concur_Core_Discharge.dischargePartialEffect(Data_Monoid.monoidArray)(winit)();
                    var initMachine = Halogen_VDom_DOM.buildVDom(spec)(render(v.value1));
                    Web_DOM_Node.appendChild(Halogen_VDom_Machine.extract(initMachine))(parent)();
                    var ref = Effect_Ref["new"](initMachine)();
                    return handler(ref)(new Data_Either.Right(v.value0))();
                };
            };
        };
    };
    var mkSpec = function (document) {
        return {
            buildWidget: Concur_Thunk_Internal.buildThunk(Concur_VDom_Types.unHTMLNode),
            buildAttributes: Concur_VDom_Props_Internal.buildProp,
            document: document
        };
    };
    var awaitLoad = Effect_Aff.makeAff(function (callback) {
        return function __do() {
            var rs = Control_Bind.bindFlipped(Effect.bindEffect)(Web_HTML_HTMLDocument.readyState)(Control_Bind.bindFlipped(Effect.bindEffect)(Web_HTML_Window.document)(Web_HTML.window))();
            if (rs instanceof Web_HTML_HTMLDocument_ReadyState.Loading) {
                var et = Data_Functor.map(Effect.functorEffect)(Web_HTML_Window.toEventTarget)(Web_HTML.window)();
                var listener = Web_Event_EventTarget.eventListener(function (v) {
                    return callback(new Data_Either.Right(Data_Unit.unit));
                })();
                Web_Event_EventTarget.addEventListener(Web_HTML_Event_EventTypes.domcontentloaded)(listener)(false)(et)();
                return Effect_Aff.effectCanceler(Web_Event_EventTarget.removeEventListener(Web_HTML_Event_EventTypes.domcontentloaded)(listener)(false)(et));
            };
            callback(new Data_Either.Right(Data_Unit.unit))();
            return Effect_Aff.nonCanceler;
        };
    });
    var renderWidgetInto = function (query) {
        return function (w) {
            return runAffX(Control_Bind.discard(Control_Bind.discardUnit)(Effect_Aff.bindAff)(awaitLoad)(function () {
                return Control_Bind.bind(Effect_Aff.bindAff)(Effect_Class.liftEffect(Effect_Aff.monadEffectAff)(Control_Bind.bindFlipped(Effect.bindEffect)(Web_HTML_Window.document)(Web_HTML.window)))(function (doc) {
                    return Control_Bind.bind(Effect_Aff.bindAff)(selectElement(query))(function (mroot) {
                        if (mroot instanceof Data_Maybe.Nothing) {
                            return Control_Applicative.pure(Effect_Aff.applicativeAff)(Data_Unit.unit);
                        };
                        if (mroot instanceof Data_Maybe.Just) {
                            return Data_Functor["void"](Effect_Aff.functorAff)(Effect_Class.liftEffect(Effect_Aff.monadEffectAff)(renderComponent(mkSpec(Web_HTML_HTMLDocument.toDocument(doc)))(Web_HTML_HTMLElement.toNode(mroot.value0))(w)));
                        };
                        throw new Error("Failed pattern match at Concur.VDom.Run (line 50, column 3 - line 52, column 120): " + [ mroot.constructor.name ]);
                    });
                });
            }));
        };
    };
    var runWidgetInSelector = function (elemId) {
        return renderWidgetInto(elemId);
    };
    var runWidgetInDom = function (elemId) {
        return runWidgetInSelector("#" + elemId);
    };
    exports["runWidgetInDom"] = runWidgetInDom;
  })(PS);
  (function($PS) {
    // Generated by purs version 0.13.8
    "use strict";
    $PS["Data.Ratio"] = $PS["Data.Ratio"] || {};
    var exports = $PS["Data.Ratio"];
    var Data_CommutativeRing = $PS["Data.CommutativeRing"];
    var Data_EuclideanRing = $PS["Data.EuclideanRing"];
    var Data_Ord = $PS["Data.Ord"];
    var Data_Ring = $PS["Data.Ring"];
    var Data_Semiring = $PS["Data.Semiring"];        
    var Ratio = (function () {
        function Ratio(value0, value1) {
            this.value0 = value0;
            this.value1 = value1;
        };
        Ratio.create = function (value0) {
            return function (value1) {
                return new Ratio(value0, value1);
            };
        };
        return Ratio;
    })();
    var reduce = function (dictOrd) {
        return function (dictEuclideanRing) {
            return function (n) {
                return function (d) {
                    var g = Data_EuclideanRing.gcd(dictOrd.Eq0())(dictEuclideanRing)(n)(d);
                    var d$prime = Data_EuclideanRing.div(dictEuclideanRing)(d)(g);
                    return new Ratio(Data_Semiring.mul(((dictEuclideanRing.CommutativeRing0()).Ring0()).Semiring0())(Data_EuclideanRing.div(dictEuclideanRing)(n)(g))(Data_Ord.signum(dictOrd)((dictEuclideanRing.CommutativeRing0()).Ring0())(d$prime)), Data_Ord.abs(dictOrd)((dictEuclideanRing.CommutativeRing0()).Ring0())(d$prime));
                };
            };
        };
    };
    var semiringRatio = function (dictOrd) {
        return function (dictEuclideanRing) {
            return new Data_Semiring.Semiring(function (v) {
                return function (v1) {
                    return reduce(dictOrd)(dictEuclideanRing)(Data_Semiring.add(((dictEuclideanRing.CommutativeRing0()).Ring0()).Semiring0())(Data_Semiring.mul(((dictEuclideanRing.CommutativeRing0()).Ring0()).Semiring0())(v.value0)(v1.value1))(Data_Semiring.mul(((dictEuclideanRing.CommutativeRing0()).Ring0()).Semiring0())(v.value1)(v1.value0)))(Data_Semiring.mul(((dictEuclideanRing.CommutativeRing0()).Ring0()).Semiring0())(v.value1)(v1.value1));
                };
            }, function (v) {
                return function (v1) {
                    return reduce(dictOrd)(dictEuclideanRing)(Data_Semiring.mul(((dictEuclideanRing.CommutativeRing0()).Ring0()).Semiring0())(v.value0)(v1.value0))(Data_Semiring.mul(((dictEuclideanRing.CommutativeRing0()).Ring0()).Semiring0())(v.value1)(v1.value1));
                };
            }, new Ratio(Data_Semiring.one(((dictEuclideanRing.CommutativeRing0()).Ring0()).Semiring0()), Data_Semiring.one(((dictEuclideanRing.CommutativeRing0()).Ring0()).Semiring0())), new Ratio(Data_Semiring.zero(((dictEuclideanRing.CommutativeRing0()).Ring0()).Semiring0()), Data_Semiring.one(((dictEuclideanRing.CommutativeRing0()).Ring0()).Semiring0())));
        };
    };
    var ringRatio = function (dictOrd) {
        return function (dictEuclideanRing) {
            return new Data_Ring.Ring(function () {
                return semiringRatio(dictOrd)(dictEuclideanRing);
            }, function (v) {
                return function (v1) {
                    return reduce(dictOrd)(dictEuclideanRing)(Data_Ring.sub((dictEuclideanRing.CommutativeRing0()).Ring0())(Data_Semiring.mul(((dictEuclideanRing.CommutativeRing0()).Ring0()).Semiring0())(v.value0)(v1.value1))(Data_Semiring.mul(((dictEuclideanRing.CommutativeRing0()).Ring0()).Semiring0())(v.value1)(v1.value0)))(Data_Semiring.mul(((dictEuclideanRing.CommutativeRing0()).Ring0()).Semiring0())(v.value1)(v1.value1));
                };
            });
        };
    };
    var numerator = function (v) {
        return v.value0;
    };
    var denominator = function (v) {
        return v.value1;
    };
    var commutativeRingRatio = function (dictOrd) {
        return function (dictEuclideanRing) {
            return new Data_CommutativeRing.CommutativeRing(function () {
                return ringRatio(dictOrd)(dictEuclideanRing);
            });
        };
    };
    var euclideanRingRatio = function (dictOrd) {
        return function (dictEuclideanRing) {
            return new Data_EuclideanRing.EuclideanRing(function () {
                return commutativeRingRatio(dictOrd)(dictEuclideanRing);
            }, function (v) {
                return 1;
            }, function (v) {
                return function (v1) {
                    return reduce(dictOrd)(dictEuclideanRing)(Data_Semiring.mul(((dictEuclideanRing.CommutativeRing0()).Ring0()).Semiring0())(v.value0)(v1.value1))(Data_Semiring.mul(((dictEuclideanRing.CommutativeRing0()).Ring0()).Semiring0())(v.value1)(v1.value0));
                };
            }, function (v) {
                return function (v1) {
                    return Data_Semiring.zero(semiringRatio(dictOrd)(dictEuclideanRing));
                };
            });
        };
    };
    exports["reduce"] = reduce;
    exports["numerator"] = numerator;
    exports["denominator"] = denominator;
    exports["euclideanRingRatio"] = euclideanRingRatio;
  })(PS);
  (function($PS) {
    // Generated by purs version 0.13.8
    "use strict";
    $PS["Data.Rational"] = $PS["Data.Rational"] || {};
    var exports = $PS["Data.Rational"];
    var Data_EuclideanRing = $PS["Data.EuclideanRing"];
    var Data_Ord = $PS["Data.Ord"];
    var Data_Ratio = $PS["Data.Ratio"];
    var fromInt = function (i) {
        return Data_Ratio.reduce(Data_Ord.ordInt)(Data_EuclideanRing.euclideanRingInt)(i)(1);
    };
    exports["fromInt"] = fromInt;
  })(PS);
  (function($PS) {
    // Generated by purs version 0.13.8
    "use strict";
    $PS["Rand"] = $PS["Rand"] || {};
    var exports = $PS["Rand"];
    var Data_Array = $PS["Data.Array"];
    var Data_Eq = $PS["Data.Eq"];
    var Data_EuclideanRing = $PS["Data.EuclideanRing"];
    var Data_Maybe = $PS["Data.Maybe"];
    var middle = function (nn) {
        var n3$prime = Data_EuclideanRing.mod(Data_EuclideanRing.euclideanRingInt)(nn)(1000000);
        var n3 = nn - (Data_EuclideanRing.div(Data_EuclideanRing.euclideanRingInt)(nn - n3$prime | 0)(1000000) * 1000000 | 0) | 0;
        var n0 = Data_EuclideanRing.mod(Data_EuclideanRing.euclideanRingInt)(nn)(100);
        return Data_EuclideanRing.div(Data_EuclideanRing.euclideanRingInt)(n3 - n0 | 0)(100);
    };
    var rand = function (v) {
        return {
            val: middle(Data_EuclideanRing.mod(Data_EuclideanRing.euclideanRingInt)((v.val * v.val | 0) + v.gen | 0)(100000000)),
            gen: Data_EuclideanRing.mod(Data_EuclideanRing.euclideanRingInt)(v.gen + v.seed | 0)(100000000),
            seed: v.seed
        };
    };
    var unsort = function (n) {
        return function (r) {
            var shake = function ($copy_v) {
                return function ($copy_v1) {
                    return function ($copy_ys) {
                        var $tco_var_v = $copy_v;
                        var $tco_var_v1 = $copy_v1;
                        var $tco_done = false;
                        var $tco_result;
                        function $tco_loop(v, v1, ys) {
                            if (v.length === 0) {
                                $tco_done = true;
                                return ys;
                            };
                            if (v.length === 1) {
                                $tco_done = true;
                                return Data_Array.cons(v[0])(ys);
                            };
                            var r$prime$prime = rand(v1);
                            var x = Data_Maybe.fromJust()(Data_Array.index(v)(Data_EuclideanRing.mod(Data_EuclideanRing.euclideanRingInt)(r$prime$prime.val)(Data_Array.length(v))));
                            $tco_var_v = Data_Array.difference(Data_Eq.eqInt)(v)([ x ]);
                            $tco_var_v1 = r$prime$prime;
                            $copy_ys = Data_Array.cons(x)(ys);
                            return;
                        };
                        while (!$tco_done) {
                            $tco_result = $tco_loop($tco_var_v, $tco_var_v1, $copy_ys);
                        };
                        return $tco_result;
                    };
                };
            };
            return shake(Data_Array.range(0)(n - 1 | 0))(r)([  ]);
        };
    };
    var consume = function (v) {
        return function (r) {
            if (v === 0) {
                return r;
            };
            return rand(consume(v - 1 | 0)(r));
        };
    };
    exports["rand"] = rand;
    exports["consume"] = consume;
    exports["unsort"] = unsort;
  })(PS);
  (function($PS) {
    // Generated by purs version 0.13.8
    "use strict";
    $PS["Main"] = $PS["Main"] || {};
    var exports = $PS["Main"];
    var Article = $PS["Article"];
    var Concur_Core_FRP = $PS["Concur.Core.FRP"];
    var Concur_Core_LiftWidget = $PS["Concur.Core.LiftWidget"];
    var Concur_Core_Props = $PS["Concur.Core.Props"];
    var Concur_Core_Types = $PS["Concur.Core.Types"];
    var Concur_VDom_DOM = $PS["Concur.VDom.DOM"];
    var Concur_VDom_GeometryRender = $PS["Concur.VDom.GeometryRender"];
    var Concur_VDom_Props = $PS["Concur.VDom.Props"];
    var Concur_VDom_Run = $PS["Concur.VDom.Run"];
    var Concur_VDom_SVG = $PS["Concur.VDom.SVG"];
    var Control_Applicative = $PS["Control.Applicative"];
    var Control_Bind = $PS["Control.Bind"];
    var Control_Category = $PS["Control.Category"];
    var Control_Cofree = $PS["Control.Cofree"];
    var Control_Monad_State_Trans = $PS["Control.Monad.State.Trans"];
    var Control_Semigroupoid = $PS["Control.Semigroupoid"];
    var Data_Array = $PS["Data.Array"];
    var Data_Enum = $PS["Data.Enum"];
    var Data_EuclideanRing = $PS["Data.EuclideanRing"];
    var Data_Foldable = $PS["Data.Foldable"];
    var Data_Function = $PS["Data.Function"];
    var Data_Functor = $PS["Data.Functor"];
    var Data_Geometry_Plane = $PS["Data.Geometry.Plane"];
    var Data_Identity = $PS["Data.Identity"];
    var Data_Int = $PS["Data.Int"];
    var Data_Maybe = $PS["Data.Maybe"];
    var Data_Monoid = $PS["Data.Monoid"];
    var Data_Ord = $PS["Data.Ord"];
    var Data_Ratio = $PS["Data.Ratio"];
    var Data_Rational = $PS["Data.Rational"];
    var Data_Ring = $PS["Data.Ring"];
    var Data_Semigroup = $PS["Data.Semigroup"];
    var Data_Show = $PS["Data.Show"];
    var Data_String_CodePoints = $PS["Data.String.CodePoints"];
    var Rand = $PS["Rand"];                
    var HasDefault = function (dflt) {
        this.dflt = dflt;
    };
    var showFraction = function (p) {
        return "\\dfrac{" + (Data_Show.show(Data_Show.showInt)(Data_Ratio.numerator(p)) + ("}{" + (Data_Show.show(Data_Show.showInt)(Data_Ratio.denominator(p)) + "}")));
    };
    var rep5 = function (dataSet) {
        return Control_Bind.discard(Control_Bind.discardUnit)(Control_Monad_State_Trans.bindStateT(Data_Identity.monadIdentity))(Article.b(" III "))(function () {
            return Control_Bind.discard(Control_Bind.discardUnit)(Control_Monad_State_Trans.bindStateT(Data_Identity.monadIdentity))(Article.t(Data_Show.show(Data_Show.showBoolean)(dataSet.ok)))(function () {
                return Article.m(showFraction(Data_EuclideanRing.div(Data_Ratio.euclideanRingRatio(Data_Ord.ordInt)(Data_EuclideanRing.euclideanRingInt))(Data_Rational.fromInt(dataSet.a))(Data_Rational.fromInt(dataSet.b))));
            });
        });
    };
    var rep4 = Control_Bind.discard(Control_Bind.discardUnit)(Control_Monad_State_Trans.bindStateT(Data_Identity.monadIdentity))(Article.b(" IV "))(function () {
        return Control_Bind.discard(Control_Bind.discardUnit)(Control_Monad_State_Trans.bindStateT(Data_Identity.monadIdentity))(Article.b(" a. "))(function () {
            return Control_Bind.discard(Control_Bind.discardUnit)(Control_Monad_State_Trans.bindStateT(Data_Identity.monadIdentity))(Article.t("angles oppos\xe9s par le sommet"))(function () {
                return Control_Bind.discard(Control_Bind.discardUnit)(Control_Monad_State_Trans.bindStateT(Data_Identity.monadIdentity))(Article.b(" b. "))(function () {
                    return Control_Bind.discard(Control_Bind.discardUnit)(Control_Monad_State_Trans.bindStateT(Data_Identity.monadIdentity))(Article.t("triangles avec deux angles \xe9gaux"))(function () {
                        return Control_Bind.discard(Control_Bind.discardUnit)(Control_Monad_State_Trans.bindStateT(Data_Identity.monadIdentity))(Article.b(" c. "))(function () {
                            return Article.m("\\frac{AI}{DI}=\\frac{IB}{IC}");
                        });
                    });
                });
            });
        });
    });
    var rep3 = function (dataSet) {
        return Control_Bind.discard(Control_Bind.discardUnit)(Control_Monad_State_Trans.bindStateT(Data_Identity.monadIdentity))(Article.b(" III "))(function () {
            return Control_Bind.discard(Control_Bind.discardUnit)(Control_Monad_State_Trans.bindStateT(Data_Identity.monadIdentity))(Article.t(Data_Show.show(Data_Show.showBoolean)(dataSet.ok)))(function () {
                return Article.m(showFraction(Data_EuclideanRing.div(Data_Ratio.euclideanRingRatio(Data_Ord.ordInt)(Data_EuclideanRing.euclideanRingInt))(Data_Rational.fromInt(dataSet.a))(Data_Rational.fromInt(dataSet.b))));
            });
        });
    };
    var rep2 = function (dataSet) {
        return Control_Bind.discard(Control_Bind.discardUnit)(Control_Monad_State_Trans.bindStateT(Data_Identity.monadIdentity))(Article.b(" II "))(function () {
            return Control_Bind.discard(Control_Bind.discardUnit)(Control_Monad_State_Trans.bindStateT(Data_Identity.monadIdentity))(Article.t(Data_Show.show(Data_Show.showBoolean)(dataSet.ok)))(function () {
                return Article.t(" Oui, comme le plus petit commun multiple de " + (Data_Show.show(Data_Show.showInt)(dataSet.a) + (" et de " + (Data_Show.show(Data_Show.showInt)(dataSet.b) + (" est " + (Data_Show.show(Data_Show.showInt)(dataSet.p) + (", les voitures se croisent sur la ligne d'arriv\xe9e toutes les " + (Data_Show.show(Data_Show.showInt)(dataSet.p) + " secondes."))))))));
            });
        });
    };
    var rep1 = function (dataSet) {
        return Control_Bind.discard(Control_Bind.discardUnit)(Control_Monad_State_Trans.bindStateT(Data_Identity.monadIdentity))(Article.b(" I "))(function () {
            return Control_Bind.discard(Control_Bind.discardUnit)(Control_Monad_State_Trans.bindStateT(Data_Identity.monadIdentity))(Article.t(Data_Show.show(Data_Show.showBoolean)(dataSet.ok)))(function () {
                return Control_Bind.discard(Control_Bind.discardUnit)(Control_Monad_State_Trans.bindStateT(Data_Identity.monadIdentity))(Article.b(" I.1) "))(function () {
                    return Control_Bind.discard(Control_Bind.discardUnit)(Control_Monad_State_Trans.bindStateT(Data_Identity.monadIdentity))(Article.t(" Non, " + (Data_Show.show(Data_Show.showInt)(dataSet.unfit) + (" n'est pas un diviseur de " + (Data_Show.show(Data_Show.showInt)(dataSet.b) + ".")))))(function () {
                        return Control_Bind.discard(Control_Bind.discardUnit)(Control_Monad_State_Trans.bindStateT(Data_Identity.monadIdentity))(Article.b(" I.2) "))(function () {
                            return Control_Bind.discard(Control_Bind.discardUnit)(Control_Monad_State_Trans.bindStateT(Data_Identity.monadIdentity))(Article.t(" le plus grand diviseur commun de " + (Data_Show.show(Data_Show.showInt)(dataSet.a) + (" et " + (Data_Show.show(Data_Show.showInt)(dataSet.b) + (" est " + (Data_Show.show(Data_Show.showInt)(dataSet.g) + (" donc il pourra concevoir " + (Data_Show.show(Data_Show.showInt)(dataSet.g) + " paniers au maximum.")))))))))(function () {
                                return Control_Bind.discard(Control_Bind.discardUnit)(Control_Monad_State_Trans.bindStateT(Data_Identity.monadIdentity))(Article.b(" I.3) "))(function () {
                                    return Article.t(Data_Show.show(Data_Show.showInt)(dataSet.u) + (" poissons et " + (Data_Show.show(Data_Show.showInt)(dataSet.v) + " coquillages par panier.")));
                                });
                            });
                        });
                    });
                });
            });
        });
    };
    var primes = [ [ 2, 4, 8, 16, 32 ], [ 3, 9, 27, 81 ], [ 5, 25 ], [ 7, 49 ] ];
    var opener = function (title) {
        return function (points) {
            return Article.put(Control_Monad_State_Trans.functorStateT(Data_Identity.functorIdentity))(Control_Monad_State_Trans.monadStateStateT(Data_Identity.monadIdentity))(Concur_VDom_DOM["div'"](Concur_Core_Types.widgetMultiAlternative(Data_Monoid.monoidArray))(Concur_Core_Types.widgetShiftMap)([ Concur_VDom_DOM.div(Concur_Core_Types.widgetMultiAlternative(Data_Monoid.monoidArray))(Concur_Core_Types.widgetShiftMap)([ Concur_VDom_Props.attr("style")("margin: 0; display: flex; justify-content: space-between") ])([ Concur_VDom_DOM.label(Concur_Core_Types.widgetMultiAlternative(Data_Monoid.monoidArray))(Concur_Core_Types.widgetShiftMap)([ Concur_VDom_Props.attr("style")("font-size: 24px; font-weight: 700;") ])([ Concur_VDom_DOM.text(Concur_Core_LiftWidget.widgetLiftWidget)(title) ]), Concur_VDom_DOM.label(Concur_Core_Types.widgetMultiAlternative(Data_Monoid.monoidArray))(Concur_Core_Types.widgetShiftMap)([ Concur_VDom_Props.attr("style")("font-size: 16px; font-weight: 700;") ])([ Concur_VDom_DOM.text(Concur_Core_LiftWidget.widgetLiftWidget)(points) ]) ]), Concur_VDom_DOM["hr'"](Concur_Core_Types.widgetMultiAlternative(Data_Monoid.monoidArray))(Concur_Core_Types.widgetShiftMap) ]));
        };
    };
    var mediatrice = function (p) {
        return function (q) {
            var v = Data_Geometry_Plane.normalTo(Data_Geometry_Plane.vector(p)(q));
            var i = Data_Geometry_Plane.middle("")(Data_Geometry_Plane.segment(p)(q)(Data_Maybe.Nothing.value));
            return Data_Geometry_Plane.line(i)(Data_Geometry_Plane.plus(Data_Geometry_Plane.summublePointVector)(i)(v));
        };
    };
    var initialState = {
        seed: Data_Maybe.Nothing.value,
        enabled: false
    };
    var header = Concur_VDom_DOM["div'"](Concur_Core_Types.widgetMultiAlternative(Data_Monoid.monoidArray))(Concur_Core_Types.widgetShiftMap)(Article.fromIncremental(Control_Bind.discard(Control_Bind.discardUnit)(Control_Monad_State_Trans.bindStateT(Data_Identity.monadIdentity))(Article.setTitle("Devoir 3 : Nombres premiers / Thal\xe8s - Triangles semblables"))(function () {
        return Control_Bind.discard(Control_Bind.discardUnit)(Control_Monad_State_Trans.bindStateT(Data_Identity.monadIdentity))(Article.nl)(function () {
            return Control_Bind.discard(Control_Bind.discardUnit)(Control_Monad_State_Trans.bindStateT(Data_Identity.monadIdentity))(Article.put(Control_Monad_State_Trans.functorStateT(Data_Identity.functorIdentity))(Control_Monad_State_Trans.monadStateStateT(Data_Identity.monadIdentity))(Concur_VDom_DOM.div(Concur_Core_Types.widgetMultiAlternative(Data_Monoid.monoidArray))(Concur_Core_Types.widgetShiftMap)([ Concur_VDom_Props.attr("style")("display: grid; grid-template-columns: 1fr 1fr 1fr;") ])([ Concur_VDom_DOM.label(Concur_Core_Types.widgetMultiAlternative(Data_Monoid.monoidArray))(Concur_Core_Types.widgetShiftMap)([  ])([ Concur_VDom_DOM.text(Concur_Core_LiftWidget.widgetLiftWidget)("Nom:") ]), Concur_VDom_DOM.label(Concur_Core_Types.widgetMultiAlternative(Data_Monoid.monoidArray))(Concur_Core_Types.widgetShiftMap)([  ])([ Concur_VDom_DOM.text(Concur_Core_LiftWidget.widgetLiftWidget)("Pr\xe9nom:") ]), Concur_VDom_DOM.label(Concur_Core_Types.widgetMultiAlternative(Data_Monoid.monoidArray))(Concur_Core_Types.widgetShiftMap)([  ])([ Concur_VDom_DOM.text(Concur_Core_LiftWidget.widgetLiftWidget)("Classe:") ]) ])))(function () {
                return Control_Bind.discard(Control_Bind.discardUnit)(Control_Monad_State_Trans.bindStateT(Data_Identity.monadIdentity))(Article.put(Control_Monad_State_Trans.functorStateT(Data_Identity.functorIdentity))(Control_Monad_State_Trans.monadStateStateT(Data_Identity.monadIdentity))(Concur_VDom_DOM.ul(Concur_Core_Types.widgetMultiAlternative(Data_Monoid.monoidArray))(Concur_Core_Types.widgetShiftMap)([  ])([ Concur_VDom_DOM.li(Concur_Core_Types.widgetMultiAlternative(Data_Monoid.monoidArray))(Concur_Core_Types.widgetShiftMap)([  ])([ Concur_VDom_DOM.text(Concur_Core_LiftWidget.widgetLiftWidget)("Les 5 exercices sont ind\xe9pendants.") ]), Concur_VDom_DOM.li(Concur_Core_Types.widgetMultiAlternative(Data_Monoid.monoidArray))(Concur_Core_Types.widgetShiftMap)([  ])([ Concur_VDom_DOM.text(Concur_Core_LiftWidget.widgetLiftWidget)("L'usage de la calculatrice est autoris\xe9.") ]), Concur_VDom_DOM.li(Concur_Core_Types.widgetMultiAlternative(Data_Monoid.monoidArray))(Concur_Core_Types.widgetShiftMap)([  ])([ Concur_VDom_DOM.text(Concur_Core_LiftWidget.widgetLiftWidget)("On veillera \xe0 respecter le format indiqu\xe9 pour les r\xe9sultats num\xe9riques.") ]), Concur_VDom_DOM.li(Concur_Core_Types.widgetMultiAlternative(Data_Monoid.monoidArray))(Concur_Core_Types.widgetShiftMap)([  ])([ Concur_VDom_DOM.text(Concur_Core_LiftWidget.widgetLiftWidget)("La ma\xeetrise de la langue et la pr\xe9sentation rapporteront 1 point.") ]) ])))(function () {
                    return Article.get(Control_Monad_State_Trans.monadStateStateT(Data_Identity.monadIdentity));
                });
            });
        });
    })));
    var ex3 = function (v) {
        return Concur_VDom_DOM["div'"](Concur_Core_Types.widgetMultiAlternative(Data_Monoid.monoidArray))(Concur_Core_Types.widgetShiftMap)([ Concur_VDom_DOM["label'"](Concur_Core_Types.widgetMultiAlternative(Data_Monoid.monoidArray))(Concur_Core_Types.widgetShiftMap)([ Concur_VDom_DOM.text(Concur_Core_LiftWidget.widgetLiftWidget)("Dans un coll\xe8ge de " + (Data_Show.show(Data_Show.showInt)(v.b) + (" \xe9l\xe8ves, " + (Data_Show.show(Data_Show.showInt)(v.a) + " \xe9l\xe8ves affirment manger au moins cinq fruits et l\xe9gumes par jour. ")))) ]), Concur_VDom_DOM.br(Concur_Core_Types.widgetMultiAlternative(Data_Monoid.monoidArray))(Concur_Core_Types.widgetShiftMap)([  ])([  ]), Concur_VDom_DOM["label'"](Concur_Core_Types.widgetMultiAlternative(Data_Monoid.monoidArray))(Concur_Core_Types.widgetShiftMap)([ Concur_VDom_DOM.text(Concur_Core_LiftWidget.widgetLiftWidget)("Donner la fraction irr\xe9ductible repr\xe9sentant la proportion de ces \xe9l\xe8ves.") ]) ]);
    };
    var ex2 = function (v) {
        return Concur_VDom_DOM["div'"](Concur_Core_Types.widgetMultiAlternative(Data_Monoid.monoidArray))(Concur_Core_Types.widgetShiftMap)([ Concur_VDom_DOM["label'"](Concur_Core_Types.widgetMultiAlternative(Data_Monoid.monoidArray))(Concur_Core_Types.widgetShiftMap)([ Concur_VDom_DOM.text(Concur_Core_LiftWidget.widgetLiftWidget)("Deux voitures partent en m\xeame temps de la ligne de d\xe9part et font plusieurs tours d\u2019un m\xeame circuit.") ]), Concur_VDom_DOM.br(Concur_Core_Types.widgetMultiAlternative(Data_Monoid.monoidArray))(Concur_Core_Types.widgetShiftMap)([  ])([  ]), Concur_VDom_DOM["label'"](Concur_Core_Types.widgetMultiAlternative(Data_Monoid.monoidArray))(Concur_Core_Types.widgetShiftMap)([ Concur_VDom_DOM.text(Concur_Core_LiftWidget.widgetLiftWidget)("La voiture A fait le tour du circuit en " + (Data_Show.show(Data_Show.showInt)(v.a) + (" secondes et a voiture B en " + (Data_Show.show(Data_Show.showInt)(v.b) + " secondes. ")))) ]), Concur_VDom_DOM.br(Concur_Core_Types.widgetMultiAlternative(Data_Monoid.monoidArray))(Concur_Core_Types.widgetShiftMap)([  ])([  ]), Concur_VDom_DOM["label'"](Concur_Core_Types.widgetMultiAlternative(Data_Monoid.monoidArray))(Concur_Core_Types.widgetShiftMap)([ Concur_VDom_DOM.text(Concur_Core_LiftWidget.widgetLiftWidget)("Y-a-t-il des moments (autres que le d\xe9part!) o\xf9 les voitures se croisent sur la ligne de d\xe9part ? Expliquer.") ]) ]);
    };
    var ex1 = function (v) {
        return Concur_VDom_DOM["div'"](Concur_Core_Types.widgetMultiAlternative(Data_Monoid.monoidArray))(Concur_Core_Types.widgetShiftMap)([ Concur_VDom_DOM["label'"](Concur_Core_Types.widgetMultiAlternative(Data_Monoid.monoidArray))(Concur_Core_Types.widgetShiftMap)([ Concur_VDom_DOM.text(Concur_Core_LiftWidget.widgetLiftWidget)("Deux amis discutent") ]), Concur_VDom_DOM.br(Concur_Core_Types.widgetMultiAlternative(Data_Monoid.monoidArray))(Concur_Core_Types.widgetShiftMap)([  ])([  ]), Concur_VDom_DOM.br(Concur_Core_Types.widgetMultiAlternative(Data_Monoid.monoidArray))(Concur_Core_Types.widgetShiftMap)([  ])([  ]), Concur_VDom_DOM.em(Concur_Core_Types.widgetMultiAlternative(Data_Monoid.monoidArray))(Concur_Core_Types.widgetShiftMap)([  ])([ Concur_VDom_DOM.text(Concur_Core_LiftWidget.widgetLiftWidget)("\u2022AUREL : ") ]), Concur_VDom_DOM["label'"](Concur_Core_Types.widgetMultiAlternative(Data_Monoid.monoidArray))(Concur_Core_Types.widgetShiftMap)([ Concur_VDom_DOM.text(Concur_Core_LiftWidget.widgetLiftWidget)("Belle p\xeache ! Combien de poissons et de coquillages vas-tu pouvoir vendre au march\xe9 ?") ]), Concur_VDom_DOM.br(Concur_Core_Types.widgetMultiAlternative(Data_Monoid.monoidArray))(Concur_Core_Types.widgetShiftMap)([  ])([  ]), Concur_VDom_DOM.em(Concur_Core_Types.widgetMultiAlternative(Data_Monoid.monoidArray))(Concur_Core_Types.widgetShiftMap)([  ])([ Concur_VDom_DOM.text(Concur_Core_LiftWidget.widgetLiftWidget)("\u2022ANTOINE : ") ]), Concur_VDom_DOM["label'"](Concur_Core_Types.widgetMultiAlternative(Data_Monoid.monoidArray))(Concur_Core_Types.widgetShiftMap)([ Concur_VDom_DOM.text(Concur_Core_LiftWidget.widgetLiftWidget)("En tout, je vais pouvoir vendre au march\xe9 ") ]), Concur_VDom_DOM["label'"](Concur_Core_Types.widgetMultiAlternative(Data_Monoid.monoidArray))(Concur_Core_Types.widgetShiftMap)([ Concur_VDom_DOM.text(Concur_Core_LiftWidget.widgetLiftWidget)(Data_Show.show(Data_Show.showInt)(v.a)) ]), Concur_VDom_DOM["label'"](Concur_Core_Types.widgetMultiAlternative(Data_Monoid.monoidArray))(Concur_Core_Types.widgetShiftMap)([ Concur_VDom_DOM.text(Concur_Core_LiftWidget.widgetLiftWidget)(" poissons et ") ]), Concur_VDom_DOM["label'"](Concur_Core_Types.widgetMultiAlternative(Data_Monoid.monoidArray))(Concur_Core_Types.widgetShiftMap)([ Concur_VDom_DOM.text(Concur_Core_LiftWidget.widgetLiftWidget)(Data_Show.show(Data_Show.showInt)(v.b)) ]), Concur_VDom_DOM["label'"](Concur_Core_Types.widgetMultiAlternative(Data_Monoid.monoidArray))(Concur_Core_Types.widgetShiftMap)([ Concur_VDom_DOM.text(Concur_Core_LiftWidget.widgetLiftWidget)(" coquillages. ") ]), Concur_VDom_DOM.br(Concur_Core_Types.widgetMultiAlternative(Data_Monoid.monoidArray))(Concur_Core_Types.widgetShiftMap)([  ])([  ]), Concur_VDom_DOM.br(Concur_Core_Types.widgetMultiAlternative(Data_Monoid.monoidArray))(Concur_Core_Types.widgetShiftMap)([  ])([  ]), Concur_VDom_DOM["label'"](Concur_Core_Types.widgetMultiAlternative(Data_Monoid.monoidArray))(Concur_Core_Types.widgetShiftMap)([ Concur_VDom_DOM.text(Concur_Core_LiftWidget.widgetLiftWidget)("Antoine est un p\xeacheur professionnel. Il veut vendre des paniers contenant des coquillages et des poissons. Il souhaite concevoir le plus grand nombre possible de paniers identiques. Enfin, il voudrait qu\u2019il ne lui reste aucun coquillage et aucun poisson dans son cong\xe9lateur.") ]), Concur_VDom_DOM.br(Concur_Core_Types.widgetMultiAlternative(Data_Monoid.monoidArray))(Concur_Core_Types.widgetShiftMap)([  ])([  ]), Concur_VDom_DOM.node("ol")(Concur_Core_Types.widgetMultiAlternative(Data_Monoid.monoidArray))(Concur_Core_Types.widgetShiftMap)([  ])([ Concur_VDom_DOM.li(Concur_Core_Types.widgetMultiAlternative(Data_Monoid.monoidArray))(Concur_Core_Types.widgetShiftMap)([  ])([ Concur_VDom_DOM.text(Concur_Core_LiftWidget.widgetLiftWidget)("Peut-il concevoir "), Concur_VDom_DOM.text(Concur_Core_LiftWidget.widgetLiftWidget)(Data_Show.show(Data_Show.showInt)(v.unfit)), Concur_VDom_DOM.text(Concur_Core_LiftWidget.widgetLiftWidget)(" paniers ? Pourquoi ?") ]), Concur_VDom_DOM.li(Concur_Core_Types.widgetMultiAlternative(Data_Monoid.monoidArray))(Concur_Core_Types.widgetShiftMap)([  ])([ Concur_VDom_DOM.text(Concur_Core_LiftWidget.widgetLiftWidget)("Combien de paniers au maximum Antoine pourra t-il concevoir ? Justifier.") ]), Concur_VDom_DOM.li(Concur_Core_Types.widgetMultiAlternative(Data_Monoid.monoidArray))(Concur_Core_Types.widgetShiftMap)([  ])([ Concur_VDom_DOM.text(Concur_Core_LiftWidget.widgetLiftWidget)("Quelle sera la composition de chaque panier ? Justifier.") ]) ]) ]);
    };
    var dfltString = new HasDefault("");
    var dfltPoint = new HasDefault(Data_Geometry_Plane.point("")(0.0)(0.0));
    var dfltInt = new HasDefault(0);
    var dfltArray = function (dictHasDefault) {
        return new HasDefault([  ]);
    };
    var dflt = function (dict) {
        return dict.dflt;
    };
    var nth = function (dictHasDefault) {
        return function (xs) {
            return function (n) {
                var v = Data_Array.index(xs)(n);
                if (v instanceof Data_Maybe.Just) {
                    return v.value0;
                };
                return dflt(dictHasDefault);
            };
        };
    };
    var ex5 = function (v) {
        return Concur_VDom_DOM.div(Concur_Core_Types.widgetMultiAlternative(Data_Monoid.monoidArray))(Concur_Core_Types.widgetShiftMap)([ Concur_VDom_Props.attr("style")("display: grid; grid-template-columns: 3fr 2fr;") ])([ Concur_VDom_DOM["div'"](Concur_Core_Types.widgetMultiAlternative(Data_Monoid.monoidArray))(Concur_Core_Types.widgetShiftMap)(Article.fromIncremental(Control_Bind.discard(Control_Bind.discardUnit)(Control_Monad_State_Trans.bindStateT(Data_Identity.monadIdentity))(Article.t("Pendant les vacances, Robin est all\xe9 visiter le phare Am\xe9d\xe9e."))(function () {
            return Control_Bind.discard(Control_Bind.discardUnit)(Control_Monad_State_Trans.bindStateT(Data_Identity.monadIdentity))(Article.nl)(function () {
                return Control_Bind.discard(Control_Bind.discardUnit)(Control_Monad_State_Trans.bindStateT(Data_Identity.monadIdentity))(Article.nl)(function () {
                    return Control_Bind.discard(Control_Bind.discardUnit)(Control_Monad_State_Trans.bindStateT(Data_Identity.monadIdentity))(Article.t("Lors d'une sieste sur la plage il a remarqu\xe9 que le sommet d'un parasol \xe9tait en parfait alignement avec le sommet du phare. Robin a donc pris quelques mesures et a d\xe9cid\xe9 de faire un sch\xe9ma de la situation dans le sable pour trouver une estimation de la hauteur du phare."))(function () {
                        return Control_Bind.discard(Control_Bind.discardUnit)(Control_Monad_State_Trans.bindStateT(Data_Identity.monadIdentity))(Article.nl)(function () {
                            return Control_Bind.discard(Control_Bind.discardUnit)(Control_Monad_State_Trans.bindStateT(Data_Identity.monadIdentity))(Article.nl)(function () {
                                return Control_Bind.discard(Control_Bind.discardUnit)(Control_Monad_State_Trans.bindStateT(Data_Identity.monadIdentity))(Article.t("Les points "))(function () {
                                    return Control_Bind.discard(Control_Bind.discardUnit)(Control_Monad_State_Trans.bindStateT(Data_Identity.monadIdentity))(Article.m("B"))(function () {
                                        return Control_Bind.discard(Control_Bind.discardUnit)(Control_Monad_State_Trans.bindStateT(Data_Identity.monadIdentity))(Article.t(", "))(function () {
                                            return Control_Bind.discard(Control_Bind.discardUnit)(Control_Monad_State_Trans.bindStateT(Data_Identity.monadIdentity))(Article.m("J"))(function () {
                                                return Control_Bind.discard(Control_Bind.discardUnit)(Control_Monad_State_Trans.bindStateT(Data_Identity.monadIdentity))(Article.t(" et "))(function () {
                                                    return Control_Bind.discard(Control_Bind.discardUnit)(Control_Monad_State_Trans.bindStateT(Data_Identity.monadIdentity))(Article.m("R"))(function () {
                                                        return Control_Bind.discard(Control_Bind.discardUnit)(Control_Monad_State_Trans.bindStateT(Data_Identity.monadIdentity))(Article.t(" sont align\xe9s."))(function () {
                                                            return Control_Bind.discard(Control_Bind.discardUnit)(Control_Monad_State_Trans.bindStateT(Data_Identity.monadIdentity))(Article.nl)(function () {
                                                                return Control_Bind.discard(Control_Bind.discardUnit)(Control_Monad_State_Trans.bindStateT(Data_Identity.monadIdentity))(Article.m("(SB)"))(function () {
                                                                    return Control_Bind.discard(Control_Bind.discardUnit)(Control_Monad_State_Trans.bindStateT(Data_Identity.monadIdentity))(Article.t(" et "))(function () {
                                                                        return Control_Bind.discard(Control_Bind.discardUnit)(Control_Monad_State_Trans.bindStateT(Data_Identity.monadIdentity))(Article.m("(BR)"))(function () {
                                                                            return Control_Bind.discard(Control_Bind.discardUnit)(Control_Monad_State_Trans.bindStateT(Data_Identity.monadIdentity))(Article.t(" sont perpendiculaires."))(function () {
                                                                                return Control_Bind.discard(Control_Bind.discardUnit)(Control_Monad_State_Trans.bindStateT(Data_Identity.monadIdentity))(Article.nl)(function () {
                                                                                    return Control_Bind.discard(Control_Bind.discardUnit)(Control_Monad_State_Trans.bindStateT(Data_Identity.monadIdentity))(Article.m("(PJ)"))(function () {
                                                                                        return Control_Bind.discard(Control_Bind.discardUnit)(Control_Monad_State_Trans.bindStateT(Data_Identity.monadIdentity))(Article.t(" et "))(function () {
                                                                                            return Control_Bind.discard(Control_Bind.discardUnit)(Control_Monad_State_Trans.bindStateT(Data_Identity.monadIdentity))(Article.m("(BR)"))(function () {
                                                                                                return Control_Bind.discard(Control_Bind.discardUnit)(Control_Monad_State_Trans.bindStateT(Data_Identity.monadIdentity))(Article.t(" sont perpendiculaires."))(function () {
                                                                                                    return Control_Bind.discard(Control_Bind.discardUnit)(Control_Monad_State_Trans.bindStateT(Data_Identity.monadIdentity))(Article.nl)(function () {
                                                                                                        return Control_Bind.discard(Control_Bind.discardUnit)(Control_Monad_State_Trans.bindStateT(Data_Identity.monadIdentity))(Article.nl)(function () {
                                                                                                            return Control_Bind.discard(Control_Bind.discardUnit)(Control_Monad_State_Trans.bindStateT(Data_Identity.monadIdentity))(Article.t("Quelle hauteur, arrondie au m\xe8tre, va-t-il trouver \xe0 l'aide de son plan ? Justifier la r\xe9ponse."))(function () {
                                                                                                                return Article.get(Control_Monad_State_Trans.monadStateStateT(Data_Identity.monadIdentity));
                                                                                                            });
                                                                                                        });
                                                                                                    });
                                                                                                });
                                                                                            });
                                                                                        });
                                                                                    });
                                                                                });
                                                                            });
                                                                        });
                                                                    });
                                                                });
                                                            });
                                                        });
                                                    });
                                                });
                                            });
                                        });
                                    });
                                });
                            });
                        });
                    });
                });
            });
        }))), Concur_VDom_SVG.svg(Concur_Core_Types.widgetMultiAlternative(Data_Monoid.monoidArray))(Concur_Core_Types.widgetShiftMap)([ Concur_VDom_SVG.width("400"), Concur_VDom_SVG.height("450") ])((function () {
            var style = [ Concur_VDom_SVG.attr("font-size")("17"), Concur_VDom_SVG.attr("font-weight")("500") ];
            var pL = Data_Geometry_Plane.point("")(280.0)(300.0);
            var pI = Data_Geometry_Plane.point("")(350.0)(400.0);
            var pS = Data_Geometry_Plane.point("S")(40.0)(23.0);
            var pS$prime = Data_Geometry_Plane.point("")(40.0 - 5.0)(23.0);
            var mer = 23.0 + 360.0;
            var pB = Data_Geometry_Plane.point("B")(40.0)(mer);
            var pB$prime = Data_Geometry_Plane.point("")(40.0 - 15.0)(mer);
            var pO = Data_Geometry_Plane.point("")(40.0)(mer + 60.0);
            var plage = 40.0 + 200.0;
            var pJ = Data_Geometry_Plane.point("J")(plage)(mer);
            var pM = Data_Geometry_Plane.point("")(plage)(mer + 30.0);
            var pN$prime = Data_Geometry_Plane.point("")(plage - 30.0)(mer);
            var pP = Data_Geometry_Plane.point("P")(plage)(mer - 100.0);
            var pN = Data_Geometry_Plane.point("")(plage - 30.0)(Data_Geometry_Plane.ord(Data_Geometry_Plane.basedPoint)(pP));
            var pR = Data_Geometry_Plane.rename("R")((function (v2) {
                return nth(dfltPoint)(v2)(0);
            })(Data_Geometry_Plane.meets(Data_Geometry_Plane.interLineLine)(Data_Geometry_Plane.line(pS)(pP))(Data_Geometry_Plane.line(pB)(pJ))));
            var pM$prime = Data_Geometry_Plane.point("")(Data_Geometry_Plane.abs(Data_Geometry_Plane.basedPoint)(pR))(mer + 30.0);
            var pO$prime = Data_Geometry_Plane.point("")(Data_Geometry_Plane.abs(Data_Geometry_Plane.basedPoint)(pR))(mer + 60.0);
            var pQ = Data_Geometry_Plane.point("")(plage)(mer - 30.0);
            var pQ$prime = Data_Geometry_Plane.point("")(plage - 8.0 / 2.0)(mer - 30.0);
            var pQ$prime$prime = Data_Geometry_Plane.point("")(plage + 8.0 / 2.0)(mer - 30.0);
            var pK = Data_Geometry_Plane.middle("")(Data_Geometry_Plane.segment(pP)(pQ$prime$prime)(Data_Maybe.Nothing.value));
            var center = function (p) {
                return function (q) {
                    return function (k) {
                        return function (o) {
                            return Data_Semigroup.append(Data_Semigroup.semigroupArray)(Article.measure(p)(Data_Geometry_Plane.plus(Data_Geometry_Plane.summublePointVector)(p)(Data_Geometry_Plane.scale(k)(Data_Geometry_Plane.vector(p)(q))))(o))(style);
                        };
                    };
                };
            };
            return Data_Semigroup.append(Data_Semigroup.semigroupArray)(Concur_VDom_GeometryRender["render'"](Concur_VDom_GeometryRender.renderSequence(Concur_VDom_GeometryRender.renderSegment))(Concur_VDom_GeometryRender.defaultContext)([ Data_Geometry_Plane.segment(pB)(pS)(Data_Maybe.Nothing.value), Data_Geometry_Plane.segment(pS)(pS$prime)(Data_Maybe.Nothing.value), Data_Geometry_Plane.segment(pS$prime)(pB$prime)(Data_Maybe.Nothing.value), Data_Geometry_Plane.segment(pB$prime)(pR)(Data_Maybe.Nothing.value), Data_Geometry_Plane.segment(pJ)(pQ)(Data_Maybe.Nothing.value), Data_Geometry_Plane.segment(pQ$prime)(pQ$prime$prime)(Data_Maybe.Nothing.value), Data_Geometry_Plane.segment(pQ$prime$prime)(pP)(Data_Maybe.Nothing.value), Data_Geometry_Plane.segment(pP)(pQ$prime)(Data_Maybe.Nothing.value), Data_Geometry_Plane.segment(pO)(pO$prime)(new Data_Maybe.Just("")), Data_Geometry_Plane.segment(pO$prime)(pO)(new Data_Maybe.Just("")), Data_Geometry_Plane.segment(pM)(pM$prime)(new Data_Maybe.Just("")), Data_Geometry_Plane.segment(pM$prime)(pM)(new Data_Maybe.Just("")), Data_Geometry_Plane.segment(pN)(pN$prime)(new Data_Maybe.Just("")), Data_Geometry_Plane.segment(pN$prime)(pN)(new Data_Maybe.Just("")), Data_Geometry_Plane.segment(pI)(pR)(new Data_Maybe.Just("")), Data_Geometry_Plane.segment(pL)(pK)(new Data_Maybe.Just("")) ]))(Data_Semigroup.append(Data_Semigroup.semigroupArray)([ Concur_VDom_SVG.line(Concur_Core_Types.widgetMultiAlternative(Data_Monoid.monoidArray))(Concur_Core_Types.widgetShiftMap)([ Concur_VDom_SVG.attr("x1")(Data_Show.show(Data_Show.showInt)(Data_Int.round(Data_Geometry_Plane.abs(Data_Geometry_Plane.basedPoint)(pS)))), Concur_VDom_SVG.attr("y1")(Data_Show.show(Data_Show.showInt)(Data_Int.round(Data_Geometry_Plane.ord(Data_Geometry_Plane.basedPoint)(pS)))), Concur_VDom_SVG.attr("x2")(Data_Show.show(Data_Show.showInt)(Data_Int.round(Data_Geometry_Plane.abs(Data_Geometry_Plane.basedPoint)(pR)))), Concur_VDom_SVG.attr("y2")(Data_Show.show(Data_Show.showInt)(Data_Int.round(Data_Geometry_Plane.ord(Data_Geometry_Plane.basedPoint)(pR)))), Concur_VDom_SVG.stroke("#000"), Concur_VDom_SVG.strokeWidth(2), Concur_VDom_SVG.attr("stroke-dasharray")("5,5") ])([  ]) ])(Data_Semigroup.append(Data_Semigroup.semigroupArray)(Concur_VDom_GeometryRender["render'"](Concur_VDom_GeometryRender.renderSequence(Concur_VDom_GeometryRender.renderPoint))(Concur_VDom_GeometryRender.defaultContext)([ pS, pB, pP, pJ, pR ]))(Data_Semigroup.append(Data_Semigroup.semigroupArray)(Concur_VDom_GeometryRender["render'"](Concur_VDom_GeometryRender.renderLine)(Concur_VDom_GeometryRender.defaultContext)(Data_Geometry_Plane.line(pB$prime)(pR)))(Data_Semigroup.append(Data_Semigroup.semigroupArray)([ Concur_VDom_SVG.text(Concur_Core_Types.widgetMultiAlternative(Data_Monoid.monoidArray))(Concur_Core_Types.widgetShiftMap)(center(pB$prime)(pS$prime)(0.75)(-9.0))([ Concur_VDom_DOM.text(Concur_Core_LiftWidget.widgetLiftWidget)("Phare") ]), Concur_VDom_SVG.text(Concur_Core_Types.widgetMultiAlternative(Data_Monoid.monoidArray))(Concur_Core_Types.widgetShiftMap)(center(pO)(pO$prime)(0.85)(-9.0))([ Concur_VDom_DOM.text(Concur_Core_LiftWidget.widgetLiftWidget)("34,7 m") ]), Concur_VDom_SVG.text(Concur_Core_Types.widgetMultiAlternative(Data_Monoid.monoidArray))(Concur_Core_Types.widgetShiftMap)(center(pM)(pM$prime)(0.4)(-9.0))([ Concur_VDom_DOM.text(Concur_Core_LiftWidget.widgetLiftWidget)("1,3 m") ]), Concur_VDom_SVG.text(Concur_Core_Types.widgetMultiAlternative(Data_Monoid.monoidArray))(Concur_Core_Types.widgetShiftMap)(center(pN)(pN$prime)(1.4)(12.0))([ Concur_VDom_DOM.text(Concur_Core_LiftWidget.widgetLiftWidget)("2,1 m") ]), Concur_VDom_SVG.text(Concur_Core_Types.widgetMultiAlternative(Data_Monoid.monoidArray))(Concur_Core_Types.widgetShiftMap)(center(pR)(pI)(2.1)(3.0))([ Concur_VDom_DOM.text(Concur_Core_LiftWidget.widgetLiftWidget)("moi") ]), Concur_VDom_SVG.text(Concur_Core_Types.widgetMultiAlternative(Data_Monoid.monoidArray))(Concur_Core_Types.widgetShiftMap)(center(pK)(pL)(2.1)(3.0))([ Concur_VDom_DOM.text(Concur_Core_LiftWidget.widgetLiftWidget)("parasol") ]) ])(Concur_VDom_GeometryRender["render'"](Concur_VDom_GeometryRender.renderSequence(Concur_VDom_GeometryRender.renderRightAngle))(Concur_VDom_GeometryRender.defaultContext)([ Data_Geometry_Plane.rightangle(Data_Geometry_Plane.vector(pB)(pS))(pB)(Data_Geometry_Plane.vector(pB)(pJ))(10.0), Data_Geometry_Plane.rightangle(Data_Geometry_Plane.vector(pJ)(pP))(pJ)(Data_Geometry_Plane.vector(pJ)(pB))(10.0) ]))))));
        })()) ]);
    };
    var randomDataSet = function (r0) {
        var r1 = Rand.rand(r0);
        var r2 = Rand.rand(r1);
        var r3 = Rand.rand(r2);
        var r4 = Rand.rand(r3);
        var primeLines = Rand.unsort(4)(r4);
        var p4 = nth(dfltArray(dfltInt))(primes)(nth(dfltInt)(primeLines)(3));
        var v$prime = nth(dfltInt)(p4)(Data_EuclideanRing.mod(Data_EuclideanRing.euclideanRingInt)(r4.val)(Data_Array.length(p4) - 1 | 0));
        var p3 = nth(dfltArray(dfltInt))(primes)(nth(dfltInt)(primeLines)(2));
        var u$prime = nth(dfltInt)(p3)(Data_EuclideanRing.mod(Data_EuclideanRing.euclideanRingInt)(r3.val)(Data_Array.length(p3) - 1 | 0));
        var p2 = nth(dfltArray(dfltInt))(primes)(nth(dfltInt)(primeLines)(1));
        var p1 = nth(dfltArray(dfltInt))(primes)(nth(dfltInt)(primeLines)(0));
        var g2 = nth(dfltInt)(p2)(Data_EuclideanRing.mod(Data_EuclideanRing.euclideanRingInt)(r2.val)(Data_Array.length(p2) - 1 | 0));
        var g1 = nth(dfltInt)(p1)(Data_EuclideanRing.mod(Data_EuclideanRing.euclideanRingInt)(r1.val)(Data_Array.length(p1) - 1 | 0));
        var g = g1 * g2 | 0;
        var v = (function () {
            var $50 = u$prime < v$prime;
            if ($50) {
                return {
                    a: g * u$prime | 0,
                    b: g * v$prime | 0,
                    u: u$prime,
                    v: v$prime
                };
            };
            return {
                a: g * v$prime | 0,
                b: g * u$prime | 0,
                u: v$prime,
                v: u$prime
            };
        })();
        var unfit = Data_EuclideanRing.div(Data_EuclideanRing.euclideanRingInt)(v.a)(Data_Ord.max(Data_Ord.ordInt)(g1)(g2));
        var p = v.a * v.v | 0;
        var ok = p === (v.b * v.u | 0);
        return {
            a: v.a,
            b: v.b,
            g: g,
            u: v.u,
            v: v.v,
            p: p,
            ok: ok,
            unfit: unfit
        };
    };
    var circumCenter = function (p) {
        return function (q) {
            return function (r) {
                var m2 = mediatrice(p)(r);
                var m1 = mediatrice(p)(q);
                return nth(dfltPoint)(Data_Geometry_Plane.meets(Data_Geometry_Plane.interLineLine)(m1)(m2))(0);
            };
        };
    };
    var ex4 = Concur_VDom_DOM["div'"](Concur_Core_Types.widgetMultiAlternative(Data_Monoid.monoidArray))(Concur_Core_Types.widgetShiftMap)(Article.fromIncremental(Control_Bind.discard(Control_Bind.discardUnit)(Control_Monad_State_Trans.bindStateT(Data_Identity.monadIdentity))(Article.put(Control_Monad_State_Trans.functorStateT(Data_Identity.functorIdentity))(Control_Monad_State_Trans.monadStateStateT(Data_Identity.monadIdentity))(Concur_VDom_DOM.div(Concur_Core_Types.widgetMultiAlternative(Data_Monoid.monoidArray))(Concur_Core_Types.widgetShiftMap)([ Concur_VDom_Props.attr("style")("display: grid; grid-template-columns: 1fr 3fr;") ])([ Concur_VDom_SVG.svg(Concur_Core_Types.widgetMultiAlternative(Data_Monoid.monoidArray))(Concur_Core_Types.widgetShiftMap)([ Concur_VDom_SVG.width("230"), Concur_VDom_SVG.height("170") ])((function () {
        var pC = Data_Geometry_Plane.point("C")(200.0)(120.0);
        var pB = Data_Geometry_Plane.point("B")(190.0)(64.0);
        var pA = Data_Geometry_Plane.point("A")(40.0)(23.0);
        var pO = circumCenter(pA)(pB)(pC);
        var c = Data_Geometry_Plane.circle(pO)(Data_Geometry_Plane.length(Data_Geometry_Plane.measurableVector)(Data_Geometry_Plane.vector(pO)(pB)));
        var bo = Data_Geometry_Plane.line(pB)(pO);
        var pD = Data_Geometry_Plane.rename("D")(nth(dfltPoint)(Data_Geometry_Plane.meets(Data_Geometry_Plane.interLineCircle)(bo)(c))(1));
        var pI = Data_Geometry_Plane.rename("I")((function (v) {
            return nth(dfltPoint)(v)(0);
        })(Data_Geometry_Plane.meets(Data_Geometry_Plane.interLineLine)(Data_Geometry_Plane.line(pB)(pD))(Data_Geometry_Plane.line(pA)(pC))));
        return Data_Semigroup.append(Data_Semigroup.semigroupArray)(Concur_VDom_GeometryRender["render'"](Concur_VDom_GeometryRender.renderSequence(Concur_VDom_GeometryRender.renderPoint))(Concur_VDom_GeometryRender.defaultContext)([ pA, pB, pI, pD, pC ]))(Data_Semigroup.append(Data_Semigroup.semigroupArray)(Concur_VDom_GeometryRender["render'"](Concur_VDom_GeometryRender.renderSequence(Concur_VDom_GeometryRender.renderSegment))(Concur_VDom_GeometryRender.defaultContext)([ Data_Geometry_Plane.segment(pA)(pB)(Data_Maybe.Nothing.value), Data_Geometry_Plane.segment(pC)(pB)(Data_Maybe.Nothing.value), Data_Geometry_Plane.segment(pC)(pD)(Data_Maybe.Nothing.value), Data_Geometry_Plane.segment(pA)(pD)(Data_Maybe.Nothing.value), Data_Geometry_Plane.segment(pA)(pC)(Data_Maybe.Nothing.value), Data_Geometry_Plane.segment(pD)(pB)(Data_Maybe.Nothing.value) ]))(Concur_VDom_GeometryRender["render'"](Concur_VDom_GeometryRender.renderSequence(Concur_VDom_GeometryRender.renderArc))(Concur_VDom_GeometryRender.defaultContext)([ Data_Geometry_Plane.arc(Data_Geometry_Plane.vector(pA)(pB))(pA)(Data_Geometry_Plane.vector(pA)(pC))(30.0)(false)(false)(false)(Data_Maybe.Nothing.value), Data_Geometry_Plane.arc(Data_Geometry_Plane.vector(pD)(pB))(pD)(Data_Geometry_Plane.vector(pD)(pC))(30.0)(false)(false)(false)(Data_Maybe.Nothing.value) ])));
    })()), Concur_VDom_DOM["div'"](Concur_Core_Types.widgetMultiAlternative(Data_Monoid.monoidArray))(Concur_Core_Types.widgetShiftMap)(Article.fromIncremental(Control_Bind.discard(Control_Bind.discardUnit)(Control_Monad_State_Trans.bindStateT(Data_Identity.monadIdentity))(Article.m("ABCD"))(function () {
        return Control_Bind.discard(Control_Bind.discardUnit)(Control_Monad_State_Trans.bindStateT(Data_Identity.monadIdentity))(Article.t(" est un quadrilat\xe8re tel que "))(function () {
            return Control_Bind.discard(Control_Bind.discardUnit)(Control_Monad_State_Trans.bindStateT(Data_Identity.monadIdentity))(Article.m(" \\widehat{BAC}=\\widehat{BDC}"))(function () {
                return Control_Bind.discard(Control_Bind.discardUnit)(Control_Monad_State_Trans.bindStateT(Data_Identity.monadIdentity))(Article.t("."))(function () {
                    return Control_Bind.discard(Control_Bind.discardUnit)(Control_Monad_State_Trans.bindStateT(Data_Identity.monadIdentity))(Article.nl)(function () {
                        return Control_Bind.discard(Control_Bind.discardUnit)(Control_Monad_State_Trans.bindStateT(Data_Identity.monadIdentity))(Article.t(" On note "))(function () {
                            return Control_Bind.discard(Control_Bind.discardUnit)(Control_Monad_State_Trans.bindStateT(Data_Identity.monadIdentity))(Article.m("I"))(function () {
                                return Control_Bind.discard(Control_Bind.discardUnit)(Control_Monad_State_Trans.bindStateT(Data_Identity.monadIdentity))(Article.t(" le point d'intersection des diagonales "))(function () {
                                    return Control_Bind.discard(Control_Bind.discardUnit)(Control_Monad_State_Trans.bindStateT(Data_Identity.monadIdentity))(Article.m("[AC]"))(function () {
                                        return Control_Bind.discard(Control_Bind.discardUnit)(Control_Monad_State_Trans.bindStateT(Data_Identity.monadIdentity))(Article.t(" et "))(function () {
                                            return Control_Bind.discard(Control_Bind.discardUnit)(Control_Monad_State_Trans.bindStateT(Data_Identity.monadIdentity))(Article.m("[BD]"))(function () {
                                                return Control_Bind.discard(Control_Bind.discardUnit)(Control_Monad_State_Trans.bindStateT(Data_Identity.monadIdentity))(Article.t("."))(function () {
                                                    return Article.get(Control_Monad_State_Trans.monadStateStateT(Data_Identity.monadIdentity));
                                                });
                                            });
                                        });
                                    });
                                });
                            });
                        });
                    });
                });
            });
        });
    }))) ])))(function () {
        return Control_Bind.discard(Control_Bind.discardUnit)(Control_Monad_State_Trans.bindStateT(Data_Identity.monadIdentity))(Article.nl)(function () {
            return Control_Bind.discard(Control_Bind.discardUnit)(Control_Monad_State_Trans.bindStateT(Data_Identity.monadIdentity))(Article.b("a. "))(function () {
                return Control_Bind.discard(Control_Bind.discardUnit)(Control_Monad_State_Trans.bindStateT(Data_Identity.monadIdentity))(Article.t("Expliquer pourquoi les angles "))(function () {
                    return Control_Bind.discard(Control_Bind.discardUnit)(Control_Monad_State_Trans.bindStateT(Data_Identity.monadIdentity))(Article.m("\\widehat{AIB}"))(function () {
                        return Control_Bind.discard(Control_Bind.discardUnit)(Control_Monad_State_Trans.bindStateT(Data_Identity.monadIdentity))(Article.t(" et "))(function () {
                            return Control_Bind.discard(Control_Bind.discardUnit)(Control_Monad_State_Trans.bindStateT(Data_Identity.monadIdentity))(Article.m("\\widehat{DIC}"))(function () {
                                return Control_Bind.discard(Control_Bind.discardUnit)(Control_Monad_State_Trans.bindStateT(Data_Identity.monadIdentity))(Article.t(" sont de m\xeame mesure."))(function () {
                                    return Control_Bind.discard(Control_Bind.discardUnit)(Control_Monad_State_Trans.bindStateT(Data_Identity.monadIdentity))(Article.nl)(function () {
                                        return Control_Bind.discard(Control_Bind.discardUnit)(Control_Monad_State_Trans.bindStateT(Data_Identity.monadIdentity))(Article.b("b. "))(function () {
                                            return Control_Bind.discard(Control_Bind.discardUnit)(Control_Monad_State_Trans.bindStateT(Data_Identity.monadIdentity))(Article.t("En d\xe9duire alors que les triangles "))(function () {
                                                return Control_Bind.discard(Control_Bind.discardUnit)(Control_Monad_State_Trans.bindStateT(Data_Identity.monadIdentity))(Article.m("AIB"))(function () {
                                                    return Control_Bind.discard(Control_Bind.discardUnit)(Control_Monad_State_Trans.bindStateT(Data_Identity.monadIdentity))(Article.t(" et "))(function () {
                                                        return Control_Bind.discard(Control_Bind.discardUnit)(Control_Monad_State_Trans.bindStateT(Data_Identity.monadIdentity))(Article.m("DIC"))(function () {
                                                            return Control_Bind.discard(Control_Bind.discardUnit)(Control_Monad_State_Trans.bindStateT(Data_Identity.monadIdentity))(Article.t(" sont semblables."))(function () {
                                                                return Control_Bind.discard(Control_Bind.discardUnit)(Control_Monad_State_Trans.bindStateT(Data_Identity.monadIdentity))(Article.nl)(function () {
                                                                    return Control_Bind.discard(Control_Bind.discardUnit)(Control_Monad_State_Trans.bindStateT(Data_Identity.monadIdentity))(Article.b("c. "))(function () {
                                                                        return Control_Bind.discard(Control_Bind.discardUnit)(Control_Monad_State_Trans.bindStateT(Data_Identity.monadIdentity))(Article.t("Montrer alors que "))(function () {
                                                                            return Control_Bind.discard(Control_Bind.discardUnit)(Control_Monad_State_Trans.bindStateT(Data_Identity.monadIdentity))(Article.m("AI\\times IC = DI \\times IB"))(function () {
                                                                                return Control_Bind.discard(Control_Bind.discardUnit)(Control_Monad_State_Trans.bindStateT(Data_Identity.monadIdentity))(Article.t("."))(function () {
                                                                                    return Article.get(Control_Monad_State_Trans.monadStateStateT(Data_Identity.monadIdentity));
                                                                                });
                                                                            });
                                                                        });
                                                                    });
                                                                });
                                                            });
                                                        });
                                                    });
                                                });
                                            });
                                        });
                                    });
                                });
                            });
                        });
                    });
                });
            });
        });
    })));
    var body = function (st) {
        return Concur_Core_FRP.dyn(Concur_Core_Types.widgetMonad)(Control_Bind.discard(Control_Bind.discardUnit)(Control_Cofree.bindCofree(Concur_Core_Types.widgetAlternative(Data_Monoid.monoidArray)))(Concur_Core_FRP.display(Concur_VDom_DOM.text(Concur_Core_LiftWidget.widgetLiftWidget)("Enonc\xe9 n\xb0 ")))(function () {
            return Control_Bind.bind(Control_Cofree.bindCofree(Concur_Core_Types.widgetAlternative(Data_Monoid.monoidArray)))(Concur_Core_FRP.debounce(Concur_Core_Types.widgetMonad)(Concur_Core_Types.widgetAlt(Data_Monoid.monoidArray))(Concur_Core_Types.widgetMonadAff(Data_Monoid.monoidArray))(50.0)(st)(function (s) {
                return Concur_VDom_DOM.input(Concur_Core_Types.widgetMultiAlternative(Data_Monoid.monoidArray))(Concur_Core_Types.widgetShiftMap)([ Concur_VDom_Props.size(6), Concur_VDom_Props.autoFocus(true), Data_Functor.map(Concur_Core_Props.functorProps)(Data_Functor.map(Data_Functor.functorFn)(function (x) {
                    return {
                        seed: Data_Functor.map(Data_Maybe.functorMaybe)(Data_Show.show(Data_Show.showInt))(Article.validateInput(new Data_Maybe.Just(x))),
                        enabled: false
                    };
                })(Concur_VDom_Props.unsafeTargetValue))(Concur_VDom_Props.onChange), Data_Functor.voidRight(Concur_Core_Props.functorProps)({
                    enabled: Data_Maybe.maybe(false)(Data_Function["const"](true))(Article.validateInput(s.seed)),
                    seed: s.seed
                })(Concur_VDom_Props.onKeyEnter) ]);
            }))(function (newState) {
                var odd = (2 * Data_Ord.abs(Data_Ord.ordInt)(Data_Ring.ringInt)(Data_Maybe.fromMaybe(0)(Article.validateInput(newState.seed))) | 0) + 1 | 0;
                var r0 = Rand.rand({
                    val: odd,
                    gen: 0,
                    seed: odd * odd | 0
                });
                return Concur_Core_FRP.display(Concur_VDom_DOM["div'"](Concur_Core_Types.widgetMultiAlternative(Data_Monoid.monoidArray))(Concur_Core_Types.widgetShiftMap)((function () {
                    var $56 = !newState.enabled;
                    if ($56) {
                        return [  ];
                    };
                    return Article.fromIncremental((function () {
                        var ctx = {
                            strokeWidth: 1.0,
                            fill: Concur_VDom_GeometryRender.defaultContext.fill,
                            fontStyle: Concur_VDom_GeometryRender.defaultContext.fontStyle,
                            stroke: Concur_VDom_GeometryRender.defaultContext.stroke,
                            textFill: Concur_VDom_GeometryRender.defaultContext.textFill
                        };
                        var render = function (dictRender) {
                            return Concur_VDom_GeometryRender["render'"](dictRender)(ctx);
                        };
                        var r1 = Rand.consume(8)(r0);
                        var f = function ($copy_r) {
                            return function ($copy_r$prime) {
                                var $tco_var_r = $copy_r;
                                var $tco_done = false;
                                var $tco_result;
                                function $tco_loop(r, r$prime) {
                                    var $57 = r$prime.val === r.val;
                                    if ($57) {
                                        $tco_var_r = r;
                                        $copy_r$prime = Rand.rand(r$prime);
                                        return;
                                    };
                                    $tco_done = true;
                                    return r$prime;
                                };
                                while (!$tco_done) {
                                    $tco_result = $tco_loop($tco_var_r, $copy_r$prime);
                                };
                                return $tco_result;
                            };
                        };
                        var r2 = f(r1)(Rand.consume(8)(r1));
                        var r3 = f(r2)(Rand.consume(8)(r2));
                        var r5 = f(r2)(Rand.consume(8)(r3));
                        return Control_Bind.discard(Control_Bind.discardUnit)(Control_Monad_State_Trans.bindStateT(Data_Identity.monadIdentity))(Article.nl)(function () {
                            return Control_Bind.discard(Control_Bind.discardUnit)(Control_Monad_State_Trans.bindStateT(Data_Identity.monadIdentity))(opener("Exercice I")("4,5 points"))(function () {
                                var dataSet1 = randomDataSet(r1);
                                return Control_Bind.discard(Control_Bind.discardUnit)(Control_Monad_State_Trans.bindStateT(Data_Identity.monadIdentity))(Article.put(Control_Monad_State_Trans.functorStateT(Data_Identity.functorIdentity))(Control_Monad_State_Trans.monadStateStateT(Data_Identity.monadIdentity))(ex1(dataSet1)))(function () {
                                    return Control_Bind.discard(Control_Bind.discardUnit)(Control_Monad_State_Trans.bindStateT(Data_Identity.monadIdentity))(Article.nl)(function () {
                                        return Control_Bind.discard(Control_Bind.discardUnit)(Control_Monad_State_Trans.bindStateT(Data_Identity.monadIdentity))(Article.nl)(function () {
                                            return Control_Bind.discard(Control_Bind.discardUnit)(Control_Monad_State_Trans.bindStateT(Data_Identity.monadIdentity))(opener("Exercice II")("4,5 points"))(function () {
                                                var dataSet2 = randomDataSet(r2);
                                                return Control_Bind.discard(Control_Bind.discardUnit)(Control_Monad_State_Trans.bindStateT(Data_Identity.monadIdentity))(Article.put(Control_Monad_State_Trans.functorStateT(Data_Identity.functorIdentity))(Control_Monad_State_Trans.monadStateStateT(Data_Identity.monadIdentity))(ex2(dataSet2)))(function () {
                                                    return Control_Bind.discard(Control_Bind.discardUnit)(Control_Monad_State_Trans.bindStateT(Data_Identity.monadIdentity))(Article.nl)(function () {
                                                        return Control_Bind.discard(Control_Bind.discardUnit)(Control_Monad_State_Trans.bindStateT(Data_Identity.monadIdentity))(Article.nl)(function () {
                                                            return Control_Bind.discard(Control_Bind.discardUnit)(Control_Monad_State_Trans.bindStateT(Data_Identity.monadIdentity))(opener("Exercice III")("3 points"))(function () {
                                                                var dataSet3 = randomDataSet(r3);
                                                                return Control_Bind.discard(Control_Bind.discardUnit)(Control_Monad_State_Trans.bindStateT(Data_Identity.monadIdentity))(Article.put(Control_Monad_State_Trans.functorStateT(Data_Identity.functorIdentity))(Control_Monad_State_Trans.monadStateStateT(Data_Identity.monadIdentity))(ex3(dataSet3)))(function () {
                                                                    return Control_Bind.discard(Control_Bind.discardUnit)(Control_Monad_State_Trans.bindStateT(Data_Identity.monadIdentity))(Article.nl)(function () {
                                                                        return Control_Bind.discard(Control_Bind.discardUnit)(Control_Monad_State_Trans.bindStateT(Data_Identity.monadIdentity))(Article.nl)(function () {
                                                                            return Control_Bind.discard(Control_Bind.discardUnit)(Control_Monad_State_Trans.bindStateT(Data_Identity.monadIdentity))(opener("Exercice IV")("4 points"))(function () {
                                                                                return Control_Bind.discard(Control_Bind.discardUnit)(Control_Monad_State_Trans.bindStateT(Data_Identity.monadIdentity))(Article.put(Control_Monad_State_Trans.functorStateT(Data_Identity.functorIdentity))(Control_Monad_State_Trans.monadStateStateT(Data_Identity.monadIdentity))(ex4))(function () {
                                                                                    return Control_Bind.discard(Control_Bind.discardUnit)(Control_Monad_State_Trans.bindStateT(Data_Identity.monadIdentity))(Article.nl)(function () {
                                                                                        return Control_Bind.discard(Control_Bind.discardUnit)(Control_Monad_State_Trans.bindStateT(Data_Identity.monadIdentity))(Article.nl)(function () {
                                                                                            return Control_Bind.discard(Control_Bind.discardUnit)(Control_Monad_State_Trans.bindStateT(Data_Identity.monadIdentity))(opener("Exercice V")("3 points"))(function () {
                                                                                                var dataSet5 = randomDataSet(r5);
                                                                                                return Control_Bind.discard(Control_Bind.discardUnit)(Control_Monad_State_Trans.bindStateT(Data_Identity.monadIdentity))(Article.put(Control_Monad_State_Trans.functorStateT(Data_Identity.functorIdentity))(Control_Monad_State_Trans.monadStateStateT(Data_Identity.monadIdentity))(ex5(dataSet5)))(function () {
                                                                                                    return Control_Bind.discard(Control_Bind.discardUnit)(Control_Monad_State_Trans.bindStateT(Data_Identity.monadIdentity))((function () {
                                                                                                        var $58 = Data_Maybe.fromMaybe(0)(Article.validateInput(newState.seed)) < 0;
                                                                                                        if ($58) {
                                                                                                            return Control_Bind.discard(Control_Bind.discardUnit)(Control_Monad_State_Trans.bindStateT(Data_Identity.monadIdentity))(Article.nl)(function () {
                                                                                                                return Control_Bind.discard(Control_Bind.discardUnit)(Control_Monad_State_Trans.bindStateT(Data_Identity.monadIdentity))(Article.t("r\xe9ponses: "))(function () {
                                                                                                                    return Control_Bind.discard(Control_Bind.discardUnit)(Control_Monad_State_Trans.bindStateT(Data_Identity.monadIdentity))(rep1(dataSet1))(function () {
                                                                                                                        return Control_Bind.discard(Control_Bind.discardUnit)(Control_Monad_State_Trans.bindStateT(Data_Identity.monadIdentity))(rep2(dataSet2))(function () {
                                                                                                                            return Control_Bind.discard(Control_Bind.discardUnit)(Control_Monad_State_Trans.bindStateT(Data_Identity.monadIdentity))(rep3(dataSet3))(function () {
                                                                                                                                return Control_Bind.discard(Control_Bind.discardUnit)(Control_Monad_State_Trans.bindStateT(Data_Identity.monadIdentity))(rep4)(function () {
                                                                                                                                    return rep5(dataSet5);
                                                                                                                                });
                                                                                                                            });
                                                                                                                        });
                                                                                                                    });
                                                                                                                });
                                                                                                            });
                                                                                                        };
                                                                                                        return Control_Applicative.pure(Control_Monad_State_Trans.applicativeStateT(Data_Identity.monadIdentity))(Data_Monoid.mempty(Data_Monoid.monoidUnit));
                                                                                                    })())(function () {
                                                                                                        return Article.get(Control_Monad_State_Trans.monadStateStateT(Data_Identity.monadIdentity));
                                                                                                    });
                                                                                                });
                                                                                            });
                                                                                        });
                                                                                    });
                                                                                });
                                                                            });
                                                                        });
                                                                    });
                                                                });
                                                            });
                                                        });
                                                    });
                                                });
                                            });
                                        });
                                    });
                                });
                            });
                        });
                    })());
                })()));
            });
        }));
    };
    var article = function (state) {
        return Concur_VDom_DOM["div'"](Concur_Core_Types.widgetMultiAlternative(Data_Monoid.monoidArray))(Concur_Core_Types.widgetShiftMap)([ header, body(state) ]);
    };
    var main = Concur_VDom_Run.runWidgetInDom("main")(article(initialState));
    var after = function (letter) {
        return function (n) {
            return Data_String_CodePoints.fromCodePointArray([ Data_Foldable.foldr(Data_Foldable.foldableArray)(Control_Semigroupoid.compose(Control_Semigroupoid.semigroupoidFn))(Control_Category.identity(Control_Category.categoryFn))(Data_Array.replicate(n)((function () {
                var $59 = Data_Enum.succ(Data_String_CodePoints.enumCodePoint);
                return function ($60) {
                    return (function (x) {
                        return Data_Maybe.fromMaybe(letter)(x);
                    })($59($60));
                };
            })()))(letter) ]);
        };
    };
    var showProp = function (props) {
        return function (ord) {
            var templateCols = Data_Foldable.fold(Data_Foldable.foldableArray)(Data_Monoid.monoidString)(Data_Functor.map(Data_Functor.functorArray)(Data_Function["const"](" 1fr"))(props));
            var a = Data_String_CodePoints.codePointFromChar("a");
            return Concur_VDom_DOM.div(Concur_Core_Types.widgetMultiAlternative(Data_Monoid.monoidArray))(Concur_Core_Types.widgetShiftMap)([ Concur_VDom_Props.attr("style")("display: grid; grid-template-columns:" + (templateCols + ";")) ])(Data_Array.mapWithIndex(function (i) {
                return function (v) {
                    return Concur_VDom_DOM.label(Concur_Core_Types.widgetMultiAlternative(Data_Monoid.monoidArray))(Concur_Core_Types.widgetShiftMap)([  ])(Article.fromIncremental(Control_Bind.discard(Control_Bind.discardUnit)(Control_Monad_State_Trans.bindStateT(Data_Identity.monadIdentity))(Article.t(after(a)(i) + ") "))(function () {
                        return Control_Bind.bind(Control_Monad_State_Trans.bindStateT(Data_Identity.monadIdentity))(Article.m(nth(dfltString)(props)(nth(dfltInt)(ord)(i))))(function () {
                            return Article.get(Control_Monad_State_Trans.monadStateStateT(Data_Identity.monadIdentity));
                        });
                    })));
                };
            })(props));
        };
    };
    var showSol = function (reps) {
        return function (ord) {
            var revOrd = Article.invPerm(ord);
            var a = Data_String_CodePoints.codePointFromChar("a");
            return Data_Foldable.foldr(Data_Foldable.foldableArray)(Data_Semigroup.append(Data_Semigroup.semigroupString))("")(Data_Functor.map(Data_Functor.functorArray)((function () {
                var $61 = after(a);
                return function ($62) {
                    return (function (v) {
                        return v + ")";
                    })($61((function (v) {
                        return nth(dfltInt)(revOrd)(v);
                    })($62)));
                };
            })())(reps));
        };
    };
    exports["dflt"] = dflt;
    exports["HasDefault"] = HasDefault;
    exports["showFraction"] = showFraction;
    exports["nth"] = nth;
    exports["after"] = after;
    exports["showProp"] = showProp;
    exports["showSol"] = showSol;
    exports["primes"] = primes;
    exports["randomDataSet"] = randomDataSet;
    exports["ex1"] = ex1;
    exports["rep1"] = rep1;
    exports["ex2"] = ex2;
    exports["rep2"] = rep2;
    exports["ex3"] = ex3;
    exports["rep3"] = rep3;
    exports["mediatrice"] = mediatrice;
    exports["circumCenter"] = circumCenter;
    exports["ex4"] = ex4;
    exports["rep4"] = rep4;
    exports["ex5"] = ex5;
    exports["rep5"] = rep5;
    exports["opener"] = opener;
    exports["body"] = body;
    exports["initialState"] = initialState;
    exports["header"] = header;
    exports["article"] = article;
    exports["main"] = main;
    exports["dfltInt"] = dfltInt;
    exports["dfltString"] = dfltString;
    exports["dfltPoint"] = dfltPoint;
    exports["dfltArray"] = dfltArray;
  })(PS);
  PS["Main"].main();