/*
All material copyright Esri, All Rights Reserved, unless otherwise specified.
See https://js.arcgis.com/5.0/esri/copyright.txt for details.
*/
import{equals as t}from"../../../../core/arrayUtils.js";import{rotate as e}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{rotateEllipticArc as i}from"../../../../geometry/support/curves/rotate.js";class o{constructor(t,e,i=0){this.origin=t,this.angle=e,this._accumulationType=i}_rotate(t,i){e(t.pos,t.pos,this.origin,i),n(t.leftSegment,this.origin,i)}apply(t){this._rotate(t,this.angle)}undo(t){this._rotate(t,-this.angle)}canAccumulate(e){return e instanceof o&&t(this.origin,e.origin)}accumulate(t,e){const i=1===e._accumulationType;this._rotate(t,i?e.angle-this.angle:e.angle)}accumulateParams(t){const e=1===t._accumulationType;this.angle=e?t.angle:this.angle+t.angle}}function n(t,o,n){switch(t?.type){case null:case void 0:case"line":return;case"bezier":{const{controlPoint1:i,controlPoint2:r}=t.curveDefinition;return e(i,i,o,n),void e(r,r,o,n)}case"circular-arc":{const{interiorPoint:i}=t.curveDefinition;return void e(i,i,o,n)}case"elliptic-arc-4":case"elliptic-arc-7":{const r=t.leftVertex.pos,a=e([0,0],[r[0],r[1]],o,-n),c=t.toCurveOrCoordinate(),[,s,l,u,p,g,m]=i(a,c,o,n).a;if("elliptic-arc-4"===t.type){const e=t.curveDefinition;e.centerPoint=[...s],e.sweep=l,e.orientation=u}else{const e=t.curveDefinition;e.centerPoint=[...s],e.sweep=l,e.orientation=u,e.rotation=p,e.semiMajorAxisLength=g,e.minorMajorAxisRatio=m}}}}export{o as RotateVertex};
