function replacePromoTokens(n){var t,i;if(n.html(n.html().replace(/##MP_PRICE##/g,window.dataLayer[findDLIndex("match-pass-price")]["match-pass-price"])),n.html(n.html().replace(/##MP_PURCHASE_LINK##/g,window.dataLayer[findDLIndex("match-pass-url")]["match-pass-url"])),typeof efltokens!="undefined")for(t in efltokens)i=efltokens[t],n.html(n.html().replace(new RegExp(t,"g"),i))}function showABTest(n){if(n.length!==0&&(replacePromoTokens(n),n.removeClass("hidden"),typeof n.attr("data-show-once")!="undefined")){var t=window.EFL.local.cookies;t.set("OptimizePromoShown","true",window.EFL.local.time.hour*n.attr("data-show-once"))}}function findDLIndex(n){for(var i,t=0;t<window.dataLayer.length;++t)if(typeof window.dataLayer[t][n]!="undefined"){i=t;break}return i}(function(){"use strict";function t(){window.EFL&&window.EFL.Dice&&window.EFL.Dice.partitionCode&&(console.log("found partition code",window.EFL.Dice.partitionCode),i())}function i(){EFL.EFLDiceLib.getUpcomingMatches({rpp:25}).then(function(n){r(n.data.events)}).catch(function(n){console.log(n)})}function r(n){var t=_.first(_.first(n).availablePurchases),i=_.first(t.amounts,function(n){return n.default}).currency==="GBP",r=_.chain(n).groupBy("externalId").filter(function(n){return n.length<2}).map(function(n){var t=_.first(n);return{id:t.externalId,home:t.details.participants[0].name,away:t.details.participants[1].name}}).value();$.ajax({type:"POST",url:"/api/holdbacks/populate",contentType:"application/json",dataType:"json",data:JSON.stringify({events:r,isUK:i,partitionCode:EFL.Dice.partitionCode}),success:function(n){var t,i,r;console.log(n);t=$("#holdbacks");n.HoldbackItems.length?(i=$("#video-blackout-results-tpl").text(),r=Sqrl.render(i,n),t.html(r)):(i=$("#video-blackout-no-results-tpl").text(),r=Sqrl.render(i,{}),t.html(r));t.removeClass("hidden")}})}var n={blackoutTrigger:"[data-efl-blackout]",holdbacksContainer:"[data-blackout-holdbacks]"};$(function(){$(n.blackoutTrigger).each(t)})})(jQuery);window.EFL=window.EFL||{};window.EFL.AnalyticsOptimize=function(){"use strict";function it(n){$("*[data-target-region]").each(function(){var t=$(this).data("target-region");t===n&&$(this).removeClass("hide");t==="ND"&&n!=="D"&&$(this).removeClass("hide")})}function rt(n){$("*[data-target-country]").each(function(){var t=$(this).data("target-country");t===n&&$(this).removeClass("hide")})}var o=900,t=window.EFL.local.cookies,n=window.EFL.local.storage,r,u,d;window.EFL.analyticsController.track({"next-match-first-team-ko":window.EFL.video.nextfxKO});window.EFL.analyticsController.track({"next-match-minutes":window.EFL.video.nextfxKOMins});window.EFL.video.nextfxMC===""?window.EFL.analyticsController.track({"next-match-first-team-mc":""}):window.EFL.analyticsController.track({"next-match-first-team-mc":window.EFL.video.nextfxMC});window.EFL.analyticsController.track({"video-subscribe-page":window.EFL.video.packagesUrl});r=t.get(window.EFL.video.videoLoggedInName);u=t.get(window.EFL.video.videoAccessLevelName);typeof r=="undefined"&&(r="false");typeof u=="undefined"&&(u="free");window.EFL.analyticsController.track({"video-logged-in":r});window.EFL.analyticsController.track({"video-access-level":u});var f=function(i){var r=n.get(window.EFL.video.videoTokenName)||t.get(window.EFL.video.videoTokenName);$.ajax({url:window.EFL.video.apiUrl+"packages",dataType:"json",data:{},headers:{Authorization:"Bearer "+r},error:function(n){g(n,i)},success:function(t){n.set(window.EFL.video.packagesDateTokenName,Date.now());n.set(window.EFL.video.packagesTokenName,t);a(!1)}})},e=function(i){var r=n.get(window.EFL.video.videoTokenName)||t.get(window.EFL.video.videoTokenName);$.ajax({url:window.EFL.video.apiUrl+"config",dataType:"json",data:{format:"json"},headers:{Authorization:"Bearer "+r},error:function(n){nt(n,i)},success:function(t){n.set(window.EFL.video.configDateTokenName,Date.now());n.set(window.EFL.video.configTokenName,t);v(!1)}})},s=function(i){var f=n.get(window.EFL.video.videoTokenName)||t.get(window.EFL.video.videoTokenName),r=window.EFL.video.nextfxVideoId,u;r!==""&&(u={extid:r,purchases:"true"},$.ajax({url:window.EFL.video.apiUrl+"game",dataType:"json",data:u,headers:{Authorization:"Bearer "+f},error:function(n){tt(n,i)},success:function(t){n.set(window.EFL.video.nextGameDateTokenName,Date.now());n.set(window.EFL.video.nextGameTokenName,t);y(!1)}}))},g=function(n,t){n.status===401?t!==!1&&i(function(){f(!1)}):t!==!1&&i(function(){f(!1)})},nt=function(n,t){n.status===401?t!==!1&&i(function(){e(!1)}):t!==!1&&i(function(){e(!1)})},tt=function(n,t){n.status===401&&t!==!1&&i(function(){s(!1)})},i=function(i){$.ajax({url:window.EFL.video.idpUrl+"/secure/accesstoken",dataType:"json",data:{format:"json"},success:function(r){n.set(window.EFL.video.videoTokenName,r.data.accessToken);t.set(window.EFL.video.videoLoggedInName,"false");i&&i()}})},h=function(){var r=n.get(window.EFL.video.videoTokenName)||t.get(window.EFL.video.videoTokenName);r===undefined?i(function(){f()}):f()},c=function(){var r=n.get(window.EFL.video.videoTokenName)||t.get(window.EFL.video.videoTokenName);r===undefined?i(function(){e()}):e()},l=function(){var r=n.get(window.EFL.video.videoTokenName)||t.get(window.EFL.video.videoTokenName);r===undefined?i(function(){s()}):s()},a=function(i){var e=n.get(window.EFL.video.videoTokenName)||t.get(window.EFL.video.videoTokenName),r=n.get(window.EFL.video.packagesTokenName),u=n.get(window.EFL.video.packagesDateTokenName),f;u===undefined?i!==!1&&h():(f=(Date.now()-u)/1e3,f>o?i!==!1&&h():r===undefined?i!==!1&&h():(window.EFL.analyticsController.track({"video-region":p(r)}),w=!0,it(p(r))))},v=function(i){var h=n.get(window.EFL.video.videoTokenName)||t.get(window.EFL.video.videoTokenName),r=n.get(window.EFL.video.configTokenName),e=n.get(window.EFL.video.configDateTokenName),s,f,u;if(e===undefined)i!==!1&&c();else if(s=(Date.now()-e)/1e3,s>o)i!==!1&&c();else if(r===undefined)i!==!1&&c();else{if(r.geo!==undefined){if(window.EFL.analyticsController.track({"video-country":r.geo.country}),window.EFL.analyticsController.track({"video-country-name":countries[r.geo.country]}),rt(r.geo.country),window.EFL.analyticsController.track({"video-state":r.geo.state}),window.EFL.analyticsController.track({"video-city":r.geo.city}),f="false",r.geo.contentRegions!==undefined)for(u=0;u<r.geo.contentRegions.length;u++)(r.geo.contentRegions[u].name.toLowerCase().indexOf("partial blackout")>=0||r.geo.contentRegions[u].name.toLowerCase().indexOf("league blackout")>=0)&&(f="true");f==="true"?window.EFL.analyticsController.track({"league-blackout-excluded":"true"}):window.EFL.analyticsController.track({"league-blackout-excluded":"false"})}else window.EFL.analyticsController.track({"video-country":""}),window.EFL.analyticsController.track({"video-state":""}),window.EFL.analyticsController.track({"video-city":""}),window.EFL.analyticsController.track({"league-blackout-excluded":"false"});b=!0}},y=function(t){var i=n.get(window.EFL.video.nextGameTokenName),r=n.get(window.EFL.video.nextGameDateTokenName),u,f;r===undefined?t!==!1&&l():(u=(Date.now()-r)/1e3,u>o?t!==!1&&l():i===undefined?t!==!1&&l():(i.gamePurchases!==undefined?(f=window.EFL.video.registerUrl+"&sku="+i.gamePurchases[0].sku+"&id="+i.id+"&redirect=https://"+window.EFL.video.thisDomain+window.EFL.video.nextfxMC,window.EFL.analyticsController.track({"video-match-pass-available":"true"}),window.EFL.analyticsController.track({"match-pass-url":f}),window.EFL.analyticsController.track({"match-pass-price":i.gamePurchases[0].product.price.display})):(window.EFL.analyticsController.track({"video-match-pass-available":"false"}),window.EFL.analyticsController.track({"match-pass-url":""}),window.EFL.analyticsController.track({"match-pass-price":""})),k=!0))},p=function(n){var t,i,f,r,e,u;if(n.bundlePurchaseModels!==undefined)for(f=0;f<n.bundlePurchaseModels.length;f++)r=n.bundlePurchaseModels[f].sku[n.bundlePurchaseModels[f].sku.length-1],(r==="N"||r==="I"||r==="E"||r==="D")&&(t=r);if(n.gamePurchaseModels!==undefined)for(e=0;e<n.gamePurchaseModels.length;e++)u=n.gamePurchaseModels[e].sku[n.gamePurchaseModels[e].sku.length-1],(u==="N"||u==="I"||u==="E"||u==="D")&&(i=u);return t!==undefined&&t[t.length-1]!=="N"?t[t.length-1]:i!==undefined&&i[i.length-1]!=="N"?i[i.length-1]:"Unknown"},w=!1,b=!1,k=!1;a();v();y();d=setInterval(function(){w&&b&&k&&(clearInterval(d),dataLayer.push({event:"optimize.activate"}))},100)}