text: (function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.Router = f()}})(function(){var define,module,exports;return (function(){function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c="function"==typeof require&&require;if(!f&&c)return c(i,!0);if(u)return u(i,!0);var a=new Error("Cannot find module '"+i+"'");throw a.code="MODULE_NOT_FOUND",a}var p=n[i]={exports:{}};e[i][0].call(p.exports,function(r){var n=e[i][1][r];return o(n||r)},p,p.exports,r,e,n,t)}return n[i].exports}for(var u="function"==typeof require&&require,i=0;i<t.length;i++)o(t[i]);return o}return r})()({1:[function(require,module,exports){
  // Generated by purs bundle 0.12.2
  var PS = {};
  (function(exports) {
    // Generated by purs version 0.12.2
    "use strict";
    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["Semigroupoid"] = Semigroupoid;
    exports["semigroupoidFn"] = semigroupoidFn;
  })(PS["Control.Semigroupoid"] = PS["Control.Semigroupoid"] || {});
  (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;
      };
    };   
  
    //------------------------------------------------------------------------------
    // Array size ------------------------------------------------------------------
    //------------------------------------------------------------------------------
  
    exports.length = function (xs) {
      return xs.length;
    };
  
    //------------------------------------------------------------------------------
    // 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;
          };
        };
      };
    };
  
    //------------------------------------------------------------------------------
    // Subarrays -------------------------------------------------------------------
    //------------------------------------------------------------------------------
  
    exports.slice = function (s) {
      return function (e) {
        return function (l) {
          return l.slice(s, e);
        };
      };
    };
  
    exports.take = function (n) {
      return function (l) {
        return n < 1 ? [] : l.slice(0, n);
      };
    };
  
    exports.drop = function (n) {
      return function (l) {
        return n < 1 ? l : l.slice(n);
      };
    };
  })(PS["Data.Array"] = PS["Data.Array"] || {});
  (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) {
    // Generated by purs version 0.12.2
    "use strict";
    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["Category"] = Category;
    exports["identity"] = identity;
    exports["categoryFn"] = categoryFn;
  })(PS["Control.Category"] = PS["Control.Category"] || {});
  (function(exports) {
    // Generated by purs version 0.12.2
    "use strict";
    var otherwise = true;
    exports["otherwise"] = otherwise;
  })(PS["Data.Boolean"] = PS["Data.Boolean"] || {});
  (function(exports) {
      "use strict";
  
    exports.refEq = function (r1) {
      return function (r2) {
        return r1 === r2;
      };
    };
  })(PS["Data.Eq"] = PS["Data.Eq"] || {});
  (function(exports) {
      "use strict";
  
    exports.boolConj = function (b1) {
      return function (b2) {
        return b1 && b2;
      };
    };
  
    exports.boolDisj = function (b1) {
      return function (b2) {
        return b1 || b2;
      };
    };
  
    exports.boolNot = function (b) {
      return !b;
    };
  })(PS["Data.HeytingAlgebra"] = PS["Data.HeytingAlgebra"] || {});
  (function(exports) {
    // Generated by purs version 0.12.2
    "use strict";
    var $foreign = PS["Data.Symbol"];      
    var SProxy = (function () {
        function SProxy() {
  
        };
        SProxy.value = new SProxy();
        return SProxy;
    })();
    var IsSymbol = function (reflectSymbol) {
        this.reflectSymbol = reflectSymbol;
    };
    var reflectSymbol = function (dict) {
        return dict.reflectSymbol;
    };
    exports["IsSymbol"] = IsSymbol;
    exports["reflectSymbol"] = reflectSymbol;
    exports["SProxy"] = SProxy;
  })(PS["Data.Symbol"] = PS["Data.Symbol"] || {});
  (function(exports) {
      "use strict";
  
    exports.unit = {};
  })(PS["Data.Unit"] = PS["Data.Unit"] || {});
  (function(exports) {
      "use strict";
  
    exports.unsafeGet = function (label) {
      return function (rec) {
        return rec[label];
      };
    };
  })(PS["Record.Unsafe"] = PS["Record.Unsafe"] || {});
  (function(exports) {
    // Generated by purs version 0.12.2
    "use strict";
    var $foreign = PS["Record.Unsafe"];
    exports["unsafeGet"] = $foreign.unsafeGet;
  })(PS["Record.Unsafe"] = PS["Record.Unsafe"] || {});
  (function(exports) {
    // Generated by purs version 0.12.2
    "use strict";
    var $foreign = PS["Data.Show"];
    var Data_Symbol = PS["Data.Symbol"];
    var Record_Unsafe = PS["Record.Unsafe"];
    var Type_Data_RowList = PS["Type.Data.RowList"];                 
    var Show = function (show) {
        this.show = show;
    }; 
    var show = function (dict) {
        return dict.show;
    };
    exports["Show"] = Show;
    exports["show"] = show;
  })(PS["Data.Show"] = PS["Data.Show"] || {});
  (function(exports) {
    // Generated by purs version 0.12.2
    "use strict";
    var $foreign = PS["Data.Unit"];
    var Data_Show = PS["Data.Show"];
    exports["unit"] = $foreign.unit;
  })(PS["Data.Unit"] = PS["Data.Unit"] || {});
  (function(exports) {
    // Generated by purs version 0.12.2
    "use strict";
    var $foreign = PS["Data.HeytingAlgebra"];
    var Data_Symbol = PS["Data.Symbol"];
    var Data_Unit = PS["Data.Unit"];
    var Record_Unsafe = PS["Record.Unsafe"];
    var Type_Data_Row = PS["Type.Data.Row"];
    var Type_Data_RowList = PS["Type.Data.RowList"];                 
    var HeytingAlgebra = function (conj, disj, ff, implies, not, tt) {
        this.conj = conj;
        this.disj = disj;
        this.ff = ff;
        this.implies = implies;
        this.not = not;
        this.tt = tt;
    };
    var tt = function (dict) {
        return dict.tt;
    };
    var not = function (dict) {
        return dict.not;
    };
    var implies = function (dict) {
        return dict.implies;
    };
    var ff = function (dict) {
        return dict.ff;
    };
    var disj = function (dict) {
        return dict.disj;
    };
    var heytingAlgebraBoolean = new HeytingAlgebra($foreign.boolConj, $foreign.boolDisj, false, function (a) {
        return function (b) {
            return disj(heytingAlgebraBoolean)(not(heytingAlgebraBoolean)(a))(b);
        };
    }, $foreign.boolNot, true);
    var conj = function (dict) {
        return dict.conj;
    };
    exports["HeytingAlgebra"] = HeytingAlgebra;
    exports["tt"] = tt;
    exports["ff"] = ff;
    exports["implies"] = implies;
    exports["conj"] = conj;
    exports["disj"] = disj;
    exports["not"] = not;
    exports["heytingAlgebraBoolean"] = heytingAlgebraBoolean;
  })(PS["Data.HeytingAlgebra"] = PS["Data.HeytingAlgebra"] || {});
  (function(exports) {
    // Generated by purs version 0.12.2
    "use strict";
    var $foreign = PS["Data.Eq"];
    var Data_HeytingAlgebra = PS["Data.HeytingAlgebra"];
    var Data_Symbol = PS["Data.Symbol"];
    var Data_Unit = PS["Data.Unit"];
    var Data_Void = PS["Data.Void"];
    var Record_Unsafe = PS["Record.Unsafe"];
    var Type_Data_RowList = PS["Type.Data.RowList"];                 
    var Eq = function (eq) {
        this.eq = eq;
    }; 
    var eqString = new Eq($foreign.refEq);
    var eqInt = new Eq($foreign.refEq);
    var eqChar = new Eq($foreign.refEq);
    var eq = function (dict) {
        return dict.eq;
    };
    exports["Eq"] = Eq;
    exports["eq"] = eq;
    exports["eqInt"] = eqInt;
    exports["eqChar"] = eqChar;
    exports["eqString"] = eqString;
  })(PS["Data.Eq"] = PS["Data.Eq"] || {});
  (function(exports) {
      "use strict";
  
    exports.unsafeCompareImpl = function (lt) {
      return function (eq) {
        return function (gt) {
          return function (x) {
            return function (y) {
              return x < y ? lt : x === y ? eq : gt;
            };
          };
        };
      };
    };
  })(PS["Data.Ord.Unsafe"] = PS["Data.Ord.Unsafe"] || {});
  (function(exports) {
      "use strict";
  
    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(exports) {
    // Generated by purs version 0.12.2
    "use strict";
    var $foreign = PS["Data.Semigroup"];
    var Data_Symbol = PS["Data.Symbol"];
    var Data_Unit = PS["Data.Unit"];
    var Data_Void = PS["Data.Void"];
    var Record_Unsafe = PS["Record.Unsafe"];
    var Type_Data_RowList = PS["Type.Data.RowList"];                 
    var Semigroup = function (append) {
        this.append = append;
    }; 
    var semigroupArray = new Semigroup($foreign.concatArray);
    var append = function (dict) {
        return dict.append;
    };
    exports["Semigroup"] = Semigroup;
    exports["append"] = append;
    exports["semigroupArray"] = semigroupArray;
  })(PS["Data.Semigroup"] = PS["Data.Semigroup"] || {});
  (function(exports) {
    // Generated by purs version 0.12.2
    "use strict";
    var Data_Eq = PS["Data.Eq"];
    var Data_Semigroup = PS["Data.Semigroup"];
    var Data_Show = PS["Data.Show"];                 
    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["Data.Ordering"] = PS["Data.Ordering"] || {});
  (function(exports) {
    // Generated by purs version 0.12.2
    "use strict";
    var $foreign = PS["Data.Ord.Unsafe"];
    var Data_Ordering = PS["Data.Ordering"];                 
    var unsafeCompare = $foreign.unsafeCompareImpl(Data_Ordering.LT.value)(Data_Ordering.EQ.value)(Data_Ordering.GT.value);
    exports["unsafeCompare"] = unsafeCompare;
  })(PS["Data.Ord.Unsafe"] = PS["Data.Ord.Unsafe"] || {});
  (function(exports) {
      "use strict";
  
    exports.intSub = function (x) {
      return function (y) {
        /* jshint bitwise: false */
        return x - y | 0;
      };
    };
  })(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;
      };
    };
  })(PS["Data.Semiring"] = PS["Data.Semiring"] || {});
  (function(exports) {
    // Generated by purs version 0.12.2
    "use strict";
    var $foreign = PS["Data.Semiring"];
    var Data_Symbol = PS["Data.Symbol"];
    var Data_Unit = PS["Data.Unit"];
    var Record_Unsafe = PS["Record.Unsafe"];
    var Type_Data_Row = PS["Type.Data.Row"];
    var Type_Data_RowList = PS["Type.Data.RowList"];                 
    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 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;
  })(PS["Data.Semiring"] = PS["Data.Semiring"] || {});
  (function(exports) {
    // Generated by purs version 0.12.2
    "use strict";
    var $foreign = PS["Data.Ring"];
    var Data_Semiring = PS["Data.Semiring"];
    var Data_Symbol = PS["Data.Symbol"];
    var Data_Unit = PS["Data.Unit"];
    var Record_Unsafe = PS["Record.Unsafe"];
    var Type_Data_RowList = PS["Type.Data.RowList"];                 
    var Ring = function (Semiring0, sub) {
        this.Semiring0 = Semiring0;
        this.sub = sub;
    };
    var sub = function (dict) {
        return dict.sub;
    };                  
    var ringInt = new Ring(function () {
        return Data_Semiring.semiringInt;
    }, $foreign.intSub);
    exports["Ring"] = Ring;
    exports["sub"] = sub;
    exports["ringInt"] = ringInt;
  })(PS["Data.Ring"] = PS["Data.Ring"] || {});
  (function(exports) {
    // Generated by purs version 0.12.2
    "use strict";
    var $foreign = PS["Data.Ord"];
    var Data_Eq = PS["Data.Eq"];
    var Data_Ord_Unsafe = PS["Data.Ord.Unsafe"];
    var Data_Ordering = PS["Data.Ordering"];
    var Data_Ring = PS["Data.Ring"];
    var Data_Semiring = PS["Data.Semiring"];
    var Data_Symbol = PS["Data.Symbol"];
    var Data_Unit = PS["Data.Unit"];
    var Data_Void = PS["Data.Void"];
    var Record_Unsafe = PS["Record.Unsafe"];
    var Type_Data_RowList = PS["Type.Data.RowList"];                 
    var Ord = function (Eq0, compare) {
        this.Eq0 = Eq0;
        this.compare = compare;
    }; 
    var ordString = new Ord(function () {
        return Data_Eq.eqString;
    }, Data_Ord_Unsafe.unsafeCompare);
    var ordInt = new Ord(function () {
        return Data_Eq.eqInt;
    }, Data_Ord_Unsafe.unsafeCompare);
    var ordChar = new Ord(function () {
        return Data_Eq.eqChar;
    }, Data_Ord_Unsafe.unsafeCompare);
    var compare = function (dict) {
        return dict.compare;
    };
    exports["Ord"] = Ord;
    exports["compare"] = compare;
    exports["ordInt"] = ordInt;
    exports["ordString"] = ordString;
    exports["ordChar"] = ordChar;
  })(PS["Data.Ord"] = PS["Data.Ord"] || {});
  (function(exports) {
    // Generated by purs version 0.12.2
    "use strict";
    var Control_Category = PS["Control.Category"];
    var Data_Boolean = PS["Data.Boolean"];
    var Data_Ord = PS["Data.Ord"];
    var Data_Ring = PS["Data.Ring"];
    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["Data.Function"] = PS["Data.Function"] || {});
  (function(exports) {
    // Generated by purs version 0.12.2
    "use strict";
    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 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["voidRight"] = voidRight;
    exports["functorFn"] = functorFn;
    exports["functorArray"] = functorArray;
  })(PS["Data.Functor"] = PS["Data.Functor"] || {});
  (function(exports) {
    // Generated by purs version 0.12.2
    "use strict";
    var Data_Functor = PS["Data.Functor"];
    var Data_Semigroup = PS["Data.Semigroup"];                 
    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["Control.Alt"] = PS["Control.Alt"] || {});
  (function(exports) {
    // Generated by purs version 0.12.2
    "use strict";
    var $foreign = 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 applyFirst = function (dictApply) {
        return function (a) {
            return function (b) {
                return apply(dictApply)(Data_Functor.map(dictApply.Functor0())(Data_Function["const"])(a))(b);
            };
        };
    };
    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["applyFirst"] = applyFirst;
    exports["applySecond"] = applySecond;
  })(PS["Control.Apply"] = PS["Control.Apply"] || {});
  (function(exports) {
    // Generated by purs version 0.12.2
    "use strict";
    var Control_Apply = PS["Control.Apply"];
    var Data_Functor = PS["Data.Functor"];
    var Data_Unit = PS["Data.Unit"];                 
    var Applicative = function (Apply0, pure) {
        this.Apply0 = Apply0;
        this.pure = pure;
    };
    var pure = function (dict) {
        return dict.pure;
    };
    exports["Applicative"] = Applicative;
    exports["pure"] = pure;
  })(PS["Control.Applicative"] = PS["Control.Applicative"] || {});
  (function(exports) {
    // Generated by purs version 0.12.2
    "use strict";
    var Control_Alt = PS["Control.Alt"];
    var Data_Functor = PS["Data.Functor"];                 
    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["Control.Plus"] = PS["Control.Plus"] || {});
  (function(exports) {
    // Generated by purs version 0.12.2
    "use strict";
    var Control_Alt = PS["Control.Alt"];
    var Control_Applicative = PS["Control.Applicative"];
    var Control_Apply = PS["Control.Apply"];
    var Control_Plus = PS["Control.Plus"];
    var Data_Functor = PS["Data.Functor"];                 
    var Alternative = function (Applicative0, Plus1) {
        this.Applicative0 = Applicative0;
        this.Plus1 = Plus1;
    };
    exports["Alternative"] = Alternative;
  })(PS["Control.Alternative"] = PS["Control.Alternative"] || {});
  (function(exports) {
    // Generated by purs version 0.12.2
    "use strict";
    var $foreign = PS["Control.Bind"];
    var Control_Applicative = PS["Control.Applicative"];
    var Control_Apply = PS["Control.Apply"];
    var Control_Category = PS["Control.Category"];
    var Data_Function = PS["Data.Function"];
    var Data_Functor = PS["Data.Functor"];
    var Data_Unit = PS["Data.Unit"];                 
    var Bind = function (Apply0, bind) {
        this.Apply0 = Apply0;
        this.bind = bind;
    };
    var Discard = function (discard) {
        this.discard = discard;
    };
    var discard = function (dict) {
        return dict.discard;
    };                     
    var bind = function (dict) {
        return dict.bind;
    };
    var discardUnit = new Discard(function (dictBind) {
        return bind(dictBind);
    });
    exports["Bind"] = Bind;
    exports["bind"] = bind;
    exports["Discard"] = Discard;
    exports["discard"] = discard;
    exports["discardUnit"] = discardUnit;
  })(PS["Control.Bind"] = PS["Control.Bind"] || {});
  (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) {
    // Generated by purs version 0.12.2
    "use strict";
    var Control_Applicative = PS["Control.Applicative"];
    var Control_Apply = PS["Control.Apply"];
    var Control_Bind = PS["Control.Bind"];
    var Data_Functor = PS["Data.Functor"];
    var Data_Unit = PS["Data.Unit"];                 
    var Monad = function (Applicative0, Bind1) {
        this.Applicative0 = Applicative0;
        this.Bind1 = Bind1;
    };
    exports["Monad"] = Monad;
  })(PS["Control.Monad"] = PS["Control.Monad"] || {});
  (function(exports) {
    // Generated by purs version 0.12.2
    "use strict";
    var Control_Alt = PS["Control.Alt"];
    var Control_Alternative = PS["Control.Alternative"];
    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_Unit = PS["Data.Unit"];                 
    var MonadZero = function (Alternative1, Monad0) {
        this.Alternative1 = Alternative1;
        this.Monad0 = Monad0;
    }; 
    var guard = function (dictMonadZero) {
        return function (v) {
            if (v) {
                return Control_Applicative.pure((dictMonadZero.Alternative1()).Applicative0())(Data_Unit.unit);
            };
            if (!v) {
                return Control_Plus.empty((dictMonadZero.Alternative1()).Plus1());
            };
            throw new Error("Failed pattern match at Control.MonadZero (line 54, column 1 - line 54, column 52): " + [ v.constructor.name ]);
        };
    };
    exports["MonadZero"] = MonadZero;
    exports["guard"] = guard;
  })(PS["Control.MonadZero"] = PS["Control.MonadZero"] || {});
  (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(exports) {
    // Generated by purs version 0.12.2
    "use strict";
    var $foreign = PS["Data.Bounded"];
    var Data_Ord = PS["Data.Ord"];
    var Data_Ordering = PS["Data.Ordering"];
    var Data_Unit = PS["Data.Unit"];                 
    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["Data.Bounded"] = PS["Data.Bounded"] || {});
  (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(exports) {
    // Generated by purs version 0.12.2
    "use strict";
    var Data_Ring = PS["Data.Ring"];
    var Data_Semiring = PS["Data.Semiring"];
    var Data_Symbol = PS["Data.Symbol"];
    var Data_Unit = PS["Data.Unit"];                 
    var CommutativeRing = function (Ring0) {
        this.Ring0 = Ring0;
    }; 
    var commutativeRingInt = new CommutativeRing(function () {
        return Data_Ring.ringInt;
    });
    exports["CommutativeRing"] = CommutativeRing;
    exports["commutativeRingInt"] = commutativeRingInt;
  })(PS["Data.CommutativeRing"] = PS["Data.CommutativeRing"] || {});
  (function(exports) {
    // Generated by purs version 0.12.2
    "use strict";
    var $foreign = PS["Data.EuclideanRing"];
    var Data_BooleanAlgebra = PS["Data.BooleanAlgebra"];
    var Data_CommutativeRing = PS["Data.CommutativeRing"];
    var Data_Eq = PS["Data.Eq"];
    var Data_HeytingAlgebra = PS["Data.HeytingAlgebra"];
    var Data_Ring = PS["Data.Ring"];
    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 euclideanRingInt = new EuclideanRing(function () {
        return Data_CommutativeRing.commutativeRingInt;
    }, $foreign.intDegree, $foreign.intDiv, $foreign.intMod);
    var div = function (dict) {
        return dict.div;
    };
    var degree = function (dict) {
        return dict.degree;
    };
    exports["EuclideanRing"] = EuclideanRing;
    exports["degree"] = degree;
    exports["div"] = div;
    exports["mod"] = mod;
    exports["euclideanRingInt"] = euclideanRingInt;
  })(PS["Data.EuclideanRing"] = PS["Data.EuclideanRing"] || {});
  (function(exports) {
    // Generated by purs version 0.12.2
    "use strict";
    var Data_Boolean = PS["Data.Boolean"];
    var Data_Eq = PS["Data.Eq"];
    var Data_EuclideanRing = PS["Data.EuclideanRing"];
    var Data_Ord = PS["Data.Ord"];
    var Data_Ordering = PS["Data.Ordering"];
    var Data_Semigroup = PS["Data.Semigroup"];
    var Data_Symbol = PS["Data.Symbol"];
    var Data_Unit = PS["Data.Unit"];
    var Record_Unsafe = PS["Record.Unsafe"];
    var Type_Data_RowList = PS["Type.Data.RowList"];                 
    var Monoid = function (Semigroup0, mempty) {
        this.Semigroup0 = Semigroup0;
        this.mempty = mempty;
    };
    var mempty = function (dict) {
        return dict.mempty;
    };
    exports["Monoid"] = Monoid;
    exports["mempty"] = mempty;
  })(PS["Data.Monoid"] = PS["Data.Monoid"] || {});
  (function(exports) {
    // Generated by purs version 0.12.2
    "use strict";
    var Control_Alt = PS["Control.Alt"];
    var Control_Alternative = PS["Control.Alternative"];
    var Control_Applicative = PS["Control.Applicative"];
    var Control_Apply = PS["Control.Apply"];
    var Control_Bind = PS["Control.Bind"];
    var Control_Category = PS["Control.Category"];
    var Control_Extend = PS["Control.Extend"];
    var Control_Monad = PS["Control.Monad"];
    var Control_MonadZero = PS["Control.MonadZero"];
    var Control_Plus = PS["Control.Plus"];
    var Data_Bounded = PS["Data.Bounded"];
    var Data_Eq = PS["Data.Eq"];
    var Data_Function = PS["Data.Function"];
    var Data_Functor = PS["Data.Functor"];
    var Data_Functor_Invariant = PS["Data.Functor.Invariant"];
    var Data_Monoid = PS["Data.Monoid"];
    var Data_Ord = PS["Data.Ord"];
    var Data_Ordering = PS["Data.Ordering"];
    var Data_Semigroup = PS["Data.Semigroup"];
    var Data_Show = PS["Data.Show"];
    var Data_Unit = PS["Data.Unit"];
    var Prelude = PS["Prelude"];                 
    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 218, column 1 - line 218, 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 269, column 1 - line 269, 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 67, column 35): " + [ 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 126, column 1 - line 126, column 33): " + [ v.constructor.name, v1.constructor.name ]);
        };
    });
    var applicativeMaybe = new Control_Applicative.Applicative(function () {
        return applyMaybe;
    }, Just.create);
    var monadMaybe = new Control_Monad.Monad(function () {
        return applicativeMaybe;
    }, function () {
        return bindMaybe;
    });
    var altMaybe = new Control_Alt.Alt(function () {
        return functorMaybe;
    }, function (v) {
        return function (v1) {
            if (v instanceof Nothing) {
                return v1;
            };
            return v;
        };
    });
    var plusMaybe = new Control_Plus.Plus(function () {
        return altMaybe;
    }, Nothing.value);
    var alternativeMaybe = new Control_Alternative.Alternative(function () {
        return applicativeMaybe;
    }, function () {
        return plusMaybe;
    });
    var monadZeroMaybe = new Control_MonadZero.MonadZero(function () {
        return alternativeMaybe;
    }, function () {
        return monadMaybe;
    });
    exports["Nothing"] = Nothing;
    exports["Just"] = Just;
    exports["maybe"] = maybe;
    exports["fromMaybe"] = fromMaybe;
    exports["isNothing"] = isNothing;
    exports["fromJust"] = fromJust;
    exports["functorMaybe"] = functorMaybe;
    exports["applyMaybe"] = applyMaybe;
    exports["applicativeMaybe"] = applicativeMaybe;
    exports["altMaybe"] = altMaybe;
    exports["plusMaybe"] = plusMaybe;
    exports["alternativeMaybe"] = alternativeMaybe;
    exports["bindMaybe"] = bindMaybe;
    exports["monadMaybe"] = monadMaybe;
    exports["monadZeroMaybe"] = monadZeroMaybe;
  })(PS["Data.Maybe"] = PS["Data.Maybe"] || {});
  (function(exports) {
    // Generated by purs version 0.12.2
    "use strict";
    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_Bounded = PS["Data.Bounded"];
    var Data_Eq = PS["Data.Eq"];
    var Data_Functor = PS["Data.Functor"];
    var Data_HeytingAlgebra = PS["Data.HeytingAlgebra"];
    var Data_Monoid = PS["Data.Monoid"];
    var Data_Ord = PS["Data.Ord"];
    var Data_Semigroup = PS["Data.Semigroup"];
    var Data_Semiring = PS["Data.Semiring"];
    var Data_Show = PS["Data.Show"];
    var Prelude = PS["Prelude"];                 
    var Disj = function (x) {
        return x;
    };
    var semigroupDisj = function (dictHeytingAlgebra) {
        return new Data_Semigroup.Semigroup(function (v) {
            return function (v1) {
                return Data_HeytingAlgebra.disj(dictHeytingAlgebra)(v)(v1);
            };
        });
    };
    var monoidDisj = function (dictHeytingAlgebra) {
        return new Data_Monoid.Monoid(function () {
            return semigroupDisj(dictHeytingAlgebra);
        }, Data_HeytingAlgebra.ff(dictHeytingAlgebra));
    };
    exports["Disj"] = Disj;
    exports["semigroupDisj"] = semigroupDisj;
    exports["monoidDisj"] = monoidDisj;
  })(PS["Data.Monoid.Disj"] = PS["Data.Monoid.Disj"] || {});
  (function(exports) {
    // Generated by purs version 0.12.2
    "use strict";
    var Control_Semigroupoid = PS["Control.Semigroupoid"];
    var Data_Function = PS["Data.Function"];
    var Data_Functor = PS["Data.Functor"];
    var Data_Monoid_Additive = PS["Data.Monoid.Additive"];
    var Data_Monoid_Conj = PS["Data.Monoid.Conj"];
    var Data_Monoid_Disj = PS["Data.Monoid.Disj"];
    var Data_Monoid_Dual = PS["Data.Monoid.Dual"];
    var Data_Monoid_Endo = PS["Data.Monoid.Endo"];
    var Data_Monoid_Multiplicative = PS["Data.Monoid.Multiplicative"];
    var Data_Semigroup_First = PS["Data.Semigroup.First"];
    var Data_Semigroup_Last = PS["Data.Semigroup.Last"];
    var Prelude = PS["Prelude"];                 
    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;
    };                        
    var newtypeDisj = new Newtype(function (v) {
        return v;
    }, Data_Monoid_Disj.Disj);
    var alaF = function (dictFunctor) {
        return function (dictFunctor1) {
            return function (dictNewtype) {
                return function (dictNewtype1) {
                    return function (v) {
                        return function (f) {
                            return function ($80) {
                                return Data_Functor.map(dictFunctor1)(unwrap(dictNewtype1))(f(Data_Functor.map(dictFunctor)(wrap(dictNewtype))($80)));
                            };
                        };
                    };
                };
            };
        };
    };
    exports["unwrap"] = unwrap;
    exports["wrap"] = wrap;
    exports["Newtype"] = Newtype;
    exports["alaF"] = alaF;
    exports["newtypeDisj"] = newtypeDisj;
  })(PS["Data.Newtype"] = PS["Data.Newtype"] || {});
  (function(exports) {
    // Generated by purs version 0.12.2
    "use strict";
    var $foreign = PS["Data.Foldable"];
    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_Category = PS["Control.Category"];
    var Control_Plus = PS["Control.Plus"];
    var Control_Semigroupoid = PS["Control.Semigroupoid"];
    var Data_Eq = PS["Data.Eq"];
    var Data_Function = PS["Data.Function"];
    var Data_Functor = PS["Data.Functor"];
    var Data_HeytingAlgebra = PS["Data.HeytingAlgebra"];
    var Data_Maybe = PS["Data.Maybe"];
    var Data_Maybe_First = PS["Data.Maybe.First"];
    var Data_Maybe_Last = PS["Data.Maybe.Last"];
    var Data_Monoid = PS["Data.Monoid"];
    var Data_Monoid_Additive = PS["Data.Monoid.Additive"];
    var Data_Monoid_Conj = PS["Data.Monoid.Conj"];
    var Data_Monoid_Disj = PS["Data.Monoid.Disj"];
    var Data_Monoid_Dual = PS["Data.Monoid.Dual"];
    var Data_Monoid_Endo = PS["Data.Monoid.Endo"];
    var Data_Monoid_Multiplicative = PS["Data.Monoid.Multiplicative"];
    var Data_Newtype = PS["Data.Newtype"];
    var Data_Ord = PS["Data.Ord"];
    var Data_Ordering = PS["Data.Ordering"];
    var Data_Semigroup = PS["Data.Semigroup"];
    var Data_Semiring = PS["Data.Semiring"];
    var Data_Unit = PS["Data.Unit"];
    var Prelude = PS["Prelude"];                 
    var Foldable = function (foldMap, foldl, foldr) {
        this.foldMap = foldMap;
        this.foldl = foldl;
        this.foldr = foldr;
    };
    var foldr = function (dict) {
        return dict.foldr;
    };
    var oneOf = function (dictFoldable) {
        return function (dictPlus) {
            return foldr(dictFoldable)(Control_Alt.alt(dictPlus.Alt0()))(Control_Plus.empty(dictPlus));
        };
    };
    var foldl = function (dict) {
        return dict.foldl;
    }; 
    var foldableMaybe = new Foldable(function (dictMonoid) {
        return function (f) {
            return function (v) {
                if (v instanceof Data_Maybe.Nothing) {
                    return Data_Monoid.mempty(dictMonoid);
                };
                if (v instanceof Data_Maybe.Just) {
                    return f(v.value0);
                };
                throw new Error("Failed pattern match at Data.Foldable (line 129, column 1 - line 129, column 41): " + [ f.constructor.name, v.constructor.name ]);
            };
        };
    }, function (v) {
        return function (z) {
            return function (v1) {
                if (v1 instanceof Data_Maybe.Nothing) {
                    return z;
                };
                if (v1 instanceof Data_Maybe.Just) {
                    return v(z)(v1.value0);
                };
                throw new Error("Failed pattern match at Data.Foldable (line 129, column 1 - line 129, column 41): " + [ v.constructor.name, z.constructor.name, v1.constructor.name ]);
            };
        };
    }, function (v) {
        return function (z) {
            return function (v1) {
                if (v1 instanceof Data_Maybe.Nothing) {
                    return z;
                };
                if (v1 instanceof Data_Maybe.Just) {
                    return v(v1.value0)(z);
                };
                throw new Error("Failed pattern match at Data.Foldable (line 129, column 1 - line 129, column 41): " + [ v.constructor.name, z.constructor.name, v1.constructor.name ]);
            };
        };
    });
    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 find = function (dictFoldable) {
        return function (p) {
            var go = function (v) {
                return function (v1) {
                    if (v instanceof Data_Maybe.Nothing && p(v1)) {
                        return new Data_Maybe.Just(v1);
                    };
                    return v;
                };
            };
            return foldl(dictFoldable)(go)(Data_Maybe.Nothing.value);
        };
    };
    var any = function (dictFoldable) {
        return function (dictHeytingAlgebra) {
            return Data_Newtype.alaF(Data_Functor.functorFn)(Data_Functor.functorFn)(Data_Newtype.newtypeDisj)(Data_Newtype.newtypeDisj)(Data_Monoid_Disj.Disj)(foldMap(dictFoldable)(Data_Monoid_Disj.monoidDisj(dictHeytingAlgebra)));
        };
    };
    var elem = function (dictFoldable) {
        return function (dictEq) {
            return function ($199) {
                return any(dictFoldable)(Data_HeytingAlgebra.heytingAlgebraBoolean)(Data_Eq.eq(dictEq)($199));
            };
        };
    };
    exports["Foldable"] = Foldable;
    exports["foldr"] = foldr;
    exports["foldl"] = foldl;
    exports["foldMap"] = foldMap;
    exports["foldMapDefaultR"] = foldMapDefaultR;
    exports["oneOf"] = oneOf;
    exports["any"] = any;
    exports["elem"] = elem;
    exports["find"] = find;
    exports["foldableArray"] = foldableArray;
    exports["foldableMaybe"] = foldableMaybe;
  })(PS["Data.Foldable"] = PS["Data.Foldable"] || {});
  (function(exports) {
      "use strict";
  
    // jshint maxparams: 3
  
    exports.traverseArrayImpl = function () {
      function array1(a) {
        return [a];
      }
  
      function array2(a) {
        return function (b) {
          return [a, b];
        };
      }
  
      function array3(a) {
        return function (b) {
          return function (c) {
            return [a, b, c];
          };
        };
      }
  
      function concat2(xs) {
        return function (ys) {
          return xs.concat(ys);
        };
      }
  
      return function (apply) {
        return function (map) {
          return function (pure) {
            return function (f) {
              return function (array) {
                function go(bot, top) {
                  switch (top - bot) {
                  case 0: return pure([]);
                  case 1: return map(array1)(f(array[bot]));
                  case 2: return apply(map(array2)(f(array[bot])))(f(array[bot + 1]));
                  case 3: return apply(apply(map(array3)(f(array[bot])))(f(array[bot + 1])))(f(array[bot + 2]));
                  default:
                    // This slightly tricky pivot selection aims to produce two
                    // even-length partitions where possible.
                    var pivot = bot + Math.floor((top - bot) / 4) * 2;
                    return apply(map(concat2)(go(bot, pivot)))(go(pivot, top));
                  }
                }
                return go(0, array.length);
              };
            };
          };
        };
      };
    }();
  })(PS["Data.Traversable"] = PS["Data.Traversable"] || {});
  (function(exports) {
    // Generated by purs version 0.12.2
    "use strict";
    var $foreign = PS["Data.Traversable"];
    var Control_Applicative = PS["Control.Applicative"];
    var Control_Apply = PS["Control.Apply"];
    var Control_Category = PS["Control.Category"];
    var Data_Foldable = PS["Data.Foldable"];
    var Data_Functor = PS["Data.Functor"];
    var Data_Maybe = PS["Data.Maybe"];
    var Data_Maybe_First = PS["Data.Maybe.First"];
    var Data_Maybe_Last = PS["Data.Maybe.Last"];
    var Data_Monoid_Additive = PS["Data.Monoid.Additive"];
    var Data_Monoid_Conj = PS["Data.Monoid.Conj"];
    var Data_Monoid_Disj = PS["Data.Monoid.Disj"];
    var Data_Monoid_Dual = PS["Data.Monoid.Dual"];
    var Data_Monoid_Multiplicative = PS["Data.Monoid.Multiplicative"];
    var Data_Traversable_Accum = PS["Data.Traversable.Accum"];
    var Data_Traversable_Accum_Internal = PS["Data.Traversable.Accum.Internal"];
    var Prelude = PS["Prelude"];                 
    var Traversable = function (Foldable1, Functor0, sequence, traverse) {
        this.Foldable1 = Foldable1;
        this.Functor0 = Functor0;
        this.sequence = sequence;
        this.traverse = traverse;
    };
    var traverse = function (dict) {
        return dict.traverse;
    }; 
    var sequenceDefault = function (dictTraversable) {
        return function (dictApplicative) {
            return traverse(dictTraversable)(dictApplicative)(Control_Category.identity(Control_Category.categoryFn));
        };
    };
    var traversableArray = new Traversable(function () {
        return Data_Foldable.foldableArray;
    }, function () {
        return Data_Functor.functorArray;
    }, function (dictApplicative) {
        return sequenceDefault(traversableArray)(dictApplicative);
    }, function (dictApplicative) {
        return $foreign.traverseArrayImpl(Control_Apply.apply(dictApplicative.Apply0()))(Data_Functor.map((dictApplicative.Apply0()).Functor0()))(Control_Applicative.pure(dictApplicative));
    });
    var sequence = function (dict) {
        return dict.sequence;
    };
    exports["Traversable"] = Traversable;
    exports["traverse"] = traverse;
    exports["sequence"] = sequence;
    exports["sequenceDefault"] = sequenceDefault;
    exports["traversableArray"] = traversableArray;
  })(PS["Data.Traversable"] = PS["Data.Traversable"] || {});
  (function(exports) {
    // Generated by purs version 0.12.2
    "use strict";
    var Control_Applicative = PS["Control.Applicative"];
    var Control_Apply = PS["Control.Apply"];
    var Control_Biapplicative = PS["Control.Biapplicative"];
    var Control_Biapply = PS["Control.Biapply"];
    var Control_Bind = PS["Control.Bind"];
    var Control_Comonad = PS["Control.Comonad"];
    var Control_Extend = PS["Control.Extend"];
    var Control_Lazy = PS["Control.Lazy"];
    var Control_Monad = PS["Control.Monad"];
    var Control_Semigroupoid = PS["Control.Semigroupoid"];
    var Data_Bifoldable = PS["Data.Bifoldable"];
    var Data_Bifunctor = PS["Data.Bifunctor"];
    var Data_Bitraversable = PS["Data.Bitraversable"];
    var Data_BooleanAlgebra = PS["Data.BooleanAlgebra"];
    var Data_Bounded = PS["Data.Bounded"];
    var Data_CommutativeRing = PS["Data.CommutativeRing"];
    var Data_Distributive = PS["Data.Distributive"];
    var Data_Eq = PS["Data.Eq"];
    var Data_Foldable = PS["Data.Foldable"];
    var Data_FoldableWithIndex = PS["Data.FoldableWithIndex"];
    var Data_Function = PS["Data.Function"];
    var Data_Functor = PS["Data.Functor"];
    var Data_Functor_Invariant = PS["Data.Functor.Invariant"];
    var Data_FunctorWithIndex = PS["Data.FunctorWithIndex"];
    var Data_HeytingAlgebra = PS["Data.HeytingAlgebra"];
    var Data_Maybe = PS["Data.Maybe"];
    var Data_Maybe_First = PS["Data.Maybe.First"];
    var Data_Monoid = PS["Data.Monoid"];
    var Data_Newtype = PS["Data.Newtype"];
    var Data_Ord = PS["Data.Ord"];
    var Data_Ordering = PS["Data.Ordering"];
    var Data_Ring = PS["Data.Ring"];
    var Data_Semigroup = PS["Data.Semigroup"];
    var Data_Semigroup_Foldable = PS["Data.Semigroup.Foldable"];
    var Data_Semigroup_Traversable = PS["Data.Semigroup.Traversable"];
    var Data_Semiring = PS["Data.Semiring"];
    var Data_Show = PS["Data.Show"];
    var Data_Traversable = PS["Data.Traversable"];
    var Data_TraversableWithIndex = PS["Data.TraversableWithIndex"];
    var Data_Unit = PS["Data.Unit"];
    var Prelude = PS["Prelude"];
    var Type_Equality = PS["Type.Equality"];                 
    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 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["functorTuple"] = functorTuple;
  })(PS["Data.Tuple"] = PS["Data.Tuple"] || {});
  (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(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(exports) {
    // Generated by purs version 0.12.2
    "use strict";
    var $foreign = PS["Data.Unfoldable1"];
    var Data_Boolean = PS["Data.Boolean"];
    var Data_Eq = PS["Data.Eq"];
    var Data_Maybe = PS["Data.Maybe"];
    var Data_Ord = PS["Data.Ord"];
    var Data_Ring = PS["Data.Ring"];
    var Data_Semigroup_Traversable = PS["Data.Semigroup.Traversable"];
    var Data_Semiring = PS["Data.Semiring"];
    var Data_Tuple = PS["Data.Tuple"];
    var Partial_Unsafe = PS["Partial.Unsafe"];
    var Prelude = PS["Prelude"];                 
    var Unfoldable1 = function (unfoldr1) {
        this.unfoldr1 = unfoldr1;
    };
    var unfoldr1 = function (dict) {
        return dict.unfoldr1;
    };
    var unfoldable1Array = new Unfoldable1($foreign.unfoldr1ArrayImpl(Data_Maybe.isNothing)(Data_Maybe.fromJust())(Data_Tuple.fst)(Data_Tuple.snd));
    exports["Unfoldable1"] = Unfoldable1;
    exports["unfoldr1"] = unfoldr1;
    exports["unfoldable1Array"] = unfoldable1Array;
  })(PS["Data.Unfoldable1"] = PS["Data.Unfoldable1"] || {});
  (function(exports) {
    // Generated by purs version 0.12.2
    "use strict";
    var $foreign = PS["Data.Unfoldable"];
    var Data_Function = PS["Data.Function"];
    var Data_Functor = PS["Data.Functor"];
    var Data_Maybe = PS["Data.Maybe"];
    var Data_Ord = PS["Data.Ord"];
    var Data_Ring = PS["Data.Ring"];
    var Data_Traversable = PS["Data.Traversable"];
    var Data_Tuple = PS["Data.Tuple"];
    var Data_Unfoldable1 = PS["Data.Unfoldable1"];
    var Data_Unit = PS["Data.Unit"];
    var Partial_Unsafe = PS["Partial.Unsafe"];
    var Prelude = PS["Prelude"];                 
    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["Data.Unfoldable"] = PS["Data.Unfoldable"] || {});
  (function(exports) {
    // Generated by purs version 0.12.2
    "use strict";
    var $foreign = PS["Data.Array"];
    var Control_Alt = PS["Control.Alt"];
    var Control_Alternative = PS["Control.Alternative"];
    var Control_Applicative = PS["Control.Applicative"];
    var Control_Apply = PS["Control.Apply"];
    var Control_Bind = PS["Control.Bind"];
    var Control_Category = PS["Control.Category"];
    var Control_Lazy = PS["Control.Lazy"];
    var Control_Monad_Rec_Class = PS["Control.Monad.Rec.Class"];
    var Control_Monad_ST = PS["Control.Monad.ST"];
    var Control_Monad_ST_Internal = PS["Control.Monad.ST.Internal"];
    var Control_Semigroupoid = PS["Control.Semigroupoid"];
    var Data_Array_NonEmpty_Internal = PS["Data.Array.NonEmpty.Internal"];
    var Data_Array_ST = PS["Data.Array.ST"];
    var Data_Array_ST_Iterator = PS["Data.Array.ST.Iterator"];
    var Data_Boolean = PS["Data.Boolean"];
    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_HeytingAlgebra = PS["Data.HeytingAlgebra"];
    var Data_Maybe = PS["Data.Maybe"];
    var Data_Ord = PS["Data.Ord"];
    var Data_Ordering = PS["Data.Ordering"];
    var Data_Ring = PS["Data.Ring"];
    var Data_Semigroup = PS["Data.Semigroup"];
    var Data_Semiring = PS["Data.Semiring"];
    var Data_Traversable = PS["Data.Traversable"];
    var Data_Tuple = PS["Data.Tuple"];
    var Data_Unfoldable = PS["Data.Unfoldable"];
    var Partial_Unsafe = PS["Partial.Unsafe"];
    var Prelude = PS["Prelude"];
    var Unsafe_Coerce = PS["Unsafe.Coerce"];
    var takeEnd = function (n) {
        return function (xs) {
            return $foreign.drop($foreign.length(xs) - n | 0)(xs);
        };
    };
    var index = $foreign.indexImpl(Data_Maybe.Just.create)(Data_Maybe.Nothing.value);
    var last = function (xs) {
        return index(xs)($foreign.length(xs) - 1 | 0);
    };
    var head = function (xs) {
        return index(xs)(0);
    };
    var findIndex = $foreign.findIndexImpl(Data_Maybe.Just.create)(Data_Maybe.Nothing.value);
    exports["head"] = head;
    exports["last"] = last;
    exports["index"] = index;
    exports["findIndex"] = findIndex;
    exports["takeEnd"] = takeEnd;
    exports["range"] = $foreign.range;
    exports["length"] = $foreign.length;
    exports["take"] = $foreign.take;
  })(PS["Data.Array"] = PS["Data.Array"] || {});
  (function(exports) {
      "use strict";
    /* global Symbol */
  
    var hasArrayFrom = typeof Array.from === "function";
    var hasStringIterator =
      typeof Symbol !== "undefined" &&
      Symbol != null &&
      typeof Symbol.iterator !== "undefined" &&
      typeof String.prototype[Symbol.iterator] === "function";
    var hasFromCodePoint = typeof String.prototype.fromCodePoint === "function";
    var hasCodePointAt = typeof String.prototype.codePointAt === "function";
  
    exports._unsafeCodePointAt0 = function (fallback) {
      return hasCodePointAt
        ? function (str) { return str.codePointAt(0); }
        : fallback;
    };
  
    exports._singleton = function (fallback) {
      return hasFromCodePoint ? String.fromCodePoint : fallback;
    };
  
    exports._take = function (fallback) {
      return function (n) {
        if (hasStringIterator) {
          return function (str) {
            var accum = "";
            var iter = str[Symbol.iterator]();
            for (var i = 0; i < n; ++i) {
              var o = iter.next();
              if (o.done) return accum;
              accum += o.value;
            }
            return accum;
          };
        }
        return fallback(n);
      };
    };
  
    exports._toCodePointArray = function (fallback) {
      return function (unsafeCodePointAt0) {
        if (hasArrayFrom) {
          return function (str) {
            return Array.from(str, unsafeCodePointAt0);
          };
        }
        return fallback;
      };
    };
  })(PS["Data.String.CodePoints"] = PS["Data.String.CodePoints"] || {});
  (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(exports) {
    // Generated by purs version 0.12.2
    "use strict";
    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_Extend = PS["Control.Extend"];
    var Control_Monad = PS["Control.Monad"];
    var Control_Semigroupoid = PS["Control.Semigroupoid"];
    var Data_Bifoldable = PS["Data.Bifoldable"];
    var Data_Bifunctor = PS["Data.Bifunctor"];
    var Data_Bitraversable = PS["Data.Bitraversable"];
    var Data_Bounded = PS["Data.Bounded"];
    var Data_Eq = PS["Data.Eq"];
    var Data_Foldable = PS["Data.Foldable"];
    var Data_FoldableWithIndex = PS["Data.FoldableWithIndex"];
    var Data_Function = PS["Data.Function"];
    var Data_Functor = PS["Data.Functor"];
    var Data_Functor_Invariant = PS["Data.Functor.Invariant"];
    var Data_FunctorWithIndex = PS["Data.FunctorWithIndex"];
    var Data_Maybe = PS["Data.Maybe"];
    var Data_Monoid = PS["Data.Monoid"];
    var Data_Ord = PS["Data.Ord"];
    var Data_Ordering = PS["Data.Ordering"];
    var Data_Semigroup = PS["Data.Semigroup"];
    var Data_Show = PS["Data.Show"];
    var Data_Traversable = PS["Data.Traversable"];
    var Data_TraversableWithIndex = PS["Data.TraversableWithIndex"];
    var Data_Unit = PS["Data.Unit"];
    var Prelude = PS["Prelude"];                 
    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 8 - line 38, column 52): " + [ m.constructor.name ]);
        };
    });
    exports["Left"] = Left;
    exports["Right"] = Right;
    exports["functorEither"] = functorEither;
  })(PS["Data.Either"] = PS["Data.Either"] || {});
  (function(exports) {
    // Generated by purs version 0.12.2
    "use strict";
    var $foreign = PS["Data.Enum"];
    var Control_Apply = PS["Control.Apply"];
    var Control_Bind = PS["Control.Bind"];
    var Control_MonadPlus = PS["Control.MonadPlus"];
    var Control_MonadZero = PS["Control.MonadZero"];
    var Control_Semigroupoid = PS["Control.Semigroupoid"];
    var Data_Boolean = PS["Data.Boolean"];
    var Data_Bounded = PS["Data.Bounded"];
    var Data_Either = PS["Data.Either"];
    var Data_Eq = PS["Data.Eq"];
    var Data_Function = PS["Data.Function"];
    var Data_Functor = PS["Data.Functor"];
    var Data_HeytingAlgebra = PS["Data.HeytingAlgebra"];
    var Data_Maybe = PS["Data.Maybe"];
    var Data_Newtype = PS["Data.Newtype"];
    var Data_Ord = PS["Data.Ord"];
    var Data_Ordering = PS["Data.Ordering"];
    var Data_Ring = PS["Data.Ring"];
    var Data_Semigroup = PS["Data.Semigroup"];
    var Data_Semiring = PS["Data.Semiring"];
    var Data_Show = PS["Data.Show"];
    var Data_Tuple = PS["Data.Tuple"];
    var Data_Unfoldable = PS["Data.Unfoldable"];
    var Data_Unfoldable1 = PS["Data.Unfoldable1"];
    var Data_Unit = PS["Data.Unit"];
    var Partial_Unsafe = PS["Partial.Unsafe"];
    var Prelude = PS["Prelude"];
    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 pred = function (dict) {
        return dict.pred;
    };              
    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 $51 = x < fromEnum(dictBoundedEnum)(Data_Bounded.bottom(dictBoundedEnum.Bounded0()));
                        if ($51) {
                            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 cardinality = function (dict) {
        return dict.cardinality;
    }; 
    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["pred"] = pred;
    exports["BoundedEnum"] = BoundedEnum;
    exports["cardinality"] = cardinality;
    exports["toEnum"] = toEnum;
    exports["fromEnum"] = fromEnum;
    exports["toEnumWithDefaults"] = toEnumWithDefaults;
    exports["defaultSucc"] = defaultSucc;
    exports["defaultPred"] = defaultPred;
    exports["enumChar"] = enumChar;
    exports["boundedEnumChar"] = boundedEnumChar;
  })(PS["Data.Enum"] = PS["Data.Enum"] || {});
  (function(exports) {
      "use strict";
  
    exports.fromStringAsImpl = function (just) {
      return function (nothing) {
        return function (radix) {
          var digits;
          if (radix < 11) {
            digits = "[0-" + (radix - 1).toString() + "]";
          } else if (radix === 11) {
            digits = "[0-9a]";
          } else {
            digits = "[0-9a-" + String.fromCharCode(86 + radix) + "]";
          }
          var pattern = new RegExp("^[\\+\\-]?" + digits + "+$", "i");
  
          return function (s) {
            /* jshint bitwise: false */
            if (pattern.test(s)) {
              var i = parseInt(s, radix);
              return (i | 0) === i ? just(i) : nothing;
            } else {
              return nothing;
            }
          };
        };
      };
    };
  })(PS["Data.Int"] = PS["Data.Int"] || {});
  (function(exports) {
    // Generated by purs version 0.12.2
    "use strict";
    var $foreign = PS["Data.Int"];
    var Control_Category = PS["Control.Category"];
    var Control_Semigroupoid = PS["Control.Semigroupoid"];
    var Data_Boolean = PS["Data.Boolean"];
    var Data_Bounded = PS["Data.Bounded"];
    var Data_CommutativeRing = PS["Data.CommutativeRing"];
    var Data_DivisionRing = PS["Data.DivisionRing"];
    var Data_Eq = PS["Data.Eq"];
    var Data_EuclideanRing = PS["Data.EuclideanRing"];
    var Data_HeytingAlgebra = PS["Data.HeytingAlgebra"];
    var Data_Int_Bits = PS["Data.Int.Bits"];
    var Data_Maybe = PS["Data.Maybe"];
    var Data_Ord = PS["Data.Ord"];
    var Data_Ordering = PS["Data.Ordering"];
    var Data_Ring = PS["Data.Ring"];
    var Data_Semiring = PS["Data.Semiring"];
    var Data_Show = PS["Data.Show"];
    var Global = PS["Global"];
    var $$Math = PS["Math"];
    var Prelude = PS["Prelude"];
    var fromStringAs = $foreign.fromStringAsImpl(Data_Maybe.Just.create)(Data_Maybe.Nothing.value);
    var fromString = fromStringAs(10);
    exports["fromString"] = fromString;
    exports["fromStringAs"] = fromStringAs;
  })(PS["Data.Int"] = PS["Data.Int"] || {});
  (function(exports) {
      "use strict";
  
    exports.singleton = function (c) {
      return c;
    };
  
    exports.length = function (s) {
      return s.length;
    };
  
    exports._indexOf = function (just) {
      return function (nothing) {
        return function (x) {
          return function (s) {
            var i = s.indexOf(x);
            return i === -1 ? nothing : just(i);
          };
        };
      };
    };
  
    exports.take = function (n) {
      return function (s) {
        return s.substr(0, n);
      };
    };
  
    exports.drop = function (n) {
      return function (s) {
        return s.substring(n);
      };
    };
  })(PS["Data.String.CodeUnits"] = PS["Data.String.CodeUnits"] || {});
  (function(exports) {
      "use strict";
  
    exports.charAt = function (i) {
      return function (s) {
        if (i >= 0 && i < s.length) return s.charAt(i);
        throw new Error("Data.String.Unsafe.charAt: Invalid index.");
      };
    };
  })(PS["Data.String.Unsafe"] = PS["Data.String.Unsafe"] || {});
  (function(exports) {
    // Generated by purs version 0.12.2
    "use strict";
    var $foreign = PS["Data.String.Unsafe"];
    exports["charAt"] = $foreign.charAt;
  })(PS["Data.String.Unsafe"] = PS["Data.String.Unsafe"] || {});
  (function(exports) {
    // Generated by purs version 0.12.2
    "use strict";
    var $foreign = PS["Data.String.CodeUnits"];
    var Control_Semigroupoid = PS["Control.Semigroupoid"];
    var Data_Boolean = PS["Data.Boolean"];
    var Data_Eq = PS["Data.Eq"];
    var Data_Function = PS["Data.Function"];
    var Data_HeytingAlgebra = PS["Data.HeytingAlgebra"];
    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_String_Pattern = PS["Data.String.Pattern"];
    var Data_String_Unsafe = PS["Data.String.Unsafe"];
    var Prelude = PS["Prelude"];                                                                
    var indexOf = $foreign["_indexOf"](Data_Maybe.Just.create)(Data_Maybe.Nothing.value);
    exports["indexOf"] = indexOf;
    exports["singleton"] = $foreign.singleton;
    exports["length"] = $foreign.length;
    exports["take"] = $foreign.take;
    exports["drop"] = $foreign.drop;
  })(PS["Data.String.CodeUnits"] = PS["Data.String.CodeUnits"] || {});
  (function(exports) {
      "use strict";
  
    exports.split = function (sep) {
      return function (s) {
        return s.split(sep);
      };
    };
  
    exports.toUpper = function (s) {
      return s.toUpperCase();
    };
  })(PS["Data.String.Common"] = PS["Data.String.Common"] || {});
  (function(exports) {
    // Generated by purs version 0.12.2
    "use strict";
    var $foreign = PS["Data.String.Common"];
    var Data_Eq = PS["Data.Eq"];
    var Data_Ordering = PS["Data.Ordering"];
    var Data_String_Pattern = PS["Data.String.Pattern"];
    var Prelude = PS["Prelude"];
    exports["split"] = $foreign.split;
    exports["toUpper"] = $foreign.toUpper;
  })(PS["Data.String.Common"] = PS["Data.String.Common"] || {});
  (function(exports) {
    // Generated by purs version 0.12.2
    "use strict";
    var $foreign = PS["Data.String.CodePoints"];
    var Control_Semigroupoid = PS["Control.Semigroupoid"];
    var Data_Array = PS["Data.Array"];
    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_Functor = PS["Data.Functor"];
    var Data_HeytingAlgebra = PS["Data.HeytingAlgebra"];
    var Data_Int = PS["Data.Int"];
    var Data_Maybe = PS["Data.Maybe"];
    var Data_Ord = PS["Data.Ord"];
    var Data_Ring = PS["Data.Ring"];
    var Data_Semigroup = PS["Data.Semigroup"];
    var Data_Semiring = PS["Data.Semiring"];
    var Data_Show = PS["Data.Show"];
    var Data_String_CodeUnits = PS["Data.String.CodeUnits"];
    var Data_String_Common = PS["Data.String.Common"];
    var Data_String_Pattern = PS["Data.String.Pattern"];
    var Data_String_Unsafe = PS["Data.String.Unsafe"];
    var Data_Tuple = PS["Data.Tuple"];
    var Data_Unfoldable = PS["Data.Unfoldable"];
    var Prelude = PS["Prelude"];
    var unsurrogate = function (lead) {
        return function (trail) {
            return (((lead - 55296 | 0) * 1024 | 0) + (trail - 56320 | 0) | 0) + 65536 | 0;
        };
    }; 
    var isTrail = function (cu) {
        return 56320 <= cu && cu <= 57343;
    };
    var isLead = function (cu) {
        return 55296 <= cu && cu <= 56319;
    };
    var uncons = function (s) {
        var v = Data_String_CodeUnits.length(s);
        if (v === 0) {
            return Data_Maybe.Nothing.value;
        };
        if (v === 1) {
            return new Data_Maybe.Just({
                head: Data_Enum.fromEnum(Data_Enum.boundedEnumChar)(Data_String_Unsafe.charAt(0)(s)),
                tail: ""
            });
        };
        var cu1 = Data_Enum.fromEnum(Data_Enum.boundedEnumChar)(Data_String_Unsafe.charAt(1)(s));
        var cu0 = Data_Enum.fromEnum(Data_Enum.boundedEnumChar)(Data_String_Unsafe.charAt(0)(s));
        var $21 = isLead(cu0) && isTrail(cu1);
        if ($21) {
            return new Data_Maybe.Just({
                head: unsurrogate(cu0)(cu1),
                tail: Data_String_CodeUnits.drop(2)(s)
            });
        };
        return new Data_Maybe.Just({
            head: cu0,
            tail: Data_String_CodeUnits.drop(1)(s)
        });
    };
    var unconsButWithTuple = function (s) {
        return Data_Functor.map(Data_Maybe.functorMaybe)(function (v) {
            return new Data_Tuple.Tuple(v.head, v.tail);
        })(uncons(s));
    };
    var toCodePointArrayFallback = function (s) {
        return Data_Unfoldable.unfoldr(Data_Unfoldable.unfoldableArray)(unconsButWithTuple)(s);
    };
    var unsafeCodePointAt0Fallback = function (s) {
        var cu0 = Data_Enum.fromEnum(Data_Enum.boundedEnumChar)(Data_String_Unsafe.charAt(0)(s));
        var $25 = isLead(cu0) && Data_String_CodeUnits.length(s) > 1;
        if ($25) {
            var cu1 = Data_Enum.fromEnum(Data_Enum.boundedEnumChar)(Data_String_Unsafe.charAt(1)(s));
            var $26 = isTrail(cu1);
            if ($26) {
                return unsurrogate(cu0)(cu1);
            };
            return cu0;
        };
        return cu0;
    };
    var unsafeCodePointAt0 = $foreign["_unsafeCodePointAt0"](unsafeCodePointAt0Fallback);
    var toCodePointArray = $foreign["_toCodePointArray"](toCodePointArrayFallback)(unsafeCodePointAt0);
    var length = function ($52) {
        return Data_Array.length(toCodePointArray($52));
    };
    var indexOf = function (p) {
        return function (s) {
            return Data_Functor.map(Data_Maybe.functorMaybe)(function (i) {
                return length(Data_String_CodeUnits.take(i)(s));
            })(Data_String_CodeUnits.indexOf(p)(s));
        };
    };
    var fromCharCode = function ($53) {
        return Data_String_CodeUnits.singleton(Data_Enum.toEnumWithDefaults(Data_Enum.boundedEnumChar)(Data_Bounded.bottom(Data_Bounded.boundedChar))(Data_Bounded.top(Data_Bounded.boundedChar))($53));
    };
    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 singleton = $foreign["_singleton"](singletonFallback);
    var takeFallback = function (n) {
        return function (v) {
            if (n < 1) {
                return "";
            };
            var v1 = uncons(v);
            if (v1 instanceof Data_Maybe.Just) {
                return singleton(v1.value0.head) + takeFallback(n - 1 | 0)(v1.value0.tail);
            };
            return v;
        };
    };
    var take = $foreign["_take"](takeFallback);
    var splitAt = function (i) {
        return function (s) {
            var before = take(i)(s);
            return {
                before: before,
                after: Data_String_CodeUnits.drop(Data_String_CodeUnits.length(before))(s)
            };
        };
    }; 
    var drop = function (n) {
        return function (s) {
            return Data_String_CodeUnits.drop(Data_String_CodeUnits.length(take(n)(s)))(s);
        };
    };
    exports["singleton"] = singleton;
    exports["toCodePointArray"] = toCodePointArray;
    exports["uncons"] = uncons;
    exports["length"] = length;
    exports["indexOf"] = indexOf;
    exports["take"] = take;
    exports["drop"] = drop;
    exports["splitAt"] = splitAt;
  })(PS["Data.String.CodePoints"] = PS["Data.String.CodePoints"] || {});
  (function(exports) {
    // Generated by purs version 0.12.2
    "use strict";
    var Control_Semigroupoid = PS["Control.Semigroupoid"];
    var Data_Array = PS["Data.Array"];
    var Data_Boolean = PS["Data.Boolean"];
    var Data_Eq = PS["Data.Eq"];
    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_HeytingAlgebra = PS["Data.HeytingAlgebra"];
    var Data_Maybe = PS["Data.Maybe"];
    var Data_Ring = PS["Data.Ring"];
    var Data_Semigroup = PS["Data.Semigroup"];
    var Data_Semiring = PS["Data.Semiring"];
    var Data_String = PS["Data.String"];
    var Data_String_CodePoints = PS["Data.String.CodePoints"];
    var Data_String_Common = PS["Data.String.Common"];
    var Data_String_Pattern = PS["Data.String.Pattern"];
    var Data_Traversable = PS["Data.Traversable"];
    var Prelude = PS["Prelude"];
    var transpose = function (n) {
        return function (root) {
            return Data_EuclideanRing.mod(Data_EuclideanRing.euclideanRingInt)(root + n | 0)(12);
        };
    };
    var rotateLeft = function (v) {
        return function (v1) {
            if (v === 0) {
                return v1;
            };
            if (v1.length === 0) {
                return [  ];
            };
            var len = Data_Array.length(v1);
            var nmod = Data_EuclideanRing.mod(Data_EuclideanRing.euclideanRingInt)(v)(len);
            return Data_Semigroup.append(Data_Semigroup.semigroupArray)(Data_Array.takeEnd(len - nmod | 0)(v1))(Data_Array.take(nmod)(v1));
        };
    };
    var numToNote = function (lst) {
        return function (n) {
            var len = Data_Array.length(lst);
            return Data_Maybe.fromMaybe([ "C" ])(Data_Array.index(lst)(Data_EuclideanRing.mod(Data_EuclideanRing.euclideanRingInt)(n)(len)));
        };
    };
    var findItemByName = function (ch) {
        return Data_Foldable.find(Data_Foldable.foldableArray)(function (x) {
            return Data_Foldable.elem(Data_Foldable.foldableArray)(Data_Eq.eqString)(ch)(x.name);
        });
    };
    var collapseNotes = function (base) {
        return function (lst) {
            var x = (function () {
                if (Data_String_CodePoints.length(base) === 2 && Data_String_CodePoints.drop(1)(base) === "b") {
                    return Data_Array.last(lst);
                };
                if (Data_Boolean.otherwise) {
                    return Data_Array.head(lst);
                };
                throw new Error("Failed pattern match at Chordal (line 83, column 9 - line 84, column 33): " + [  ]);
            })();
            return Data_Maybe.fromMaybe("")(x);
        };
    };
    var capitalise = function (v) {
        if (v === "") {
            return "";
        };
        return Data_String_Common.toUpper(Data_String_CodePoints.take(1)(v)) + Data_String_CodePoints.drop(1)(v);
    };
    var noteToNum = function (lst) {
        return function (e) {
            return Data_Array.findIndex(Data_Foldable.elem(Data_Foldable.foldableArray)(Data_Eq.eqString)(capitalise(e)))(lst);
        };
    };
    var allScales = [ {
        name: [ "major", "ionian", "I" ],
        notes: [ 0, 2, 4, 5, 7, 9, 11 ],
        description: "Ionian mode (I) or major scale"
    }, {
        name: [ "dorian", "II" ],
        notes: [ 0, 2, 3, 5, 7, 9, 10 ],
        description: "Dorian mode (II)"
    }, {
        name: [ "phrygian", "III" ],
        notes: [ 0, 1, 3, 5, 7, 8, 10 ],
        description: "Phrygian mode (III)"
    }, {
        name: [ "lydian", "IV" ],
        notes: [ 0, 2, 4, 6, 9, 11 ],
        description: "Lydian mode (IV)"
    }, {
        name: [ "mixolydian", "V" ],
        notes: [ 0, 2, 4, 5, 9, 10 ],
        description: "Mixolydian mode (V)"
    }, {
        name: [ "aeolian", "natural_minor", "VI" ],
        notes: [ 0, 2, 3, 5, 7, 8, 10 ],
        description: "Aeolian mode (VI)"
    }, {
        name: [ "locrian", "VII" ],
        notes: [ 0, 1, 3, 5, 6, 8, 10 ],
        description: "Locrian mode (VII)"
    }, {
        name: [ "minor", "harmonic_minor" ],
        notes: [ 0, 2, 3, 5, 7, 8, 11 ],
        description: "Harmonic minor scale"
    }, {
        name: [ "harmonic_major" ],
        notes: [ 0, 2, 4, 5, 7, 8, 11 ],
        description: "Harmonic major scale"
    }, {
        name: [ "blues" ],
        notes: [ 0, 3, 5, 6, 7, 10 ],
        description: "Blues scale"
    }, {
        name: [ "chromatic" ],
        notes: Data_Array.range(0)(12),
        description: "Chromatic scale"
    }, {
        name: [ "major_pentatonic" ],
        notes: [ 0, 2, 4, 7, 9 ],
        description: "Major pentatonic scale"
    }, {
        name: [ "minor_pentatonic" ],
        notes: [ 0, 3, 4, 7, 10 ],
        description: "Major pentatonic scale"
    }, {
        name: [ "neapolitan_major" ],
        notes: [ 0, 1, 3, 5, 7, 9, 11 ],
        description: "Neapolitan major scale"
    }, {
        name: [ "neapolitan_minor" ],
        notes: [ 0, 1, 3, 5, 7, 8, 11 ],
        description: "Neapolitan minor scale"
    }, {
        name: [ "tritone" ],
        notes: [ 0, 1, 4, 6, 7, 10 ],
        description: "Tritone scale (1 b2 3 b5 5 b7)"
    } ];
    var getAllScales = {
        scales: allScales
    };
    var allNotes = [ [ "C" ], [ "C#", "Db" ], [ "D" ], [ "D#", "Eb" ], [ "E" ], [ "F" ], [ "F#", "Gb" ], [ "G" ], [ "G#", "Ab" ], [ "A" ], [ "A#", "Bb" ], [ "B" ] ];
    var getAllNotes = {
        notes: allNotes
    };
    var getNote = function (n) {
        return function (opts) {
            var noteList = Data_String_Common.split(",")(n);
            var mapmap = function ($8) {
                return Data_Functor.map(Data_Functor.functorArray)(Data_Functor.map(Data_Maybe.functorMaybe)($8));
            };
            var baseNote = Data_Maybe.fromMaybe("C")(Data_Array.head(noteList));
            var f = function ($9) {
                return Data_Traversable.sequence(Data_Traversable.traversableArray)(Data_Maybe.applicativeMaybe)(mapmap(function ($10) {
                    return collapseNotes(baseNote)(numToNote(allNotes)(transpose(opts.transpose)($10)));
                })(Data_Functor.map(Data_Functor.functorArray)(noteToNum(allNotes))($9)));
            };
            var notes = f(noteList);
            return {
                notes: notes,
                transpose: opts.transpose
            };
        };
    };
    var getScale = function (rootNote) {
        return function (scaleName) {
            return function (opts) {
                var scale = findItemByName(scaleName)(allScales);
                var rootNum = Data_Maybe.fromMaybe(0)(noteToNum(allNotes)(rootNote));
                var f = function ($11) {
                    return (function ($12) {
                        return Data_Functor.map(Data_Functor.functorArray)(collapseNotes(rootNote))(Data_Functor.map(Data_Functor.functorArray)(numToNote(allNotes))($12));
                    })(Data_Functor.map(Data_Functor.functorArray)(transpose(opts.transpose + rootNum | 0))((function (v) {
                        return v.notes;
                    })($11)));
                };
                var notes = Data_Functor.map(Data_Maybe.functorMaybe)(f)(scale);
                return {
                    scale: rootNote + ("_" + scaleName),
                    notes: notes,
                    transpose: opts.transpose
                };
            };
        };
    };
    var allChords = [ {
        name: [ "maj", "major" ],
        notes: [ 0, 4, 7 ],
        description: "major (C-E-G)"
    }, {
        name: [ "min", "minor" ],
        notes: [ 0, 3, 7 ],
        description: "minor (C-E\u266d-G)"
    }, {
        name: [ "7", "7th" ],
        notes: [ 0, 4, 7, 10 ],
        description: "7th (C-E-G-B\u266d)"
    }, {
        name: [ "min7", "min7th", "minor7", "minor7th" ],
        notes: [ 0, 3, 7, 10 ],
        description: "minor 7th (C-E\u266d-G-B\u266d)"
    }, {
        name: [ "maj7", "maj7th", "major7", "major7th" ],
        notes: [ 0, 4, 7, 11 ],
        description: "major 7th (C-E-G-B)"
    }, {
        name: [ "minmaj7" ],
        notes: [ 0, 3, 7, 11 ],
        description: "minor/major 7th (C-E\u266d-G-B)"
    }, {
        name: [ "dim", "diminished" ],
        notes: [ 0, 3, 6 ],
        description: "diminished (C-E\u266d-G\u266d)"
    }, {
        name: [ "aug", "augmented" ],
        notes: [ 0, 4, 8 ],
        description: "augmented (C-E-G\u266f)"
    }, {
        name: [ "dim7", "dim7th" ],
        notes: [ 0, 3, 6, 9 ],
        description: "diminished 7th (C-E\u266d-G\u266d-B\u266d\u266d)"
    }, {
        name: [ "dimmaj7" ],
        notes: [ 0, 3, 6, 11 ],
        description: "diminished major 7th (C-E\u266d-G\u266d-B)"
    }, {
        name: [ "aug7" ],
        notes: [ 0, 4, 8, 10 ],
        description: "augmented 7th (C-E-G\u266f-B\u266d)"
    }, {
        name: [ "augmaj7" ],
        notes: [ 0, 4, 8, 11 ],
        description: "augmented major 7th (C-E-G\u266f-B)"
    }, {
        name: [ "7b5" ],
        notes: [ 0, 4, 6, 10 ],
        description: "seventh flat 5 (C-E-G\u266d-B\u266d)"
    }, {
        name: [ "min7b5" ],
        notes: [ 0, 3, 6, 10 ],
        description: "minor seventh flat 5 (C-E\u266d-G\u266d-B\u266d)"
    }, {
        name: [ "maj4" ],
        notes: [ 0, 4, 5, 7 ],
        description: "major 4th (C-E-F-G)"
    }, {
        name: [ "min4" ],
        notes: [ 0, 3, 5, 7 ],
        description: "minor 4th (C-E\u266d-F-G)"
    }, {
        name: [ "maj6" ],
        notes: [ 0, 4, 7, 9 ],
        description: "major 6th (C-E-G-A)"
    }, {
        name: [ "min6" ],
        notes: [ 0, 3, 7, 9 ],
        description: "minor 6th (C-E\u266d-G-A)"
    }, {
        name: [ "sus2" ],
        notes: [ 0, 2, 7 ],
        description: "suspended 2nd (C-D-G)"
    }, {
        name: [ "sus4" ],
        notes: [ 0, 5, 7 ],
        description: "suspended 4th (C-F-G)"
    }, {
        name: [ "maj9", "maj9th" ],
        notes: [ 0, 4, 7, 11, 14 ],
        description: "major 9th (C-E-G-B-D)"
    }, {
        name: [ "min9", "min9th" ],
        notes: [ 0, 3, 7, 10, 14 ],
        description: "minor 9th (C-E\u266d-G-B\u266d-D)"
    }, {
        name: [ "minmaj9" ],
        notes: [ 0, 3, 7, 11, 14 ],
        description: "minor/major 9th (C-E\u266d-G-B-D)"
    } ];
    var getAllChords = {
        chords: allChords
    };
    var getChord = function (rootNote) {
        return function (chordName) {
            return function (opts) {
                var rootNum = Data_Maybe.fromMaybe(0)(noteToNum(allNotes)(rootNote));
                var f = function ($13) {
                    return (function ($14) {
                        return Data_Functor.map(Data_Functor.functorArray)(collapseNotes(rootNote))(Data_Functor.map(Data_Functor.functorArray)(numToNote(allNotes))(rotateLeft(opts.inversion)($14)));
                    })(Data_Functor.map(Data_Functor.functorArray)(transpose(opts.transpose + rootNum | 0))((function (v) {
                        return v.notes;
                    })($13)));
                };
                var chord = findItemByName(chordName)(allChords);
                var notes = Data_Functor.map(Data_Maybe.functorMaybe)(f)(chord);
                return {
                    chord: rootNote + ("_" + chordName),
                    notes: notes,
                    transpose: opts.transpose,
                    inversion: opts.inversion
                };
            };
        };
    };
    exports["allNotes"] = allNotes;
    exports["getNote"] = getNote;
    exports["allChords"] = allChords;
    exports["getChord"] = getChord;
    exports["allScales"] = allScales;
    exports["getScale"] = getScale;
    exports["getAllNotes"] = getAllNotes;
    exports["getAllChords"] = getAllChords;
    exports["getAllScales"] = getAllScales;
    exports["capitalise"] = capitalise;
    exports["rotateLeft"] = rotateLeft;
    exports["noteToNum"] = noteToNum;
    exports["numToNote"] = numToNote;
    exports["collapseNotes"] = collapseNotes;
    exports["transpose"] = transpose;
    exports["findItemByName"] = findItemByName;
  })(PS["Chordal"] = PS["Chordal"] || {});
  (function(exports) {
    // Generated by purs version 0.12.2
    "use strict";
    var Control_Alt = PS["Control.Alt"];
    var Control_Alternative = PS["Control.Alternative"];
    var Control_Applicative = PS["Control.Applicative"];
    var Control_Apply = PS["Control.Apply"];
    var Control_Bind = PS["Control.Bind"];
    var Control_Category = PS["Control.Category"];
    var Control_Comonad = PS["Control.Comonad"];
    var Control_Extend = PS["Control.Extend"];
    var Control_Monad = PS["Control.Monad"];
    var Control_MonadPlus = PS["Control.MonadPlus"];
    var Control_MonadZero = PS["Control.MonadZero"];
    var Control_Plus = PS["Control.Plus"];
    var Control_Semigroupoid = PS["Control.Semigroupoid"];
    var Data_Eq = PS["Data.Eq"];
    var Data_Foldable = PS["Data.Foldable"];
    var Data_FoldableWithIndex = PS["Data.FoldableWithIndex"];
    var Data_Function = PS["Data.Function"];
    var Data_Functor = PS["Data.Functor"];
    var Data_FunctorWithIndex = PS["Data.FunctorWithIndex"];
    var Data_HeytingAlgebra = PS["Data.HeytingAlgebra"];
    var Data_Maybe = PS["Data.Maybe"];
    var Data_Monoid = PS["Data.Monoid"];
    var Data_Newtype = PS["Data.Newtype"];
    var Data_NonEmpty = PS["Data.NonEmpty"];
    var Data_Ord = PS["Data.Ord"];
    var Data_Ordering = PS["Data.Ordering"];
    var Data_Ring = PS["Data.Ring"];
    var Data_Semigroup = PS["Data.Semigroup"];
    var Data_Semigroup_Foldable = PS["Data.Semigroup.Foldable"];
    var Data_Semigroup_Traversable = PS["Data.Semigroup.Traversable"];
    var Data_Semiring = PS["Data.Semiring"];
    var Data_Show = PS["Data.Show"];
    var Data_Traversable = PS["Data.Traversable"];
    var Data_TraversableWithIndex = PS["Data.TraversableWithIndex"];
    var Data_Tuple = PS["Data.Tuple"];
    var Data_Unfoldable = PS["Data.Unfoldable"];
    var Data_Unfoldable1 = PS["Data.Unfoldable1"];
    var Prelude = PS["Prelude"];                 
    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 foldableList = new Data_Foldable.Foldable(function (dictMonoid) {
        return function (f) {
            return Data_Foldable.foldl(foldableList)(function (acc) {
                return function ($174) {
                    return Data_Semigroup.append(dictMonoid.Semigroup0())(acc)(f($174));
                };
            })(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 81, column 12 - line 83, 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);
            return function ($175) {
                return Data_Foldable.foldl(foldableList)(Data_Function.flip(f))(b)(rev($175));
            };
        };
    });
    var functorList = new Data_Functor.Functor(function (f) {
        return Data_Foldable.foldr(foldableList)(function (x) {
            return function (acc) {
                return new Cons(f(x), acc);
            };
        })(Nil.value);
    });
    var semigroupList = new Data_Semigroup.Semigroup(function (xs) {
        return function (ys) {
            return Data_Foldable.foldr(foldableList)(Cons.create)(ys)(xs);
        };
    });
    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 127, column 1 - line 127, column 33): " + [ v.constructor.name, v1.constructor.name ]);
        };
    });
    var bindList = new Control_Bind.Bind(function () {
        return applyList;
    }, function (v) {
        return function (v1) {
            if (v instanceof Nil) {
                return Nil.value;
            };
            if (v instanceof Cons) {
                return Data_Semigroup.append(semigroupList)(v1(v.value0))(Control_Bind.bind(bindList)(v.value1)(v1));
            };
            throw new Error("Failed pattern match at Data.List.Types (line 134, column 1 - line 134, column 31): " + [ 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["functorList"] = functorList;
    exports["foldableList"] = foldableList;
    exports["applyList"] = applyList;
    exports["applicativeList"] = applicativeList;
    exports["bindList"] = bindList;
  })(PS["Data.List.Types"] = PS["Data.List.Types"] || {});
  (function(exports) {
    // Generated by purs version 0.12.2
    "use strict";
    var Control_Alt = PS["Control.Alt"];
    var Control_Alternative = PS["Control.Alternative"];
    var Control_Applicative = PS["Control.Applicative"];
    var Control_Apply = PS["Control.Apply"];
    var Control_Bind = PS["Control.Bind"];
    var Control_Category = PS["Control.Category"];
    var Control_Lazy = PS["Control.Lazy"];
    var Control_Monad_Rec_Class = PS["Control.Monad.Rec.Class"];
    var Control_Semigroupoid = PS["Control.Semigroupoid"];
    var Data_Bifunctor = PS["Data.Bifunctor"];
    var Data_Boolean = PS["Data.Boolean"];
    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_FunctorWithIndex = PS["Data.FunctorWithIndex"];
    var Data_HeytingAlgebra = PS["Data.HeytingAlgebra"];
    var Data_List_Types = PS["Data.List.Types"];
    var Data_Maybe = PS["Data.Maybe"];
    var Data_Newtype = PS["Data.Newtype"];
    var Data_NonEmpty = PS["Data.NonEmpty"];
    var Data_Ord = PS["Data.Ord"];
    var Data_Ordering = PS["Data.Ordering"];
    var Data_Ring = PS["Data.Ring"];
    var Data_Semigroup = PS["Data.Semigroup"];
    var Data_Semiring = PS["Data.Semiring"];
    var Data_Show = PS["Data.Show"];
    var Data_Traversable = PS["Data.Traversable"];
    var Data_Tuple = PS["Data.Tuple"];
    var Data_Unfoldable = PS["Data.Unfoldable"];
    var Data_Unit = PS["Data.Unit"];
    var Prelude = PS["Prelude"];
    var singleton = function (a) {
        return new Data_List_Types.Cons(a, Data_List_Types.Nil.value);
    };
    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);
    })();
    var unsnoc = function (lst) {
        var go = function ($copy_v) {
            return function ($copy_acc) {
                var $tco_var_v = $copy_v;
                var $tco_done = false;
                var $tco_result;
                function $tco_loop(v, acc) {
                    if (v instanceof Data_List_Types.Nil) {
                        $tco_done = true;
                        return Data_Maybe.Nothing.value;
                    };
                    if (v instanceof Data_List_Types.Cons && v.value1 instanceof Data_List_Types.Nil) {
                        $tco_done = true;
                        return new Data_Maybe.Just({
                            revInit: acc,
                            last: v.value0
                        });
                    };
                    if (v instanceof Data_List_Types.Cons) {
                        $tco_var_v = v.value1;
                        $copy_acc = new Data_List_Types.Cons(v.value0, acc);
                        return;
                    };
                    throw new Error("Failed pattern match at Data.List (line 270, column 3 - line 270, column 23): " + [ v.constructor.name, acc.constructor.name ]);
                };
                while (!$tco_done) {
                    $tco_result = $tco_loop($tco_var_v, $copy_acc);
                };
                return $tco_result;
            };
        };
        return Data_Functor.map(Data_Maybe.functorMaybe)(function (h) {
            return {
                init: reverse(h.revInit),
                last: h.last
            };
        })(go(lst)(Data_List_Types.Nil.value));
    };    
    var last = function ($copy_v) {
        var $tco_done = false;
        var $tco_result;
        function $tco_loop(v) {
            if (v instanceof Data_List_Types.Cons && v.value1 instanceof Data_List_Types.Nil) {
                $tco_done = true;
                return new Data_Maybe.Just(v.value0);
            };
            if (v instanceof Data_List_Types.Cons) {
                $copy_v = v.value1;
                return;
            };
            $tco_done = true;
            return Data_Maybe.Nothing.value;
        };
        while (!$tco_done) {
            $tco_result = $tco_loop($copy_v);
        };
        return $tco_result;
    };
    var fromFoldable = function (dictFoldable) {
        return Data_Foldable.foldr(dictFoldable)(Data_List_Types.Cons.create)(Data_List_Types.Nil.value);
    };
    exports["fromFoldable"] = fromFoldable;
    exports["singleton"] = singleton;
    exports["last"] = last;
    exports["unsnoc"] = unsnoc;
    exports["reverse"] = reverse;
  })(PS["Data.List"] = PS["Data.List"] || {});
  (function(exports) {
    // Generated by purs version 0.12.2
    "use strict";
    var Control_Applicative = PS["Control.Applicative"];
    var Control_Apply = PS["Control.Apply"];
    var Control_Category = PS["Control.Category"];
    var Control_Semigroupoid = PS["Control.Semigroupoid"];
    var Data_Eq = PS["Data.Eq"];
    var Data_Foldable = PS["Data.Foldable"];
    var Data_FoldableWithIndex = PS["Data.FoldableWithIndex"];
    var Data_Function = PS["Data.Function"];
    var Data_Functor = PS["Data.Functor"];
    var Data_FunctorWithIndex = PS["Data.FunctorWithIndex"];
    var Data_HeytingAlgebra = PS["Data.HeytingAlgebra"];
    var Data_List = PS["Data.List"];
    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_Monoid = PS["Data.Monoid"];
    var Data_Ord = PS["Data.Ord"];
    var Data_Ordering = PS["Data.Ordering"];
    var Data_Semigroup = PS["Data.Semigroup"];
    var Data_Semiring = PS["Data.Semiring"];
    var Data_Show = PS["Data.Show"];
    var Data_Traversable = PS["Data.Traversable"];
    var Data_TraversableWithIndex = PS["Data.TraversableWithIndex"];
    var Data_Tuple = PS["Data.Tuple"];
    var Data_Unfoldable = PS["Data.Unfoldable"];
    var Partial_Unsafe = PS["Partial.Unsafe"];
    var Prelude = PS["Prelude"];                 
    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 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 197, column 5 - line 197, 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 415, column 3 - line 420, column 88): " + [ v.value0.constructor.name ]);
                    };
                    throw new Error("Failed pattern match at Data.Map.Internal (line 412, column 1 - line 412, 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 451, column 5 - line 456, column 108): " + [ v1.value0.constructor.name, v2.constructor.name ]);
                            };
                            throw new Error("Failed pattern match at Data.Map.Internal (line 448, column 3 - line 448, 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 431, column 3 - line 431, 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 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);
        };
    };
    exports["empty"] = empty;
    exports["insert"] = insert;
    exports["lookup"] = lookup;
    exports["fromFoldable"] = fromFoldable;
  })(PS["Data.Map.Internal"] = PS["Data.Map.Internal"] || {});
  (function(exports) {
    // Generated by purs version 0.12.2
    "use strict";
    var Control_Applicative = PS["Control.Applicative"];
    var Control_Apply = PS["Control.Apply"];
    var Control_Bind = PS["Control.Bind"];
    var Control_Semigroupoid = PS["Control.Semigroupoid"];
    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_List = PS["Data.List"];
    var Data_List_Types = PS["Data.List.Types"];
    var Data_Newtype = PS["Data.Newtype"];
    var Data_Ord = PS["Data.Ord"];
    var Data_Semigroup = PS["Data.Semigroup"];
    var Data_Semiring = PS["Data.Semiring"];
    var Data_Show = PS["Data.Show"];
    var Data_Traversable = PS["Data.Traversable"];
    var Prelude = PS["Prelude"];                 
    var Free = function (x) {
        return x;
    };
    var semiringFree = new Data_Semiring.Semiring(function (v) {
        return function (v1) {
            return Data_Semigroup.append(Data_List_Types.semigroupList)(v)(v1);
        };
    }, function (v) {
        return function (v1) {
            return Control_Bind.bind(Data_List_Types.bindList)(v)(function (v2) {
                return Control_Bind.bind(Data_List_Types.bindList)(v1)(function (v3) {
                    return Control_Applicative.pure(Data_List_Types.applicativeList)(Data_Semigroup.append(Data_List_Types.semigroupList)(v2)(v3));
                });
            });
        };
    }, Data_List.singleton(Data_List_Types.Nil.value), Data_List_Types.Nil.value);
    var newtypeFree = new Data_Newtype.Newtype(function (n) {
        return n;
    }, Free);
    var free = function (a) {
        return Data_List.singleton(Data_List.singleton(a));
    };
    exports["Free"] = Free;
    exports["free"] = free;
    exports["newtypeFree"] = newtypeFree;
    exports["semiringFree"] = semiringFree;
  })(PS["Data.Semiring.Free"] = PS["Data.Semiring.Free"] || {});
  (function(exports) {
    // Generated by purs version 0.12.2
    "use strict";
    var Control_Alt = PS["Control.Alt"];
    var Control_Applicative = PS["Control.Applicative"];
    var Control_Apply = PS["Control.Apply"];
    var Control_Plus = PS["Control.Plus"];
    var Control_Semigroupoid = PS["Control.Semigroupoid"];
    var Data_Bifunctor = PS["Data.Bifunctor"];
    var Data_Either = PS["Data.Either"];
    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_Monoid = PS["Data.Monoid"];
    var Data_Ord = PS["Data.Ord"];
    var Data_Semigroup = PS["Data.Semigroup"];
    var Data_Semiring = PS["Data.Semiring"];
    var Data_Show = PS["Data.Show"];
    var Data_Traversable = PS["Data.Traversable"];
    var Prelude = PS["Prelude"];                 
    var V = function (x) {
        return x;
    };
    var unV = function (v) {
        return function (v1) {
            return function (v2) {
                if (v2 instanceof Data_Either.Left) {
                    return v(v2.value0);
                };
                if (v2 instanceof Data_Either.Right) {
                    return v1(v2.value0);
                };
                throw new Error("Failed pattern match at Data.Validation.Semiring (line 44, column 1 - line 44, column 77): " + [ v.constructor.name, v1.constructor.name, v2.constructor.name ]);
            };
        };
    };
    var invalid = function ($68) {
        return V(Data_Either.Left.create($68));
    };
    var functorV = Data_Either.functorEither;    
    var applyV = function (dictSemiring) {
        return new Control_Apply.Apply(function () {
            return functorV;
        }, function (v) {
            return function (v1) {
                if (v instanceof Data_Either.Left && v1 instanceof Data_Either.Left) {
                    return new Data_Either.Left(Data_Semiring.mul(dictSemiring)(v.value0)(v1.value0));
                };
                if (v instanceof Data_Either.Left) {
                    return new Data_Either.Left(v.value0);
                };
                if (v1 instanceof Data_Either.Left) {
                    return new Data_Either.Left(v1.value0);
                };
                if (v instanceof Data_Either.Right && v1 instanceof Data_Either.Right) {
                    return new Data_Either.Right(v.value0(v1.value0));
                };
                throw new Error("Failed pattern match at Data.Validation.Semiring (line 75, column 1 - line 75, column 49): " + [ v.constructor.name, v1.constructor.name ]);
            };
        });
    };
    var applicativeV = function (dictSemiring) {
        return new Control_Applicative.Applicative(function () {
            return applyV(dictSemiring);
        }, function ($74) {
            return V(Data_Either.Right.create($74));
        });
    };
    var altV = function (dictSemiring) {
        return new Control_Alt.Alt(function () {
            return functorV;
        }, function (v) {
            return function (v1) {
                if (v instanceof Data_Either.Left && v1 instanceof Data_Either.Left) {
                    return new Data_Either.Left(Data_Semiring.add(dictSemiring)(v.value0)(v1.value0));
                };
                if (v instanceof Data_Either.Left) {
                    return v1;
                };
                if (v instanceof Data_Either.Right) {
                    return new Data_Either.Right(v.value0);
                };
                throw new Error("Failed pattern match at Data.Validation.Semiring (line 90, column 1 - line 90, column 45): " + [ v.constructor.name, v1.constructor.name ]);
            };
        });
    };
    exports["unV"] = unV;
    exports["invalid"] = invalid;
    exports["functorV"] = functorV;
    exports["applyV"] = applyV;
    exports["applicativeV"] = applicativeV;
    exports["altV"] = altV;
  })(PS["Data.Validation.Semiring"] = PS["Data.Validation.Semiring"] || {});
  (function(exports) {
      "use strict";
  
    exports.unsafeToForeign = function (value) {
      return value;
    };
  })(PS["Foreign"] = PS["Foreign"] || {});
  (function(exports) {
    // Generated by purs version 0.12.2
    "use strict";
    var $foreign = PS["Foreign"];
    var Control_Applicative = PS["Control.Applicative"];
    var Control_Monad_Error_Class = PS["Control.Monad.Error.Class"];
    var Control_Monad_Except = PS["Control.Monad.Except"];
    var Control_Monad_Except_Trans = PS["Control.Monad.Except.Trans"];
    var Control_Semigroupoid = PS["Control.Semigroupoid"];
    var Data_Boolean = PS["Data.Boolean"];
    var Data_Either = PS["Data.Either"];
    var Data_Eq = PS["Data.Eq"];
    var Data_Function = PS["Data.Function"];
    var Data_HeytingAlgebra = PS["Data.HeytingAlgebra"];
    var Data_Identity = PS["Data.Identity"];
    var Data_Int = PS["Data.Int"];
    var Data_List_NonEmpty = PS["Data.List.NonEmpty"];
    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_Show = PS["Data.Show"];
    var Data_String_CodeUnits = PS["Data.String.CodeUnits"];
    var Prelude = PS["Prelude"];
    exports["unsafeToForeign"] = $foreign.unsafeToForeign;
  })(PS["Foreign"] = PS["Foreign"] || {});
  (function(exports) {
    /* globals exports, JSON */
    "use strict";
  
    exports.unsafeStringify = function (x) {
      return JSON.stringify(x);
    };                                  
    exports.unsafeDecodeURIComponent = decodeURIComponent;
  })(PS["Global.Unsafe"] = PS["Global.Unsafe"] || {});
  (function(exports) {
    // Generated by purs version 0.12.2
    "use strict";
    var $foreign = PS["Global.Unsafe"];
    exports["unsafeStringify"] = $foreign.unsafeStringify;
    exports["unsafeDecodeURIComponent"] = $foreign.unsafeDecodeURIComponent;
  })(PS["Global.Unsafe"] = PS["Global.Unsafe"] || {});
  (function(exports) {
    // Generated by purs version 0.12.2
    "use strict";
    var Type_Data_Boolean = PS["Type.Data.Boolean"];
    var Type_Data_Symbol = PS["Type.Data.Symbol"];
    var Type_Equality = PS["Type.Equality"];
    var RLProxy = (function () {
        function RLProxy() {
  
        };
        RLProxy.value = new RLProxy();
        return RLProxy;
    })();
    exports["RLProxy"] = RLProxy;
  })(PS["Type.Row"] = PS["Type.Row"] || {});
  (function(exports) {
    // Generated by purs version 0.12.2
    "use strict";
    var Data_Eq = PS["Data.Eq"];
    var Data_Function_Uncurried = PS["Data.Function.Uncurried"];
    var Data_HeytingAlgebra = PS["Data.HeytingAlgebra"];
    var Data_Symbol = PS["Data.Symbol"];
    var Prelude = PS["Prelude"];
    var Record_Unsafe = PS["Record.Unsafe"];
    var Record_Unsafe_Union = PS["Record.Unsafe.Union"];
    var Type_Row = PS["Type.Row"];
    var Unsafe_Coerce = PS["Unsafe.Coerce"];
    var get = function (dictIsSymbol) {
        return function (dictCons) {
            return function (l) {
                return function (r) {
                    return Record_Unsafe.unsafeGet(Data_Symbol.reflectSymbol(dictIsSymbol)(l))(r);
                };
            };
        };
    };
    exports["get"] = get;
  })(PS["Record"] = PS["Record"] || {});
  (function(exports) {
      "use strict";
  
    exports.copyRecord = function(rec) {
      var copy = {};
      for (var key in rec) {
        if ({}.hasOwnProperty.call(rec, key)) {
          copy[key] = rec[key];
        }
      }
      return copy;
    };
  
    exports.unsafeInsert = function(l) {
      return function(a) {
        return function(rec) {
          rec[l] = a;
          return rec;
        };
      };
    };
  })(PS["Record.Builder"] = PS["Record.Builder"] || {});
  (function(exports) {
    // Generated by purs version 0.12.2
    "use strict";
    var $foreign = PS["Record.Builder"];
    var Control_Category = PS["Control.Category"];
    var Control_Semigroupoid = PS["Control.Semigroupoid"];
    var Data_Function_Uncurried = PS["Data.Function.Uncurried"];
    var Data_Symbol = PS["Data.Symbol"];
    var Prelude = PS["Prelude"];
    var Record_Unsafe_Union = PS["Record.Unsafe.Union"];
    var Type_Row = PS["Type.Row"];
    var Unsafe_Coerce = PS["Unsafe.Coerce"];
    var semigroupoidBuilder = Control_Semigroupoid.semigroupoidFn;
    var insert = function (dictCons) {
        return function (dictLacks) {
            return function (dictIsSymbol) {
                return function (l) {
                    return function (a) {
                        return function (r1) {
                            return $foreign.unsafeInsert(Data_Symbol.reflectSymbol(dictIsSymbol)(l))(a)(r1);
                        };
                    };
                };
            };
        };
    };
    var categoryBuilder = Control_Category.categoryFn;
    var build = function (v) {
        return function (r1) {
            return v($foreign.copyRecord(r1));
        };
    };
    exports["build"] = build;
    exports["insert"] = insert;
    exports["semigroupoidBuilder"] = semigroupoidBuilder;
    exports["categoryBuilder"] = categoryBuilder;
  })(PS["Record.Builder"] = PS["Record.Builder"] || {});
  (function(exports) {
    // Generated by purs version 0.12.2
    "use strict";
    var Data_Semigroup = PS["Data.Semigroup"];
    var Prelude = PS["Prelude"];                 
    var UnexpectedPath = (function () {
        function UnexpectedPath(value0) {
            this.value0 = value0;
        };
        UnexpectedPath.create = function (value0) {
            return new UnexpectedPath(value0);
        };
        return UnexpectedPath;
    })();
    var ExpectedBoolean = (function () {
        function ExpectedBoolean() {
  
        };
        ExpectedBoolean.value = new ExpectedBoolean();
        return ExpectedBoolean;
    })();
    var ExpectedEnd = (function () {
        function ExpectedEnd() {
  
        };
        ExpectedEnd.value = new ExpectedEnd();
        return ExpectedEnd;
    })();
    var ExpectedNumber = (function () {
        function ExpectedNumber() {
  
        };
        ExpectedNumber.value = new ExpectedNumber();
        return ExpectedNumber;
    })();
    var ExpectedInt = (function () {
        function ExpectedInt() {
  
        };
        ExpectedInt.value = new ExpectedInt();
        return ExpectedInt;
    })();
    var ExpectedString = (function () {
        function ExpectedString() {
  
        };
        ExpectedString.value = new ExpectedString();
        return ExpectedString;
    })();
    var ExpectedQuery = (function () {
        function ExpectedQuery() {
  
        };
        ExpectedQuery.value = new ExpectedQuery();
        return ExpectedQuery;
    })();
    var ExpectedPathPart = (function () {
        function ExpectedPathPart() {
  
        };
        ExpectedPathPart.value = new ExpectedPathPart();
        return ExpectedPathPart;
    })();
    var KeyNotFound = (function () {
        function KeyNotFound(value0) {
            this.value0 = value0;
        };
        KeyNotFound.create = function (value0) {
            return new KeyNotFound(value0);
        };
        return KeyNotFound;
    })();
    var Fail = (function () {
        function Fail(value0) {
            this.value0 = value0;
        };
        Fail.create = function (value0) {
            return new Fail(value0);
        };
        return Fail;
    })();
    var showMatchError = function (err) {
        if (err instanceof UnexpectedPath) {
            return "expected path part: " + err.value0;
        };
        if (err instanceof KeyNotFound) {
            return "key: " + (err.value0 + " has not found in query part");
        };
        if (err instanceof ExpectedQuery) {
            return "expected query - found path";
        };
        if (err instanceof ExpectedNumber) {
            return "expected number";
        };
        if (err instanceof ExpectedInt) {
            return "expected int";
        };
        if (err instanceof ExpectedBoolean) {
            return "expected boolean";
        };
        if (err instanceof ExpectedEnd) {
            return "expected end";
        };
        if (err instanceof ExpectedString) {
            return "expected string var";
        };
        if (err instanceof ExpectedPathPart) {
            return "expected path part, found query";
        };
        if (err instanceof Fail) {
            return "match error: " + err.value0;
        };
        throw new Error("Failed pattern match at Routing.Match.Error (line 29, column 3 - line 39, column 36): " + [ err.constructor.name ]);
    };
    exports["UnexpectedPath"] = UnexpectedPath;
    exports["ExpectedBoolean"] = ExpectedBoolean;
    exports["ExpectedEnd"] = ExpectedEnd;
    exports["ExpectedNumber"] = ExpectedNumber;
    exports["ExpectedInt"] = ExpectedInt;
    exports["ExpectedString"] = ExpectedString;
    exports["ExpectedQuery"] = ExpectedQuery;
    exports["ExpectedPathPart"] = ExpectedPathPart;
    exports["KeyNotFound"] = KeyNotFound;
    exports["Fail"] = Fail;
    exports["showMatchError"] = showMatchError;
  })(PS["Routing.Match.Error"] = PS["Routing.Match.Error"] || {});
  (function(exports) {
    // Generated by purs version 0.12.2
    "use strict";
    var Data_Eq = PS["Data.Eq"];
    var Data_List = PS["Data.List"];
    var Data_Map = PS["Data.Map"];
    var Data_Map_Internal = PS["Data.Map.Internal"];
    var Data_Ord = PS["Data.Ord"];
    var Data_Ordering = PS["Data.Ordering"];
    var Prelude = PS["Prelude"];                 
    var Path = (function () {
        function Path(value0) {
            this.value0 = value0;
        };
        Path.create = function (value0) {
            return new Path(value0);
        };
        return Path;
    })();
    var Query = (function () {
        function Query(value0) {
            this.value0 = value0;
        };
        Query.create = function (value0) {
            return new Query(value0);
        };
        return Query;
    })();
    exports["Path"] = Path;
    exports["Query"] = Query;
  })(PS["Routing.Types"] = PS["Routing.Types"] || {});
  (function(exports) {
    // Generated by purs version 0.12.2
    "use strict";
    var Control_Alt = PS["Control.Alt"];
    var Control_Alternative = PS["Control.Alternative"];
    var Control_Applicative = PS["Control.Applicative"];
    var Control_Apply = PS["Control.Apply"];
    var Control_Bind = PS["Control.Bind"];
    var Control_Category = PS["Control.Category"];
    var Control_Plus = PS["Control.Plus"];
    var Control_Semigroupoid = PS["Control.Semigroupoid"];
    var Data_Either = PS["Data.Either"];
    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_Int = PS["Data.Int"];
    var Data_List = PS["Data.List"];
    var Data_List_Types = PS["Data.List.Types"];
    var Data_Map = PS["Data.Map"];
    var Data_Map_Internal = PS["Data.Map.Internal"];
    var Data_Maybe = PS["Data.Maybe"];
    var Data_Newtype = PS["Data.Newtype"];
    var Data_Ord = PS["Data.Ord"];
    var Data_Semigroup = PS["Data.Semigroup"];
    var Data_Semiring = PS["Data.Semiring"];
    var Data_Semiring_Free = PS["Data.Semiring.Free"];
    var Data_String_NonEmpty = PS["Data.String.NonEmpty"];
    var Data_String_NonEmpty_Internal = PS["Data.String.NonEmpty.Internal"];
    var Data_Tuple = PS["Data.Tuple"];
    var Data_Unit = PS["Data.Unit"];
    var Data_Validation_Semiring = PS["Data.Validation.Semiring"];
    var Global = PS["Global"];
    var Prelude = PS["Prelude"];
    var Routing_Match_Error = PS["Routing.Match.Error"];
    var Routing_Types = PS["Routing.Types"];                 
    var Match = function (x) {
        return x;
    };
    var str = function (route) {
        if (route instanceof Data_List_Types.Cons && route.value0 instanceof Routing_Types.Path) {
            return Control_Applicative.pure(Data_Validation_Semiring.applicativeV(Data_Semiring_Free.semiringFree))(new Data_Tuple.Tuple(route.value1, route.value0.value0));
        };
        return Data_Validation_Semiring.invalid(Data_Semiring_Free.free(Routing_Match_Error.ExpectedString.value));
    };
    var runMatch = function (v) {
        return function (route) {
            var foldErrors = function (errs) {
                return Data_Either.Left.create(Data_Foldable.foldl(Data_List_Types.foldableList)(function (b) {
                    return function (a) {
                        return a + ("\x0a" + b);
                    };
                })("")(Control_Bind.bind(Data_List_Types.bindList)(Data_Functor.map(Data_List_Types.functorList)(Data_List.reverse)(Data_Newtype.unwrap(Data_Semiring_Free.newtypeFree)(errs)))(function (v1) {
                    return Control_Applicative.pure(Data_List_Types.applicativeList)(Data_Foldable.foldl(Data_List_Types.foldableList)(function (b) {
                        return function (a) {
                            return a + (";" + b);
                        };
                    })("")(Data_Functor.map(Data_List_Types.functorList)(Routing_Match_Error.showMatchError)(v1)));
                })));
            };
            return Data_Validation_Semiring.unV(foldErrors)(function ($90) {
                return Data_Either.Right.create(Data_Tuple.snd($90));
            })(v(route));
        };
    };
    var params = function (route) {
        if (route instanceof Data_List_Types.Cons && route.value0 instanceof Routing_Types.Query) {
            return Control_Applicative.pure(Data_Validation_Semiring.applicativeV(Data_Semiring_Free.semiringFree))(new Data_Tuple.Tuple(route.value1, route.value0.value0));
        };
        return Data_Validation_Semiring.invalid(Data_Semiring_Free.free(Routing_Match_Error.ExpectedQuery.value));
    };
    var optionalMatch = function (v) {
        return function (route) {
            return Data_Validation_Semiring.unV(Data_Function["const"](Control_Applicative.pure(Data_Validation_Semiring.applicativeV(Data_Semiring_Free.semiringFree))(new Data_Tuple.Tuple(route, Data_Maybe.Nothing.value))))(function ($91) {
                return Control_Applicative.pure(Data_Validation_Semiring.applicativeV(Data_Semiring_Free.semiringFree))(Data_Functor.map(Data_Tuple.functorTuple)(Data_Maybe.Just.create)($91));
            })(v(route));
        };
    };        
    var matchFunctor = new Data_Functor.Functor(function (fn) {
        return function (v) {
            return Match(function (r) {
                return Data_Validation_Semiring.unV(Data_Validation_Semiring.invalid)(function (v1) {
                    return Control_Applicative.pure(Data_Validation_Semiring.applicativeV(Data_Semiring_Free.semiringFree))(new Data_Tuple.Tuple(v1.value0, fn(v1.value1)));
                })(v(r));
            });
        };
    });
    var matchApply = new Control_Apply.Apply(function () {
        return matchFunctor;
    }, function (v) {
        return function (v1) {
            var processFnRes = function (v2) {
                return Data_Validation_Semiring.unV(Data_Validation_Semiring.invalid)(function (v3) {
                    return Control_Applicative.pure(Data_Validation_Semiring.applicativeV(Data_Semiring_Free.semiringFree))(new Data_Tuple.Tuple(v3.value0, v2.value1(v3.value1)));
                })(v1(v2.value0));
            };
            var processFnErr = function (r) {
                return function (err) {
                    return Data_Validation_Semiring.invalid(Data_Semiring.mul(Data_Semiring_Free.semiringFree)(err)(Data_Validation_Semiring.unV(Control_Category.identity(Control_Category.categoryFn))(Data_Function["const"](Data_Semiring.one(Data_Semiring_Free.semiringFree)))(v1(r))));
                };
            };
            return Match(function (r) {
                return Data_Validation_Semiring.unV(processFnErr(r))(processFnRes)(v(r));
            });
        };
    });
    var matchAlt = new Control_Alt.Alt(function () {
        return matchFunctor;
    }, function (v) {
        return function (v1) {
            return Match(function (r) {
                return Control_Alt.alt(Data_Validation_Semiring.altV(Data_Semiring_Free.semiringFree))(v(r))(v1(r));
            });
        };
    });
    var matchPlus = new Control_Plus.Plus(function () {
        return matchAlt;
    }, Match(Data_Function["const"](Data_Validation_Semiring.invalid(Data_Semiring.one(Data_Semiring_Free.semiringFree)))));
    var lit = function (input) {
        return function (route) {
            if (route instanceof Data_List_Types.Cons && (route.value0 instanceof Routing_Types.Path && route.value0.value0 === input)) {
                return Control_Applicative.pure(Data_Validation_Semiring.applicativeV(Data_Semiring_Free.semiringFree))(new Data_Tuple.Tuple(route.value1, Data_Unit.unit));
            };
            if (route instanceof Data_List_Types.Cons && route.value0 instanceof Routing_Types.Path) {
                return Data_Validation_Semiring.invalid(Data_Semiring_Free.free(new Routing_Match_Error.UnexpectedPath(input)));
            };
            return Data_Validation_Semiring.invalid(Data_Semiring_Free.free(Routing_Match_Error.ExpectedPathPart.value));
        };
    };
    var root = lit("");
    var end = function (route) {
        if (route instanceof Data_List_Types.Nil) {
            return Control_Applicative.pure(Data_Validation_Semiring.applicativeV(Data_Semiring_Free.semiringFree))(new Data_Tuple.Tuple(Data_List_Types.Nil.value, Data_Unit.unit));
        };
        return Data_Validation_Semiring.invalid(Data_Semiring_Free.free(Routing_Match_Error.ExpectedEnd.value));
    };
    exports["Match"] = Match;
    exports["root"] = root;
    exports["lit"] = lit;
    exports["str"] = str;
    exports["params"] = params;
    exports["end"] = end;
    exports["runMatch"] = runMatch;
    exports["optionalMatch"] = optionalMatch;
    exports["matchFunctor"] = matchFunctor;
    exports["matchAlt"] = matchAlt;
    exports["matchPlus"] = matchPlus;
    exports["matchApply"] = matchApply;
  })(PS["Routing.Match"] = PS["Routing.Match"] || {});
  (function(exports) {
    // Generated by purs version 0.12.2
    "use strict";
    var Control_Apply = PS["Control.Apply"];
    var Control_Bind = PS["Control.Bind"];
    var Control_MonadPlus = PS["Control.MonadPlus"];
    var Control_MonadZero = PS["Control.MonadZero"];
    var Control_Semigroupoid = PS["Control.Semigroupoid"];
    var Data_Array = PS["Data.Array"];
    var Data_Foldable = PS["Data.Foldable"];
    var Data_Function = PS["Data.Function"];
    var Data_Functor = PS["Data.Functor"];
    var Data_List = PS["Data.List"];
    var Data_List_Types = PS["Data.List.Types"];
    var Data_Map = PS["Data.Map"];
    var Data_Map_Internal = PS["Data.Map.Internal"];
    var Data_Maybe = PS["Data.Maybe"];
    var Data_Ord = PS["Data.Ord"];
    var Data_Semigroup = PS["Data.Semigroup"];
    var Data_String = PS["Data.String"];
    var Data_String_CodePoints = PS["Data.String.CodePoints"];
    var Data_String_Common = PS["Data.String.Common"];
    var Data_String_Pattern = PS["Data.String.Pattern"];
    var Data_Traversable = PS["Data.Traversable"];
    var Data_Tuple = PS["Data.Tuple"];
    var Prelude = PS["Prelude"];
    var Routing_Types = PS["Routing.Types"];                 
    var parseQueryPart = function (decoder) {
        var part2tuple = function (input) {
            var keyVal = Data_Functor.map(Data_Functor.functorArray)(decoder)(Data_String_Common.split("=")(input));
            return Control_Bind.discard(Control_Bind.discardUnit)(Data_Maybe.bindMaybe)(Control_MonadZero.guard(Data_Maybe.monadZeroMaybe)(Data_Array.length(keyVal) <= 2))(function () {
                return Control_Apply.apply(Data_Maybe.applyMaybe)(Data_Functor.map(Data_Maybe.functorMaybe)(Data_Tuple.Tuple.create)(Data_Array.head(keyVal)))(Data_Array.index(keyVal)(1));
            });
        };
        return function ($11) {
            return Data_Functor.map(Data_Maybe.functorMaybe)(Data_Map_Internal.fromFoldable(Data_Ord.ordString)(Data_Foldable.foldableArray))(Data_Traversable.traverse(Data_Traversable.traversableArray)(Data_Maybe.applicativeMaybe)(part2tuple)(Data_String_Common.split("&")($11)));
        };
    };
    var parse = function (decoder) {
        return function (hash) {
            var pathParts = function (str) {
                var parts = Data_List.fromFoldable(Data_Foldable.foldableArray)(Data_Functor.map(Data_Functor.functorArray)(function ($12) {
                    return Routing_Types.Path.create(decoder($12));
                })(Data_String_Common.split("/")(str)));
                var v = Data_List.unsnoc(parts);
                if (v instanceof Data_Maybe.Just && (v.value0.last instanceof Routing_Types.Path && v.value0.last.value0 === "")) {
                    return v.value0.init;
                };
                return parts;
            };
            var v = Data_Functor.map(Data_Maybe.functorMaybe)(Data_Function.flip(Data_String_CodePoints.splitAt)(hash))(Data_String_CodePoints.indexOf("?")(hash));
            if (v instanceof Data_Maybe.Just) {
                return Data_Semigroup.append(Data_List_Types.semigroupList)(pathParts(v.value0.before))(Data_Functor.map(Data_List_Types.functorList)(Routing_Types.Query.create)(Data_List.fromFoldable(Data_Foldable.foldableMaybe)(parseQueryPart(decoder)(Data_String_CodePoints.drop(1)(v.value0.after)))));
            };
            if (v instanceof Data_Maybe.Nothing) {
                return pathParts(hash);
            };
            throw new Error("Failed pattern match at Routing.Parser (line 32, column 3 - line 37, column 21): " + [ v.constructor.name ]);
        };
    };
    exports["parse"] = parse;
  })(PS["Routing.Parser"] = PS["Routing.Parser"] || {});
  (function(exports) {
    // Generated by purs version 0.12.2
    "use strict";
    var Control_Semigroupoid = PS["Control.Semigroupoid"];
    var Data_Either = PS["Data.Either"];
    var Global_Unsafe = PS["Global.Unsafe"];
    var Prelude = PS["Prelude"];
    var Routing_Match = PS["Routing.Match"];
    var Routing_Parser = PS["Routing.Parser"];                 
    var matchWith = function (decoder) {
        return function (matcher) {
            return function ($0) {
                return Routing_Match.runMatch(matcher)(Routing_Parser.parse(decoder)($0));
            };
        };
    };
    var match = matchWith(Global_Unsafe.unsafeDecodeURIComponent);
    exports["match"] = match;
    exports["matchWith"] = matchWith;
  })(PS["Routing"] = PS["Routing"] || {});
  (function(exports) {              
  
    exports._undefined = undefined;
  })(PS["Simple.JSON"] = PS["Simple.JSON"] || {});
  (function(exports) {
    // Generated by purs version 0.12.2
    "use strict";
    var $foreign = PS["Simple.JSON"];
    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_Category = PS["Control.Category"];
    var Control_Monad_Except = PS["Control.Monad.Except"];
    var Control_Monad_Except_Trans = PS["Control.Monad.Except.Trans"];
    var Control_Semigroupoid = PS["Control.Semigroupoid"];
    var Data_Bifunctor = PS["Data.Bifunctor"];
    var Data_Boolean = PS["Data.Boolean"];
    var Data_Either = PS["Data.Either"];
    var Data_Eq = PS["Data.Eq"];
    var Data_Function = PS["Data.Function"];
    var Data_Functor = PS["Data.Functor"];
    var Data_HeytingAlgebra = PS["Data.HeytingAlgebra"];
    var Data_Identity = PS["Data.Identity"];
    var Data_List_Types = PS["Data.List.Types"];
    var Data_Maybe = PS["Data.Maybe"];
    var Data_Nullable = PS["Data.Nullable"];
    var Data_Semigroup = PS["Data.Semigroup"];
    var Data_Symbol = PS["Data.Symbol"];
    var Data_Traversable = PS["Data.Traversable"];
    var Data_Variant = PS["Data.Variant"];
    var Effect_Exception = PS["Effect.Exception"];
    var Effect_Uncurried = PS["Effect.Uncurried"];
    var Effect_Unsafe = PS["Effect.Unsafe"];
    var Foreign = PS["Foreign"];
    var Foreign_Index = PS["Foreign.Index"];
    var Foreign_Object = PS["Foreign.Object"];
    var Global_Unsafe = PS["Global.Unsafe"];
    var Partial_Unsafe = PS["Partial.Unsafe"];
    var Prelude = PS["Prelude"];
    var Record = PS["Record"];
    var Record_Builder = PS["Record.Builder"];
    var Type_Prelude = PS["Type.Prelude"];
    var Type_Row = PS["Type.Row"];
    var WriteForeign = function (writeImpl) {
        this.writeImpl = writeImpl;
    };
    var WriteForeignFields = function (writeImplFields) {
        this.writeImplFields = writeImplFields;
    };
    var writeImplFields = function (dict) {
        return dict.writeImplFields;
    };
    var writeImpl = function (dict) {
        return dict.writeImpl;
    };
    var writeJSON = function (dictWriteForeign) {
        return function ($70) {
            return Global_Unsafe.unsafeStringify(writeImpl(dictWriteForeign)($70));
        };
    };
    var writeForeignString = new WriteForeign(Foreign.unsafeToForeign);
    var writeForeignInt = new WriteForeign(Foreign.unsafeToForeign);    
    var writeForeignArray = function (dictWriteForeign) {
        return new WriteForeign(function (xs) {
            return Foreign.unsafeToForeign(Data_Functor.map(Data_Functor.functorArray)(writeImpl(dictWriteForeign))(xs));
        });
    };
    var $$undefined = $foreign["_undefined"];
    var writeForeignMaybe = function (dictWriteForeign) {
        return new WriteForeign(Data_Maybe.maybe($$undefined)(writeImpl(dictWriteForeign)));
    };
    var recordWriteForeign = function (dictRowToList) {
        return function (dictWriteForeignFields) {
            return new WriteForeign(function (rec) {
                var steps = writeImplFields(dictWriteForeignFields)(Type_Row.RLProxy.value)(rec);
                return Foreign.unsafeToForeign(Record_Builder.build(steps)({}));
            });
        };
    }; 
    var nilWriteForeignFields = new WriteForeignFields(function (v) {
        return function (v1) {
            return Control_Category.identity(Record_Builder.categoryBuilder);
        };
    });
    var consWriteForeignFields = function (dictIsSymbol) {
        return function (dictWriteForeign) {
            return function (dictWriteForeignFields) {
                return function (dictCons) {
                    return function (dictLacks) {
                        return function (dictCons1) {
                            return new WriteForeignFields(function (v) {
                                return function (rec) {
                                    var rest = writeImplFields(dictWriteForeignFields)(Type_Row.RLProxy.value)(rec);
                                    var value = writeImpl(dictWriteForeign)(Record.get(dictIsSymbol)(dictCons)(Data_Symbol.SProxy.value)(rec));
                                    var result = Control_Semigroupoid.compose(Record_Builder.semigroupoidBuilder)(Record_Builder.insert(dictCons1)(dictLacks)(dictIsSymbol)(Data_Symbol.SProxy.value)(value))(rest);
                                    return result;
                                };
                            });
                        };
                    };
                };
            };
        };
    };
    exports["writeJSON"] = writeJSON;
    exports["WriteForeign"] = WriteForeign;
    exports["writeImpl"] = writeImpl;
    exports["WriteForeignFields"] = WriteForeignFields;
    exports["writeImplFields"] = writeImplFields;
    exports["writeForeignString"] = writeForeignString;
    exports["writeForeignInt"] = writeForeignInt;
    exports["writeForeignArray"] = writeForeignArray;
    exports["writeForeignMaybe"] = writeForeignMaybe;
    exports["recordWriteForeign"] = recordWriteForeign;
    exports["consWriteForeignFields"] = consWriteForeignFields;
    exports["nilWriteForeignFields"] = nilWriteForeignFields;
  })(PS["Simple.JSON"] = PS["Simple.JSON"] || {});
  (function(exports) {
    // Generated by purs version 0.12.2
    "use strict";
    var Chordal = PS["Chordal"];
    var Control_Apply = PS["Control.Apply"];
    var Control_Bind = PS["Control.Bind"];
    var Control_Category = PS["Control.Category"];
    var Control_Semigroupoid = PS["Control.Semigroupoid"];
    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_Int = PS["Data.Int"];
    var Data_Map = PS["Data.Map"];
    var Data_Map_Internal = PS["Data.Map.Internal"];
    var Data_Maybe = PS["Data.Maybe"];
    var Data_Ord = PS["Data.Ord"];
    var Data_Semigroup = PS["Data.Semigroup"];
    var Data_Show = PS["Data.Show"];
    var Data_String = PS["Data.String"];
    var Data_String_Common = PS["Data.String.Common"];
    var Data_String_Pattern = PS["Data.String.Pattern"];
    var Data_Symbol = PS["Data.Symbol"];
    var Prelude = PS["Prelude"];
    var Routing = PS["Routing"];
    var Routing_Match = PS["Routing.Match"];
    var Simple_JSON = PS["Simple.JSON"];                 
    var Notes = (function () {
        function Notes() {
  
        };
        Notes.value = new Notes();
        return Notes;
    })();
    var Chords = (function () {
        function Chords() {
  
        };
        Chords.value = new Chords();
        return Chords;
    })();
    var Chord = (function () {
        function Chord(value0, value1, value2) {
            this.value0 = value0;
            this.value1 = value1;
            this.value2 = value2;
        };
        Chord.create = function (value0) {
            return function (value1) {
                return function (value2) {
                    return new Chord(value0, value1, value2);
                };
            };
        };
        return Chord;
    })();
    var Scales = (function () {
        function Scales() {
  
        };
        Scales.value = new Scales();
        return Scales;
    })();
    var Scale = (function () {
        function Scale(value0, value1, value2) {
            this.value0 = value0;
            this.value1 = value1;
            this.value2 = value2;
        };
        Scale.create = function (value0) {
            return function (value1) {
                return function (value2) {
                    return new Scale(value0, value1, value2);
                };
            };
        };
        return Scale;
    })();
    var Note = (function () {
        function Note(value0, value1) {
            this.value0 = value0;
            this.value1 = value1;
        };
        Note.create = function (value0) {
            return function (value1) {
                return new Note(value0, value1);
            };
        };
        return Note;
    })();
    var stringToInt = function (s) {
        return Data_Maybe.fromMaybe(0)(Control_Bind.bind(Data_Maybe.bindMaybe)(s)(Data_Int.fromString));
    };
    var stringToArray = function (s) {
        return Data_Maybe.fromMaybe([  ])(Data_Functor.map(Data_Maybe.functorMaybe)(Data_String_Common.split(","))(s));
    };
    var showAPI = new Data_Show.Show(function (v) {
        if (v instanceof Notes) {
            return "Notes";
        };
        if (v instanceof Chords) {
            return "Chords";
        };
        if (v instanceof Chord) {
            return "Chord " + (v.value0 + v.value1);
        };
        if (v instanceof Scales) {
            return "Scales";
        };
        if (v instanceof Scale) {
            return "Scale " + (v.value0 + v.value1);
        };
        if (v instanceof Note) {
            return "Note " + v.value0;
        };
        throw new Error("Failed pattern match at Router (line 41, column 1 - line 41, column 36): " + [ v.constructor.name ]);
    });
    var options = function (p) {
        var tr = stringToInt(Data_Map_Internal.lookup(Data_Ord.ordString)("transpose")(p));
        var inv = stringToInt(Data_Map_Internal.lookup(Data_Ord.ordString)("inversion")(p));
        return {
            transpose: tr,
            inversion: inv
        };
    };
    var optParams = Control_Apply.applyFirst(Routing_Match.matchApply)(Data_Functor.map(Routing_Match.matchFunctor)(Data_Maybe.maybe(Data_Map_Internal.empty)(Control_Category.identity(Control_Category.categoryFn)))(Routing_Match.optionalMatch(Routing_Match.params)))(Routing_Match.end);
    var chordalAPI = Control_Apply.applyFirst(Routing_Match.matchApply)(Control_Apply.applySecond(Routing_Match.matchApply)(Routing_Match.root)(Data_Foldable.oneOf(Data_Foldable.foldableArray)(Routing_Match.matchPlus)([ Data_Functor.voidRight(Routing_Match.matchFunctor)(Notes.value)(Routing_Match.lit("notes")), Data_Functor.voidRight(Routing_Match.matchFunctor)(Chords.value)(Routing_Match.lit("chords")), Control_Apply.apply(Routing_Match.matchApply)(Control_Apply.apply(Routing_Match.matchApply)(Data_Functor.map(Routing_Match.matchFunctor)(Chord.create)(Control_Apply.applySecond(Routing_Match.matchApply)(Routing_Match.lit("chord"))(Routing_Match.str)))(Routing_Match.str))(optParams), Data_Functor.voidRight(Routing_Match.matchFunctor)(Scales.value)(Routing_Match.lit("scales")), Control_Apply.apply(Routing_Match.matchApply)(Control_Apply.apply(Routing_Match.matchApply)(Data_Functor.map(Routing_Match.matchFunctor)(Scale.create)(Control_Apply.applySecond(Routing_Match.matchApply)(Routing_Match.lit("scale"))(Routing_Match.str)))(Routing_Match.str))(optParams), Control_Apply.apply(Routing_Match.matchApply)(Data_Functor.map(Routing_Match.matchFunctor)(Note.create)(Control_Apply.applySecond(Routing_Match.matchApply)(Routing_Match.lit("note"))(Routing_Match.str)))(optParams) ])))(Routing_Match.end);
    var matchAPI = Routing.match(chordalAPI);
    var route = function (r) {
        var v = matchAPI(r);
        if (v instanceof Data_Either.Right && v.value0 instanceof Notes) {
            return Simple_JSON.writeJSON(Simple_JSON.recordWriteForeign()(Simple_JSON.consWriteForeignFields(new Data_Symbol.IsSymbol(function () {
                return "notes";
            }))(Simple_JSON.writeForeignArray(Simple_JSON.writeForeignArray(Simple_JSON.writeForeignString)))(Simple_JSON.nilWriteForeignFields)()()()))(Chordal.getAllNotes);
        };
        if (v instanceof Data_Either.Right && v.value0 instanceof Chords) {
            return Simple_JSON.writeJSON(Simple_JSON.recordWriteForeign()(Simple_JSON.consWriteForeignFields(new Data_Symbol.IsSymbol(function () {
                return "chords";
            }))(Simple_JSON.writeForeignArray(Simple_JSON.recordWriteForeign()(Simple_JSON.consWriteForeignFields(new Data_Symbol.IsSymbol(function () {
                return "description";
            }))(Simple_JSON.writeForeignString)(Simple_JSON.consWriteForeignFields(new Data_Symbol.IsSymbol(function () {
                return "name";
            }))(Simple_JSON.writeForeignArray(Simple_JSON.writeForeignString))(Simple_JSON.consWriteForeignFields(new Data_Symbol.IsSymbol(function () {
                return "notes";
            }))(Simple_JSON.writeForeignArray(Simple_JSON.writeForeignInt))(Simple_JSON.nilWriteForeignFields)()()())()()())()()())))(Simple_JSON.nilWriteForeignFields)()()()))(Chordal.getAllChords);
        };
        if (v instanceof Data_Either.Right && v.value0 instanceof Chord) {
            return Simple_JSON.writeJSON(Simple_JSON.recordWriteForeign()(Simple_JSON.consWriteForeignFields(new Data_Symbol.IsSymbol(function () {
                return "chord";
            }))(Simple_JSON.writeForeignString)(Simple_JSON.consWriteForeignFields(new Data_Symbol.IsSymbol(function () {
                return "inversion";
            }))(Simple_JSON.writeForeignInt)(Simple_JSON.consWriteForeignFields(new Data_Symbol.IsSymbol(function () {
                return "notes";
            }))(Simple_JSON.writeForeignMaybe(Simple_JSON.writeForeignArray(Simple_JSON.writeForeignString)))(Simple_JSON.consWriteForeignFields(new Data_Symbol.IsSymbol(function () {
                return "transpose";
            }))(Simple_JSON.writeForeignInt)(Simple_JSON.nilWriteForeignFields)()()())()()())()()())()()()))(Chordal.getChord(v.value0.value0)(v.value0.value1)(options(v.value0.value2)));
        };
        if (v instanceof Data_Either.Right && v.value0 instanceof Scales) {
            return Simple_JSON.writeJSON(Simple_JSON.recordWriteForeign()(Simple_JSON.consWriteForeignFields(new Data_Symbol.IsSymbol(function () {
                return "scales";
            }))(Simple_JSON.writeForeignArray(Simple_JSON.recordWriteForeign()(Simple_JSON.consWriteForeignFields(new Data_Symbol.IsSymbol(function () {
                return "description";
            }))(Simple_JSON.writeForeignString)(Simple_JSON.consWriteForeignFields(new Data_Symbol.IsSymbol(function () {
                return "name";
            }))(Simple_JSON.writeForeignArray(Simple_JSON.writeForeignString))(Simple_JSON.consWriteForeignFields(new Data_Symbol.IsSymbol(function () {
                return "notes";
            }))(Simple_JSON.writeForeignArray(Simple_JSON.writeForeignInt))(Simple_JSON.nilWriteForeignFields)()()())()()())()()())))(Simple_JSON.nilWriteForeignFields)()()()))(Chordal.getAllScales);
        };
        if (v instanceof Data_Either.Right && v.value0 instanceof Scale) {
            return Simple_JSON.writeJSON(Simple_JSON.recordWriteForeign()(Simple_JSON.consWriteForeignFields(new Data_Symbol.IsSymbol(function () {
                return "notes";
            }))(Simple_JSON.writeForeignMaybe(Simple_JSON.writeForeignArray(Simple_JSON.writeForeignString)))(Simple_JSON.consWriteForeignFields(new Data_Symbol.IsSymbol(function () {
                return "scale";
            }))(Simple_JSON.writeForeignString)(Simple_JSON.consWriteForeignFields(new Data_Symbol.IsSymbol(function () {
                return "transpose";
            }))(Simple_JSON.writeForeignInt)(Simple_JSON.nilWriteForeignFields)()()())()()())()()()))(Chordal.getScale(v.value0.value0)(v.value0.value1)(options(v.value0.value2)));
        };
        if (v instanceof Data_Either.Right && v.value0 instanceof Note) {
            return Simple_JSON.writeJSON(Simple_JSON.recordWriteForeign()(Simple_JSON.consWriteForeignFields(new Data_Symbol.IsSymbol(function () {
                return "notes";
            }))(Simple_JSON.writeForeignMaybe(Simple_JSON.writeForeignArray(Simple_JSON.writeForeignString)))(Simple_JSON.consWriteForeignFields(new Data_Symbol.IsSymbol(function () {
                return "transpose";
            }))(Simple_JSON.writeForeignInt)(Simple_JSON.nilWriteForeignFields)()()())()()()))(Chordal.getNote(v.value0.value0)(options(v.value0.value1)));
        };
        if (v instanceof Data_Either.Left) {
            return Simple_JSON.writeJSON(Simple_JSON.recordWriteForeign()(Simple_JSON.consWriteForeignFields(new Data_Symbol.IsSymbol(function () {
                return "error";
            }))(Simple_JSON.writeForeignString)(Simple_JSON.nilWriteForeignFields)()()()))({
                error: "Route error"
            });
        };
        throw new Error("Failed pattern match at Router (line 89, column 11 - line 96, column 76): " + [ v.constructor.name ]);
    };
    exports["route"] = route;
  })(PS["Router"] = PS["Router"] || {});module.exports = PS["Router"];
  
  },{}]},{},[1])(1)
  });
  