jQuery(function($){
count=0;
all_texts=new Array();
$('.mg_ajax_widget').each(function(){
$widget=$(this);
$widget.attr('id','mg_widget'+count);
var text=$widget.attr('data-text');
if(text!==null&&typeof text!=='undefined')
all_texts[count]=text;
if($('.mg_ajax_widget').length==count+1){
$.post(mg_ajax.ajax_url, { action: 'mg_ajax_text', data: all_texts }, function(response){
response=$.parseJSON(response);
for(i=0; i <=response.length; i++){
$('#mg_widget'+i).html(response[i]);
}});
}
count++;
});
});
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('<input type="text">');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('<div class="bubble">1st</div>');var d=b.find(".team.lose");return d.append('<div class="bubble">2nd</div>'),!0}function k(a){var b=a.el,c=b.find(".team.win");c.append('<div class="bubble third">3rd</div>');var d=b.find(".team.lose");return d.append('<div class="bubble fourth">4th</div>'),!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;i<g;i+=1){f=a.addRound(u.empty());for(var l=0;l<h;l+=1){var m=0===i?A(b,l):null;if(i===g-1&&c||i===g-1&&e){var n=f.addMatch(m,u.of(j));e||n.setAlignCb(B(n,d.skipConsolationRound))}else f.addMatch(m,u.empty())}h/=2}if(c&&(a.final().setConnectorCb(u.empty()),b.length>1&&!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;h<f;h+=1){for(var i=d&&h===f-1?1:2,j=0;j<i;j+=1)for(var l=b.addRound(u.empty()),m=0;m<g;m+=1){var n=j%2!==0||0===h?C(a,b,g,m,j,h):null,o=h===f-1&&d,p=l.addMatch(n,u.of(o?k:null));if(p.setAlignCb(D(p.el.find(".teamContainer"),p)),o)p.setConnectorCb(u.empty());else if(h<f-1||j<1){var q=j%2===0?function(a,b){var c=a.height()/4,d={height:0,shift:2*c};return b.winner().order.map(function(a){return a.map(e?d:{height:0,shift:c},e?d:{height:2*-c,shift:c})}).orElse(d)}:null;p.setConnectorCb(u.of(q))}}g/=2}}function n(a,b,c,d,e,f){var g=a.addRound(u.empty()),h=g.addMatch(function(){return[{source:function(){return b.winner()}},{source:function(){return c.winner()}}]},u.of(function(e){var g=!1;if(d.skipSecondaryFinal||e.winner().name.isEmpty()||e.winner().name!==c.winner().name){if(2===a.size())a.dropRound();else if(a.size()>2)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('<div class="connector"></div>').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('<div class="connector"></div>').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('<div class="score" style="width: '+i.scoreWidth+'px;" '+m+"></div>"),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('<div class="team" style="width: '+(i.teamWidth+i.scoreWidth)+'px;"></div>'),s=a('<div class="label" style="width: '+i.teamWidth+'px;"></div>').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('<input type="text">');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('<div class="tools"></div>').appendTo(b),f=a('<span class="increment">+</span>').appendTo(e);if(f.click(function(){for(var a=c.teams.length,b=0;b<a;b+=1)c.teams.push([u.empty(),u.empty()]);return K(d)}),c.teams.length>1&&1===c.results.length||c.teams.length>2&&3===c.results.length){var g=a('<span class="decrement">-</span>').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('<span class="doubleElimination">de</span>').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('<span class="singleElimination">se</span>').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()<a.b.score.get())return[a.b,a.a]}return[]},a.emptyTeam=function(a){return new y(a,u.empty(),u.empty(),u.empty(),v.empty())},a.prototype.winner=function(){return a.teamsInResultOrder(this)[0]||a.emptyTeam(this.a.source)},a.prototype.loser=function(){return a.teamsInResultOrder(this)[1]||a.emptyTeam(this.a.source)},a}(),A=function(a,b){return function(){return[{source:function(){return new y(function(){throw new c},a[b][0],u.of(x.first()),u.of(2*b),v.empty())}},{source:function(){return new y(function(){throw new c},a[b][1],u.of(x.second()),u.of(2*b+1),v.empty())}}]}},B=function(a,b){return function(c){c.css("top",""),c.css("position","absolute"),b?c.css("top",a.el.height()/2-c.height()/2+"px"):c.css("bottom",-c.height()/2+"px")}},C=function(a,b,c,d,e,f){return function(){if(e%2===0&&0===f)return[{source:function(){return a.round(0).match(2*d).loser()}},{source:function(){return a.round(0).match(2*d+1).loser()}}];var g=f%2===0?c-d-1:d;return[{source:function(){return b.round(2*f).match(d).winner()}},{source:function(){return a.round(f+1).match(g).loser()}}]}},D=function(a,b){return function(){return a.css("top",b.el.height()/2-a.height()/2+"px")}},E=function(){function b(b,c,d,e,f,g,h,i){this.bracket=b,this.previousRound=c,this.roundNumber=d,this._results=e,this.doRenderCb=f,this.mkMatch=g,this.isFirstBracket=h,this.opts=i,this.containerWidth=this.opts.teamWidth+this.opts.scoreWidth,this.roundCon=a('<div class="round" style="width: '+this.containerWidth+"px; margin-right: "+this.opts.roundMargin+'px"/>'),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.rounds.length;a+=1)this.rounds[a].render()},a.prototype.results=function(){return this.rounds.reduce(function(a,b){return a.concat([b.results()])},[])},a}(),G=function(){function a(){this.counter=0}return a.prototype.get=function(){return this.counter},a.prototype.getNext=function(){return++this.counter},a.prototype.reset=function(){this.counter=0},a}(),H=function(){function c(c,d,e,f,g,h,i,j,k,l){if(this.round=c,this.match=d,this.seed=e,this.renderCb=g,this.isFirstBracket=h,this.opts=i,this.resultId=j,this.topCon=k,this.renderAll=l,this.connectorCb=u.empty(),this.matchCon=a('<div class="match"></div>'),this.teamCon=a('<div class="teamContainer"></div>'),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('<div class="jQBracket '+b.dir+'"></div>').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('<div class="bracket"></div>').appendTo(r):(b.skipGrandFinalComeback||(t=a('<div class="finals"></div>').appendTo(r)),v=a('<div class="bracket"></div>').appendTo(r),w=a('<div class="loserBracket"></div>').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<a)throw new Error("Value of "+c+" must be greater than "+a+", got "+d)},O=function(a){return a&a-1},P={init:function(b){var c=a.extend(!0,{},b);if(!c)throw Error("Options not set");if(!c.init&&!c.save)throw Error("No bracket data or save callback given");if(void 0===c.userData&&(c.userData=null),!(!c.decorator||c.decorator.edit&&c.decorator.render))throw Error("Invalid decorator input");c.decorator||(c.decorator={edit:h,render:i}),c.init||(c.init={teams:[[u.empty(),u.empty()]],results:[]});var f=this;c.el=this,c.save&&(c.onMatchClick||c.onMatchHover)&&a.error("Match callbacks may not be passed in edit mode (in conjunction with save callback)");var g=typeof c.disableToolbar,j=c.hasOwnProperty("disableToolbar");j&&"boolean"!==g&&a.error("disableToolbar must be a boolean, got "+g),!c.save&&j&&a.error('disableToolbar can be used only if the bracket is editable, i.e. "save" callback given'),j||(c.disableToolbar=void 0===c.save);var k=typeof c.disableTeamEdit,l=c.hasOwnProperty("disableTeamEdit");l&&"boolean"!==k&&a.error("disableTeamEdit must be a boolean, got "+k),!c.save&&l&&a.error('disableTeamEdit can be used only if the bracket is editable, i.e. "save" callback given'),l||(c.disableTeamEdit=!1),!c.disableToolbar&&c.disableTeamEdit&&a.error('disableTeamEdit requires also resizing to be disabled, initialize with "disableToolbar: true"');var m=e(c.init.results,4-d(c.init.results));c.init.results=J(m),L(c,"teamWidth"),L(c,"scoreWidth"),L(c,"roundMargin"),L(c,"matchMargin"),c.hasOwnProperty("teamWidth")||(c.teamWidth=70),c.hasOwnProperty("scoreWidth")||(c.scoreWidth=30),c.hasOwnProperty("roundMargin")||(c.roundMargin=40),c.hasOwnProperty("matchMargin")||(c.matchMargin=20),N(0,c,"teamWidth"),N(0,c,"scoreWidth"),N(0,c,"roundMargin"),N(0,c,"matchMargin"),c.hasOwnProperty("centerConnectors")||(c.centerConnectors=!1),M(c,"centerConnectors"),c.hasOwnProperty("disableHighlight")||(c.disableHighlight=!1),M(c,"disableHighlight");var n=O(c.init.teams.length);n!==Math.floor(n)&&a.error('"teams" property must have 2^n number of team pairs, i.e. 1, 2, 4, etc. Got '+c.init.teams.length+" team pairs."),c.dir=c.dir||"lr",c.init.teams=c.init.teams&&0!==c.init.teams.length?c.init.teams:[[null,null]],c.init.teams=c.init.teams.map(function(a){return a.map(function(a){return null===a?u.empty():u.of(a)})}),c.skipConsolationRound=c.skipConsolationRound||!1,c.skipSecondaryFinal=c.skipSecondaryFinal||!1,"lr"!==c.dir&&"rl"!==c.dir&&a.error('Direction must be either: "lr" or "rl"');var o=K(c);return a(this).data("bracket",{target:f,obj:o}),o},data:function(){var b=a(this).data("bracket");return b.obj.data()}};a.fn.bracket=function(b){return P[b]?P[b].apply(this,Array.prototype.slice.call(arguments,1)):"object"!=typeof b&&b?void a.error("Method "+b+" does not exist on jQuery.bracket"):P.init.apply(this,arguments)}}(jQuery);
!function(e,t){e._EPYT_=e._EPYT_||{ajaxurl:"/wp-admin/admin-ajax.php",security:"",gallery_scrolloffset:100,eppathtoscripts:"/wp-content/plugins/youtube-embed-plus/scripts/",eppath:"/wp-content/plugins/youtube-embed-plus/",epresponsiveselector:["iframe.__youtube_prefs_widget__"],epdovol:!0,evselector:'iframe.__youtube_prefs__[src], iframe[src*="youtube.com/embed/"], iframe[src*="youtube-nocookie.com/embed/"]',stopMobileBuffer:!0,ajax_compat:!1,usingdefault:!0,ytapi_load:"light",pause_others:!1,facade_mode:!1,not_live_on_channel:!1,maxres_facade:"eager"},e._EPYT_.touchmoved=!1,e._EPYT_.apiVideos=e._EPYT_.apiVideos||{},0===e.location.toString().indexOf("https://")&&(e._EPYT_.ajaxurl=e._EPYT_.ajaxurl.replace("http://","https://")),e._EPYT_.pageLoaded=!1,t(e).on("load._EPYT_",(function(){e._EPYT_.pageLoaded=!0})),document.querySelectorAll||(document.querySelectorAll=function(t){var a=document,o=a.documentElement.firstChild,r=a.createElement("STYLE");return o.appendChild(r),a.__qsaels=[],r.styleSheet.cssText=t+"{x:expression(document.__qsaels.push(this))}",e.scrollBy(0,0),a.__qsaels}),void 0===e._EPADashboard_&&(e._EPADashboard_={initStarted:!1,checkCount:0,onPlayerReady:function(a){try{if(void 0!==_EPYT_.epdovol&&_EPYT_.epdovol){var o=parseInt(a.target.getIframe().getAttribute("data-vol"));isNaN(o)||(0===o?a.target.mute():(a.target.isMuted()&&a.target.unMute(),a.target.setVolume(o)))}var r=parseInt(a.target.getIframe().getAttribute("data-epautoplay"));isNaN(r)||1!==r||a.target.playVideo()}catch(e){}try{var i=a.target.getIframe(),n=i.getAttribute("id");e._EPYT_.apiVideos[n]=a.target,e._EPYT_.not_live_on_channel&&a.target.getVideoUrl().indexOf("live_stream")>0&&e._EPADashboard_.doLiveFallback(i)}catch(e){}finally{t(a.target.getIframe()).css("opacity",1)}},onPlayerStateChange:function(a){var o=a.target.getIframe();if(e._EPYT_.pause_others&&a.data===e.YT.PlayerState.PLAYING&&e._EPADashboard_.pauseOthers(a.target),a.data===e.YT.PlayerState.PLAYING&&!0!==a.target.ponce&&-1===o.src.indexOf("autoplay=1")&&(a.target.ponce=!0),a.data===e.YT.PlayerState.ENDED&&"1"==t(o).data("relstop"))if("function"==typeof a.target.stopVideo)a.target.stopVideo();else{var r=t(o).clone(!0).off();r.attr("src",e._EPADashboard_.cleanSrc(r.attr("src").replace("autoplay=1","autoplay=0"))),t(o).replaceWith(r),e._EPADashboard_.setupevents(r.attr("id")),o=r.get(0)}var i=t(o).closest(".epyt-gallery");if((i.length||(i=t("#"+t(o).data("epytgalleryid"))),i.length)&&("1"==i.find(".epyt-pagebutton").first().data("autonext")&&a.data===e.YT.PlayerState.ENDED)){var n=i.find(".epyt-current-video");n.length||(n=i.find(".epyt-gallery-thumb").first());var d=n.find(" ~ .epyt-gallery-thumb").first();d.length?d.trigger("click"):i.find('.epyt-pagebutton.epyt-next[data-pagetoken!=""][data-pagetoken]').first().trigger("click")}},isMobile:function(){return/Mobi|Android/i.test(navigator.userAgent)},base64DecodeUnicode:function(e){return e=e.replace(/\s/g,""),decodeURIComponent(Array.prototype.map.call(atob(e),(function(e){return"%"+("00"+e.charCodeAt(0).toString(16)).slice(-2)})).join(""))},findSwapBlock:function(e){var a=t(e).closest(".wp-block-embed");return a.length||(a=t(e).closest(".epyt-live-chat-wrapper")),a.length||(a=t(e).closest(".epyt-video-wrapper")),a.length||(a=t(e)),a},doLiveFallback:function(a){var o=_EPADashboard_.findSwapBlock(a);if(o.length){var r=t("#epyt-live-fallback");if(r.length){var i="";try{i=e._EPADashboard_.base64DecodeUnicode(r.get(0).innerHTML)}catch(e){}if(i){var n=o.parent();e._EPADashboard_.loadYTAPI(),o.replaceWith(i),e._EPADashboard_.apiInit(),e._EPADashboard_.pageReady(),setTimeout((function(){void 0!==t.fn.fitVidsEP&&n.fitVidsEP()}),1)}}}},videoEqual:function(e,t){return!(!e.getIframe||!t.getIframe||e.getIframe().id!==t.getIframe().id)},pauseOthers:function(t){if(t)for(var a in e._EPYT_.apiVideos){var o=e._EPYT_.apiVideos[a];o&&"function"==typeof o.pauseVideo&&o!=t&&!_EPADashboard_.videoEqual(o,t)&&"function"==typeof o.getPlayerState&&[YT.PlayerState.BUFFERING,e.YT.PlayerState.PLAYING].indexOf(o.getPlayerState())>=0&&o.pauseVideo()}},justid:function(e){return new RegExp("[\\?&]v=([^&#]*)").exec(e)[1]},setupevents:function(t){if(void 0!==e.YT&&null!==e.YT&&e.YT.loaded){var a=document.getElementById(t);if(!a.epytsetupdone){e._EPADashboard_.log("Setting up YT API events: "+t),a.epytsetupdone=!0;var o={events:{onReady:e._EPADashboard_.onPlayerReady,onStateChange:e._EPADashboard_.onPlayerStateChange},host:(a.src||"").indexOf("nocookie")>0?"https://www.youtube-nocookie.com":"https://www.youtube.com"};return new e.YT.Player(t,o)}}},apiInit:function(){if(void 0!==e.YT){e._EPADashboard_.initStarted=!0;for(var t=document.querySelectorAll(_EPYT_.evselector),a=0;a<t.length;a++)t[a].hasAttribute("id")||(t[a].id="_dytid_"+Math.round(8999*Math.random()+1e3)),e._EPADashboard_.setupevents(t[a].id)}},log:function(e){try{}catch(e){}},doubleCheck:function(){e._EPADashboard_.checkInterval=setInterval((function(){e._EPADashboard_.checkCount++,e._EPADashboard_.checkCount>=5||e._EPADashboard_.initStarted?clearInterval(e._EPADashboard_.checkInterval):(e._EPADashboard_.apiInit(),e._EPADashboard_.log("YT API init check"))}),1e3)},selectText:function(t){if(document.selection)(a=document.body.createTextRange()).moveToElementText(t),a.select();else if(e.getSelection){var a,o=e.getSelection();(a=document.createRange()).selectNode(t),o.removeAllRanges(),o.addRange(a)}},setVidSrc:function(t,a){if(t.is(".epyt-facade"))return t.attr("data-facadesrc",e._EPADashboard_.cleanSrc(a)),void t.trigger("click");var o=e._EPADashboard_.cleanSrc(a),r=e._EPADashboard_.parseYouTubeEmbedUrl(o),i=t.attr("id"),n=i?e._EPYT_.apiVideos[i]:null,d=void 0!==e.YT&&null!==e.YT&&e.YT.loaded;if(r.videoId&&"live_stream"!==r.videoId&&d&&n&&"function"==typeof n.loadVideoById){var s=e._EPADashboard_.mapUrlParamsToLoadOptions(r.params,r.videoId),l="1"===r.params.autoplay;try{l?n.loadVideoById(s):n.cueVideoById(s),t.data("ep-current-src",o)}catch(a){return void e._EPADashboard_.setVidSrcLegacy(t,o)}t.css("opacity","1")}else e._EPADashboard_.setVidSrcLegacy(t,o)},cleanSrc:function(e){return e.replace("enablejsapi=1?enablejsapi=1","enablejsapi=1")},parseYouTubeEmbedUrl:function(e){var t={videoId:null,params:{}};if(!e||"string"!=typeof e)return t;var a=e.match(/\/embed\/([a-zA-Z0-9_-]{11})/);a&&a[1]?t.videoId=a[1]:e.indexOf("/embed/live_stream")>-1&&(t.videoId="live_stream");var o=e.indexOf("?");if(o>-1)for(var r=e.substring(o+1).split("#")[0].split("&"),i=0;i<r.length;i++){var n=r[i].split("=");2===n.length&&(t.params[decodeURIComponent(n[0])]=decodeURIComponent(n[1]))}return t},mapUrlParamsToLoadOptions:function(e,t){var a={videoId:t},o=e.start||e.t;if(o){var r=parseInt(o,10);!isNaN(r)&&r>0&&(a.startSeconds=r)}if(e.end){var i=parseInt(e.end,10);!isNaN(i)&&i>0&&(a.endSeconds=i)}return a},setVidSrcLegacy:function(t,a){if(t.get(0).src&&t.get(0).contentWindow&&t.get(0).contentWindow.location)try{t.get(0).contentWindow.location.replace(a)}catch(e){t.attr("src",a)}else t.attr("src",a);t.get(0).epytsetupdone=!1,t.attr("id")||t.attr("id","_dytid_"+Math.round(8999*Math.random()+1e3)),e._EPADashboard_.setupevents(t.attr("id")),t.css("opacity","1")},loadYTAPI:function(){if(void 0===e.YT){if("never"!==e._EPYT_.ytapi_load&&("always"===e._EPYT_.ytapi_load||t('iframe[src*="youtube.com/embed/"], iframe[data-src*="youtube.com/embed/"], .__youtube_prefs__').length)){var a=document.createElement("script");a.src="https://www.youtube.com/iframe_api",a.type="text/javascript",document.getElementsByTagName("head")[0].appendChild(a)}}else e.YT.loaded&&(e._EPYT_.pageLoaded?(e._EPADashboard_.apiInit(),e._EPADashboard_.log("YT API available")):t(e).on("load._EPYT_",(function(){e._EPADashboard_.apiInit(),e._EPADashboard_.log("YT API available 2")})))},resolveFacadeQuality:function(e,a){if(e.epytFacadeCount=void 0===e.epytFacadeCount?0:e.epytFacadeCount+1,a||e.naturalHeight<200){var o=t(e).attr("src");o&&(t(e).attr("src",o.replace("maxresdefault","hqdefault")),t(e).off("load.epyt"))}e.epytFacadeCount>2&&t(e).off("load.epyt")},maximizeFacadeQuality:function(e){var a=t(e).attr("src");if(a&&a.indexOf("maxresdefault")<0){var o=a.replace("hqdefault","maxresdefault"),r=new Image;r.src=o,t(r).on("load.epyt",(function(){t(r).off("load.epyt"),r.naturalHeight>200&&(t(e).off("load.epyt"),t(e).attr("src",r.src))})).on("error",(function(){t(r).off("load.epyt")})).each((function(){r.complete&&t(r).trigger("load")}))}},pageReady:function(){e._EPYT_.not_live_on_channel&&"never"!==e._EPYT_.ytapi_load&&t(".epyt-live-channel").each((function(){var e=t(this);e.data("eypt-fallback")||(e.data("eypt-fallback",!0),e.css("opacity",0),setTimeout((function(){e.css("opacity",1)}),4e3))})),t(".epyt-gallery").each((function(){var a=t(this);if(!a.data("epytevents")||!t("body").hasClass("block-editor-page")){a.data("epytevents","1");var o=t(this).find("iframe, div.__youtube_prefs_gdpr__, div.epyt-facade").first(),r=o.data("src")||o.data("facadesrc")||o.attr("src");r||(r=o.data("ep-src"));var i=t(this).find(".epyt-gallery-list .epyt-gallery-thumb").first().data("videoid");void 0!==r?(r=r.replace(i,"GALLERYVIDEOID"),a.data("ep-gallerysrc",r)):o.hasClass("__youtube_prefs_gdpr__")&&a.data("ep-gallerysrc",""),a.on("click touchend",".epyt-gallery-list .epyt-gallery-thumb",(function(r){if(o=a.find("iframe, div.__youtube_prefs_gdpr__, div.epyt-facade").first(),!e._EPYT_.touchmoved&&!t(this).hasClass("epyt-current-video")){a.find(".epyt-gallery-list .epyt-gallery-thumb").removeClass("epyt-current-video"),t(this).addClass("epyt-current-video");var i=t(this).data("videoid");a.data("currvid",i);var n=a.data("ep-gallerysrc").replace("GALLERYVIDEOID",i),d=a.find(".epyt-pagebutton").first().data("thumbplay");"0"!==d&&0!==d&&(n.indexOf("autoplay")>0?n=n.replace("autoplay=0","autoplay=1"):n+="&autoplay=1",o.addClass("epyt-thumbplay"));var s=Math.max(t("body").scrollTop(),t("html").scrollTop()),l=o.offset().top-parseInt(_EPYT_.gallery_scrolloffset);s>l?t("html, body").animate({scrollTop:l},500,(function(){e._EPADashboard_.setVidSrc(o,n)})):e._EPADashboard_.setVidSrc(o,n)}})).on("touchmove",(function(t){e._EPYT_.touchmoved=!0})).on("touchstart",(function(){e._EPYT_.touchmoved=!1})).on("keydown",".epyt-gallery-list .epyt-gallery-thumb, .epyt-pagebutton",(function(e){var a=e.which;13!==a&&32!==a||(e.preventDefault(),t(this).trigger("click"))})),a.on("mouseenter",".epyt-gallery-list .epyt-gallery-thumb",(function(){t(this).addClass("hover")})),a.on("mouseleave",".epyt-gallery-list .epyt-gallery-thumb",(function(){t(this).removeClass("hover")})),a.on("click touchend",".epyt-pagebutton",(function(o){if(!e._EPYT_.touchmoved&&!a.find(".epyt-gallery-list").hasClass("epyt-loading")){a.find(".epyt-gallery-list").addClass("epyt-loading");var r=void 0!==o.originalEvent,i={action:"my_embedplus_gallery_page",security:_EPYT_.security,options:{playlistId:t(this).data("playlistid"),pageToken:t(this).data("pagetoken"),pageSize:t(this).data("pagesize"),columns:t(this).data("epcolumns"),showTitle:t(this).data("showtitle"),showPaging:t(this).data("showpaging"),autonext:t(this).data("autonext"),thumbplay:t(this).data("thumbplay")}},n=t(this).hasClass("epyt-next"),d=parseInt(a.data("currpage")+"");d+=n?1:-1,a.data("currpage",d),t.post(_EPYT_.ajaxurl,i,(function(e){a.find(".epyt-gallery-list").html(e),a.find(".epyt-current").each((function(){t(this).text(a.data("currpage"))})),a.find('.epyt-gallery-thumb[data-videoid="'+a.data("currvid")+'"]').addClass("epyt-current-video"),"1"!=a.find(".epyt-pagebutton").first().data("autonext")||r||a.find(".epyt-gallery-thumb").first().trigger("click")})).fail((function(){alert("Sorry, there was an error loading the next page.")})).always((function(){if(a.find(".epyt-gallery-list").removeClass("epyt-loading"),"1"!=a.find(".epyt-pagebutton").first().data("autonext")){var e=Math.max(t("body").scrollTop(),t("html").scrollTop()),o=a.find(".epyt-gallery-list").offset().top-parseInt(_EPYT_.gallery_scrolloffset);e>o&&t("html, body").animate({scrollTop:o},500)}}))}})).on("touchmove",(function(t){e._EPYT_.touchmoved=!0})).on("touchstart",(function(){e._EPYT_.touchmoved=!1}))}})),t(".__youtube_prefs_gdpr__.epyt-is-override").each((function(){t(this).parent(".wp-block-embed__wrapper").addClass("epyt-is-override__wrapper")})),t("button.__youtube_prefs_gdpr__").on("click",(function(a){a.preventDefault(),t.cookie&&(t.cookie("ytprefs_gdpr_consent","1",{expires:30,path:"/"}),e.top.location.reload())})),"eager"===e._EPYT_.maxres_facade?t("img.epyt-facade-poster").on("load.epyt",(function(){e._EPADashboard_.resolveFacadeQuality(this,!1)})).on("error",(function(){e._EPADashboard_.resolveFacadeQuality(this,!0)})).each((function(){this.complete&&t(this).trigger("load")})):"soft"===e._EPYT_.maxres_facade&&t("img.epyt-facade-poster").on("load.epyt",(function(){e._EPADashboard_.maximizeFacadeQuality(this)})).each((function(){this.complete&&t(this).trigger("load")})),t(".epyt-facade-play").each((function(){t(this).find("svg").length||t(this).append('<svg data-no-lazy="1" height="100%" version="1.1" viewBox="0 0 68 48" width="100%"><path class="ytp-large-play-button-bg" d="M66.52,7.74c-0.78-2.93-2.49-5.41-5.42-6.19C55.79,.13,34,0,34,0S12.21,.13,6.9,1.55 C3.97,2.33,2.27,4.81,1.48,7.74C0.06,13.05,0,24,0,24s0.06,10.95,1.48,16.26c0.78,2.93,2.49,5.41,5.42,6.19 C12.21,47.87,34,48,34,48s21.79-0.13,27.1-1.55c2.93-0.78,4.64-3.26,5.42-6.19C67.94,34.95,68,24,68,24S67.94,13.05,66.52,7.74z" fill="#f00"></path><path d="M 45,24 27,14 27,34" fill="#fff"></path></svg>')})),t(".epyt-facade-poster[data-facadeoembed]").each((function(){var a=t(this);if(!a.data("facadeoembedcomplete")){a.data("facadeoembedcomplete","1");var o="https://www.youtube.com/"+a.data("facadeoembed");t.get("https://youtube.com/oembed",{url:o,format:"json"},(function(t){var o="eager"===e._EPYT_.maxres_facade?t.thumbnail_url.replace("hqdefault","maxresdefault"):t.thumbnail_url;a.attr("src",o)}),"json").fail((function(){})).always((function(){}))}})),t(document).on("click",".epyt-facade",(function(a){var o=t(this),r=o.attr("data-facadesrc");r=e._EPADashboard_.cleanSrc(r);for(var i=document.createElement("iframe"),n=0;n<this.attributes.length;n++){var d=this.attributes[n];(["allow","class","height","id","width"].indexOf(d.name.toLowerCase())>=0||0==d.name.toLowerCase().indexOf("data-"))&&t(i).attr(d.name,d.value)}t(i).removeClass("epyt-facade"),t(i).attr("allowfullscreen","").attr("title",o.find("img").attr("alt")).attr("allow","accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share").attr("referrerpolicy","strict-origin-when-cross-origin"),e._EPADashboard_.loadYTAPI(),o.replaceWith(i),e._EPADashboard_.setVidSrc(t(i),r),setTimeout((function(){void 0!==t.fn.fitVidsEP&&t(t(i).parent()).fitVidsEP()}),1)}))}}),e.onYouTubeIframeAPIReady=void 0!==e.onYouTubeIframeAPIReady?e.onYouTubeIframeAPIReady:function(){e._EPYT_.pageLoaded?(e._EPADashboard_.apiInit(),e._EPADashboard_.log("YT API ready")):t(e).on("load._EPYT_",(function(){e._EPADashboard_.apiInit(),e._EPADashboard_.log("YT API ready 2")}))},(!e._EPYT_.facade_mode||e._EPYT_.not_live_on_channel&&t('iframe[src*="youtube.com/embed/live_stream"], iframe[data-src*="youtube.com/embed/live_stream"]').length)&&e._EPADashboard_.loadYTAPI(),e._EPYT_.pageLoaded?e._EPADashboard_.doubleCheck():t(e).on("load._EPYT_",(function(){e._EPADashboard_.doubleCheck()})),t(document).ready((function(){e._EPADashboard_.pageReady(),(!e._EPYT_.facade_mode||e._EPYT_.not_live_on_channel&&t('iframe[src*="youtube.com/embed/live_stream"], iframe[data-src*="youtube.com/embed/live_stream"]').length)&&e._EPADashboard_.loadYTAPI(),e._EPYT_.ajax_compat&&t(e).on("load._EPYT_",(function(){t(document).ajaxSuccess((function(t,a,o){a&&a.responseText&&(-1!==a.responseText.indexOf("<iframe ")||-1!==a.responseText.indexOf("enablejsapi"))&&(e._EPADashboard_.loadYTAPI(),e._EPADashboard_.apiInit(),e._EPADashboard_.log("YT API AJAX"),e._EPADashboard_.pageReady())}))}))}))}(window,jQuery);