/* COPYRIGHT Esri - https://js.arcgis.com/5.1.2/LICENSE.txt */
import{clone as e}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{isRelativeVertexSpace as t}from"../../../../geometry/support/meshVertexSpaceUtils.js";function r(e){return null!=e&&"mesh"===e.type?o(e):n(e)}function o(e){return t(e.vertexSpace)?i(e,e.transform,e.vertexSpace):l(e)}function n(e){let t=e,r=null;return{undo(e){r=e.geometry,e.geometry=t},redo(e){t=e.geometry,e.geometry=r}}}function i(t,r,o){let n=r?.clone(),i=e(o.origin),l=null,u=null;return{undo:()=>{l=t.transform?.clone(),u=e(o.origin),t.transform=n,t.vertexSpace.origin=i},redo:()=>{n=t.transform?.clone(),i=e(o.origin),t.transform=l,t.vertexSpace.origin=u}}}function l(e){let t,r=e.vertexAttributes.clonePositional();return{undo:()=>{t=e.vertexAttributes.clonePositional(),e.vertexAttributes=r},redo:()=>{r=e.vertexAttributes.clonePositional(),e.vertexAttributes=t}}}export{r as createGraphicGeometryUndoRecord};
