/*
	Copyright (c) 2004-2011, The Dojo Foundation All Rights Reserved.
	Available via Academic Free License >= 2.1 OR the modified BSD license.
	see: http://dojotoolkit.org/license for details
*/


window[esri._dojoScopeName||"dojo"]._xdResourceLoaded(function(_1,_2,_3){return {depends:[["provide","dojox.sketch.UndoStack"],["require","dojox.xml.DomParser"]],defineResource:function(_4,_5,_6){if(!_4._hasResource["dojox.sketch.UndoStack"]){_4._hasResource["dojox.sketch.UndoStack"]=true;_4.provide("dojox.sketch.UndoStack");_4.require("dojox.xml.DomParser");(function(){var ta=_6.sketch;ta.CommandTypes={Create:"Create",Move:"Move",Modify:"Modify",Delete:"Delete",Convert:"Convert"};_4.declare("dojox.sketch.UndoStack",null,{constructor:function(_7){this.figure=_7;this._steps=[];this._undoedSteps=[];},apply:function(_8,_9,to){if(!_9&&!to&&_8.fullText){this.figure.setValue(_8.fullText);return;}var _a=_9.shapeText;var _b=to.shapeText;if(_a.length==0&&_b.length==0){return;}if(_a.length==0){var o=_6.xml.DomParser.parse(_b).documentElement;var a=this.figure._loadAnnotation(o);if(a){this.figure._add(a);}return;}if(_b.length==0){var _c=this.figure.getAnnotator(_9.shapeId);this.figure._delete([_c],true);return;}var _d=this.figure.getAnnotator(to.shapeId);var no=_6.xml.DomParser.parse(_b).documentElement;_d.draw(no);this.figure.select(_d);return;},add:function(_e,_f,_10){var id=_f?_f.id:"";var _11=_f?_f.serialize():"";if(_e==ta.CommandTypes.Delete){_11="";}var _12={cmdname:_e,before:{shapeId:id,shapeText:_10||""},after:{shapeId:id,shapeText:_11}};this._steps.push(_12);this._undoedSteps=[];},destroy:function(){},undo:function(){var _13=this._steps.pop();if(_13){this._undoedSteps.push(_13);this.apply(_13,_13.after,_13.before);}},redo:function(){var _14=this._undoedSteps.pop();if(_14){this._steps.push(_14);this.apply(_14,_14.before,_14.after);}}});})();}}};});