/*
@license
dhtmlxScheduler v.5.1.6 Stardard

This software is covered by GPL license. You also can obtain Commercial or Enterprise license to use it in non-GPL project - please contact sales@dhtmlx.com. Usage without proper license is prohibited.

(c) Dinamenta, UAB.
*/
scheduler.xy.map_date_width=188,scheduler.xy.map_icon_width=25,scheduler.xy.map_description_width=400,scheduler.config.map_resolve_event_location=!0,scheduler.config.map_resolve_user_location=!0,scheduler.config.map_initial_position=new google.maps.LatLng(48.724,8.215),scheduler.config.map_error_position=new google.maps.LatLng(15,15),scheduler.config.map_infowindow_max_width=300,scheduler.config.map_type=google.maps.MapTypeId.ROADMAP,scheduler.config.map_zoom_after_resolve=15,scheduler.locale.labels.marker_geo_success="It seems you are here.",
scheduler.locale.labels.marker_geo_fail="Sorry, could not get your current position using geolocation.",scheduler.templates.marker_date=scheduler.date.date_to_str("%Y-%m-%d %H:%i"),scheduler.templates.marker_text=function(e,t,a){return"<div><b>"+a.text+"</b><br/><br/>"+(a.event_location||"")+"<br/><br/>"+scheduler.templates.marker_date(e)+" - "+scheduler.templates.marker_date(t)+"</div>"},scheduler.dblclick_dhx_map_area=function(){!this.config.readonly&&this.config.dblclick_create&&this.addEventNow({
start_date:scheduler._date,end_date:scheduler.date.add(scheduler._date,scheduler.config.time_step,"minute")})},scheduler.templates.map_time=function(e,t,a){return a._timed?this.day_date(a.start_date,a.end_date,a)+" "+this.event_date(e):scheduler.templates.day_date(e)+" &ndash; "+scheduler.templates.day_date(t)},scheduler.templates.map_text=function(e,t,a){return a.text},scheduler.date.map_start=function(e){return e},scheduler.date.add_map=function(e,t,a){return new Date(e.valueOf())},scheduler.templates.map_date=function(e,t,a){
return""},scheduler._latLngUpdate=!1,scheduler.attachEvent("onSchedulerReady",function(){function e(e){if(e){var t=scheduler.locale.labels;scheduler._els.dhx_cal_header[0].innerHTML="<div class='dhx_map_line' style='width: "+(scheduler.xy.map_date_width+scheduler.xy.map_description_width+2)+"px;' ><div class='headline_date' style='width: "+scheduler.xy.map_date_width+"px;'>"+t.date+"</div><div class='headline_description' style='width: "+scheduler.xy.map_description_width+"px;'>"+t.description+"</div></div>",
scheduler._table_view=!0,scheduler.set_sizes()}}function t(){scheduler._selected_event_id=null,scheduler.map._infowindow.close();var e=scheduler.map._markers;for(var t in e)e.hasOwnProperty(t)&&(e[t].setMap(null),delete scheduler.map._markers[t],scheduler.map._infowindows_content[t]&&delete scheduler.map._infowindows_content[t])}function a(){var e=scheduler.get_visible_events();e.sort(function(e,t){return e.start_date.valueOf()==t.start_date.valueOf()?e.id>t.id?1:-1:e.start_date>t.start_date?1:-1;
});for(var t=scheduler._waiAria.mapAttrString(),a="<div "+t+" class='dhx_map_area'>",r=0;r<e.length;r++){var i=e[r],n=i.id==scheduler._selected_event_id?"dhx_map_line highlight":"dhx_map_line",d=i.color?"background:"+i.color+";":"",l=i.textColor?"color:"+i.textColor+";":"",t=scheduler._waiAria.mapRowAttrString(i),o=scheduler._waiAria.mapDetailsBtnString();a+="<div "+t+" class='"+n+"' event_id='"+i.id+"' style='"+d+l+(i._text_style||"")+" width: "+(scheduler.xy.map_date_width+scheduler.xy.map_description_width+2)+"px;'><div class='dhx_map_event_time' style='width: "+scheduler.xy.map_date_width+"px;' >"+scheduler.templates.map_time(i.start_date,i.end_date,i)+"</div>",
a+="<div "+o+" class='dhx_event_icon icon_details'>&nbsp;</div>",a+="<div class='line_description' style='width:"+(scheduler.xy.map_description_width-scheduler.xy.map_icon_width)+"px;'>"+scheduler.templates.map_text(i.start_date,i.end_date,i)+"</div></div>"}a+="<div class='dhx_v_border' style='left: "+(scheduler.xy.map_date_width-2)+"px;'></div><div class='dhx_v_border_description'></div></div>",scheduler._els.dhx_cal_data[0].scrollTop=0,scheduler._els.dhx_cal_data[0].innerHTML=a,scheduler._els.dhx_cal_data[0].style.width=scheduler.xy.map_date_width+scheduler.xy.map_description_width+1+"px";
var s=scheduler._els.dhx_cal_data[0].firstChild.childNodes;scheduler._els.dhx_cal_date[0].innerHTML=scheduler.templates[scheduler._mode+"_date"](scheduler._min_date,scheduler._max_date,scheduler._mode),scheduler._rendered=[];for(var r=0;r<s.length-2;r++)scheduler._rendered[r]=s[r]}function r(e){var t=document.getElementById(e),a=scheduler._y-scheduler.xy.nav_height;0>a&&(a=0);var r=scheduler._x-scheduler.xy.map_date_width-scheduler.xy.map_description_width-1;0>r&&(r=0),t.style.height=a+"px",t.style.width=r+"px",
t.style.marginLeft=scheduler.xy.map_date_width+scheduler.xy.map_description_width+1+"px",t.style.marginTop=scheduler.xy.nav_height+2+"px"}scheduler._isMapPositionSet=!1;var i=document.createElement("div");i.className="dhx_map",i.id="dhx_gmap",i.style.dispay="none";var n=scheduler._obj;n.appendChild(i),scheduler._els.dhx_gmap=[],scheduler._els.dhx_gmap.push(i),r("dhx_gmap");var d={zoom:scheduler.config.map_inital_zoom||10,center:scheduler.config.map_initial_position,mapTypeId:scheduler.config.map_type||google.maps.MapTypeId.ROADMAP
},l=new google.maps.Map(document.getElementById("dhx_gmap"),d);l.disableDefaultUI=!1,l.disableDoubleClickZoom=!scheduler.config.readonly,google.maps.event.addListener(l,"dblclick",function(e){if(!scheduler.config.readonly&&scheduler.config.dblclick_create){var t=e.latLng;geocoder.geocode({latLng:t},function(e,a){a==google.maps.GeocoderStatus.OK&&(t=e[0].geometry.location,scheduler.addEventNow({lat:t.lat(),lng:t.lng(),event_location:e[0].formatted_address,start_date:scheduler._date,end_date:scheduler.date.add(scheduler._date,scheduler.config.time_step,"minute")
}))})}});var o={content:""};scheduler.config.map_infowindow_max_width&&(o.maxWidth=scheduler.config.map_infowindow_max_width),scheduler.map={_points:[],_markers:[],_infowindow:new google.maps.InfoWindow(o),_infowindows_content:[],_initialization_count:-1,_obj:l},geocoder=new google.maps.Geocoder,scheduler.config.map_resolve_user_location&&navigator.geolocation&&(scheduler._isMapPositionSet||navigator.geolocation.getCurrentPosition(function(e){var t=new google.maps.LatLng(e.coords.latitude,e.coords.longitude);
l.setCenter(t),l.setZoom(scheduler.config.map_zoom_after_resolve||10),scheduler.map._infowindow.setContent(scheduler.locale.labels.marker_geo_success),scheduler.map._infowindow.position=l.getCenter(),scheduler.map._infowindow.open(l),scheduler._isMapPositionSet=!0},function(){scheduler.map._infowindow.setContent(scheduler.locale.labels.marker_geo_fail),scheduler.map._infowindow.setPosition(l.getCenter()),scheduler.map._infowindow.open(l),scheduler._isMapPositionSet=!0})),google.maps.event.addListener(l,"resize",function(e){
i.style.zIndex="5",l.setZoom(l.getZoom())}),google.maps.event.addListener(l,"tilesloaded",function(e){i.style.zIndex="5"}),i.style.display="none";var s=scheduler.render_data;scheduler.render_data=function(e,t){if("map"!=this._mode)return s.apply(this,arguments);a();for(var r=scheduler.get_visible_events(),i=0;i<r.length;i++)scheduler.map._markers[r[i].id]||c(r[i],!1,!1)},scheduler.map_view=function(i){scheduler.map._initialization_count++;var n,d=scheduler._els.dhx_gmap[0];if(scheduler._els.dhx_cal_data[0].style.width=scheduler.xy.map_date_width+scheduler.xy.map_description_width+1+"px",
scheduler._min_date=scheduler.config.map_start||scheduler._currentDate(),scheduler._max_date=scheduler.config.map_end||scheduler.date.add(scheduler._currentDate(),1,"year"),scheduler._table_view=!0,e(i),i){t(),a(),d.style.display="block",r("dhx_gmap"),n=scheduler.map._obj.getCenter();for(var l=scheduler.get_visible_events(),o=0;o<l.length;o++)scheduler.map._markers[l[o].id]||c(l[o])}else d.style.display="none";google.maps.event.trigger(scheduler.map._obj,"resize"),0===scheduler.map._initialization_count&&n&&scheduler.map._obj.setCenter(n),
scheduler._selected_event_id&&_(scheduler._selected_event_id)};var _=function(e){scheduler.map._obj.setCenter(scheduler.map._points[e]),scheduler.callEvent("onClick",[e])},c=function(e,t,a){var r=scheduler.config.map_error_position;e.lat&&e.lng&&(r=new google.maps.LatLng(e.lat,e.lng));var i=scheduler.templates.marker_text(e.start_date,e.end_date,e);scheduler._new_event||(scheduler.map._infowindows_content[e.id]=i,scheduler.map._markers[e.id]&&scheduler.map._markers[e.id].setMap(null),scheduler.map._markers[e.id]=new google.maps.Marker({
position:r,map:scheduler.map._obj}),google.maps.event.addListener(scheduler.map._markers[e.id],"click",function(){scheduler.map._infowindow.setContent(scheduler.map._infowindows_content[e.id]),scheduler.map._infowindow.open(scheduler.map._obj,scheduler.map._markers[e.id]),scheduler._selected_event_id=e.id,scheduler.render_data()}),scheduler.map._points[e.id]=r,t&&scheduler.map._obj.setCenter(scheduler.map._points[e.id]),a&&scheduler.callEvent("onClick",[e.id]))};scheduler.attachEvent("onClick",function(e,t){
if("map"==this._mode){scheduler._selected_event_id=e;for(var a=0;a<scheduler._rendered.length;a++)scheduler._rendered[a].className="dhx_map_line",scheduler._rendered[a].getAttribute("event_id")==e&&(scheduler._rendered[a].className+=" highlight");scheduler.map._points[e]&&scheduler.map._markers[e]&&(scheduler.map._obj.setCenter(scheduler.map._points[e]),google.maps.event.trigger(scheduler.map._markers[e],"click"))}return!0});var u=function(e){e.event_location&&geocoder?geocoder.geocode({address:e.event_location,
language:scheduler.uid().toString()},function(t,a){var r={};a!=google.maps.GeocoderStatus.OK?(r=scheduler.callEvent("onLocationError",[e.id]),r&&r!==!0||(r=scheduler.config.map_error_position)):r=t[0].geometry.location,e.lat=r.lat(),e.lng=r.lng(),scheduler._selected_event_id=e.id,scheduler._latLngUpdate=!0,scheduler.callEvent("onEventChanged",[e.id,e]),c(e,!0,!0)}):c(e,!0,!0)},h=function(e){e.event_location&&geocoder&&geocoder.geocode({address:e.event_location,language:scheduler.uid().toString()},function(t,a){
var r={};a!=google.maps.GeocoderStatus.OK?(r=scheduler.callEvent("onLocationError",[e.id]),r&&r!==!0||(r=scheduler.config.map_error_position)):r=t[0].geometry.location,e.lat=r.lat(),e.lng=r.lng(),scheduler._latLngUpdate=!0,scheduler.callEvent("onEventChanged",[e.id,e])})},p=function(e,t,a,r){setTimeout(function(){var r=e.apply(t,a);return e=t=a=null,r},r||1)};scheduler.attachEvent("onEventChanged",function(e,t){if(this._latLngUpdate)this._latLngUpdate=!1;else{var a=scheduler.getEvent(e);a.start_date<scheduler._min_date&&a.end_date>scheduler._min_date||a.start_date<scheduler._max_date&&a.end_date>scheduler._max_date||a.start_date.valueOf()>=scheduler._min_date&&a.end_date.valueOf()<=scheduler._max_date?(scheduler.map._markers[e]&&scheduler.map._markers[e].setMap(null),
u(a)):(scheduler._selected_event_id=null,scheduler.map._infowindow.close(),scheduler.map._markers[e]&&scheduler.map._markers[e].setMap(null))}return!0}),scheduler.attachEvent("onEventIdChange",function(e,t){var a=scheduler.getEvent(t);return(a.start_date<scheduler._min_date&&a.end_date>scheduler._min_date||a.start_date<scheduler._max_date&&a.end_date>scheduler._max_date||a.start_date.valueOf()>=scheduler._min_date&&a.end_date.valueOf()<=scheduler._max_date)&&(scheduler.map._markers[e]&&(scheduler.map._markers[e].setMap(null),
delete scheduler.map._markers[e]),scheduler.map._infowindows_content[e]&&delete scheduler.map._infowindows_content[e],u(a)),!0}),scheduler.attachEvent("onEventAdded",function(e,t){return scheduler._dataprocessor||(t.start_date<scheduler._min_date&&t.end_date>scheduler._min_date||t.start_date<scheduler._max_date&&t.end_date>scheduler._max_date||t.start_date.valueOf()>=scheduler._min_date&&t.end_date.valueOf()<=scheduler._max_date)&&(scheduler.map._markers[e]&&scheduler.map._markers[e].setMap(null),
u(t)),!0}),scheduler.attachEvent("onBeforeEventDelete",function(e,t){return scheduler.map._markers[e]&&scheduler.map._markers[e].setMap(null),scheduler._selected_event_id=null,scheduler.map._infowindow.close(),!0}),scheduler._event_resolve_delay=1500,scheduler.attachEvent("onEventLoading",function(e){return scheduler.config.map_resolve_event_location&&e.event_location&&!e.lat&&!e.lng&&(scheduler._event_resolve_delay+=1500,p(h,this,[e],scheduler._event_resolve_delay)),!0}),scheduler.attachEvent("onEventCancel",function(e,t){
return t&&(scheduler.map._markers[e]&&scheduler.map._markers[e].setMap(null),scheduler.map._infowindow.close()),!0})});
//# sourceMappingURL=../sources/ext/dhtmlxscheduler_map_view.js.map