var __extends=this&&this.__extends||function(){var n=function(t,i){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,t){n.__proto__=t}||function(n,t){for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(n[i]=t[i])},n(t,i)};return function(t,i){function r(){this.constructor=t}if(typeof i!="function"&&i!==null)throw new TypeError("Class extends value "+String(i)+" is not a constructor or null");n(t,i);t.prototype=i===null?Object.create(i):(r.prototype=i.prototype,new r)}}(),Maps;(function(n){var t=function(t){function i(n,i,r,u,f,e,o,s,h){h===void 0&&(h=!1);var c=t.call(this,n,i,r,u)||this;return c._mapId="map",c._mostPriorObjectMask="!*",c._isFirstInit=!0,c.showMhdZjr=0,c._walkColor="#777",c.isMafraSK=!1,c.oldBounds=undefined,c.newBounds=undefined,c._positionData=f,c.isFormMap=e,c.isDetail=o,c.isMafraSK=s,c.isDep=h,s?n=="VlakSk"?c.showMhdZjr=2:n!="BusSk"&&n!="VlakBusSk"&&(c.showMhdZjr=1):n=="Vlak"?c.showMhdZjr=2:n!="BusC"&&n!="VlakBusCZ"&&(c.showMhdZjr=1),c}return __extends(i,t),i.prototype.init=function(n,t){var i=this,u=new Base.ModalParams("idos-modal__content--90perc map-modal","",!1,!1,0,!1,!0,!1),r;u.backgroundTransparent=!0;$(".map-controls-panel").hide();$("#".concat(this._mapId)).html(null);this._mapModal=new Base.Modal(null,new Messages.MessagesService(null),null,u,null);$("#delete-route").hide();this._mapModal.show("#maps-modal");r=null;this.isFormMap?($(".popup-close.popup-close-map").addClass("popup-close-map-search"),$(".map-modal").css("margin-top","68px"),this.initMapForm(),r=$(window).height()-68):r=$(window).height();this._mapModal.exitOnClikOtside();$("#".concat(this._mapId)).height(r);$("#".concat(this._mapModal.Id)).on("closeEvent",function(){i.removeLeafletMap()});if(this,this.InitMap(n,t),this.isFormMap){this.map.on("zoomend",function(){i.map.getZoom()>=i.mapSettings.minZoom&&(i.UpdateRemainingMarkersCaptions(),i.map.closePopup())});this.map.on("click",function(n){i.showOnMapByMyPosition(n.latlng.lat,n.latlng.lng)});this.map.on("moveend",function(){i.ShowStations()});this.map.on("click",function(n){i.showOnMapByMyPosition(n.latlng.lat,n.latlng.lng)})}},i.prototype.setData=function(n){this._positionData=n},i.prototype.showConnectionOnMap=function(n,t){t===void 0&&(t=!0);try{if(n==null||this.IsErrorJSON(n))return;typeof n.aoTrains!="undefined"&&n.aoTrains!=null&&n.aoTrains.length>0&&(this._mapData=n,this.drawMapRoute(t))}catch(i){}},i.prototype.showStationsMap=function(){var t=this;this._fromMarker=null;this._toMarker=null;this._myPositionMarker=null;var n=$("#"+this.mapSettings.parentInputSelector).val(),i=$("#"+this.mapSettings.parentInputSelector).attr("placeholder"),r=$("#"+this.mapSettings.parentInputHiddenSelector).val();$("#positionAC").val(n);$("#positionAC").attr("placeholder",i);$("#positionACHidden").val(r);this.stationChanged(!0);$("#positionACHidden").change(function(){t.RemoveAllStations();t.stationChanged()});$(".map-controls-panel .inp-combined").toggleClass("filled",typeof n=="string"&&!Base.Support.stringIsEmpty(n.toString())||!Base.Support.stringIsEmpty(i))},i.prototype.getHiddenItem=function(n,t,i){return Base.HiddenItem.parse(typeof t=="string"?t.toString():"",typeof n=="string"&&!Base.Support.stringIsEmpty(n.toString())?n.toString():i)},i.prototype.setPositionData=function(n,t){var i=Base.PositionItem.parse(typeof n=="string"?n.toString():"");i&&i.coorX>0&&i.coorY>0&&(t||(t=new Base.HiddenItem),(isNaN(t.coorX)||t.coorX===0&&isNaN(t.coorY)||t.coorY===0)&&(t.coorX=i.coorX,t.coorY=i.coorY))},i.prototype.getPositionSuccess=function(){$("#positionAC").val("");$("#positionAC").autocomplete({minLength:0});$("#positionAC").autocomplete("search")},i.prototype.drawMapRoute=function(t){var i,f,e,u,o,r,s;try{if(typeof this._mapData!="undefined"&&this._mapData!=null){for(i=n.TrainMapData.getFirstStation(this._mapData.aoTrains[0]),this.mapSettings.coorToY+this.mapSettings.coorToX>0&&(i.lat!=this.mapSettings.coorFromX||i.lng!=this.mapSettings.coorFromY)&&(this.addWalkLine(i.lat,i.lng,this.mapSettings.coorToX,this.mapSettings.coorToY),this.addWalkPseudoStation(this.mapSettings.coorToX,this.mapSettings.coorToY,this.mapSettings.sFromName,t)),f=null,e=null,u=0;u<this._mapData.aoTrains.length;u++)o=this.drawTrainRoute(u,f,e,t),f=o.lastStation,e=o.line;r=n.TrainMapData.getLastStation(this._mapData.aoTrains[this._mapData.aoTrains.length-1]);this.mapSettings.coorToY+this.mapSettings.coorToX>0&&(r.lat!=this.mapSettings.coorToX||r.lng!=this.mapSettings.coorToY)&&(this.addWalkLine(r.lat,r.lng,this.mapSettings.coorToX,this.mapSettings.coorToY),this.addWalkPseudoStation(this.mapSettings.coorToX,this.mapSettings.coorToY,this.mapSettings.sToName,t));s=L.featureGroup(this.getPolyLines());this.map.fitBounds(s.getBounds(),{maxZoom:16,padding:[60,60]})}else{this.getMapRoute(this._mapData.iID);return}}catch(h){}},i.prototype.drawTrainRoute=function(t,i,r,u){var e=this._mapData.aoTrains[t],s,h,f;if(n.TrainMapData.hasStations(e)){var c="#aaa",o=!1,l=[],a=[],v=[];for(this.hasWalkToNextTrain(this._mapData.aoTrains,t)&&(o=!0,s=n.TrainMapData.getLastStation(this._mapData.aoTrains[t]),h=n.TrainMapData.getFirstStation(this._mapData.aoTrains[t+1]),this.addWalkLine(s.lat,s.lng,h.lat,h.lng)),f=0;f<e.aoStations.length;f++)this.drawTrainStation(t,f,i,r,o,u),this.fillRouteCoors(e.aoStations[f],L.latLng([e.aoStations[f].lat,e.aoStations[f].lng]),l,a,v);return this.addRouteLine(c,a),this.addRouteLine(e.sColor,l),this.addRouteLine(c,v),o?{lastStation:null,line:null}:{lastStation:n.TrainMapData.getLastStation(this._mapData.aoTrains[t]),line:this._mapData.aoTrains[t]}}},i.prototype.addRouteLine=function(n,t){try{if(t&&t.length>0){var i=L.polyline(t,{color:"#000000",weight:6}).addTo(this.map),r=L.polyline(t,{color:n,weight:4}).addTo(this.map);this.getPolyLines().push(i);this.getPolyLines().push(r)}}catch(u){}},i.prototype.drawTrainStation=function(n,t,i,r,u,f){function s(n,t,i){i===void 0&&(i=1);var r=L.icon({iconUrl:n,iconAnchor:[9,32]});return L.marker([t.lat,t.lng],{icon:r,zIndexOffset:i})}var c=this._mapData.aoTrains[n],e=c.aoStations[t],l=!0,h=!1,o=[];!this.isFormMap&&e.bIsFirstOnSearchedRoute?n==0?o.push(s("/images/map_pin_start.png",e,3)):(i!=null&&(h=!0),o.push(s("/images/map_pin_transfer_edge.png",e))):!this.isFormMap&&e.bIsLastOnSearchedRoute&&(n==this._mapData.aoTrains.length-1?o.push(s("/images/map_pin_finish_edge.png",e,2)):u?o.push(s("/images/map_pin_transfer_edge.png",e)):l=!1);l&&o.push(this.addStationMarker("/images/map_pin_bg.png",e));this.featureGroupStationMarker(o,e,c,h?i:null,h?r:null,u,f,n)},i.prototype.addStationMarker=function(n,t){var i=L.icon({iconUrl:n,iconAnchor:[6,6]});return L.marker([t.lat,t.lng],{icon:i,zIndexOffset:1})},i.prototype.getZJR=function(n,t,i,r,u,f,e,o,s,h){var c=this,l;o===void 0&&(o=-1);s===void 0&&(s=-1);h===void 0&&(h=-1);l=$.ajax({type:"POST",cache:!1,url:this.ajaxBaseUrl+"ZJR",dataType:"jsonp",data:{iLine:o,sLine:n,iFrom:s,sFrom:t,iTo:h,sTo:i,sStation:null,iStationIndex:u,iTTIndex:f,bPrefereBack:e,sAbsCombID:"",format:"json"}});l.done(function(n){c.SucessZjrAjax(n,f)});l.fail(function(){c.openErrorModal(c.msgService.getMessages().showZjr.sErrorMessageForNoZJR)})},i.prototype.mangePdfIcon=function(n,t){var i=this;$(".ico-pdfzjr").click(function(){i.zjrPDF(n,t)});this.manageIconWraper("pdfWrapper",i.msgService.getMessages().showZjr.sPDF)},i.prototype.manageRouteIcon=function(n,t){var i=this;$(".ico-route").click(function(r){r.preventDefault();var u=$.ajax({type:"GET",cache:!1,url:i.ajaxBaseUrl+"ZJRLinesForDraw",dataType:"jsonp",data:{ttIndex:t,prefixText:n.sLine,sFrom:n.aoStations[0].sFrom,sTo:n.aoStations[n.aoStations.length-1].sFrom,absCombId:n.sAbsCombID,iStationIndex:n.iStationIndex,format:"json"}});u.done(function(n){n&&(i.closeModals(),i.RemoveMapLinesAndFeatureStation(),i.showConnectionOnMap(n,!1),i.AddDeleteLinesControl())});u.fail(function(){i.openErrorModal(i.msgService.getMessages().general.loadError)})});this.manageIconWraper("routeWraper",i.msgService.getMessages().showZjr.sRoute)},i.prototype.closeModals=function(){this._paoramaModal&&this._paoramaModal.isOpen&&this._paoramaModal.close();this._zjrModal&&this._zjrModal.isOpen&&this._zjrModal.close();this._trainDetailModal&&this._trainDetailModal.isOpen&&this._trainDetailModal.close();this.map&&this.map.closePopup()},i.prototype.manageIconWraper=function(n,t){var i=this;$("."+n).mouseover(function(r){var e=$(i.getElement(r,n)),u=document.createElement("div"),f;u.innerHTML='<span class="notes-container">'.concat(t,"<\/span>");u.classList.add("map-station-tooltip");u.classList.add("note-container");f=$(e).offset();i.showStationTooltip($(e)[0],u,f.top,f.left)});$("."+n).mouseout(function(t){var r=$(i.getElement(t,n));$(r).children(".map-station-tooltip").remove()})},i.prototype.managePanoIcon=function(n){var t=this;$(".ico-pano").click(function(){t.stationPanorama(n.aoStations[n.iStationIndex])});this.manageIconWraper("panoWrapper",t.msgService.getMessages().showZjr.sPano)},i.prototype.manageNoteBubbles=function(n){var t=this;$(".bhlpS").mouseover(function(i){for(var r,e,c=$(i.target),o=$(t.getElement(i,"bhlpS")),h=$(o).attr("i"),s=h.split("|"),u="",f=0;f<s.length;f++)u+=n.asBubble[s[f]],u+="<br>";r=document.createElement("div");r.innerHTML='<span class="notes-container"><h4 style="display: inline; " >'.concat(t.msgService.getMessages().showZjr.sNotes,"<\/h4><br>").concat(u,"<\/span>");r.classList.add("map-station-tooltip");r.classList.add("note-container");e=$(o).offset();t.showStationTooltip($(t.getElement(i,"bhlpS"))[0],r,e.top,e.left)});$(".bhlpS").mouseout(function(n){var i=$(t.getElement(n,"bhlpS"));$(i).children(".map-station-tooltip").remove()})},i.prototype.makeZjrHtmlHeader=function(n){return'<div class="headZjr"><h2>'+(n.bExclusion?'<span class="vylukaWrapper"><img src=/images/vyluka.png class="vyluka" alt="Vyluka"  /><\/span>':"")+this.msgService.getMessages().showZjr.sLineLabelCap+" "+n.sRecap+'<span style="margin-left:50px;"><\/span><span class="pdfWrapper"><img src=/images/file-pdf-regular.svg class="ico-pdfzjr" alt="PDF" /><\/span>'+(this.isMafraSK?"":'<span class="panoWrapper"><img src=/images/panorama-solid.svg class="ico-pano" alt="Panorama" /><\/span>')+'<span class="routeWraper"><img src=/images/route-solid.svg class="ico-route" alt="Route" /><\/span><\/h2><\/div>'},i.prototype.showZjrModal=function(n,t){this._zjrModal.isOpen?$(".stat").height($(".zjrtd1 .zjr2").height()+$(".zjrrem div").height()+10-$(".changes").height()):(this._zjrModal.show("#maps-zjr-modal"),this._zjrModal.exitOnClikOtside(),$(".stat").height($(".zjrtd1 .zjr2").height()+$(".zjrrem div").height()+10-$(".changes").height()),$(".widthForParam")[0].style.left=$(".widthForParam").parent().width()/2-$(".widthForParam")[0].offsetWidth/2+"px",$(".widthForParam")[0].style.top=$(".widthForParam").parent().height()/2-$(".widthForParam")[0].offsetHeight/2+"px");this.manageZjrProcesses(n,t)},i.prototype.makeZjrMovable=function(){var t=[0,0],n=$(".widthForParam")[0],r=$("#mapsZjrModalContent .headZjr")[0],i=!1;r.addEventListener("mousedown",function(r){r.which==1&&(i=!0,t=[n.offsetLeft-r.clientX,n.offsetTop-r.clientY])},!0);r.addEventListener("mouseup",function(){i=!1},!0);document.addEventListener("mousemove",function(r){r.preventDefault();i&&(n.style.left=r.clientX+t[0]+"px",n.style.top=r.clientY+t[1]+"px")},!0)},i.prototype.resizeZjrModal=function(){var n=$(".stat"),t=$(".stat .zjr2"),i,r;n.height()<t.height()&&(i=$(".selsttr").position(),i.top+$(".selsttr").height()/2>$(".stat").height()&&$(".stat").scrollTop(i.top));n.height()<t.height()&&n[0].clientWidth<n[0].offsetWidth&&(r=n[0].offsetWidth-n[0].clientWidth-n[0].clientLeft,n.css("min-width",t[0].clientWidth+r),n[0].offsetWidth>n[0].clientWidth&&$(".mapsZjrModalContent .headZjr").outerWidth($(".zjr1").width()))},i.prototype.changeStationbyClick=function(n,t){var i=this;$(".zjr2 a").click(function(r){var f=$(r.target).attr("i"),u;f!=""&&(u=n.aoStations[f],i.getZJR(n.sLine,u.sFrom,u.sTo,null,u.iStationIndex,t,u.bPrefereBack,n.iLine,u.iFrom,u.iTo))})},i.prototype.changeStationBySelect=function(n,t){var i=this;$("#chsel").change(function(r){var u=r.target.value;u!=""&&n.aoChange[u]&&i.getZJR(n.aoChange[u].sLine,n.aoChange[u].sFrom,n.aoChange[u].sTo,null,n.aoChange[u].iStationIndex,t,n.aoChange[u].bPrefereBack,n.aoChange[u].iLine,n.aoChange[u].iFrom,n.aoChange[u].iTo)})},i.prototype.manageChangeStation=function(n,t){this.changeStationbyClick(n,t);this.changeStationBySelect(n,t)},i.prototype.manageZjrProcesses=function(n,t){var i=this;this.manageChangeStation(n,t);this.mangePdfIcon(n,t);this.manageRouteIcon(n,t);this.isMafraSK||this.managePanoIcon(n);this.manageIconWraper("vylukaWrapper",i.msgService.getMessages().showZjr.sExclave);this.manageNoteBubbles(n);this.makeZjrMovable();this.resizeZjrModal()},i.prototype.SucessZjrAjax=function(n,t){if(n){if(this._zjrModal==null){var i=new Base.ModalParams("widthForParam",null,!1,!0,1,!1,!1);this._zjrModal=new Base.Modal(null,this.msgService,null,i,null)}$("#mapsZjrModalContent").html(this.makeZjrHtmlHeader(n)+this.zjrResults(n));this.showZjrModal(n,t)}else this.openErrorModal(this.msgService.getMessages().showZjr.sErrorMessageForNoZJR)},i.prototype.getStationLinesDepParams=function(n,t){var i=this,r;t.getPopup()==null&&(r=$.ajax({type:"POST",cache:!1,url:this.ajaxBaseUrl+"StationLinesDep",dataType:"jsonp",data:{iItem:n.item,SLine:null,sDate:null,sTime:null,iListID:n.listId,sName:n.name,format:"json"}}),r.done(function(n){i.depLinesAjaxSucess(n,t)}),r.fail(function(){i.openErrorModal(i.msgService.getMessages().showZjr.sErrorMessageForNoListOfLines)}))},i.prototype.addLineToCard=function(n){var u=this,t=document.createElement("div"),i,r;return t.className="linebox"+n.bIsRouteLine,i=document.createElement("img"),i.src=n.imagePath,i.title=n.imageTitle,i.className=n.imageClass,t.appendChild(i),r=document.createElement("span"),r.className="bignum",r.style.color=n.imageColor,r.innerHTML="&nbsp"+n.sLineName,t.appendChild(r),t.innerHTML+="&nbsp"+"".concat(n.sLangDirection," ").concat(n.sDirection,"<br />")+n.sDepTime+'<div class="break"><\/div><\/div>',t.addEventListener("click",function(){u.getZJR(n.sLineName,n.sStation,n.sDirection,n.sStation,0,n.iTTIndex,!1,null)}),t},i.prototype.depLinesAjaxSucess=function(n,t){var u,f,i,e,o,r,s;if(n&&this.showMhdZjr==1){if(u=document.createElement("div"),f=document.createElement("div"),f.innerHTML="<strong>"+t.options.station.name+"<\/strong>",f.classList.add("card-header"),f.style.height="20px",u.appendChild(f),i=document.createElement("div"),i.classList.add("deptitle"),i.classList.add("cb"),i.style.height="20px",u.appendChild(i),e=document.createElement("div"),e.classList.add("card-body"),n.aoContent!=null)for(o=0;o<n.aoContent.length;o++)r=n.aoContent[o],r.iType!=200&&r.iType!=202&&r.iType!=201&&r.sLineName.length<5&&(s=this.addLineToCard(r),e.appendChild(s),Base.Support.stringIsEmpty(i.innerText)&&(i.innerText=n.title));u.appendChild(e);Base.Support.stringIsEmpty(i.innerText)&&(i.innerText=this.msgService.getMessages().showZjr.sNoMhdLines24hours,i.classList.add("paddidng-bottom"));t.bindPopup(u,{minWidth:300,maxHeight:351,offset:new L.Point(0,-10),bubblingMouseEvents:!1,autoPanPadding:new L.Point(50,50)});t.getPopup().toggle()}},i.prototype._genStations=function(n){var t="",u=n.aoStations.length,r,i;if(u>0){for(r=n.asZones!=null,t+='<div class="stat">',t+='<table class="zjr2"><thead class="zjr2-header"><tr><th colspan="2" class="zjrday">'+this.msgService.getMessages().showZjr.sStop+"<\/th>",r&&(t+='<th class="zones">'+this.msgService.getMessages().showZjr.sZones+"<\/th>"),t+="<\/tr><\/thead>",t+="<tbody>",i=0;i<u;i++)t+="<tr",n.iStationIndex==i&&(t+=' class="selsttr" '),t+='><td class="statm">',t+=n.aiStDist[i]>-1?n.aiStDist[i]:"&nbsp;",t+='<\/td><td class="zast">',t+=n.iStationIndex==i?'<span class="selst">'+n.aoStations[i].sFrom+"<\/span>":'<a href="#" title="'+this.msgService.getMessages().showZjr.sGetFromStation+'" i="'+i+'">'+n.aoStations[i].sFrom+"<\/a>",n.aoStations[i].sNotes&&n.aoStations[i].sNotes!=""&&(t+=" "+n.aoStations[i].sNotes),t+="<\/td>",r&&(t+='<td class="zones">'+n.asZones[i]+"<\/td>"),t+="<\/tr>";t+="<\/tbody><\/table><\/div>"}return t},i.prototype.genZJRData=function(n){var t="",o,i,f;if(t+='<td class="zjrtd1" ><table class="zjr2"><thead><tr>',n.asTabValidity&&n.asTabValidity.length>=0)for(i=0;i<=n.asTabValidity.length-1;i++)t+='<th colspan="2" class="zjrday',i==n.asTabValidity.length-1&&(t+=" nob"),t+='">'+n.asTabValidity[i]+"<\/th>";else this.openErrorModal(n.sRecap);t+="<\/tr><\/thead><tbody>";for(var u=!1,s=!1,r=n.iMinHour,e=0;!s;){for(e++,t+="<tr",u&&(t+=' class="even"'),u=!u,t+=">",i=0;i<=n.asTabValidity.length-1;i++)t+='<td class="zjrhour">'+r+'<\/td><td class="zjrmin',i==n.asTabValidity.length-1&&(t+=" nob"),t+='">',t+=n.asTimes[i][r]?n.asTimes[i][r]:"&nbsp;",t+="<\/td>";t+="<\/tr>";n.iMaxHour==r&&(s=!0);r++;r>23&&(r=0)}if(o=24,e<o)for(i=e;i<o;i++){for(t+="<tr",u&&(t+=' class="even"'),t+=">",f=0;f<n.asTabValidity.length;f++)t+='<td class="zjrhour">&nbsp;<\/td><td class="zjrmin',f==n.asTabValidity.length-1&&(t+=" nob"),t+='">&nbsp;<\/td>';t+="<\/tr>"}return t+"<\/tbody><\/table><\/td>"},i.prototype._genChanges=function(n){var t="",r,i;if(t+='<div class="changes"><div class="chlbl">'+this.msgService.getMessages().showZjr.sLinesAtStopLabel+":<\/div>",n.aoChange&&n.aoChange.length>0){for(r=n.aoChange.length,t+='<select id="chsel"><option value="">&nbsp;'+this.msgService.getMessages().showZjr.sLineLabel1+" → "+this.msgService.getMessages().showZjr.sDirectionLabel,i=0;i<r;i++)t+='<option value="'+i+'">&nbsp;'+n.aoChange[i].sLine+" → "+n.aoChange[i].sTo+"<\/option>";t+="<\/select>"}else t+="<span>"+this.msgService.getMessages().showZjr.sNoLinesLabel+"<\/span>";return t+"<\/div>"},i.prototype._genRem=function(){return'<td class="zjrrem btop"><div>'+this.msgService.getMessages().showZjr.sMessageForUndrstanfing+"<\/div><\/td>"},i.prototype.generateZJR=function(n,t){var i="";return i+='<table class="zjr1"><tr>',i+=this.genZJRData(n),i+="<\/td>",i+="<td ",t&&(i+='rowspan="2" '),i+='class="stattd">',i+=this._genStations(n),i+=this._genChanges(n),i+="<\/td><\/tr><tr>",t&&(i+=this._genRem()),i+"<\/tr><\/table>"},i.prototype.zjrResults=function(n){var t=n.asBubble!=null&&n.asBubble.length>0;return this.generateZJR(n,t)},i.prototype.stationPanorama=function(n){var t=n.iCooX,i=n.iCooY;this.showPanoramaAtStationPosition(t,i,n.sFrom)},i.prototype.showPanoramaAtStationPosition=function(n,t,i){var r,u;this._paoramaModal==null&&(this._paoramaModal=new Base.Modal(null,this.msgService,null,new Base.ModalParams("panoramaWidth",null,null,null,3),null));this._paoramaModal.show("#maps-panorama-modal");this._paoramaModal.exitOnClikOtside();r='<div class="headPano"><h2>'.concat(i,"<\/h2><\/div>");$("#panoramaModalContent").html(r);$("#panoramaModalContent").height("100%");$("#panoramaModalContent").width("100%");u=document.querySelector("#panoramaModalContent");Panorama.panoramaFromPosition({parent:u,lon:t,lat:n,apiKey:this.mapSettings.seznamMAPKey,yaw:5.43,pitch:Math.PI/1,fov:Math.PI/1,showNavigation:!0})},i.prototype.zjrPDF=function(n,t){var i=new Conn.PdfModel;i.context=1;i.jsZjrData=new Zjr.ResultJsModel;i.jsZjrData.stationIndex=n.iStationIndex;i.jsZjrData.TTIndex=t;i.jsZjrData.searchItem=new Pref.PrefsSearchItem;i.jsZjrData.searchItem.oZjr=new Pref.PrefsItemZjr;i.jsZjrData.searchItem.sCombId=n.sAbsCombID;i.jsZjrData.searchItem.oZjr.oUserInput=new Pref.PrefsUserInputZjr;i.jsZjrData.searchItem.oZjr.oUserInput.bWholeWeek=!0;var r=new Date,e=r.getTimezoneOffset(),o=r.toISOString().split(".")[0]+"+"+("0"+Math.abs(e/60)).slice(-2)+":00";i.jsZjrData.searchItem.oZjr.oUserInput.dtSearchDate=o;i.jsZjrData.searchItem.oZjr.oUserInput.sLine=n.sLine;i.jsZjrData.searchItem.oZjr.oUserInput.oFrom=new Pref.PrefsObjectItem;i.jsZjrData.searchItem.oZjr.oUserInput.oFrom.sAdvancedName=n.aoStations[n.iStationIndex].sFrom;i.jsZjrData.searchItem.oZjr.oUserInput.oFrom.sName=n.aoStations[n.iStationIndex].sFrom;i.jsZjrData.searchItem.oZjr.oUserInput.oTo=new Pref.PrefsObjectItem;i.jsZjrData.searchItem.oZjr.oUserInput.oTo.sAdvancedName=n.aoStations[n.iStationIndex].sTo;i.jsZjrData.searchItem.oZjr.oUserInput.oTo.sName=n.aoStations[n.iStationIndex].sTo;var s=this.isMafraSK?this.ajaxBaseUrl.replace("Ajax","zcp/pdf"):this.ajaxBaseUrl.replace("Ajax","zjr/pdf"),u=$("#idosform"),f=$("<form />",{target:"_blank",action:s,method:"post",id:"pdfForm"}).append($("<input/>",{type:"hidden",name:"model",value:JSON.stringify(i)}));u.append(f);f.submit();u.remove("#pdfForm");event.preventDefault()},i.prototype.hasWalkToNextTrain=function(t,r){return r>=0&&r<t.length-1&&t[r].bHasEnd&&t[r+1].bHasStart&&n.TrainMapData.hasStations(t[r])&&n.TrainMapData.hasStations(t[r+1])&&!i.getStationCoords(n.TrainMapData.getLastStation(t[r])).equals(i.getStationCoords(n.TrainMapData.getFirstStation(t[r+1])))},i.prototype.fillRouteCoors=function(n,t,i,r,u){if(n.bIsOnSearchedRoute?i[i.length]=t:i.length===0?r[r.length]=t:u[u.length]=t,n.aoCoor!=null)for(var f=0;f<n.aoCoor.length;f++)n.bIsOnSearchedRoute?i[i.length]=L.latLng([n.aoCoor[f].x,n.aoCoor[f].y]):i.length===0?r[r.length]=L.latLng([n.aoCoor[f].x,n.aoCoor[f].y]):u[u.length]=L.latLng([n.aoCoor[f].x,n.aoCoor[f].y])},i.prototype.addWalkLine=function(n,t,i,r){try{if(typeof n!="undefined"&&typeof t!="undefined"&&typeof i!="undefined"&&typeof r!="undefined"){var u=L.latLng(n,t),f=L.latLng(i,r),e=L.polyline([u,f],{color:this._walkColor,weight:4}).addTo(this.map);this.getPolyLines().push(e)}}catch(o){}},i.prototype.addWalkPseudoStation=function(n,t,i,r){try{if(typeof n!="undefined"&&typeof t!="undefined"&&typeof i!="undefined"){var u={lat:n,lng:t,name:i},f=this.addStationMarker("/images/map_pin_bg.png",u);this.featureGroupStationMarker([f],u,{sColor:"black"},null,null,!0,r,0)}}catch(e){}},i.prototype.featureGroupStationMarker=function(n,t,i,r,u,f,e,o){var l,s,c,a,h;if(r===void 0&&(r=null),u===void 0&&(u=null),l=this,s=L.featureGroup(n,{station:t,train:i,prevLastStation:r,prevLine:u}),s.addTo(this.map),c=this.getTooltipDescription(t,r,i,u,f,e),t.bIsFirstOnSearchedRoute?(a=this.getPermanentHoverTooltipWithNameAndDepartures(c),s.bindTooltip(a),a.getElement().style.zIndex=(-o).toString(),h=document.createElement("span"),h.classList.add("closeButton"),h.innerText="x",s.getTooltip().getElement().appendChild(h),h.addEventListener("click",function(){s.unbindTooltip();s.bindTooltip(l.getHoverTooltipWithNameAndDepartures(c))})):s.bindTooltip(this.getHoverTooltipWithNameAndDepartures(c)),this.isFormMap)s.on("click",function(){l.setSelectedStation(L.latLng(t.lat,t.lng),t)});this.stationFeatureMarkers().push(s)},i.prototype.getElement=function(n,t){var i=$(n.target),r;return i.hasClass(t)?i[0]:(r=i.parents("."+t),r.length>0)?r[0]:null},i.prototype.showStationTooltip=function(n,t,i,r,u,f,e){var d,l;u===void 0&&(u=0);f===void 0&&(f=0);e===void 0&&(e=0);n.appendChild(t);var h=$(t),w=0,a=$("#".concat(this._mapId)).width(),v="left",y="bottom",o,s,b=-1,k=-1,g=parseFloat(getComputedStyle(n).fontSize),c=.7*g,p=1.2*g;n?(b=$("#".concat(this._mapId)).offset().left-$(document).scrollLeft(),k=$("#".concat(this._mapId)).offset().top-$(document).scrollTop(),o=$(n).offset().left-$(document).scrollLeft()-b,s=$(n).offset().top-$(document).scrollTop()-k):(o=Math.round(i),s=Math.round(r));o+=u;s+=f;d=h.outerHeight();l=h.outerWidth();$(h).width(h.width());s-d-p<=0&&(y="top",f+=$(n).height());o-3*c+l>=a&&(v="right");v=="left"&&y=="top"?(o=o-c,s=s+p+f+e,o<w&&(o=w),this.addMarkerTooltipPositionClass(h,"left-top")):v=="right"&&y=="top"?(o=o-u+3*c>a?a-l:o+3*c-l-u,s=s+p+f+e,this.addMarkerTooltipPositionClass(h,"right-top")):v=="left"&&y=="bottom"?(o=o-c,s=s-p-d-f,o<w&&(o=w),this.addMarkerTooltipPositionClass(h,"left-bottom")):v=="right"&&y=="bottom"&&(o=o-u+3*c>a?a-l:o+3*c-l-u,s=s-p-d-f,this.addMarkerTooltipPositionClass(h,"right-bottom"));b>-1&&(o=o+b);k>-1&&(s=s+k);h.css("left",o+"px");h.css("top",s+"px")},i.prototype.addMarkerTooltipPositionClass=function(n,t){n.removeClass("left-bottom right-bottom left-top right-top").addClass(t)},i.prototype.getTooltipDescription=function(n,t,i,r,u,f){var o,e,l="",s="",h,c;return f&&(n.bIsLastOnSearchedRoute?(o=this.msgService.getMessages().conn.arr,e=this.msgService.getMessages().conn.dep,s=Base.Support.stringIsEmpty(n.sArr)?n.sDep:n.sArr):(o=this.msgService.getMessages().conn.dep,e=this.msgService.getMessages().conn.arr,Base.Support.stringIsEmpty(n.sArr)||(l=" "+e+" "+n.sArr+", "),s=n.sDep)),h='<strong class="right-paddding">'+n.name+"<\/strong>",t&&r&&(c="",c=Base.Support.stringIsEmpty(t.sArr)?t.sDep:t.sArr,h+=this.getConnDesc(r,f?", "+e+" "+c:"",n,u)),h+this.getConnDesc(i,f?", "+l+o+" "+s:"",n,u)},i.prototype.getConnDesc=function(n,t,i,r){var u="";n.bHasIDSLineSName||(u=Base.Support.stringIsEmpty(n.sLineDesc)?"".concat(n.sType," ").concat(n.sLine):"".concat(n.sType," ").concat(n.sLineDesc));var e="<span>".concat(t,"<\/span>"),o='<span style="color:'.concat(n.sColor,';">').concat(Base.Support.stringIsEmpty(n.sName)?u:u+n.sName,"<\/span>"),f="";return i.bIsLastOnSearchedRoute&&r&&(f+=this.getWalkDesc(n)),'<div class="connectionDiv"><span class="wwwtt tt-icon-conn" style="color:'.concat(n.sColor,'">&#').concat(n.iAsc,";<\/span>").concat(o).concat(e).concat(f,"<\/div>")},i.prototype.getWalkDesc=function(n){var i=this.msgService.getMessages().conn.nodePedestrianShift,r="",t;return n.iLinkDist>0&&(i=this.msgService.getMessages().conn.pedestrianShiftLabel,t=this.msgService.getMessages().share.minutes(n.iLinkDist),r=Base.Support.stringIsEmpty(n.sLinkDesc)?t:"".concat(t,", ").concat(n.sLinkDesc)),'<span style="color: #000;">, '.concat(i).concat(r,"<\/span>")},i.prototype.initMapForm=function(){var t=this,n=this;$(".map-controls-panel").show();$("label[for='positionAC'] .label-span").html(Components.Autocomplete.GetLabelForInputType(this.mapSettings.parentInputType,this.msgService));this.mapSettings.parentInputType===Components.AutocompleteInputType.From?($("#positionAC").data("searchbyposition","true"),$(".map-controls-panel .ico-position").show(),$(".map-controls-panel .ico-position").click(function(n){n.preventDefault();n.stopPropagation();t._positionData.GetCurrentPosition(!0,t.getPositionSuccess.bind(t))})):($("#positionAC").removeData("searchbyposition"),$(".map-controls-panel .ico-position").hide());this.positionAC=new Components.Autocomplete("positionAC",this._positionData,this.msgService,undefined,!1,this.mapSettings.parentInputType,function(){$(".map-controls-panel button").click()},this._isFirstInit,!0);Components.Autocomplete.hasError($("#"+n.mapSettings.parentInputSelector))&&$("#positionAC").click();$(".map-controls-panel button").click(function(){var t=$("#positionAC").val(),i=$("#positionACHidden").val();$("#"+n.mapSettings.parentInputSelector).val(t);$("#"+n.mapSettings.parentInputHiddenSelector).val(i);$("#"+n.mapSettings.parentInputSelector).closest(".inp-combined").toggleClass("filled",t&&typeof t=="string"&&!Base.Support.stringIsEmpty(t.toString()));n.positionAC.hasError()?$("#"+n.mapSettings.parentInputSelector).click():Components.Autocomplete.hideError($('label[for="'+n.mapSettings.parentInputSelector+'"]'),$("#"+n.mapSettings.parentInputSelector));n._mapModal.close()});this._isFirstInit&&(this._isFirstInit=!1)},i.prototype.getName=function(n,t){var i=n;return Base.Support.stringIsEmpty(i)&&(i=Base.Support.stringIsEmpty(t)?this._mostPriorObjectMask:t),i},i.prototype.setAsyncStationFromName=function(n,t,i){var u=n===this._mostPriorObjectMask,e=this.getName(n,t),r=this,f=$.ajax({type:"GET",cache:!1,url:this.ajaxBaseUrl+"FindObjectByName",dataType:"jsonp",data:{name:e,onlyStations:this.mapSettings.isDeparture,format:"json"}});f.done(function(n){if(n)if(n&&n.name&&n.lat&&n.lng&&n.lat>0&&n.lng>0)i?r.init(new L.LatLng(n.lat,n.lng),r.mapSettings.defaultZoom):r.map.setView(new L.LatLng(n.lat,n.lng),r.map.getZoom()),u||r.setSelectedStation(new L.LatLng(n.lat,n.lng),n,!0),r.ShowStations();else if(!u){r.setAsyncStationFromName(r._mostPriorObjectMask,t,!0);return}});f.fail(function(){r.openErrorModal(r.msgService.getMessages().general.loadError)})},i.prototype.showStationFromHiddenItem=function(n,t){var i=new L.LatLng(n.coorX,n.coorY);t?this.init(i,this.mapSettings.defaultZoom):this.map.setView(i,this.map.getZoom());n.myPosition&&this.setMyPosition(i);this.setFlagToStation(i)},i.prototype.setMyPosition=function(n){this._myPositionMarker=L.marker(n,{icon:L.icon({iconUrl:"/images/departures.png",iconSize:[24,24]})});this._myPositionMarker.addTo(this.map)},i.prototype.stationChanged=function(n){n===void 0&&(n=!1);var i=typeof $("#positionAC").val()=="string"?$("#positionAC").val().toString():"",r=$("#positionAC").attr("placeholder"),u=$("#positionACHidden").val(),t=this.getHiddenItem(i,u,r),f=$("#positionACPosition").val();this.setPositionData(f,t);!t||(isNaN(t.coorX)||t.coorX===0)&&(isNaN(t.coorY)||t.coorY===0)?this.setAsyncStationFromName(i,r,n):(this.showStationFromHiddenItem(t,n),this.ShowStations())},i.getStationCoords=function(n){return L.latLng(n.lat,n.lng)},i.prototype.getStationMarkers=function(){return this._stationMarkers||(this._stationMarkers=[]),this._stationMarkers},i.prototype.getPolyLines=function(){return this._polyLines||(this._polyLines=[]),this._polyLines},i.prototype.stationFeatureMarkers=function(){return this._stationFeatureMarkers||(this._stationFeatureMarkers=[]),this._stationFeatureMarkers},i.prototype.getMapRoute=function(n){var t=this,i=$.ajax({type:"GET",cache:!1,url:this.ajaxBaseUrl+"GetMapRoute",dataType:"jsonp",data:{handle:this.handle,connID:n,combID:this.combId,format:"json"}});i.done(function(n){n&&t.showConnectionOnMap(n)});i.fail(function(){t.openErrorModal(t.msgService.getMessages().general.loadError)})},i.prototype.openErrorModal=function(n){var t=new Base.Modal(null,this.msgService,null,new Base.SwalModalParams);t.show("#errorModal");$("#errorModalContent").text(n)},i.prototype.ShowStations=function(){var i=this,n=this,r=this.map.getZoom(),t=this.map.getBounds();this.newBounds=t;r>this.mapSettings.minZoom?($(document).queue("MapFind",function(){$.ajax({type:"GET",cache:!1,url:i.ajaxBaseUrl+"SearchTimetableObjectsInRect",dataType:"jsonp",data:{combID:i.combId,minX:t.getSouthWest().lat,minY:t.getNorthEast().lat,maxX:t.getSouthWest().lng,maxY:t.getNorthEast().lng,zoom:r,format:"json"}}).done(function(t){n.RemoveOldExistingStations();t.length>0?(n.AddNewNonDuplicitStations(t),n.oldBounds=n.newBounds,n.newBounds=undefined):(n.oldBounds=undefined,n.newBounds=undefined)}).fail(function(){n.oldBounds=undefined}).always(function(){n.oldBounds&&n.oldBounds.overlaps(n.map.getBounds())&&$(document).dequeue("MapFind")})}),$(document).queue("MapFind").length==1&&$(document).dequeue("MapFind")):this.RemoveAllStations()},i.prototype.RemoveOldExistingStations=function(){for(var i,n=this.getStationMarkers(),t=0;t<n.length;t++)i=n[t],this.newBounds==void 0||this.newBounds.contains(i.getLatLng())||(this.map.removeLayer(i),n.splice(t,1));this._stationMarkers=n},i.prototype.RemoveAllStations=function(){for(var i,t=this.getStationMarkers(),n=0;n<t.length;n++)i=t[n],this.map.removeLayer(i);this.oldBounds=undefined;this._stationMarkers=null},i.prototype.RemoveMapLinesAndFeatureStation=function(){for(var u,n,f,i=this.stationFeatureMarkers(),r=this.getPolyLines(),t=0;t<i.length;t++)u=i[t],this.map.removeLayer(u);for(n=0;n<r.length;n++)f=r[n],this.map.removeLayer(f);this._polyLines=null;this._stationFeatureMarkers=null;this.map.deleteLinesControl&&this.map.deleteLinesControl.remove()},i.prototype.AddNewNonDuplicitStations=function(n){for(var u=function(){var u=n[r],f;if(typeof t.oldBounds=="undefined"||!t.oldBounds.contains([u.lat,u.lng])){f=L.marker([u.lat,u.lng],{station:u,icon:t.getStationIcon()});t.UpdateRemainingMarker(f);i=t;f.on("click",function(){i.setSelectedStation(this.getLatLng(),this.options.station);u&&(i.showMhdZjr==1&&u.nodeName!=""?i.getStationLinesDepParams(u,f):(i.showMhdZjr==2||i.showMhdZjr==3)&&i.getStationTrainDepParams(u,f,!0,!0))});t.getStationMarkers().push(f);f.addTo(t.map)}},t=this,i,r=0;r<n.length;r++)u()},i.prototype.getStationTrainDepParams=function(n,t,i,r){var u=this,f;r===void 0&&(r=!1);f=$.ajax({type:"POST",cache:!1,url:this.ajaxBaseUrl+"DepartureTable",dataType:"jsonp",data:{iItem:n.item,sDate:null,sTime:null,bIsDep:i,iListID:n.listId,sName:n.name,format:"json"}});f.done(function(f){var w,y=r,o=document.createElement("div"),b=u,c=document.createElement("div"),e,s,h,l,a,v,p;for(c.innerHTML="<strong>"+t.options.station.name+"<\/strong>",c.classList.add("card-header"),c.style.height="20px",o.appendChild(c),e=document.createElement("div"),e.className="deptitle arrdeptrain cb",s=document.createElement("span"),s.className="depbox"+(i?" sel":""),s.innerText=u.msgService.getMessages().showDepartures.sDepartures,h=document.createElement("span"),h.className="arrbox"+(i?"":" sel"),h.innerText=u.msgService.getMessages().showDepartures.sArrivals,l=document.createElement("span"),l.className="direction",l.innerText=i?u.msgService.getMessages().showDepartures.sDiretionTo:u.msgService.getMessages().showDepartures.sDirectionFrom,i?h.addEventListener("click",function(){b.getStationTrainDepParams(n,t,!1,!0)}):s.addEventListener("click",function(){b.getStationTrainDepParams(n,t,!0,!0)}),e.appendChild(s),e.appendChild(h),e.appendChild(l),o.appendChild(e),a=[],a.push(e),v=0;v<f.arrDep.length;v++)a.push(u.getDepartureToCard(f.arrDep[v],n.name,i,f.absCombId));if(p=document.createElement("div"),(w=p).replaceChildren.apply(w,a),o.appendChild(p),t.getPopup())t.getPopup().setContent(o),y=y&&!1;else{t.bindPopup(o,{minWidth:360,maxHeight:351,offset:new L.Point(0,-10),bubblingMouseEvents:!1,autoPanPadding:new L.Point(50,50)});t.on("popupclose",function(){t.options.popUpInterval>0&&(clearInterval(t.options.popUpInterval),t.options.popUpInterval=0)})}r&&u.setIntervalForPopup(n,t,i);t.getPopup()&&!t.getPopup().isOpen()&&y&&t.togglePopup()});f.fail(function(){u.openErrorModal(u.msgService.getMessages().showZjr.sErrorMessageForNoListOfLines)})},i.prototype.setIntervalForPopup=function(n,t,i){var r=this;t.options.popUpInterval>0&&(clearInterval(t.options.popUpInterval),t.options.popUpInterval=0);t.options.popUpInterval=setInterval(function(){r.getStationTrainDepParams(n,t,i)},6e4)},i.prototype.getDepartureToCard=function(n,t,i,r){function a(){var t="nodelay";return n.iDelay==-2&&(t="expdelay"),n.iDelay>=6&&n.iDelay<=15&&(t="delayto15"),n.iDelay>=16&&n.iDelay<=30&&(t="delayto30"),n.iDelay>=31&&(t="delayfrom31"),t}function v(){var t="Delay5";return n.iDelay==-2?t=f.msgService.getMessages().showDepartures.sDelayExpected:n.iDelay>0&&(t=n.iDelay+f.msgService.getMessages().showDepartures.sDelay5),t}function y(){var t="";return n.sStand!=null&&n.sStand.length>0&&(t=f.msgService.getMessages().showDepartures.sStand+" "+(n.sStand.indexOf("#")>-1?n.sStand.split("#")[0]:n.sStand)),n.sTrack!=null&&t.length>0&&(t+=" / ",t+=f.msgService.getMessages().showDepartures.sTrack+" "+(n.sTrack.indexOf("#")>-1?n.sTrack.split("#")[0]:n.sTrack)),t}var f=this,u=document.createElement("div"),e,o;u.className="linebox dep".concat(n.dep);e="";e="<span class=time>".concat(n.sDateTime,"<\/span><img src=").concat(n.sImagePath,' class="').concat(n.sImageClass,'"/>')+'&nbsp;<span style="color:'.concat(n.sColor,';">').concat(n.sName,"<\/span>").concat(n.sIDSLine," <span class=r>").concat(n.sDestination,"<\/span><br class=break>");var s=y(),c=a(),l=v(),h=n.iDelay==-2||n.iDelay>0;return(s.length||h)&&(e+="".concat(s,'<span class="r ').concat(c,'">').concat(h?l:"","<\/span><br class=break/>")),n.iTTIndex!=-1?(o=this,u.addEventListener("click",function(){var u=new Conn.TrainDetailModel;u.ttIndex=n.iTTIndex;u.train=n.iTrain;u.delayQuery=n.sDelayQuery;u.id=n.iID;u.dateFrom=Base.Support.formatDate(n.dtDateTime);u.timeFrom=Base.Support.formatTime(n.dtDateTime);u.stationFromName=t;u.isDep=o.isDep;u.isArr=!i;u.absCombId=r;u.isDetailFromMap=!0;u.stationFromIndex=n.iStationFromIndex;o.showTrainDetail(u)})):u.classList.add("unclickable"),u.innerHTML=e,u},i.prototype.showTrainDetail=function(n){var i=this,r,u,t;this._trainDetailModal!=undefined&&this._trainDetailModal.isOpen?($("#hrefTrainDetailPosition-".concat(n.train)).length&&(u=new Loader.BouncingLoader("actualPosition","#hrefTrainDetailPosition-"+n.train),$("#hrefTrainDetailPosition-".concat(n.train)).hide(),u.show(!0,!0)),t=Base.BaseResult.getTrainDetailHtml(n,this.ajaxBaseUrl),Base.Support.stringIsEmpty(t)||($(".train-detail-center").html(t),this.showDepTrainDetailComplete(n))):(r={method:"POST",url:this.ajaxBaseUrl+"TrainDetail",data:n,complete:function(){return i.showDepTrainDetailComplete(n)},trainDetail:!0},this._trainDetailModal=new Base.Modal(null,new Messages.MessagesService(null),r,new Base.ModalParams("idos-modal__content--760","trainDetailModal",!1,!0,1,!1,!1)),this._trainDetailModal.show("#trainDetail"),this._trainDetailModal.exitOnClikOtside());$(".share-button--copy").on("click touchstart",function(n){i.copyToClipboard(n)})},i.prototype.copyToClipboard=function(n){var t=$(n.target).attr("data-input-id");Base.Support.copyToClipboardCore($("#".concat(t)).get(0))},i.prototype.showDepTrainDetailComplete=function(n){var t=this;Base.BaseResult.showTrainDetailComplete(n.id);$(".text-position").click(function(){t.showTrainDetail(n)});$(".remarks-list__datelimit").click(function(){Components.Datelimit.showDateLimit(n.ttIndex,n.train,n.stationFromIndex,n.dateFrom,n.isArr,t.ajaxBaseUrl,n.absCombId,t.msgService)});$(".ico-map.train-detail").click(function(i){i.preventDefault();var r=$.ajax({type:"GET",cache:!1,url:t.ajaxBaseUrl+"GetTrainMapRoute4Dep",dataType:"jsonp",data:{ttIndex:n.ttIndex,train:n.train,combID:n.absCombId,stationFromIndex:-1,dateFrom:n.dateFrom,format:"json"}});r.done(function(n){n&&(t.closeModals(),t.RemoveMapLinesAndFeatureStation(),t.showConnectionOnMap(n),t.AddDeleteLinesControl())});r.fail(function(){t.openErrorModal(t.msgService.getMessages().showZjr.sErrorMessageForNoListOfLines)})})},i.prototype.getPermanentTooltipWithName=function(n){return L.tooltip({permanent:!0,direction:"bottom",className:"marker-label",interactive:!0,opacity:.95,content:n.name,bubblingMouseEvents:!1})},i.prototype.getHoverTooltipWithNameAndLines=function(n){var t=n.info!=null&&n.info.length>0?'<div class="station-desc-container" ><span>Linka: <\/span><span style="font-weight:bold">'.concat(n.info,"<\/span><\/div>"):"";return L.tooltip({permanent:!1,direction:"bottom",className:"marker-label-conn focused lines-marker-label",interactive:!0,opacity:1,content:'<span style="font-weight:bold">'.concat(n.name,"<\/span>")+t,bubblingMouseEvents:!1})},i.prototype.getHoverTooltipWithNameAndDepartures=function(n){return L.tooltip({permanent:!1,direction:"bottom",className:"marker-label-form lines-marker-label",interactive:!0,opacity:1,content:n,bubblingMouseEvents:!1})},i.prototype.getPermanentHoverTooltipWithNameAndDepartures=function(n){return L.tooltip({permanent:!0,direction:"bottom",className:"marker-label-conn lines-marker-label",interactive:!0,opacity:1,content:n,bubblingMouseEvents:!1})},i.prototype.setSelectedStation=function(n,t,i){(i===void 0&&(i=!1),this.mapSettings.parentInputType)&&(this.SetMapForm(t,i),this.setFlagToStation(n))},i.prototype.setFlagToStation=function(n){switch(this.mapSettings.parentInputType){case Components.AutocompleteInputType.From:this._fromMarker?this._fromMarker.setLatLng(n):this._fromMarker=L.marker(n,{icon:L.icon({iconUrl:"/images/map_pin_start.png",iconAnchor:[9,28]}),zIndexOffset:2e3,pane:"popupPane"}).addTo(this.map);break;case Components.AutocompleteInputType.To:this._toMarker?this._toMarker.setLatLng(n):this._toMarker=L.marker(n,{icon:L.icon({iconUrl:"/images/map_pin_finish_edge.png",iconAnchor:[9,28]}),zIndexOffset:1999}).addTo(this.map)}},i.prototype.SetMapForm=function(n,t){n&&(t||$("#positionAC").val(n.name),$("#positionAC").attr("placeholder",n.name),$("#positionACHidden").val(Base.HiddenItem.stringify(n.name,n.listId,n.item,"",n.lat,n.lng,!1,"")),$(".map-controls-panel .inp-combined").toggleClass("filled",!Base.Support.stringIsEmpty(n.name)))},i.prototype.getStationIcon=function(){var n="";return n=this.mapSettings.parentInputType==Components.AutocompleteInputType.To?"/images/map_pin_finish_focus_bg.png":this.mapSettings.parentInputType==Components.AutocompleteInputType.From?"/images/map_pin_start_focus_bg.png":"/images/map_pin_transfer_focus_bg.png",L.icon({iconUrl:n,iconSize:[24,24]})},i.prototype.InitMap=function(n,t){var i={position:"topleft",title:this.msgService.getMessages().maps.fullscreenIn,titleCancel:this.msgService.getMessages().maps.fullscreenOut,content:null,forceSeparateButton:!1,forcePseudoFullscreen:!1,fullscreenElement:!1};this.map=n||t?new L.Map(this._mapId,{fullscreenControl:!0,attributionControl:!1,fullscreenControlOptions:i}).setView([n.lat,n.lng],t):new L.Map(this._mapId,{fullscreenControl:!0,attributionControl:!1,fullscreenControlOptions:i}).setView([49.8729317,14.8981184],17);document.getElementsByClassName("leaflet-control-zoom-in").item(0).title=this.msgService.getMessages().maps.zoomIn;document.getElementsByClassName("leaflet-control-zoom-out").item(0).title=this.msgService.getMessages().maps.zoomOut;this.AddAttributionControl();this.AddLogoControl();this.AddLayerControl();this.AddScaleControl()},i.prototype.removeLeafletMap=function(){this.map&&this.map.remove();this.map=null;this._stationMarkers=null;this._polyLines=null;this._toMarker=null;this._fromMarker=null;this._myPositionMarker=null;this.oldBounds=undefined},i.prototype.AddScaleControl=function(){L.control.scale({position:"bottomleft",metric:!0,imperial:!1}).addTo(this.map)},i.prototype.AddLayerControl=function(){var n={};n[this.msgService.getMessages().maps.defaultTile]=L.tileLayer("https://api.mapy.cz/v1/maptiles/basic/256@2x/{z}/{x}/{y}?apikey=".concat(this.mapSettings.seznamMAPKey),{minZoom:0,maxZoom:19,attribution:'<a href="https://api.mapy.cz/copyright" target="_blank">&copy; Seznam.cz a.s. a další<\/a>'});n[this.msgService.getMessages().maps.turistTile]=L.tileLayer("https://api.mapy.cz/v1/maptiles/outdoor/256@2x/{z}/{x}/{y}?apikey=".concat(this.mapSettings.seznamMAPKey),{minZoom:0,maxZoom:19,attribution:'<a href="https://api.mapy.cz/copyright" target="_blank">&copy; Seznam.cz a.s. a další<\/a>'});n[this.msgService.getMessages().maps.winterTile]=L.tileLayer("https://api.mapy.cz/v1/maptiles/winter/256/{z}/{x}/{y}?apikey=".concat(this.mapSettings.seznamMAPKey),{minZoom:0,maxZoom:19,attribution:'<a href="https://api.mapy.cz/copyright" target="_blank">&copy; Seznam.cz a.s. a další<\/a>'});n[this.msgService.getMessages().maps.arialTile]=L.layerGroup([L.tileLayer("https://api.mapy.cz/v1/maptiles/aerial/256/{z}/{x}/{y}?apikey=".concat(this.mapSettings.seznamMAPKey),{minZoom:0,maxZoom:19,attribution:'<a href="https://api.mapy.cz/copyright" target="_blank">&copy; Seznam.cz a.s. a další<\/a>'}),L.tileLayer("https://api.mapy.cz/v1/maptiles/names-overlay/256/{z}/{x}/{y}?apikey=".concat(this.mapSettings.seznamMAPKey),{minZoom:0,maxZoom:19})]);n[this.msgService.getMessages().maps.defaultTile].addTo(this.map);L.control.layers(n,null,{position:"topleft"}).addTo(this.map)},i.prototype.AddAttributionControl=function(){L.control.attribution({position:"bottomleft"}).addAttribution('<a href="https://api.mapy.cz/copyright" target="_blank">&copy; Seznam.cz a.s. a další<\/a>').addTo(this.map)},i.prototype.AddLogoControl=function(){var n=L.Control.extend({options:{position:"bottomright"},onAdd:function(){var t=L.DomUtil.create("div"),n=L.DomUtil.create("a","",t);return n.setAttribute("href","http://mapy.cz/"),n.setAttribute("target","_blank"),n.innerHTML='<img src="https://api.mapy.cz/img/api/logo.svg" />',L.DomEvent.disableClickPropagation(n),t}});(new n).addTo(this.map)},i.prototype.AddDeleteLinesControl=function(){var n=this;L.Control.DeleteLinesControl=L.Control.extend({options:{position:"topleft",title:"Full Screen",forceSeparateButton:!0},onAdd:function(t){var r=this,i;return i=t.zoomControl&&!this.options.forceSeparateButton?t.zoomControl._container:L.DomUtil.create("div","leaflet-bar"),this.link=L.DomUtil.create("a","route-icon",i),this.link.href="#",this.link.title=n.msgService.getMessages().maps.deleteRoute,this.link.setAttribute("role","button"),L.DomEvent.disableClickPropagation(i),i.addEventListener("click",function(){n.RemoveMapLinesAndFeatureStation()}),i}});this.map.deleteLinesControl=new L.Control.DeleteLinesControl;this.map.addControl(this.map.deleteLinesControl)},i.prototype.UpdateRemainingMarkersCaptions=function(){for(var i,t=this.getStationMarkers(),n=0;n<t.length;n++)i=t[n],this.UpdateRemainingMarker(i)},i.prototype.UpdateRemainingMarker=function(n){n!=null&&n.getTooltip()!=null&&n.unbindTooltip();this.map.getZoom()>=this.mapSettings.showLabelZoom?this.AddPermanentTooltipWithNameToMarker(n):n.bindTooltip(this.getHoverTooltipWithNameAndLines(n.options.station))},i.prototype.AddPermanentTooltipWithNameToMarker=function(n){var t=this.getPermanentTooltipWithName(n.options.station);n.bindTooltip(t);n.on("mouseover",function(){t.getElement().classList.add("focused");t.getElement().classList.remove("marker-label");t.getElement().classList.add("marker-label-form");t.getElement().classList.add("lines-marker-label");var i=n.options.station.info!=null&&n.options.station.info.length>0?'<div class="station-desc-container"><span>Linka: <\/span><span style = "font-weight:bold">'.concat(n.options.station.info,"<\/span> <\/div>"):"";t.setContent('<span style="font-weight:bold">'.concat(n.getTooltip().getContent(),"<\/span>")+i);t.update()});n.on("mouseout",function(){t.getElement().classList.remove("focused");t.getElement().classList.remove("marker-label-form");t.getElement().classList.remove("lines-marker-label");t.getElement().classList.add("marker-label");t.setContent(n.options.station.name)})},i.prototype.showOnMapByMyPosition=function(n,t,i){var r=this,u;n&&t&&(u=$.ajax({cache:!1,dataType:"jsonp",url:r.ajaxBaseUrl+"FindObjectByPosition",data:{lat:n,lng:t,accuracy:i,format:"json"}}),u.done(function(n){n?r.setSelectedStation(new L.LatLng(n.lat,n.lng),n):r.openErrorModal(r.msgService.getMessages().general.noClosestObjects)}),u.fail(function(){r.openErrorModal(r.msgService.getMessages().general.noClosestObjects)}))},i}(n.MapsBase);n.MapyCz=t})(Maps||(Maps={}))