
(function(name,definition){if(typeof module!='undefined'&&module.exports)module.exports=definition()
else if(typeof define=='function'&&define.amd)define(definition)
else this[name]=definition()})('$script',function(){var doc=document,head=doc.getElementsByTagName('head')[0],s='string',f=false,push='push',readyState='readyState',onreadystatechange='onreadystatechange',list={},ids={},delay={},scripts={},scriptpath,urlArgs
function every(ar,fn){for(var i=0,j=ar.length;i<j;++i)if(!fn(ar[i]))return f
return 1}
function each(ar,fn){every(ar,function(el){return!fn(el)})}
function $script(paths,idOrDone,optDone){paths=paths[push]?paths:[paths]
var idOrDoneIsDone=idOrDone&&idOrDone.call,done=idOrDoneIsDone?idOrDone:optDone,id=idOrDoneIsDone?paths.join(''):idOrDone,queue=paths.length
function loopFn(item){return item.call?item():list[item]}
function callback(){if(!--queue){list[id]=1
done&&done()
for(var dset in delay){every(dset.split('|'),loopFn)&&!each(delay[dset],loopFn)&&(delay[dset]=[])}}}
setTimeout(function(){each(paths,function loading(path,force){if(path===null)return callback()
path=!force&&path.indexOf('.js')===-1&&!/^https?:\/\//.test(path)&&scriptpath?scriptpath+path+'.js':path
if(scripts[path]){if(id)ids[id]=1
return(scripts[path]==2)?callback():setTimeout(function(){loading(path,true)},0)}
scripts[path]=1
if(id)ids[id]=1
create(path,callback)})},0)
return $script}
function create(path,fn){var el=doc.createElement('script'),loaded
el.onload=el.onerror=el[onreadystatechange]=function(){if((el[readyState]&&!(/^c|loade/.test(el[readyState])))||loaded)return;el.onload=el[onreadystatechange]=null
loaded=1
scripts[path]=2
fn()}
el.async=1
el.src=urlArgs?path+(path.indexOf('?')===-1?'?':'&')+urlArgs:path;head.insertBefore(el,head.lastChild)}
$script.get=create
$script.order=function(scripts,id,done){(function callback(s){s=scripts.shift()
!scripts.length?$script(s,id,done):$script(s,callback)}())}
$script.path=function(p){scriptpath=p}
$script.urlArgs=function(str){urlArgs=str;}
$script.ready=function(deps,ready,req){deps=deps[push]?deps:[deps]
var missing=[];!each(deps,function(dep){list[dep]||missing[push](dep);})&&every(deps,function(dep){return list[dep]})?ready():!function(key){delay[key]=delay[key]||[]
delay[key][push](ready)
req&&req(missing)}(deps.join('|'))
return $script}
$script.done=function(idOrDone){$script([null],idOrDone)}
return $script});
if(typeof JSON!=='object'){JSON={};}
(function(){'use strict';function f(n){return n<10?'0'+n:n;}
if(typeof Date.prototype.toJSON!=='function'){Date.prototype.toJSON=function(){return isFinite(this.valueOf())?this.getUTCFullYear()+'-'+f(this.getUTCMonth()+1)+'-'+f(this.getUTCDate())+'T'+f(this.getUTCHours())+':'+f(this.getUTCMinutes())+':'+f(this.getUTCSeconds())+'Z':null;};String.prototype.toJSON=Number.prototype.toJSON=Boolean.prototype.toJSON=function(){return this.valueOf();};}
var cx,escapable,gap,indent,meta,rep;function quote(string){escapable.lastIndex=0;return escapable.test(string)?'"'+string.replace(escapable,function(a){var c=meta[a];return typeof c==='string'?c:'\\u'+('0000'+a.charCodeAt(0).toString(16)).slice(-4);})+'"':'"'+string+'"';}
function str(key,holder){var i,k,v,length,mind=gap,partial,value=holder[key];if(value&&typeof value==='object'&&typeof value.toJSON==='function'){value=value.toJSON(key);}
if(typeof rep==='function'){value=rep.call(holder,key,value);}
switch(typeof value){case'string':return quote(value);case'number':return isFinite(value)?String(value):'null';case'boolean':case'null':return String(value);case'object':if(!value){return'null';}
gap+=indent;partial=[];if(Object.prototype.toString.apply(value)==='[object Array]'){length=value.length;for(i=0;i<length;i+=1){partial[i]=str(i,value)||'null';}
v=partial.length===0?'[]':gap?'[\n'+gap+partial.join(',\n'+gap)+'\n'+mind+']':'['+partial.join(',')+']';gap=mind;return v;}
if(rep&&typeof rep==='object'){length=rep.length;for(i=0;i<length;i+=1){if(typeof rep[i]==='string'){k=rep[i];v=str(k,value);if(v){partial.push(quote(k)+(gap?': ':':')+v);}}}}else{for(k in value){if(Object.prototype.hasOwnProperty.call(value,k)){v=str(k,value);if(v){partial.push(quote(k)+(gap?': ':':')+v);}}}}
v=partial.length===0?'{}':gap?'{\n'+gap+partial.join(',\n'+gap)+'\n'+mind+'}':'{'+partial.join(',')+'}';gap=mind;return v;}}
if(typeof JSON.stringify!=='function'){escapable=/[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g;meta={'\b':'\\b','\t':'\\t','\n':'\\n','\f':'\\f','\r':'\\r','"':'\\"','\\':'\\\\'};JSON.stringify=function(value,replacer,space){var i;gap='';indent='';if(typeof space==='number'){for(i=0;i<space;i+=1){indent+=' ';}}else if(typeof space==='string'){indent=space;}
rep=replacer;if(replacer&&typeof replacer!=='function'&&(typeof replacer!=='object'||typeof replacer.length!=='number')){throw new Error('JSON.stringify');}
return str('',{'':value});};}
if(typeof JSON.parse!=='function'){cx=/[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g;JSON.parse=function(text,reviver){var j;function walk(holder,key){var k,v,value=holder[key];if(value&&typeof value==='object'){for(k in value){if(Object.prototype.hasOwnProperty.call(value,k)){v=walk(value,k);if(v!==undefined){value[k]=v;}else{delete value[k];}}}}
return reviver.call(holder,key,value);}
text=String(text);cx.lastIndex=0;if(cx.test(text)){text=text.replace(cx,function(a){return'\\u'+('0000'+a.charCodeAt(0).toString(16)).slice(-4);});}
if(/^[\],:{}\s]*$/.test(text.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,'@').replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,']').replace(/(?:^|:|,)(?:\s*\[)+/g,''))){j=eval('('+text+')');return typeof reviver==='function'?walk({'':j},''):j;}
throw new SyntaxError('JSON.parse');};}}());
var TSOTranslations = {"vehicleInStock":"1 veículo no armazém","locationsOverview":"Todas as localizações em resumo","VAT":"{0} IVA","paint":"Pintura","truckletterSuccessTitle":"Subscrever a TruckLetter","homePage":"Página inicial","totalPriceVATOnlyLabel":"(bruto)","firstRegistration":"PM","allin":"Todos na","generalError":"Tenha em atenção a indicação de erro nos campos assinalados a vermelho e preencha-os corretamente.","gfzNumber":"ID de veículo usado","isPriceReduced":"Cotação","truckletterFooter":"Sim, concordo que o TruckLetter será enviado para mim por e-mail. Cabe-lhe selecionar quais as ofertas a enviar-lhe e a respetiva periodicidade: novidade do portfólio ou preço reduzido. Li a <a href='https://www.truckstore.com/PT/pt/sobre-a-truckstore/protecao-de-dados-na-truckstore.html'>declaração de autorização</a> e autorizo o processamento e utilização dos meus dados. O cancelamento da subscrição é possível a qualquer momento através da hiperligação no final da TruckLetter.","last_nameRequired":"Introduza o seu apelido.","warranty":"Garantia TruckStore","sortBy":"Organizar por","finalInstallment":"Última prestação","fax":"Fax","contactByOption":"Ainda não deu a sua autorização ou recusa para um contacto. Se pudermos estabelecer contacto consigo, poderemos responder melhor às suas necessidades no futuro.","lastSearch":"Última pesquisa","additonalInformation":"Informação adicional","suspension":"Suspensão","sales_messageMaxLength":"The maximum number of characters for the message is {maxLength}.","detailsDisclaimer":"Esta cotação não é vinculativa. Encontra-se sujeita a erros e vendas. Cotações em unidades monetárias estrangeiras são calculadas com base nas taxas actuais de câmbio. É aplicável a unidade monetária do local do veículo.","images":"Imagens","financeCalculatorTitle":"Mercedes-Benz Bank","truckPurchasePrivacyHead":"Nota","reservedVehiclePrimaryImage":"RESERVADO","printDisclaimer":"Cotação de veículo não vinculativa","vehicleNotFoundBreadcrumb":"Não foi encontrado qualquer veículo","searchSwipeHint":"Deslize para mostrar/ocultar filtros","detailviewReservedSimilarVehiclesHeadline":"Veículos semelhantes","yourContactPerson":"Os Seus Contactos","accept":"Aceitar","leasing_service":"Leasing","businessAndContactours":"Horário de expediente e para contacto telefónico","financeCalculatorDescription":"<p>Indicação: O Mercedes-Benz Bank apenas pode prestar serviços de financiamento a pessoas residentes na Alemanha.</p><p>*  Monatliche Rate. <strong>Diese Beispielkalkulation der Mercedes-Benz Bank AG, Siemensstraße 7, 70469 Stuttgart</strong> gilt für eine Finanzierung bei einem festgesetzten effektiven Jahreszins, einer Anzahlung von 15, 97 % des Kaufpreises und einer Laufzeit von 36 Monaten. Ist der Darlehensnehmer Verbraucher, besteht nach Vertragsschluss ein gesetzliches Widerrufsrecht nach §495 BGB.</p>","wheelbase":"Dist.eixo","searchExcludeVat":"* excluíndo IVA","searchVehiclesPlural":"{0} que correspondem aos seus critérios","lastsearches_title":"Últimas pesquisas","truckPurchasePrivacyDesc1":"Desejamos informá-lo e aconselhá-lo de forma individualizada. Pedimos-lhe, por isso, para concordar com a utilização dos seus dados. Estes serão tratados de forma confidencial e cuidadosa.","truckPurchasePrivacyDesc2":"Li a declaração de autorização e autorizo o processamento e utilização dos meus dados. Podem contactar-me das formas seguintes:","emailRequired":"Introduza o seu endereço de e-mail.","aprEffective":"Taxa de juro efectiva","contactFormTitle":"A sua mensagem para o TruckStore","totalPrice":"Preço total","privacyFormTitle":"Nota","truckletterAgreement":"Sim, concordo que me enviem a TruckLetter por e-mail. O cancelamento da subscrição é possível em qualquer altura através de um link em baixo na TruckLetter.","filterTrucks":"Filtrar veículos","cabin":"Cabina","truckletterSelectionTitle":"Personalizar TruckLetter","locationOfVehicles":"Localização dos veículos","cookieNoticeContent":"A Daimler utiliza cookies para poder organizar o website da forma ideal e melhorá-lo continuamente.<br/> Ao continuar a utilizar o website, concorda com a utilização de cookies.<br/><br/><a href='/~country~/~language~/sobre-a-truckstore/cookies-website-da-truckstore.html'>Poderá obter mais informações nas indicações relativas aos cookies.</a>","vehicle":"Veículo","lastSearchSubscribe":"Subscrever última pesquisa","financing":"financiamento","totalPriceWithoutVAT":"(líquido)","vehiclesInStock":"{0} veículos  no armazém","term":"Duração","currency":"Moeda","reservedVehicleSearch":"Encontre veículos semelhantes na nossa oferta.","map":"Mapa","close":"Fechar","kilometersIncluded":"Quilometragem","email":"Email","yourRepresentativeForThisTruck":"O seu contacto para este veículo","vehicleNotFoundDescription":"Recomendamos-lhe que entre em contacto com um vendedor da TruckStore mais próxima de si. Os nossos vendedores terão todo o gosto em ajudá-lo a procurar um veículo adequado.","question":"Solicitação","languages":"Idiomas","first_nameRequired":"Introduza o seu nome.","bookmarked":"Guardado","change":"Alterar","businessHours":"Horário de funcionamento","salesFormTitle":"Pedir Cotação","services":"Serviços","captchaRequired":"Por favor, confirme a pergunta de segurança.","truckletterNewsletterSelected":"Seleccione, no mínimo, uma oferta Truck.","call":"Ligar","reservedVehiclePartnerTitle":"O seu interlocutor no próximo TruckStore","privacyStatementIntLink":"","locationsHeaderCountries":"Países","sortByList":"Relevância, Primeira matrícula - ascendente|dateOfRegistration|asc, Primeira matrícula - descendente|dateOfRegistration|desc, Quilómetros - ascendente|km|asc, Quilómetros - descendente|km|desc, Preço - ascendente|priceNet|asc, Preço - descendente|priceNet|desc","centerTelephoneHours":"Pelo telefone","vehicleNotFoundTitle":"Não foi encontrado qualquer veículo","truckletterRequest":"Solicitar diretamente a TruckLetter","offerPrice":"Cotação","xxlImages":"Imagens XXL","truckletterSelectionText":"Selecione os seus interesses para a Newsletter:","searchGoldSilverBronze":"Ouro/Prata/Bronze","informationNoticeTitle":"","phoneRequired":"Introduza o seu número de telefone.","locationsHeaderCenters":"{0} TruckStore Center em {1} países","informationReadStatement":"","leasing":"Leasing","searchNoResultsSubTitle":" que correspondam aos seus critérios","truckletterSuccess":"O seu registo foi bem-sucedido.<br/>Acabou de receber um e-mail com um link de confirmação. A mensagem foi enviada para o endereço de e-mail indicado:<br/><b>~truckletterEmail~</b><br/><br/>Pode cancelar o nosso serviço a qualquer momento. Para tal, clique diretamente no respetivo link na sua Truckletter.<br/><br/>É com satisfação que constatamos o seu interesse pela nossa Truckletter.","salesFormSuccess":"Recebemos a sua comunicação. Iremos contactá-lo telefonicamente durante o nosso horário de expediente para lhe fornecer mais informações sobre o veículo que escolheu.","payload":"Carga Útil","continue":"Seguinte","contact":"Contato","announcementTitle":"Alteração dos nossos avisos de proteção de dados","informationNoticeStatement":"","export":"Exportação","messageMaxLength":"The maximum number of characters for the message is {maxLength}.","lastSearchFrequency":"Selecione a sua frequência para a newsletter","showVehicles":"Exibir veículos","centerNamePrefix":"TruckStore","months":"Meses","returnToList":"Lista","searchVehiclesSingular":"{0} que vai ao encontro dos seus critérios","searchNoResultsTitle":"Sem veículos","equipment":"Equipamento","privacyFormReadTerms":"Ler a declaração de autorização legal relativa à confidencialidade dos dados","telephone":"Telefone","bookmark":"Favorito","recipientRequired":"Escolha um destinatário.","truckletterPrivacyStatementText":"Os seus dados que introduziu aqui, serão armazenados e tratados exclusivamente para o envio da Newsletter. Informações de proteção de dados adicionais: <a href=\"javascript:void(0)\" onClick=\"window.open('https://www.truckstore.com/PT/pt/sobre-a-truckstore/protecao-de-dados-na-truckstore.html')\">Proteção de dados</a>","abort":"Cancelar","vehicleSold":"","salesRepButton":"Equipa de vendas","announcementContent":"Ex.mos Senhores, <br>A Daimler AG foi reestruturada. A responsabilidade em termos de proteção de dados desta página web cabe a partir de 01/11/2019 à Daimler Truck AG.<br><br><a href\=\"javascript:void(0)\" onClick\=\"window.open('https://www.truckstore.com/PT/pt/protecao-de-dados-atualizada.html')\"> Avisos de proteção de dados </a>(atualização a 01/11/2019)","vehicleDetailViewPS":"CV ","page":"Página","sales_phoneRequired":"Introduza o seu número de telefone.","send":"Enviar","bookmarkList":"Favoritos","next":"Seguinte","backToTop":"Para cima","color":"Cor","searchExclusive":"","purchasePrivacyStatementHead":"Declaração da protecção de dados pessoais","financial":"financiamento","cargoSpace":"Espaço de carga (C/L/A)","line":"Linha de equipamento","salesFormTitleSuccess":"Mensagem enviada para TruckStore {0}","privacyFormDescription":"Desejamos informá-lo e aconselhá-lo de forma individualizada. Pedimos-lhe, por isso, para concordar com a utilização dos seus dados. Estes serão tratados de forma confidencial e cuidadosa.","vehicles":"Veículos","truckPurchasePrivacyLink":"Ler a declaração de autorização legal relativa à confidencialidade dos dados","reservedVehicleSearchButton":"Mostrar veículos semelhantes","reservedVehiclePartner":"Os nossos vendedores terão todo o gosto em ajudá-lo a procurar um veículo adequado.","specialPayment":"Pagamento especial","emailValid":"Introduza um endereço de e-mail válido.","vehicle_typeRequired":"Introduza o tipo de veículo.","monthlyLeasingRate":"Renda","truckletterTitle":"Novidades da TruckStore - solicitar agora e manter-se informado.","purchasePrivacyStatement":"Aceito que os meus dados de contacto e os dados relativos ao meu veículo e aos serviços usados sejam processados e utilizados pela Daimler AG e pelos parceiros de distribuição e oficinas autorizados para fins de informação e aconselhamento sobre produtos e serviços da Daimler AG e das empresas a ela associadas, bem como para a realização de pesquisas de mercado. Os dados poderão ser transmitidos à Daimler AG, aos concessionários/oficinas seleccionados pertencentes à organização de vendas e assistência Daimler e a institutos de pesquisa de mercado para os efeitos supramencionados.<br/><br/>Se desejar que os seus dados não sejam processados e utilizados, seremos obrigados, por motivos legais, a deixar de lhe prestar informações sobre produtos e serviços. Se pretender revogar a sua declaração de consentimento num momento posterior, contacte a Daimler AG, assunto: TruckStore Daten, HPC Z800, 70564 Stuttgart.<br/><br/>Se pretender deixar de ser contactado(a) pelos nossos serviços de forma permanente, poderá suspender a utilização dos seus dados para fins de informação sobre produtos e serviços, e para a realização de pesquisas de mercado. Contacte: Daimler AG, assunto: TruckStore Daten, HPC Z800, 70564 Stuttgart. Esta suspensão limita, porém, a possibilidade de lhe podermos prestar assistência e informações.","monthlyFinancingRate":"Prestação mensal","vehicleSearch":"Procurar veículos","truckData":"Dados do veículo","privacyFormAcceptance":"Li a declaração de autorização e autorizo o processamento e utilização dos meus dados. Podem contactar-me das formas seguintes:","searchNoResultsDescription":"Recomendamos que realize uma procura com menos restrições ou que entre em contacto com um dos nossos vendedores. Os nossos vendedores terão todo o gosto em ajudá-lo a procurar um veículo adequado.","truckPurchaseFormTitle":"Ou envie-nos algumas informações sobre o seu camião e nós responder-lhe-emos","allVehicles":"Todos os veículos","vehicle_commentsMaxLength":"The maximum number of characters for vehicle comments is {maxLength}.","previous":"Anterior","logisticDesign":"Design da logística","nameRequired":"Introduza o seu apelido.","totalPriceVAT":"(bruto, incl. {0} IVA)","mobile":"Telemóvel","clear":"Retroceder","cookieNoticeHead":"Utilização de cookies","steering":"Direcção","numberOfPreviousOwners":"Proprietários anteriores","isNew":"Novo","any":"Qualquer item","viewVehicles":"Exibir veículos","searchHeaderPlaceholder":"Pesquisa","phoneValid":"Por favor introduza um número de telefone válido.","salesFormDescription":"Iremos contactá-lo telefonicamente durante o nosso horário de expediente para lhe fornecer mais informações sobre o veículo que escolheu.","print":"Imprimir","truckPurchaseVehicleTitleBreak":"Dados do veículo","application":"Aplicação","productGroup":"Grupo de produtos","totalWeight":"Peso Bruto","until":"a","detailviewReservedBreadcrumb":"Veículo já não existe","category":"Categoria","privacyStatementLink":"Para que a sua TruckStore possa responder ao seu pedido, precisamos de dados seus relativos à forma de tratamento, ao apelido e endereço de e-mail ou número de telefone. Desta forma, podemos responder-lhe de forma personalizada e oferecer-lhe o melhor serviço possível. Os dados fornecidos por si são guardados e tratados exclusivamente para dar resposta ao seu pedido. Para mais informações, consulte a nossa <a href\=\"javascript:void(0)\" onClick\=\"window.open('https://www.truckstore.com/{0}/pt/sobre-a-truckstore/protecao-de-dados-na-truckstore.html')\">Política de Privacidade</a>.","downpayment":"Primeira prestação"}

var app=angular.module("app",["ngRoute","ngResource","angular-cache","ngCookies","ngTouch","ui.bootstrap","infinite-scroll","jkuri.gallery","angular-uuid","fs-calculation-module"]);app.config(["$routeProvider","$locationProvider","CacheFactoryProvider",function(t,e,r){angular.extend(r.defaults,{maxAge:9e5}),window.history&&window.history.pushState&&e.html5Mode({enabled:!1,requireBase:!1,rewriteLinks:!1})}]),app.run(["$rootScope",function(t){t.tsoI18n=TSOTranslations,t.htmlDirection=TSO.Helpers.htmlDirection()}]),app.filter("numberDotted",function(){return function(t,e){return null==t?"":t.toString().replace(/\B(?=(\d{3})+(?!\d))/g,e)}}),app.filter("sanitize",["$sce",function(t){return function(e){return t.trustAsHtml(e)}}]),app.filter("stringFormat",function(){function t(t,e,r){for(var n="",i=0;;){var o=e.indexOf("{",i),a=e.indexOf("}",i);if(o<0&&a<0){n+=e.slice(i);break}if(a>0&&(a<o||o<0)){if("}"!==e.charAt(a+1))throw new Error("format stringFormatBraceMismatch");n+=e.slice(i,a+1),i=a+2}else if(n+=e.slice(i,o),i=o+1,"{"!==e.charAt(i)){if(a<0)throw new Error("format stringFormatBraceMismatch");var u=e.substring(i,a),c=u.indexOf(":"),l=parseInt(c<0?u:u.substring(0,c),10);if(isNaN(l))throw new Error("format stringFormatInvalid");var s=c<0?"":u.substring(c+1),f=r[l];void 0!==f&&null!==f||(f=""),f.toFormattedString?n+=f.toFormattedString(s):t&&f.localeFormat?n+=f.localeFormat(s):f.format?n+=f.format(s):n+=f.toString(),i=a+1}else n+="{",i++}return n}return function(e,r){return r&&r.length&&e?t(!1,e,r):e}}),$(document).ready(function(){$(".mega-menu-language").hover(function(){TSO.Helpers.isDesktopSize()&&($(".mega-menu-language").find(".mega-menu-category").each(function(t){$(this).height($(this).height())}),setTimeout(function(){$(".tso-mega-menu-wrapper").masonry({itemSelector:".mega-menu-category",columnWidth:120,transitionDuration:0})},50))})}),$(document).click(function(t){if(!document.activeElement.type||"search"!=document.activeElement.type){var e=$(t.target),r=$(".navbar-collapse");!0!==r.hasClass("in")||e.hasClass("navbar-toggle")||r.collapse("hide")}}),app.directive("htmlRender",["$compile",function(t){return{restrict:"A",scope:{html:"@"},link:function(e,r){e.$watch("html",function(n){if(n){var i=t(n)(e);r.append(i)}})}}}]),String.prototype.replaceAll=function(t,e){return this.replace(new RegExp(t,"g"),e)},Array.prototype.indexOf||(Array.prototype.indexOf=function(t,e){for(var r=e||0,n=this.length;r<n;r++)if(this[r]===t)return r;return-1});
var TSO={ServicePath:function(){return"sto"==TSO.Helpers.getPlatform()?"test"==TSO.Helpers.getEnvironment()||"localhost"==document.location.hostname?"https://proxytest.sto-aws.com/tsoApp/":"int"==TSO.Helpers.getEnvironment()?"https://proxyint.sto-aws.com/tsoApp/":(TSO.Helpers.getEnvironment(),"https://proxyprod.sto-aws.com/tsoApp/"):"tza"==TSO.Helpers.getPlatform()?"int"==TSO.Helpers.getEnvironment()?"https://proxyintza.tso-aws.com/tsoApp/":(TSO.Helpers.getEnvironment(),"https://proxyprodza.tso-aws.com/tsoApp/"):"test"==TSO.Helpers.getEnvironment()||"localhost"==document.location.hostname?"https://proxytest.tso-aws.com/tsoApp/":"int"==TSO.Helpers.getEnvironment()?"https://proxyint.tso-aws.com/tsoApp/":"int2"==TSO.Helpers.getEnvironment()?"https://proxyint2.tso-aws.com/tsoApp/":"prod"==TSO.Helpers.getEnvironment()?"https://proxyprod.tso-aws.com/tsoApp/":"prod2"==TSO.Helpers.getEnvironment()?"https://proxyprod2.tso-aws.com/tsoApp/":"https://proxyprod.tso-aws.com/tsoApp/"},MapsApiKey:function(){return"sto"==TSO.Helpers.getPlatform()?"test"==TSO.Helpers.getEnvironment()||"localhost"==document.location.hostname?"AIzaSyBwUDyOI_GwOwTn01cHr9oVGl415I4dGEk":"int"==TSO.Helpers.getEnvironment()?"AIzaSyD-FMRoQFHKYW3TuecSWG7F5ktHLTIkGBM":(TSO.Helpers.getEnvironment(),"AIzaSyC1gVk8L7m1X8HLRMohjcw1X9yt9Jb-428"):"tza"==TSO.Helpers.getPlatform()?"test"==TSO.Helpers.getEnvironment()||"localhost"==document.location.hostname?"AIzaSyBwUDyOI_GwOwTn01cHr9oVGl415I4dGEk":"int"==TSO.Helpers.getEnvironment()?"AIzaSyCCL5uhVTRt3EX_N_KPXJ283dtI0-d6Pz8":(TSO.Helpers.getEnvironment(),"AIzaSyBvztXdxt2EEvs904RM7AgSLHYKs1ZGQuI"):"test"==TSO.Helpers.getEnvironment()||"localhost"==document.location.hostname?"AIzaSyA4xUzqqjJr1amJcQ0AG-VuIU41UKjRqDg":"int"==TSO.Helpers.getEnvironment()?"AIzaSyCCL5uhVTRt3EX_N_KPXJ283dtI0-d6Pz8":(TSO.Helpers.getEnvironment(),"AIzaSyBvztXdxt2EEvs904RM7AgSLHYKs1ZGQuI")},Helpers:{language:function(){return $('meta[name="language"]').attr("content")},getEnvironment:function(){return $('meta[name="environment"]').attr("content")},getPlatform:function(){return void 0==$('meta[name="platform"]').attr("content")?"tso":$('meta[name="platform"]').attr("content")},uvid:function(){var e=window.location.pathname;e=e.replace(".html","").replace(/\/$/,"");for(var t=e.split(/[\/]|[\.]/),a=0;a<t.length;a++)if(("detail"===t[a]||"print"===t[a])&&a+1<t.length)return t[a+1];return t[t.length-1]},centerId:function(){var e=window.location.pathname;e=e.replace(".html","").replace(/\/$/,"");for(var t=e.split(/[\/]|[]/),a=0;a<t.length;a++)if("site"===t[a]&&a+1<t.length)return t[a+1];return t[t.length-1]},country:function(){var e=$('meta[name="country"]').attr("content");return""!=e&&"INT"!=e||(e="EN"),e},rawCountry:function(){var e=$('meta[name="country"]').attr("content");return""==e&&(e="EN"),e},currency:function(){return $('meta[name="currency"]').attr("content")},culture:function(){return TSO.Helpers.language()+"_"+TSO.Helpers.country()},culturePath:function(){return"EN"==TSO.Helpers.country()?"en"==TSO.Helpers.language()?"/":"/"+TSO.Helpers.language()+"/":"/"+TSO.Helpers.country()+"/"+TSO.Helpers.language()+"/"},siteURL:function(e,t){return this.culturePath()+"site/"+e+"/"+encodeURIComponent(t)+".html"},pageType:function(){return $('meta[name="pageType"]').attr("content")},isMobile:function(){return!(!TSO.Helpers.isDevice()||!$("body").hasClass("tso-responsive-mobile-size"))},binaryStringToBytes:function(e){for(var t=[],a=0;a<e.length;a++)t.push(e.charCodeAt(a));return t},binaryBytesToString:function(e){return e.map(function(e){return String.fromCharCode(e)}).join("")},stringToBytes:function(e){return TSO.Helpers.binaryStringToBytes(unescape(encodeURIComponent(e)))},formatAmount:function(e){return e.toString().replace(".",",").replace(/\B(?=(\d{3})+(?!\d))/g,".")},isTablet:function(){return!(!TSO.Helpers.isDevice||!$("body").hasClass("tso-responsive-tablet-size"))},isMobileOnly:function(){return!(!bowser.hasOwnProperty("mobile")||!bowser.mobile)},isDevice:function(){return!!(bowser.hasOwnProperty("tablet")&&bowser.tablet||bowser.hasOwnProperty("mobile")&&bowser.mobile)},isDesktopSize:function(){return $("body").hasClass("tso-responsive-desktop-size")},htmlDirection:function(){return $("html").attr("dir")},siteOnResize:function(){$(".tso-responsive-desktop-size-override").is(":visible")?$("body").addClass("tso-responsive-desktop-size"):$("body").removeClass("tso-responsive-desktop-size"),$(".tso-responsive-tablet-size-override").is(":visible")?$("body").addClass("tso-responsive-tablet-size"):$("body").removeClass("tso-responsive-tablet-size"),$(".tso-responsive-mobile-size-override").is(":visible")?$("body").addClass("tso-responsive-mobile-size"):$("body").removeClass("tso-responsive-mobile-size");var e=0;$(".max-height-list").each(function(){var t=$(this).find("li");t.height("");var a=0;t.each(function(){var t=$(this),s=$(this).height();s>a&&(a=s);var n=0;if($(".tso-responsive-mobile-size-override").is(":visible")){var r=t.find("img:visible").first();r&&(n=r.height())}else n=t.outerHeight()-t.find(".tso-block-small-description").outerHeight();var o=t.find(".tso-block-small-head");t.find(".tso-home-gmap").length>0&&0!=e?$(".tso-home-gmap").height(e-15):e=n,o.length>0&&o.css("top",e-o.outerHeight()+"px")}),t.each(function(e){2!=e&&$(this).height(a)})})},initCardEvents:function(){$(window).resize(function(){TSO.Helpers.resizeCards()}),$(window).on("load",function(){TSO.Helpers.resizeCards()})},resizeCards:function(){var e=$(".tso-card"),t=-1;e.each(function(){var e=$(this),a=parseFloat(e.css("padding-top"))||0,s=parseFloat(e.css("padding-bottom"))||0,n=parseFloat(e.css("border-top-width"))||0,r=parseFloat(e.css("border-bottom-width"))||0;$(this).removeAttr("style");var o=$(this).outerHeight()-a-s-n-r;o>t&&(t=o)}),e.height(t)},hashCode:function(e){var t,a,s,n=0;if(0==e.length)return n;for(t=0,s=e.length;t<s;t++)a=e.charCodeAt(t),n=(n<<5)-n+a,n|=0;return n},getUrlParameter:function(e,t){var a=decodeURIComponent(window.location.search.substring(1));null!=t&&""!=t&&(a=t);var s,n,r=a.split("&");for(n=0;n<r.length;n++){if(s=r[n].split("="),s[0]===e)return void 0!==s[1]&&s[1];if("leasingInternationalCampaign"===e&&"leasing"===s[0])return"leasing"!==s[1]&&s[1];if("financingInternationalCampaign"===e&&"financing"===s[0])return"financing"!==s[1]&&s[1];if("specialInternationalCampaign"===e&&"special"===s[0])return"special"!==s[1]&&s[1]}},removeURLParameter:function(e,t){for(var a=encodeURIComponent(t)+"=",s=e.split(/[&;]/g),n=s.length;n-- >0;)-1!==s[n].lastIndexOf(a,0)&&s.splice(n,1);return e=s.join("&")},parseTruckTitleUrl:function(e){return encodeURIComponent(e).replace(/\s/g,"-").replace(/\//g,"").replace(/\./g,"").replace(/[^\w\s]/gi,"").substring(0,20)},getHash:function(){return TSO.Helpers.cleanupHash(window.location.hash)},cleanupHash:function(e){return e.replace("##","").replace("#/","").replace("/#","").replace("#","")},changeHash:function(e){e=e.replaceAll(" ","%20"),window.location.hash!=e&&(location.replace(e),$(".tso-header-menu-language [data-language-uid]").each(function(){var t=$(this).attr("href"),a=t.indexOf("#");a>=0&&(t=t.substr(0,a)),$(this).attr("href",t+e)}))},validation:{emailValid:"^(?:[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*|\"(?:[\\x01-\\x08\\x0b\\x0c\\x0e-\\x1f\\x21\\x23-\\x5b\\x5d-\\x7f]|\\\\[\\x01-\\x09\\x0b\\x0c\\x0e-\\x7f])*\")@(?:(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?|\\[(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?|[a-z0-9-]*[a-z0-9]:(?:[\\x01-\\x08\\x0b\\x0c\\x0e-\\x1f\\x21-\\x5a\\x53-\\x7f]|\\\\[\\x01-\\x09\\x0b\\x0c\\x0e-\\x7f])+)\\])$",valueRequired:"^(?!\\s*$).+",phoneValid:"([^-\\s\\d.()+])",validateFormElement:function(e,t){var a="";if("captcha"==e.type)e.text=grecaptcha.getResponse(),a=e.text;else if("email"==e.type){var s=new RegExp(TSO.Helpers.validation.emailValid);if((a=$.trim(e.text||""))&&!s.test(a))return{message:t.emailValid,type:"invalidEmail"}}else if("phone"==e.type){var s=new RegExp(TSO.Helpers.validation.phoneValid);if((a=$.trim(e.text||""))&&s.test(a))return{message:t.phoneValid,type:"invalidPhone"}}else a="options"==e.type?void 0!=e.selectedOption&&null!=e.selectedOption?e.selectedOption.toString():"":"dropdown"==e.type?e.selectedOption.valid?e.selectedOption:"":e.text;if(e.required&&!a)return"email"==e.type||"phone"==e.type||"captcha"==e.type?{message:t[e.type+"Required"],type:"required"}:{message:t[e.name.toLowerCase()+"Required"],type:"required"};if(e.required&&"checkbox"==e.type&&!e.selected)return{message:t[e.type+"Required"],type:"required"};if(e.maxLength&&a&&a.length>e.maxLength){var n=t[e.name.toLowerCase()+"MaxLength"]||"";return n=n.replace(/\{maxLength\}/g,e.maxLength),{message:n,type:"maxLength"}}return null}}}},TSOChat={currentTime:function(){var e=new Date;return e.getHours()+":"+e.getMinutes()+":"+e.getSeconds()+" -- "},getCenterUrl:function(e){var t={en:{23200:"//userlike-cdn-widgets.s3-eu-west-1.amazonaws.com/03444cc4848995df212ea12b977d389ac5d9deabcf0d64c74a0320cb38b4d9b9.js",25900:"//userlike-cdn-widgets.s3-eu-west-1.amazonaws.com/64087b54786ccddc36e47bb1fc29b8f7097f9fe7324384c5bb6f596599665fc5.js",20700:"//userlike-cdn-widgets.s3-eu-west-1.amazonaws.com/806e050a804f664b9a5dd5159decad6f62c3f93826deb216fe3ee90517d1064e.js",25901:"//userlike-cdn-widgets.s3-eu-west-1.amazonaws.com/8db3e6bd8090e6d35fe58331b54a7d372f036581462b67b36bbaef0ede9b1898.js",26600:"//userlike-cdn-widgets.s3-eu-west-1.amazonaws.com/39702b75da88ad1f05db64a5f79da312ae9c594e4cf1ecf0619953e1172e2fd3.js",21300:"//userlike-cdn-widgets.s3-eu-west-1.amazonaws.com/826760faa0a7e50263fff55dc90f381e33123de71febf6f5bf3dcac6a7a7b268.js",320900:"//userlike-cdn-widgets.s3-eu-west-1.amazonaws.com/b5b1a5ca7f40ee36a309010f6d835b3fc86bb3afd70019fa339771798a22b3a6.js",320910:"//userlike-cdn-widgets.s3-eu-west-1.amazonaws.com/ddc70fb362e4862582ae0abf83cd1e0e00198bcc94c6996ff2983a0197870f14.js","600.0":"//userlike-cdn-widgets.s3-eu-west-1.amazonaws.com/64290cc013cd6b7d48923c8884bceab6c2e9db7417436e1ab492c046c7fdb6f8.js",Netherlands:"//userlike-cdn-widgets.s3-eu-west-1.amazonaws.com/64290cc013cd6b7d48923c8884bceab6c2e9db7417436e1ab492c046c7fdb6f8.js"},de:{23200:"//userlike-cdn-widgets.s3-eu-west-1.amazonaws.com/55a6dc9423edd250d1099983d9d5a7477da7ad05974f16085fc69f4302536bee.js",25900:"//userlike-cdn-widgets.s3-eu-west-1.amazonaws.com/f51a62e645d1e4c34e2b43a5dda84bc984d7c9dc26c30334d83379e7b8468109.js",20700:"//userlike-cdn-widgets.s3-eu-west-1.amazonaws.com/6d577119f96b249eedc398e420ec5c0f76f9079c51b77d1c4329ffcea949cfdc.js",25901:"//userlike-cdn-widgets.s3-eu-west-1.amazonaws.com/1a4be39e0090abceaa8f5b1a395920f94aede9b7b6c1cf417f55496e69594dd1.js",26600:"//userlike-cdn-widgets.s3-eu-west-1.amazonaws.com/2678a6557b3b6a5c256e3d671c9f6bfe122482f3b5769f8c31766bcbdfa6285a.js",21300:"//userlike-cdn-widgets.s3-eu-west-1.amazonaws.com/84584f0a88ee60d8b5a2b6e344aa22dd71d3881e50e816d65e38f4ae74b4cf18.js"},es:{320900:"//userlike-cdn-widgets.s3-eu-west-1.amazonaws.com/80552aa744fc07f166500ca79a2d576585e667a1323f54ed004cec7eb97969ad.js",320910:"//userlike-cdn-widgets.s3-eu-west-1.amazonaws.com/cdff1844cc30871416ef69a2c78d0eeb6eed4bd4b6ec8d6809b9fce098d67c84.js"},nl:{"600.0":"//userlike-cdn-widgets.s3-eu-west-1.amazonaws.com/9011519211b2e7292dd2b37f3fae219dceac9286c99a5c9c8874a27a717748e2.js",Netherlands:"//userlike-cdn-widgets.s3-eu-west-1.amazonaws.com/9011519211b2e7292dd2b37f3fae219dceac9286c99a5c9c8874a27a717748e2.js"}};if(e){var a=TSO.Helpers.language(),s=t[a];return void 0===s?null:s[e]}return null},activeChatSessionExists:function(e){var t=TSOCache.getItem(e,TSOCache.keys.TSOChatSession());return!(!t||!t.chatStarted)&&(!!t.clientTimestamp&&(t.operatorTimestamp?t.operatorTimestamp>t.clientTimestamp||!(Date.now()-t.clientTimestamp>6e5):!(Date.now()-t.clientTimestamp>6e5)))},chatCallback:function(e,t,a,s){var n=TSOCache.getItem(s,TSOCache.keys.TSOChatSession());"chat_started"==e?(n.chatStarted=!0,TSOCache.setItem(s,TSOCache.keys.TSOChatSession(),n)):"message_client_terminating"==e?(n.operatorTimestamp=Date.now(),TSOCache.setItem(s,TSOCache.keys.TSOChatSession(),n)):"message_operator_terminating"==e?(n.clientTimestamp=Date.now(),TSOCache.setItem(s,TSOCache.keys.TSOChatSession(),n)):"chat_quit"==e&&(TSOChat.unloadChat(s,!0),n.lastRequestedCenter&&(TSOChat.attachScript(n.lastRequestedCenter),TSOChat.saveActiveChat(n.lastRequestedCenter,s)))},loadChat:function(e,t){if("tso"!=TSO.Helpers.getPlatform())return!1;userlikeTrackingEvent=function(e,a,s){TSOChat.chatCallback(e,a,s,t)};var a=TSOChat.getCenterUrl(e),s=TSOChat.activeChatSessionExists(t);if(s){var n=TSOCache.getItem(t,TSOCache.keys.TSOChatSession());a?(n.lastRequestedCenter=a,TSOCache.setItem(t,TSOCache.keys.TSOChatSession(),n)):(delete n.lastRequestedCenter,TSOCache.setItem(t,TSOCache.keys.TSOChatSession(),n)),a=n.chatUrl}else if(!e)return!1;return!!TSOChat.attachScript(a)&&(s||TSOChat.saveActiveChat(a,t),!0)},saveActiveChat:function(e,t){return void 0!==e&&null!=e&&(TSOCache.setItem(t,TSOCache.keys.TSOChatSession(),{chatUrl:e,lastRequestedCenter:e,chatStarted:!1,initTimestamp:Date.now()}),!0)},attachScript:function(e){if(void 0===e||null==e)return!1;var t=document.querySelector("script[src*='"+e+"']");if(!t){var a=document.getElementsByTagName("body");if(a&&a.length){var s=a[0];s&&(t=document.createElement("script"),t.setAttribute("src",e),t.setAttribute("type","text/javascript"),t.id="userlikeChatTool",t.setAttribute("charset","utf-8"),s.appendChild(t))}}var n=document.getElementById("userlike");return n&&n.removeAttribute("hidden"),!0},unloadChat:function(e,t){if(t)TSOCache.removeFromCache(e,TSOCache.keys.TSOChatSession());else if(TSOChat.activeChatSessionExists(e)){var a=TSOCache.getItem(e,TSOCache.keys.TSOChatSession());return delete a.lastRequestedCenter,void TSOCache.setItem(e,TSOCache.keys.TSOChatSession(),a)}var s=document.getElementById("userlikeChatTool");s&&s.remove();var n=document.getElementById("userlike");n&&n.setAttribute("hidden",!0)}};
app.directive("ngEnter",function(){return function(e,t,o){t.bind("keydown keypress",function(t){13===t.which&&(e.$apply(function(){e.$eval(o.ngEnter)}),t.preventDefault())})}}),app.directive("tsoResponsive",["$compile","$rootScope","CacheFactory",function(e,t,o){return{restrict:"A",link:function(e,t,s){TSOChat.loadChat(null,o),bowser.hasOwnProperty("tablet")&&bowser.tablet?document.body.className+=" tso-responsive-device tso-responsive-tablet tso-reponsive-tablet-mobile":bowser.hasOwnProperty("mobile")&&bowser.mobile?document.body.className+=" tso-responsive-device tso-responsive-mobile tso-reponsive-tablet-mobile":document.body.className+=" tso-responsive-desktop",TSO.Helpers.siteOnResize(),setTimeout(function(){TSO.Helpers.siteOnResize()},500),$(document).ready(function(){$(window).resize(function(){setTimeout(function(){TSO.Helpers.siteOnResize()},50)})})}}}]),app.directive("tsoMenu",function(){return function(e,t,o){$(t).find("h4 a").click(function(){var e=$(this);setTimeout(function(){$("body").hasClass("tso-responsive-desktop-size")||$("html, body").animate({scrollTop:e.offset().top+"px"},"fast")},50)})}});
app.directive("truckTiles",["$compile","$rootScope","truckTilesRepository","$location",function(e,t,s,r){return{restrict:"A",templateUrl:"/typo3conf/ext/truckstore_template/Resources/Public/Src/components/truck-tiles/truck-tiles.html",link:function(e,c,u){e.title=u.title,e.platform=TSO.Helpers.getPlatform(),e.tilesSize=0,e.filterMapping={TRACTOR:0,TRUCKWITHBODY:1,TIPPER:5,CADDY:2,TRAILER:4,TRANSPORTER:3},e.lastSearchesTile=null;var o=!1;if(TSO.Helpers.getUrlParameter("debug"))e.trucks=TSODebugJSON_Tiles;else{for(var i=u.tiles.split(","),l="",p=0;p<i.length;p++)"LAST5SEARCHES"!==i[p]?(l.length>0&&(l+=","),l+=i[p]):(o=!0,e.lastSearchesTile={img:"/typo3conf/ext/truckstore_template/Resources/Public/Images/sizeL_Last_searches.png",imgTablet:"/typo3conf/ext/truckstore_template/Resources/Public/Images/sizeL_Last_searches.png",imgMobile:"/typo3conf/ext/truckstore_template/Resources/Public/Images/sizeL_Last_searches.png",title:t.tsoI18n.lastsearches_title,count:"-1"});s.getTiles(l).$promise.then(function(t){if(e.trucks=t.List,null!=e.trucks&&e.trucks.length>0)for(var s=0;s<e.trucks.length;s++)if(null!=e.trucks[s].type){var r=e.trucks[s].type[0].replace(",","").replace("/","");e.trucks[s].title=e.trucks[s].title.replace("/","/<br/>"),"tso"==e.platform?(e.trucks[s].img="/typo3conf/ext/truckstore_template/Resources/Public/Images/truck-types/sizeL_"+r+".png",e.trucks[s].imgTablet="/typo3conf/ext/truckstore_template/Resources/Public/Images/truck-types/sizeL_"+r+".png",e.trucks[s].imgMobile="/typo3conf/ext/truckstore_template/Resources/Public/Images/truck-types/sizeL_"+r+".png"):(e.trucks[s].img="/typo3conf/ext/truckstore_template/Resources/Public/Images/truck-types/size1_"+r+".png",e.trucks[s].imgTablet="/typo3conf/ext/truckstore_template/Resources/Public/Images/truck-types/size2_"+r+".png",e.trucks[s].imgMobile="/typo3conf/ext/truckstore_template/Resources/Public/Images/truck-types/size3_"+r+".png")}e.tilesSize=e.trucks.length})}if(e.getSearchPageURL=function(e){return 0===e.count?"":-1==e.count?"search/last-searches":"search/#/vehicleType="+e.type.join(",").replaceAll(" ","%20")},TSO.Helpers.getUrlParameter("debug")){var a=r.url().split("debugtiles="),g=0;g=a.length>1?parseInt(a[1]):6,e.trucks=TSODebugJSON_Tiles.slice(0,g)}e.getTilesNumber=function(){return o?e.tilesSize+1:e.tilesSize}}}}]);var TSODebugJSON_Tiles=[{img:"/typo3conf/ext/truckstore_template/Resources/Public/Images/truck-types/size1_tractor.png",imgTablet:"/typo3conf/ext/truckstore_template/Resources/Public/Images/truck-types/size2_tractor.png",imgMobile:"/typo3conf/ext/truckstore_template/Resources/Public/Images/truck-types/size3_tractor.png",title:"Sattelzugmaschine",count:"1418"},{img:"/typo3conf/ext/truckstore_template/Resources/Public/Images/truck-types/size1_truckwithbody.png",imgTablet:"/typo3conf/ext/truckstore_template/Resources/Public/Images/truck-types/size2_truckwithbody.png",imgMobile:"/typo3conf/ext/truckstore_template/Resources/Public/Images/truck-types/size3_truckwithbody.png",title:"Lkw mit Aufbau",count:"1418"},{img:"/typo3conf/ext/truckstore_template/Resources/Public/Images/truck-types/size1_dump_truck.png",imgTablet:"/typo3conf/ext/truckstore_template/Resources/Public/Images/truck-types/size2_dump_truck.png",imgMobile:"/typo3conf/ext/truckstore_template/Resources/Public/Images/truck-types/size3_dump_truck.png",title:"Kipper",count:"544"},{img:"/typo3conf/ext/truckstore_template/Resources/Public/Images/truck-types/size1_demoutable.png",imgTablet:"/typo3conf/ext/truckstore_template/Resources/Public/Images/truck-types/size2_demoutable.png",imgMobile:"/typo3conf/ext/truckstore_template/Resources/Public/Images/truck-types/size3_demoutable.png",title:"Wechselrahmen / Fahrgestell",count:"245"},{img:"/typo3conf/ext/truckstore_template/Resources/Public/Images/truck-types/size1_trailer.png",imgTablet:"/typo3conf/ext/truckstore_template/Resources/Public/Images/truck-types/size2_trailer.png",imgMobile:"/typo3conf/ext/truckstore_template/Resources/Public/Images/truck-types/size3_trailer.png",title:"Anhanger / Sattelauflieger",count:"105"},{img:"/typo3conf/ext/truckstore_template/Resources/Public/Images/truck-types/size1_van.png",imgTablet:"/typo3conf/ext/truckstore_template/Resources/Public/Images/truck-types/size2_van.png",imgMobile:"/typo3conf/ext/truckstore_template/Resources/Public/Images/truck-types/size3_van.png",title:"Transporter",count:"306"}];
app.factory("truckTilesRepository",["$resource",function(e){return{getTiles:function(t){return e(TSO.ServicePath()+"widget/truck/countTypes/"+TSO.Helpers.culture()+"?tileType="+t).get()}}}]);
app.directive("truckNvis",["$compile","$rootScope","truckNvisRepository","$location",function(o,e,i,t){return{restrict:"A",link:function(o,e,t){i.getNewVehiclesInStock().$promise.then(function(e){o.count=e.count}),o.loadSearchPageIsNew=function(o){window.location="search/##isNew=isNew"}}}}]);
app.factory("truckNvisRepository",["$resource",function(e){return{getNewVehiclesInStock:function(){return e(TSO.ServicePath()+"widget/truck/new/"+TSO.Helpers.culture()).get()}}}]);
// Lazy loading of Google Map API
app.service("loadGoogleMapsAPI",["$window","$q",function(e,t){var o=t.defer();return e.initMaps=function(){o.resolve()},function(){var e=document.createElement("script");e.src="//maps.googleapis.com/maps/api/js?key="+TSO.MapsApiKey()+"&language="+TSO.Helpers.culture()+"&callback=initMaps",document.body.appendChild(e)}(),o.promise}]),app.directive("truckLocation",["$compile","$rootScope","truckLocationRepository","loadGoogleMapsAPI","$location","CacheFactory",function(e,t,o,a,r,s){return{restrict:"A",link:function(e,r,n){var i,l=[];e.truckStoreList={},TSOLocationResize.setupRefresh(t,e),e.renderMarkers=function(o){if(e.clearMarkers(),e.truckStoreCount>1||!e.hasLoc){$("#truck-location-title-count").html(e.truckStoreCount);for(var a=new google.maps.LatLngBounds,s={url:"/typo3conf/ext/truckstore_template/Resources/Public/Icons/svgs/location-pin.svg",size:new google.maps.Size(30,40),scaledSize:new google.maps.Size(30,40)},i=0;i<e.truckStoreCount;i++){var c=e.truckStoreList[i],d=new google.maps.LatLng(c.address.latitude,c.address.longtitude),u=new google.maps.Marker({map:o,draggable:!1,icon:s,optimized:!1,animation:google.maps.Animation.DROP,position:{lat:c.address.latitude,lng:c.address.longtitude}});a.extend(d),l.push(u)}o.fitBounds(a)}else{var c=e.truckStoreList[0],s={url:"/typo3conf/ext/truckstore_template/Resources/Public/Icons/svgs/location-pin.svg",size:new google.maps.Size(30,40),scaledSize:new google.maps.Size(30,40)};if($("#truck-location-title").html(n.centerfoundtext),null!=c){var g=TSO.Helpers.siteURL(c.centerId,c.name);null!=c.fax&&""==c.fax?$("#truck-location-subtitle").html('<a class="tso-block-small-link" href="'+g+'"><h3>'+t.tsoI18n.centerNamePrefix+" "+c.name+"</h3><p>"+c.address.streetName+" "+c.address.streetNumber+"</p><table class='tso-location-address-left-table'><tr><td>"+c.address.postalCode+" "+c.address.cityName+"</td></tr><tr><td>"+c.address.country+"</td></tr></table><table class='tso-location-address-right-table'><tr><td>T: "+c.phone1+"</td></tr></table></a>"):$("#truck-location-subtitle").html('<a class="tso-block-small-link" href="'+g+'"><h3>'+t.tsoI18n.centerNamePrefix+" "+c.name+"</h3><p>"+c.address.streetName+" "+c.address.streetNumber+"</p><table class='tso-location-address-left-table'><tr><td>"+c.address.postalCode+" "+c.address.cityName+"</td></tr><tr><td>"+c.address.country+"</td></tr></table><table class='tso-location-address-right-table'><tr><td>T: "+c.phone1+"</td></tr><tr><td>F: "+c.fax+"</td></tr></table></a>"),$(r).children("a").attr("href",g);var u=new google.maps.Marker({map:o,draggable:!1,icon:s,optimized:!1,animation:google.maps.Animation.DROP,position:{lat:c.address.latitude,lng:c.address.longtitude}});o.setCenter(u.position),l.push(u)}o.setZoom(10)}},e.clearMarkers=function(){for(var e=0;e<l.length;e++)l[e].setMap(null);l.length=0},e.geolocFail=function(){e.country||o.getNearest().$promise.then(function(t){e.truckStoreCount=t.List.length,e.truckStoreList=t.List,e.renderMarkers(i)})},e.initializeWidget=function(){if(i=new google.maps.Map($(".tso-home-gmap")[0],{center:{lat:47.6815813,lng:11.5663035},draggable:!1,scrollwheel:!1,disableDefaultUI:!0}),navigator.geolocation){var t=setTimeout(e.geolocFail,6e3);e.hasLoc=!1,navigator.geolocation.getCurrentPosition(function(a){clearTimeout(t),e.lat=a.coords.latitude,e.long=a.coords.longitude;var r=new google.maps.Geocoder,n={lat:e.lat,lng:e.long};r.geocode({location:n},function(t,a){if(a===google.maps.GeocoderStatus.OK){var r=t[1];if(r)for(var n=0;n<=r.address_components.length;n++)if(r.address_components[n]&&r.address_components[n].types)for(var l=0;l<=r.address_components[n].types.length;l++)"country"==r.address_components[n].types[l]&&(e.country=r.address_components[n].short_name,TSOCache.setItem(s,TSOCache.keys.SearchCountryIso(),e.country))}o.getNearest(e.lat,e.long,e.country).$promise.then(function(t){e.hasLoc=!0,e.truckStoreCount=t.List.length,e.truckStoreList=t.List,e.renderMarkers(i)})})},function(a){clearTimeout(t),e.country||o.getNearest().$promise.then(function(t){e.truckStoreCount=t.List.length,e.truckStoreList=t.List,e.renderMarkers(i)})},{enableHighAccuracy:!1,timeout:5e3,maximumAge:0})}else o.getNearest().$promise.then(function(t){e.hasLoc=!1,e.truckStoreCount=t.length,e.truckStoreList=t.List,e.renderMarkers(i)})},a.then(function(){e.initializeWidget()},function(){console.warn("Unable to load google maps...")})}}}]);
var TSOLocationResize={setupRefresh:function(i,e){$(window).resize(function(){setTimeout(function(){e.initializeWidget()},100)})}};
app.factory("truckLocationRepository",["$resource",function(e){return{getNearest:function(t,r,u){return u||(u=TSO.Helpers.country()),t||r?e(TSO.ServicePath()+"widget/location/culture/"+TSO.Helpers.culture()+"?country="+u+"&latitude="+t+"&longitude="+r).get():e(TSO.ServicePath()+"widget/location/culture/"+TSO.Helpers.culture()+"?country="+u).get()}}}]);
app.directive("truckLetter",["$compile","$rootScope","$sce","truckLetterRepository","$location",function(e,t,r,n,s){return{restrict:"A",templateUrl:"/typo3conf/ext/truckstore_template/Resources/Public/Src/components/truck-letter/truck-letter.html",link:function(e,s,o){var i="";e.$rootScope=t,e.truckletterResponse={},e.isOpened=!1,e.selectedCenters=[],e.centerSelectionOpen=!1,e.centerFilters=[],e.centerDirty=!1,e.isLoading=!0,e.successfulSubscription=!1,e.emailSent="",e.successMessage="",e.validationNewsletter="",e.scrollPosition=document.documentElement.scrollTop,e.platform=TSO.Helpers.getPlatform(),e.loadTruckletter=function(){e.isLoading=!0,(t.lastSearchTruckLetterSubscription?n.getLastSearchForm:n.getForm)().$promise.then(function(r){e.validationNewsletter="",e.truckletterResponse=r,e.fixFormObject(),e.isLoading=!1,setTimeout(function(){$("#truckletter-email").focus(),i=t.tsoI18n.truckletterSuccess,e.resetBodyHeight()},100)})},e.renderHtml=function(e){return r.trustAsHtml(e)},e.submitForm=function(){e.isLoading=!0;var r=e.fixRequest(e.truckletterResponse);if(null==r)return e.isLoading=!1,void setTimeout(function(){$("#truckletter-email").focus(),e.resetBodyHeight()},200);(t.lastSearchTruckLetterSubscription?n.submitLastSearchForm:n.submitForm)(angular.toJson(r)).$promise.then(function(t){t.hasErrors?(e.centerFilters=[],e.truckletterResponse.List=t.List,e.fixFormObject(),e.isLoading=!1,setTimeout(function(){$("#truckletter-email").focus(),e.resetBodyHeight()},200)):(e.successfulSubscription=!0,e.successMessage=i.replace("~truckletterEmail~",e.emailSent),e.validationNewsletter="")})},e.fixRequest=function(r){var n=jQuery.extend(!0,{},r);t.lastSearchTruckLetterSubscription&&(n=jQuery.extend(!0,n,{queryURL:t.lastSearchQueryURL,queryDescription:t.lastSearchTruckLetterDescription}));var s=!0;e.validationNewsletter="";for(var o in n.List)n.List[o].hasOwnProperty("formElements")&&(n.List[o].formElements[0].hasOwnProperty("options")?delete n.List[o].formElements[0].selectedOption:n.List[o].hasOwnProperty("options")&&delete n.List[o].selectedOption);for(var o in r.List)if("EMAIL"==r.List[o].name){r.List[o].message="";var i=TSO.Helpers.validation.validateFormElement(r.List[o],t.tsoI18n);i&&(r.List[o].message=i.message||" ",e.hasErrors=!0,s=!1),e.emailSent=r.List[o].text}else if("USER_CONSENT"==r.List[o].name){var i=TSO.Helpers.validation.validateFormElement(r.List[o],t.tsoI18n);r.List[o].message="",i&&(r.List[o].message=i.message||" ",e.hasErrors=!0,s=!1)}var c=t.lastSearchTruckLetterSubscription?1:0;for(var o in r.List)"checkbox"==r.List[o].type&&"CONTINENT"!=r.List[o].name&&"USER_CONSENT"!=r.List[o].name&&r.List[o].selected&&c++;return 0==c&&(e.validationNewsletter=t.tsoI18n.truckletterNewsletterSelected,s=!1),s?n:null},e.fixFormObject=function(){e.centerFilters=[];for(var r in e.truckletterResponse.List){var n=e.truckletterResponse.List[r];if("CONTINENT"==n.name)e.centerFilters.push(n);else if(n.hasOwnProperty("formElements")){if(n.formElements[0].hasOwnProperty("options"))for(var s=0;s<n.formElements[0].options.length;s++)n.formElements[0].options[s].selected&&(n.formElements[0].selectedOption=n.formElements[0].options[s])}else if(t.lastSearchTruckLetterSubscription&&"dropdown"==n.type)for(var s=0;s<n.options.length;++s)n.options[s].selected&&(n.selectedOption=n.options[s])}e.hasErrors=e.truckletterResponse.hasErrors,e.refreshSelected()},e.changeOptions=function(e,t){for(var r in t)t[r].selected=!1;e.selected=!0},e.toggleCenterSelection=function(){e.centerSelectionOpen=!e.centerSelectionOpen,e.centerSelectionOpen&&e.loadCountries()},e.toggleFormElement=function(e){e.selected=!e.selected},e.toggleInformationNoticeModal=function(){e.isInformationNoticeModalOpened=!e.isInformationNoticeModalOpened,e.sfScrollPosition=(window.pageYOffset||document.documentElement.scrollTop)+20},e.loadCountries=function(){e.refreshSelected()},t.lastSearchTruckLetterSubscription=!1,t.toggleTruckletterInit=function(){e.scrollPosition=$(window).scrollTop(),TSO.Helpers.isMobile()||(e.scrollPosition+=50),e.initMobileHeightWatch(),t.toggleTruckLetterPopup()},e.initMobileHeightWatch=function(){e.$watch("isOpened",function(t,r){0==t&&e.resetBodyHeight()})},e.resetBodyHeight=function(){},t.toggleTruckLetterPopup=function(){e.isOpened=!e.isOpened,e.isOpened&&(e.successfulSubscription=!1,e.loadTruckletter(),e.centerSelectionOpen=!1,e.hasErrors=!1)},e.stopToggle=function(e){e.stopPropagation&&e.stopPropagation(),e.preventDefault&&e.preventDefault(),e.cancelBubble=!0,e.returnValue=!1},e.saveCenters=function(){e.centerDirty=!1,e.centerSelectionOpen=!1,e.refreshSelected()},e.selectContinent=function(t,r){r.stopPropagation(),t.selected=!t.selected;for(var n in t.formElements){t.formElements[n].selected=t.selected;for(var s in t.formElements[n].formElements)t.formElements[n].formElements[s].selected=t.selected}e.centerDirty=!0,e.refreshSelected()},e.selectCountry=function(t,r,n){n.stopPropagation(),r.selected&&(t.selected=!1),r.selected=!r.selected;for(var s in r.formElements)r.formElements[s].selected=r.selected;e.centerDirty=!0,e.refreshSelected()},e.selectCity=function(t,r,n,s){s.stopPropagation(),n.selected&&(t.selected=!1,r.selected=!1),n.selected=!n.selected,e.centerDirty=!0,e.refreshSelected()},e.getSearchDescription=function(e){var t="",r=0;return e.forEach(function(e){if("currency"!=e.name&&"customCurrency"!=e.name&&(r++>0&&(t+=", "),t+="<i>"+e.title+"</i>",null!=e.values&&e.values.length>0&&"isNew"!=e.name&&"pricereduced"!=e.name&&"financing"!=e.name&&"leasing"!=e.name)){t+=": ";var n=0;e.values.forEach(function(e){n++>0&&(t+=" | "),t+=e},this)}},this),t},e.refreshSelected=function(){e.selectedCenters=[];for(var t=e.centerFilters,r=[],n=0;n<t.length;n++){if(!t[n].selected){var s=0;if(null!=t[n].formElements)for(var o=0;o<t[n].formElements.length;o++){for(var i=0,c=t[n].formElements[o],l=[],a=0;a<c.formElements.length;a++)c.formElements[a].selected&&(i++,l.push(c.formElements[a].title));i==c.formElements.length||c.selected?(c.selected=!0,r.push(c.title),s++):r=r.concat(l)}e.selectedCenters=e.selectedCenters.concat(r)}(s==t[n].formElements.length||t[n].selected)&&(e.selectedCenters.push(t[n].title),t[n].selected=!0)}}}}}]),app.directive("truckLetterLastSearchButton",["$compile","$rootScope",function(e,t){return{restrict:"A",link:function(e,r,n){e.toggleTruckLetterLastSearch=function(r){var n=[];r.urlParams.forEach(function(e){null==e||e.startsWith("sortBy")||n.push(e)});var s=[];r.filters.forEach(function(e){"customSortBy"!==e.name&&s.push(e)}),t.lastSearchTruckLetterSubscription=!0,t.lastSearchTruckLetterDescription=e.getSearchDescription(s),t.lastSearchQueryURL=n.join("&"),t.toggleTruckletterInit()}}}}]),app.directive("truckLetterButton",["$compile","$rootScope",function(e,t){return{restrict:"A",link:function(e,r,n){e.toggleTruckLetter=function(){t.lastSearchTruckLetterSubscription=!1,console.log("truckletter trigger"),t.toggleTruckletterInit()}}}}]),app.directive("truckLetterConfirm",["$compile","truckLetterRepository","$rootScope",function(e,t,r){return{restrict:"A",link:function(e,r,n){var s=TSO.Helpers.getUrlParameter("uid");console.log(s),t.confirm(s)}}}]),app.directive("truckLetterUnsubscribe",["$compile","truckLetterRepository","$rootScope",function(e,t,r){return{restrict:"A",link:function(e,r,n){var s=TSO.Helpers.getUrlParameter("uid"),o=TSO.Helpers.getUrlParameter("typeLetter");t.unsubscribe(s,o)}}}]);
app.factory("truckLetterRepository",["$resource",function(e){return{getForm:function(){return e(TSO.ServicePath()+"widget/truck/letter/register/"+TSO.Helpers.culture()).get()},submitForm:function(t){return e(TSO.ServicePath()+"widget/truck/letter/register/"+TSO.Helpers.culture()).save(t)},getLastSearchForm:function(){return e(TSO.ServicePath()+"widget/truck/letter/register/last-search/"+TSO.Helpers.culture()).get()},submitLastSearchForm:function(t){return e(TSO.ServicePath()+"widget/truck/letter/register/last-search/"+TSO.Helpers.culture()).save(t)},confirm:function(t){return e(TSO.ServicePath()+"widget/truck/letter/confirm/"+TSO.Helpers.culture()).get({uid:t})},unsubscribe:function(t,r){return e(TSO.ServicePath()+"widget/truck/letter/unsubscribe/"+TSO.Helpers.culture()).get({uid:t,type:r})}}}]);
app.directive("truckCard",["$compile","$rootScope","$sce","$location",function(t,o,e,l){return{restrict:"C",templateUrl:"/typo3conf/ext/truckstore_template/Resources/Public/Src/components/truck-card/truck-card.html",scope:{truckCard:"&"},link:function(t,e,l){t.$rootScope=o,null==o.truckCards&&(o.truckCards=[]);l.mobileList&&(1==l.mobileList.length?l.mobileList[0].toString():l.mobileList.length>=2&&(l.mobileList[0].toString(),l.mobileList[1].toString())),t.truckCard={location:null==l.location?"":l.location.toString(),locationFlag:null==l.locationFlag?"":l.locationFlag.toString(),employeeName:null==l.employeeName?"":l.employeeName.toString(),subName:null==l.subName?"":l.subName.toString(),telephone:null==l.telephone?"":l.telephone.toString(),mobile1:null==l.mobile1?"":l.mobile1.toString(),mobile2:null==l.mobile2?"":l.mobile2.toString(),fax:null==l.fax?"":l.fax.toString(),employeeImg:null==l.employeeImg?"":l.employeeImg.toString(),position:null==l.position?"":l.position.toString()}}}}]);
app.directive("truckCookies",["$compile","$rootScope","$sce","$cookies","$location",function(e,n,o,t,c){return{restrict:"A",templateUrl:"/typo3conf/ext/truckstore_template/Resources/Public/Src/components/truck-cookies/truck-cookies.html",link:function(e,c,a){e.cookiesOpened=!1;var l="";null==t.get("tso_cookie_acceptance_"+TSO.Helpers.language().toLowerCase())&&(e.cookiesOpened=!0),e.hiveDownOpened=!1;var r="";null==t.get("tso_hive_down_"+TSO.Helpers.language().toLowerCase())&&(e.hiveDownOpened=!0),n.$watch("tsoI18n",function(t,c){null!=n.tsoI18n&&null!=n.tsoI18n.cookieNoticeContent&&(l=n.tsoI18n.cookieNoticeContent,"EN"==TSO.Helpers.country()?(l=l.replace("/~country~/","/"),"en"==TSO.Helpers.language()&&(l=l.replace("/~language~/","/"))):l=l.replace("~country~",TSO.Helpers.country()),l=l.replace("~language~",TSO.Helpers.language()),e.cookieContent=o.trustAsHtml("<p>"+l+"</p>")),null!=n.tsoI18n&&null!=n.tsoI18n.announcementContent&&(r=n.tsoI18n.announcementContent,"EN"==TSO.Helpers.country()?(r=r.replace("/~country~/","/"),"en"==TSO.Helpers.language()&&(r=r.replace("/~language~/","/"))):r=r.replace("~country~",TSO.Helpers.country()),r=r.replace("~language~",TSO.Helpers.language()),e.announcementContent=o.trustAsHtml("<p>"+r+"</p>"))}),e.toggleCookiePopup=function(){var n=new Date;n.setDate(n.getDate()+365),t.put("tso_cookie_acceptance_"+TSO.Helpers.language().toLowerCase(),1,{expires:n,path:"/"}),e.cookiesOpened=!1,t.put("tso_hive_down_"+TSO.Helpers.language().toLowerCase(),1,{expires:n,path:"/"}),e.hiveDownOpened=!1}}}}]);
app.factory("autoCompleteDataService",["$rootScope","$resource","$window",function(e,t,a){return{getUvidsURL:function(){return TSO.ServicePath()+"widget/truck/search/suggest/"+TSO.Helpers.language()+"?type=uvid&term="},getManufacturersURL:function(){return TSO.ServicePath()+"widget/truck/search/suggest/"+TSO.Helpers.language()+"?type=manufacturer&term="},getModelsURL:function(){return TSO.ServicePath()+"widget/truck/search/suggest/"+TSO.Helpers.language()+"?type=model&term="},getTypesURL:function(){return TSO.ServicePath()+"widget/truck/search/suggest/"+TSO.Helpers.language()+"?type=type&term="},getVehicleTypesURL:function(){return TSO.ServicePath()+"widget/truck/search/suggest/"+TSO.Helpers.language()+"?type=vehicleType&term="},getBodyGroupURL:function(){return TSO.ServicePath()+"widget/truck/search/suggest/"+TSO.Helpers.language()+"?type=bodyGroup&term="},getBodyURL:function(){return TSO.ServicePath()+"widget/truck/search/suggest/"+TSO.Helpers.language()+"?type=body&term="},getEmissionStandardURL:function(){return TSO.ServicePath()+"widget/truck/search/suggest/"+TSO.Helpers.language()+"?type=emissionStandard&term="},getCabinTypeURL:function(){return TSO.ServicePath()+"widget/truck/search/suggest/"+TSO.Helpers.language()+"?type=cabinType&term="},getVehicleDetails:function(e){a.location.href=TSO.Helpers.culturePath()+"detail/"+e+".html"},getManufacturerSearch:function(e){a.location=TSO.Helpers.culturePath()+"search/#/manufacturer="+e,-1!=a.location.pathname.search("search.html")||-1!=a.location.pathname.search("search")&&a.location.reload()},getModelSearch:function(e){a.location=TSO.Helpers.culturePath()+"search/#/modelName="+e,-1!=a.location.pathname.search("search.html")||-1!=a.location.pathname.search("search")&&a.location.reload()},getTypeSearch:function(e){a.location=TSO.Helpers.culturePath()+"search/#/type="+e,-1!=a.location.pathname.search("search.html")||-1!=a.location.pathname.search("search")&&a.location.reload()},getVehicleTypeSearch:function(e){a.location=TSO.Helpers.culturePath()+"search/#/vehicleType="+e,-1!=a.location.pathname.search("search.html")||-1!=a.location.pathname.search("search")&&a.location.reload()},getBodyGroupSearch:function(e){a.location=TSO.Helpers.culturePath()+"search/#/bodyGroup="+e,-1!=a.location.pathname.search("search.html")||-1!=a.location.pathname.search("search")&&a.location.reload()},getBodySearch:function(e){a.location=TSO.Helpers.culturePath()+"search/#/body="+e,-1!=a.location.pathname.search("search.html")||-1!=a.location.pathname.search("search")&&a.location.reload()},getEmissionStandardSearch:function(e){a.location=TSO.Helpers.culturePath()+"search/#/emmissionsStandard="+e,-1!=a.location.pathname.search("search.html")||-1!=a.location.pathname.search("search")&&a.location.reload()},getCabinTypeSearch:function(e){a.location=TSO.Helpers.culturePath()+"search/#/cab="+e,-1!=a.location.pathname.search("search.html")||-1!=a.location.pathname.search("search")&&a.location.reload()}}}]),app.directive("autoCompleteField",["$rootScope","autoCompleteDataService",function(e,t){return{restrict:"A",templateUrl:"/typo3conf/ext/truckstore_template/Resources/Public/Src/components/truck-search-header/truck-search-header.html"}}]),app.directive("autoComplete",["$rootScope","autoCompleteDataService",function(e,t){return{restrict:"A",requre:"^^tsoI18n",link:function(a,r,c){r.typeahead({minLength:1,maxItem:8,order:"asc",hint:!0,dynamic:!0,mustSelectItem:!0,group:{key:"name"},display:["text"],maxItemPerGroup:5,highlight:!0,source:{vehicles:{ajax:function(e){return{url:t.getUvidsURL()+e}}},manufacturers:{ajax:function(e){return{url:t.getManufacturersURL()+e}}},models:{ajax:function(e){return{url:t.getModelsURL()+e}}},types:{ajax:function(e){return{url:t.getTypesURL()+e}}},vehicleTypes:{ajax:function(e){return{url:t.getVehicleTypesURL()+e}}},bodyGroup:{ajax:function(e){return{url:t.getBodyGroupURL()+e}}},body:{ajax:function(e){return{url:t.getBodyURL()+e}}},emissionStandard:{ajax:function(e){return{url:t.getEmissionStandardURL()+e}}},cabinType:{ajax:function(e){return{url:t.getCabinTypeURL()+e}}}},callback:{onClick:function(e,r,c,n){a.itemType=c.type,a.itemValue=c.defaultText,"uvid"==c.type?t.getVehicleDetails(a.itemValue):"manufacturer"==c.type?t.getManufacturerSearch(a.itemValue):"model"==c.type?t.getModelSearch(a.itemValue):"type"==c.type?t.getTypeSearch(a.itemValue):"vehicleType"==c.type?t.getVehicleTypeSearch(a.itemValue):"bodyGroup"==c.type?t.getBodyGroupSearch(a.itemValue):"body"==c.type?t.getBodySearch(a.itemValue):"emissionStandard"==c.type?t.getEmissionStandardSearch(a.itemValue):"cabinType"==c.type&&t.getCabinTypeSearch(a.itemValue)}}}),a.submitSearch=function(){a.itemValue&&""!=a.itemValue.trim()&&("uvid"==a.itemType?t.getVehicleDetails(a.itemValue):"manufacturer"==a.itemType?t.getManufacturerSearch(a.itemValue):"model"==a.itemType?t.getModelSearch(a.itemValue):"type"==a.itemType?t.getTypeSearch(a.itemValue):"vehicleType"==a.itemType?t.getVehicleTypeSearch(a.itemValue):"bodyGroup"==a.itemType?t.getBodyGroupSearch(a.itemValue):"body"==a.itemType?t.getBodySearch(a.itemValue):"emissionStandard"==a.itemType?t.getEmissionStandardSearch(a.itemValue):"cabinType"==a.itemType&&t.getCabinTypeSearch(a.itemValue))},a.placeholder=e.tsoI18n.searchHeaderPlaceholder}}}]);
app.directive("tsoFavoritesHeader",["$compile","$rootScope","truckFavoritesRepository","CacheFactory","uuid",function(e,t,o,r,a){return{restrict:"E",templateUrl:"/typo3conf/ext/truckstore_template/Resources/Public/Src/components/truck-favorites-header/truck-favorites-header.html",link:function(e,n,i){e.favoritesCount=0,e.favoritesLink=TSO.Helpers.culturePath()+"favourites.html";var s=TSOCache.getItemFromInfiniteCache(r,TSOCache.keys.UserUUID());s||(TSOCache.setItemInInfiniteCache(r,TSOCache.keys.UserUUID(),a.v4()),s=TSOCache.getItemFromInfiniteCache(r,TSOCache.keys.UserUUID())),e.favoritesText=t.tsoI18n.bookmarkList,e.$on("favoritesCountLoaded",function(t,o){e.favoritesCount=o}),e.$on("addToFavourites",function(t){t.defaultPrevented||(e.favoritesCount++,t.preventDefault())}),e.$on("removeFromFavourites",function(t){t.defaultPrevented||(e.favoritesCount--,t.preventDefault())}),e.$on("removeAllFromFavourites",function(t){t.defaultPrevented||(e.favoritesCount=0,t.preventDefault())}),e.favoritesCount=o.getFavoritesCount(s)}}}]);
app.factory("truckFavoritesRepository",["$resource","$rootScope",function(e,t){var r=null;return{getFavoritesCount:function(u){if(null!=r)return r;r=0,e(TSO.ServicePath()+"widget/favourites/count?uuid="+u,null,{post:{method:"POST"}}).post().$promise.then(function(e){e.value&&(r=e.value,t.$broadcast("favoritesCountLoaded",e.value))})},getFavoriteVehicles:function(t){return e(TSO.ServicePath()+"widget/favourites/list/"+TSO.Helpers.culture()+"?uuid="+t).get()},putVehicleToFavorites:function(t,r){return e(TSO.ServicePath()+"widget/favourites/add?uuid="+t+"&uvid="+r,null,{update:{method:"PUT"}}).update()},removeVehicleFromFavorites:function(t,r){return e(TSO.ServicePath()+"widget/favourites/remove?uuid="+t+"&uvid="+r).remove()},removeAllVehiclesFromFavorites:function(t){return e(TSO.ServicePath()+"widget/favourites/remove/all?uuid="+t).remove()}}}]);
// Lazy loading of Google Map API
app.service("loadGoogleMapsAPI",["$window","$q",function(e,t){var o=t.defer();return e.initMaps=function(){o.resolve()},function(){var e=document.createElement("script");e.src="//maps.googleapis.com/maps/api/js?key="+TSO.MapsApiKey()+"&language="+TSO.Helpers.culture()+"&callback=initMaps",document.body.appendChild(e)}(),o.promise}]),app.directive("truckLocations",["$compile","$rootScope","truckLocationsRepository","loadGoogleMapsAPI","$location","$window",function(e,t,o,n,s,r){return{restrict:"A",templateUrl:"/typo3conf/ext/truckstore_template/Resources/Public/App/components/truck-locations/truck-locations.html",link:function(e,t,s){e.isMobile=TSO.Helpers.isMobile();var i;e.markers=[],e.renderMarkers=function(t){for(var o=new google.maps.LatLngBounds,n={url:"/typo3conf/ext/truckstore_template/Resources/Public/Icons/svgs/location-pin.svg",size:new google.maps.Size(30,40),scaledSize:new google.maps.Size(30,40)},s=0;s<e.truckStores.countries.length;s++)for(var i=e.truckStores.countries[s].centers.length,a=0;a<i;a++){var l=e.truckStores.countries[s].centers[a],c=new google.maps.LatLng(l.address.latitude,l.address.longtitude),u=new google.maps.Marker({map:t,draggable:!1,icon:n,optimized:!1,animation:google.maps.Animation.DROP,position:{lat:l.address.latitude,lng:l.address.longtitude}});google.maps.event.addListener(u,"click",function(e,t){return function(){r.open("https://maps.google.com/maps/search/Truckstore "+t.address.cityName+"/@"+e.getPosition().lat()+","+e.getPosition().lng()+",15z/am=t","_blank")}}(u,l)),o.extend(c)}null!=t&&(t.fitBounds(o),t.addListener("click",function(){r.open("https://maps.google.com/maps?z="+t.getZoom()+"&ll="+t.getCenter().toUrlValue(),"_blank")}))},e.initializeWidget=function(){i=null,o.getAllLocations().$promise.then(function(t){e.truckStores=t.List,e.renderMarkers(i),e.divMasonryClass=e.getMasonryClass(e.truckStores.countries)})},e.renderCenterLink=function(e){return TSO.Helpers.culturePath()+"sites/site/"+e.centerId+"/"+e.name+".html"},n.then(function(){e.initializeWidget()},function(){console.warn("unable to load google maps...")}),e.getMasonryClass=function(t){return e.isMobile?t.length<=2?"masonry-2":3===t.length?"masonry-3":"masonry":"masonry"}}}}]);
app.factory("truckLocationsRepository",["$resource",function(t){return{getAllLocations:function(){return t(TSO.ServicePath()+"widget/location/locations/"+TSO.Helpers.culture()).get()},getSingleLocation:function(e){return t(TSO.ServicePath()+"widget/location/locations/center/"+TSO.Helpers.culture()+"?centerId="+e).get()}}}]);