text: define(["dojo/_base/declare","dojo/_base/array","dojo/_base/connect","dojo/_base/html","dojo/_base/lang","dojo/dom","dojo/dom-attr","dojo/dom-class","dojo/keys","dojo/on","dojo/parser","dojox/widget/Toaster","dijit/_WidgetsInTemplateMixin","dijit/ConfirmDialog","dijit/form/Button","dijit/form/RadioButton","esri/Color","esri/graphic","esri/graphicsUtils","esri/undoManager","esri/dijit/editing/Add","esri/dijit/editing/Cut","esri/dijit/editing/Delete","esri/dijit/editing/Union","esri/dijit/editing/Update","esri/geometry/geometryEngine","esri/layers/FeatureLayer","esri/renderers/SimpleRenderer","esri/symbols/SimpleMarkerSymbol","esri/symbols/SimpleLineSymbol","esri/symbols/SimpleFillSymbol","esri/tasks/query","esri/toolbars/draw","esri/toolbars/edit","jimu/BaseWidget"],function(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,I){return a([I,m],{baseClass:"jimu-widget-polygoneditor",startup:function(){this.inherited(arguments),this.watch("_activeTool",function(a,b,c){var d=c?document.getElementById(c).title:null;document.getElementById("statusbar_tool").innerHTML=d?"Active tool: <strong>"+d+"</strong>":"Active tool: <strong>[none]</strong>"}),this.set("_activeTool",null),this.sq=new F,this.ds=new E(E.STYLE_SOLID,new D(D.STYLE_SOLID,new q([128,0,128]),2),new q([128,0,128,.3])),this.ss=new E(E.STYLE_SOLID,new D(D.STYLE_SOLID,new q([0,255,255]),3),new q([0,255,255,.3])),this.fs=new E(E.STYLE_SOLID,new D(D.STYLE_SOLID,new q([0,0,255]),2),new q([128,128,128,.3])),this.ls=new D(D.STYLE_SOLID,new q([0,0,255]),2),this.ms=new C(C.STYLE_CIRCLE,10,new D(D.STYLE_SOLID,new q([0,0,255]),1),new q([128,128,128,.3])),this.hs=new E(E.STYLE_SOLID,new D(D.STYLE_SOLID,new q([255,255,0]),3),new q([255,255,0,.3])),this.ws=new E(E.STYLE_SOLID,new D(D.STYLE_SOLID,new q([255,165,0]),3),new q([255,165,0,.3])),this.es=new E(E.STYLE_SOLID,new D(D.STYLE_SOLID,new q([255,0,0]),3),new q([255,0,0,.3])),this.d=new G(this.map,{showTooltips:!1}),this.d.setFillSymbol(this.fs),this.d.setLineSymbol(this.ls),this.d.on("draw-complete",e.hitch(this,this._ddcc)),this.e=new H(this.map),this.u=new t,c.connect(this.u,"onChange",e.hitch(this,function(){g.set("UNDO","disabled",!this.u.canUndo),g.set("REDO","disabled",!this.u.canRedo)})),this.f=new A("https://sampleserver6.arcgisonline.com/arcgis/rest/services/Military/FeatureServer/9",{mode:A.MODE_ONDEMAND,outFields:["*"]}),this.f.setRenderer(new B(this.ds)),this.f.setSelectionSymbol(this.ss),this.f.on("selection-complete",e.hitch(this,function(){this._uts()})),this.f.on("selection-clear",e.hitch(this,function(){this._uts()})),this.map.addLayer(this.f),this.map.enableSnapping({alwaysSnap:!1,layerInfos:[{layer:this.f,snapToEdge:!0,snapToPoint:!1,snapToVertex:!0}],snapKey:i.ALT,snapPointSymbol:this.ms,tolerance:15})},_sat:function(a){this._activeTool?a.currentTarget.id===this._activeTool?(this.d.deactivate(),this._scu(null),this.map.enablePan(),this.map.setInfoWindowOnClick(!0),this.set("_activeTool",null),h.remove(a.currentTarget,"active-tool")):(this.f.getSelectedFeatures().length>0&&"EDIT_RESHAPE"!==a.currentTarget.id&&this.f.getSelectedFeatures()[0].show(),this.map.graphics.clear(),this.e.deactivate(),h.remove(this._activeTool,"active-tool"),"EDIT_RESHAPE"===this._activeTool?g.set("EDIT_RESHAPE_SAVE","disabled",!0):"PASTE_COPY"===this._activeTool&&(g.set("PASTE_NEW","disabled",!0),g.set("PASTE_ADD","disabled",!0),g.set("PASTE_SUBTRACT","disabled",!0)),this.map.setInfoWindowOnClick(!1),this.map.disablePan(),this._scu(a.currentTarget.value),this.d.activate(G[a.currentTarget.value]),this.set("_activeTool",a.currentTarget.id),h.add(a.currentTarget.id,"active-tool")):(this.map.setInfoWindowOnClick(!1),this.map.disablePan(),this._scu(a.currentTarget.value),this.d.activate(G[a.currentTarget.value]),this.set("_activeTool",a.currentTarget.id),h.add(a.currentTarget.id,"active-tool"))},_uts:function(){var a=this.f.getSelectedFeatures().length;document.getElementById("statusbar_selection").innerHTML="Selected features: <strong>"+a+"</strong>",g.set("SELECTION_SUBTRACT","disabled",0===a),g.set("SELECTION_CLEAR","disabled",0===a),g.set("SELECTION_ZOOM","disabled",0===a),g.set("EDIT_REMOVE","disabled",0===a),g.set("EDIT_ADD","disabled",1!==a),g.set("EDIT_SUBTRACT","disabled",0===a),g.set("EDIT_RESHAPE","disabled",1!==a),g.set("EDIT_UNION","disabled",0===a),g.set("EDIT_CUT","disabled",1!==a),g.set("PASTE_COPY","disabled",1!==a),this._activeTool&&g.get(this._activeTool,"disabled")===!0&&(this.map.graphics.clear(),this.d.deactivate(),this.e.deactivate(),this._scu(null),this.map.enablePan(),this.map.setInfoWindowOnClick(!0),h.remove(this._activeTool,"active-tool"),"EDIT_RESHAPE"===this._activeTool?g.set("EDIT_RESHAPE_SAVE","disabled",!0):"PASTE_COPY"===this._activeTool&&(g.set("PASTE_NEW","disabled",!0),g.set("PASTE_ADD","disabled",!0),g.set("PASTE_SUBTRACT","disabled",!0)),this.set("_activeTool",null))},_scu:function(a){switch(a){case"RECTANGLE":this.map.setMapCursor("crosshair");break;case"POINT":this.map.setMapCursor("pointer");break;default:this.map.setMapCursor("auto")}},_cs:function(a){this.f.getSelectedFeatures().forEach(function(a){a.visible!==!0&&a.show()}),this.f.clearSelection()},_zts:function(a){this.map.setExtent(s.graphicsExtent(this.f.getSelectedFeatures()).expand(2))},_uuu:function(a){this.u.undo()},_rrr:function(a){this.u.redo()},_ddcc:function(a){switch(this._activeTool){case"SELECTION_NEW":this.sq.geometry=a.geometry,this.f.selectFeatures(this.sq,A.SELECTION_NEW);break;case"SELECTION_ADD":this.map.graphics.add(new r(a.geometry,this.ms,null,null)),setTimeout(e.hitch(this,function(){this.map.graphics.remove(this.map.graphics.graphics[this.map.graphics.graphics.length-1])}),500),this.sq.geometry=a.geometry,this.f.selectFeatures(this.sq,A.SELECTION_ADD);break;case"SELECTION_SUBTRACT":this.map.graphics.add(new r(a.geometry,this.ms,null,null)),setTimeout(e.hitch(this,function(){this.map.graphics.remove(this.map.graphics.graphics[this.map.graphics.graphics.length-1])}),500),this.sq.geometry=a.geometry,this.f.selectFeatures(this.sq,A.SELECTION_SUBTRACT);break;case"EDIT_CREATE":this.sq.geometry=a.geometry,this.f.queryFeatures(this.sq,e.hitch(this,function(b){var c=a.geometry;if(b.features.length>0){for(var d=z.difference(c,b.features[0].geometry),f=1;f<b.features.length&&null!==d;f++)d=z.difference(d,b.features[f].geometry);if(null===d)return this._ssmm("Edit operation rejected.<br><br>Polygons cannot be completely covered by other polygons.","error"),this.map.graphics.add(new r(a.geometry,this.es,null)),void setTimeout(e.hitch(this,function(){this.map.graphics.clear()}),2e3);if(d.rings.length>1)return this._ssmm("Edit operation rejected.<br><br>Polygons cannot be multipart or contain holes (interior rings).","error"),this.map.graphics.add(new r(d,this.es,null)),void setTimeout(e.hitch(this,function(){this.map.graphics.clear()}),2e3);c=d,this._ssmm("Edit operation applied with corrections.<br><br>Polygons must not overlap. Overlapping area has been removed.","warning"),this.map.graphics.add(new r(z.difference(a.geometry,d),this.ws,null)),setTimeout(e.hitch(this,function(){this.map.graphics.clear()}),2e3)}var g=new r(c,null,null);this.f.applyEdits([g],null,null,e.hitch(this,function(){var a=new u({featureLayer:this.f,addedGraphics:[g]});this.u.add(a),0===b.features.length&&this._ssmm("Edit operation applied successfully.","message")}))}));break;case"EDIT_ADD":this.sq.geometry=a.geometry,this.f.queryFeatures(this.sq,e.hitch(this,function(b){var c=b.features.some(e.hitch(this,function(a){return a.attributes.objectid===this.f.getSelectedFeatures()[0].attributes.objectid}));if(c!==!0)return this._ssmm("Edit operation rejected.<br><br>The area drawn must overlap with the selected feature.","error"),this.map.graphics.add(new r(a.geometry,this.es,null)),void setTimeout(e.hitch(this,function(){this.map.graphics.clear()}),2e3);var d=new r(this.f.getSelectedFeatures()[0].toJson()),f=z.union([d.geometry,a.geometry]),g=b.features.filter(function(a){return a.attributes.objectid!==d.attributes.objectid});if(g.length>0){for(var h=z.difference(f,g[0].geometry),i=1;i<g.length;i++)h=z.difference(h,g[i].geometry);if(h.rings.length>1)return this._ssmm("Edit operation rejected.<br><br>Polygons cannot be multipart or contain holes (interior rings).","error"),this.map.graphics.add(new r(h,this.es,null)),void setTimeout(e.hitch(this,function(){this.map.graphics.clear()}),2e3);f=h,this._ssmm("Edit operation applied with corrections.<br><br>Polygons must not overlap. Overlapping area has been removed.","warning"),this.map.graphics.add(new r(z.difference(a.geometry,h),this.ws,null)),setTimeout(e.hitch(this,function(){this.map.graphics.clear()}),2e3)}var j=new r(d.toJson()).setGeometry(f);this.f.applyEdits(null,[j],null,e.hitch(this,function(){var a=new y({featureLayer:this.f,preUpdatedGraphics:[d],postUpdatedGraphics:[j]});this.u.add(a),0===g.length&&this._ssmm("Edit operation applied successfully.","message")}))}));break;case"EDIT_SUBTRACT":this.sq.geometry=a.geometry;var b=e.clone(this.sq);b.where="objectid in ("+this.f.getSelectedFeatures().map(function(a){return a.attributes.objectid}).join()+")",this.f.queryFeatures(b,e.hitch(this,function(b){if(0===b.features.length)return this._ssmm("Edit operation rejected.<br><br>The area drawn must overlap with the selected feature(s).","error"),this.map.graphics.add(new r(a.geometry,this.es,null)),void setTimeout(e.hitch(this,function(){this.map.graphics.clear()}),2e3);var h,i,c=[],d=[],f=[],g=[];return b.features.forEach(function(b){h=new r(b.toJson()),i=z.difference(h.geometry,a.geometry),null==i?(f.indexOf("Original polygon was completely consumed.")===-1&&f.push("Original polygon was completely consumed."),g.push(h.geometry)):i.rings.length>1?(f.indexOf("Polygons cannot be multipart or contain holes (interior rings).")===-1&&f.push("Polygons cannot be multipart or contain holes (interior rings)."),g.push(i)):(c.push(h),d.push(new r(h.toJson()).setGeometry(i)))}),0===c.length||0===d.length?(this._ssmm("Edit operation rejected.<br><br>"+f.join("<br><br>"),"error"),g.forEach(e.hitch(this,function(a){this.map.graphics.add(new r(a,this.es,null))})),void setTimeout(e.hitch(this,function(){this.map.graphics.clear()}),2e3)):void this.f.applyEdits(null,d,null,e.hitch(this,function(){var a=new y({featureLayer:this.f,preUpdatedGraphics:c,postUpdatedGraphics:d});this.u.add(a),0===f.length&&0===g.length?this._ssmm("Edit operation applied successfully.","message"):(this._ssmm("Edit operation applied with corrections.<br><br>"+f.join("<br><br>"),"warning"),g.forEach(e.hitch(this,function(a){this.map.graphics.add(new r(a,this.ws,null))})),setTimeout(e.hitch(this,function(){this.map.graphics.clear()}),2e3))}))}));break;case"EDIT_CUT":var c=new r(this.f.getSelectedFeatures()[0].toJson()),d=z.intersects(a.geometry,c.geometry);if(d!==!0)return this._ssmm("Edit operation rejected.<br><br>The cutting polyline must intersect the target polygon.","error"),this.map.graphics.add(new r(a.geometry,this.es,null)),this.map.graphics.add(c.setSymbol(this.es)),void setTimeout(e.hitch(this,function(){this.map.graphics.clear()}),2e3);var f=z.cut(c.geometry,a.geometry),g=f.filter(function(a){return a.rings.length>1});if(g.length>0)return this._ssmm("Edit operation rejected.<br><br>Polygons cannot be multipart or contain holes (interior rings).","error"),this.map.graphics.add(new r(g[0],this.es,null)),void setTimeout(e.hitch(this,function(){this.map.graphics.clear()}),2e3);var h=new r(c.toJson()).setGeometry(f[0]),i=new r(f[1],null,null);this.f.applyEdits([i],[h],null,e.hitch(this,function(){var a=new v({featureLayer:this.f,preUpdatedGraphics:[c],postUpdatedGraphics:[h],addedGraphics:[i]});this.u.add(a),this._ssmm("Edit operation applied successfully.","message")}))}},_aet:function(a){var b=H.EDIT_VERTICES|H.MOVE|H.SCALE|H.ROTATE,c={allowAddVertices:!0,allowDeleteVertices:!0,uniformScaling:!0},d=new r(this.f.getSelectedFeatures()[0].toJson()).setSymbol(this.ss);this.map.graphics.clear(),this.map.graphics.add(d),"EDIT_RESHAPE"===a.currentTarget.id&&this.f.getSelectedFeatures()[0].hide(),this._activeTool?a.currentTarget.id===this._activeTool?("EDIT_RESHAPE"===a.currentTarget.id&&this.f.getSelectedFeatures()[0].show(),this.map.graphics.clear(),this.e.deactivate(),this._scu(null),this.map.enablePan(),this.map.setInfoWindowOnClick(!0),this.set("_activeTool",null),h.remove(a.currentTarget,"active-tool"),"EDIT_RESHAPE"===a.currentTarget.id?g.set("EDIT_RESHAPE_SAVE","disabled",!0):"PASTE_COPY"===a.currentTarget.id&&(g.set("PASTE_NEW","disabled",!0),g.set("PASTE_ADD","disabled",!0),g.set("PASTE_SUBTRACT","disabled",!0))):("EDIT_RESHAPE"!==a.currentTarget.id&&this.f.getSelectedFeatures()[0].show(),this.e.deactivate(),this.d.deactivate(),h.remove(this._activeTool,"active-tool"),"EDIT_RESHAPE"===this._activeTool?g.set("EDIT_RESHAPE_SAVE","disabled",!0):"PASTE_COPY"===this._activeTool&&(g.set("PASTE_NEW","disabled",!0),g.set("PASTE_ADD","disabled",!0),g.set("PASTE_SUBTRACT","disabled",!0)),this.map.setInfoWindowOnClick(!1),this.map.disablePan(),this._scu(null),this.e.activate(b,d,c),this.set("_activeTool",a.currentTarget.id),h.add(a.currentTarget.id,"active-tool"),"EDIT_RESHAPE"===a.currentTarget.id?g.set("EDIT_RESHAPE_SAVE","disabled",!1):"PASTE_COPY"===a.currentTarget.id&&(g.set("PASTE_NEW","disabled",!1),g.set("PASTE_ADD","disabled",!1),g.set("PASTE_SUBTRACT","disabled",!1))):(this.map.setInfoWindowOnClick(!1),this.map.disablePan(),this._scu(null),this.e.activate(b,d,c),this.set("_activeTool",a.currentTarget.id),h.add(a.currentTarget.id,"active-tool"),"EDIT_RESHAPE"===a.currentTarget.id?g.set("EDIT_RESHAPE_SAVE","disabled",!1):"PASTE_COPY"===a.currentTarget.id&&(g.set("PASTE_NEW","disabled",!1),g.set("PASTE_ADD","disabled",!1),g.set("PASTE_SUBTRACT","disabled",!1)))},_srh:function(a){if(this.e.getCurrentState().isModified===!0){var b=new r(this.f.getSelectedFeatures()[0].toJson()),c=this.e.getCurrentState().graphic;this.sq.geometry=c.geometry,this.f.queryFeatures(this.sq,e.hitch(this,function(a){var d=a.features.filter(function(a){return a.attributes.objectid!==c.attributes.objectid});if(d.length>0){for(var f=z.difference(c.geometry,d[0].geometry),g=1;g<d.length&&null!==f;g++)f=z.difference(f,d[g].geometry);if(null===f)return this._ssmm("Edit operation rejected.<br><br>Polygons cannot be completely covered by other polygons.","error"),this.map.graphics.add(new r(c.geometry,this.es,null)),void setTimeout(e.hitch(this,function(){this.f.getSelectedFeatures()[0].show(),this.map.graphics.clear()}),2e3);if(f.rings.length>1)return this._ssmm("Edit operation rejected.<br><br>Polygons cannot be multipart or contain holes (interior rings).","error"),this.map.graphics.add(new r(f,this.es,null)),void setTimeout(e.hitch(this,function(){this.f.getSelectedFeatures()[0].show(),this.map.graphics.clear()}),2e3);this._ssmm("Edit operation applied with corrections.<br><br>Polygons must not overlap. Overlapping area has been removed.","warning"),this.map.graphics.add(new r(z.difference(c.geometry,f),this.ws,null)),setTimeout(e.hitch(this,function(){this.map.graphics.clear()}),2e3),c=c.setGeometry(f)}this.f.applyEdits(null,[c],null,e.hitch(this,function(){var a=new y({featureLayer:this.f,preUpdatedGraphics:[b],postUpdatedGraphics:[c]});this.u.add(a),this.f.getSelectedFeatures()[0].show(),0===d.length&&(this.map.graphics.clear(),this._ssmm("Edit operation applied successfully.","message"))}))}))}this._drt()},_rmf:function(a){this.confirmDialog=new n({title:"Remove feature(s)",content:1===this.f.getSelectedFeatures().length?"1 feature is selected.<br>Are you sure you want to remove it?":this.f.getSelectedFeatures().length+" features are selected.<br>Are you sure you want to remove them?",closable:!1}),this.confirmDialog.on("execute",e.hitch(this,function(){var a=this.f.getSelectedFeatures();this.f.applyEdits(null,null,this.f.getSelectedFeatures(),e.hitch(this,function(){var b=new w({featureLayer:this.f,deletedGraphics:a});this.u.add(b),this._ssmm("Edit operation applied successfully.","message")})),this.confirmDialog.destroy()})),this.confirmDialog.on("cancel",e.hitch(this,function(a){this.confirmDialog.destroy()})),this.confirmDialog.show()},_mgf:function(a){var b=this.f.getSelectedFeatures().map(function(a){return new r(a.toJson()).setSymbol(null)}),c=z.union(b.map(function(a){return a.geometry}));if(c.rings.length>1)return this._ssmm("Edit operation rejected.<br><br>Polygons cannot be multipart or contain holes (interior rings).","error"),this.map.graphics.add(new r(c,this.es,null)),void setTimeout(e.hitch(this,function(){this.map.graphics.clear()}),2e3);var d=new r(b[0].toJson()).setGeometry(c);this.f.applyEdits(null,[d],b.slice(1),e.hitch(this,function(){var a=new x({featureLayer:this.f,preUpdatedGraphics:[b[0]],postUpdatedGraphics:[d],deletedGraphics:b.slice(1)});this.u.add(a),this._ssmm("Edit operation applied successfully.","message")}))},_pan:function(a){var b=this.e.getCurrentState().graphic.geometry;this.sq.geometry=b,this.f.queryFeatures(this.sq,e.hitch(this,function(a){if(a.features.length>0){for(var c=z.difference(b,a.features[0].geometry),d=1;d<a.features.length&&null!==c;d++)c=z.difference(c,a.features[d].geometry);if(null===c)return this._ssmm("Edit operation rejected.<br><br>Polygons cannot be completely covered by other polygons.","error"),this.map.graphics.add(new r(b,this.es,null)),void setTimeout(e.hitch(this,function(){this.map.graphics.clear()}),2e3);if(c.rings.length>1)return this._ssmm("Edit operation rejected.<br><br>Polygons cannot be multipart or contain holes (interior rings).","error"),this.map.graphics.add(new r(c,this.es,null)),void setTimeout(e.hitch(this,function(){this.map.graphics.clear()}),2e3);this._ssmm("Edit operation applied with corrections.<br><br>Polygons must not overlap. Overlapping area has been removed.","warning"),this.map.graphics.add(new r(z.difference(b,c),this.ws,null)),setTimeout(e.hitch(this,function(){this.map.graphics.clear()}),2e3),b=c}var f=new r(b,null,null);this.f.applyEdits([f],null,null,e.hitch(this,function(){var b=new u({featureLayer:this.f,addedGraphics:[f]});this.u.add(b),0===a.features.length&&(this.map.graphics.clear(),this._ssmm("Edit operation applied successfully.","message"))}))})),this._dct()},_paa:function(a){var b=this.e.getCurrentState().graphic.geometry;this.sq.geometry=b,this.f.queryFeatures(this.sq,e.hitch(this,function(a){if(0===a.features.length)return this._ssmm("Edit operation rejected.<br><br>The area drawn must overlap with another feature.","error"),this.map.graphics.add(new r(b,this.es,null)),void setTimeout(e.hitch(this,function(){this.map.graphics.clear()}),2e3);if(1===a.features.length){var c=new r(a.features[0].toJson()),d=z.union([c.geometry,b]),g=new r(c.toJson()).setGeometry(d);this.f.applyEdits(null,[g],null,e.hitch(this,function(){var a=new y({featureLayer:this.f,preUpdatedGraphics:[c],postUpdatedGraphics:[g]});this.u.add(a),this.map.graphics.clear(),this._ssmm("Edit operation applied successfully.","message")}))}else if(a.features.length>1){for(var h="The area to be pasted intersects with more than one feature.<br>Please select the target feature for this operation.<br>Hover over an option to see its geometry highlighted on the map.<br><br><br><form id='PASTE_ADD_FORM'>",i=0;i<a.features.length;i++)h+=0===i?"<div id='PASTE_ADD_"+i+"' style='display:table;'><input type='radio' data-dojo-type='dijit/form/RadioButton' name='PasteAsAdd' value='"+i+"' checked='checked' /><label>"+a.features[i].attributes.objectid+"</label></div><br><br>":"<div id='PASTE_ADD_"+i+"' style='display:table;'><input type='radio' data-dojo-type='dijit/form/RadioButton' name='PasteAsAdd' value='"+i+"' /><label>"+a.features[i].attributes.objectid+"</label></div><br><br>";h+="</form>",this.confirmDialog=new n({title:"Paste as add",content:h,closable:!1}),this.confirmDialog.on("execute",e.hitch(this,function(c){var d=document.getElementById("PASTE_ADD_FORM").elements.namedItem("PasteAsAdd").value,f=new r(a.features[d].toJson()),g=z.union([f.geometry,b]),h=a.features.filter(function(a){return a.attributes.objectid!==f.attributes.objectid});if(h.length>0){for(var i=z.difference(g,h[0].geometry),j=1;j<h.length;j++)i=z.difference(i,h[j].geometry);if(i.rings.length>1)return this._ssmm("Edit operation rejected.<br><br>Polygons cannot be multipart or contain holes (interior rings).","error"),this.map.graphics.add(new r(i,this.es,null)),setTimeout(e.hitch(this,function(){this.map.graphics.clear()}),2e3),void this.confirmDialog.destroy();g=i,this._ssmm("Edit operation applied with corrections.<br><br>Polygons must not overlap. Overlapping area has been removed.","warning"),this.map.graphics.add(new r(z.difference(b,i),this.ws,null)),setTimeout(e.hitch(this,function(){this.map.graphics.clear()}),2e3)}var k=new r(f.toJson()).setGeometry(g);this.f.applyEdits(null,[k],null,e.hitch(this,function(){var a=new y({featureLayer:this.f,preUpdatedGraphics:[f],postUpdatedGraphics:[k]});this.u.add(a),0===h.length&&(this.map.graphics.clear(),this._ssmm("Edit operation applied successfully.","message"))})),this.confirmDialog.destroy()})),this.confirmDialog.on("cancel",e.hitch(this,function(a){this.confirmDialog.destroy()})),this.confirmDialog.show();for(var i=0;i<a.features.length;i++)j(f.byId("PASTE_ADD_"+i),"mouseover",e.hitch(this,function(b){var c=b.currentTarget.firstChild.firstChild.value,d=new r(a.features[c].geometry,this.hs,null,null);this.map.graphics.add(d)})),j(f.byId("PASTE_ADD_"+i),"mouseout",e.hitch(this,function(a){this.map.graphics.graphics.length>1&&this.map.graphics.remove(this.map.graphics.graphics[this.map.graphics.graphics.length-1])}))}})),this._dct()},_pas:function(a){var b=this.e.getCurrentState().graphic.geometry;this.sq.geometry=b,this.f.queryFeatures(this.sq,e.hitch(this,function(a){if(0===a.features.length)return this._ssmm("Edit operation rejected.<br><br>The area drawn must overlap with another feature.","error"),this.map.graphics.add(new r(b,this.es,null)),void setTimeout(e.hitch(this,function(){this.map.graphics.clear()}),2e3);if(1===a.features.length){var c=new r(a.features[0].toJson()),d=z.difference(c.geometry,b);if(null==d)return this._ssmm("Edit operation rejected.<br><br>Original polygon was completely consumed.","error"),this.map.graphics.add(new r(c.geometry,this.es,null)),void setTimeout(e.hitch(this,function(){this.map.graphics.clear()}),2e3);if(d.rings.length>1)return this._ssmm("Edit operation rejected.<br><br>Polygons cannot be multipart or contain holes (interior rings).","error"),this.map.graphics.add(new r(d,this.es,null)),void setTimeout(e.hitch(this,function(){this.map.graphics.clear()}),2e3);var g=new r(c.toJson()).setGeometry(d);this.f.applyEdits(null,[g],null,e.hitch(this,function(){var a=new y({featureLayer:this.f,preUpdatedGraphics:[c],postUpdatedGraphics:[g]});this.u.add(a),this.map.graphics.clear(),this._ssmm("Edit operation applied successfully.","message")}))}else if(a.features.length>1){for(var h="The area to be pasted intersects with more than one feature.<br>Please select the target feature for this operation.<br>Hover over an option to see its geometry highlighted on the map.<br><br><br><form id='PASTE_SUBTRACT_FORM'>",i=0;i<a.features.length;i++)h+=0===i?"<div id='PASTE_SUBTRACT_"+i+"' style='display:table;'><input type='radio' data-dojo-type='dijit/form/RadioButton' name='PasteAsSubtract' value='"+i+"' checked='checked' /><label>"+a.features[i].attributes.objectid+"</label></div><br><br>":"<div id='PASTE_SUBTRACT_"+i+"' style='display:table;'><input type='radio' data-dojo-type='dijit/form/RadioButton' name='PasteAsSubtract' value='"+i+"' /><label>"+a.features[i].attributes.objectid+"</label></div><br><br>";h+="</form>",this.confirmDialog=new n({title:"Paste as subtract",content:h,closable:!1}),this.confirmDialog.on("execute",e.hitch(this,function(c){var d=document.getElementById("PASTE_SUBTRACT_FORM").elements.namedItem("PasteAsSubtract").value,f=new r(a.features[d].toJson()),g=z.difference(f.geometry,b);if(null==g)return this._ssmm("Edit operation rejected.<br><br>Original polygon was completely consumed.","error"),this.map.graphics.add(new r(f.geometry,this.es,null)),setTimeout(e.hitch(this,function(){this.map.graphics.clear()}),2e3),void this.confirmDialog.destroy();if(g.rings.length>1)return this._ssmm("Edit operation rejected.<br><br>Polygons cannot be multipart or contain holes (interior rings).","error"),this.map.graphics.add(new r(g,this.es,null)),setTimeout(e.hitch(this,function(){this.map.graphics.clear()}),2e3),void this.confirmDialog.destroy();var h=new r(f.toJson()).setGeometry(g);this.f.applyEdits(null,[h],null,e.hitch(this,function(){var a=new y({featureLayer:this.f,preUpdatedGraphics:[f],postUpdatedGraphics:[h]});this.u.add(a),this.map.graphics.clear(),this._ssmm("Edit operation applied successfully.","message")})),this.confirmDialog.destroy()})),this.confirmDialog.on("cancel",e.hitch(this,function(a){this.confirmDialog.destroy()})),this.confirmDialog.show();for(var i=0;i<a.features.length;i++)j(f.byId("PASTE_SUBTRACT_"+i),"mouseover",e.hitch(this,function(b){var c=b.currentTarget.firstChild.firstChild.value,d=new r(a.features[c].geometry,this.hs,null,null);this.map.graphics.add(d)})),j(f.byId("PASTE_SUBTRACT_"+i),"mouseout",e.hitch(this,function(a){this.map.graphics.graphics.length>1&&this.map.graphics.remove(this.map.graphics.graphics[this.map.graphics.graphics.length-1])}))}})),this._dct()},_drt:function(){this.e.deactivate(),this._scu(null),this.map.enablePan(),this.map.setInfoWindowOnClick(!0),this.set("_activeTool",null),h.remove("EDIT_RESHAPE","active-tool"),g.set("EDIT_RESHAPE_SAVE","disabled",!0)},_dct:function(){this.e.deactivate(),this._scu(null),this.map.enablePan(),this.map.setInfoWindowOnClick(!0),this.set("_activeTool",null),h.remove("PASTE_COPY","active-tool"),g.set("PASTE_NEW","disabled",!0),g.set("PASTE_ADD","disabled",!0),g.set("PASTE_SUBTRACT","disabled",!0)},_ssmm:function(a,b){this.t.setContent(a,b),this.t.show()}})});
  