!function(e){var s,n="WebappConfig",i=e.Core.newType("hafasModule");function o(s){e.Config.isCustomer&&(s=function(s,n){return s[n]?e.Core.extend(!0,s,s[n]):s}(s,e.Config.CustomerName)),function(e){e.formatVersion&&"1.0"===e.formatVersion||alert("Error: Wrong format of external config!"),e.urlMgate&&""!==e.urlMgate||alert("Error: Missing mgate URL!")}(s),e.Config.urlMgate=s.urlMgate||null,e.Config.HCI.hciAuth.aid=s.hciAuth.aid,e.Config.Services=s.services,s.services.mapApiClient&&(e.Config.Maps.mapApiClientId=s.services.mapApiClient.id,e.Config.Maps.mapApiKey=s.services.mapApiClient.key),s.services.webpush&&e.Config.Push&&e.Config.Push.channels&&e.Config.Push.channels.webpush&&(s.services.webpush.publicKey&&(e.Config.Push.channels.webpush.publicKey=s.services.webpush.publicKey),s.services.webpush.customerType&&(e.Config.Push.channels.webpush.customerType=s.services.webpush.customerType),s.services.webpush.customerTypeApple&&(e.Config.Push.channels.webpush.customerTypeApple=s.services.webpush.customerTypeApple),s.services.webpush.applePushID&&(e.Config.Push.channels.webpush.applePushID=s.services.webpush.applePushID),s.services.webpush.applePushWebserviceUrl&&(e.Config.Push.channels.webpush.applePushWebserviceUrl=s.services.webpush.applePushWebserviceUrl))}i.getExternalConfig=function(n,i){!function(n,i){s(n+"?v="+e.Core.getAntiCacheParam(),{requestType:"customUrl",method:"get",url:n+"?v="+e.Core.getAntiCacheParam(),onSuccess:function(e){o(JSON.parse(e.response)),i()},onFailure:e.bind((function(e){i()}),this)})}(n,(function(){e.Config.useCustomConfig?function(n){s(e.Config.customConfigPath+"?v="+e.Core.getAntiCacheParam(),{requestType:"customUrl",method:"get",url:e.Config.customConfigPath+"?v="+e.Core.getAntiCacheParam(),onSuccess:e.bind((function(s){try{var i=JSON.parse(s.response);i&&(e.Config.customConfig=e.Core.extend(!0,e.Config.customConfig,i))}catch(e){}n()}),this),onFailure:e.bind((function(e){n()}),this)})}(i):i()}))},e.Core.registerType(n,"WebappConfig",(function(e){})),i.init=function(e,n,i){i&&"function"==typeof i&&(s=i)},e.Core.registerModule(n,i)}(window.Hafas=window.Hafas||{});