angular.module("c8y.smartRules").directive("smartRuleParamInputGeofence",function(){return{require:"smartRuleParamInput",scope:{rule:"=",param:"="},restrict:"E",templateUrl:":::PLUGIN_PATH:::/views/paramInputGeofence.html",controller:["$scope","c8yGeo","geofenceSvc",function(t,e,o){var n={type:"polygon",stroke:!0,weight:1,color:"#2e3974",fillColor:"#2e3974",latlngs:[]},r=new e.Bounds,l={center:{},bounds:r.get(),paths:{geofence:n},defaults:{zoomControl:!1,scrollWheelZoom:!1,tileLayerOptions:{referrerPolicy:"strict-origin-when-cross-origin"}}};function a(e){t.rule.config[t.param.property]=e,n.latlngs.length=0,_.forEach(e,function(e){n.latlngs.push(e),r.add(e)}),l.bounds=r.get(),0<n.latlngs.length?l.paths={geofence:n}:l.paths={}}t.map=l,t.editGeofence=function(){o.showEditUI(n.latlngs).then(function(e){a(e)})},a(t.rule.config[t.param.property])}]}});