define(["exports","./Cartographic-1d953166","./when-d186add7","./Check-2514d21d","./buildModuleUrl-d920237a","./Math-7f5f2992","./GeometryAttribute-95780fd1","./Rectangle-f841217d"],(function(t,n,r,a,e,o,s,i){"use strict";var h=Math.cos,g=Math.sin,u=Math.sqrt,l={computePosition:function(t,n,a,e,o,s,i){var l=n.radiiSquared,d=t.nwCorner,c=t.boundingRectangle,C=d.latitude-t.granYCos*e+o*t.granXSin,S=h(C),w=g(C),f=l.z*w,X=d.longitude+e*t.granYSin+o*t.granXCos,Y=S*h(X),O=S*g(X),v=l.x*Y,_=l.y*O,M=u(v*Y+_*O+f*w);if(s.x=v/M,s.y=_/M,s.z=f/M,a){var p=t.stNwCorner;r.e(p)?(C=p.latitude-t.stGranYCos*e+o*t.stGranXSin,X=p.longitude+e*t.stGranYSin+o*t.stGranXCos,i.x=(X-t.stWest)*t.lonScalar,i.y=(C-t.stSouth)*t.latScalar):(i.x=(X-c.west)*t.lonScalar,i.y=(C-c.south)*t.latScalar)}}},d=new s.f,c=new n.t,C=new n.t$1,S=new n.t,w=new e.n;function f(t,r,a,e,o,i,h){var g=Math.cos(r),u=e*g,l=a*g,C=Math.sin(r),f=e*C,X=a*C;c=w.project(t,c),c=n.t.subtract(c,S,c);var Y=s.f.fromRotation(r,d);c=s.f.multiplyByVector(Y,c,c),c=n.t.add(c,S,c),i-=1,h-=1;var O=(t=w.unproject(c,t)).latitude,v=O+i*X,_=O-u*h,M=O-u*h+i*X,p=Math.max(O,v,_,M),R=Math.min(O,v,_,M),W=t.longitude,m=W+i*l,G=W+h*f,I=W+h*f+i*l;return{north:p,south:R,east:Math.max(W,m,G,I),west:Math.min(W,m,G,I),granYCos:u,granYSin:f,granXCos:l,granXSin:X,nwCorner:t}}l.computeOptions=function(t,n,r,e,s,h,g){var u=t.east,l=t.west,d=t.north,c=t.south,X=!1,Y=!1;d===o.e.PI_OVER_TWO&&(X=!0),c===-o.e.PI_OVER_TWO&&(Y=!0);var O,v,_,M,p,R=d-c;_=(p=l>u?o.e.TWO_PI-l+u:u-l)/((O=Math.ceil(p/n)+1)-1),M=R/((v=Math.ceil(R/n)+1)-1);var W=i.h.northwest(t,h),m=i.h.center(t,C);(0!==r||0!==e)&&(m.longitude<W.longitude&&(m.longitude+=o.e.TWO_PI),S=w.project(m,S));var G=M,I=_,P=i.h.clone(t,s),T={granYCos:G,granYSin:0,granXCos:I,granXSin:0,nwCorner:W,boundingRectangle:P,width:O,height:v,northCap:X,southCap:Y};if(0!==r){var x=f(W,r,_,M,0,O,v);if(d=x.north,c=x.south,u=x.east,l=x.west,d<-o.e.PI_OVER_TWO||d>o.e.PI_OVER_TWO||c<-o.e.PI_OVER_TWO||c>o.e.PI_OVER_TWO)throw new a.t("Rotated rectangle is invalid.  It crosses over either the north or south pole.");T.granYCos=x.granYCos,T.granYSin=x.granYSin,T.granXCos=x.granXCos,T.granXSin=x.granXSin,P.north=d,P.south=c,P.east=u,P.west=l}if(0!==e){r-=e;var y=i.h.northwest(P,g),V=f(y,r,_,M,0,O,v);T.stGranYCos=V.granYCos,T.stGranXCos=V.granXCos,T.stGranYSin=V.granYSin,T.stGranXSin=V.granXSin,T.stNwCorner=y,T.stWest=V.west,T.stSouth=V.south}return T},t.j=l}));
