var wcs_vue_modal=new Vue({el:"#wcs-vue-modal",template:"#wcs_templates_modal",data:function(){return{visible:!1,loading:!0,data:{},options:{},events:{},taxonomies:{}}},watch:{visible:function(e){e?document.body.className+=" wcs_modal--opened":document.body.className=document.body.className.replace("wcs_modal--opened","")}},updated:function(){var e=this;if(!e.loading&&void 0!==e.data.start&&void 0!==e.data.map){var t=[];"light"===e.data.map.theme&&(t=[{featureType:"administrative",elementType:"all",stylers:[{visibility:"on"},{saturation:-100},{lightness:20}]},{featureType:"road",elementType:"all",stylers:[{visibility:"on"},{saturation:-100},{lightness:40}]},{featureType:"water",elementType:"all",stylers:[{visibility:"on"},{saturation:-10},{lightness:30}]},{featureType:"landscape.man_made",elementType:"all",stylers:[{visibility:"simplified"},{saturation:-60},{lightness:10}]},{featureType:"landscape.natural",elementType:"all",stylers:[{visibility:"simplified"},{saturation:-60},{lightness:60}]},{featureType:"poi",elementType:"all",stylers:[{visibility:"off"},{saturation:-100},{lightness:60}]},{featureType:"transit",elementType:"all",stylers:[{visibility:"off"},{saturation:-100},{lightness:60}]}]),"dark"===e.data.map.theme&&(t=[{featureType:"all",elementType:"labels.text.fill",stylers:[{saturation:36},{color:"#000000"},{lightness:40}]},{featureType:"all",elementType:"labels.text.stroke",stylers:[{visibility:"on"},{color:"#000000"},{lightness:16}]},{featureType:"all",elementType:"labels.icon",stylers:[{visibility:"off"}]},{featureType:"administrative",elementType:"geometry.fill",stylers:[{color:"#000000"},{lightness:20}]},{featureType:"administrative",elementType:"geometry.stroke",stylers:[{color:"#000000"},{lightness:17},{weight:1.2}]},{featureType:"landscape",elementType:"geometry",stylers:[{color:"#000000"},{lightness:20}]},{featureType:"poi",elementType:"geometry",stylers:[{color:"#000000"},{lightness:21}]},{featureType:"road.highway",elementType:"geometry.fill",stylers:[{color:"#000000"},{lightness:17}]},{featureType:"road.highway",elementType:"geometry.stroke",stylers:[{color:"#000000"},{lightness:29},{weight:.2}]},{featureType:"road.arterial",elementType:"geometry",stylers:[{color:"#000000"},{lightness:18}]},{featureType:"road.local",elementType:"geometry",stylers:[{color:"#000000"},{lightness:16}]},{featureType:"transit",elementType:"geometry",stylers:[{color:"#000000"},{lightness:19}]},{featureType:"water",elementType:"geometry",stylers:[{color:"#000000"},{lightness:17}]}]),jQuery(".wcs-map",e.$el).width("100%").height("100%").gmap3({center:[e.data.map.latitude,e.data.map.longitude],zoom:parseInt(e.data.map.zoom),disableDefaultUI:!0,draggable:!0,mapTypeId:google.maps.MapTypeId[e.data.map.type.toUpperCase()],mapTypeControl:!1,mapTypeControlOptions:{},navigationControl:!0,scrollwheel:!1,streetViewControl:!0,styles:t}).marker([{position:[e.data.map.latitude,e.data.map.longitude]}])}},methods:{openModal:function(e,t){var s=this;this.data=e,this.options=t,this.visible||(this.visible=!0),this.loading=!0,void 0!==e.start?void 0===this.events[e.id]?this.getClass(e.id):(this.data.content=this.events[e.id].content,this.data.image=this.events[e.id].image,this.loading=!this.loading):void 0===this.taxonomies[e.id]?this.getTaxonomy(e.id):(this.data.content=this.taxonomies[e.id],this.loading=!this.loading)},closeModal:function(e){var t=e.target.className.split(" ");(t.indexOf("wcs-modal")>=0||t.indexOf("wcs-modal__close")>=0)&&(e.preventDefault(),this.visible=!this.visible,this.loading=!0)},getClass:function(e){this.$http.get(ajaxurl,{params:{action:"wcs_get_class_json",id:this.data.id}}).then(this.responseSuccessClass,this.responseError)},getTaxonomy:function(e){this.$http.get(ajaxurl,{params:{action:"wcs_get_taxonomy_json",id:this.data.id}}).then(this.responseSuccessTaxonomy,this.responseError)},responseSuccessClass:function(e){0!==e.body&&void 0!==e.body.id?(this.events[e.body.id]=e.body,this.data.content=e.body.content,this.data.image=e.body.image,this.data.map=e.body.map,this.loading=!this.loading):this.visible=!this.loading},responseSuccessTaxonomy:function(e){0!==e.body&&void 0!==e.body.id?(this.taxonomies[e.body.id]=e.body.content,this.data.content=e.body.content,this.loading=!this.loading):this.visible=!this.visible},responseError:function(e){this.visible=!this.visible},filter_var:function(e){return-1!==["1","true","on","yes",!0,1].indexOf(e)}},computed:{css_classes:function(){var e=["wcs-modal-container"];return this.filter_var(this.options.show_modal)&&e.push("wcs-modal--light"),e.push("wcs-modal--"+this.type),e.join(" ")},type:function(){var e="normal";return e=void 0!==this.data.start?1===parseInt(this.options.modal)?"large":e:"taxonomy"}}});