var __awaiter=this&&this.__awaiter||function(n,t,i,r){function u(n){return n instanceof i?n:new i(function(t){t(n)})}return new(i||(i=Promise))(function(i,f){function o(n){try{e(r.next(n))}catch(t){f(t)}}function s(n){try{e(r["throw"](n))}catch(t){f(t)}}function e(n){n.done?i(n.value):u(n.value).then(o,s)}e((r=r.apply(n,t||[])).next())})},Fotbollskanalen;String.prototype.format||(String.prototype.format=function(...n){return this.replace(/{(\d+)}/g,(t,i)=>typeof n[i]!="undefined"?n[i]:t)});String.prototype.removeSpecialCharacters||(String.prototype.removeSpecialCharacters=function(){var n=this.replace(/\<|\.|\>|\"|\'|\%|\;|\\|\/|\&|\+|\^|\*|\||°|©|:|¶|~|∞|≈|±|¨|…|–|‚|™|½|§|_|!|#|@|¤|€|£|\$|=|\?|{|\[|\]|}|\(|\)|´|`|,/g,"");return $.trim(n)});String.prototype.contains||(String.prototype.contains=function(n){return this.indexOf(n)>=0}),function(n){"use strict";class t{static onlyUnique(n,t,i){return i.indexOf(n)===t}static hasCookie(n){for(var t,u=n+"=",r=document.cookie.split(";"),i=0;i<r.length;i++){for(t=r[i];t.charAt(0)==" ";)t=t.substring(1);if(t.indexOf(u)!=-1)return!0}return!1}static setCookie(n,t,i){var r,u,f;t!==undefined&&(r=new Date,r.setTime(r.getTime()+i*864e5),u=r.toUTCString(),f="."+window.location.host.replace("www.","").replace("ios.","").replace("android.","").replace("hybrid.",""),document.cookie="{0}={1}; path=/; expires={2}; domain={3}".format(n,t,u,f))}static getCookie(n){for(var t,r=n+"=",u=document.cookie.split(";"),i=0;i<u.length;i++){for(t=u[i];t.charAt(0)==" ";)t=t.substring(1);if(t.indexOf(r)!=-1)return t.substring(r.length,t.length)}return""}static getIosAppVersion(){return t.getCookie(t.iosAppVersionName)}static getIosAppVersionFullname(){return t.getCookie(t.iosAppVersionFullname)}static getAndroidAppVersion(){return t.getCookie(t.androidAppVersionName)}static getPersonalizedTeams(){var n=t.getCookie(t.teamCookieName);return n===""?[]:n.split(",")}static setPersonalizedTeams(n){t.setCookie(t.teamCookieName,n,3650)}static getPushEvents(){var n=t.getCookie(t.pushCookieName);return n===""?[]:n.split(",")}static isFollowingTeam(n){return t.getPersonalizedTeams().indexOf(n)!==-1}static hasPushEventCookie(){return t.hasCookie(t.pushCookieName)}static removePushEvent(n){var i=t.getPushEvents(),r=i.indexOf(n);r>-1&&(i.splice(r,1),t.setCookie(t.pushCookieName,i.join(),3650),Bonnier.Fotbollskanalen.NativeBridgeModule.OnPushEventChanged())}static getPersonalizedLeagues(){var n=t.getCookie(t.leagueCookieName);return n===""?[]:n.split(",")}static setPersonalizedLeagues(n){t.setCookie(t.leagueCookieName,n,3650)}static isFollowingLeague(n){return t.getPersonalizedLeagues().indexOf(n)!==-1}static hasPersonalization(){let n=this.getPersonalization();return n.length>0}static getPersonalization(){return this.getPersonalizedLeagues().concat(this.getPersonalizedTeams()).concat(this.getPersonalizedPlayers()).concat(this.getPersonalizedSections())}static getPersonalizedPlayers(){var n=t.getCookie(t.playerCookieName);return n===""?[]:n.split(",")}static setPersonalizedPlayers(n){t.setCookie(t.playerCookieName,n,3650)}static isFollowingPlayer(n){return t.getPersonalizedPlayers().indexOf(n)!==-1}static getPersonalizedSections(){var n=t.getCookie(t.sectionCookieName);return n===""?[]:n.split(",")}static setPersonalizedSections(n){t.setCookie(t.sectionCookieName,n,3650)}static isFollowingSection(n){return t.getPersonalizedSections().indexOf(n)!==-1}static removeDuplicateFavorites(){var n=t.getPersonalizedPlayers(),i=t.getPersonalizedTeams(),r=t.getPersonalizedLeagues(),u=t.getPersonalizedSections(),f=n.filter(t.onlyUnique),e=i.filter(t.onlyUnique),o=r.filter(t.onlyUnique),s=u.filter(t.onlyUnique);f.length!==n.length&&t.setCookie(t.playerCookieName,f.join(),3650);e.length!==i.length&&t.setCookie(t.teamCookieName,e.join(),3650);o.length!==r.length&&t.setCookie(t.leagueCookieName,o.join(),3650);s.length!==u.length&&t.setCookie(t.sectionCookieName,s.join(),3650)}static declineAppVersion(n){t.setCookie(t.declinedAppVersionCookieName,n,14)}static hasDeclinedAppVersion(n){return t.getCookie(t.declinedAppVersionCookieName)===n}static addPersonalizedTeam(i,r){var u=t.getPersonalizedTeams();return(u.forEach(n=>{if(n===i)return!0}),u.length>=t.teamsMaxLimit)?!1:(u.push(i),n.CookieModule.setCookie(n.CookieModule.teamCookieName,u.join(),3650),Bonnier.Fotbollskanalen.NativeBridgeModule.OnPersonalizationChanged(),Bonnier.Fotbollskanalen.TrackingModule.TrackFollowTeam(i.toString(),r),!0)}static removePersonalizedTeam(i,r){var u=t.getPersonalizedTeams(),f=u.indexOf(i.toString());f>-1&&(u.splice(f,1),n.CookieModule.setCookie(n.CookieModule.teamCookieName,u.join(),3650),Bonnier.Fotbollskanalen.NativeBridgeModule.OnPersonalizationChanged(),Bonnier.Fotbollskanalen.TrackingModule.TrackUnfollowTeam(i.toString(),r))}static addPushEvent(i){var r=t.getPushEvents();r.forEach(n=>{n===i});r.push(i);n.CookieModule.setCookie(n.CookieModule.pushCookieName,r.join(),3650);Bonnier.Fotbollskanalen.NativeBridgeModule.OnPushEventChanged()}static addPersonalizedPlayer(i,r){var u=t.getPersonalizedPlayers();return(u.forEach(n=>{if(n===i)return!0}),u.length>=t.playersMaxLimit)?!1:(u.push(i),n.CookieModule.setCookie(n.CookieModule.playerCookieName,u.join(),3650),Bonnier.Fotbollskanalen.NativeBridgeModule.OnPersonalizationChanged(),Bonnier.Fotbollskanalen.TrackingModule.TrackFollowPlayer(i.toString(),r),!0)}static removePersonalizedPlayer(i,r){var u=t.getPersonalizedPlayers(),f=u.indexOf(i.toString());f>-1&&(u.splice(f,1),n.CookieModule.setCookie(n.CookieModule.playerCookieName,u.join(),3650),Bonnier.Fotbollskanalen.NativeBridgeModule.OnPersonalizationChanged(),Bonnier.Fotbollskanalen.TrackingModule.TrackUnfollowPlayer(i.toString(),r))}static addPersonalizedLeague(i,r){var u=t.getPersonalizedLeagues();return(u.forEach(n=>{if(n===i)return!0}),u.length>=t.leaguesMaxLimit)?!1:(u.push(i),n.CookieModule.setCookie(n.CookieModule.leagueCookieName,u.join(),3650),Bonnier.Fotbollskanalen.NativeBridgeModule.OnPersonalizationChanged(),Bonnier.Fotbollskanalen.TrackingModule.TrackFollowLeague(i.toString(),r),!0)}static removePersonalizedLeague(i,r){var u=t.getPersonalizedLeagues(),f=u.indexOf(i.toString());f>-1&&(u.splice(f,1),n.CookieModule.setCookie(n.CookieModule.leagueCookieName,u.join(),3650),Bonnier.Fotbollskanalen.NativeBridgeModule.OnPersonalizationChanged(),Bonnier.Fotbollskanalen.TrackingModule.TrackUnfollowLeague(i.toString(),r))}static addPersonalizedSection(i,r){var u=t.getPersonalizedSections();return(u.forEach(n=>{if(n===i)return!0}),u.length>=t.sectionsMaxLimit)?!1:(u.push(i),n.CookieModule.setCookie(n.CookieModule.sectionCookieName,u.join(),3650),Bonnier.Fotbollskanalen.NativeBridgeModule.OnPersonalizationChanged(),Bonnier.Fotbollskanalen.TrackingModule.TrackFollowLeague(i.toString(),r),!0)}static removePersonalizedSection(i,r){var u=t.getPersonalizedSections(),f=u.indexOf(i.toString());f>-1&&(u.splice(f,1),n.CookieModule.setCookie(n.CookieModule.sectionCookieName,u.join(),3650),Bonnier.Fotbollskanalen.NativeBridgeModule.OnPersonalizationChanged(),Bonnier.Fotbollskanalen.TrackingModule.TrackUnfollowLeague(i.toString(),r))}}t.playersMaxLimit=30;t.teamsMaxLimit=15;t.leaguesMaxLimit=10;t.sectionsMaxLimit=15;t.leagueCookieName="fk_favorite_leagues";t.teamCookieName="fk_favorite_teams";t.playerCookieName="fk_favorite_players";t.sectionCookieName="fk_favorite_sections";t.pushCookieName="fk_push_events";t.iosAppVersionName="ios_app_version";t.iosAppVersionFullname="ios_app_version_fullname";t.androidAppVersionName="android_app_version";t.androidAppVersionFullname="android_app_version_fullname";t.declinedAppVersionCookieName="declined_app_version";t.getAndroidAppVersionFullname=()=>t.getCookie(t.androidAppVersionFullname);n.CookieModule=t}(Fotbollskanalen||(Fotbollskanalen={}));var isSmartPhone=()=>hasClass(document.body,"mobile"),isDesktop=()=>this.hasClass(document.body,"desktop"),isMobileOrTablet=()=>this.hasClass(document.body,"mobile-and-tablet"),isNative=()=>this.hasClass(document.body,"native"),hasClass=(n,t)=>(" "+n.className+" ").indexOf(" "+t+" ")>-1,Fotbollskanalen;(function(n){class t{static init(n,i,r){n!==""&&i!==""&&r!==""&&(t.favoriteStorageBaseUrl="https://"+i+"/api/favorites/syncfavorites",t.authRefreshUrl="https://avod-auth-alb.a2d.tv/oauth/refresh",t.accountServiceBaseUrl="https://swe.account.a2d.tv",t.currentTermsDate=r,window.addEventListener("message",n=>{var u;if(n.data.type==="loginSuccess"){var i=n.data.payload.refreshToken,r=n.data.payload.accessToken,f=t.parseJwtToken(r);if(localStorage.setItem("refresh_token",i),localStorage.setItem("bbr_token",i),localStorage.setItem("access_token",r),localStorage.setItem("user_id",f.uid),localStorage.setItem("hasLoggedIn","1"),u=t.getUserInfo().then(n=>{t.setUserInfo(n);var i=this.getAccountSession();t.handleSuccessfulLogon(i,window.location.toString());Bonnier.Fotbollskanalen.TrackingModule.TrackLoginSuccess();window.location.reload()},null),u===null){console.error("user is null");return}}}))}static getAuthorizationHeaders(){return{Authorization:"Bearer "+t.getAuthToken()}}static getAuthorizationHeadersRefreshToken(){return{Authorization:"Bearer "+t.getRefreshToken()}}static logoutAllDevices(n){t.accountServiceBaseUrl!==""&&$.ajax({url:t.accountServiceBaseUrl+"/rest/logout_all",type:"put",contentType:"application/json",headers:this.getAuthorizationHeaders()}).done(function(n){console.log(n)}).fail(function(n){console.error(n)}).always(function(){n&&n();t.setUserInfo(null);t.setAccountSession(null);t.nativeNotifyAccountInfo();window.location.href="/profile/"})}static logout(n){t.accountServiceBaseUrl!==""&&$.ajax({url:t.accountServiceBaseUrl+"/rest/logout",type:"put",contentType:"application/json",headers:this.getAuthorizationHeaders()}).done(function(n){console.log(n)}).fail(function(n){console.error(n)}).always(function(){n&&n();t.setUserInfo(null);t.setAccountSession(null);localStorage.removeItem(t.favoritesLastUpdated);t.nativeNotifyAccountInfo();window.location.href="/profile/"})}static openComplementView(){var i=t.loginSuccessCallback;t.loginSuccessCallback=undefined;$.ajax({url:"/api/account/darkcomplementview",type:"GET",dataType:"json",success:function(t){$(".account-container").empty().append(t.html);n.AccountModule.loginSuccessCallback=i}})}static handleSuccessfulLogon(n,i){t.nativeNotifyAccountInfo();t.updateLastAuthentication();t.syncAccountStorage(n,()=>{Bonnier.Fotbollskanalen.NativeBridgeModule.SyncCookies(),i&&(window.location.href=i)});$t.dispatchCustomEvent("successfulLogon");localStorage.setItem("hasLoggedIn","1")}static showCoachScreen(){$.ajax({url:"/api/account/coachscreenview",type:"GET",dataType:"json",success:function(n){$(".account-container").empty().append(n.html)}})}static validateUserExists(n){if(t.accountServiceBaseUrl!=="")try{$.ajax({url:t.accountServiceBaseUrl+"/rest/user/exists/"+n,type:"get",contentType:"application/json",headers:this.getAuthorizationHeaders()}).done(function(){$(".user-exists").addClass("user-exists-visible")}).fail(function(){$(".user-exists").removeClass("user-exists-visible")})}catch(i){}}static updateUserInfo(n,i){return __awaiter(this,void 0,void 0,function*(){yield t.shouldRefresh();var r={firstName:n.firstName,lastName:n.lastName,zipCode:n.zipCode,yearOfBirth:n.yearOfBirth};$.ajax({url:t.accountServiceBaseUrl+"/rest/user/",type:"put",contentType:"application/json",headers:this.getAuthorizationHeaders(),data:JSON.stringify(r)}).done(function(n){t.showUpdateServerMessage("Kontouppgifter sparades!");var i=n;t.setUserInfo(i);updateAccountHeaderName();updateAvatarLoginStatus();t.nativeNotifyAccountInfo()}).fail(function(n){console.error(n);n.code&&n.sourceErrors?t.showUpdateServerMessage(t.mapErrorCode(n.code)):t.showUpdateServerMessage(t.mapErrorCode(0))}).always(function(){i()})})}static showUpdateServerMessage(n){var t=$("#update-server-message");t.text(n);t.closest("div").addClass("server-message-enabled")}static changeEmail(n,i){return __awaiter(this,void 0,void 0,function*(){yield t.shouldRefresh();var r={confirmNewEmail:n.newEmail,newEmail:n.newEmail,password:n.password};$.ajax({url:t.accountServiceBaseUrl+"/rest/update_email",type:"put",contentType:"application/json",headers:this.getAuthorizationHeaders(),data:JSON.stringify(r)}).done(function(i){t.showChangeEmailServerMessage("E-postadress är ändrad!");var r=i;t.setUserInfo(r);updateUserFields();t.nativeNotifyAccountInfo();t.storeCredentials(n.newEmail,n.password)}).fail(function(n){if(console.error(n),n.code&&n.sourceErrors){var i=n.code;t.showChangeEmailServerMessage(t.mapErrorCode(i))}else t.showChangeEmailServerMessage(t.mapErrorCode(0))}).always(function(){i()})})}static showChangeEmailServerMessage(n){var t=$("#change-email-server-message");t.text(n);t.closest("div").addClass("server-message-enabled")}static changePassword(n,i){return __awaiter(this,void 0,void 0,function*(){yield t.shouldRefresh();var r={confirmNewPassword:n.newPassword,logoutOther:!1,newPassword:n.newPassword,oldPassword:n.oldPassword};$.ajax({url:t.accountServiceBaseUrl+"/rest/update_password",type:"put",contentType:"application/json",headers:this.getAuthorizationHeaders(),data:JSON.stringify(r)}).done(function(i){i.sourceErrors?t.showChangePasswordServerMessage(t.mapErrorCode(i.sourceErrors[0].code)):(t.storeCredentials(t.getAccountUser().email,n.newPassword),t.showChangePasswordServerMessage("Lösenordet är ändrat!"))}).fail(function(n){if(console.error(n),n.responseJSON&&n.responseJSON.sourceErrors){var i=n.responseJSON.errors[0].code;t.showChangePasswordServerMessage(t.mapErrorCode(i))}else t.showChangePasswordServerMessage(t.mapErrorCode(0))}).always(function(){i()})})}static showChangePasswordServerMessage(n){var t=$("#change-password-server-message");t.text(n);t.closest("div").addClass("server-message-enabled")}static syncAccountStorage(i,r=null){return __awaiter(this,void 0,void 0,function*(){if(t.favoriteStorageBaseUrl!==null){const f=n.CookieModule.getPersonalizedLeagues(),e=n.CookieModule.getPersonalizedTeams(),o=n.CookieModule.getPersonalizedPlayers(),s=n.CookieModule.getPersonalizedSections(),u=localStorage.getItem(t.favoritesLastUpdated);var i=t.getRefreshToken();if(i!==null&&i!==undefined&&i!=="null"&&i!=="undefined"){const h={lastUpdated:u!==undefined&&u!=="undefined"?u:null,favorites:[{FavoriteType:"League",Values:f},{FavoriteType:"Team",Values:e},{FavoriteType:"Player",Values:o},{FavoriteType:"Section",Values:s}]};return $.ajax({url:t.favoriteStorageBaseUrl,type:"post",contentType:"application/json",xhrFields:{withCredentials:!0},headers:t.getAuthorizationHeadersRefreshToken(),data:JSON.stringify(h)}).done(function(i){i.action==="No update"&&(n.CookieModule.setPersonalizedLeagues(t.filterFavoritesByType(i.favorites,"League")),n.CookieModule.setPersonalizedTeams(t.filterFavoritesByType(i.favorites,"Team")),n.CookieModule.setPersonalizedPlayers(t.filterFavoritesByType(i.favorites,"Player")),n.CookieModule.setPersonalizedSections(t.filterFavoritesByType(i.favorites,"Section")));localStorage.setItem(t.favoritesLastUpdated,i.lastUpdated)}).fail(function(n){console.error(n)}).always(function(){r&&r()})}}})}static filterFavoritesByType(n,t){var i=n.find(function(n){return n.favoriteType===t});return i?i.values.join(","):undefined}static forceSyncAccountFavorites(i){var r=n.AccountModule.getAccountSession();r.refreshToken?(localStorage.setItem(t.favoritesLastUpdated,"9999-12-31 23:59:59"),n.AccountModule.syncAccountStorage(r,()=>{i?i():Bonnier.Fotbollskanalen.NativeBridgeModule.SyncCookies()})):Bonnier.Fotbollskanalen.NativeBridgeModule.SyncCookies()}static reauthenticate(n,i){return __awaiter(this,void 0,void 0,function*(){var f,r,u;if(t.accountServiceBaseUrl!==""&&(f=yield t.shouldReauthenticate(),n&&f)){if(r=t.getAccountSession(),r.refreshToken===null){i&&i();t.nativeNotifyAccountInfo();return}if(u=yield t.refreshJwtToken(r.refreshToken),u)return $.ajax({url:t.accountServiceBaseUrl+"/rest/user/me?client=fotbollskanalen",type:"get",contentType:"application/json",headers:t.getAuthorizationHeaders()}).done(function(n){var f=n,e={userId:f.userId,accessToken:u,refreshToken:r.refreshToken,vimondToken:r.vimondToken,token:r.token};t.setUserInfo(f);t.setAccountSession(e);t.adjustFalseTermsDate(f);t.syncAccountStorage(e,()=>{Bonnier.Fotbollskanalen.NativeBridgeModule.SyncCookies()});localStorage.setItem("hasLoggedIn","1");t.nativeNotifyAccountInfo();t.updateLastAuthentication();i&&i()}).fail(function(n){t.setUserInfo(null);t.setAccountSession(null);console.error(n)})}})}static shouldReauthenticate(){return __awaiter(this,void 0,void 0,function*(){var n=localStorage.getItem("access_token"),u,r,i,f;return n===null||n===undefined||n==="undefined"||n==="null"?!0:(u=yield t.getDateTimeUtc(),r=parseInt(u),r===0)?!1:(i=this.parseJwtToken(n),f=Math.floor(Math.random()*121),r+(i.exp-i.iat)/2+f>i.exp)})}static updateLastAuthentication(){localStorage.setItem("lastAuthentication",Date())}static nativeNotifyAccountInfo(){if(isNative()){const n=this.getAccountUser(),i=this.getAccountSession();if(n===null||n.userId===null||i===null||i.refreshToken===null)localStorage.removeItem("lastAuthentication"),Bonnier.Fotbollskanalen.NativeBridgeModule.AccountLoggedOut();else{const r={userId:n.userId,bbrToken:i.refreshToken,avartarName:t.getAvatarName(n),genericAds:n.genericAds};Bonnier.Fotbollskanalen.NativeBridgeModule.AccountStatusUpdated(r)}}}static isLoggedIn(){const n=this.getAccountSession();return!!n.refreshToken}static getAvatarName(n){try{return(!n.firstName||!n.lastName)&&n.email&&n.email.length>2?n.email.substring(0,2):n.firstName&&n.firstName.length<3?n.firstName:n.firstName.charAt(0)+n.lastName.charAt(0)}catch(t){return"NN"}}static adjustFalseTermsDate(n){if(n!==null&&n.email!==null){var i=new Date(n.acceptedFotbollskanalenTerms),r=new Date(t.currentTermsDate);(i.toString()==="Invalid Date"||i>r)&&t.updateTermsDate()}}static updateTermsDate(){$.ajax({url:t.accountServiceBaseUrl+"/rest/user",type:"put",contentType:"application/json",headers:this.getAuthorizationHeaders(),data:JSON.stringify({})}).done(function(n){if(n.errors)t.showUpdateServerMessage(t.mapErrorCode(n.errors[0].code));else{var i=n.data.update.user;i.acceptedFotbollskanalenTerms&&localStorage.setItem("accepted_fotbollskanalen_terms",i.acceptedFotbollskanalenTerms)}}).fail(function(n){if(console.error(n),n.responseJSON&&n.responseJSON.errors){var i=n.responseJSON.errors[0].code;t.showUpdateServerMessage(t.mapErrorCode(i))}else t.showUpdateServerMessage(t.mapErrorCode(0))})}static setUserInfo(n){(localStorage.removeItem("first_name"),localStorage.removeItem("last_name"),localStorage.removeItem("user_name"),localStorage.removeItem("year_of_birth"),localStorage.removeItem("zip_code"),localStorage.removeItem("accepted_fotbollskanalen_terms"),localStorage.removeItem("user_id"),localStorage.removeItem("lastAuthentication"),localStorage.removeItem("generic_ads"),localStorage.removeItem("no_ads"),n!==null)&&(n.firstName&&localStorage.setItem("first_name",escape(n.firstName)),n.lastName&&localStorage.setItem("last_name",escape(n.lastName)),n.email&&localStorage.setItem("user_name",escape(n.email)),n.yearOfBirth&&localStorage.setItem("year_of_birth",n.yearOfBirth.toString()),n.zipCode&&localStorage.setItem("zip_code",n.zipCode.toString()),n.acceptedTermsDate&&localStorage.setItem("accepted_fotbollskanalen_terms",n.acceptedTermsDate),n.userId&&localStorage.setItem("user_id",n.userId),localStorage.setItem("generic_ads",n.genericAds.toString()))}static setAccountSession(n){n===null?(localStorage.removeItem("bbr_token"),localStorage.removeItem("vimond_token"),localStorage.removeItem("refresh_token"),localStorage.removeItem("access_token"),localStorage.removeItem("user_id")):(localStorage.setItem("bbr_token",n.token),localStorage.setItem("vimond_token",n.vimondToken),localStorage.setItem("refresh_token",n.refreshToken),localStorage.setItem("access_token",n.authToken),localStorage.setItem("user_id",n.userId))}static setSession(n){n===null?(localStorage.removeItem("bbr_token"),localStorage.removeItem("refresh_token"),localStorage.removeItem("auth_token"),localStorage.removeItem("user_id")):(localStorage.setItem("bbr_token",n.token),localStorage.setItem("refresh_token",n.refreshToken),localStorage.setItem("auth_token",n.authToken),localStorage.setItem("user_id",n.uid))}static isUserAccountComplete(){var n=this.getAccountUser();return n.firstName&&n.lastName&&n.yearOfBirth&&n.zipCode&&n.acceptedTermsDate}static getAccountUser(){return{firstName:t.unescapeOrNull(localStorage.getItem("first_name")),lastName:t.unescapeOrNull(localStorage.getItem("last_name")),email:t.unescapeOrNull(localStorage.getItem("user_name")),yearOfBirth:localStorage.getItem("year_of_birth"),zipCode:localStorage.getItem("zip_code"),acceptedTermsDate:localStorage.getItem("accepted_fotbollskanalen_terms"),userId:localStorage.getItem("user_id"),genericAds:localStorage.getItem("generic_ads")}}static getAccountSession(){return{token:localStorage.getItem("bbr_token"),vimondToken:localStorage.getItem("vimond_token"),accessToken:localStorage.getItem("access_token"),refreshToken:localStorage.getItem("refresh_token")}}static getAuthToken(){return localStorage.getItem("access_token")}static getRefreshToken(){return localStorage.getItem("refresh_token")}static storeCredentials(n,t){if("PasswordCredential"in window){var i=new PasswordCredential({id:n,password:t});navigator.credentials.store(i).then(()=>console.log("Storing credential for <b>"+i.id+"<\/b>")).catch(n=>console.error("Error storing credentials: "+n))}else isNative()&&Bonnier.Fotbollskanalen.NativeBridgeModule.StoreCredentials(n,t)}static showServerMessage(n){var t=$(".server-message");t&&(t.text(n),t.closest("div").addClass("server-message-enabled"))}static unescapeOrNull(n){return n===null?null:unescape(n)}static mapErrorCode(n){return t.errors[n]||t.errors[0]}static getUserInfo(){return $.ajax({url:t.accountServiceBaseUrl+"/rest/user/me?client=fotbollskanalen",type:"get",contentType:"application/json",headers:this.getAuthorizationHeaders(),async:!1}).done(function(n){return n}).fail(function(n){return console.log("getUserInfo error: ",n),null})}static parseJwtToken(n){var t=n.split(".")[1],i=t.replace(/-/g,"+").replace(/_/g,"/"),r=decodeURIComponent(window.atob(i).split("").map(function(n){return"%"+("00"+n.charCodeAt(0).toString(16)).slice(-2)}).join(""));return JSON.parse(r)}static getDateTimeUtc(){return __awaiter(this,void 0,void 0,function*(){return yield $.ajax({url:"https://time.akamai.com/now?client=fotbollskanalen-web&format=rfc3339"}).done(function(n){return n}).fail(()=>null)})}static shouldRefresh(){return __awaiter(this,void 0,void 0,function*(){var n,i;const r=yield t.shouldReauthenticate();return n=null,r&&(i=t.getRefreshToken(),i&&(n=yield t.refreshJwtToken(i))),n!=null})}static refreshJwtToken(n){return __awaiter(this,void 0,void 0,function*(){if(t.authRefreshUrl!==""&&n!==""){var i={client_id:"fotbollskanalen",refresh_token:n};return yield $.ajax({url:t.authRefreshUrl,type:"post",contentType:"application/json",data:JSON.stringify(i)}).done(function(n){return localStorage.setItem("access_token",n.access_token),n.access_token}).fail(function(){return null})}})}}t.favoriteStorageBaseUrl="";t.authRefreshUrl="";t.currentTermsDate="";t.accountServiceBaseUrl="";t.favoritesLastUpdated="favoritesLastUpdated";t.currentEmail="";t.errors={0:"Hoppsan! Något gick fel, kontrollera dina uppgifter och försök igen.",1:"Det verkar som att du redan har ett konto hos oss – testa att logga in",2:"Kontrollera e-postadressen",10:"Fel e-postadress eller lösenord",14:"Något gick fel",15:"Hoppsan! Något gick fel.",17:"Hoppsan! Något gick fel, kontrollera dina uppgifter och försök igen.",18:"Det verkar som att du redan har ett konto hos oss – testa att logga in",21:"Det finns ingen användare med den e-post du angivit"};n.AccountModule=t})(Fotbollskanalen||(Fotbollskanalen={})),function(n){class t{}t.historyKeyPrefix="history_";t.save=(n,i,r)=>{if(typeof Storage=="undefined")return!1;var u=r*864e5,f={value:JSON.stringify(i),timestamp:(new Date).getTime()+u};return localStorage.removeItem(t.historyKeyPrefix+n),localStorage.setItem(t.historyKeyPrefix+n,JSON.stringify(f)),i};t.removeOldHistory=()=>{if(typeof Storage!="undefined"){var n=t.getHistoryKeys();n.forEach(n=>{var t=JSON.parse(localStorage.getItem(n));t&&(new Date).getTime()>t.timestamp&&localStorage.removeItem(n)})}};t.getHistoryKeys=()=>{var n=Object.keys(localStorage);return n.filter(n=>n.startsWith(t.historyKeyPrefix))};t.getAllIds=()=>{var n=t.getHistoryKeys();return n.map(n=>n.replace(new RegExp("^"+t.historyKeyPrefix),""))};t.updateVisited=()=>{var n=t.getAllIds();n.forEach(n=>{$('[data-page-id="'+n+'"]').addClass("visited")})};t.init=()=>{$(".news-list a").on("click",n=>{var i=$(n.currentTarget).closest("li").data("page-id");t.save(i,i,7)});$("[data-blogpost-related-link]").on("click",n=>{var i=$(n.currentTarget).closest("li").data("page-id");t.save(i,i,7)});t.updateVisited();document.addEventListener("onBackNavigation",()=>{t.updateVisited()},!1)};n.ArticleHistoryModule=t}(Fotbollskanalen||(Fotbollskanalen={}));$fk(()=>{$t.isNative&&($t.exists(".news-list")||$t.exists("[data-related-list]"))&&Fotbollskanalen.ArticleHistoryModule.init()}),function(n){class t{getNextContentAssetId(n,i,r){var u=this.getNextVideoInPlaylist(n),f;u!==null?$.ajax({url:"/api/videoinfo/"+u,contentType:"application/json"}).done(f=>{var e={id:f.id,nextContentUrl:f.url,title:f.title,image:f.image,description:f.description,publishedDateTime:f.published_date_time};isNative()?t.setPlayedVideo(n):$t.dispatchCustomEvent("currentplaylistvideo",{detail:{assetId:u}});i!==null&&i!==undefined?r(e,i):r(e)}):(t.clearPlaylist(),f="https://graphql.tv4play.se/graphql?query=%7BvideoAsset(id:%22"+n+"%22)%7BnextContent%7BrelatedClips(limit:20)%7B%20id%20image%20title%20description%20publishedDateTime%20tags%20categories%20is_live%20%7D%7D%7D%7D",$.ajax({url:f,type:"get",contentType:"application/json",headers:{Client:"fotbollskanalen"}}).done(u=>{if(u!==null&&u!==undefined&&u.data!==undefined&&!(u.data.videoAsset.nextContent.relatedClips.length<1)){var e=u.data.videoAsset.nextContent.relatedClips,f=this.skipAlreadyPlayedVideosAndGetNextContent(e);$.ajax({url:"/api/videoUrl/"+f.id,contentType:"application/json"}).done(u=>{f.nextContentUrl=u,isNative()&&t.setPlayedVideo(n),i!==null&&i!==undefined?r(f,i):r(f)})}}))}skipAlreadyPlayedVideosAndGetNextContent(n){for(var r=t.getPlayedVideos(),i=0;i<n.length;i++)if((n[i].categories===null||n[i].categories.indexOf("fotbollskanalen-medlemmar-geoblock")===-1)&&(n[i].categories===null||n[i].categories.indexOf("fotbollskanalen-medlemmar-ej-geoblock")===-1)&&!(r.indexOf(n[i].id)>-1)&&n[i].tags!=null&&n[i].tags.indexOf("fotboll")!==-1)return n[i];return n.length>0?n[Math.floor(Math.random()*n.length)]:null}static getPlayedVideos(){var n=localStorage.getItem(this.localStoragePlayedKey);return n===undefined||n===null||n===""?[]:JSON.parse(n)}static setPlayedVideo(n){setTimeout(()=>{Bonnier.Fotbollskanalen.VideoPlayLoggerModule.LogVideoStart(n);var t=this.getPlayedVideos();t.indexOf(n)>-1||(t.unshift(n),t.length>50&&(t.length=50),localStorage.setItem(this.localStoragePlayedKey,JSON.stringify(t)))},3e4)}getNextVideoInPlaylist(n){var i=t.getPlaylist(),r=i.indexOf(n);return r==-1?null:r+1>=i.length?i[0]:i[r+1]}static getPlaylist(){var n=localStorage.getItem(this.localStoragePlaylistKey);return n===undefined||n===null||n===""||n==="undefined"?[]:JSON.parse(n)}static setPlaylist(n){localStorage.setItem(this.localStoragePlaylistKey,JSON.stringify(n))}static clearPlaylist(){localStorage.removeItem(this.localStoragePlaylistKey)}static setNativePlaylist(n){localStorage.setItem(this.localStorageNativePlaylistKey,n)}static getNativePlaylist(){return localStorage.getItem(this.localStorageNativePlaylistKey)}static clearNativePlaylist(){localStorage.removeItem(this.localStorageNativePlaylistKey)}}t.localStoragePlayedKey="Fotbollskanalen.played.videos";t.localStoragePlaylistKey="Fotbollskanalen.playlist.videos";t.localStorageNativePlaylistKey="Fotbollskanalen.native.playlist.videos";n.PushNextContentModule=t}(Fotbollskanalen||(Fotbollskanalen={})),function(n){class t{constructor(t,i){this.wasPausedInline=!1;this.appendBbrStyleAndScriptToHead=n=>{this.addBonnierBroadcastingStyle(),this.addBonnierBroadcastingMediaScript(),this.addBonnierBroadcastingScript(n)};this.addBonnierBroadcastingMediaScript=()=>{var t="bbrMediaScript",i,n;document.getElementById(t)||(i=document.getElementsByTagName("head")[0],n=document.createElement("script"),n.id=t,n.defer=!0,n.type="text/javascript",n.onload=()=>{},n.src="/ScriptsHybrid/libs/NordicPlayer/media-engines.1.25.0.js",i.appendChild(n))};this.addBonnierBroadcastingStyle=()=>{var t="bbrStyle",i,n;document.getElementById(t)||(i=document.getElementsByTagName("head")[0],n=document.createElement("link"),n.id=t,n.rel="stylesheet",n.type="text/css",n.href="/ScriptsHybrid/libs/NordicPlayer/avod-web-player.1.25.0.css",n.media="all",i.appendChild(n))};this.addBonnierBroadcastingScript=n=>{var i="bbrScript",r,t;document.getElementById(i)?n&&n():(r=document.getElementsByTagName("head")[0],t=document.createElement("script"),t.id=i,t.defer=!0,t.type="text/javascript",t.onload=()=>{n&&n()},t.src="/ScriptsHybrid/libs/NordicPlayer/avod-web-player.1.25.0.js",r.appendChild(t))};this.version=t;this.usePushNextContent=i;this.token=n.AccountModule.getAccountSession().accessToken;this.userId=n.AccountModule.getAccountUser().userId;i&&(this.registerPopStateListener(),this.pushNextContentModule=new n.PushNextContentModule)}playVideoAsset(n,t,i,r=false){var u=parseInt(n),e;this.currentAssetId=u;this.currentPlayerId=i;let f="";"__tcfapi"in window?__tcfapi("getTCData",2,(n,e)=>{e&&(f=n.tcString),this.startVideoAsset(u,t,i,f,r)}):this.startVideoAsset(u,t,i,f,r);this.usePushNextContent&&location.pathname.startsWith("/video/")&&(e={id:this.currentAssetId,title:document.getElementById("videoTitle").innerHTML,description:document.getElementById("videoDescription").innerHTML,publishedDateTime:document.getElementById("videoBroadcastDate").innerHTML},history.replaceState(e,document.title,location.href))}startVideoAsset(t,i,r,u,f){var e,o,s,h,c;if($t.exists(".fullscreen-wrapper"))$(document).on("scroll",function(){$t.exists(".has-desktop-sticky-video")&&(window.scrollY>$(".video__holder")[0].offsetTop-72?$("body").addClass("desktop-sticky-video"):$("body").removeClass("desktop-sticky-video"))});for(e=document.getElementById("bonnier-video-player-"+r+"-"+t);e&&e.hasChildNodes();)e.removeChild(e.firstChild);o=$t.isIosWeb;o=!1;$(".endscreen-wrapper").css("display","none");s="#endscreen-element-id-"+r+"-"+t.toString();h="endscreen-element-id-"+r+"-"+t.toString();$(s).css("display","block");c=document.getElementById("bonnier-video-player-"+r+"-"+t);this.player=new WebPlayer(c,{service:"Fotbollskanalen",autoplay:i,muted:f,onBackClick:()=>{this.backButtonClicked(this,r)},onExitClick:()=>{this.destroy()},onVideoClick:()=>{console.log("OnVideoButtonClicked")},iosNativeFullscreen:o,showMobileMuteButton:!0,playbackApiURL:"https://playback2.a2d.tv/",playerProgressTintColor:"#18A965",fullscreenElementId:h,appName:"Fotbollskanalen HTML5",appVersion:this.version,hideSubtitlesMenu:!0,useFreeWheel:!0,castId:"B78EBC45",gdprConsent:u});this.player.load({assetId:t.toString(),noAds:!1});this.applyListeners(this.player,r);n.PushNextContentModule.setPlayedVideo(t)}setCloseCallback(n){this.closeCallback=n}applyListeners(n,t){n.on(CoreEvents.ENDED,()=>this.videoEnded(t));n.on(CoreEvents.BREAK_START,()=>this.adBlockStarted());n.on(CoreEvents.BREAK_END,()=>this.adBlockEnded());n.on(CoreEvents.FULLSCREEN_CHANGED,()=>this.toggleFullscreen());n.on(CoreEvents.PAUSED,()=>this.videoPaused());n.on(CoreEvents.RESUME,()=>this.videoResumed());n.on(CoreEvents.START,()=>this.videoStarted())}handlePlayerErrors(n){switch(n.code){}}backButtonClicked(n,t){$("#bonnier-video-player-"+t+"-"+this.currentAssetId).empty();$("#endscreen-element-id-"+t+"-"+this.currentAssetId).css("display","none");$(".endscreen-wrapper").css("display","none");this.closeCallback&&this.closeCallback()}displayAppLink(){var n,t;navigator.userAgent.indexOf("Android")>-1?(n=document.getElementById("androidAppLink"),n.style.display="block"):(t=document.getElementById("iosAppLink"),t.style.display="block")}autoStartMobileWeb(n){n>15||($("[aria-label='start playback']").length>0?$("[aria-label='start playback']").click():setTimeout(()=>this.autoStartMobileWeb(++n),500))}toggleFullscreen(){this.isFullScreen?this.exitFullscreen():this.enterFullscreen()}enterFullscreen(){isDesktop()||$(".endscreen-wrapper").addClass("fullscreen");this.isFullScreen=!0}exitFullscreen(){isDesktop()||$(".endscreen-wrapper").removeClass("fullscreen");this.isFullScreen=!1}setEndscreenFullscreenTopMargin(){var n,t;(isDesktop()||$t.isAndroid)&&(n=$("#imageNextContent").height(),n>0&&(t=$(".endscreen")[0],t.style.marginTop=(screen.height-n)/2+"px"))}removeEndscreenFullscreenTopMargin(){if(isDesktop()||$t.isAndroid){var n=$(".endscreen")[0];n.style.marginTop=""}}adBlockEnded(){$(".player-in-endscreen").addClass("playing-content")}videoPaused(){$(".player-in-endscreen").removeClass("playing-content")}videoResumed(){this.wasPausedInline=!1;$(".player-in-endscreen").addClass("playing-content")}videoStarted(){var n=$(".bbhp-skin-container .close").detach();$(".player-skin").append(n)}videoEnded(n){this.usePushNextContent&&($(".player-in-endscreen").removeClass("playing-content"),this.pushNextContentModule.getNextContentAssetId(this.currentAssetId,n,(n,t)=>{this.showEndScreen(n,t,()=>{this.updateVideoPlayerContainerId(t,this.currentAssetId,n.id),this.playVideoAsset(n.id,!0,t,!0)})}))}updateVideoPlayerContainerId(n,t,i){document.getElementById("endscreen-element-id-"+n+"-"+t).id="endscreen-element-id-"+n+"-"+i;document.getElementById("bonnier-video-player-"+n+"-"+t).id="bonnier-video-player-"+n+"-"+i}showEndScreen(n,t,i){var f=document.getElementById("imageNextContent"),e,o,r;this.isFullScreen&&f.addEventListener("load",this.setEndscreenFullscreenTopMargin);f.setAttribute("src",n.image);e=document.getElementById("nextContentLink");e.setAttribute("href",n.nextContentUrl);o=document.getElementById("nextContentHeading");o.innerHTML=n.title;$(".player-in-endscreen").removeClass("full-width");r=null;this.endScreenVisible(!0);var l=document.getElementById("green-halo"),s=document.getElementById("pushNextTimer"),a=document.getElementById("abortPushNext");a.addEventListener("click",()=>{r&&window.clearInterval(r),this.player.restartAsset(),this.endScreenVisible(!1),$(".player-in-endscreen").addClass("full-width")});var h=50,u=0,v=2,c=6500;r=window.setInterval(function(){c-=h;l.setAttribute("stroke-dasharray",u+", 20000");var t=(c/1e3).toLocaleString("sv-SE",{maximumFractionDigits:0});if(s.innerHTML="Om {0}s".format(t),u>=250){window.clearInterval(r);s.innerHTML="Startar nu";location.pathname.startsWith("/video/")&&this.setNextContentProperties(n);this.destroy();this.endScreenVisible(!1);$(".player-in-endscreen").addClass("full-width");i();return}u+=v}.bind(this),h)}destroy(){console.log("exit button clicked");this.player!=null&&this.player.destroy()}setNextContentProperties(n){var i,r,u,f,t;document.title=n.title+" - fotbollskanalen.se";i=document.getElementById("videoTitle");i&&(i.innerHTML=n.title);r=document.getElementById("videoDescription");r&&(r.innerHTML=n.description);u=document.getElementById("videoBroadcastDate");u&&(u.innerHTML=this.getDatePart(n.publishedDateTime));f=document.getElementById("videoBroadcastTime");f&&(f.innerHTML=this.getTimePart(n.publishedDateTime));$("div[data-video-id]").data(n.videoId);$(".social-item a[data-url]").data("url","https://www.fotbollskanalen.se"+n.nextContentUrl);t=this.getImageProxyBySizeUrl(n.image,411,231);document.body.classList.contains("mobile")||(t=this.getImageProxyBySizeUrl(n.image,768,432));$(".video__image-wrapper").data("cover-image-url",t);$(".video__image-wrapper .video__image").attr("src",t);history.pushState(n,n.title,n.nextContentUrl)}getImageProxyBySizeUrl(n,t){return"https://imageproxy.a2d.tv/?width="+t+"&source="+encodeURIComponent(n)}getDatePart(n){var r=new Date(n),t=""+(r.getMonth()+1),i=""+r.getDate(),u=r.getFullYear();return t.length<2&&(t="0"+t),i.length<2&&(i="0"+i),[u,t,i].join("-")}getTimePart(n){var r=new Date(n),t=""+r.getHours(),i=""+r.getMinutes();return t.length<2&&(t="0"+t),i.length<2&&(i="0"+i)," "+[t,i].join(":")}registerPopStateListener(){location.pathname.startsWith("/video/")&&window.addEventListener("popstate",n=>{this.setNextContentProperties(n.state),this.playVideoAsset(n.state.id,!0,$(".player-in-endscreen").children().first()[0].id)})}endScreenVisible(n){var t,i,r;this.isFullScreen&&!n&&this.removeEndscreenFullscreenTopMargin();t=document.getElementById("endscreen");t.style.display=n?"flex":"none";i=document.getElementById("video-end-screen");i.style.display=n?"flex":"none";r=document.getElementById("imageNextContent");r.style.display=n?"block":"none"}adBlockStarted(){this.endScreenVisible(!1)}}n.BonnierBroadcastingPlayerModule=t}(Fotbollskanalen||(Fotbollskanalen={})),function(n){class t{static refreshCountDown(n){var i=Math.floor((moment(t.closeTime)-Date.now()+t.serverLocalDiff)/1e3),u;if(i<=0){document.getElementById(n).innerHTML="Spelet avslutat";document.getElementById(n).classList.add("done");return}var r=Math.floor(i/86400),f=Math.floor(i%86400/3600),e=Math.floor(i%3600/60),o=i%60,s=(r>0?r+"d ":"")+t.pad(f)+":"+t.pad(e)+":"+t.pad(o);setTimeout(function(){t.refreshCountDown(n)},1e3);u=document.getElementById(n);r>0&&document.getElementById(n).classList.add("long");i<3600&&i>0&&!u.classList.contains("urgent")?document.getElementById(n).classList.add("urgent"):i<7200&&i>0&&!u.classList.contains("soon")&&document.getElementById(n).classList.add("soon");document.getElementById(n).innerHTML=s}static refreshPromoCountDown(n,i){var u=Math.floor((moment(t.startTime)-Date.now()+t.serverLocalDiff)/1e3);if(u<=0){document.getElementById(n).innerHTML="STREAMA LIVE HÄR";return}var f=Math.floor(u/86400),e=Math.floor(u%86400/3600),h=Math.floor(u%3600/60),c=u%60;setTimeout(function(){t.refreshPromoCountDown(n,i)},1e3);var s=document.getElementById(n),r=new Date(t.startTime),l=(f>0?f+"d ":"")+t.pad(e)+":"+t.pad(h)+":"+t.pad(c),o="";(i<1&&(i=1),o=f<1&&e<i&&u>0?"STREAMA LIVE OM: "+l:f<1&&e>=i&&r.getDay()===(new Date).getDay()?`STREAMA IDAG ${t.pad(r.getHours())}:${t.pad(r.getMinutes())}`:r.getDay()===(new Date).getDay()+1&&f<2?`STREAMA IMORGON ${t.pad(r.getHours())}:${t.pad(r.getMinutes())}`:`STREAMA PÅ ${t.getWeekDayFullName(r)} ${t.pad(r.getHours())}:${t.pad(r.getMinutes())}`,o!==s.innerHTML)&&(s.innerHTML=o)}static initBetEndCountDown(n,i){n&&(t.closeTime=n.trim(),$.ajax({context:this,url:"https://time.akamai.com/now?client=fotbollskanalen-web&format=rfc3339"}).done(function(n){this.serverTime=moment.unix(n).toDate();this.serverLocalDiff=Date.now()-this.serverTime}).always(function(){t.refreshCountDown(i)}))}static initPromoEndCountDown(n,i,r){n&&(t.startTime=n,$.ajax({context:this,url:"https://time.akamai.com/now?client=fotbollskanalen-web&format=rfc3339"}).done(function(n){this.serverTime=moment.unix(n).toDate();this.serverLocalDiff=Date.now()-this.serverTime}).always(function(){t.refreshPromoCountDown(i,r)}))}static pad(n){return n<10?"0"+n:""+n}static getWeekDayFullName(n){return["söndag","måndag","tisdag","onsdag","torsdag","fredag","lördag"][n.getDay()].toUpperCase()}}t.serverLocalDiff=0;n.CountdownModule=t}(Fotbollskanalen||(Fotbollskanalen={}));class HamburgerModule{constructor(){this.openHamburgerMenu();this.closeHamburgerMenu()}openHamburgerMenu(){var n=document.documentElement||document.body,i=document.querySelector("[data-mobile-menu]"),t=0;document.querySelector("[data-hamburger]").addEventListener("click",function(){n.classList.contains("hamburger--open")&&(t=document.documentElement.scrollTop||n.scrollTop);n.classList.toggle("hamburger--open");i.classList.toggle("hidden");n.classList.contains("hamburger--open")?Bonnier.Fotbollskanalen.TrackingModule.OpenMobileMenu():(Bonnier.Fotbollskanalen.TrackingModule.CloseMobileMenu(),document.documentElement.scrollTop=n.scrollTop=t);$t.isNative&&(n.classList.contains("hamburger--open")?Bonnier.Fotbollskanalen.NativeBridgeModule.OpenHamburgerMenu():Bonnier.Fotbollskanalen.NativeBridgeModule.CloseHamburgerMenu())})}closeHamburgerMenu(){for(var t=document.querySelectorAll("[data-mobile-menu-link]"),n=0;n<t.length;n++)t[n].addEventListener("click",function(n){document.body.classList.remove("hamburger--open");document.querySelector("[data-mobile-menu]").classList.add("hidden");Bonnier.Fotbollskanalen.TrackingModule.InteractionInMobileMenu(n.target.text)})}}(function(n){class t{}t.isIos=()=>t.isHost("ios.");t.isHost=n=>{var t=new RegExp(n);return t.test(window.location.host)};n.HelperModule=t})(Fotbollskanalen||(Fotbollskanalen={})),function(n){class t{constructor(){this.init=i=>{t.baseUrl=i!==null&&i!==void 0?i:"https://fotbollskanalenmessages.azurewebsites.net/",this.loadScript(t.baseUrl+"lib/signalr.js",()=>{var i=(new signalR.HubConnectionBuilder).withUrl(t.baseUrl+"messagehub",{accessTokenFactory:()=>"testing"}).build();i.on("ReceiveMessage",function(n){console.info(n)});i.on("NewsUpdate",function(n){console.info("NewsUpdate",n);t.incomingMessage(JSON.parse(n))});i.on("UserConnected",function(n){console.info("UserConnected",n)});i.on("UserDisconnected",function(n){console.info("UserDisconnected",n)});i.start().then(function(){let t=n.CookieModule.getPersonalization();t.forEach(n=>{i.invoke("JoinGroup",n).catch(function(n){return console.error(n.toString())})})}).catch(function(n){return console.error(n.toString())})})};this.loadScript=(n,t)=>{var i=document.createElement("script");i.type="text/javascript";i.src=n;i.onload=t;document.head.appendChild(i)}}MyFeedMessageModule(){}}t.incomingMessage=n=>{Bonnier.Fotbollskanalen.TrackingModule.TrackInAppMessageIncoming(),t.lastMessage=n,location.pathname==="/"&&Bonnier.Fotbollskanalen.MyFeedModule.reloadMyFeedStartpage()};t.showMessage=()=>{$(".in-app-message__title").text(t.lastMessage.title);$(".in-app-message__open").on("click",function(){Bonnier.Fotbollskanalen.TrackingModule.TrackInAppMessageOpen();$(".in-app-message").removeClass("visible");location.href=t.lastMessage.url});$(".in-app-message__close").on("click",function(n){n.stopPropagation();Bonnier.Fotbollskanalen.TrackingModule.TrackInAppMessageClose();$(".in-app-message").removeClass("visible")});Bonnier.Fotbollskanalen.TrackingModule.TrackInAppMessageShow();$(".in-app-message").addClass("visible")};n.MyFeedMessageModule=t}(Fotbollskanalen||(Fotbollskanalen={})),function(n){class t{static renderChart(n,i){$.ajax({url:"/api/playerIndex/radar/"+i,success:function(i){t.drawRadarChart(i,n)}})}static drawRadarChart(n,t){var i=JSON.parse(n);new Chart(t,{type:"radar",data:{labels:["Avslut","Huvudspel","Passningar","Försvar","Närkamper","Dribblingar"],datasets:[{label:i.Name,data:i.player_values,fill:!0,backgroundColor:"rgba(236, 195, 11, 0.1)",borderColor:"#f60",pointBackgroundColor:"#f60",pointBorderColor:"#f60",pointHoverBackgroundColor:"#f60",pointHoverBorderColor:"#f60",pointRadius:3,pointHoverRadius:3,labelColor:"#f60"},{label:"Genomsnitt",data:i.average_values,fill:!0,backgroundColor:"rgba(49, 112, 157, 0.8)",borderColor:"#768fa5",pointBackgroundColor:"rgb(54, 162, 235)",pointBorderColor:"#fff",pointHoverBackgroundColor:"#31709d",pointHoverBorderColor:"rgb(54, 162, 235)",pointRadius:1,pointHoverRadius:1,labelColor:"#31709d"}]},options:{elements:{line:{tension:0,borderWidth:2}},legend:{display:!0,labels:{fontSize:9,boxWidth:10,fontColor:"#fff"}},bezierCurve:!1,scaleShowLabels:!1,tooltipEvents:[],pointDot:!1,scaleShowGridLines:!1,responsive:!0,maintainAspectRatio:!1,defaultFontColor:"#fff",scaleShowVerticalLines:!1,showLines:!1,scale:{ticks:{showLabelBackdrop:!1,display:!1,max:1,min:0,stepSize:.1,padding:0,beginAtZero:!0},gridLines:{color:"#585858",zeroLineColor:"#fff"},pointLabels:{fontSize:7,fontColor:"#fff"}},tooltips:{bodyFontSize:0}}})}}n.PlayerIndexDetailedRadarChart=t}(Fotbollskanalen||(Fotbollskanalen={})),function(n){class t{static renderChart(n,i){$.ajax({url:"/api/playerIndex/history/"+i,success:function(i){t.drawRadarChart(i,n)}})}static drawRadarChart(n,t){new Chart(t,{type:"line",data:{datasets:[{label:"PlayerIndex utveckling",boxWidth:0,borderColor:"#f60",borderWidth:1,hoverBorderColor:"#f60",data:n,pointRadius:0}]},options:{maintainAspectRatio:!1,responsive:!0,legend:{display:!0,labels:{fontSize:9,boxWidth:10,fontColor:"#fff"}},scales:{xAxes:[{type:"time",display:!0,ticks:{fontSize:8},gridLines:{display:!0,color:"#333333"},time:{unit:"day",unitStepSize:30,displayFormats:{day:"MMM YY"}}}],yAxes:[{stacked:!1,ticks:{fontSize:8},gridLines:{display:!0,unitStepSize:10,color:"#333333"}}]}}})}}n.PlayerIndexHistoryChart=t}(Fotbollskanalen||(Fotbollskanalen={})),function(n){"use strict";class t{constructor(t){this.animatePoll=n=>{var t=$(n).find("[data-js='item-poll']"),i=t.attr("data-percent");t.width(i+"%")};this.hideResults=()=>{this.votingClosed()||this.showQuestions(!0)};this.registerVote=()=>{if(this.isChecked()){if(n.CookieModule.getCookie(this.params.guid)){this.getRegisteredVotes();return}var t=$(".selected",this.params.radiosList).attr("data-value"),i=this.params.radiosList.attr("data-pollUid");$.ajax({type:"POST",success:i=>{var r=$.parseJSON(i);n.CookieModule.setCookie(this.params.guid,t,365);this.votingClosed(!0);this.showVotingResult(r)},url:this.params.handlerUrl,data:{methodName:"SaveUserVote",pollUid:i,answerUid:t}})}};this.bindClickEvent=()=>{$("[data-js='poll-click']",this.params.radiosList).on("click",{outer:this},n=>{$(n.currentTarget).siblings().removeClass("selected"),$(n.currentTarget).addClass("selected"),n.data.outer.isChecked(!0)})};this.getRegisteredVotes=()=>{var n=this.params.radiosList.attr("data-pollUid");$.ajax({type:"POST",success:n=>{var t=$.parseJSON(n);this.showVotingResult(t)},url:this.params.handlerUrl,data:{methodName:"GetVotingResults",pollUid:n}})};this.init=()=>{this.params.finishedVoting==="True"||n.CookieModule.getCookie(this.params.guid)?(this.getRegisteredVotes(),this.votingClosed(!0)):this.bindClickEvent()};this.showVotingResult=n=>{var t,i;this.showQuestions(!1);t="Nuvarande resultat på röstningen: ";n.AnswerResults.forEach(n=>{t=t+n.Answer+" - "+n.NumPercents+"%, "});t=t+"rösta på:";this.shareString(t);n.NumPeopleAnswered>=500&&(i=Math.floor(n.NumPeopleAnswered/100)*100,this.numberOfVotes(i));ko.mapping.fromJS(n.AnswerResults,{},this.answersList)};this.answersList=ko.observableArray([]);this.params=t;this.showResult=ko.observable(!1);this.showQuestions=ko.observable(!0);this.isChecked=ko.observable(!1);this.shareString=ko.observable("");this.numberOfVotes=ko.observable(0);this.votingClosed=ko.observable(!1);this.init()}}n.PollModule=t}(Fotbollskanalen||(Fotbollskanalen={})),function(n){class t{constructor(){this.ApplyRelativeTime=function(){t.writeRelativeTime(document);setTimeout(()=>{t.writeRelativeTime(document)},6e4)}}static ApplyRelativeTimeNow(n){t.writeRelativeTime(n)}static writeRelativeTime(n){var i=n.querySelectorAll("[data-publish-time]");i.forEach(n=>{n.innerHTML=t.getRelativeTime(n.attributes["data-publish-time"].value)})}static getRelativeTime(n){var i,r,u,f,e;const t=moment();return(i=t.diff(moment(n),"minutes"),i<60)?i===0?"Just nu":i===1?"1 minut":i+" minuter":(r=t.diff(moment(n),"hours"),r<24)?r===1?"1 timme":r+" timmar":(u=t.diff(moment(n),"days"),u<30)?u===1?"1 dag":u+" dagar":(f=t.diff(moment(n),"months"),f<30)?f===1?"1 månad":f+" månader":(e=t.diff(moment(n),"years"),e+" år")}}n.PublishTimeModule=t}(Fotbollskanalen||(Fotbollskanalen={}));(new Fotbollskanalen.PublishTimeModule).ApplyRelativeTime(),function(n){"use strict";class t{}t.init=function(){if("IntersectionObserver"in window){if(!t.observer){var n=$t.isNative?0:$(".header").height(),i={rootMargin:-n+"px 0px 0px 0px",threshold:1};t.observer=new IntersectionObserver(function(t){t.forEach(t=>{var r=$(t.target),i=r.children(":first");t.isIntersecting?i.removeClass("fixed"):t.boundingClientRect.height==0||t.boundingClientRect.y>=n?i.removeClass("fixed"):i.addClass("fixed")})},i)}t.setupStickyHeaders()}};t.setupStickyHeaders=function(){"IntersectionObserver"in window&&(t.stickyHeaders&&t.stickyHeaders.forEach(n=>t.observer.unobserve(n)),t.stickyHeaders=document.querySelectorAll(".sticky-container"),t.stickyHeaders.length!=0)&&t.stickyHeaders.forEach(n=>t.observer.observe(n))};n.StickyHeadingModule=t}(Fotbollskanalen||(Fotbollskanalen={})),function(n){class t{static getRedirectUrl(n,t){var i=t.contains("?")?"&":"?",r=t.concat(i).concat("utm_campaign=partn_fbk&utm_source=fotbollskanalen&utm_medium=referral");return"https://clk.tradedoubler.com/click?p=295103&a=3268015&g={0}&url={1}".format(n,encodeURIComponent(r))}static openRedirectUrl(n,t){var i=this.getRedirectUrl(n,t);window.open(i,"_blank")}}n.TradeDoublerModule=t}(Fotbollskanalen||(Fotbollskanalen={})),function(n){"use strict";let i;(function(n){n[n.Stryktipset=0]="Stryktipset";n[n.Europatipset=1]="Europatipset";n[n.Topptipset=2]="Topptipset";n[n.TopptipsetStryket=3]="TopptipsetStryket";n[n.TopptipsetEuropa=4]="TopptipsetEuropa"})(i=n.TipsType||(n.TipsType={}));class t{constructor(n,i,r=0,u){this.setConfiguration(n,i,r,u);this.initSingltonListensers();this.loadStryktipsetData();t.updateStryktipsetPrice(n);this.initListeners();t.deadLinePassed&&this.markResult(n)}setConfiguration(n,r,u,f){this.containerClientId=n;this.tipsType=r;this.drawNumber=u;t.stryktipsEventData=f;r===i.Stryktipset?(t.tradeDoublerId="24492296",this.betPostUrl="/api/svenskaspel/stryktipset/post",t.drawResultUrl=u>0?"/api/svenskaspel/stryktipset/getdrawresult/"+u:""):r===i.Europatipset?(t.tradeDoublerId="24530600",this.betPostUrl="/api/svenskaspel/europatipset/post",t.drawResultUrl=u>0?"/api/svenskaspel/europatipset/getdrawresult/"+u:""):r===i.Topptipset?(t.tradeDoublerId="24530602",this.betPostUrl="/api/svenskaspel/topptipset/post",t.drawResultUrl=u>0?"/api/svenskaspel/topptipset/getdrawresult/"+u:""):r===i.TopptipsetStryket?(t.tradeDoublerId="24530606",this.betPostUrl="/api/svenskaspel/topptipsetstryket/post",t.drawResultUrl=u>0?"/api/svenskaspel/topptipsetstryket/getdrawresult/"+u:""):r===i.TopptipsetEuropa&&(t.tradeDoublerId="24530604",this.betPostUrl="/api/svenskaspel/topptipseteuropa/post",t.drawResultUrl=u>0?"/api/svenskaspel/topptipseteuropa/getdrawresult/"+u:"")}setOddsInfo(n){var i,t;if(n!==undefined&&n!==null&&n.events!==undefined&&n.events.length>=1)for(i=$("#"+this.containerClientId+" .stryktipset-item"),t=0;t<n.events.length;t++)n.events[t].odds!==null?($(i[t]).find("[data-js='odds-1']").text(n.events[t].odds.home),$(i[t]).find("[data-js='odds-X']").text(n.events[t].odds.draw),$(i[t]).find("[data-js='odds-2']").text(n.events[t].odds.away)):$(i[t]).find("[data-js='stryktipset-odds-row']").hide(),n.events[t].distribution!==null&&($(i[t]).find("[data-js='distribution-1']").text(n.events[t].distribution.home),$(i[t]).find("[data-js='distribution-X']").text(n.events[t].distribution.draw),$(i[t]).find("[data-js='distribution-2']").text(n.events[t].distribution.away)),n.events[t].newspaper_advice!==null&&($(i[t]).find("[data-js='newspaperAdvice-1']").text(n.events[t].newspaper_advice.home),$(i[t]).find("[data-js='newspaperAdvice-X']").text(n.events[t].newspaper_advice.draw),$(i[t]).find("[data-js='newspaperAdvice-2']").text(n.events[t].newspaper_advice.away))}loadStryktipsetData(){this.setOddsInfo(t.stryktipsEventData);this.setTitle(t.stryktipsEventData)}setTitle(n){if(n.product_name===undefined||n.close_time===undefined){$(".stryktipset-summary-sticky__drawtitle").hide();return}var t=moment(n.close_time).format("ddd YYYY-MM-DD HH:mm");$(".drawtitle-text").text(n.product_name+" spelstopp: "+t)}initBetEndCountDown(n){t.closeTime=n;$.ajax({context:this,url:"https://time.akamai.com/now?client=fotbollskanalen-web&format=rfc3339"}).done(function(n){this.serverTime=moment.unix(n).toDate();this.serverLocalDiff=Date.now()-this.serverTime}).always(function(){t.refreshCountDown()})}static couponDeadlinePassed(){t.deadLinePassed=!0;var n=$(".stryktipset-summary-sticky__button");n.hide();$(".stryktipset-summary-sticky__spelstopp").hide();$(".stryktipset-row-stats").hide();$(".odds-label").hide();$(".svs-rate-stake-wrapper").hide()}markResult(n){t.drawResultUrl.length>0&&$.ajax({context:this,url:t.drawResultUrl}).done(function(i){for(var o,s=$("#"+n+" .stryktipset-item"),h=!1,r=0;r<i.forecast.events.length;r++){var f=$(s[r]).find(".stryktipset-result"),u=i.forecast.events[r],c=moment(t.stryktipsEventData.events[r].sport_event_start),e=c<moment();f.text(e?u.outcome_score:c.format("ddd hh:mm"));e&&(o=$(s[r]).find("[data-outcome='"+u.outcome+"']"),o.siblings().removeClass("outcome-winner"),o.addClass("outcome-winner"));u.is_finished!==!0&&e?f.addClass("live"):f.removeClass("live");u.is_finished!==!0&&(h=!0)}h?(setTimeout(()=>this.markResult(this.containerClientId),6e4),$(".stryktipset-drawendtime").text("Spelet pågår")):$(".stryktipset-drawendtime").text("Spelet avslutat")})}static refreshCountDown(){var r="",n=Math.floor((moment(t.closeTime)-Date.now()+t.serverLocalDiff)/1e3),i;if(n<=0){t.couponDeadlinePassed();return}var u=Math.floor(n/86400),f=Math.floor(n%86400/3600),e=Math.floor(n%3600/60),o=n%60;r=(u>0?u+"d ":"")+t.pad(f)+":"+t.pad(e)+":"+t.pad(o);setTimeout(function(){t.refreshCountDown()},1e3);i=$(".stryktipset-drawendtime");n<3600&&n>0?i.addClass("urgent"):n<7200&&n>0&&i.addClass("soon");i.text(r)}static pad(n){return n<10?"0"+n:""+n}initListeners(){t.deadLinePassed||(this.editCouponListener(),this.clearCouponListener(),this.purchaseButtonListener(),this.changeStakeListener())}purchaseButtonListener(){$(".stryktipset-summary-sticky__button").on("click",{outer:this},n=>{var s;if((n.stopPropagation(),!$("#"+n.data.outer.containerClientId).parent().hasClass("hide"))&&!$(n.currentTarget).hasClass("disabled")){var e=[],r=0,u=1;if($("#"+n.data.outer.containerClientId+" .stryktipset-btn-container").each((n,t)=>{var i=$(t).children(".stryktipset-btn-selected").text();r=Math.max(r,i.length);u=Math.min(u,i.length);e.push(i)}),u<1){$("#error-stryktipset-incomplete span").text("Välj minst ett alternativ för varje match.");$("#error-stryktipset-incomplete").fadeIn().delay(1500).fadeOut();return}var o=t.getRowPrice(this.containerClientId),f={stryktipsRad:e.join(","),system:r>=2?"math":"single",betRowAmount:o!==undefined?o:null},h=t.isCustomSelection?"Custom":$(".tabs__menu-item.selected .tab-title").text()||"Single",c=$(".stryktipset-drawendtime").text();Bonnier.Fotbollskanalen.TrackingModule.TrackSponsoredArticlePurchase(i[n.data.outer.tipsType],t.price,c,t.stryktipsEventData.draw_comment,h);s="{0}?stryktipsRad={1}&system={2}&betRowAmount={3}&drawNumber={4}".format(n.data.outer.betPostUrl,f.stryktipsRad,f.system,f.betRowAmount,this.drawNumber);window.open(s)}})}changeStakeListener(){$("#"+this.containerClientId+" .svs-stake-content-cell").on("click",{outer:this},n=>{$("#"+n.data.outer.containerClientId+" .svs-stake-content .active").removeClass("active"),$(n.currentTarget).addClass("active"),t.updateStryktipsetPrice(n.data.outer.containerClientId)})}editCouponListener(){$("#"+this.containerClientId+" .stryktipset-btn").on("click",{outer:this},n=>{n.stopPropagation(),t.isCustomSelection=!0,$(n.currentTarget).toggleClass("stryktipset-btn-selected"),t.updateStryktipsetPrice(n.data.outer.containerClientId)})}clearCouponListener(){$("#"+this.containerClientId+' [data-js="stryktipset-clean"]').on("click",{outer:this},n=>{n.stopPropagation(),$("#"+n.data.outer.containerClientId+" .stryktipset-btn").removeClass("stryktipset-btn-selected"),t.updateStryktipsetPrice(n.data.outer.containerClientId)})}static getMatchLink(n=1){const i="https://spela.svenskaspel.se/{0}/{1}_{2}/{3}".format(t.stryktipsEventData.product_name.toLowerCase(),t.stryktipsEventData.product_id,t.stryktipsEventData.draw_number,n);return"https://clk.tradedoubler.com/click?p=295103&a=3268015&g={0}&url={1}".format(t.tradeDoublerId,encodeURIComponent(i))}static isLandscape(){try{return window.orientation?Math.abs(Number(window.orientation))===90:!1}catch(n){console.error("Error evaluating landscape",n)}return!1}static setContainerHeight(){var n=$(".stryktipset-sticky-container"),i;try{n.hasClass("sticky")&&(t.isLandscape()?(i=Math.min(screen.height,screen.width)-48,i<n[0].scrollHeight&&n.height(i)):n.height(n[0].scrollHeight),setTimeout(function(){n.height("auto")},500))}catch(r){alert(r)}}static addStickyHideScroll(){var n;if(document.getElementsByClassName("stryktipset-sticky-container").length!==0&&(n=$(".article-sponsored"),n)){var i=n.offset().top+n.height(),t=$(".article-right-widgets"),r=t.height();$(document).on("scroll",function(){$(document).width()<980||(i-r<window.scrollY?t.fadeOut(200):t.fadeIn(200))})}}static closeCoupon(){$(".stryktipset-summary-sticky__item .arrow").removeClass("expanded");var n=$(".stryktipset-sticky-container");n.height(n[0].scrollHeight);n.removeClass("sticky").height(0);$("body").hasClass("native")&&Bonnier.Fotbollskanalen.NativeBridgeModule.CloseHamburgerMenu()}static openCoupen(){$(".stryktipset-summary-sticky__item .arrow").addClass("expanded");var n=$(".stryktipset-sticky-container");n.addClass("sticky");t.setContainerHeight();$("body").hasClass("native")&&Bonnier.Fotbollskanalen.NativeBridgeModule.OpenHamburgerMenu()}static toggleCoupon(){$(document).width()>=980||($(".stryktipset-summary-sticky__item .arrow").hasClass("expanded")?t.closeCoupon():t.openCoupen())}initSingltonListensers(){if(!t.initializationComplete){t.initializationComplete=!0;t.stryktipsEventData!==null&&t.stryktipsEventData!==undefined&&moment(t.stryktipsEventData.close_time)>moment()?this.initBetEndCountDown(t.stryktipsEventData.close_time):t.couponDeadlinePassed();$(".mobile .article-sponsored").on("click",{outer:this},()=>{t.closeCoupon()});$('[data-js="open-stats"]').on("click",function(){var n,t,i,r;event.stopPropagation();n=$(this);t=n.find(".arrow");n.hasClass("open")?(n.removeClass("open"),n.find('[data-js="stats-holder"]').height(0),t.removeClass("expanded")):(n.addClass("open"),i=n.find('[data-js="stats-holder"]'),r=i.first()[0].scrollHeight,i.height(r),t.addClass("expanded"))});$(".stryktipset-summary-sticky").on("click",{outer:this},n=>{n.stopPropagation(),t.toggleCoupon()});$(window).on("orientationchange",function(){t.setContainerHeight()});t.addStickyHideScroll();document.addEventListener("stryktipsetTabChanged",function(n){t.isCustomSelection=!1;t.updateStryktipsetPrice(n.detail)},!1)}}static getRowPrice(n){var t=$("#"+n+" .svs-stake-content-cell.active").data();return t!==undefined?t.amount:undefined}static updateStryktipsetPrice(n){var i=1,e=0,o=0,f,r,u;$("#"+n+" .stryktipset-btn-container").each((n,t)=>{var r=$(t).children(".stryktipset-btn-selected").text();i=i*r.length;r.length===2?e++:r.length===3&&o++});f=t.getRowPrice(n);f!==undefined&&(i=i*f);t.price=i;r=$("#"+n);r.find("[data-js='stryktipset-full']").text(o);r.find("[data-js='stryktipset-half']").text(e);r.find("[data-js='stryktipset-price']").text(i+" kr");u=$(".stryktipset-summary-sticky__button");t.deadLinePassed?($(".stryktipset-summary-sticky__spelstopp").hide(),u.hide()):i>2e4||i<1?u.addClass("disabled"):u.removeClass("disabled")}}t.deadLinePassed=!1;t.serverLocalDiff=0;t.initializationComplete=!1;t.isCustomSelection=!1;n.StryktipsetModule=t}(Fotbollskanalen||(Fotbollskanalen={})),function(n){class t{constructor(n){this.moreItemShown=!1;this.containerClientId=n}applyListeners(){$("#"+this.containerClientId+" .theme-news_show-more").on("click",{outer:this},n=>{$("#"+n.data.outer.containerClientId+" .theme-news_show-more").toggleClass("opened");var t=$("#"+n.data.outer.containerClientId+" .theme-news_more_items");n.data.outer.moreItemShown?t.addClass("theme-news_item_hidden"):t.removeClass("theme-news_item_hidden");$("#"+n.data.outer.containerClientId+" .theme-news_show-more_heading").text(n.data.outer.moreItemShown?"Visa fler":"Visa färre");$("#"+n.data.outer.containerClientId+" .skiplazy").removeClass("skiplazy").addClass("lazy");Bonnier.Fotbollskanalen.ImageLazyLoadModule.InitLazyLoad();n.data.outer.moreItemShown=!n.data.outer.moreItemShown})}}n.ThemeNewsModule=t}(Fotbollskanalen||(Fotbollskanalen={}))