define(["exports","./RuntimeError-346a3079","./when-4bbc8319","./ComponentDatatype-93750d1a"],(function(e,t,n,r){"use strict";function a(e,t,r){this.x=n.defaultValue(e,0),this.y=n.defaultValue(t,0),this.z=n.defaultValue(r,0)}a.fromSpherical=function(e,t){n.defined(t)||(t=new a);var r=e.clock,i=e.cone,u=n.defaultValue(e.magnitude,1),o=u*Math.sin(i);return t.x=o*Math.cos(r),t.y=o*Math.sin(r),t.z=u*Math.cos(i),t},a.fromElements=function(e,t,r,i){return n.defined(i)?(i.x=e,i.y=t,i.z=r,i):new a(e,t,r)},a.clone=function(e,t){if(n.defined(e))return n.defined(t)?(t.x=e.x,t.y=e.y,t.z=e.z,t):new a(e.x,e.y,e.z)},a.fromCartesian4=a.clone,a.packedLength=3,a.pack=function(e,t,r){return r=n.defaultValue(r,0),t[r++]=e.x,t[r++]=e.y,t[r]=e.z,t},a.unpack=function(e,t,r){return t=n.defaultValue(t,0),n.defined(r)||(r=new a),r.x=e[t++],r.y=e[t++],r.z=e[t],r},a.packArray=function(e,r){var i=e.length,u=3*i;if(n.defined(r)){if(!Array.isArray(r)&&r.length!==u)throw new t.DeveloperError("If result is a typed array, it must have exactly array.length * 3 elements");r.length!==u&&(r.length=u)}else r=new Array(u);for(var o=0;or.CesiumMath.EPSILON12);return n.defined(o)?(o.x=s*q,o.y=f*_,o.z=l*R,o):new a(s*q,f*_,l*R)}function p(e,t,r){this.longitude=n.defaultValue(e,0),this.latitude=n.defaultValue(t,0),this.height=n.defaultValue(r,0)}p.fromRadians=function(e,t,r,a){return r=n.defaultValue(r,0),n.defined(a)?(a.longitude=e,a.latitude=t,a.height=r,a):new p(e,t,r)},p.fromDegrees=function(e,t,n,a){return e=r.CesiumMath.toRadians(e),t=r.CesiumMath.toRadians(t),p.fromRadians(e,t,n,a)};var x=new a,M=new a,w=new a,g=new a(1/6378137,1/6378137,1/6356752.314245179),v=new a(1/40680631590769,1/40680631590769,1/40408299984661.445),z=r.CesiumMath.EPSILON1;function C(e,t,i,u){t=n.defaultValue(t,0),i=n.defaultValue(i,0),u=n.defaultValue(u,0),e._radii=new a(t,i,u),e._radiiSquared=new a(t*t,i*i,u*u),e._radiiToTheFourth=new a(t*t*t*t,i*i*i*i,u*u*u*u),e._oneOverRadii=new a(0===t?0:1/t,0===i?0:1/i,0===u?0:1/u),e._oneOverRadiiSquared=new a(0===t?0:1/(t*t),0===i?0:1/(i*i),0===u?0:1/(u*u)),e._minimumRadius=Math.min(t,i,u),e._maximumRadius=Math.max(t,i,u),e._centerToleranceSquared=r.CesiumMath.EPSILON1,0!==e._radiiSquared.z&&(e._squaredXOverSquaredZ=e._radiiSquared.x/e._radiiSquared.z)}function O(e,t,n){this._radii=void 0,this._radiiSquared=void 0,this._radiiToTheFourth=void 0,this._oneOverRadii=void 0,this._oneOverRadiiSquared=void 0,this._minimumRadius=void 0,this._maximumRadius=void 0,this._centerToleranceSquared=void 0,this._squaredXOverSquaredZ=void 0,C(this,e,t,n)}p.fromCartesian=function(e,t,i){var u=n.defined(t)?t.oneOverRadii:g,o=n.defined(t)?t.oneOverRadiiSquared:v,s=y(e,u,o,n.defined(t)?t._centerToleranceSquared:z,M);if(n.defined(s)){var f=a.multiplyComponents(s,o,x);f=a.normalize(f,f);var l=a.subtract(e,s,w),d=Math.atan2(f.y,f.x),c=Math.asin(f.z),h=r.CesiumMath.sign(a.dot(l,e))*a.magnitude(l);return n.defined(i)?(i.longitude=d,i.latitude=c,i.height=h,i):new p(d,c,h)}},p.toCartesian=function(e,t,n){return a.fromRadians(e.longitude,e.latitude,e.height,t,n)},p.clone=function(e,t){if(n.defined(e))return n.defined(t)?(t.longitude=e.longitude,t.latitude=e.latitude,t.height=e.height,t):new p(e.longitude,e.latitude,e.height)},p.equals=function(e,t){return e===t||n.defined(e)&&n.defined(t)&&e.longitude===t.longitude&&e.latitude===t.latitude&&e.height===t.height},p.equalsEpsilon=function(e,t,r){return r=n.defaultValue(r,0),e===t||n.defined(e)&&n.defined(t)&&Math.abs(e.longitude-t.longitude)<=r&&Math.abs(e.latitude-t.latitude)<=r&&Math.abs(e.height-t.height)<=r},p.ZERO=Object.freeze(new p(0,0,0)),p.prototype.clone=function(e){return p.clone(this,e)},p.prototype.equals=function(e){return p.equals(this,e)},p.prototype.equalsEpsilon=function(e,t){return p.equalsEpsilon(this,e,t)},p.prototype.toString=function(){return"("+this.longitude+", "+this.latitude+", "+this.height+")"},Object.defineProperties(O.prototype,{radii:{get:function(){return this._radii}},radiiSquared:{get:function(){return this._radiiSquared}},radiiToTheFourth:{get:function(){return this._radiiToTheFourth}},oneOverRadii:{get:function(){return this._oneOverRadii}},oneOverRadiiSquared:{get:function(){return this._oneOverRadiiSquared}},minimumRadius:{get:function(){return this._minimumRadius}},maximumRadius:{get:function(){return this._maximumRadius}}}),O.clone=function(e,t){if(n.defined(e)){var r=e._radii;return n.defined(t)?(a.clone(r,t._radii),a.clone(e._radiiSquared,t._radiiSquared),a.clone(e._radiiToTheFourth,t._radiiToTheFourth),a.clone(e._oneOverRadii,t._oneOverRadii),a.clone(e._oneOverRadiiSquared,t._oneOverRadiiSquared),t._minimumRadius=e._minimumRadius,t._maximumRadius=e._maximumRadius,t._centerToleranceSquared=e._centerToleranceSquared,t):new O(r.x,r.y,r.z)}},O.fromCartesian3=function(e,t){return n.defined(t)||(t=new O),n.defined(e)?(C(t,e.x,e.y,e.z),t):t},O.WGS84=Object.freeze(new O(6378137,6378137,6356752.314245179)),O.UNIT_SPHERE=Object.freeze(new O(1,1,1)),O.MOON=Object.freeze(new O(r.CesiumMath.LUNAR_RADIUS,r.CesiumMath.LUNAR_RADIUS,r.CesiumMath.LUNAR_RADIUS)),O.prototype.clone=function(e){return O.clone(this,e)},O.packedLength=a.packedLength,O.pack=function(e,t,r){return r=n.defaultValue(r,0),a.pack(e._radii,t,r),t},O.unpack=function(e,t,r){t=n.defaultValue(t,0);var i=a.unpack(e,t);return O.fromCartesian3(i,r)},O.prototype.geocentricSurfaceNormal=a.normalize,O.prototype.geodeticSurfaceNormalCartographic=function(e,t){var r=e.longitude,i=e.latitude,u=Math.cos(i),o=u*Math.cos(r),s=u*Math.sin(r),f=Math.sin(i);return n.defined(t)||(t=new a),t.x=o,t.y=s,t.z=f,a.normalize(t,t)},O.prototype.geodeticSurfaceNormal=function(e,t){if(!a.equalsEpsilon(e,a.ZERO,r.CesiumMath.EPSILON14))return n.defined(t)||(t=new a),t=a.multiplyComponents(e,this._oneOverRadiiSquared,t),a.normalize(t,t)};var b=new a,S=new a;O.prototype.cartographicToCartesian=function(e,t){var r=b,i=S;this.geodeticSurfaceNormalCartographic(e,r),a.multiplyComponents(this._radiiSquared,r,i);var u=Math.sqrt(a.dot(r,i));return a.divideByScalar(i,u,i),a.multiplyByScalar(r,e.height,r),n.defined(t)||(t=new a),a.add(i,r,t)},O.prototype.cartographicArrayToCartesianArray=function(e,t){var r=e.length;n.defined(t)?t.length=r:t=new Array(r);for(var a=0;a=this._radii.z-t))return r};var V=[.14887433898163,.43339539412925,.67940956829902,.86506336668898,.97390652851717,0],E=[.29552422471475,.26926671930999,.21908636251598,.14945134915058,.066671344308684,0];function T(e,t,n){for(var r=.5*(t+e),a=.5*(t-e),i=0,u=0;u<5;u++){var o=a*V[u];i+=E[u]*(n(r+o)+n(r-o))}return i*=a}function A(e,t,r,a,i,u,o,s,f){this[0]=n.defaultValue(e,0),this[1]=n.defaultValue(a,0),this[2]=n.defaultValue(o,0),this[3]=n.defaultValue(t,0),this[4]=n.defaultValue(i,0),this[5]=n.defaultValue(s,0),this[6]=n.defaultValue(r,0),this[7]=n.defaultValue(u,0),this[8]=n.defaultValue(f,0)}O.prototype.surfaceArea=function(e){for(var t=e.west,n=e.east,a=e.south,i=e.north;na&&(i=u,a=o)}var s=1,f=0,l=L[i],d=P[i];if(Math.abs(e[A.getElementIndex(d,l)])>n){var c,h=(e[A.getElementIndex(d,d)]-e[A.getElementIndex(l,l)])/2/e[A.getElementIndex(d,l)];f=(c=h<0?-1/(-h+Math.sqrt(1+h*h)):1/(h+Math.sqrt(1+h*h)))*(s=1/Math.sqrt(1+c*c))}return(t=A.clone(A.IDENTITY,t))[A.getElementIndex(l,l)]=t[A.getElementIndex(d,d)]=s,t[A.getElementIndex(d,l)]=f,t[A.getElementIndex(l,d)]=-f,t}var B=new A,j=new A;A.computeEigenDecomposition=function(e,t){var a=r.CesiumMath.EPSILON20,i=0,u=0;n.defined(t)||(t={});for(var o=t.unitary=A.clone(A.IDENTITY,t.unitary),s=t.diagonal=A.clone(e,t.diagonal),f=a*function(e){for(var t=0,n=0;n<9;++n){var r=e[n];t+=r*r}return Math.sqrt(t)}(s);u<10&&W(s)>f;)k(s,B),A.transpose(B,j),A.multiply(s,B,s),A.multiply(j,s,s),A.multiply(o,B,o),++i>2&&(++u,i=0);return t},A.abs=function(e,t){return t[0]=Math.abs(e[0]),t[1]=Math.abs(e[1]),t[2]=Math.abs(e[2]),t[3]=Math.abs(e[3]),t[4]=Math.abs(e[4]),t[5]=Math.abs(e[5]),t[6]=Math.abs(e[6]),t[7]=Math.abs(e[7]),t[8]=Math.abs(e[8]),t},A.determinant=function(e){var t=e[0],n=e[3],r=e[6],a=e[1],i=e[4],u=e[7],o=e[2],s=e[5],f=e[8];return t*(i*f-s*u)+a*(s*r-n*f)+o*(n*u-i*r)},A.inverse=function(e,t){var n=e[0],r=e[1],a=e[2],i=e[3],u=e[4],o=e[5],s=e[6],f=e[7],l=e[8],d=A.determinant(e);t[0]=u*l-f*o,t[1]=f*a-r*l,t[2]=r*o-u*a,t[3]=s*o-i*l,t[4]=n*l-s*a,t[5]=i*a-n*o,t[6]=i*f-s*u,t[7]=s*r-n*f,t[8]=n*u-i*r;var c=1/d;return A.multiplyByScalar(t,c,t)};var X=new A;function D(e,t,r,a){this.x=n.defaultValue(e,0),this.y=n.defaultValue(t,0),this.z=n.defaultValue(r,0),this.w=n.defaultValue(a,0)}A.inverseTranspose=function(e,t){return A.inverse(A.transpose(e,X),t)},A.equals=function(e,t){return e===t||n.defined(e)&&n.defined(t)&&e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]&&e[3]===t[3]&&e[4]===t[4]&&e[5]===t[5]&&e[6]===t[6]&&e[7]===t[7]&&e[8]===t[8]},A.equalsEpsilon=function(e,t,r){return r=n.defaultValue(r,0),e===t||n.defined(e)&&n.defined(t)&&Math.abs(e[0]-t[0])<=r&&Math.abs(e[1]-t[1])<=r&&Math.abs(e[2]-t[2])<=r&&Math.abs(e[3]-t[3])<=r&&Math.abs(e[4]-t[4])<=r&&Math.abs(e[5]-t[5])<=r&&Math.abs(e[6]-t[6])<=r&&Math.abs(e[7]-t[7])<=r&&Math.abs(e[8]-t[8])<=r},A.IDENTITY=Object.freeze(new A(1,0,0,0,1,0,0,0,1)),A.ZERO=Object.freeze(new A(0,0,0,0,0,0,0,0,0)),A.COLUMN0ROW0=0,A.COLUMN0ROW1=1,A.COLUMN0ROW2=2,A.COLUMN1ROW0=3,A.COLUMN1ROW1=4,A.COLUMN1ROW2=5,A.COLUMN2ROW0=6,A.COLUMN2ROW1=7,A.COLUMN2ROW2=8,Object.defineProperties(A.prototype,{length:{get:function(){return A.packedLength}}}),A.prototype.clone=function(e){return A.clone(this,e)},A.prototype.equals=function(e){return A.equals(this,e)},A.equalsArray=function(e,t,n){return e[0]===t[n]&&e[1]===t[n+1]&&e[2]===t[n+2]&&e[3]===t[n+3]&&e[4]===t[n+4]&&e[5]===t[n+5]&&e[6]===t[n+6]&&e[7]===t[n+7]&&e[8]===t[n+8]},A.prototype.equalsEpsilon=function(e,t){return A.equalsEpsilon(this,e,t)},A.prototype.toString=function(){return"("+this[0]+", "+this[3]+", "+this[6]+")\n("+this[1]+", "+this[4]+", "+this[7]+")\n("+this[2]+", "+this[5]+", "+this[8]+")"},D.fromElements=function(e,t,r,a,i){return n.defined(i)?(i.x=e,i.y=t,i.z=r,i.w=a,i):new D(e,t,r,a)},D.fromColor=function(e,t){return n.defined(t)?(t.x=e.red,t.y=e.green,t.z=e.blue,t.w=e.alpha,t):new D(e.red,e.green,e.blue,e.alpha)},D.clone=function(e,t){if(n.defined(e))return n.defined(t)?(t.x=e.x,t.y=e.y,t.z=e.z,t.w=e.w,t):new D(e.x,e.y,e.z,e.w)},D.packedLength=4,D.pack=function(e,t,r){return r=n.defaultValue(r,0),t[r++]=e.x,t[r++]=e.y,t[r++]=e.z,t[r]=e.w,t},D.unpack=function(e,t,r){return t=n.defaultValue(t,0),n.defined(r)||(r=new D),r.x=e[t++],r.y=e[t++],r.z=e[t++],r.w=e[t],r},D.packArray=function(e,r){var a=e.length,i=4*a;if(n.defined(r)){if(!Array.isArray(r)&&r.length!==i)throw new t.DeveloperError("If result is a typed array, it must have exactly array.length * 4 elements");r.length!==i&&(r.length=i)}else r=new Array(i);for(var u=0;u=0?c.longitude:c.longitude+r.CesiumMath.TWO_PI;u=Math.min(u,h),o=Math.max(o,h)}return i-a>o-u&&(a=u,(i=o)>r.CesiumMath.PI&&(i-=r.CesiumMath.TWO_PI),a>r.CesiumMath.PI&&(a-=r.CesiumMath.TWO_PI)),n.defined(t)?(t.west=a,t.south=s,t.east=i,t.north=f,t):new de(a,s,i,f)},de.fromCartesianArray=function(e,t,a){t=n.defaultValue(t,O.WGS84);for(var i=Number.MAX_VALUE,u=-Number.MAX_VALUE,o=Number.MAX_VALUE,s=-Number.MAX_VALUE,f=Number.MAX_VALUE,l=-Number.MAX_VALUE,d=0,c=e.length;d=0?h.longitude:h.longitude+r.CesiumMath.TWO_PI;o=Math.min(o,m),s=Math.max(s,m)}return u-i>s-o&&(i=o,(u=s)>r.CesiumMath.PI&&(u-=r.CesiumMath.TWO_PI),i>r.CesiumMath.PI&&(i-=r.CesiumMath.TWO_PI)),n.defined(a)?(a.west=i,a.south=f,a.east=u,a.north=l,a):new de(i,f,u,l)},de.clone=function(e,t){if(n.defined(e))return n.defined(t)?(t.west=e.west,t.south=e.south,t.east=e.east,t.north=e.north,t):new de(e.west,e.south,e.east,e.north)},de.equalsEpsilon=function(e,t,r){return r=n.defaultValue(r,0),e===t||n.defined(e)&&n.defined(t)&&Math.abs(e.west-t.west)<=r&&Math.abs(e.south-t.south)<=r&&Math.abs(e.east-t.east)<=r&&Math.abs(e.north-t.north)<=r},de.prototype.clone=function(e){return de.clone(this,e)},de.prototype.equals=function(e){return de.equals(this,e)},de.equals=function(e,t){return e===t||n.defined(e)&&n.defined(t)&&e.west===t.west&&e.south===t.south&&e.east===t.east&&e.north===t.north},de.prototype.equalsEpsilon=function(e,t){return de.equalsEpsilon(this,e,t)},de.validate=function(e){},de.southwest=function(e,t){return n.defined(t)?(t.longitude=e.west,t.latitude=e.south,t.height=0,t):new p(e.west,e.south)},de.northwest=function(e,t){return n.defined(t)?(t.longitude=e.west,t.latitude=e.north,t.height=0,t):new p(e.west,e.north)},de.northeast=function(e,t){return n.defined(t)?(t.longitude=e.east,t.latitude=e.north,t.height=0,t):new p(e.east,e.north)},de.southeast=function(e,t){return n.defined(t)?(t.longitude=e.east,t.latitude=e.south,t.height=0,t):new p(e.east,e.south)},de.center=function(e,t){var a=e.east,i=e.west;a0?i+=r.CesiumMath.TWO_PI:o0&&(o+=r.CesiumMath.TWO_PI),i=c))return n.defined(a)?(a.west=f,a.south=d,a.east=l,a.north=c,a):new de(f,d,l,c)}},de.simpleIntersection=function(e,t,r){var a=Math.max(e.west,t.west),i=Math.max(e.south,t.south),u=Math.min(e.east,t.east),o=Math.min(e.north,t.north);if(!(i>=o||a>=u))return n.defined(r)?(r.west=a,r.south=i,r.east=u,r.north=o,r):new de(a,i,u,o)},de.union=function(e,t,a){n.defined(a)||(a=new de);var i=e.east,u=e.west,o=t.east,s=t.west;i0?i+=r.CesiumMath.TWO_PI:o0&&(o+=r.CesiumMath.TWO_PI),ii||r.CesiumMath.equalsEpsilon(n,i,r.CesiumMath.EPSILON14))&&(n=e.south&&a<=e.north};var ce=new p;function he(e,t){this.x=n.defaultValue(e,0),this.y=n.defaultValue(t,0)}de.subsample=function(e,t,a,i){t=n.defaultValue(t,O.WGS84),a=n.defaultValue(a,0),n.defined(i)||(i=[]);var u=0,o=e.north,s=e.south,f=e.east,l=e.west,d=ce;d.height=a,d.longitude=l,d.latitude=o,i[u]=t.cartographicToCartesian(d,i[u]),u++,d.longitude=f,i[u]=t.cartographicToCartesian(d,i[u]),u++,d.latitude=s,i[u]=t.cartographicToCartesian(d,i[u]),u++,d.longitude=l,i[u]=t.cartographicToCartesian(d,i[u]),u++,d.latitude=o<0?o:s>0?s:0;for(var c=1;c<8;++c)d.longitude=-Math.PI+c*r.CesiumMath.PI_OVER_TWO,de.contains(e,d)&&(i[u]=t.cartographicToCartesian(d,i[u]),u++);return 0===d.latitude&&(d.longitude=l,i[u]=t.cartographicToCartesian(d,i[u]),u++,d.longitude=f,i[u]=t.cartographicToCartesian(d,i[u]),u++),i.length=u,i},de.MAX_VALUE=Object.freeze(new de(-Math.PI,-r.CesiumMath.PI_OVER_TWO,Math.PI,r.CesiumMath.PI_OVER_TWO)),he.fromElements=function(e,t,r){return n.defined(r)?(r.x=e,r.y=t,r):new he(e,t)},he.clone=function(e,t){if(n.defined(e))return n.defined(t)?(t.x=e.x,t.y=e.y,t):new he(e.x,e.y)},he.fromCartesian3=he.clone,he.fromCartesian4=he.clone,he.packedLength=2,he.pack=function(e,t,r){return r=n.defaultValue(r,0),t[r++]=e.x,t[r]=e.y,t},he.unpack=function(e,t,r){return t=n.defaultValue(t,0),n.defined(r)||(r=new he),r.x=e[t++],r.y=e[t],r},he.packArray=function(e,r){var a=e.length,i=2*a;if(n.defined(r)){if(!Array.isArray(r)&&r.length!==i)throw new t.DeveloperError("If result is a typed array, it must have exactly array.length * 2 elements");r.length!==i&&(r.length=i)}else r=new Array(i);for(var u=0;u