diff --git a/public/css/jquery.bracket.min.css b/public/css/jquery.bracket.min.css
new file mode 100755
index 0000000..ae4c552
--- /dev/null
+++ b/public/css/jquery.bracket.min.css
@@ -0,0 +1,2 @@
+/* jQuery Bracket | Copyright (c) Teijo Laine 2011-2016 | Licenced under the MIT licence */
+div.jQBracket{font-family:Arial;font-size:14px;position:relative}div.jQBracket .tools{position:absolute;top:0;color:#FFF}div.jQBracket .tools span{cursor:pointer;margin:5px;display:block;text-align:center;width:18px;height:18px;background-color:#666}div.jQBracket .tools span:hover{background-color:#999}div.jQBracket .finals{float:right;right:0;clear:right;position:relative}div.jQBracket .bracket{float:right;clear:left}div.jQBracket .loserBracket{float:right;clear:left;position:relative}div.jQBracket .round{position:relative;float:left}div.jQBracket .match{position:relative}div.jQBracket .editable{cursor:pointer}div.jQBracket .team{position:relative;z-index:1;float:left;background-color:#EEE;cursor:default}div.jQBracket .team:first-child{border-bottom:1px solid #999}div.jQBracket .team input{font-size:14px;padding:0;width:100%;border:0;margin:0;outline:0}div.jQBracket .team div.label{padding:3px;position:absolute;height:22px;white-space:nowrap;overflow:hidden;box-sizing:border-box}div.jQBracket .team div.label[disabled]{cursor:default}div.jQBracket .team div.score{float:right;padding:3px;background-color:rgba(255,255,255,.3);text-align:center;box-sizing:border-box}div.jQBracket .team div.score input{text-align:center}div.jQBracket .team div.score[disabled]{color:#999;cursor:default}div.jQBracket .team div.label input.error,div.jQBracket .team div.score input.error{background-color:#FCC}div.jQBracket .team.np{background-color:#666;color:#EEE}div.jQBracket .team.na{background-color:#999;color:#CCC}div.jQBracket .team.win{color:#333}div.jQBracket .team.win div.score{color:#060}div.jQBracket .team.lose div.score{color:#900}div.jQBracket .team.lose{background-color:#DDD;color:#999}div.jQBracket .team.tie div.score{color:#00F}div.jQBracket .team.highlightWinner{background-color:#DA0;color:#000}div.jQBracket .team.highlightLoser{background-color:#CCC;color:#000}div.jQBracket .team.highlight{background-color:#3C0;color:#000}div.jQBracket .team.bye{background-color:#999;color:#CCC}div.jQBracket .teamContainer{z-index:1;position:relative;float:left}div.jQBracket .connector{border:2px solid #666;border-left-style:none;position:absolute;z-index:1}div.jQBracket .connector div.connector{border:0;border-bottom:2px solid #666;height:0;position:absolute}div.jQBracket .connector.highlightWinner,div.jQBracket .connector div.connector.highlightWinner{border-color:#DA0}div.jQBracket .connector.highlightLoser,div.jQBracket .connector div.connector.highlightLoser{border-color:#CCC}div.jQBracket .connector.highlight,div.jQBracket .connector div.connector.highlight{border-color:#0C0}div.jQBracket .np .connector,div.jQBracket .np .connector div.connector{border-color:#999}div.jQBracket .bubble{height:22px;line-height:22px;width:30px;right:-35px;position:absolute;text-align:center;font-size:11px}div.jQBracket .bubble:after{content:'';position:absolute;top:6px;width:0;height:0;border-top:5px solid transparent;border-left:5px solid transparent;border-right:5px solid transparent;border-bottom:5px solid transparent}div.jQBracket .bubble:after{left:-5px;border-left:0}div.jQBracket .win .bubble{background-color:#DA0;color:#960}div.jQBracket .win .bubble:after{border-right-color:#DA0}div.jQBracket .win .bubble.third{background-color:#963;color:#D95}div.jQBracket .win .bubble.third:after{border-right:6px solid #963}div.jQBracket .lose .bubble{background-color:#CCC;color:#333}div.jQBracket .lose .bubble:after{border-right-color:#CCC}div.jQBracket .lose .bubble.fourth{background-color:#678;color:#CCD}div.jQBracket .lose .bubble.fourth:after{border-right:6px solid #678}div.jQBracket.rl .finals{float:left;left:0;clear:left}div.jQBracket.rl .bracket{float:left;clear:right}div.jQBracket.rl .loserBracket{float:left;clear:right}div.jQBracket.rl .round{margin-right:0;float:right}div.jQBracket.rl .team{float:right}div.jQBracket.rl .team div.label{right:0}div.jQBracket.rl .team div.score{float:left}div.jQBracket.rl .teamContainer{float:right}div.jQBracket.rl .connector{border-left-style:solid;border-right-style:none;border-width:2px}div.jQBracket.rl .connector.highlightWinner,div.jQBracket.rl .connector div.connector.highlightWinner{border-color:#DA0}div.jQBracket.rl .connector.highlightLoser,div.jQBracket.rl .connector div.connector.highlightLoser{border-color:#CCC}div.jQBracket.rl .connector.highlight,div.jQBracket.rl .connector div.connector.highlight{border-color:#0C0}div.jQBracket.rl .bubble{left:-35px}div.jQBracket.rl .bubble.third{background-color:#963;color:#310}div.jQBracket.rl .bubble.fourth{background-color:#678;color:#CCD}div.jQBracket.rl .bubble:after{left:auto;right:-5px;border-left:5px solid transparent;border-right:0}div.jQBracket.rl .bubble.third:after{border-right:0;border-left:6px solid #963}div.jQBracket.rl .bubble.fourth:after{border-right:0;border-left:6px solid #678}div.jQBracket.rl .highlightWinner .bubble:after{border-left-color:#DA0}div.jQBracket.rl .highlightLoser .bubble:after{border-left-color:#CCC}
\ No newline at end of file
diff --git a/public/js/jquery.bracket.min.js b/public/js/jquery.bracket.min.js
new file mode 100755
index 0000000..db05ac6
--- /dev/null
+++ b/public/js/jquery.bracket.min.js
@@ -0,0 +1,2 @@
+/* jQuery Bracket | Copyright (c) Teijo Laine 2011-2016 | Licenced under the MIT licence */
+var __extends=this&&this.__extends||function(a,b){function c(){this.constructor=a}for(var d in b)b.hasOwnProperty(d)&&(a[d]=b[d]);a.prototype=null===b?Object.create(b):(c.prototype=b.prototype,new c)};!function(a){function b(a){return!isNaN(parseFloat(a))&&isFinite(a)}function c(){this.message="Root of information for this team",this.name="EndOfBranchException"}function d(a){function b(a,c){return a instanceof Array?b(a[0],c+1):c}return b(a,0)}function e(a,b){return b>0&&(a=e([a],b-1)),a}function f(b,c,d){var e=d.find(".team[data-teamid="+b+"]"),f=c?c:"highlight";return{highlight:function(){e.each(function(){a(this).addClass(f),a(this).hasClass("win")&&a(this).parent().find(".connector").addClass(f)})},deHighlight:function(){e.each(function(){a(this).removeClass(f),a(this).parent().find(".connector").removeClass(f)})}}}function g(b,c,d){var e=d||c,g=e.winner(),h=e.loser();g&&h&&(g.name.isEmpty()||f(g.seed.get(),"highlightWinner",b).highlight(),h.name.isEmpty()||f(h.seed.get(),"highlightLoser",b).highlight()),b.find(".team").mouseover(function(){var c=a(this).attr("data-teamid");if(void 0!==c){var d=f(parseInt(c,10),null,b);d.highlight(),a(this).mouseout(function(){d.deHighlight(),a(this).unbind("mouseout")})}})}function h(b,c,d){var e=a('');e.val(c),b.empty().append(e),e.focus(),e.blur(function(){d(e.val())}),e.keydown(function(a){var b=a.keyCode||a.which;9!==b&&13!==b&&27!==b||(a.preventDefault(),d(e.val(),27!==b))})}function i(a,b,c,d){switch(d){case"empty-bye":return void a.append("BYE");case"empty-tbd":return void a.append("TBD");case"entry-no-score":case"entry-default-win":case"entry-complete":return void a.append(b)}}function j(a){var b=a.el,c=b.find(".team.win");c.append('
1st
');var d=b.find(".team.lose");return d.append('2nd
'),!0}function k(a){var b=a.el,c=b.find(".team.win");c.append('3rd
');var d=b.find(".team.lose");return d.append('4th
'),!0}function l(a,b,c,d,e){for(var f,g=Math.log(2*b.length)/Math.log(2),h=b.length,i=0;i1&&!d.skipConsolationRound)){var o=a.final().getRound().prev(),p=o.map(function(a){return function(){return a.match(0).loser()}}).toNull(),q=o.map(function(a){return function(){return a.match(1).loser()}}).toNull(),r=f.addMatch(function(){return[{source:p},{source:q}]},u.of(k));r.setAlignCb(function(b){var c=a.el.height()/2;r.el.css("height",c+"px");var e=b.height()/2+d.matchMargin;b.css("top",e+"px")}),r.setConnectorCb(u.empty())}}function m(a,b,c,d,e){for(var f=Math.log(2*c)/Math.log(2)-1,g=c/2,h=0;h2)throw new Error("Unexpected number of final rounds");return j(e)}if(2===a.size())return!1;var h=function(){var b=!e.winner().name.isEmpty()&&e.winner().name===c.winner().name;return g===!1&&b&&(g=!0,f()),!b&&g&&(g=!1,a.dropRound(),f()),b},i=a.addRound(u.of(h)),k=i.addMatch(function(){return[{source:function(){return e.first()}},{source:function(){return e.second()}}]},u.of(j));return e.setConnectorCb(u.of(function(a){return{height:0,shift:a.height()/2}})),k.setConnectorCb(u.empty()),k.setAlignCb(function(a){var d=b.el.height()+c.el.height();k.el.css("height",d+"px");var e=(b.el.height()/2+b.el.height()+c.el.height()/2)/2-a.height();a.css("top",e+"px")}),!1}));if(h.setAlignCb(function(a){var e=b.el.height()+c.el.height();d.skipConsolationRound||(e/=2),h.el.css("height",e+"px");var f=(b.el.height()/2+b.el.height()+c.el.height()/2)/2-a.height();a.css("top",f+"px")}),!d.skipConsolationRound){var i=c.final().getRound().prev(),l=g.addMatch(function(){return[{source:function(){return i.get().match(0).loser()}},{source:function(){return c.loser()}}]},u.of(k));l.setAlignCb(function(a){var d=(b.el.height()+c.el.height())/2;l.el.css("height",d+"px");var e=(b.el.height()/2+b.el.height()+c.el.height()/2)/2+a.height()/2-d;a.css("top",e+"px")}),h.setConnectorCb(u.empty()),l.setConnectorCb(u.empty())}b.final().setConnectorCb(u.of(function(a){var e=a.height()/4,f=(b.el.height()/2+b.el.height()+c.el.height()/2)/2-a.height()/2,g=f-b.el.height()/2,h=b.winner().order.map(function(a){return a.map({height:g+e*(d.centerConnectors?2:1),shift:e*(d.centerConnectors?2:1)},{height:g+e*(d.centerConnectors?2:0),shift:e*(d.centerConnectors?2:3)})}).orElse({height:g+e*(d.centerConnectors?2:1),shift:2*e}),i=h.height,j=h.shift;return i-=a.height()/2,{height:i,shift:j}})),c.final().setConnectorCb(u.of(function(a){var e=a.height()/4,f=(b.el.height()/2+b.el.height()+c.el.height()/2)/2-a.height()/2,g=f-b.el.height()/2,h=c.winner().order.map(function(a){return a.map({height:g+e*(d.centerConnectors?2:0),shift:e*(d.centerConnectors?2:3)},{height:g+2*e,shift:e*(d.centerConnectors?2:1)})}).orElse({height:g+e*(d.centerConnectors?2:1),shift:2*e}),i=h.height,j=h.shift;return i+=a.height()/2,{height:-i,shift:-j}}))}function o(b,c,d,e){var f=c.height,g=c.shift,h=b/2,i=!0;f<0&&(i=!1,f=-f),f<2&&(f=0);var j=a('').appendTo(d);j.css("height",f),j.css("width",h+"px"),j.css(e,-h-2+"px"),g>=0?j.css("top",g-1+"px"):j.css("bottom",-g-1+"px"),i?j.css("border-bottom","none"):j.css("border-top","none");var k=a('').appendTo(j);return k.css("width",h+"px"),k.css(e,-h+"px"),i?k.css("bottom","0px"):k.css("top","0px"),j}function p(a,b,c,d,e){if(b)return Math.log(2*a)/Math.log(2);if(c)return Math.max(2,2*(Math.log(2*a)/Math.log(2)-1)-1);var f=!d&&3===e.length&&2===e[2].length;return 2*(Math.log(2*a)/Math.log(2)-1)+1+(f?1:0)}function q(b){var c=a.extend(!0,{},b);return c.teams=c.teams.map(function(a){return a.map(function(a){return a.toNull()})}),c.results=c.results.map(function(a){return a.map(function(a){return a.map(function(a){var b=[a.first.toNull(),a.second.toNull()];return void 0!==a.userData&&b.push(a.userData),b})})}),c}function r(c,d,e,f,g,h,i,j,k,l){var m=e.name.isEmpty()||f.name.isEmpty()?"":'data-resultid="result-'+j.getNext()+'"',n=a('"),o=e.name.isEmpty()||f.name.isEmpty()||!g?u.empty():e.score.map(function(a){return""+a}),p=o.orElse("--");n.text(p);var q=e.name.map(function(){return o.map(function(){return"entry-complete"}).orElseGet(function(){return f.emptyBranch()===t.BYE?"entry-default-win":"entry-no-score"})}).orElseGet(function(){var a=e.emptyBranch();switch(a){case t.BYE:return"empty-bye";case t.TBD:return"empty-tbd";default:throw new Error("Unexpected branch type "+a)}}),r=a(''),s=a('').appendTo(r);if(i.decorator.render(s,e.name.toNull(),p,q),e.seed.forEach(function(a){r.attr("data-teamid",a)}),e.name.isEmpty()?r.addClass("na"):d.winner().name===e.name?r.addClass("win"):d.loser().name===e.name&&r.addClass("lose"),r.append(n),(!e.name.isEmpty()||e.name.isEmpty()&&0===c&&h)&&"function"==typeof i.save&&(i.disableTeamEdit||(s.addClass("editable"),s.click(function(){function b(){function f(f,g){var h=e.seed.get();i.init.teams[~~(h/2)][h%2]=u.of(f||null),l(!0),d.click(b);var j=i.el.find(".team[data-teamid="+(h+1)+"] div.label:first");j.length&&g===!0&&0===c&&a(j).click()}d.unbind(),i.decorator.edit(d,e.name.toNull(),f)}var d=a(this);b()})),!e.name.isEmpty()&&!f.name.isEmpty()&&g)){var w=j.get();n.addClass("editable"),n.click(function(){function c(){d.unbind();var f=b(e.score)?d.text():"0",g=a('');g.val(f),d.empty().append(g),g.focus().select(),g.keydown(function(c){b(a(this).val())?a(this).removeClass("error"):a(this).addClass("error");var d=c.keyCode||c.which;if(9===d||13===d||27===d){if(c.preventDefault(),a(this).blur(),27===d)return;var e=k.find("div.score[data-resultid=result-"+(w+1)+"]");e&&e.click()}}),g.blur(function(){var a=g.val();a&&b(a)||b(e.score)?a&&b(a)||!b(e.score)||(a=e.score):a="0",d.html(a),b(a)&&(e.score=v.of(parseInt(a,10)),l(!0)),d.click(c)})}var d=a(this);c()})}return r}function s(b,c,d){var e=a('').appendTo(b),f=a('+').appendTo(e);if(f.click(function(){for(var a=c.teams.length,b=0;b1&&1===c.results.length||c.teams.length>2&&3===c.results.length){var g=a('-').appendTo(e);g.click(function(){if(c.teams.length>1)return c.teams=c.teams.slice(0,c.teams.length/2),K(d)})}if(1===c.results.length&&c.teams.length>1){var h=a('de').appendTo(e);h.click(function(){if(c.teams.length>1&&c.results.length<3)return c.results.push([],[]),K(d)})}else if(3===c.results.length&&c.teams.length>1){var h=a('se').appendTo(e);h.click(function(){if(3===c.results.length)return c.results=c.results.slice(0,1),K(d)})}}var t,u=function(){function a(b){if(this.val=b,b instanceof a)throw new Error("Trying to wrap Option into an Option");if(void 0===this.val)throw new Error("Option cannot contain undefined")}return a.of=function(b){return new a(b)},a.empty=function(){return new a(null)},a.prototype.get=function(){if(null===this.val)throw new Error("Trying to get() empty Option");return this.val},a.prototype.orElse=function(a){return null===this.val?a:this.val},a.prototype.orElseGet=function(a){return null===this.val?a():this.val},a.prototype.map=function(b){return null===this.val?a.empty():new a(b(this.val))},a.prototype.forEach=function(a){return null!==this.val&&a(this.val),this},a.prototype.toNull=function(){return null===this.val?null:this.val},a.prototype.isEmpty=function(){return null===this.val},a}(),v=function(a){function b(){a.apply(this,arguments)}return __extends(b,a),b.of=function(a){var b=typeof a,c="number";if(null!==a&&b!==c)throw new Error("Invalid score format, expected "+c+", got "+b);return u.of(a)},b.empty=function(){return u.empty()},b}(u),w=function(){function a(a,b,c){if(this.first=a,this.second=b,this.userData=c,!a||!b)throw new Error("Cannot create ResultObject with undefined scores")}return a}();!function(a){a[a.TBD=0]="TBD",a[a.BYE=1]="BYE"}(t||(t={}));var x=function(){function a(a){this.isFirst=a}return a.first=function(){return new a(!0)},a.second=function(){return new a(!1)},a.prototype.map=function(a,b){return this.isFirst?a:b},a}(),y=function(){function a(a,b,c,d,e){this.source=a,this.name=b,this.order=c,this.seed=d,this.score=e}return a.prototype.emptyBranch=function(){if(!this.name.isEmpty())return t.TBD;try{return this.source().emptyBranch()}catch(a){if(a instanceof c)return t.BYE;throw new Error("Unexpected exception type")}},a}(),z=function(){function a(a,b){this.a=a,this.b=b}return a.teamsInResultOrder=function(a){var b=a.a.name.isEmpty(),c=a.b.name.isEmpty();if(c&&!b)return a.b.emptyBranch()===t.BYE?[a.a,a.b]:[];if(b&&!c)return a.a.emptyBranch()===t.BYE?[a.b,a.a]:[];if(!a.a.score.isEmpty()&&!a.b.score.isEmpty()){if(a.a.score.get()>a.b.score.get())return[a.a,a.b];if(a.a.score.get()'),this.matches=[]}return Object.defineProperty(b.prototype,"el",{get:function(){return this.roundCon},enumerable:!0,configurable:!0}),b.prototype.addMatch=function(a,b){var c=this,d=this.matches.length,e=null!==a?a():[{source:function(){return c.bracket.round(c.roundNumber-1).match(2*d).winner()}},{source:function(){return c.bracket.round(c.roundNumber-1).match(2*d+1).winner()}}],f=function(){return e[0].source()},g=function(){return e[1].source()},h=new z(new y(f,f().name,u.of(x.first()),f().seed,v.empty()),new y(g,g().name,u.of(x.second()),g().seed,v.empty())),i=this.mkMatch(this,h,d,this._results.map(function(a){return void 0===a[d]?null:a[d]}),b,this.isFirstBracket,this.opts);return this.matches.push(i),i},b.prototype.match=function(a){return this.matches[a]},b.prototype.prev=function(){return this.previousRound},b.prototype.size=function(){return this.matches.length},b.prototype.render=function(){this.roundCon.empty(),(this.doRenderCb.isEmpty()||this.doRenderCb.get()())&&(this.roundCon.appendTo(this.bracket.el),this.matches.forEach(function(a){return a.render()}))},b.prototype.results=function(){return this.matches.reduce(function(a,b){return a.concat([b.results()])},[])},b}(),F=function(){function a(a,b,c,d,e){this.bracketCon=a,this.initResults=b,this.mkMatch=c,this.isFirstBracket=d,this.opts=e,this.rounds=[]}return Object.defineProperty(a.prototype,"el",{get:function(){return this.bracketCon},enumerable:!0,configurable:!0}),a.prototype.addRound=function(a){var b=this.rounds.length,c=b>0?u.of(this.rounds[b-1]):u.empty(),d=this.initResults.map(function(a){return void 0===a[b]?new w(v.empty(),v.empty(),void 0):a[b]}),e=new E(this,c,b,d,a,this.mkMatch,this.isFirstBracket,this.opts);return this.rounds.push(e),e},a.prototype.dropRound=function(){this.rounds.pop()},a.prototype.round=function(a){return this.rounds[a]},a.prototype.size=function(){return this.rounds.length},a.prototype.final=function(){return this.rounds[this.rounds.length-1].match(0)},a.prototype.winner=function(){return this.rounds[this.rounds.length-1].match(0).winner()},a.prototype.loser=function(){return this.rounds[this.rounds.length-1].match(0).loser()},a.prototype.render=function(){this.bracketCon.empty();for(var a=0;a'),this.teamCon=a(''),this.alignCb=null,this.matchUserData=f.isEmpty()?void 0:f.get().userData,!i.save){var m=this.matchUserData;i.onMatchHover&&this.teamCon.hover(function(){i.onMatchHover(m,!0)},function(){i.onMatchHover(m,!1)}),i.onMatchClick&&this.teamCon.click(function(){i.onMatchClick(m)})}d.a.name=d.a.source().name,d.b.name=d.b.source().name,d.a.score=f.map(function(a){return a.first.toNull()}),d.b.score=f.map(function(a){return a.second.toNull()}),d.a.name&&d.b.name||!b(d.a.score)&&!b(d.b.score)||(console.log("ERROR IN SCORE DATA: "+d.a.source().name+": "+d.a.score+", "+d.b.source().name+": "+d.b.score),d.a.score=d.b.score=v.empty())}return Object.defineProperty(c.prototype,"el",{get:function(){return this.matchCon},enumerable:!0,configurable:!0}),c.prototype.getRound=function(){return this.round},c.prototype.setConnectorCb=function(a){this.connectorCb=a},c.prototype.connect=function(a){var b=this,c="lr"===this.opts.dir?"right":"left",d=this.teamCon.height()/4,e=this.matchCon.height()/2,f=a.map(function(a){return a(b.teamCon,b)}).orElseGet(function(){return b.seed%2===0?b.winner().order.map(function(a){return a.map({shift:d*(b.opts.centerConnectors?2:1),height:e},{shift:d*(b.opts.centerConnectors?2:3),height:e-d*(b.opts.centerConnectors?0:2)})}).orElse({shift:2*d,height:e-d*(b.opts.centerConnectors?0:1)}):b.winner().order.map(function(a){return a.map({shift:-d*(b.opts.centerConnectors?2:3),height:-e+d*(b.opts.centerConnectors?0:2)},{shift:-d*(b.opts.centerConnectors?2:1),height:-e})}).orElse({shift:2*-d,height:-e+d*(b.opts.centerConnectors?0:1)})});this.teamCon.append(o(this.opts.roundMargin,f,this.teamCon,c))},c.prototype.winner=function(){return this.match.winner()},c.prototype.loser=function(){return this.match.loser()},c.prototype.first=function(){return this.match.a},c.prototype.second=function(){return this.match.b},c.prototype.setAlignCb=function(a){this.alignCb=a},c.prototype.render=function(){var a=this;this.matchCon.empty(),this.teamCon.empty(),this.match.a.name=this.match.a.source().name,this.match.b.name=this.match.b.source().name,this.match.a.seed=this.match.a.source().seed,this.match.b.seed=this.match.b.source().seed;var b=this.match.a.name.isEmpty()&&this.match.b.name.isEmpty();b?this.teamCon.addClass("np"):this.match.winner().name?this.teamCon.removeClass("np"):this.teamCon.addClass("np");var c=!this.match.a.name.isEmpty()&&!this.match.b.name.isEmpty();this.teamCon.append(r(this.round.roundNumber,this.match,this.match.a,this.match.b,c,this.isFirstBracket,this.opts,this.resultId,this.topCon,this.renderAll)),this.teamCon.append(r(this.round.roundNumber,this.match,this.match.b,this.match.a,c,this.isFirstBracket,this.opts,this.resultId,this.topCon,this.renderAll)),this.matchCon.appendTo(this.round.el),this.matchCon.append(this.teamCon),this.el.css("height",this.round.bracket.el.height()/this.round.size()+"px"),this.teamCon.css("top",this.el.height()/2-this.teamCon.height()/2+"px"),null!==this.alignCb&&this.alignCb(this.teamCon);var d=this.renderCb.map(function(b){return b(a)}).orElse(!1);d||this.connect(this.connectorCb)},c.prototype.results=function(){var a=this.match.a.name.isEmpty()||this.match.b.name.isEmpty();return a&&(this.match.a.score=this.match.b.score=v.empty()),new w(this.match.a.score,this.match.b.score,this.matchUserData)},c}(),I=function(a){return void 0===a?null:a},J=function(a){return a.map(function(a){return a.map(function(a){return a.map(function(a){return new w(v.of(I(a[0])),v.of(I(a[1])),a[2])})})})},K=function(b){function c(){var a=p(j.teams.length,k,b.skipGrandFinalComeback,b.skipSecondaryFinal,j.results);b.disableToolbar?r.css("width",a*(b.teamWidth+b.scoreWidth+b.roundMargin)+10):r.css("width",a*(b.teamWidth+b.scoreWidth+b.roundMargin)+40),k&&j.teams.length<=2&&!b.skipConsolationRound&&r.css("height",o+40)}function d(a){i.reset(),e.render(),f&&f.render(),h&&!b.skipGrandFinalComeback&&h.render(),b.disableHighlight||g(r,e,h),a&&(j.results[0]=e.results(),f&&(j.results[1]=f.results()),h&&!b.skipGrandFinalComeback&&(j.results[2]=h.results()),c(),b.save&&b.save(q(j),b.userData))}var e,f,h,i=new G,j=b.init,k=j.results.length<=1,o=45*j.teams.length+j.teams.length*b.matchMargin,r=a('').appendTo(b.el.empty());b.skipSecondaryFinal&&k&&a.error("skipSecondaryFinal setting is viable only in double elimination mode"),b.disableToolbar||s(r,j,b);var t,v,w;k?v=a('').appendTo(r):(b.skipGrandFinalComeback||(t=a('').appendTo(r)),v=a('').appendTo(r),w=a('').appendTo(r)),v.css("height",o),w&&w.css("height",v.height()/2),c();var x=function(a,b,c,e,f,g,h){return new H(a,b,c,e,f,g,h,i,r,d)};return e=new F(v,u.of(j.results[0]||null),x,!0,b),k||(f=new F(w,u.of(j.results[1]||null),x,!1,b),b.skipGrandFinalComeback||(h=new F(t,u.of(j.results[2]||null),x,!1,b))),l(e,j.teams,k,b,b.skipGrandFinalComeback&&!k),k||(m(e,f,j.teams.length,b.skipGrandFinalComeback,b.centerConnectors),b.skipGrandFinalComeback||n(h,e,f,b,r,c)),d(!1),{data:function(){return q(b.init)}}},L=function(a,b){if(a.hasOwnProperty(b)){var c="number",d=typeof a[b];if(d!==c)throw new Error('Option "'+b+'" is '+d+" instead of "+c)}},M=function(a,b){var c=a[b],d="boolean",e=typeof c;if(e!==d)throw new Error("Value of "+b+" must be boolean, got "+d+", got "+e)},N=function(a,b,c){var d=b[c];if(d