text: /**
   * Cesium - https://github.com/AnalyticalGraphicsInc/cesium
   *
   * Copyright 2011-2015 Cesium Contributors
   *
   * Licensed under the Apache License, Version 2.0 (the "License");
   * you may not use this file except in compliance with the License.
   * You may obtain a copy of the License at
   *
   * http://www.apache.org/licenses/LICENSE-2.0
   *
   * Unless required by applicable law or agreed to in writing, software
   * distributed under the License is distributed on an "AS IS" BASIS,
   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   * See the License for the specific language governing permissions and
   * limitations under the License.
   *
   * Columbus View (Pat. Pend.)
   *
   * Portions licensed separately.
   * See https://github.com/AnalyticalGraphicsInc/cesium/blob/master/LICENSE.md for full licensing details.
   */
  /**
  @license
  mersenne-twister.js - https://gist.github.com/banksean/300494
  
     Copyright (C) 1997 - 2002, Makoto Matsumoto and Takuji Nishimura,
     All rights reserved.
  
     Redistribution and use in source and binary forms, with or without
     modification, are permitted provided that the following conditions
     are met:
  
       1. Redistributions of source code must retain the above copyright
          notice, this list of conditions and the following disclaimer.
  
       2. Redistributions in binary form must reproduce the above copyright
          notice, this list of conditions and the following disclaimer in the
          documentation and/or other materials provided with the distribution.
  
       3. The names of its contributors may not be used to endorse or promote
          products derived from this software without specific prior written
          permission.
  
     THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
     "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
     LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
     A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT OWNER OR
     CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
     EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
     PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
     PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
     LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
     NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
     SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
  
  !function(){define("Core/defined",[],function(){"use strict";function e(e){return void 0!==e&&null!==e}return e}),define("Core/freezeObject",["./defined"],function(e){"use strict";var r=Object.freeze;return e(r)||(r=function(e){return e}),r}),define("Core/defaultValue",["./freezeObject"],function(e){"use strict";function r(e,r){return void 0!==e?e:r}return r.EMPTY_OBJECT=e({}),r}),define("Core/DeveloperError",["./defined"],function(e){"use strict";function r(e){this.name="DeveloperError",this.message=e;var r;try{throw new Error}catch(t){r=t.stack}this.stack=r}return r.prototype.toString=function(){var r=this.name+": "+this.message;return e(this.stack)&&(r+="\n"+this.stack.toString()),r},r.throwInstantiationError=function(){throw new r("This function defines an interface and should not be called directly.")},r}),define("ThirdParty/mersenne-twister",[],function(){var e=function(e){void 0==e&&(e=(new Date).getTime()),this.N=624,this.M=397,this.MATRIX_A=2567483615,this.UPPER_MASK=2147483648,this.LOWER_MASK=2147483647,this.mt=new Array(this.N),this.mti=this.N+1,this.init_genrand(e)};return e.prototype.init_genrand=function(e){for(this.mt[0]=e>>>0,this.mti=1;this.mti<this.N;this.mti++){var e=this.mt[this.mti-1]^this.mt[this.mti-1]>>>30;this.mt[this.mti]=(1812433253*((4294901760&e)>>>16)<<16)+1812433253*(65535&e)+this.mti,this.mt[this.mti]>>>=0}},e.prototype.genrand_int32=function(){var e,r=new Array(0,this.MATRIX_A);if(this.mti>=this.N){var t;for(this.mti==this.N+1&&this.init_genrand(5489),t=0;t<this.N-this.M;t++)e=this.mt[t]&this.UPPER_MASK|this.mt[t+1]&this.LOWER_MASK,this.mt[t]=this.mt[t+this.M]^e>>>1^r[1&e];for(;t<this.N-1;t++)e=this.mt[t]&this.UPPER_MASK|this.mt[t+1]&this.LOWER_MASK,this.mt[t]=this.mt[t+(this.M-this.N)]^e>>>1^r[1&e];e=this.mt[this.N-1]&this.UPPER_MASK|this.mt[0]&this.LOWER_MASK,this.mt[this.N-1]=this.mt[this.M-1]^e>>>1^r[1&e],this.mti=0}return e=this.mt[this.mti++],e^=e>>>11,e^=e<<7&2636928640,e^=e<<15&4022730752,e^=e>>>18,e>>>0},e.prototype.random=function(){return this.genrand_int32()*(1/4294967296)},e}),define("Core/Math",["../ThirdParty/mersenne-twister","./defaultValue","./defined","./DeveloperError"],function(e,r,t,n){"use strict";var i={};i.EPSILON1=.1,i.EPSILON2=.01,i.EPSILON3=.001,i.EPSILON4=1e-4,i.EPSILON5=1e-5,i.EPSILON6=1e-6,i.EPSILON7=1e-7,i.EPSILON8=1e-8,i.EPSILON9=1e-9,i.EPSILON10=1e-10,i.EPSILON11=1e-11,i.EPSILON12=1e-12,i.EPSILON13=1e-13,i.EPSILON14=1e-14,i.EPSILON15=1e-15,i.EPSILON16=1e-16,i.EPSILON17=1e-17,i.EPSILON18=1e-18,i.EPSILON19=1e-19,i.EPSILON20=1e-20,i.GRAVITATIONALPARAMETER=3986004418e5,i.SOLAR_RADIUS=6955e5,i.LUNAR_RADIUS=1737400,i.SIXTY_FOUR_KILOBYTES=65536,i.sign=function(e){return e>0?1:0>e?-1:0},i.signNotZero=function(e){return 0>e?-1:1},i.toSNorm=function(e){return Math.round(255*(.5*i.clamp(e,-1,1)+.5))},i.fromSNorm=function(e){return i.clamp(e,0,255)/255*2-1},i.sinh=function(e){var r=Math.pow(Math.E,e),t=Math.pow(Math.E,-1*e);return.5*(r-t)},i.cosh=function(e){var r=Math.pow(Math.E,e),t=Math.pow(Math.E,-1*e);return.5*(r+t)},i.lerp=function(e,r,t){return(1-t)*e+t*r},i.PI=Math.PI,i.ONE_OVER_PI=1/Math.PI,i.PI_OVER_TWO=.5*Math.PI,i.PI_OVER_THREE=Math.PI/3,i.PI_OVER_FOUR=Math.PI/4,i.PI_OVER_SIX=Math.PI/6,i.THREE_PI_OVER_TWO=3*Math.PI*.5,i.TWO_PI=2*Math.PI,i.ONE_OVER_TWO_PI=1/(2*Math.PI),i.RADIANS_PER_DEGREE=Math.PI/180,i.DEGREES_PER_RADIAN=180/Math.PI,i.RADIANS_PER_ARCSECOND=i.RADIANS_PER_DEGREE/3600,i.toRadians=function(e){if(!t(e))throw new n("degrees is required.");return e*i.RADIANS_PER_DEGREE},i.toDegrees=function(e){if(!t(e))throw new n("radians is required.");return e*i.DEGREES_PER_RADIAN},i.convertLongitudeRange=function(e){if(!t(e))throw new n("angle is required.");var r=i.TWO_PI,a=e-Math.floor(e/r)*r;return a<-Math.PI?a+r:a>=Math.PI?a-r:a},i.negativePiToPi=function(e){if(!t(e))throw new n("x is required.");return i.zeroToTwoPi(e+i.PI)-i.PI},i.zeroToTwoPi=function(e){if(!t(e))throw new n("x is required.");var r=i.mod(e,i.TWO_PI);return Math.abs(r)<i.EPSILON14&&Math.abs(e)>i.EPSILON14?i.TWO_PI:r},i.mod=function(e,r){if(!t(e))throw new n("m is required.");if(!t(r))throw new n("n is required.");return(e%r+r)%r},i.equalsEpsilon=function(e,i,a,o){if(!t(e))throw new n("left is required.");if(!t(i))throw new n("right is required.");if(!t(a))throw new n("relativeEpsilon is required.");o=r(o,a);var u=Math.abs(e-i);return o>=u||u<=a*Math.max(Math.abs(e),Math.abs(i))};var a=[1];i.factorial=function(e){if("number"!=typeof e||0>e)throw new n("A number greater than or equal to 0 is required.");var r=a.length;if(e>=r)for(var t=a[r-1],i=r;e>=i;i++)a.push(t*i);return a[e]},i.incrementWrap=function(e,i,a){if(a=r(a,0),!t(e))throw new n("n is required.");if(a>=i)throw new n("maximumValue must be greater than minimumValue.");return++e,e>i&&(e=a),e},i.isPowerOfTwo=function(e){if("number"!=typeof e||0>e)throw new n("A number greater than or equal to 0 is required.");return 0!==e&&0===(e&e-1)},i.nextPowerOfTwo=function(e){if("number"!=typeof e||0>e)throw new n("A number greater than or equal to 0 is required.");return--e,e|=e>>1,e|=e>>2,e|=e>>4,e|=e>>8,e|=e>>16,++e,e},i.clamp=function(e,r,i){if(!t(e))throw new n("value is required");if(!t(r))throw new n("min is required.");if(!t(i))throw new n("max is required.");return r>e?r:e>i?i:e};var o=new e;return i.setRandomNumberSeed=function(r){if(!t(r))throw new n("seed is required.");o=new e(r)},i.nextRandomNumber=function(){return o.random()},i.acosClamped=function(e){if(!t(e))throw new n("value is required.");return Math.acos(i.clamp(e,-1,1))},i.asinClamped=function(e){if(!t(e))throw new n("value is required.");return Math.asin(i.clamp(e,-1,1))},i.chordLength=function(e,r){if(!t(e))throw new n("angle is required.");if(!t(r))throw new n("radius is required.");return 2*r*Math.sin(.5*e)},i.logBase=function(e,r){if(!t(e))throw new n("number is required.");if(!t(r))throw new n("base is required.");return Math.log(e)/Math.log(r)},i.fog=function(e,r){var t=e*r;return 1-Math.exp(-(t*t))},i}),define("Core/Cartesian3",["./defaultValue","./defined","./DeveloperError","./freezeObject","./Math"],function(e,r,t,n,i){"use strict";function a(r,t,n){this.x=e(r,0),this.y=e(t,0),this.z=e(n,0)}a.fromSpherical=function(n,i){if(!r(n))throw new t("spherical is required");r(i)||(i=new a);var o=n.clock,u=n.cone,s=e(n.magnitude,1),c=s*Math.sin(u);return i.x=c*Math.cos(o),i.y=c*Math.sin(o),i.z=s*Math.cos(u),i},a.fromElements=function(e,t,n,i){return r(i)?(i.x=e,i.y=t,i.z=n,i):new a(e,t,n)},a.clone=function(e,t){return r(e)?r(t)?(t.x=e.x,t.y=e.y,t.z=e.z,t):new a(e.x,e.y,e.z):void 0},a.fromCartesian4=a.clone,a.packedLength=3,a.pack=function(n,i,a){if(!r(n))throw new t("value is required");if(!r(i))throw new t("array is required");a=e(a,0),i[a++]=n.x,i[a++]=n.y,i[a]=n.z},a.unpack=function(n,i,o){if(!r(n))throw new t("array is required");return i=e(i,0),r(o)||(o=new a),o.x=n[i++],o.y=n[i++],o.z=n[i],o},a.fromArray=a.unpack,a.maximumComponent=function(e){if(!r(e))throw new t("cartesian is required");return Math.max(e.x,e.y,e.z)},a.minimumComponent=function(e){if(!r(e))throw new t("cartesian is required");return Math.min(e.x,e.y,e.z)},a.minimumByComponent=function(e,n,i){if(!r(e))throw new t("first is required.");if(!r(n))throw new t("second is required.");if(!r(i))throw new t("result is required.");return i.x=Math.min(e.x,n.x),i.y=Math.min(e.y,n.y),i.z=Math.min(e.z,n.z),i},a.maximumByComponent=function(e,n,i){if(!r(e))throw new t("first is required.");if(!r(n))throw new t("second is required.");if(!r(i))throw new t("result is required.");return i.x=Math.max(e.x,n.x),i.y=Math.max(e.y,n.y),i.z=Math.max(e.z,n.z),i},a.magnitudeSquared=function(e){if(!r(e))throw new t("cartesian is required");return e.x*e.x+e.y*e.y+e.z*e.z},a.magnitude=function(e){return Math.sqrt(a.magnitudeSquared(e))};var o=new a;a.distance=function(e,n){if(!r(e)||!r(n))throw new t("left and right are required.");return a.subtract(e,n,o),a.magnitude(o)},a.distanceSquared=function(e,n){if(!r(e)||!r(n))throw new t("left and right are required.");return a.subtract(e,n,o),a.magnitudeSquared(o)},a.normalize=function(e,n){if(!r(e))throw new t("cartesian is required");if(!r(n))throw new t("result is required");var i=a.magnitude(e);return n.x=e.x/i,n.y=e.y/i,n.z=e.z/i,n},a.dot=function(e,n){if(!r(e))throw new t("left is required");if(!r(n))throw new t("right is required");return e.x*n.x+e.y*n.y+e.z*n.z},a.multiplyComponents=function(e,n,i){if(!r(e))throw new t("left is required");if(!r(n))throw new t("right is required");if(!r(i))throw new t("result is required");return i.x=e.x*n.x,i.y=e.y*n.y,i.z=e.z*n.z,i},a.add=function(e,n,i){if(!r(e))throw new t("left is required");if(!r(n))throw new t("right is required");if(!r(i))throw new t("result is required");return i.x=e.x+n.x,i.y=e.y+n.y,i.z=e.z+n.z,i},a.subtract=function(e,n,i){if(!r(e))throw new t("left is required");if(!r(n))throw new t("right is required");if(!r(i))throw new t("result is required");return i.x=e.x-n.x,i.y=e.y-n.y,i.z=e.z-n.z,i},a.multiplyByScalar=function(e,n,i){if(!r(e))throw new t("cartesian is required");if("number"!=typeof n)throw new t("scalar is required and must be a number.");if(!r(i))throw new t("result is required");return i.x=e.x*n,i.y=e.y*n,i.z=e.z*n,i},a.divideByScalar=function(e,n,i){if(!r(e))throw new t("cartesian is required");if("number"!=typeof n)throw new t("scalar is required and must be a number.");if(!r(i))throw new t("result is required");return i.x=e.x/n,i.y=e.y/n,i.z=e.z/n,i},a.negate=function(e,n){if(!r(e))throw new t("cartesian is required");if(!r(n))throw new t("result is required");return n.x=-e.x,n.y=-e.y,n.z=-e.z,n},a.abs=function(e,n){if(!r(e))throw new t("cartesian is required");if(!r(n))throw new t("result is required");return n.x=Math.abs(e.x),n.y=Math.abs(e.y),n.z=Math.abs(e.z),n};var u=new a;a.lerp=function(e,n,i,o){if(!r(e))throw new t("start is required.");if(!r(n))throw new t("end is required.");if("number"!=typeof i)throw new t("t is required and must be a number.");if(!r(o))throw new t("result is required.");return a.multiplyByScalar(n,i,u),o=a.multiplyByScalar(e,1-i,o),a.add(u,o,o)};var s=new a,c=new a;a.angleBetween=function(e,n){if(!r(e))throw new t("left is required");if(!r(n))throw new t("right is required");a.normalize(e,s),a.normalize(n,c);var i=a.dot(s,c),o=a.magnitude(a.cross(s,c,s));return Math.atan2(o,i)};var l=new a;a.mostOrthogonalAxis=function(e,n){if(!r(e))throw new t("cartesian is required.");if(!r(n))throw new t("result is required.");var i=a.normalize(e,l);return a.abs(i,i),n=i.x<=i.y?i.x<=i.z?a.clone(a.UNIT_X,n):a.clone(a.UNIT_Z,n):i.y<=i.z?a.clone(a.UNIT_Y,n):a.clone(a.UNIT_Z,n)},a.equals=function(e,t){return e===t||r(e)&&r(t)&&e.x===t.x&&e.y===t.y&&e.z===t.z},a.equalsArray=function(e,r,t){return e.x===r[t]&&e.y===r[t+1]&&e.z===r[t+2]},a.equalsEpsilon=function(e,t,n,a){return e===t||r(e)&&r(t)&&i.equalsEpsilon(e.x,t.x,n,a)&&i.equalsEpsilon(e.y,t.y,n,a)&&i.equalsEpsilon(e.z,t.z,n,a)},a.cross=function(e,n,i){if(!r(e))throw new t("left is required");if(!r(n))throw new t("right is required");if(!r(i))throw new t("result is required");var a=e.x,o=e.y,u=e.z,s=n.x,c=n.y,l=n.z,f=o*l-u*c,h=u*s-a*l,w=a*c-o*s;return i.x=f,i.y=h,i.z=w,i},a.fromDegrees=function(e,n,o,u,s){if(!r(e))throw new t("longitude is required");if(!r(n))throw new t("latitude is required");var c=i.toRadians(e),l=i.toRadians(n);return a.fromRadians(c,l,o,u,s)};var f=new a,h=new a,w=new a(40680631590769,40680631590769,40408299984661.445);return a.fromRadians=function(n,i,o,u,s){if(!r(n))throw new t("longitude is required");if(!r(i))throw new t("latitude is required");o=e(o,0);var c=r(u)?u.radiiSquared:w,l=Math.cos(i);f.x=l*Math.cos(n),f.y=l*Math.sin(n),f.z=Math.sin(i),f=a.normalize(f,f),a.multiplyComponents(c,f,h);var d=Math.sqrt(a.dot(f,h));return h=a.divideByScalar(h,d,h),f=a.multiplyByScalar(f,o,f),r(s)||(s=new a),a.add(h,f,s)},a.fromDegreesArray=function(e,n,o){if(!r(e))throw new t("positions is required.");for(var u=new Array(e.length),s=0;s<e.length;s++)u[s]=i.toRadians(e[s]);return a.fromRadiansArray(u,n,o)},a.fromRadiansArray=function(e,n,i){if(!r(e))throw new t("positions is required.");if(e.length<2)throw new t("positions length cannot be less than 2.");if(e.length%2!==0)throw new t("positions length must be a multiple of 2.");var o=e.length;r(i)?i.length=o/2:i=new Array(o/2);for(var u=0;o>u;u+=2){var s=e[u],c=e[u+1];i[u/2]=a.fromRadians(s,c,0,n,i[u/2])}return i},a.fromDegreesArrayHeights=function(e,n,o){if(!r(e))throw new t("positions is required.");if(e.length<3)throw new t("positions length cannot be less than 3.");if(e.length%3!==0)throw new t("positions length must be a multiple of 3.");for(var u=new Array(e.length),s=0;s<e.length;s+=3)u[s]=i.toRadians(e[s]),u[s+1]=i.toRadians(e[s+1]),u[s+2]=e[s+2];return a.fromRadiansArrayHeights(u,n,o)},a.fromRadiansArrayHeights=function(e,n,i){if(!r(e))throw new t("positions is required.");if(e.length<3)throw new t("positions length cannot be less than 3.");if(e.length%3!==0)throw new t("positions length must be a multiple of 3.");var o=e.length;r(i)?i.length=o/3:i=new Array(o/3);for(var u=0;o>u;u+=3){var s=e[u],c=e[u+1],l=e[u+2];i[u/3]=a.fromRadians(s,c,l,n,i[u/3])}return i},a.ZERO=n(new a(0,0,0)),a.UNIT_X=n(new a(1,0,0)),a.UNIT_Y=n(new a(0,1,0)),a.UNIT_Z=n(new a(0,0,1)),a.prototype.clone=function(e){return a.clone(this,e)},a.prototype.equals=function(e){return a.equals(this,e)},a.prototype.equalsEpsilon=function(e,r,t){return a.equalsEpsilon(this,e,r,t)},a.prototype.toString=function(){return"("+this.x+", "+this.y+", "+this.z+")"},a}),define("Core/scaleToGeodeticSurface",["./Cartesian3","./defined","./DeveloperError","./Math"],function(e,r,t,n){"use strict";function i(i,u,s,c,l){if(!r(i))throw new t("cartesian is required.");if(!r(u))throw new t("oneOverRadii is required.");if(!r(s))throw new t("oneOverRadiiSquared is required.");if(!r(c))throw new t("centerToleranceSquared is required.");var f=i.x,h=i.y,w=i.z,d=u.x,m=u.y,E=u.z,p=f*f*d*d,y=h*h*m*m,_=w*w*E*E,T=p+y+_,R=Math.sqrt(1/T),A=e.multiplyByScalar(i,R,a);if(c>T)return isFinite(R)?e.clone(A,l):void 0;var v=s.x,N=s.y,I=s.z,S=o;S.x=A.x*v*2,S.y=A.y*N*2,S.z=A.z*I*2;var g,M,O,q,x,b,P,L,C,F,U,D=(1-R)*e.magnitude(i)/(.5*e.magnitude(S)),z=0;do{D-=z,O=1/(1+D*v),q=1/(1+D*N),x=1/(1+D*I),b=O*O,P=q*q,L=x*x,C=b*O,F=P*q,U=L*x,g=p*b+y*P+_*L-1,M=p*C*v+y*F*N+_*U*I;var B=-2*M;z=g/B}while(Math.abs(g)>n.EPSILON12);return r(l)?(l.x=f*O,l.y=h*q,l.z=w*x,l):new e(f*O,h*q,w*x)}var a=new e,o=new e;return i}),define("Core/Cartographic",["./Cartesian3","./defaultValue","./defined","./DeveloperError","./freezeObject","./Math","./scaleToGeodeticSurface"],function(e,r,t,n,i,a,o){"use strict";function u(e,t,n){this.longitude=r(e,0),this.latitude=r(t,0),this.height=r(n,0)}u.fromRadians=function(e,i,a,o){if(!t(e))throw new n("longitude is required.");if(!t(i))throw new n("latitude is required.");return a=r(a,0),t(o)?(o.longitude=e,o.latitude=i,o.height=a,o):new u(e,i,a)},u.fromDegrees=function(e,r,i,o){if(!t(e))throw new n("longitude is required.");if(!t(r))throw new n("latitude is required.");return e=a.toRadians(e),r=a.toRadians(r),u.fromRadians(e,r,i,o)};var s=new e,c=new e,l=new e,f=new e(1/6378137,1/6378137,1/6356752.314245179),h=new e(1/40680631590769,1/40680631590769,1/40408299984661.445),w=a.EPSILON1;return u.fromCartesian=function(r,n,i){var d=t(n)?n.oneOverRadii:f,m=t(n)?n.oneOverRadiiSquared:h,E=t(n)?n._centerToleranceSquared:w,p=o(r,d,m,E,c);if(t(p)){var y=e.multiplyComponents(r,m,s);y=e.normalize(y,y);var _=e.subtract(r,p,l),T=Math.atan2(y.y,y.x),R=Math.asin(y.z),A=a.sign(e.dot(_,r))*e.magnitude(_);return t(i)?(i.longitude=T,i.latitude=R,i.height=A,i):new u(T,R,A)}},u.clone=function(e,r){return t(e)?t(r)?(r.longitude=e.longitude,r.latitude=e.latitude,r.height=e.height,r):new u(e.longitude,e.latitude,e.height):void 0},u.equals=function(e,r){return e===r||t(e)&&t(r)&&e.longitude===r.longitude&&e.latitude===r.latitude&&e.height===r.height},u.equalsEpsilon=function(e,r,i){if("number"!=typeof i)throw new n("epsilon is required and must be a number.");return e===r||t(e)&&t(r)&&Math.abs(e.longitude-r.longitude)<=i&&Math.abs(e.latitude-r.latitude)<=i&&Math.abs(e.height-r.height)<=i},u.ZERO=i(new u(0,0,0)),u.prototype.clone=function(e){return u.clone(this,e)},u.prototype.equals=function(e){return u.equals(this,e)},u.prototype.equalsEpsilon=function(e,r){return u.equalsEpsilon(this,e,r)},u.prototype.toString=function(){return"("+this.longitude+", "+this.latitude+", "+this.height+")"},u}),define("Core/defineProperties",["./defined"],function(e){"use strict";var r=function(){try{return"x"in Object.defineProperty({},"x",{})}catch(e){return!1}}(),t=Object.defineProperties;return r&&e(t)||(t=function(e){return e}),t}),define("Core/Ellipsoid",["./Cartesian3","./Cartographic","./defaultValue","./defined","./defineProperties","./DeveloperError","./freezeObject","./Math","./scaleToGeodeticSurface"],function(e,r,t,n,i,a,o,u,s){"use strict";function c(r,n,i,o){if(n=t(n,0),i=t(i,0),o=t(o,0),0>n||0>i||0>o)throw new a("All radii components must be greater than or equal to zero.");r._radii=new e(n,i,o),r._radiiSquared=new e(n*n,i*i,o*o),r._radiiToTheFourth=new e(n*n*n*n,i*i*i*i,o*o*o*o),r._oneOverRadii=new e(0===n?0:1/n,0===i?0:1/i,0===o?0:1/o),r._oneOverRadiiSquared=new e(0===n?0:1/(n*n),0===i?0:1/(i*i),0===o?0:1/(o*o)),r._minimumRadius=Math.min(n,i,o),r._maximumRadius=Math.max(n,i,o),r._centerToleranceSquared=u.EPSILON1}function l(e,r,t){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,c(this,e,r,t)}i(l.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}}}),l.clone=function(r,t){if(n(r)){var i=r._radii;return n(t)?(e.clone(i,t._radii),e.clone(r._radiiSquared,t._radiiSquared),e.clone(r._radiiToTheFourth,t._radiiToTheFourth),e.clone(r._oneOverRadii,t._oneOverRadii),e.clone(r._oneOverRadiiSquared,t._oneOverRadiiSquared),t._minimumRadius=r._minimumRadius,t._maximumRadius=r._maximumRadius,t._centerToleranceSquared=r._centerToleranceSquared,t):new l(i.x,i.y,i.z)}},l.fromCartesian3=function(e,r){return n(r)||(r=new l),n(e)?(c(r,e.x,e.y,e.z),r):r},l.WGS84=o(new l(6378137,6378137,6356752.314245179)),l.UNIT_SPHERE=o(new l(1,1,1)),l.MOON=o(new l(u.LUNAR_RADIUS,u.LUNAR_RADIUS,u.LUNAR_RADIUS)),l.prototype.clone=function(e){return l.clone(this,e)},l.packedLength=e.packedLength,l.pack=function(r,i,o){if(!n(r))throw new a("value is required");if(!n(i))throw new a("array is required");o=t(o,0),e.pack(r._radii,i,o)},l.unpack=function(r,i,o){if(!n(r))throw new a("array is required");i=t(i,0);var u=e.unpack(r,i);return l.fromCartesian3(u,o)},l.prototype.geocentricSurfaceNormal=e.normalize,l.prototype.geodeticSurfaceNormalCartographic=function(r,t){if(!n(r))throw new a("cartographic is required.");var i=r.longitude,o=r.latitude,u=Math.cos(o),s=u*Math.cos(i),c=u*Math.sin(i),l=Math.sin(o);return n(t)||(t=new e),t.x=s,t.y=c,t.z=l,e.normalize(t,t)},l.prototype.geodeticSurfaceNormal=function(r,t){return n(t)||(t=new e),t=e.multiplyComponents(r,this._oneOverRadiiSquared,t),e.normalize(t,t)};var f=new e,h=new e;l.prototype.cartographicToCartesian=function(r,t){var i=f,a=h;this.geodeticSurfaceNormalCartographic(r,i),e.multiplyComponents(this._radiiSquared,i,a);var o=Math.sqrt(e.dot(i,a));return e.divideByScalar(a,o,a),e.multiplyByScalar(i,r.height,i),n(t)||(t=new e),e.add(a,i,t)},l.prototype.cartographicArrayToCartesianArray=function(e,r){if(!n(e))throw new a("cartographics is required.");var t=e.length;n(r)?r.length=t:r=new Array(t);for(var i=0;t>i;i++)r[i]=this.cartographicToCartesian(e[i],r[i]);return r};var w=new e,d=new e,m=new e;return l.prototype.cartesianToCartographic=function(t,i){var a=this.scaleToGeodeticSurface(t,d);if(n(a)){var o=this.geodeticSurfaceNormal(a,w),s=e.subtract(t,a,m),c=Math.atan2(o.y,o.x),l=Math.asin(o.z),f=u.sign(e.dot(s,t))*e.magnitude(s);return n(i)?(i.longitude=c,i.latitude=l,i.height=f,i):new r(c,l,f)}},l.prototype.cartesianArrayToCartographicArray=function(e,r){if(!n(e))throw new a("cartesians is required.");var t=e.length;n(r)?r.length=t:r=new Array(t);for(var i=0;t>i;++i)r[i]=this.cartesianToCartographic(e[i],r[i]);return r},l.prototype.scaleToGeodeticSurface=function(e,r){return s(e,this._oneOverRadii,this._oneOverRadiiSquared,this._centerToleranceSquared,r)},l.prototype.scaleToGeocentricSurface=function(r,t){if(!n(r))throw new a("cartesian is required.");n(t)||(t=new e);var i=r.x,o=r.y,u=r.z,s=this._oneOverRadiiSquared,c=1/Math.sqrt(i*i*s.x+o*o*s.y+u*u*s.z);return e.multiplyByScalar(r,c,t)},l.prototype.transformPositionToScaledSpace=function(r,t){return n(t)||(t=new e),e.multiplyComponents(r,this._oneOverRadii,t)},l.prototype.transformPositionFromScaledSpace=function(r,t){return n(t)||(t=new e),e.multiplyComponents(r,this._radii,t)},l.prototype.equals=function(r){return this===r||n(r)&&e.equals(this._radii,r._radii)},l.prototype.toString=function(){return this._radii.toString()},l}),define("Core/GeographicProjection",["./Cartesian3","./Cartographic","./defaultValue","./defined","./defineProperties","./DeveloperError","./Ellipsoid"],function(e,r,t,n,i,a,o){"use strict";function u(e){this._ellipsoid=t(e,o.WGS84),this._semimajorAxis=this._ellipsoid.maximumRadius,this._oneOverSemimajorAxis=1/this._semimajorAxis}return i(u.prototype,{ellipsoid:{get:function(){return this._ellipsoid}}}),u.prototype.project=function(r,t){var i=this._semimajorAxis,a=r.longitude*i,o=r.latitude*i,u=r.height;return n(t)?(t.x=a,t.y=o,t.z=u,t):new e(a,o,u)},u.prototype.unproject=function(e,t){if(!n(e))throw new a("cartesian is required");var i=this._oneOverSemimajorAxis,o=e.x*i,u=e.y*i,s=e.z;return n(t)?(t.longitude=o,t.latitude=u,t.height=s,t):new r(o,u,s)},u}),define("Core/Intersect",["./freezeObject"],function(e){"use strict";var r={OUTSIDE:-1,INTERSECTING:0,INSIDE:1};return e(r)}),define("Core/Interval",["./defaultValue"],function(e){"use strict";function r(r,t){this.start=e(r,0),this.stop=e(t,0)}return r}),define("Core/Matrix3",["./Cartesian3","./defaultValue","./defined","./defineProperties","./DeveloperError","./freezeObject","./Math"],function(e,r,t,n,i,a,o){"use strict";function u(e,t,n,i,a,o,u,s,c){this[0]=r(e,0),this[1]=r(i,0),this[2]=r(u,0),this[3]=r(t,0),this[4]=r(a,0),this[5]=r(s,0),this[6]=r(n,0),this[7]=r(o,0),this[8]=r(c,0)}function s(e){for(var r=0,t=0;9>t;++t){var n=e[t];r+=n*n}return Math.sqrt(r)}function c(e){for(var r=0,t=0;3>t;++t){var n=e[u.getElementIndex(d[t],w[t])];r+=2*n*n}return Math.sqrt(r)}function l(e,r){for(var t=o.EPSILON15,n=0,i=1,a=0;3>a;++a){var s=Math.abs(e[u.getElementIndex(d[a],w[a])]);s>n&&(i=a,n=s)}var c=1,l=0,f=w[i],h=d[i];if(Math.abs(e[u.getElementIndex(h,f)])>t){var m,E=e[u.getElementIndex(h,h)],p=e[u.getElementIndex(f,f)],y=e[u.getElementIndex(h,f)],_=(E-p)/2/y;m=0>_?-1/(-_+Math.sqrt(1+_*_)):1/(_+Math.sqrt(1+_*_)),c=1/Math.sqrt(1+m*m),l=m*c}return r=u.clone(u.IDENTITY,r),r[u.getElementIndex(f,f)]=r[u.getElementIndex(h,h)]=c,r[u.getElementIndex(h,f)]=l,r[u.getElementIndex(f,h)]=-l,r}u.packedLength=9,u.pack=function(e,n,a){if(!t(e))throw new i("value is required");if(!t(n))throw new i("array is required");a=r(a,0),n[a++]=e[0],n[a++]=e[1],n[a++]=e[2],n[a++]=e[3],n[a++]=e[4],n[a++]=e[5],n[a++]=e[6],n[a++]=e[7],n[a++]=e[8]},u.unpack=function(e,n,a){if(!t(e))throw new i("array is required");return n=r(n,0),t(a)||(a=new u),a[0]=e[n++],a[1]=e[n++],a[2]=e[n++],a[3]=e[n++],a[4]=e[n++],a[5]=e[n++],a[6]=e[n++],a[7]=e[n++],a[8]=e[n++],a},u.clone=function(e,r){return t(e)?t(r)?(r[0]=e[0],r[1]=e[1],r[2]=e[2],r[3]=e[3],r[4]=e[4],r[5]=e[5],r[6]=e[6],r[7]=e[7],r[8]=e[8],r):new u(e[0],e[3],e[6],e[1],e[4],e[7],e[2],e[5],e[8]):void 0},u.fromArray=function(e,n,a){if(!t(e))throw new i("array is required");return n=r(n,0),t(a)||(a=new u),a[0]=e[n],a[1]=e[n+1],a[2]=e[n+2],a[3]=e[n+3],a[4]=e[n+4],a[5]=e[n+5],a[6]=e[n+6],a[7]=e[n+7],a[8]=e[n+8],a},u.fromColumnMajorArray=function(e,r){if(!t(e))throw new i("values parameter is required");return u.clone(e,r)},u.fromRowMajorArray=function(e,r){if(!t(e))throw new i("values is required.");return t(r)?(r[0]=e[0],r[1]=e[3],r[2]=e[6],r[3]=e[1],r[4]=e[4],r[5]=e[7],r[6]=e[2],r[7]=e[5],r[8]=e[8],r):new u(e[0],e[1],e[2],e[3],e[4],e[5],e[6],e[7],e[8])},u.fromQuaternion=function(e,r){if(!t(e))throw new i("quaternion is required");var n=e.x*e.x,a=e.x*e.y,o=e.x*e.z,s=e.x*e.w,c=e.y*e.y,l=e.y*e.z,f=e.y*e.w,h=e.z*e.z,w=e.z*e.w,d=e.w*e.w,m=n-c-h+d,E=2*(a-w),p=2*(o+f),y=2*(a+w),_=-n+c-h+d,T=2*(l-s),R=2*(o-f),A=2*(l+s),v=-n-c+h+d;return t(r)?(r[0]=m,r[1]=y,r[2]=R,r[3]=E,r[4]=_,r[5]=A,r[6]=p,r[7]=T,r[8]=v,r):new u(m,E,p,y,_,T,R,A,v)},u.fromScale=function(e,r){if(!t(e))throw new i("scale is required.");return t(r)?(r[0]=e.x,r[1]=0,r[2]=0,r[3]=0,r[4]=e.y,r[5]=0,r[6]=0,r[7]=0,r[8]=e.z,r):new u(e.x,0,0,0,e.y,0,0,0,e.z)},u.fromUniformScale=function(e,r){if("number"!=typeof e)throw new i("scale is required.");return t(r)?(r[0]=e,r[1]=0,r[2]=0,r[3]=0,r[4]=e,r[5]=0,r[6]=0,r[7]=0,r[8]=e,r):new u(e,0,0,0,e,0,0,0,e)},u.fromCrossProduct=function(e,r){if(!t(e))throw new i("vector is required.");return t(r)?(r[0]=0,r[1]=e.z,r[2]=-e.y,r[3]=-e.z,r[4]=0,r[5]=e.x,r[6]=e.y,r[7]=-e.x,r[8]=0,r):new u(0,-e.z,e.y,e.z,0,-e.x,-e.y,e.x,0)},u.fromRotationX=function(e,r){if(!t(e))throw new i("angle is required.");var n=Math.cos(e),a=Math.sin(e);return t(r)?(r[0]=1,r[1]=0,r[2]=0,r[3]=0,r[4]=n,r[5]=a,r[6]=0,r[7]=-a,r[8]=n,r):new u(1,0,0,0,n,-a,0,a,n)},u.fromRotationY=function(e,r){if(!t(e))throw new i("angle is required.");var n=Math.cos(e),a=Math.sin(e);return t(r)?(r[0]=n,r[1]=0,r[2]=-a,r[3]=0,r[4]=1,r[5]=0,r[6]=a,r[7]=0,r[8]=n,r):new u(n,0,a,0,1,0,-a,0,n)},u.fromRotationZ=function(e,r){if(!t(e))throw new i("angle is required.");var n=Math.cos(e),a=Math.sin(e);return t(r)?(r[0]=n,r[1]=a,r[2]=0,r[3]=-a,r[4]=n,r[5]=0,r[6]=0,r[7]=0,r[8]=1,r):new u(n,-a,0,a,n,0,0,0,1)},u.toArray=function(e,r){if(!t(e))throw new i("matrix is required");return t(r)?(r[0]=e[0],r[1]=e[1],r[2]=e[2],r[3]=e[3],r[4]=e[4],r[5]=e[5],r[6]=e[6],r[7]=e[7],r[8]=e[8],r):[e[0],e[1],e[2],e[3],e[4],e[5],e[6],e[7],e[8]]},u.getElementIndex=function(e,r){if("number"!=typeof r||0>r||r>2)throw new i("row must be 0, 1, or 2.");if("number"!=typeof e||0>e||e>2)throw new i("column must be 0, 1, or 2.");return 3*e+r},u.getColumn=function(e,r,n){if(!t(e))throw new i("matrix is required.");if("number"!=typeof r||0>r||r>2)throw new i("index must be 0, 1, or 2.");if(!t(n))throw new i("result is required");var a=3*r,o=e[a],u=e[a+1],s=e[a+2];return n.x=o,n.y=u,n.z=s,n},u.setColumn=function(e,r,n,a){if(!t(e))throw new i("matrix is required");if(!t(n))throw new i("cartesian is required");if("number"!=typeof r||0>r||r>2)throw new i("index must be 0, 1, or 2.");if(!t(a))throw new i("result is required");a=u.clone(e,a);var o=3*r;return a[o]=n.x,a[o+1]=n.y,a[o+2]=n.z,a},u.getRow=function(e,r,n){if(!t(e))throw new i("matrix is required.");if("number"!=typeof r||0>r||r>2)throw new i("index must be 0, 1, or 2.");if(!t(n))throw new i("result is required");var a=e[r],o=e[r+3],u=e[r+6];return n.x=a,n.y=o,n.z=u,n},u.setRow=function(e,r,n,a){if(!t(e))throw new i("matrix is required");if(!t(n))throw new i("cartesian is required");if("number"!=typeof r||0>r||r>2)throw new i("index must be 0, 1, or 2.");if(!t(a))throw new i("result is required");return a=u.clone(e,a),a[r]=n.x,a[r+3]=n.y,a[r+6]=n.z,a};var f=new e;u.getScale=function(r,n){if(!t(r))throw new i("matrix is required.");if(!t(n))throw new i("result is required");return n.x=e.magnitude(e.fromElements(r[0],r[1],r[2],f)),n.y=e.magnitude(e.fromElements(r[3],r[4],r[5],f)),n.z=e.magnitude(e.fromElements(r[6],r[7],r[8],f)),n};var h=new e;u.getMaximumScale=function(r){return u.getScale(r,h),e.maximumComponent(h)},u.multiply=function(e,r,n){if(!t(e))throw new i("left is required");if(!t(r))throw new i("right is required");if(!t(n))throw new i("result is required");var a=e[0]*r[0]+e[3]*r[1]+e[6]*r[2],o=e[1]*r[0]+e[4]*r[1]+e[7]*r[2],u=e[2]*r[0]+e[5]*r[1]+e[8]*r[2],s=e[0]*r[3]+e[3]*r[4]+e[6]*r[5],c=e[1]*r[3]+e[4]*r[4]+e[7]*r[5],l=e[2]*r[3]+e[5]*r[4]+e[8]*r[5],f=e[0]*r[6]+e[3]*r[7]+e[6]*r[8],h=e[1]*r[6]+e[4]*r[7]+e[7]*r[8],w=e[2]*r[6]+e[5]*r[7]+e[8]*r[8];return n[0]=a,n[1]=o,n[2]=u,n[3]=s,n[4]=c,n[5]=l,n[6]=f,n[7]=h,n[8]=w,n},u.add=function(e,r,n){if(!t(e))throw new i("left is required");if(!t(r))throw new i("right is required");if(!t(n))throw new i("result is required");return n[0]=e[0]+r[0],n[1]=e[1]+r[1],n[2]=e[2]+r[2],n[3]=e[3]+r[3],n[4]=e[4]+r[4],n[5]=e[5]+r[5],n[6]=e[6]+r[6],n[7]=e[7]+r[7],n[8]=e[8]+r[8],n},u.subtract=function(e,r,n){if(!t(e))throw new i("left is required");if(!t(r))throw new i("right is required");if(!t(n))throw new i("result is required");return n[0]=e[0]-r[0],n[1]=e[1]-r[1],n[2]=e[2]-r[2],n[3]=e[3]-r[3],n[4]=e[4]-r[4],n[5]=e[5]-r[5],n[6]=e[6]-r[6],n[7]=e[7]-r[7],n[8]=e[8]-r[8],n},u.multiplyByVector=function(e,r,n){if(!t(e))throw new i("matrix is required");if(!t(r))throw new i("cartesian is required");if(!t(n))throw new i("result is required");var a=r.x,o=r.y,u=r.z,s=e[0]*a+e[3]*o+e[6]*u,c=e[1]*a+e[4]*o+e[7]*u,l=e[2]*a+e[5]*o+e[8]*u;return n.x=s,n.y=c,n.z=l,n},u.multiplyByScalar=function(e,r,n){if(!t(e))throw new i("matrix is required");if("number"!=typeof r)throw new i("scalar must be a number");if(!t(n))throw new i("result is required");return n[0]=e[0]*r,n[1]=e[1]*r,n[2]=e[2]*r,n[3]=e[3]*r,n[4]=e[4]*r,n[5]=e[5]*r,n[6]=e[6]*r,n[7]=e[7]*r,n[8]=e[8]*r,n},u.multiplyByScale=function(e,r,n){if(!t(e))throw new i("matrix is required");if(!t(r))throw new i("scale is required");if(!t(n))throw new i("result is required");return n[0]=e[0]*r.x,n[1]=e[1]*r.x,n[2]=e[2]*r.x,n[3]=e[3]*r.y,n[4]=e[4]*r.y,n[5]=e[5]*r.y,n[6]=e[6]*r.z,n[7]=e[7]*r.z,n[8]=e[8]*r.z,n},u.negate=function(e,r){if(!t(e))throw new i("matrix is required");if(!t(r))throw new i("result is required");return r[0]=-e[0],r[1]=-e[1],r[2]=-e[2],r[3]=-e[3],r[4]=-e[4],r[5]=-e[5],r[6]=-e[6],r[7]=-e[7],r[8]=-e[8],r},u.transpose=function(e,r){if(!t(e))throw new i("matrix is required");if(!t(r))throw new i("result is required");var n=e[0],a=e[3],o=e[6],u=e[1],s=e[4],c=e[7],l=e[2],f=e[5],h=e[8];return r[0]=n,r[1]=a,r[2]=o,r[3]=u,r[4]=s,r[5]=c,r[6]=l,r[7]=f,r[8]=h,r};var w=[1,0,0],d=[2,2,1],m=new u,E=new u;return u.computeEigenDecomposition=function(e,r){if(!t(e))throw new i("matrix is required.");var n=o.EPSILON20,a=10,f=0,h=0;t(r)||(r={});for(var w=r.unitary=u.clone(u.IDENTITY,r.unitary),d=r.diagonal=u.clone(e,r.diagonal),p=n*s(d);a>h&&c(d)>p;)l(d,m),u.transpose(m,E),u.multiply(d,m,d),u.multiply(E,d,d),u.multiply(w,m,w),++f>2&&(++h,f=0);return r},u.abs=function(e,r){if(!t(e))throw new i("matrix is required");if(!t(r))throw new i("result is required");return r[0]=Math.abs(e[0]),r[1]=Math.abs(e[1]),r[2]=Math.abs(e[2]),r[3]=Math.abs(e[3]),r[4]=Math.abs(e[4]),r[5]=Math.abs(e[5]),r[6]=Math.abs(e[6]),r[7]=Math.abs(e[7]),r[8]=Math.abs(e[8]),r},u.determinant=function(e){if(!t(e))throw new i("matrix is required");var r=e[0],n=e[3],a=e[6],o=e[1],u=e[4],s=e[7],c=e[2],l=e[5],f=e[8];return r*(u*f-l*s)+o*(l*a-n*f)+c*(n*s-u*a)},u.inverse=function(e,r){if(!t(e))throw new i("matrix is required");if(!t(r))throw new i("result is required");var n=e[0],a=e[1],s=e[2],c=e[3],l=e[4],f=e[5],h=e[6],w=e[7],d=e[8],m=u.determinant(e);if(Math.abs(m)<=o.EPSILON15)throw new i("matrix is not invertible");r[0]=l*d-w*f,r[1]=w*s-a*d,r[2]=a*f-l*s,r[3]=h*f-c*d,r[4]=n*d-h*s,r[5]=c*s-n*f,r[6]=c*w-h*l,r[7]=h*a-n*w,r[8]=n*l-c*a;var E=1/m;return u.multiplyByScalar(r,E,r)},u.equals=function(e,r){return e===r||t(e)&&t(r)&&e[0]===r[0]&&e[1]===r[1]&&e[2]===r[2]&&e[3]===r[3]&&e[4]===r[4]&&e[5]===r[5]&&e[6]===r[6]&&e[7]===r[7]&&e[8]===r[8];
  },u.equalsEpsilon=function(e,r,n){if("number"!=typeof n)throw new i("epsilon must be a number");return e===r||t(e)&&t(r)&&Math.abs(e[0]-r[0])<=n&&Math.abs(e[1]-r[1])<=n&&Math.abs(e[2]-r[2])<=n&&Math.abs(e[3]-r[3])<=n&&Math.abs(e[4]-r[4])<=n&&Math.abs(e[5]-r[5])<=n&&Math.abs(e[6]-r[6])<=n&&Math.abs(e[7]-r[7])<=n&&Math.abs(e[8]-r[8])<=n},u.IDENTITY=a(new u(1,0,0,0,1,0,0,0,1)),u.ZERO=a(new u(0,0,0,0,0,0,0,0,0)),u.COLUMN0ROW0=0,u.COLUMN0ROW1=1,u.COLUMN0ROW2=2,u.COLUMN1ROW0=3,u.COLUMN1ROW1=4,u.COLUMN1ROW2=5,u.COLUMN2ROW0=6,u.COLUMN2ROW1=7,u.COLUMN2ROW2=8,n(u.prototype,{length:{get:function(){return u.packedLength}}}),u.prototype.clone=function(e){return u.clone(this,e)},u.prototype.equals=function(e){return u.equals(this,e)},u.equalsArray=function(e,r,t){return e[0]===r[t]&&e[1]===r[t+1]&&e[2]===r[t+2]&&e[3]===r[t+3]&&e[4]===r[t+4]&&e[5]===r[t+5]&&e[6]===r[t+6]&&e[7]===r[t+7]&&e[8]===r[t+8]},u.prototype.equalsEpsilon=function(e,r){return u.equalsEpsilon(this,e,r)},u.prototype.toString=function(){return"("+this[0]+", "+this[3]+", "+this[6]+")\n("+this[1]+", "+this[4]+", "+this[7]+")\n("+this[2]+", "+this[5]+", "+this[8]+")"},u}),define("Core/Cartesian4",["./defaultValue","./defined","./DeveloperError","./freezeObject","./Math"],function(e,r,t,n,i){"use strict";function a(r,t,n,i){this.x=e(r,0),this.y=e(t,0),this.z=e(n,0),this.w=e(i,0)}a.fromElements=function(e,t,n,i,o){return r(o)?(o.x=e,o.y=t,o.z=n,o.w=i,o):new a(e,t,n,i)},a.fromColor=function(e,n){if(!r(e))throw new t("color is required");return r(n)?(n.x=e.red,n.y=e.green,n.z=e.blue,n.w=e.alpha,n):new a(e.red,e.green,e.blue,e.alpha)},a.clone=function(e,t){return r(e)?r(t)?(t.x=e.x,t.y=e.y,t.z=e.z,t.w=e.w,t):new a(e.x,e.y,e.z,e.w):void 0},a.packedLength=4,a.pack=function(n,i,a){if(!r(n))throw new t("value is required");if(!r(i))throw new t("array is required");a=e(a,0),i[a++]=n.x,i[a++]=n.y,i[a++]=n.z,i[a]=n.w},a.unpack=function(n,i,o){if(!r(n))throw new t("array is required");return i=e(i,0),r(o)||(o=new a),o.x=n[i++],o.y=n[i++],o.z=n[i++],o.w=n[i],o},a.fromArray=a.unpack,a.maximumComponent=function(e){if(!r(e))throw new t("cartesian is required");return Math.max(e.x,e.y,e.z,e.w)},a.minimumComponent=function(e){if(!r(e))throw new t("cartesian is required");return Math.min(e.x,e.y,e.z,e.w)},a.minimumByComponent=function(e,n,i){if(!r(e))throw new t("first is required.");if(!r(n))throw new t("second is required.");if(!r(i))throw new t("result is required.");return i.x=Math.min(e.x,n.x),i.y=Math.min(e.y,n.y),i.z=Math.min(e.z,n.z),i.w=Math.min(e.w,n.w),i},a.maximumByComponent=function(e,n,i){if(!r(e))throw new t("first is required.");if(!r(n))throw new t("second is required.");if(!r(i))throw new t("result is required.");return i.x=Math.max(e.x,n.x),i.y=Math.max(e.y,n.y),i.z=Math.max(e.z,n.z),i.w=Math.max(e.w,n.w),i},a.magnitudeSquared=function(e){if(!r(e))throw new t("cartesian is required");return e.x*e.x+e.y*e.y+e.z*e.z+e.w*e.w},a.magnitude=function(e){return Math.sqrt(a.magnitudeSquared(e))};var o=new a;a.distance=function(e,n){if(!r(e)||!r(n))throw new t("left and right are required.");return a.subtract(e,n,o),a.magnitude(o)},a.distanceSquared=function(e,n){if(!r(e)||!r(n))throw new t("left and right are required.");return a.subtract(e,n,o),a.magnitudeSquared(o)},a.normalize=function(e,n){if(!r(e))throw new t("cartesian is required");if(!r(n))throw new t("result is required");var i=a.magnitude(e);return n.x=e.x/i,n.y=e.y/i,n.z=e.z/i,n.w=e.w/i,n},a.dot=function(e,n){if(!r(e))throw new t("left is required");if(!r(n))throw new t("right is required");return e.x*n.x+e.y*n.y+e.z*n.z+e.w*n.w},a.multiplyComponents=function(e,n,i){if(!r(e))throw new t("left is required");if(!r(n))throw new t("right is required");if(!r(i))throw new t("result is required");return i.x=e.x*n.x,i.y=e.y*n.y,i.z=e.z*n.z,i.w=e.w*n.w,i},a.add=function(e,n,i){if(!r(e))throw new t("left is required");if(!r(n))throw new t("right is required");if(!r(i))throw new t("result is required");return i.x=e.x+n.x,i.y=e.y+n.y,i.z=e.z+n.z,i.w=e.w+n.w,i},a.subtract=function(e,n,i){if(!r(e))throw new t("left is required");if(!r(n))throw new t("right is required");if(!r(i))throw new t("result is required");return i.x=e.x-n.x,i.y=e.y-n.y,i.z=e.z-n.z,i.w=e.w-n.w,i},a.multiplyByScalar=function(e,n,i){if(!r(e))throw new t("cartesian is required");if("number"!=typeof n)throw new t("scalar is required and must be a number.");if(!r(i))throw new t("result is required");return i.x=e.x*n,i.y=e.y*n,i.z=e.z*n,i.w=e.w*n,i},a.divideByScalar=function(e,n,i){if(!r(e))throw new t("cartesian is required");if("number"!=typeof n)throw new t("scalar is required and must be a number.");if(!r(i))throw new t("result is required");return i.x=e.x/n,i.y=e.y/n,i.z=e.z/n,i.w=e.w/n,i},a.negate=function(e,n){if(!r(e))throw new t("cartesian is required");if(!r(n))throw new t("result is required");return n.x=-e.x,n.y=-e.y,n.z=-e.z,n.w=-e.w,n},a.abs=function(e,n){if(!r(e))throw new t("cartesian is required");if(!r(n))throw new t("result is required");return n.x=Math.abs(e.x),n.y=Math.abs(e.y),n.z=Math.abs(e.z),n.w=Math.abs(e.w),n};var u=new a;a.lerp=function(e,n,i,o){if(!r(e))throw new t("start is required.");if(!r(n))throw new t("end is required.");if("number"!=typeof i)throw new t("t is required and must be a number.");if(!r(o))throw new t("result is required.");return a.multiplyByScalar(n,i,u),o=a.multiplyByScalar(e,1-i,o),a.add(u,o,o)};var s=new a;return a.mostOrthogonalAxis=function(e,n){if(!r(e))throw new t("cartesian is required.");if(!r(n))throw new t("result is required.");var i=a.normalize(e,s);return a.abs(i,i),n=i.x<=i.y?i.x<=i.z?i.x<=i.w?a.clone(a.UNIT_X,n):a.clone(a.UNIT_W,n):i.z<=i.w?a.clone(a.UNIT_Z,n):a.clone(a.UNIT_W,n):i.y<=i.z?i.y<=i.w?a.clone(a.UNIT_Y,n):a.clone(a.UNIT_W,n):i.z<=i.w?a.clone(a.UNIT_Z,n):a.clone(a.UNIT_W,n)},a.equals=function(e,t){return e===t||r(e)&&r(t)&&e.x===t.x&&e.y===t.y&&e.z===t.z&&e.w===t.w},a.equalsArray=function(e,r,t){return e.x===r[t]&&e.y===r[t+1]&&e.z===r[t+2]&&e.w===r[t+3]},a.equalsEpsilon=function(e,t,n,a){return e===t||r(e)&&r(t)&&i.equalsEpsilon(e.x,t.x,n,a)&&i.equalsEpsilon(e.y,t.y,n,a)&&i.equalsEpsilon(e.z,t.z,n,a)&&i.equalsEpsilon(e.w,t.w,n,a)},a.ZERO=n(new a(0,0,0,0)),a.UNIT_X=n(new a(1,0,0,0)),a.UNIT_Y=n(new a(0,1,0,0)),a.UNIT_Z=n(new a(0,0,1,0)),a.UNIT_W=n(new a(0,0,0,1)),a.prototype.clone=function(e){return a.clone(this,e)},a.prototype.equals=function(e){return a.equals(this,e)},a.prototype.equalsEpsilon=function(e,r,t){return a.equalsEpsilon(this,e,r,t)},a.prototype.toString=function(){return"("+this.x+", "+this.y+", "+this.z+", "+this.w+")"},a}),define("Core/RuntimeError",["./defined"],function(e){"use strict";function r(e){this.name="RuntimeError",this.message=e;var r;try{throw new Error}catch(t){r=t.stack}this.stack=r}return r.prototype.toString=function(){var r=this.name+": "+this.message;return e(this.stack)&&(r+="\n"+this.stack.toString()),r},r}),define("Core/Matrix4",["./Cartesian3","./Cartesian4","./defaultValue","./defined","./defineProperties","./DeveloperError","./freezeObject","./Math","./Matrix3","./RuntimeError"],function(e,r,t,n,i,a,o,u,s,c){"use strict";function l(e,r,n,i,a,o,u,s,c,l,f,h,w,d,m,E){this[0]=t(e,0),this[1]=t(a,0),this[2]=t(c,0),this[3]=t(w,0),this[4]=t(r,0),this[5]=t(o,0),this[6]=t(l,0),this[7]=t(d,0),this[8]=t(n,0),this[9]=t(u,0),this[10]=t(f,0),this[11]=t(m,0),this[12]=t(i,0),this[13]=t(s,0),this[14]=t(h,0),this[15]=t(E,0)}l.packedLength=16,l.pack=function(e,r,i){if(!n(e))throw new a("value is required");if(!n(r))throw new a("array is required");i=t(i,0),r[i++]=e[0],r[i++]=e[1],r[i++]=e[2],r[i++]=e[3],r[i++]=e[4],r[i++]=e[5],r[i++]=e[6],r[i++]=e[7],r[i++]=e[8],r[i++]=e[9],r[i++]=e[10],r[i++]=e[11],r[i++]=e[12],r[i++]=e[13],r[i++]=e[14],r[i]=e[15]},l.unpack=function(e,r,i){if(!n(e))throw new a("array is required");return r=t(r,0),n(i)||(i=new l),i[0]=e[r++],i[1]=e[r++],i[2]=e[r++],i[3]=e[r++],i[4]=e[r++],i[5]=e[r++],i[6]=e[r++],i[7]=e[r++],i[8]=e[r++],i[9]=e[r++],i[10]=e[r++],i[11]=e[r++],i[12]=e[r++],i[13]=e[r++],i[14]=e[r++],i[15]=e[r],i},l.clone=function(e,r){return n(e)?n(r)?(r[0]=e[0],r[1]=e[1],r[2]=e[2],r[3]=e[3],r[4]=e[4],r[5]=e[5],r[6]=e[6],r[7]=e[7],r[8]=e[8],r[9]=e[9],r[10]=e[10],r[11]=e[11],r[12]=e[12],r[13]=e[13],r[14]=e[14],r[15]=e[15],r):new l(e[0],e[4],e[8],e[12],e[1],e[5],e[9],e[13],e[2],e[6],e[10],e[14],e[3],e[7],e[11],e[15]):void 0},l.fromArray=l.unpack,l.fromColumnMajorArray=function(e,r){if(!n(e))throw new a("values is required");return l.clone(e,r)},l.fromRowMajorArray=function(e,r){if(!n(e))throw new a("values is required.");return n(r)?(r[0]=e[0],r[1]=e[4],r[2]=e[8],r[3]=e[12],r[4]=e[1],r[5]=e[5],r[6]=e[9],r[7]=e[13],r[8]=e[2],r[9]=e[6],r[10]=e[10],r[11]=e[14],r[12]=e[3],r[13]=e[7],r[14]=e[11],r[15]=e[15],r):new l(e[0],e[1],e[2],e[3],e[4],e[5],e[6],e[7],e[8],e[9],e[10],e[11],e[12],e[13],e[14],e[15])},l.fromRotationTranslation=function(r,i,o){if(!n(r))throw new a("rotation is required.");return i=t(i,e.ZERO),n(o)?(o[0]=r[0],o[1]=r[1],o[2]=r[2],o[3]=0,o[4]=r[3],o[5]=r[4],o[6]=r[5],o[7]=0,o[8]=r[6],o[9]=r[7],o[10]=r[8],o[11]=0,o[12]=i.x,o[13]=i.y,o[14]=i.z,o[15]=1,o):new l(r[0],r[3],r[6],i.x,r[1],r[4],r[7],i.y,r[2],r[5],r[8],i.z,0,0,0,1)},l.fromTranslationQuaternionRotationScale=function(e,r,t,i){if(!n(e))throw new a("translation is required.");if(!n(r))throw new a("rotation is required.");if(!n(t))throw new a("scale is required.");n(i)||(i=new l);var o=t.x,u=t.y,s=t.z,c=r.x*r.x,f=r.x*r.y,h=r.x*r.z,w=r.x*r.w,d=r.y*r.y,m=r.y*r.z,E=r.y*r.w,p=r.z*r.z,y=r.z*r.w,_=r.w*r.w,T=c-d-p+_,R=2*(f-y),A=2*(h+E),v=2*(f+y),N=-c+d-p+_,I=2*(m-w),S=2*(h-E),g=2*(m+w),M=-c-d+p+_;return i[0]=T*o,i[1]=v*o,i[2]=S*o,i[3]=0,i[4]=R*u,i[5]=N*u,i[6]=g*u,i[7]=0,i[8]=A*s,i[9]=I*s,i[10]=M*s,i[11]=0,i[12]=e.x,i[13]=e.y,i[14]=e.z,i[15]=1,i},l.fromTranslationRotationScale=function(e,r){if(!n(e))throw new a("translationRotationScale is required.");return l.fromTranslationQuaternionRotationScale(e.translation,e.rotation,e.scale,r)},l.fromTranslation=function(e,r){if(!n(e))throw new a("translation is required.");return l.fromRotationTranslation(s.IDENTITY,e,r)},l.fromScale=function(e,r){if(!n(e))throw new a("scale is required.");return n(r)?(r[0]=e.x,r[1]=0,r[2]=0,r[3]=0,r[4]=0,r[5]=e.y,r[6]=0,r[7]=0,r[8]=0,r[9]=0,r[10]=e.z,r[11]=0,r[12]=0,r[13]=0,r[14]=0,r[15]=1,r):new l(e.x,0,0,0,0,e.y,0,0,0,0,e.z,0,0,0,0,1)},l.fromUniformScale=function(e,r){if("number"!=typeof e)throw new a("scale is required.");return n(r)?(r[0]=e,r[1]=0,r[2]=0,r[3]=0,r[4]=0,r[5]=e,r[6]=0,r[7]=0,r[8]=0,r[9]=0,r[10]=e,r[11]=0,r[12]=0,r[13]=0,r[14]=0,r[15]=1,r):new l(e,0,0,0,0,e,0,0,0,0,e,0,0,0,0,1)};var f=new e,h=new e,w=new e;l.fromCamera=function(r,t){if(!n(r))throw new a("camera is required.");var i=r.eye,o=r.target,u=r.up;if(!n(i))throw new a("camera.eye is required.");if(!n(o))throw new a("camera.target is required.");if(!n(u))throw new a("camera.up is required.");e.normalize(e.subtract(o,i,f),f),e.normalize(e.cross(f,u,h),h),e.normalize(e.cross(h,f,w),w);var s=h.x,c=h.y,d=h.z,m=f.x,E=f.y,p=f.z,y=w.x,_=w.y,T=w.z,R=i.x,A=i.y,v=i.z,N=s*-R+c*-A+d*-v,I=y*-R+_*-A+T*-v,S=m*R+E*A+p*v;return n(t)?(t[0]=s,t[1]=y,t[2]=-m,t[3]=0,t[4]=c,t[5]=_,t[6]=-E,t[7]=0,t[8]=d,t[9]=T,t[10]=-p,t[11]=0,t[12]=N,t[13]=I,t[14]=S,t[15]=1,t):new l(s,c,d,N,y,_,T,I,-m,-E,-p,S,0,0,0,1)},l.computePerspectiveFieldOfView=function(e,r,t,i,o){if(0>=e||e>Math.PI)throw new a("fovY must be in [0, PI).");if(0>=r)throw new a("aspectRatio must be greater than zero.");if(0>=t)throw new a("near must be greater than zero.");if(0>=i)throw new a("far must be greater than zero.");if(!n(o))throw new a("result is required");var u=Math.tan(.5*e),s=1/u,c=s/r,l=(i+t)/(t-i),f=2*i*t/(t-i);return o[0]=c,o[1]=0,o[2]=0,o[3]=0,o[4]=0,o[5]=s,o[6]=0,o[7]=0,o[8]=0,o[9]=0,o[10]=l,o[11]=-1,o[12]=0,o[13]=0,o[14]=f,o[15]=0,o},l.computeOrthographicOffCenter=function(e,r,t,i,o,u,s){if(!n(e))throw new a("left is required.");if(!n(r))throw new a("right is required.");if(!n(t))throw new a("bottom is required.");if(!n(i))throw new a("top is required.");if(!n(o))throw new a("near is required.");if(!n(u))throw new a("far is required.");if(!n(s))throw new a("result is required");var c=1/(r-e),l=1/(i-t),f=1/(u-o),h=-(r+e)*c,w=-(i+t)*l,d=-(u+o)*f;return c*=2,l*=2,f*=-2,s[0]=c,s[1]=0,s[2]=0,s[3]=0,s[4]=0,s[5]=l,s[6]=0,s[7]=0,s[8]=0,s[9]=0,s[10]=f,s[11]=0,s[12]=h,s[13]=w,s[14]=d,s[15]=1,s},l.computePerspectiveOffCenter=function(e,r,t,i,o,u,s){if(!n(e))throw new a("left is required.");if(!n(r))throw new a("right is required.");if(!n(t))throw new a("bottom is required.");if(!n(i))throw new a("top is required.");if(!n(o))throw new a("near is required.");if(!n(u))throw new a("far is required.");if(!n(s))throw new a("result is required");var c=2*o/(r-e),l=2*o/(i-t),f=(r+e)/(r-e),h=(i+t)/(i-t),w=-(u+o)/(u-o),d=-1,m=-2*u*o/(u-o);return s[0]=c,s[1]=0,s[2]=0,s[3]=0,s[4]=0,s[5]=l,s[6]=0,s[7]=0,s[8]=f,s[9]=h,s[10]=w,s[11]=d,s[12]=0,s[13]=0,s[14]=m,s[15]=0,s},l.computeInfinitePerspectiveOffCenter=function(e,r,t,i,o,u){if(!n(e))throw new a("left is required.");if(!n(r))throw new a("right is required.");if(!n(t))throw new a("bottom is required.");if(!n(i))throw new a("top is required.");if(!n(o))throw new a("near is required.");if(!n(u))throw new a("result is required");var s=2*o/(r-e),c=2*o/(i-t),l=(r+e)/(r-e),f=(i+t)/(i-t),h=-1,w=-1,d=-2*o;return u[0]=s,u[1]=0,u[2]=0,u[3]=0,u[4]=0,u[5]=c,u[6]=0,u[7]=0,u[8]=l,u[9]=f,u[10]=h,u[11]=w,u[12]=0,u[13]=0,u[14]=d,u[15]=0,u},l.computeViewportTransformation=function(e,r,i,o){if(!n(o))throw new a("result is required");e=t(e,t.EMPTY_OBJECT);var u=t(e.x,0),s=t(e.y,0),c=t(e.width,0),l=t(e.height,0);r=t(r,0),i=t(i,1);var f=.5*c,h=.5*l,w=.5*(i-r),d=f,m=h,E=w,p=u+f,y=s+h,_=r+w,T=1;return o[0]=d,o[1]=0,o[2]=0,o[3]=0,o[4]=0,o[5]=m,o[6]=0,o[7]=0,o[8]=0,o[9]=0,o[10]=E,o[11]=0,o[12]=p,o[13]=y,o[14]=_,o[15]=T,o},l.toArray=function(e,r){if(!n(e))throw new a("matrix is required");return n(r)?(r[0]=e[0],r[1]=e[1],r[2]=e[2],r[3]=e[3],r[4]=e[4],r[5]=e[5],r[6]=e[6],r[7]=e[7],r[8]=e[8],r[9]=e[9],r[10]=e[10],r[11]=e[11],r[12]=e[12],r[13]=e[13],r[14]=e[14],r[15]=e[15],r):[e[0],e[1],e[2],e[3],e[4],e[5],e[6],e[7],e[8],e[9],e[10],e[11],e[12],e[13],e[14],e[15]]},l.getElementIndex=function(e,r){if("number"!=typeof r||0>r||r>3)throw new a("row must be 0, 1, 2, or 3.");if("number"!=typeof e||0>e||e>3)throw new a("column must be 0, 1, 2, or 3.");return 4*e+r},l.getColumn=function(e,r,t){if(!n(e))throw new a("matrix is required.");if("number"!=typeof r||0>r||r>3)throw new a("index must be 0, 1, 2, or 3.");if(!n(t))throw new a("result is required");var i=4*r,o=e[i],u=e[i+1],s=e[i+2],c=e[i+3];return t.x=o,t.y=u,t.z=s,t.w=c,t},l.setColumn=function(e,r,t,i){if(!n(e))throw new a("matrix is required");if(!n(t))throw new a("cartesian is required");if("number"!=typeof r||0>r||r>3)throw new a("index must be 0, 1, 2, or 3.");if(!n(i))throw new a("result is required");i=l.clone(e,i);var o=4*r;return i[o]=t.x,i[o+1]=t.y,i[o+2]=t.z,i[o+3]=t.w,i},l.setTranslation=function(e,r,t){if(!n(e))throw new a("matrix is required");if(!n(r))throw new a("translation is required");if(!n(t))throw new a("result is required");return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[4]=e[4],t[5]=e[5],t[6]=e[6],t[7]=e[7],t[8]=e[8],t[9]=e[9],t[10]=e[10],t[11]=e[11],t[12]=r.x,t[13]=r.y,t[14]=r.z,t[15]=e[15],t},l.getRow=function(e,r,t){if(!n(e))throw new a("matrix is required.");if("number"!=typeof r||0>r||r>3)throw new a("index must be 0, 1, 2, or 3.");if(!n(t))throw new a("result is required");var i=e[r],o=e[r+4],u=e[r+8],s=e[r+12];return t.x=i,t.y=o,t.z=u,t.w=s,t},l.setRow=function(e,r,t,i){if(!n(e))throw new a("matrix is required");if(!n(t))throw new a("cartesian is required");if("number"!=typeof r||0>r||r>3)throw new a("index must be 0, 1, 2, or 3.");if(!n(i))throw new a("result is required");return i=l.clone(e,i),i[r]=t.x,i[r+4]=t.y,i[r+8]=t.z,i[r+12]=t.w,i};var d=new e;l.getScale=function(r,t){if(!n(r))throw new a("matrix is required.");if(!n(t))throw new a("result is required");return t.x=e.magnitude(e.fromElements(r[0],r[1],r[2],d)),t.y=e.magnitude(e.fromElements(r[4],r[5],r[6],d)),t.z=e.magnitude(e.fromElements(r[8],r[9],r[10],d)),t};var m=new e;l.getMaximumScale=function(r){return l.getScale(r,m),e.maximumComponent(m)},l.multiply=function(e,r,t){if(!n(e))throw new a("left is required");if(!n(r))throw new a("right is required");if(!n(t))throw new a("result is required");var i=e[0],o=e[1],u=e[2],s=e[3],c=e[4],l=e[5],f=e[6],h=e[7],w=e[8],d=e[9],m=e[10],E=e[11],p=e[12],y=e[13],_=e[14],T=e[15],R=r[0],A=r[1],v=r[2],N=r[3],I=r[4],S=r[5],g=r[6],M=r[7],O=r[8],q=r[9],x=r[10],b=r[11],P=r[12],L=r[13],C=r[14],F=r[15],U=i*R+c*A+w*v+p*N,D=o*R+l*A+d*v+y*N,z=u*R+f*A+m*v+_*N,B=s*R+h*A+E*v+T*N,G=i*I+c*S+w*g+p*M,V=o*I+l*S+d*g+y*M,X=u*I+f*S+m*g+_*M,W=s*I+h*S+E*g+T*M,H=i*O+c*q+w*x+p*b,Y=o*O+l*q+d*x+y*b,k=u*O+f*q+m*x+_*b,K=s*O+h*q+E*x+T*b,Z=i*P+c*L+w*C+p*F,j=o*P+l*L+d*C+y*F,Q=u*P+f*L+m*C+_*F,J=s*P+h*L+E*C+T*F;return t[0]=U,t[1]=D,t[2]=z,t[3]=B,t[4]=G,t[5]=V,t[6]=X,t[7]=W,t[8]=H,t[9]=Y,t[10]=k,t[11]=K,t[12]=Z,t[13]=j,t[14]=Q,t[15]=J,t},l.add=function(e,r,t){if(!n(e))throw new a("left is required");if(!n(r))throw new a("right is required");if(!n(t))throw new a("result is required");return t[0]=e[0]+r[0],t[1]=e[1]+r[1],t[2]=e[2]+r[2],t[3]=e[3]+r[3],t[4]=e[4]+r[4],t[5]=e[5]+r[5],t[6]=e[6]+r[6],t[7]=e[7]+r[7],t[8]=e[8]+r[8],t[9]=e[9]+r[9],t[10]=e[10]+r[10],t[11]=e[11]+r[11],t[12]=e[12]+r[12],t[13]=e[13]+r[13],t[14]=e[14]+r[14],t[15]=e[15]+r[15],t},l.subtract=function(e,r,t){if(!n(e))throw new a("left is required");if(!n(r))throw new a("right is required");if(!n(t))throw new a("result is required");return t[0]=e[0]-r[0],t[1]=e[1]-r[1],t[2]=e[2]-r[2],t[3]=e[3]-r[3],t[4]=e[4]-r[4],t[5]=e[5]-r[5],t[6]=e[6]-r[6],t[7]=e[7]-r[7],t[8]=e[8]-r[8],t[9]=e[9]-r[9],t[10]=e[10]-r[10],t[11]=e[11]-r[11],t[12]=e[12]-r[12],t[13]=e[13]-r[13],t[14]=e[14]-r[14],t[15]=e[15]-r[15],t},l.multiplyTransformation=function(e,r,t){if(!n(e))throw new a("left is required");if(!n(r))throw new a("right is required");if(!n(t))throw new a("result is required");var i=e[0],o=e[1],u=e[2],s=e[4],c=e[5],l=e[6],f=e[8],h=e[9],w=e[10],d=e[12],m=e[13],E=e[14],p=r[0],y=r[1],_=r[2],T=r[4],R=r[5],A=r[6],v=r[8],N=r[9],I=r[10],S=r[12],g=r[13],M=r[14],O=i*p+s*y+f*_,q=o*p+c*y+h*_,x=u*p+l*y+w*_,b=i*T+s*R+f*A,P=o*T+c*R+h*A,L=u*T+l*R+w*A,C=i*v+s*N+f*I,F=o*v+c*N+h*I,U=u*v+l*N+w*I,D=i*S+s*g+f*M+d,z=o*S+c*g+h*M+m,B=u*S+l*g+w*M+E;return t[0]=O,t[1]=q,t[2]=x,t[3]=0,t[4]=b,t[5]=P,t[6]=L,t[7]=0,t[8]=C,t[9]=F,t[10]=U,t[11]=0,t[12]=D,t[13]=z,t[14]=B,t[15]=1,t},l.multiplyByMatrix3=function(e,r,t){if(!n(e))throw new a("matrix is required");if(!n(r))throw new a("rotation is required");if(!n(t))throw new a("result is required");var i=e[0],o=e[1],u=e[2],s=e[4],c=e[5],l=e[6],f=e[8],h=e[9],w=e[10],d=r[0],m=r[1],E=r[2],p=r[3],y=r[4],_=r[5],T=r[6],R=r[7],A=r[8],v=i*d+s*m+f*E,N=o*d+c*m+h*E,I=u*d+l*m+w*E,S=i*p+s*y+f*_,g=o*p+c*y+h*_,M=u*p+l*y+w*_,O=i*T+s*R+f*A,q=o*T+c*R+h*A,x=u*T+l*R+w*A;return t[0]=v,t[1]=N,t[2]=I,t[3]=0,t[4]=S,t[5]=g,t[6]=M,t[7]=0,t[8]=O,t[9]=q,t[10]=x,t[11]=0,t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15],t},l.multiplyByTranslation=function(e,r,t){if(!n(e))throw new a("matrix is required");if(!n(r))throw new a("translation is required");if(!n(t))throw new a("result is required");var i=r.x,o=r.y,u=r.z,s=i*e[0]+o*e[4]+u*e[8]+e[12],c=i*e[1]+o*e[5]+u*e[9]+e[13],l=i*e[2]+o*e[6]+u*e[10]+e[14];return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[4]=e[4],t[5]=e[5],t[6]=e[6],t[7]=e[7],t[8]=e[8],t[9]=e[9],t[10]=e[10],t[11]=e[11],t[12]=s,t[13]=c,t[14]=l,t[15]=e[15],t};var E=new e;l.multiplyByUniformScale=function(e,r,t){if(!n(e))throw new a("matrix is required");if("number"!=typeof r)throw new a("scale is required");if(!n(t))throw new a("result is required");return E.x=r,E.y=r,E.z=r,l.multiplyByScale(e,E,t)},l.multiplyByScale=function(e,r,t){if(!n(e))throw new a("matrix is required");if(!n(r))throw new a("scale is required");if(!n(t))throw new a("result is required");var i=r.x,o=r.y,u=r.z;return 1===i&&1===o&&1===u?l.clone(e,t):(t[0]=i*e[0],t[1]=i*e[1],t[2]=i*e[2],t[3]=0,t[4]=o*e[4],t[5]=o*e[5],t[6]=o*e[6],t[7]=0,t[8]=u*e[8],t[9]=u*e[9],t[10]=u*e[10],t[11]=0,t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=1,t)},l.multiplyByVector=function(e,r,t){if(!n(e))throw new a("matrix is required");if(!n(r))throw new a("cartesian is required");if(!n(t))throw new a("result is required");var i=r.x,o=r.y,u=r.z,s=r.w,c=e[0]*i+e[4]*o+e[8]*u+e[12]*s,l=e[1]*i+e[5]*o+e[9]*u+e[13]*s,f=e[2]*i+e[6]*o+e[10]*u+e[14]*s,h=e[3]*i+e[7]*o+e[11]*u+e[15]*s;return t.x=c,t.y=l,t.z=f,t.w=h,t},l.multiplyByPointAsVector=function(e,r,t){if(!n(e))throw new a("matrix is required");if(!n(r))throw new a("cartesian is required");if(!n(t))throw new a("result is required");var i=r.x,o=r.y,u=r.z,s=e[0]*i+e[4]*o+e[8]*u,c=e[1]*i+e[5]*o+e[9]*u,l=e[2]*i+e[6]*o+e[10]*u;return t.x=s,t.y=c,t.z=l,t},l.multiplyByPoint=function(e,r,t){if(!n(e))throw new a("matrix is required");if(!n(r))throw new a("cartesian is required");if(!n(t))throw new a("result is required");var i=r.x,o=r.y,u=r.z,s=e[0]*i+e[4]*o+e[8]*u+e[12],c=e[1]*i+e[5]*o+e[9]*u+e[13],l=e[2]*i+e[6]*o+e[10]*u+e[14];return t.x=s,t.y=c,t.z=l,t},l.multiplyByScalar=function(e,r,t){if(!n(e))throw new a("matrix is required");if("number"!=typeof r)throw new a("scalar must be a number");if(!n(t))throw new a("result is required");return t[0]=e[0]*r,t[1]=e[1]*r,t[2]=e[2]*r,t[3]=e[3]*r,t[4]=e[4]*r,t[5]=e[5]*r,t[6]=e[6]*r,t[7]=e[7]*r,t[8]=e[8]*r,t[9]=e[9]*r,t[10]=e[10]*r,t[11]=e[11]*r,t[12]=e[12]*r,t[13]=e[13]*r,t[14]=e[14]*r,t[15]=e[15]*r,t},l.negate=function(e,r){if(!n(e))throw new a("matrix is required");if(!n(r))throw new a("result is required");return r[0]=-e[0],r[1]=-e[1],r[2]=-e[2],r[3]=-e[3],r[4]=-e[4],r[5]=-e[5],r[6]=-e[6],r[7]=-e[7],r[8]=-e[8],r[9]=-e[9],r[10]=-e[10],r[11]=-e[11],r[12]=-e[12],r[13]=-e[13],r[14]=-e[14],r[15]=-e[15],r},l.transpose=function(e,r){if(!n(e))throw new a("matrix is required");if(!n(r))throw new a("result is required");var t=e[1],i=e[2],o=e[3],u=e[6],s=e[7],c=e[11];return r[0]=e[0],r[1]=e[4],r[2]=e[8],r[3]=e[12],r[4]=t,r[5]=e[5],r[6]=e[9],r[7]=e[13],r[8]=i,r[9]=u,r[10]=e[10],r[11]=e[14],r[12]=o,r[13]=s,r[14]=c,r[15]=e[15],r},l.abs=function(e,r){if(!n(e))throw new a("matrix is required");if(!n(r))throw new a("result is required");return r[0]=Math.abs(e[0]),r[1]=Math.abs(e[1]),r[2]=Math.abs(e[2]),r[3]=Math.abs(e[3]),r[4]=Math.abs(e[4]),r[5]=Math.abs(e[5]),r[6]=Math.abs(e[6]),r[7]=Math.abs(e[7]),r[8]=Math.abs(e[8]),r[9]=Math.abs(e[9]),r[10]=Math.abs(e[10]),r[11]=Math.abs(e[11]),r[12]=Math.abs(e[12]),r[13]=Math.abs(e[13]),r[14]=Math.abs(e[14]),r[15]=Math.abs(e[15]),r},l.equals=function(e,r){return e===r||n(e)&&n(r)&&e[12]===r[12]&&e[13]===r[13]&&e[14]===r[14]&&e[0]===r[0]&&e[1]===r[1]&&e[2]===r[2]&&e[4]===r[4]&&e[5]===r[5]&&e[6]===r[6]&&e[8]===r[8]&&e[9]===r[9]&&e[10]===r[10]&&e[3]===r[3]&&e[7]===r[7]&&e[11]===r[11]&&e[15]===r[15]},l.equalsEpsilon=function(e,r,t){if("number"!=typeof t)throw new a("epsilon must be a number");return e===r||n(e)&&n(r)&&Math.abs(e[0]-r[0])<=t&&Math.abs(e[1]-r[1])<=t&&Math.abs(e[2]-r[2])<=t&&Math.abs(e[3]-r[3])<=t&&Math.abs(e[4]-r[4])<=t&&Math.abs(e[5]-r[5])<=t&&Math.abs(e[6]-r[6])<=t&&Math.abs(e[7]-r[7])<=t&&Math.abs(e[8]-r[8])<=t&&Math.abs(e[9]-r[9])<=t&&Math.abs(e[10]-r[10])<=t&&Math.abs(e[11]-r[11])<=t&&Math.abs(e[12]-r[12])<=t&&Math.abs(e[13]-r[13])<=t&&Math.abs(e[14]-r[14])<=t&&Math.abs(e[15]-r[15])<=t},l.getTranslation=function(e,r){if(!n(e))throw new a("matrix is required");if(!n(r))throw new a("result is required");return r.x=e[12],r.y=e[13],r.z=e[14],r},l.getRotation=function(e,r){if(!n(e))throw new a("matrix is required");if(!n(r))throw new a("result is required");return r[0]=e[0],r[1]=e[1],r[2]=e[2],r[3]=e[4],r[4]=e[5],r[5]=e[6],r[6]=e[8],r[7]=e[9],r[8]=e[10],r};var p=new s,y=new s,_=new r,T=new r(0,0,0,1);return l.inverse=function(e,t){if(!n(e))throw new a("matrix is required");if(!n(t))throw new a("result is required");if(s.equalsEpsilon(l.getRotation(e,p),y,u.EPSILON7)&&r.equals(l.getRow(e,3,_),T))return t[0]=0,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=0,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=0,t[11]=0,t[12]=-e[12],t[13]=-e[13],t[14]=-e[14],t[15]=1,t;var i=e[0],o=e[4],f=e[8],h=e[12],w=e[1],d=e[5],m=e[9],E=e[13],R=e[2],A=e[6],v=e[10],N=e[14],I=e[3],S=e[7],g=e[11],M=e[15],O=v*M,q=N*g,x=A*M,b=N*S,P=A*g,L=v*S,C=R*M,F=N*I,U=R*g,D=v*I,z=R*S,B=A*I,G=O*d+b*m+P*E-(q*d+x*m+L*E),V=q*w+C*m+D*E-(O*w+F*m+U*E),X=x*w+F*d+z*E-(b*w+C*d+B*E),W=L*w+U*d+B*m-(P*w+D*d+z*m),H=q*o+x*f+L*h-(O*o+b*f+P*h),Y=O*i+F*f+U*h-(q*i+C*f+D*h),k=b*i+C*o+B*h-(x*i+F*o+z*h),K=P*i+D*o+z*f-(L*i+U*o+B*f);O=f*E,q=h*m,x=o*E,b=h*d,P=o*m,L=f*d,C=i*E,F=h*w,U=i*m,D=f*w,z=i*d,B=o*w;var Z=O*S+b*g+P*M-(q*S+x*g+L*M),j=q*I+C*g+D*M-(O*I+F*g+U*M),Q=x*I+F*S+z*M-(b*I+C*S+B*M),J=L*I+U*S+B*g-(P*I+D*S+z*g),$=x*v+L*N+q*A-(P*N+O*A+b*v),ee=U*N+O*R+F*v-(C*v+D*N+q*R),re=C*A+B*N+b*R-(z*N+x*R+F*A),te=z*v+P*R+D*A-(U*A+B*v+L*R),ne=i*G+o*V+f*X+h*W;if(Math.abs(ne)<u.EPSILON20)throw new c("matrix is not invertible because its determinate is zero.");return ne=1/ne,t[0]=G*ne,t[1]=V*ne,t[2]=X*ne,t[3]=W*ne,t[4]=H*ne,t[5]=Y*ne,t[6]=k*ne,t[7]=K*ne,t[8]=Z*ne,t[9]=j*ne,t[10]=Q*ne,t[11]=J*ne,t[12]=$*ne,t[13]=ee*ne,t[14]=re*ne,t[15]=te*ne,t},l.inverseTransformation=function(e,r){if(!n(e))throw new a("matrix is required");if(!n(r))throw new a("result is required");var t=e[0],i=e[1],o=e[2],u=e[4],s=e[5],c=e[6],l=e[8],f=e[9],h=e[10],w=e[12],d=e[13],m=e[14],E=-t*w-i*d-o*m,p=-u*w-s*d-c*m,y=-l*w-f*d-h*m;return r[0]=t,r[1]=u,r[2]=l,r[3]=0,r[4]=i,r[5]=s,r[6]=f,r[7]=0,r[8]=o,r[9]=c,r[10]=h,r[11]=0,r[12]=E,r[13]=p,r[14]=y,r[15]=1,r},l.IDENTITY=o(new l(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1)),l.ZERO=o(new l(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)),l.COLUMN0ROW0=0,l.COLUMN0ROW1=1,l.COLUMN0ROW2=2,l.COLUMN0ROW3=3,l.COLUMN1ROW0=4,l.COLUMN1ROW1=5,l.COLUMN1ROW2=6,l.COLUMN1ROW3=7,l.COLUMN2ROW0=8,l.COLUMN2ROW1=9,l.COLUMN2ROW2=10,l.COLUMN2ROW3=11,l.COLUMN3ROW0=12,l.COLUMN3ROW1=13,l.COLUMN3ROW2=14,l.COLUMN3ROW3=15,i(l.prototype,{length:{get:function(){return l.packedLength}}}),l.prototype.clone=function(e){return l.clone(this,e)},l.prototype.equals=function(e){return l.equals(this,e)},l.equalsArray=function(e,r,t){return e[0]===r[t]&&e[1]===r[t+1]&&e[2]===r[t+2]&&e[3]===r[t+3]&&e[4]===r[t+4]&&e[5]===r[t+5]&&e[6]===r[t+6]&&e[7]===r[t+7]&&e[8]===r[t+8]&&e[9]===r[t+9]&&e[10]===r[t+10]&&e[11]===r[t+11]&&e[12]===r[t+12]&&e[13]===r[t+13]&&e[14]===r[t+14]&&e[15]===r[t+15]},l.prototype.equalsEpsilon=function(e,r){return l.equalsEpsilon(this,e,r)},l.prototype.toString=function(){return"("+this[0]+", "+this[4]+", "+this[8]+", "+this[12]+")\n("+this[1]+", "+this[5]+", "+this[9]+", "+this[13]+")\n("+this[2]+", "+this[6]+", "+this[10]+", "+this[14]+")\n("+this[3]+", "+this[7]+", "+this[11]+", "+this[15]+")"},l}),define("Core/Plane",["./Cartesian3","./defined","./DeveloperError","./freezeObject"],function(e,r,t,n){"use strict";function i(n,i){if(!r(n))throw new t("normal is required.");if(!r(i))throw new t("distance is required.");this.normal=e.clone(n),this.distance=i}i.fromPointNormal=function(n,a,o){if(!r(n))throw new t("point is required.");if(!r(a))throw new t("normal is required.");var u=-e.dot(a,n);return r(o)?(e.clone(a,o.normal),o.distance=u,o):new i(a,u)};var a=new e;return i.fromCartesian4=function(n,o){if(!r(n))throw new t("coefficients is required.");var u=e.fromCartesian4(n,a),s=n.w;return r(o)?(e.clone(u,o.normal),o.distance=s,o):new i(u,s)},i.getPointDistance=function(n,i){if(!r(n))throw new t("plane is required.");if(!r(i))throw new t("point is required.");return e.dot(n.normal,i)+n.distance},i.ORIGIN_XY_PLANE=n(new i(e.UNIT_Z,0)),i.ORIGIN_YZ_PLANE=n(new i(e.UNIT_X,0)),i.ORIGIN_ZX_PLANE=n(new i(e.UNIT_Y,0)),i}),define("Core/Rectangle",["./Cartographic","./defaultValue","./defined","./defineProperties","./DeveloperError","./Ellipsoid","./freezeObject","./Math"],function(e,r,t,n,i,a,o,u){"use strict";function s(e,t,n,i){this.west=r(e,0),this.south=r(t,0),this.east=r(n,0),this.north=r(i,0)}n(s.prototype,{width:{get:function(){return s.computeWidth(this)}},height:{get:function(){return s.computeHeight(this)}}}),s.packedLength=4,s.pack=function(e,n,a){if(!t(e))throw new i("value is required");if(!t(n))throw new i("array is required");a=r(a,0),n[a++]=e.west,n[a++]=e.south,n[a++]=e.east,n[a]=e.north},s.unpack=function(e,n,a){if(!t(e))throw new i("array is required");return n=r(n,0),t(a)||(a=new s),a.west=e[n++],a.south=e[n++],a.east=e[n++],a.north=e[n],a},s.computeWidth=function(e){if(!t(e))throw new i("rectangle is required.");var r=e.east,n=e.west;return n>r&&(r+=u.TWO_PI),r-n},s.computeHeight=function(e){if(!t(e))throw new i("rectangle is required.");return e.north-e.south},s.fromDegrees=function(e,n,i,a,o){return e=u.toRadians(r(e,0)),n=u.toRadians(r(n,0)),i=u.toRadians(r(i,0)),a=u.toRadians(r(a,0)),t(o)?(o.west=e,o.south=n,o.east=i,o.north=a,o):new s(e,n,i,a)},s.fromCartographicArray=function(e,r){if(!t(e))throw new i("cartographics is required.");for(var n=Number.MAX_VALUE,a=-Number.MAX_VALUE,o=Number.MAX_VALUE,c=-Number.MAX_VALUE,l=Number.MAX_VALUE,f=-Number.MAX_VALUE,h=0,w=e.length;w>h;h++){var d=e[h];n=Math.min(n,d.longitude),a=Math.max(a,d.longitude),l=Math.min(l,d.latitude),f=Math.max(f,d.latitude);var m=d.longitude>=0?d.longitude:d.longitude+u.TWO_PI;o=Math.min(o,m),c=Math.max(c,m)}return a-n>c-o&&(n=o,a=c,a>u.PI&&(a-=u.TWO_PI),n>u.PI&&(n-=u.TWO_PI)),t(r)?(r.west=n,r.south=l,r.east=a,r.north=f,r):new s(n,l,a,f)},s.clone=function(e,r){return t(e)?t(r)?(r.west=e.west,r.south=e.south,r.east=e.east,r.north=e.north,r):new s(e.west,e.south,e.east,e.north):void 0},s.prototype.clone=function(e){return s.clone(this,e)},s.prototype.equals=function(e){return s.equals(this,e)},s.equals=function(e,r){return e===r||t(e)&&t(r)&&e.west===r.west&&e.south===r.south&&e.east===r.east&&e.north===r.north},s.prototype.equalsEpsilon=function(e,r){if("number"!=typeof r)throw new i("epsilon is required and must be a number.");return t(e)&&Math.abs(this.west-e.west)<=r&&Math.abs(this.south-e.south)<=r&&Math.abs(this.east-e.east)<=r&&Math.abs(this.north-e.north)<=r},s.validate=function(e){if(!t(e))throw new i("rectangle is required");var r=e.north;if("number"!=typeof r)throw new i("north is required to be a number.");if(r<-u.PI_OVER_TWO||r>u.PI_OVER_TWO)throw new i("north must be in the interval [-Pi/2, Pi/2].");var n=e.south;if("number"!=typeof n)throw new i("south is required to be a number.");if(n<-u.PI_OVER_TWO||n>u.PI_OVER_TWO)throw new i("south must be in the interval [-Pi/2, Pi/2].");var a=e.west;if("number"!=typeof a)throw new i("west is required to be a number.");if(a<-Math.PI||a>Math.PI)throw new i("west must be in the interval [-Pi, Pi].");var o=e.east;if("number"!=typeof o)throw new i("east is required to be a number.");if(o<-Math.PI||o>Math.PI)throw new i("east must be in the interval [-Pi, Pi].")},s.southwest=function(r,n){if(!t(r))throw new i("rectangle is required");return t(n)?(n.longitude=r.west,n.latitude=r.south,n.height=0,n):new e(r.west,r.south)},s.northwest=function(r,n){if(!t(r))throw new i("rectangle is required");return t(n)?(n.longitude=r.west,n.latitude=r.north,n.height=0,n):new e(r.west,r.north)},s.northeast=function(r,n){if(!t(r))throw new i("rectangle is required");return t(n)?(n.longitude=r.east,n.latitude=r.north,n.height=0,n):new e(r.east,r.north)},s.southeast=function(r,n){if(!t(r))throw new i("rectangle is required");return t(n)?(n.longitude=r.east,n.latitude=r.south,n.height=0,n):new e(r.east,r.south)},s.center=function(r,n){if(!t(r))throw new i("rectangle is required");var a=r.east,o=r.west;o>a&&(a+=u.TWO_PI);var s=u.negativePiToPi(.5*(o+a)),c=.5*(r.south+r.north);return t(n)?(n.longitude=s,n.latitude=c,n.height=0,n):new e(s,c)},s.intersection=function(e,r,n){if(!t(e))throw new i("rectangle is required");if(!t(r))throw new i("otherRectangle is required.");var a=e.east,o=e.west,c=r.east,l=r.west;o>a&&c>0?a+=u.TWO_PI:l>c&&a>0&&(c+=u.TWO_PI),o>a&&0>l?l+=u.TWO_PI:l>c&&0>o&&(o+=u.TWO_PI);var f=u.negativePiToPi(Math.max(o,l)),h=u.negativePiToPi(Math.min(a,c));
  if(!((e.west<e.east||r.west<r.east)&&f>=h)){var w=Math.max(e.south,r.south),d=Math.min(e.north,r.north);if(!(w>=d))return t(n)?(n.west=f,n.south=w,n.east=h,n.north=d,n):new s(f,w,h,d)}},s.union=function(e,r,n){if(!t(e))throw new i("rectangle is required");if(!t(r))throw new i("otherRectangle is required.");return t(n)||(n=new s),n.west=Math.min(e.west,r.west),n.south=Math.min(e.south,r.south),n.east=Math.max(e.east,r.east),n.north=Math.max(e.north,r.north),n},s.expand=function(e,r,n){if(!t(e))throw new i("rectangle is required.");if(!t(r))throw new i("cartographic is required.");return t(n)||(n=new s),n.west=Math.min(e.west,r.longitude),n.south=Math.min(e.south,r.latitude),n.east=Math.max(e.east,r.longitude),n.north=Math.max(e.north,r.latitude),n},s.contains=function(e,r){if(!t(e))throw new i("rectangle is required");if(!t(r))throw new i("cartographic is required.");var n=r.longitude,a=r.latitude,o=e.west,s=e.east;return o>s&&(s+=u.TWO_PI,0>n&&(n+=u.TWO_PI)),(n>o||u.equalsEpsilon(n,o,u.EPSILON14))&&(s>n||u.equalsEpsilon(n,s,u.EPSILON14))&&a>=e.south&&a<=e.north};var c=new e;return s.subsample=function(e,n,o,l){if(!t(e))throw new i("rectangle is required");n=r(n,a.WGS84),o=r(o,0),t(l)||(l=[]);var f=0,h=e.north,w=e.south,d=e.east,m=e.west,E=c;E.height=o,E.longitude=m,E.latitude=h,l[f]=n.cartographicToCartesian(E,l[f]),f++,E.longitude=d,l[f]=n.cartographicToCartesian(E,l[f]),f++,E.latitude=w,l[f]=n.cartographicToCartesian(E,l[f]),f++,E.longitude=m,l[f]=n.cartographicToCartesian(E,l[f]),f++,0>h?E.latitude=h:w>0?E.latitude=w:E.latitude=0;for(var p=1;8>p;++p)E.longitude=-Math.PI+p*u.PI_OVER_TWO,s.contains(e,E)&&(l[f]=n.cartographicToCartesian(E,l[f]),f++);return 0===E.latitude&&(E.longitude=m,l[f]=n.cartographicToCartesian(E,l[f]),f++,E.longitude=d,l[f]=n.cartographicToCartesian(E,l[f]),f++),l.length=f,l},s.MAX_VALUE=o(new s(-Math.PI,-u.PI_OVER_TWO,Math.PI,u.PI_OVER_TWO)),s}),define("Core/BoundingSphere",["./Cartesian3","./Cartographic","./defaultValue","./defined","./DeveloperError","./Ellipsoid","./GeographicProjection","./Intersect","./Interval","./Matrix3","./Matrix4","./Plane","./Rectangle"],function(e,r,t,n,i,a,o,u,s,c,l,f,h){"use strict";function w(r,n){this.center=e.clone(t(r,e.ZERO)),this.radius=t(n,0)}var d=new e,m=new e,E=new e,p=new e,y=new e,_=new e,T=new e,R=new e,A=new e,v=new e,N=new e,I=new e;w.fromPoints=function(r,t){if(n(t)||(t=new w),!n(r)||0===r.length)return t.center=e.clone(e.ZERO,t.center),t.radius=0,t;for(var i=e.clone(r[0],T),a=e.clone(i,d),o=e.clone(i,m),u=e.clone(i,E),s=e.clone(i,p),c=e.clone(i,y),l=e.clone(i,_),f=r.length,h=1;f>h;h++){e.clone(r[h],i);var S=i.x,g=i.y,M=i.z;S<a.x&&e.clone(i,a),S>s.x&&e.clone(i,s),g<o.y&&e.clone(i,o),g>c.y&&e.clone(i,c),M<u.z&&e.clone(i,u),M>l.z&&e.clone(i,l)}var O=e.magnitudeSquared(e.subtract(s,a,R)),q=e.magnitudeSquared(e.subtract(c,o,R)),x=e.magnitudeSquared(e.subtract(l,u,R)),b=a,P=s,L=O;q>L&&(L=q,b=o,P=c),x>L&&(L=x,b=u,P=l);var C=A;C.x=.5*(b.x+P.x),C.y=.5*(b.y+P.y),C.z=.5*(b.z+P.z);var F=e.magnitudeSquared(e.subtract(P,C,R)),U=Math.sqrt(F),D=v;D.x=a.x,D.y=o.y,D.z=u.z;var z=N;z.x=s.x,z.y=c.y,z.z=l.z;var B=e.multiplyByScalar(e.add(D,z,R),.5,I),G=0;for(h=0;f>h;h++){e.clone(r[h],i);var V=e.magnitude(e.subtract(i,B,R));V>G&&(G=V);var X=e.magnitudeSquared(e.subtract(i,C,R));if(X>F){var W=Math.sqrt(X);U=.5*(U+W),F=U*U;var H=W-U;C.x=(U*C.x+H*i.x)/W,C.y=(U*C.y+H*i.y)/W,C.z=(U*C.z+H*i.z)/W}}return G>U?(e.clone(C,t.center),t.radius=U):(e.clone(B,t.center),t.radius=G),t};var S=new o,g=new e,M=new e,O=new r,q=new r;w.fromRectangle2D=function(e,r,t){return w.fromRectangleWithHeights2D(e,r,0,0,t)},w.fromRectangleWithHeights2D=function(r,i,a,o,u){if(n(u)||(u=new w),!n(r))return u.center=e.clone(e.ZERO,u.center),u.radius=0,u;i=t(i,S),h.southwest(r,O),O.height=a,h.northeast(r,q),q.height=o;var s=i.project(O,g),c=i.project(q,M),l=c.x-s.x,f=c.y-s.y,d=c.z-s.z;u.radius=.5*Math.sqrt(l*l+f*f+d*d);var m=u.center;return m.x=s.x+.5*l,m.y=s.y+.5*f,m.z=s.z+.5*d,u};var x=[];w.fromRectangle3D=function(e,r,i,o){r=t(r,a.WGS84),i=t(i,0);var u;return n(e)&&(u=h.subsample(e,r,i,x)),w.fromPoints(u,o)},w.fromVertices=function(r,a,o,u){if(n(u)||(u=new w),!n(r)||0===r.length)return u.center=e.clone(e.ZERO,u.center),u.radius=0,u;if(a=t(a,e.ZERO),o=t(o,3),3>o)throw new i("stride must be 3 or greater.");var s=T;s.x=r[0]+a.x,s.y=r[1]+a.y,s.z=r[2]+a.z;for(var c=e.clone(s,d),l=e.clone(s,m),f=e.clone(s,E),h=e.clone(s,p),S=e.clone(s,y),g=e.clone(s,_),M=r.length,O=0;M>O;O+=o){var q=r[O]+a.x,x=r[O+1]+a.y,b=r[O+2]+a.z;s.x=q,s.y=x,s.z=b,q<c.x&&e.clone(s,c),q>h.x&&e.clone(s,h),x<l.y&&e.clone(s,l),x>S.y&&e.clone(s,S),b<f.z&&e.clone(s,f),b>g.z&&e.clone(s,g)}var P=e.magnitudeSquared(e.subtract(h,c,R)),L=e.magnitudeSquared(e.subtract(S,l,R)),C=e.magnitudeSquared(e.subtract(g,f,R)),F=c,U=h,D=P;L>D&&(D=L,F=l,U=S),C>D&&(D=C,F=f,U=g);var z=A;z.x=.5*(F.x+U.x),z.y=.5*(F.y+U.y),z.z=.5*(F.z+U.z);var B=e.magnitudeSquared(e.subtract(U,z,R)),G=Math.sqrt(B),V=v;V.x=c.x,V.y=l.y,V.z=f.z;var X=N;X.x=h.x,X.y=S.y,X.z=g.z;var W=e.multiplyByScalar(e.add(V,X,R),.5,I),H=0;for(O=0;M>O;O+=o){s.x=r[O]+a.x,s.y=r[O+1]+a.y,s.z=r[O+2]+a.z;var Y=e.magnitude(e.subtract(s,W,R));Y>H&&(H=Y);var k=e.magnitudeSquared(e.subtract(s,z,R));if(k>B){var K=Math.sqrt(k);G=.5*(G+K),B=G*G;var Z=K-G;z.x=(G*z.x+Z*s.x)/K,z.y=(G*z.y+Z*s.y)/K,z.z=(G*z.z+Z*s.z)/K}}return H>G?(e.clone(z,u.center),u.radius=G):(e.clone(W,u.center),u.radius=H),u},w.fromEncodedCartesianVertices=function(r,t,i){if(n(i)||(i=new w),!n(r)||!n(t)||r.length!==t.length||0===r.length)return i.center=e.clone(e.ZERO,i.center),i.radius=0,i;var a=T;a.x=r[0]+t[0],a.y=r[1]+t[1],a.z=r[2]+t[2];for(var o=e.clone(a,d),u=e.clone(a,m),s=e.clone(a,E),c=e.clone(a,p),l=e.clone(a,y),f=e.clone(a,_),h=r.length,S=0;h>S;S+=3){var g=r[S]+t[S],M=r[S+1]+t[S+1],O=r[S+2]+t[S+2];a.x=g,a.y=M,a.z=O,g<o.x&&e.clone(a,o),g>c.x&&e.clone(a,c),M<u.y&&e.clone(a,u),M>l.y&&e.clone(a,l),O<s.z&&e.clone(a,s),O>f.z&&e.clone(a,f)}var q=e.magnitudeSquared(e.subtract(c,o,R)),x=e.magnitudeSquared(e.subtract(l,u,R)),b=e.magnitudeSquared(e.subtract(f,s,R)),P=o,L=c,C=q;x>C&&(C=x,P=u,L=l),b>C&&(C=b,P=s,L=f);var F=A;F.x=.5*(P.x+L.x),F.y=.5*(P.y+L.y),F.z=.5*(P.z+L.z);var U=e.magnitudeSquared(e.subtract(L,F,R)),D=Math.sqrt(U),z=v;z.x=o.x,z.y=u.y,z.z=s.z;var B=N;B.x=c.x,B.y=l.y,B.z=f.z;var G=e.multiplyByScalar(e.add(z,B,R),.5,I),V=0;for(S=0;h>S;S+=3){a.x=r[S]+t[S],a.y=r[S+1]+t[S+1],a.z=r[S+2]+t[S+2];var X=e.magnitude(e.subtract(a,G,R));X>V&&(V=X);var W=e.magnitudeSquared(e.subtract(a,F,R));if(W>U){var H=Math.sqrt(W);D=.5*(D+H),U=D*D;var Y=H-D;F.x=(D*F.x+Y*a.x)/H,F.y=(D*F.y+Y*a.y)/H,F.z=(D*F.z+Y*a.z)/H}}return V>D?(e.clone(F,i.center),i.radius=D):(e.clone(G,i.center),i.radius=V),i},w.fromCornerPoints=function(r,t,a){if(!n(r)||!n(t))throw new i("corner and oppositeCorner are required.");n(a)||(a=new w);var o=a.center;return e.add(r,t,o),e.multiplyByScalar(o,.5,o),a.radius=e.distance(o,t),a},w.fromEllipsoid=function(r,t){if(!n(r))throw new i("ellipsoid is required.");return n(t)||(t=new w),e.clone(e.ZERO,t.center),t.radius=r.maximumRadius,t};var b=new e;w.fromBoundingSpheres=function(r,t){if(n(t)||(t=new w),!n(r)||0===r.length)return t.center=e.clone(e.ZERO,t.center),t.radius=0,t;var i=r.length;if(1===i)return w.clone(r[0],t);if(2===i)return w.union(r[0],r[1],t);for(var a=[],o=0;i>o;o++)a.push(r[o].center);t=w.fromPoints(a,t);var u=t.center,s=t.radius;for(o=0;i>o;o++){var c=r[o];s=Math.max(s,e.distance(u,c.center,b)+c.radius)}return t.radius=s,t};var P=new e,L=new e,C=new e;w.fromOrientedBoundingBox=function(r,t){n(t)||(t=new w);var i=r.halfAxes,a=c.getColumn(i,0,P),o=c.getColumn(i,1,L),u=c.getColumn(i,2,C),s=e.magnitude(a),l=e.magnitude(o),f=e.magnitude(u);return t.center=e.clone(r.center,t.center),t.radius=Math.max(s,l,f),t},w.clone=function(r,t){return n(r)?n(t)?(t.center=e.clone(r.center,t.center),t.radius=r.radius,t):new w(r.center,r.radius):void 0},w.packedLength=4,w.pack=function(e,r,a){if(!n(e))throw new i("value is required");if(!n(r))throw new i("array is required");a=t(a,0);var o=e.center;r[a++]=o.x,r[a++]=o.y,r[a++]=o.z,r[a]=e.radius},w.unpack=function(e,r,a){if(!n(e))throw new i("array is required");r=t(r,0),n(a)||(a=new w);var o=a.center;return o.x=e[r++],o.y=e[r++],o.z=e[r++],a.radius=e[r],a};var F=new e,U=new e;w.union=function(r,t,a){if(!n(r))throw new i("left is required.");if(!n(t))throw new i("right is required.");n(a)||(a=new w);var o=r.center,u=r.radius,s=t.center,c=t.radius,l=e.subtract(s,o,F),f=e.magnitude(l);if(u>=f+c)return r.clone(a),a;if(c>=f+u)return t.clone(a),a;var h=.5*(u+f+c),d=e.multiplyByScalar(l,(-u+h)/f,U);return e.add(d,o,d),e.clone(d,a.center),a.radius=h,a};var D=new e;w.expand=function(r,t,a){if(!n(r))throw new i("sphere is required.");if(!n(t))throw new i("point is required.");a=w.clone(r,a);var o=e.magnitude(e.subtract(t,a.center,D));return o>a.radius&&(a.radius=o),a},w.intersectPlane=function(r,t){if(!n(r))throw new i("sphere is required.");if(!n(t))throw new i("plane is required.");var a=r.center,o=r.radius,s=t.normal,c=e.dot(s,a)+t.distance;return-o>c?u.OUTSIDE:o>c?u.INTERSECTING:u.INSIDE},w.transform=function(e,r,t){if(!n(e))throw new i("sphere is required.");if(!n(r))throw new i("transform is required.");return n(t)||(t=new w),t.center=l.multiplyByPoint(r,e.center,t.center),t.radius=l.getMaximumScale(r)*e.radius,t};var z=new e;w.distanceSquaredTo=function(r,t){if(!n(r))throw new i("sphere is required.");if(!n(t))throw new i("cartesian is required.");var a=e.subtract(r.center,t,z);return e.magnitudeSquared(a)-r.radius*r.radius},w.transformWithoutScale=function(e,r,t){if(!n(e))throw new i("sphere is required.");if(!n(r))throw new i("transform is required.");return n(t)||(t=new w),t.center=l.multiplyByPoint(r,e.center,t.center),t.radius=e.radius,t};var B=new e;w.computePlaneDistances=function(r,t,a,o){if(!n(r))throw new i("sphere is required.");if(!n(t))throw new i("position is required.");if(!n(a))throw new i("direction is required.");n(o)||(o=new s);var u=e.subtract(r.center,t,B),c=e.dot(a,u);return o.start=c-r.radius,o.stop=c+r.radius,o};for(var G=new e,V=new e,X=new e,W=new e,H=new e,Y=new r,k=new Array(8),K=0;8>K;++K)k[K]=new e;var Z=new o;return w.projectTo2D=function(r,a,o){if(!n(r))throw new i("sphere is required.");a=t(a,Z);var u=a.ellipsoid,s=r.center,c=r.radius,l=u.geodeticSurfaceNormal(s,G),f=e.cross(e.UNIT_Z,l,V);e.normalize(f,f);var h=e.cross(l,f,X);e.normalize(h,h),e.multiplyByScalar(l,c,l),e.multiplyByScalar(h,c,h),e.multiplyByScalar(f,c,f);var d=e.negate(h,H),m=e.negate(f,W),E=k,p=E[0];e.add(l,h,p),e.add(p,f,p),p=E[1],e.add(l,h,p),e.add(p,m,p),p=E[2],e.add(l,d,p),e.add(p,m,p),p=E[3],e.add(l,d,p),e.add(p,f,p),e.negate(l,l),p=E[4],e.add(l,h,p),e.add(p,f,p),p=E[5],e.add(l,h,p),e.add(p,m,p),p=E[6],e.add(l,d,p),e.add(p,m,p),p=E[7],e.add(l,d,p),e.add(p,f,p);for(var y=E.length,_=0;y>_;++_){var T=E[_];e.add(s,T,T);var R=u.cartesianToCartographic(T,Y);a.project(R,T)}o=w.fromPoints(E,o),s=o.center;var A=s.x,v=s.y,N=s.z;return s.x=N,s.y=A,s.z=v,o},w.isOccluded=function(e,r){if(!n(e))throw new i("sphere is required.");if(!n(r))throw new i("occluder is required.");return!r.isBoundingSphereVisible(e)},w.equals=function(r,t){return r===t||n(r)&&n(t)&&e.equals(r.center,t.center)&&r.radius===t.radius},w.prototype.intersectPlane=function(e){return w.intersectPlane(this,e)},w.prototype.distanceSquaredTo=function(e){return w.distanceSquaredTo(this,e)},w.prototype.computePlaneDistances=function(e,r,t){return w.computePlaneDistances(this,e,r,t)},w.prototype.isOccluded=function(e){return w.isOccluded(this,e)},w.prototype.equals=function(e){return w.equals(this,e)},w.prototype.clone=function(e){return w.clone(this,e)},w}),define("Core/Cartesian2",["./defaultValue","./defined","./DeveloperError","./freezeObject","./Math"],function(e,r,t,n,i){"use strict";function a(r,t){this.x=e(r,0),this.y=e(t,0)}a.fromElements=function(e,t,n){return r(n)?(n.x=e,n.y=t,n):new a(e,t)},a.clone=function(e,t){return r(e)?r(t)?(t.x=e.x,t.y=e.y,t):new a(e.x,e.y):void 0},a.fromCartesian3=a.clone,a.fromCartesian4=a.clone,a.packedLength=2,a.pack=function(n,i,a){if(!r(n))throw new t("value is required");if(!r(i))throw new t("array is required");a=e(a,0),i[a++]=n.x,i[a]=n.y},a.unpack=function(n,i,o){if(!r(n))throw new t("array is required");return i=e(i,0),r(o)||(o=new a),o.x=n[i++],o.y=n[i],o},a.fromArray=a.unpack,a.maximumComponent=function(e){if(!r(e))throw new t("cartesian is required");return Math.max(e.x,e.y)},a.minimumComponent=function(e){if(!r(e))throw new t("cartesian is required");return Math.min(e.x,e.y)},a.minimumByComponent=function(e,n,i){if(!r(e))throw new t("first is required.");if(!r(n))throw new t("second is required.");if(!r(i))throw new t("result is required.");return i.x=Math.min(e.x,n.x),i.y=Math.min(e.y,n.y),i},a.maximumByComponent=function(e,n,i){if(!r(e))throw new t("first is required.");if(!r(n))throw new t("second is required.");if(!r(i))throw new t("result is required.");return i.x=Math.max(e.x,n.x),i.y=Math.max(e.y,n.y),i},a.magnitudeSquared=function(e){if(!r(e))throw new t("cartesian is required");return e.x*e.x+e.y*e.y},a.magnitude=function(e){return Math.sqrt(a.magnitudeSquared(e))};var o=new a;a.distance=function(e,n){if(!r(e)||!r(n))throw new t("left and right are required.");return a.subtract(e,n,o),a.magnitude(o)},a.distanceSquared=function(e,n){if(!r(e)||!r(n))throw new t("left and right are required.");return a.subtract(e,n,o),a.magnitudeSquared(o)},a.normalize=function(e,n){if(!r(e))throw new t("cartesian is required");if(!r(n))throw new t("result is required");var i=a.magnitude(e);return n.x=e.x/i,n.y=e.y/i,n},a.dot=function(e,n){if(!r(e))throw new t("left is required");if(!r(n))throw new t("right is required");return e.x*n.x+e.y*n.y},a.multiplyComponents=function(e,n,i){if(!r(e))throw new t("left is required");if(!r(n))throw new t("right is required");if(!r(i))throw new t("result is required");return i.x=e.x*n.x,i.y=e.y*n.y,i},a.add=function(e,n,i){if(!r(e))throw new t("left is required");if(!r(n))throw new t("right is required");if(!r(i))throw new t("result is required");return i.x=e.x+n.x,i.y=e.y+n.y,i},a.subtract=function(e,n,i){if(!r(e))throw new t("left is required");if(!r(n))throw new t("right is required");if(!r(i))throw new t("result is required");return i.x=e.x-n.x,i.y=e.y-n.y,i},a.multiplyByScalar=function(e,n,i){if(!r(e))throw new t("cartesian is required");if("number"!=typeof n)throw new t("scalar is required and must be a number.");if(!r(i))throw new t("result is required");return i.x=e.x*n,i.y=e.y*n,i},a.divideByScalar=function(e,n,i){if(!r(e))throw new t("cartesian is required");if("number"!=typeof n)throw new t("scalar is required and must be a number.");if(!r(i))throw new t("result is required");return i.x=e.x/n,i.y=e.y/n,i},a.negate=function(e,n){if(!r(e))throw new t("cartesian is required");if(!r(n))throw new t("result is required");return n.x=-e.x,n.y=-e.y,n},a.abs=function(e,n){if(!r(e))throw new t("cartesian is required");if(!r(n))throw new t("result is required");return n.x=Math.abs(e.x),n.y=Math.abs(e.y),n};var u=new a;a.lerp=function(e,n,i,o){if(!r(e))throw new t("start is required.");if(!r(n))throw new t("end is required.");if("number"!=typeof i)throw new t("t is required and must be a number.");if(!r(o))throw new t("result is required.");return a.multiplyByScalar(n,i,u),o=a.multiplyByScalar(e,1-i,o),a.add(u,o,o)};var s=new a,c=new a;a.angleBetween=function(e,n){if(!r(e))throw new t("left is required");if(!r(n))throw new t("right is required");return a.normalize(e,s),a.normalize(n,c),i.acosClamped(a.dot(s,c))};var l=new a;return a.mostOrthogonalAxis=function(e,n){if(!r(e))throw new t("cartesian is required.");if(!r(n))throw new t("result is required.");var i=a.normalize(e,l);return a.abs(i,i),n=i.x<=i.y?a.clone(a.UNIT_X,n):a.clone(a.UNIT_Y,n)},a.equals=function(e,t){return e===t||r(e)&&r(t)&&e.x===t.x&&e.y===t.y},a.equalsArray=function(e,r,t){return e.x===r[t]&&e.y===r[t+1]},a.equalsEpsilon=function(e,t,n,a){return e===t||r(e)&&r(t)&&i.equalsEpsilon(e.x,t.x,n,a)&&i.equalsEpsilon(e.y,t.y,n,a)},a.ZERO=n(new a(0,0)),a.UNIT_X=n(new a(1,0)),a.UNIT_Y=n(new a(0,1)),a.prototype.clone=function(e){return a.clone(this,e)},a.prototype.equals=function(e){return a.equals(this,e)},a.prototype.equalsEpsilon=function(e,r,t){return a.equalsEpsilon(this,e,r,t)},a.prototype.toString=function(){return"("+this.x+", "+this.y+")"},a}),define("Renderer/WebGLConstants",["../Core/freezeObject"],function(e){"use strict";var r={DEPTH_BUFFER_BIT:256,STENCIL_BUFFER_BIT:1024,COLOR_BUFFER_BIT:16384,POINTS:0,LINES:1,LINE_LOOP:2,LINE_STRIP:3,TRIANGLES:4,TRIANGLE_STRIP:5,TRIANGLE_FAN:6,ZERO:0,ONE:1,SRC_COLOR:768,ONE_MINUS_SRC_COLOR:769,SRC_ALPHA:770,ONE_MINUS_SRC_ALPHA:771,DST_ALPHA:772,ONE_MINUS_DST_ALPHA:773,DST_COLOR:774,ONE_MINUS_DST_COLOR:775,SRC_ALPHA_SATURATE:776,FUNC_ADD:32774,BLEND_EQUATION:32777,BLEND_EQUATION_RGB:32777,BLEND_EQUATION_ALPHA:34877,FUNC_SUBTRACT:32778,FUNC_REVERSE_SUBTRACT:32779,BLEND_DST_RGB:32968,BLEND_SRC_RGB:32969,BLEND_DST_ALPHA:32970,BLEND_SRC_ALPHA:32971,CONSTANT_COLOR:32769,ONE_MINUS_CONSTANT_COLOR:32770,CONSTANT_ALPHA:32771,ONE_MINUS_CONSTANT_ALPHA:32772,BLEND_COLOR:32773,ARRAY_BUFFER:34962,ELEMENT_ARRAY_BUFFER:34963,ARRAY_BUFFER_BINDING:34964,ELEMENT_ARRAY_BUFFER_BINDING:34965,STREAM_DRAW:35040,STATIC_DRAW:35044,DYNAMIC_DRAW:35048,BUFFER_SIZE:34660,BUFFER_USAGE:34661,CURRENT_VERTEX_ATTRIB:34342,FRONT:1028,BACK:1029,FRONT_AND_BACK:1032,CULL_FACE:2884,BLEND:3042,DITHER:3024,STENCIL_TEST:2960,DEPTH_TEST:2929,SCISSOR_TEST:3089,POLYGON_OFFSET_FILL:32823,SAMPLE_ALPHA_TO_COVERAGE:32926,SAMPLE_COVERAGE:32928,NO_ERROR:0,INVALID_ENUM:1280,INVALID_VALUE:1281,INVALID_OPERATION:1282,OUT_OF_MEMORY:1285,CW:2304,CCW:2305,LINE_WIDTH:2849,ALIASED_POINT_SIZE_RANGE:33901,ALIASED_LINE_WIDTH_RANGE:33902,CULL_FACE_MODE:2885,FRONT_FACE:2886,DEPTH_RANGE:2928,DEPTH_WRITEMASK:2930,DEPTH_CLEAR_VALUE:2931,DEPTH_FUNC:2932,STENCIL_CLEAR_VALUE:2961,STENCIL_FUNC:2962,STENCIL_FAIL:2964,STENCIL_PASS_DEPTH_FAIL:2965,STENCIL_PASS_DEPTH_PASS:2966,STENCIL_REF:2967,STENCIL_VALUE_MASK:2963,STENCIL_WRITEMASK:2968,STENCIL_BACK_FUNC:34816,STENCIL_BACK_FAIL:34817,STENCIL_BACK_PASS_DEPTH_FAIL:34818,STENCIL_BACK_PASS_DEPTH_PASS:34819,STENCIL_BACK_REF:36003,STENCIL_BACK_VALUE_MASK:36004,STENCIL_BACK_WRITEMASK:36005,VIEWPORT:2978,SCISSOR_BOX:3088,COLOR_CLEAR_VALUE:3106,COLOR_WRITEMASK:3107,UNPACK_ALIGNMENT:3317,PACK_ALIGNMENT:3333,MAX_TEXTURE_SIZE:3379,MAX_VIEWPORT_DIMS:3386,SUBPIXEL_BITS:3408,RED_BITS:3410,GREEN_BITS:3411,BLUE_BITS:3412,ALPHA_BITS:3413,DEPTH_BITS:3414,STENCIL_BITS:3415,POLYGON_OFFSET_UNITS:10752,POLYGON_OFFSET_FACTOR:32824,TEXTURE_BINDING_2D:32873,SAMPLE_BUFFERS:32936,SAMPLES:32937,SAMPLE_COVERAGE_VALUE:32938,SAMPLE_COVERAGE_INVERT:32939,COMPRESSED_TEXTURE_FORMATS:34467,DONT_CARE:4352,FASTEST:4353,NICEST:4354,GENERATE_MIPMAP_HINT:33170,BYTE:5120,UNSIGNED_BYTE:5121,SHORT:5122,UNSIGNED_SHORT:5123,INT:5124,UNSIGNED_INT:5125,FLOAT:5126,DEPTH_COMPONENT:6402,ALPHA:6406,RGB:6407,RGBA:6408,LUMINANCE:6409,LUMINANCE_ALPHA:6410,UNSIGNED_SHORT_4_4_4_4:32819,UNSIGNED_SHORT_5_5_5_1:32820,UNSIGNED_SHORT_5_6_5:33635,FRAGMENT_SHADER:35632,VERTEX_SHADER:35633,MAX_VERTEX_ATTRIBS:34921,MAX_VERTEX_UNIFORM_VECTORS:36347,MAX_VARYING_VECTORS:36348,MAX_COMBINED_TEXTURE_IMAGE_UNITS:35661,MAX_VERTEX_TEXTURE_IMAGE_UNITS:35660,MAX_TEXTURE_IMAGE_UNITS:34930,MAX_FRAGMENT_UNIFORM_VECTORS:36349,SHADER_TYPE:35663,DELETE_STATUS:35712,LINK_STATUS:35714,VALIDATE_STATUS:35715,ATTACHED_SHADERS:35717,ACTIVE_UNIFORMS:35718,ACTIVE_ATTRIBUTES:35721,SHADING_LANGUAGE_VERSION:35724,CURRENT_PROGRAM:35725,NEVER:512,LESS:513,EQUAL:514,LEQUAL:515,GREATER:516,NOTEQUAL:517,GEQUAL:518,ALWAYS:519,KEEP:7680,REPLACE:7681,INCR:7682,DECR:7683,INVERT:5386,INCR_WRAP:34055,DECR_WRAP:34056,VENDOR:7936,RENDERER:7937,VERSION:7938,NEAREST:9728,LINEAR:9729,NEAREST_MIPMAP_NEAREST:9984,LINEAR_MIPMAP_NEAREST:9985,NEAREST_MIPMAP_LINEAR:9986,LINEAR_MIPMAP_LINEAR:9987,TEXTURE_MAG_FILTER:10240,TEXTURE_MIN_FILTER:10241,TEXTURE_WRAP_S:10242,TEXTURE_WRAP_T:10243,TEXTURE_2D:3553,TEXTURE:5890,TEXTURE_CUBE_MAP:34067,TEXTURE_BINDING_CUBE_MAP:34068,TEXTURE_CUBE_MAP_POSITIVE_X:34069,TEXTURE_CUBE_MAP_NEGATIVE_X:34070,TEXTURE_CUBE_MAP_POSITIVE_Y:34071,TEXTURE_CUBE_MAP_NEGATIVE_Y:34072,TEXTURE_CUBE_MAP_POSITIVE_Z:34073,TEXTURE_CUBE_MAP_NEGATIVE_Z:34074,MAX_CUBE_MAP_TEXTURE_SIZE:34076,TEXTURE0:33984,TEXTURE1:33985,TEXTURE2:33986,TEXTURE3:33987,TEXTURE4:33988,TEXTURE5:33989,TEXTURE6:33990,TEXTURE7:33991,TEXTURE8:33992,TEXTURE9:33993,TEXTURE10:33994,TEXTURE11:33995,TEXTURE12:33996,TEXTURE13:33997,TEXTURE14:33998,TEXTURE15:33999,TEXTURE16:34e3,TEXTURE17:34001,TEXTURE18:34002,TEXTURE19:34003,TEXTURE20:34004,TEXTURE21:34005,TEXTURE22:34006,TEXTURE23:34007,TEXTURE24:34008,TEXTURE25:34009,TEXTURE26:34010,TEXTURE27:34011,TEXTURE28:34012,TEXTURE29:34013,TEXTURE30:34014,TEXTURE31:34015,ACTIVE_TEXTURE:34016,REPEAT:10497,CLAMP_TO_EDGE:33071,MIRRORED_REPEAT:33648,FLOAT_VEC2:35664,FLOAT_VEC3:35665,FLOAT_VEC4:35666,INT_VEC2:35667,INT_VEC3:35668,INT_VEC4:35669,BOOL:35670,BOOL_VEC2:35671,BOOL_VEC3:35672,BOOL_VEC4:35673,FLOAT_MAT2:35674,FLOAT_MAT3:35675,FLOAT_MAT4:35676,SAMPLER_2D:35678,SAMPLER_CUBE:35680,VERTEX_ATTRIB_ARRAY_ENABLED:34338,VERTEX_ATTRIB_ARRAY_SIZE:34339,VERTEX_ATTRIB_ARRAY_STRIDE:34340,VERTEX_ATTRIB_ARRAY_TYPE:34341,VERTEX_ATTRIB_ARRAY_NORMALIZED:34922,VERTEX_ATTRIB_ARRAY_POINTER:34373,VERTEX_ATTRIB_ARRAY_BUFFER_BINDING:34975,IMPLEMENTATION_COLOR_READ_TYPE:35738,IMPLEMENTATION_COLOR_READ_FORMAT:35739,COMPILE_STATUS:35713,LOW_FLOAT:36336,MEDIUM_FLOAT:36337,HIGH_FLOAT:36338,LOW_INT:36339,MEDIUM_INT:36340,HIGH_INT:36341,FRAMEBUFFER:36160,RENDERBUFFER:36161,RGBA4:32854,RGB5_A1:32855,RGB565:36194,DEPTH_COMPONENT16:33189,STENCIL_INDEX:6401,STENCIL_INDEX8:36168,DEPTH_STENCIL:34041,RENDERBUFFER_WIDTH:36162,RENDERBUFFER_HEIGHT:36163,RENDERBUFFER_INTERNAL_FORMAT:36164,RENDERBUFFER_RED_SIZE:36176,RENDERBUFFER_GREEN_SIZE:36177,RENDERBUFFER_BLUE_SIZE:36178,RENDERBUFFER_ALPHA_SIZE:36179,RENDERBUFFER_DEPTH_SIZE:36180,RENDERBUFFER_STENCIL_SIZE:36181,FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE:36048,FRAMEBUFFER_ATTACHMENT_OBJECT_NAME:36049,FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL:36050,FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE:36051,COLOR_ATTACHMENT0:36064,DEPTH_ATTACHMENT:36096,STENCIL_ATTACHMENT:36128,DEPTH_STENCIL_ATTACHMENT:33306,NONE:0,FRAMEBUFFER_COMPLETE:36053,FRAMEBUFFER_INCOMPLETE_ATTACHMENT:36054,FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT:36055,FRAMEBUFFER_INCOMPLETE_DIMENSIONS:36057,FRAMEBUFFER_UNSUPPORTED:36061,FRAMEBUFFER_BINDING:36006,RENDERBUFFER_BINDING:36007,MAX_RENDERBUFFER_SIZE:34024,INVALID_FRAMEBUFFER_OPERATION:1286,UNPACK_FLIP_Y_WEBGL:37440,UNPACK_PREMULTIPLY_ALPHA_WEBGL:37441,CONTEXT_LOST_WEBGL:37442,UNPACK_COLORSPACE_CONVERSION_WEBGL:37443,BROWSER_DEFAULT_WEBGL:37444,DOUBLE:5130,READ_BUFFER:3074,UNPACK_ROW_LENGTH:3314,UNPACK_SKIP_ROWS:3315,UNPACK_SKIP_PIXELS:3316,PACK_ROW_LENGTH:3330,PACK_SKIP_ROWS:3331,PACK_SKIP_PIXELS:3332,COLOR:6144,DEPTH:6145,STENCIL:6146,RED:6403,RGB8:32849,RGBA8:32856,RGB10_A2:32857,TEXTURE_BINDING_3D:32874,UNPACK_SKIP_IMAGES:32877,UNPACK_IMAGE_HEIGHT:32878,TEXTURE_3D:32879,TEXTURE_WRAP_R:32882,MAX_3D_TEXTURE_SIZE:32883,UNSIGNED_INT_2_10_10_10_REV:33640,MAX_ELEMENTS_VERTICES:33e3,MAX_ELEMENTS_INDICES:33001,TEXTURE_MIN_LOD:33082,TEXTURE_MAX_LOD:33083,TEXTURE_BASE_LEVEL:33084,TEXTURE_MAX_LEVEL:33085,MIN:32775,MAX:32776,DEPTH_COMPONENT24:33190,MAX_TEXTURE_LOD_BIAS:34045,TEXTURE_COMPARE_MODE:34892,TEXTURE_COMPARE_FUNC:34893,CURRENT_QUERY:34917,QUERY_RESULT:34918,QUERY_RESULT_AVAILABLE:34919,STREAM_READ:35041,STREAM_COPY:35042,STATIC_READ:35045,STATIC_COPY:35046,DYNAMIC_READ:35049,DYNAMIC_COPY:35050,MAX_DRAW_BUFFERS:34852,DRAW_BUFFER0:34853,DRAW_BUFFER1:34854,DRAW_BUFFER2:34855,DRAW_BUFFER3:34856,DRAW_BUFFER4:34857,DRAW_BUFFER5:34858,DRAW_BUFFER6:34859,DRAW_BUFFER7:34860,DRAW_BUFFER8:34861,DRAW_BUFFER9:34862,DRAW_BUFFER10:34863,DRAW_BUFFER11:34864,DRAW_BUFFER12:34865,DRAW_BUFFER13:34866,DRAW_BUFFER14:34867,DRAW_BUFFER15:34868,MAX_FRAGMENT_UNIFORM_COMPONENTS:35657,MAX_VERTEX_UNIFORM_COMPONENTS:35658,SAMPLER_3D:35679,SAMPLER_2D_SHADOW:35682,FRAGMENT_SHADER_DERIVATIVE_HINT:35723,PIXEL_PACK_BUFFER:35051,PIXEL_UNPACK_BUFFER:35052,PIXEL_PACK_BUFFER_BINDING:35053,PIXEL_UNPACK_BUFFER_BINDING:35055,FLOAT_MAT2x3:35685,FLOAT_MAT2x4:35686,FLOAT_MAT3x2:35687,FLOAT_MAT3x4:35688,FLOAT_MAT4x2:35689,FLOAT_MAT4x3:35690,SRGB:35904,SRGB8:35905,SRGB8_ALPHA8:35907,COMPARE_REF_TO_TEXTURE:34894,RGBA32F:34836,RGB32F:34837,RGBA16F:34842,RGB16F:34843,VERTEX_ATTRIB_ARRAY_INTEGER:35069,MAX_ARRAY_TEXTURE_LAYERS:35071,MIN_PROGRAM_TEXEL_OFFSET:35076,MAX_PROGRAM_TEXEL_OFFSET:35077,MAX_VARYING_COMPONENTS:35659,TEXTURE_2D_ARRAY:35866,TEXTURE_BINDING_2D_ARRAY:35869,R11F_G11F_B10F:35898,UNSIGNED_INT_10F_11F_11F_REV:35899,RGB9_E5:35901,UNSIGNED_INT_5_9_9_9_REV:35902,TRANSFORM_FEEDBACK_BUFFER_MODE:35967,MAX_TRANSFORM_FEEDBACK_SEPARATE_COMPONENTS:35968,TRANSFORM_FEEDBACK_VARYINGS:35971,TRANSFORM_FEEDBACK_BUFFER_START:35972,TRANSFORM_FEEDBACK_BUFFER_SIZE:35973,TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN:35976,RASTERIZER_DISCARD:35977,MAX_TRANSFORM_FEEDBACK_INTERLEAVED_COMPONENTS:35978,MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS:35979,INTERLEAVED_ATTRIBS:35980,SEPARATE_ATTRIBS:35981,TRANSFORM_FEEDBACK_BUFFER:35982,TRANSFORM_FEEDBACK_BUFFER_BINDING:35983,RGBA32UI:36208,RGB32UI:36209,RGBA16UI:36214,RGB16UI:36215,RGBA8UI:36220,RGB8UI:36221,RGBA32I:36226,RGB32I:36227,RGBA16I:36232,RGB16I:36233,RGBA8I:36238,RGB8I:36239,RED_INTEGER:36244,RGB_INTEGER:36248,RGBA_INTEGER:36249,SAMPLER_2D_ARRAY:36289,SAMPLER_2D_ARRAY_SHADOW:36292,SAMPLER_CUBE_SHADOW:36293,UNSIGNED_INT_VEC2:36294,UNSIGNED_INT_VEC3:36295,UNSIGNED_INT_VEC4:36296,INT_SAMPLER_2D:36298,INT_SAMPLER_3D:36299,INT_SAMPLER_CUBE:36300,INT_SAMPLER_2D_ARRAY:36303,UNSIGNED_INT_SAMPLER_2D:36306,UNSIGNED_INT_SAMPLER_3D:36307,UNSIGNED_INT_SAMPLER_CUBE:36308,UNSIGNED_INT_SAMPLER_2D_ARRAY:36311,DEPTH_COMPONENT32F:36012,DEPTH32F_STENCIL8:36013,FLOAT_32_UNSIGNED_INT_24_8_REV:36269,FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING:33296,FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE:33297,FRAMEBUFFER_ATTACHMENT_RED_SIZE:33298,FRAMEBUFFER_ATTACHMENT_GREEN_SIZE:33299,FRAMEBUFFER_ATTACHMENT_BLUE_SIZE:33300,FRAMEBUFFER_ATTACHMENT_ALPHA_SIZE:33301,FRAMEBUFFER_ATTACHMENT_DEPTH_SIZE:33302,FRAMEBUFFER_ATTACHMENT_STENCIL_SIZE:33303,FRAMEBUFFER_DEFAULT:33304,UNSIGNED_INT_24_8:34042,DEPTH24_STENCIL8:35056,UNSIGNED_NORMALIZED:35863,DRAW_FRAMEBUFFER_BINDING:36006,READ_FRAMEBUFFER:36008,DRAW_FRAMEBUFFER:36009,READ_FRAMEBUFFER_BINDING:36010,RENDERBUFFER_SAMPLES:36011,FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER:36052,MAX_COLOR_ATTACHMENTS:36063,COLOR_ATTACHMENT1:36065,COLOR_ATTACHMENT2:36066,COLOR_ATTACHMENT3:36067,COLOR_ATTACHMENT4:36068,COLOR_ATTACHMENT5:36069,COLOR_ATTACHMENT6:36070,COLOR_ATTACHMENT7:36071,COLOR_ATTACHMENT8:36072,COLOR_ATTACHMENT9:36073,COLOR_ATTACHMENT10:36074,COLOR_ATTACHMENT11:36075,COLOR_ATTACHMENT12:36076,COLOR_ATTACHMENT13:36077,COLOR_ATTACHMENT14:36078,COLOR_ATTACHMENT15:36079,FRAMEBUFFER_INCOMPLETE_MULTISAMPLE:36182,MAX_SAMPLES:36183,HALF_FLOAT:5131,RG:33319,RG_INTEGER:33320,R8:33321,RG8:33323,R16F:33325,R32F:33326,RG16F:33327,RG32F:33328,R8I:33329,R8UI:33330,R16I:33331,R16UI:33332,R32I:33333,R32UI:33334,RG8I:33335,RG8UI:33336,RG16I:33337,RG16UI:33338,RG32I:33339,RG32UI:33340,VERTEX_ARRAY_BINDING:34229,R8_SNORM:36756,RG8_SNORM:36757,RGB8_SNORM:36758,RGBA8_SNORM:36759,SIGNED_NORMALIZED:36764,COPY_READ_BUFFER:36662,COPY_WRITE_BUFFER:36663,COPY_READ_BUFFER_BINDING:36662,COPY_WRITE_BUFFER_BINDING:36663,UNIFORM_BUFFER:35345,UNIFORM_BUFFER_BINDING:35368,UNIFORM_BUFFER_START:35369,UNIFORM_BUFFER_SIZE:35370,MAX_VERTEX_UNIFORM_BLOCKS:35371,MAX_FRAGMENT_UNIFORM_BLOCKS:35373,MAX_COMBINED_UNIFORM_BLOCKS:35374,MAX_UNIFORM_BUFFER_BINDINGS:35375,MAX_UNIFORM_BLOCK_SIZE:35376,MAX_COMBINED_VERTEX_UNIFORM_COMPONENTS:35377,MAX_COMBINED_FRAGMENT_UNIFORM_COMPONENTS:35379,UNIFORM_BUFFER_OFFSET_ALIGNMENT:35380,ACTIVE_UNIFORM_BLOCKS:35382,UNIFORM_TYPE:35383,UNIFORM_SIZE:35384,UNIFORM_BLOCK_INDEX:35386,UNIFORM_OFFSET:35387,UNIFORM_ARRAY_STRIDE:35388,UNIFORM_MATRIX_STRIDE:35389,UNIFORM_IS_ROW_MAJOR:35390,UNIFORM_BLOCK_BINDING:35391,UNIFORM_BLOCK_DATA_SIZE:35392,UNIFORM_BLOCK_ACTIVE_UNIFORMS:35394,UNIFORM_BLOCK_ACTIVE_UNIFORM_INDICES:35395,UNIFORM_BLOCK_REFERENCED_BY_VERTEX_SHADER:35396,UNIFORM_BLOCK_REFERENCED_BY_FRAGMENT_SHADER:35398,INVALID_INDEX:4294967295,MAX_VERTEX_OUTPUT_COMPONENTS:37154,MAX_FRAGMENT_INPUT_COMPONENTS:37157,MAX_SERVER_WAIT_TIMEOUT:37137,OBJECT_TYPE:37138,SYNC_CONDITION:37139,SYNC_STATUS:37140,SYNC_FLAGS:37141,SYNC_FENCE:37142,SYNC_GPU_COMMANDS_COMPLETE:37143,UNSIGNALED:37144,SIGNALED:37145,ALREADY_SIGNALED:37146,TIMEOUT_EXPIRED:37147,CONDITION_SATISFIED:37148,WAIT_FAILED:37149,SYNC_FLUSH_COMMANDS_BIT:1,VERTEX_ATTRIB_ARRAY_DIVISOR:35070,ANY_SAMPLES_PASSED:35887,ANY_SAMPLES_PASSED_CONSERVATIVE:36202,SAMPLER_BINDING:35097,RGB10_A2UI:36975,INT_2_10_10_10_REV:36255,TRANSFORM_FEEDBACK:36386,TRANSFORM_FEEDBACK_PAUSED:36387,TRANSFORM_FEEDBACK_ACTIVE:36388,TRANSFORM_FEEDBACK_BINDING:36389,COMPRESSED_R11_EAC:37488,COMPRESSED_SIGNED_R11_EAC:37489,COMPRESSED_RG11_EAC:37490,COMPRESSED_SIGNED_RG11_EAC:37491,COMPRESSED_RGB8_ETC2:37492,COMPRESSED_SRGB8_ETC2:37493,COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2:37494,COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2:37495,COMPRESSED_RGBA8_ETC2_EAC:37496,COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:37497,TEXTURE_IMMUTABLE_FORMAT:37167,MAX_ELEMENT_INDEX:36203,TEXTURE_IMMUTABLE_LEVELS:33503};return e(r)}),define("Core/Fullscreen",["./defined","./defineProperties"],function(e,r){"use strict";var t,n={requestFullscreen:void 0,exitFullscreen:void 0,fullscreenEnabled:void 0,fullscreenElement:void 0,fullscreenchange:void 0,fullscreenerror:void 0},i={};return r(i,{element:{get:function(){return i.supportsFullscreen()?document[n.fullscreenElement]:void 0}},changeEventName:{get:function(){return i.supportsFullscreen()?n.fullscreenchange:void 0}},errorEventName:{get:function(){return i.supportsFullscreen()?n.fullscreenerror:void 0}},enabled:{get:function(){return i.supportsFullscreen()?document[n.fullscreenEnabled]:void 0}},fullscreen:{get:function(){return i.supportsFullscreen()?null!==i.element:void 0}}}),i.supportsFullscreen=function(){if(e(t))return t;t=!1;var r=document.body;if("function"==typeof r.requestFullscreen)return n.requestFullscreen="requestFullscreen",n.exitFullscreen="exitFullscreen",n.fullscreenEnabled="fullscreenEnabled",n.fullscreenElement="fullscreenElement",n.fullscreenchange="fullscreenchange",n.fullscreenerror="fullscreenerror",t=!0;for(var i,a=["webkit","moz","o","ms","khtml"],o=0,u=a.length;u>o;++o){var s=a[o];i=s+"RequestFullscreen","function"==typeof r[i]?(n.requestFullscreen=i,t=!0):(i=s+"RequestFullScreen","function"==typeof r[i]&&(n.requestFullscreen=i,t=!0)),i=s+"ExitFullscreen","function"==typeof document[i]?n.exitFullscreen=i:(i=s+"CancelFullScreen","function"==typeof document[i]&&(n.exitFullscreen=i)),i=s+"FullscreenEnabled",void 0!==document[i]?n.fullscreenEnabled=i:(i=s+"FullScreenEnabled",void 0!==document[i]&&(n.fullscreenEnabled=i)),i=s+"FullscreenElement",void 0!==document[i]?n.fullscreenElement=i:(i=s+"FullScreenElement",void 0!==document[i]&&(n.fullscreenElement=i)),i=s+"fullscreenchange",void 0!==document["on"+i]&&("ms"===s&&(i="MSFullscreenChange"),n.fullscreenchange=i),i=s+"fullscreenerror",void 0!==document["on"+i]&&("ms"===s&&(i="MSFullscreenError"),n.fullscreenerror=i)}return t},i.requestFullscreen=function(e,r){i.supportsFullscreen()&&e[n.requestFullscreen]({vrDisplay:r})},i.exitFullscreen=function(){i.supportsFullscreen()&&document[n.exitFullscreen]()},i}),define("Core/FeatureDetection",["./defaultValue","./defined","./Fullscreen"],function(e,r,t){"use strict";function n(e){for(var r=e.split("."),t=0,n=r.length;n>t;++t)r[t]=parseInt(r[t],10);return r}function i(){if(!r(_)){_=!1;var e=/ Chrome\/([\.0-9]+)/.exec(y.userAgent);null!==e&&(_=!0,T=n(e[1]))}return _}function a(){return i()&&T}function o(){if(!r(R)&&(R=!1,!i()&&/ Safari\/[\.0-9]+/.test(y.userAgent))){var e=/ Version\/([\.0-9]+)/.exec(y.userAgent);null!==e&&(R=!0,A=n(e[1]));
  }return R}function u(){return o()&&A}function s(){if(!r(v)){v=!1;var e=/ AppleWebKit\/([\.0-9]+)(\+?)/.exec(y.userAgent);null!==e&&(v=!0,N=n(e[1]),N.isNightly=!!e[2])}return v}function c(){return s()&&N}function l(){if(!r(I)){I=!1;var e;"Microsoft Internet Explorer"===y.appName?(e=/MSIE ([0-9]{1,}[\.0-9]{0,})/.exec(y.userAgent),null!==e&&(I=!0,S=n(e[1]))):"Netscape"===y.appName&&(e=/Trident\/.*rv:([0-9]{1,}[\.0-9]{0,})/.exec(y.userAgent),null!==e&&(I=!0,S=n(e[1])))}return I}function f(){return l()&&S}function h(){if(!r(g)){g=!1;var e=/Firefox\/([\.0-9]+)/.exec(y.userAgent);null!==e&&(g=!0,M=n(e[1]))}return g}function w(){return r(O)||(O=/Windows/i.test(y.appVersion)),O}function d(){return h()&&M}function m(){return r(q)||(q="undefined"!=typeof PointerEvent&&(!r(y.pointerEnabled)||y.pointerEnabled)),q}function E(){if(!r(b)){var e=document.createElement("canvas");e.setAttribute("style","image-rendering: -moz-crisp-edges;image-rendering: pixelated;");var t=e.style.imageRendering;b=r(t)&&""!==t,b&&(x=t)}return b}function p(){return E()?x:void 0}var y;y="undefined"!=typeof navigator?navigator:{};var _,T,R,A,v,N,I,S,g,M,O,q,x,b,P={isChrome:i,chromeVersion:a,isSafari:o,safariVersion:u,isWebkit:s,webkitVersion:c,isInternetExplorer:l,internetExplorerVersion:f,isFirefox:h,firefoxVersion:d,isWindows:w,hardwareConcurrency:e(y.hardwareConcurrency,3),supportsPointerEvents:m,supportsImageRenderingPixelated:E,imageRenderingValue:p};return P.supportsFullscreen=function(){return t.supportsFullscreen()},P.supportsTypedArrays=function(){return"undefined"!=typeof ArrayBuffer},P.supportsWebWorkers=function(){return"undefined"!=typeof Worker},P}),define("Core/ComponentDatatype",["../Renderer/WebGLConstants","./defaultValue","./defined","./DeveloperError","./FeatureDetection","./freezeObject"],function(e,r,t,n,i,a){"use strict";if(!i.supportsTypedArrays())return{};var o={BYTE:e.BYTE,UNSIGNED_BYTE:e.UNSIGNED_BYTE,SHORT:e.SHORT,UNSIGNED_SHORT:e.UNSIGNED_SHORT,FLOAT:e.FLOAT,DOUBLE:e.DOUBLE};return o.getSizeInBytes=function(e){if(!t(e))throw new n("value is required.");switch(e){case o.BYTE:return Int8Array.BYTES_PER_ELEMENT;case o.UNSIGNED_BYTE:return Uint8Array.BYTES_PER_ELEMENT;case o.SHORT:return Int16Array.BYTES_PER_ELEMENT;case o.UNSIGNED_SHORT:return Uint16Array.BYTES_PER_ELEMENT;case o.FLOAT:return Float32Array.BYTES_PER_ELEMENT;case o.DOUBLE:return Float64Array.BYTES_PER_ELEMENT;default:throw new n("componentDatatype is not a valid value.")}},o.fromTypedArray=function(e){return e instanceof Int8Array?o.BYTE:e instanceof Uint8Array?o.UNSIGNED_BYTE:e instanceof Int16Array?o.SHORT:e instanceof Uint16Array?o.UNSIGNED_SHORT:e instanceof Float32Array?o.FLOAT:e instanceof Float64Array?o.DOUBLE:void 0},o.validate=function(e){return t(e)&&(e===o.BYTE||e===o.UNSIGNED_BYTE||e===o.SHORT||e===o.UNSIGNED_SHORT||e===o.FLOAT||e===o.DOUBLE)},o.createTypedArray=function(e,r){if(!t(e))throw new n("componentDatatype is required.");if(!t(r))throw new n("valuesOrLength is required.");switch(e){case o.BYTE:return new Int8Array(r);case o.UNSIGNED_BYTE:return new Uint8Array(r);case o.SHORT:return new Int16Array(r);case o.UNSIGNED_SHORT:return new Uint16Array(r);case o.FLOAT:return new Float32Array(r);case o.DOUBLE:return new Float64Array(r);default:throw new n("componentDatatype is not a valid value.")}},o.createArrayBufferView=function(e,i,a,u){if(!t(e))throw new n("componentDatatype is required.");if(!t(i))throw new n("buffer is required.");switch(a=r(a,0),u=r(u,(i.byteLength-a)/o.getSizeInBytes(e)),e){case o.BYTE:return new Int8Array(i,a,u);case o.UNSIGNED_BYTE:return new Uint8Array(i,a,u);case o.SHORT:return new Int16Array(i,a,u);case o.UNSIGNED_SHORT:return new Uint16Array(i,a,u);case o.FLOAT:return new Float32Array(i,a,u);case o.DOUBLE:return new Float64Array(i,a,u);default:throw new n("componentDatatype is not a valid value.")}},a(o)}),define("Core/Quaternion",["./Cartesian3","./defaultValue","./defined","./DeveloperError","./FeatureDetection","./freezeObject","./Math","./Matrix3"],function(e,r,t,n,i,a,o,u){"use strict";function s(e,t,n,i){this.x=r(e,0),this.y=r(t,0),this.z=r(n,0),this.w=r(i,0)}var c=new e;s.fromAxisAngle=function(r,i,a){if(!t(r))throw new n("axis is required.");if("number"!=typeof i)throw new n("angle is required and must be a number.");var o=i/2,u=Math.sin(o);c=e.normalize(r,c);var l=c.x*u,f=c.y*u,h=c.z*u,w=Math.cos(o);return t(a)?(a.x=l,a.y=f,a.z=h,a.w=w,a):new s(l,f,h,w)};var l=[1,2,0],f=new Array(3);s.fromRotationMatrix=function(e,r){if(!t(e))throw new n("matrix is required.");var i,a,o,c,h,w=e[u.COLUMN0ROW0],d=e[u.COLUMN1ROW1],m=e[u.COLUMN2ROW2],E=w+d+m;if(E>0)i=Math.sqrt(E+1),h=.5*i,i=.5/i,a=(e[u.COLUMN1ROW2]-e[u.COLUMN2ROW1])*i,o=(e[u.COLUMN2ROW0]-e[u.COLUMN0ROW2])*i,c=(e[u.COLUMN0ROW1]-e[u.COLUMN1ROW0])*i;else{var p=l,y=0;d>w&&(y=1),m>w&&m>d&&(y=2);var _=p[y],T=p[_];i=Math.sqrt(e[u.getElementIndex(y,y)]-e[u.getElementIndex(_,_)]-e[u.getElementIndex(T,T)]+1);var R=f;R[y]=.5*i,i=.5/i,h=(e[u.getElementIndex(T,_)]-e[u.getElementIndex(_,T)])*i,R[_]=(e[u.getElementIndex(_,y)]+e[u.getElementIndex(y,_)])*i,R[T]=(e[u.getElementIndex(T,y)]+e[u.getElementIndex(y,T)])*i,a=-R[0],o=-R[1],c=-R[2]}return t(r)?(r.x=a,r.y=o,r.z=c,r.w=h,r):new s(a,o,c,h)};var h=new s;s.fromHeadingPitchRoll=function(r,i,a,o){if(!t(r))throw new n("heading is required.");if(!t(i))throw new n("pitch is required.");if(!t(a))throw new n("roll is required.");var u=s.fromAxisAngle(e.UNIT_X,a,h),c=s.fromAxisAngle(e.UNIT_Y,-i,o);o=s.multiply(c,u,c);var l=s.fromAxisAngle(e.UNIT_Z,-r,h);return s.multiply(l,o,o)};var w=new e,d=new e,m=new s,E=new s,p=new s;s.packedLength=4,s.pack=function(e,i,a){if(!t(e))throw new n("value is required");if(!t(i))throw new n("array is required");a=r(a,0),i[a++]=e.x,i[a++]=e.y,i[a++]=e.z,i[a]=e.w},s.unpack=function(e,i,a){if(!t(e))throw new n("array is required");return i=r(i,0),t(a)||(a=new s),a.x=e[i],a.y=e[i+1],a.z=e[i+2],a.w=e[i+3],a},s.packedInterpolationLength=3,s.convertPackedArrayForInterpolation=function(e,r,t,n){s.unpack(e,4*t,p),s.conjugate(p,p);for(var i=0,a=t-r+1;a>i;i++){var o=3*i;s.unpack(e,4*(r+i),m),s.multiply(m,p,m),m.w<0&&s.negate(m,m),s.computeAxis(m,w);var u=s.computeAngle(m);n[o]=w.x*u,n[o+1]=w.y*u,n[o+2]=w.z*u}},s.unpackInterpolationResult=function(r,n,i,a,o){t(o)||(o=new s),e.fromArray(r,0,d);var u=e.magnitude(d);return s.unpack(n,4*a,E),0===u?s.clone(s.IDENTITY,m):s.fromAxisAngle(d,u,m),s.multiply(m,E,o)},s.clone=function(e,r){return t(e)?t(r)?(r.x=e.x,r.y=e.y,r.z=e.z,r.w=e.w,r):new s(e.x,e.y,e.z,e.w):void 0},s.conjugate=function(e,r){if(!t(e))throw new n("quaternion is required");if(!t(r))throw new n("result is required");return r.x=-e.x,r.y=-e.y,r.z=-e.z,r.w=e.w,r},s.magnitudeSquared=function(e){if(!t(e))throw new n("quaternion is required");return e.x*e.x+e.y*e.y+e.z*e.z+e.w*e.w},s.magnitude=function(e){return Math.sqrt(s.magnitudeSquared(e))},s.normalize=function(e,r){if(!t(r))throw new n("result is required");var i=1/s.magnitude(e),a=e.x*i,o=e.y*i,u=e.z*i,c=e.w*i;return r.x=a,r.y=o,r.z=u,r.w=c,r},s.inverse=function(e,r){if(!t(r))throw new n("result is required");var i=s.magnitudeSquared(e);return r=s.conjugate(e,r),s.multiplyByScalar(r,1/i,r)},s.add=function(e,r,i){if(!t(e))throw new n("left is required");if(!t(r))throw new n("right is required");if(!t(i))throw new n("result is required");return i.x=e.x+r.x,i.y=e.y+r.y,i.z=e.z+r.z,i.w=e.w+r.w,i},s.subtract=function(e,r,i){if(!t(e))throw new n("left is required");if(!t(r))throw new n("right is required");if(!t(i))throw new n("result is required");return i.x=e.x-r.x,i.y=e.y-r.y,i.z=e.z-r.z,i.w=e.w-r.w,i},s.negate=function(e,r){if(!t(e))throw new n("quaternion is required");if(!t(r))throw new n("result is required");return r.x=-e.x,r.y=-e.y,r.z=-e.z,r.w=-e.w,r},s.dot=function(e,r){if(!t(e))throw new n("left is required");if(!t(r))throw new n("right is required");return e.x*r.x+e.y*r.y+e.z*r.z+e.w*r.w},s.multiply=function(e,r,i){if(!t(e))throw new n("left is required");if(!t(r))throw new n("right is required");if(!t(i))throw new n("result is required");var a=e.x,o=e.y,u=e.z,s=e.w,c=r.x,l=r.y,f=r.z,h=r.w,w=s*c+a*h+o*f-u*l,d=s*l-a*f+o*h+u*c,m=s*f+a*l-o*c+u*h,E=s*h-a*c-o*l-u*f;return i.x=w,i.y=d,i.z=m,i.w=E,i},s.multiplyByScalar=function(e,r,i){if(!t(e))throw new n("quaternion is required");if("number"!=typeof r)throw new n("scalar is required and must be a number.");if(!t(i))throw new n("result is required");return i.x=e.x*r,i.y=e.y*r,i.z=e.z*r,i.w=e.w*r,i},s.divideByScalar=function(e,r,i){if(!t(e))throw new n("quaternion is required");if("number"!=typeof r)throw new n("scalar is required and must be a number.");if(!t(i))throw new n("result is required");return i.x=e.x/r,i.y=e.y/r,i.z=e.z/r,i.w=e.w/r,i},s.computeAxis=function(e,r){if(!t(e))throw new n("quaternion is required");if(!t(r))throw new n("result is required");var i=e.w;if(Math.abs(i-1)<o.EPSILON6)return r.x=r.y=r.z=0,r;var a=1/Math.sqrt(1-i*i);return r.x=e.x*a,r.y=e.y*a,r.z=e.z*a,r},s.computeAngle=function(e){if(!t(e))throw new n("quaternion is required");return Math.abs(e.w-1)<o.EPSILON6?0:2*Math.acos(e.w)};var y=new s;s.lerp=function(e,r,i,a){if(!t(e))throw new n("start is required.");if(!t(r))throw new n("end is required.");if("number"!=typeof i)throw new n("t is required and must be a number.");if(!t(a))throw new n("result is required");return y=s.multiplyByScalar(r,i,y),a=s.multiplyByScalar(e,1-i,a),s.add(y,a,a)};var _=new s,T=new s,R=new s;s.slerp=function(e,r,i,a){if(!t(e))throw new n("start is required.");if(!t(r))throw new n("end is required.");if("number"!=typeof i)throw new n("t is required and must be a number.");if(!t(a))throw new n("result is required");var u=s.dot(e,r),c=r;if(0>u&&(u=-u,c=_=s.negate(r,_)),1-u<o.EPSILON6)return s.lerp(e,c,i,a);var l=Math.acos(u);return T=s.multiplyByScalar(e,Math.sin((1-i)*l),T),R=s.multiplyByScalar(c,Math.sin(i*l),R),a=s.add(T,R,a),s.multiplyByScalar(a,1/Math.sin(l),a)},s.log=function(r,i){if(!t(r))throw new n("quaternion is required.");if(!t(i))throw new n("result is required");var a=o.acosClamped(r.w),u=0;return 0!==a&&(u=a/Math.sin(a)),e.multiplyByScalar(r,u,i)},s.exp=function(r,i){if(!t(r))throw new n("cartesian is required.");if(!t(i))throw new n("result is required");var a=e.magnitude(r),o=0;return 0!==a&&(o=Math.sin(a)/a),i.x=r.x*o,i.y=r.y*o,i.z=r.z*o,i.w=Math.cos(a),i};var A=new e,v=new e,N=new s,I=new s;s.computeInnerQuadrangle=function(r,i,a,o){if(!t(r)||!t(i)||!t(a))throw new n("q0, q1, and q2 are required.");if(!t(o))throw new n("result is required");var u=s.conjugate(i,N);s.multiply(u,a,I);var c=s.log(I,A);s.multiply(u,r,I);var l=s.log(I,v);return e.add(c,l,c),e.multiplyByScalar(c,.25,c),e.negate(c,c),s.exp(c,N),s.multiply(i,N,o)},s.squad=function(e,r,i,a,o,u){if(!(t(e)&&t(r)&&t(i)&&t(a)))throw new n("q0, q1, s0, and s1 are required.");if("number"!=typeof o)throw new n("t is required and must be a number.");if(!t(u))throw new n("result is required");var c=s.slerp(e,r,o,N),l=s.slerp(i,a,o,I);return s.slerp(c,l,2*o*(1-o),u)};for(var S=new s,g=1.9011074535173003,M=i.supportsTypedArrays()?new Float32Array(8):[],O=i.supportsTypedArrays()?new Float32Array(8):[],q=i.supportsTypedArrays()?new Float32Array(8):[],x=i.supportsTypedArrays()?new Float32Array(8):[],b=0;7>b;++b){var P=b+1,L=2*P+1;M[b]=1/(P*L),O[b]=P/L}return M[7]=g/136,O[7]=8*g/17,s.fastSlerp=function(e,r,i,a){if(!t(e))throw new n("start is required.");if(!t(r))throw new n("end is required.");if("number"!=typeof i)throw new n("t is required and must be a number.");if(!t(a))throw new n("result is required");var o,u=s.dot(e,r);u>=0?o=1:(o=-1,u=-u);for(var c=u-1,l=1-i,f=i*i,h=l*l,w=7;w>=0;--w)q[w]=(M[w]*f-O[w])*c,x[w]=(M[w]*h-O[w])*c;var d=o*i*(1+q[0]*(1+q[1]*(1+q[2]*(1+q[3]*(1+q[4]*(1+q[5]*(1+q[6]*(1+q[7])))))))),m=l*(1+x[0]*(1+x[1]*(1+x[2]*(1+x[3]*(1+x[4]*(1+x[5]*(1+x[6]*(1+x[7])))))))),E=s.multiplyByScalar(e,m,S);return s.multiplyByScalar(r,d,a),s.add(E,a,a)},s.fastSquad=function(e,r,i,a,o,u){if(!(t(e)&&t(r)&&t(i)&&t(a)))throw new n("q0, q1, s0, and s1 are required.");if("number"!=typeof o)throw new n("t is required and must be a number.");if(!t(u))throw new n("result is required");var c=s.fastSlerp(e,r,o,N),l=s.fastSlerp(i,a,o,I);return s.fastSlerp(c,l,2*o*(1-o),u)},s.equals=function(e,r){return e===r||t(e)&&t(r)&&e.x===r.x&&e.y===r.y&&e.z===r.z&&e.w===r.w},s.equalsEpsilon=function(e,r,i){if("number"!=typeof i)throw new n("epsilon is required and must be a number.");return e===r||t(e)&&t(r)&&Math.abs(e.x-r.x)<=i&&Math.abs(e.y-r.y)<=i&&Math.abs(e.z-r.z)<=i&&Math.abs(e.w-r.w)<=i},s.ZERO=a(new s(0,0,0,0)),s.IDENTITY=a(new s(0,0,0,1)),s.prototype.clone=function(e){return s.clone(this,e)},s.prototype.equals=function(e){return s.equals(this,e)},s.prototype.equalsEpsilon=function(e,r){return s.equalsEpsilon(this,e,r)},s.prototype.toString=function(){return"("+this.x+", "+this.y+", "+this.z+", "+this.w+")"},s}),define("Core/EllipseGeometryLibrary",["./Cartesian3","./Math","./Matrix3","./Quaternion"],function(e,r,t,n){"use strict";function i(r,i,a,l,f,h,w,d,m,E){var p=r+i;e.multiplyByScalar(l,Math.cos(p),o),e.multiplyByScalar(a,Math.sin(p),u),e.add(o,u,o);var y=Math.cos(r);y*=y;var _=Math.sin(r);_*=_;var T=h/Math.sqrt(w*y+f*_),R=T/d;return n.fromAxisAngle(o,R,s),t.fromQuaternion(s,c),t.multiplyByVector(c,m,E),e.normalize(E,E),e.multiplyByScalar(E,d,E),E}var a={},o=new e,u=new e,s=new n,c=new t,l=new e,f=new e,h=new e,w=new e;a.raisePositionsToHeight=function(r,t,n){for(var i=t.ellipsoid,a=t.height,o=t.extrudedHeight,u=n?r.length/3*2:r.length/3,s=new Float64Array(3*u),c=r.length,d=n?c:0,m=0;c>m;m+=3){var E=m+1,p=m+2,y=e.fromArray(r,m,l);i.scaleToGeodeticSurface(y,y);var _=e.clone(y,f),T=i.geodeticSurfaceNormal(y,w),R=e.multiplyByScalar(T,a,h);e.add(y,R,y),n&&(e.multiplyByScalar(T,o,R),e.add(_,R,_),s[m+d]=_.x,s[E+d]=_.y,s[p+d]=_.z),s[m]=y.x,s[E]=y.y,s[p]=y.z}return s};var d=new e,m=new e,E=new e;return a.computeEllipsePositions=function(t,n,a){var o=t.semiMinorAxis,u=t.semiMajorAxis,s=t.rotation,c=t.center,w=8*t.granularity,p=o*o,y=u*u,_=u*o,T=e.magnitude(c),R=e.normalize(c,d),A=e.cross(e.UNIT_Z,c,m);A=e.normalize(A,A);var v=e.cross(R,A,E),N=1+Math.ceil(r.PI_OVER_TWO/w),I=r.PI_OVER_TWO/(N-1),S=r.PI_OVER_TWO-N*I;0>S&&(N-=Math.ceil(Math.abs(S)/I));var g,M,O,q,x,b=2*(N*(N+2)),P=n?new Array(3*b):void 0,L=0,C=l,F=f,U=4*N*3,D=U-1,z=0,B=a?new Array(U):void 0;for(S=r.PI_OVER_TWO,C=i(S,s,v,A,p,_,y,T,R,C),n&&(P[L++]=C.x,P[L++]=C.y,P[L++]=C.z),a&&(B[D--]=C.z,B[D--]=C.y,B[D--]=C.x),S=r.PI_OVER_TWO-I,g=1;N+1>g;++g){if(C=i(S,s,v,A,p,_,y,T,R,C),F=i(Math.PI-S,s,v,A,p,_,y,T,R,F),n){for(P[L++]=C.x,P[L++]=C.y,P[L++]=C.z,O=2*g+2,M=1;O-1>M;++M)q=M/(O-1),x=e.lerp(C,F,q,h),P[L++]=x.x,P[L++]=x.y,P[L++]=x.z;P[L++]=F.x,P[L++]=F.y,P[L++]=F.z}a&&(B[D--]=C.z,B[D--]=C.y,B[D--]=C.x,B[z++]=F.x,B[z++]=F.y,B[z++]=F.z),S=r.PI_OVER_TWO-(g+1)*I}for(g=N;g>1;--g){if(S=r.PI_OVER_TWO-(g-1)*I,C=i(-S,s,v,A,p,_,y,T,R,C),F=i(S+Math.PI,s,v,A,p,_,y,T,R,F),n){for(P[L++]=C.x,P[L++]=C.y,P[L++]=C.z,O=2*(g-1)+2,M=1;O-1>M;++M)q=M/(O-1),x=e.lerp(C,F,q,h),P[L++]=x.x,P[L++]=x.y,P[L++]=x.z;P[L++]=F.x,P[L++]=F.y,P[L++]=F.z}a&&(B[D--]=C.z,B[D--]=C.y,B[D--]=C.x,B[z++]=F.x,B[z++]=F.y,B[z++]=F.z)}S=r.PI_OVER_TWO,C=i(-S,s,v,A,p,_,y,T,R,C);var G={};return n&&(P[L++]=C.x,P[L++]=C.y,P[L++]=C.z,G.positions=P,G.numPts=N),a&&(B[D--]=C.z,B[D--]=C.y,B[D--]=C.x,G.outerPositions=B),G},a}),define("Core/GeometryType",["./freezeObject"],function(e){"use strict";var r={NONE:0,TRIANGLES:1,LINES:2,POLYLINES:3};return e(r)}),define("Core/PrimitiveType",["../Renderer/WebGLConstants","./freezeObject"],function(e,r){"use strict";var t={POINTS:e.POINTS,LINES:e.LINES,LINE_LOOP:e.LINE_LOOP,LINE_STRIP:e.LINE_STRIP,TRIANGLES:e.TRIANGLES,TRIANGLE_STRIP:e.TRIANGLE_STRIP,TRIANGLE_FAN:e.TRIANGLE_FAN,validate:function(e){return e===t.POINTS||e===t.LINES||e===t.LINE_LOOP||e===t.LINE_STRIP||e===t.TRIANGLES||e===t.TRIANGLE_STRIP||e===t.TRIANGLE_FAN}};return r(t)}),define("Core/Geometry",["./defaultValue","./defined","./DeveloperError","./GeometryType","./PrimitiveType"],function(e,r,t,n,i){"use strict";function a(a){if(a=e(a,e.EMPTY_OBJECT),!r(a.attributes))throw new t("options.attributes is required.");this.attributes=a.attributes,this.indices=a.indices,this.primitiveType=e(a.primitiveType,i.TRIANGLES),this.boundingSphere=a.boundingSphere,this.geometryType=e(a.geometryType,n.NONE),this.boundingSphereCV=void 0}return a.computeNumberOfVertices=function(e){if(!r(e))throw new t("geometry is required.");var n=-1;for(var i in e.attributes)if(e.attributes.hasOwnProperty(i)&&r(e.attributes[i])&&r(e.attributes[i].values)){var a=e.attributes[i],o=a.values.length/a.componentsPerAttribute;if(n!==o&&-1!==n)throw new t("All attribute lists must have the same number of attributes.");n=o}return n},a}),define("Core/GeometryAttribute",["./defaultValue","./defined","./DeveloperError"],function(e,r,t){"use strict";function n(n){if(n=e(n,e.EMPTY_OBJECT),!r(n.componentDatatype))throw new t("options.componentDatatype is required.");if(!r(n.componentsPerAttribute))throw new t("options.componentsPerAttribute is required.");if(n.componentsPerAttribute<1||n.componentsPerAttribute>4)throw new t("options.componentsPerAttribute must be between 1 and 4.");if(!r(n.values))throw new t("options.values is required.");this.componentDatatype=n.componentDatatype,this.componentsPerAttribute=n.componentsPerAttribute,this.normalize=e(n.normalize,!1),this.values=n.values}return n}),define("Core/GeometryAttributes",["./defaultValue"],function(e){"use strict";function r(r){r=e(r,e.EMPTY_OBJECT),this.position=r.position,this.normal=r.normal,this.st=r.st,this.binormal=r.binormal,this.tangent=r.tangent,this.color=r.color}return r}),define("Core/GeometryInstance",["./defaultValue","./defined","./DeveloperError","./Matrix4"],function(e,r,t,n){"use strict";function i(i){if(i=e(i,e.EMPTY_OBJECT),!r(i.geometry))throw new t("options.geometry is required.");this.geometry=i.geometry,this.modelMatrix=n.clone(e(i.modelMatrix,n.IDENTITY)),this.id=i.id,this.pickPrimitive=i.pickPrimitive,this.attributes=e(i.attributes,{}),this.westHemisphereGeometry=void 0,this.eastHemisphereGeometry=void 0}return i}),define("Core/AttributeCompression",["./Cartesian2","./Cartesian3","./defined","./DeveloperError","./Math"],function(e,r,t,n,i){"use strict";var a={};a.octEncode=function(e,a){if(!t(e))throw new n("vector is required.");if(!t(a))throw new n("result is required.");var o=r.magnitudeSquared(e);if(Math.abs(o-1)>i.EPSILON6)throw new n("vector must be normalized.");if(a.x=e.x/(Math.abs(e.x)+Math.abs(e.y)+Math.abs(e.z)),a.y=e.y/(Math.abs(e.x)+Math.abs(e.y)+Math.abs(e.z)),e.z<0){var u=a.x,s=a.y;a.x=(1-Math.abs(s))*i.signNotZero(u),a.y=(1-Math.abs(u))*i.signNotZero(s)}return a.x=i.toSNorm(a.x),a.y=i.toSNorm(a.y),a},a.octDecode=function(e,a,o){if(!t(o))throw new n("result is required.");if(0>e||e>255||0>a||a>255)throw new n("x and y must be a signed normalized integer between 0 and 255");if(o.x=i.fromSNorm(e),o.y=i.fromSNorm(a),o.z=1-(Math.abs(o.x)+Math.abs(o.y)),o.z<0){var u=o.x;o.x=(1-Math.abs(o.y))*i.signNotZero(u),o.y=(1-Math.abs(u))*i.signNotZero(o.y)}return r.normalize(o,o)},a.octPackFloat=function(e){if(!t(e))throw new n("encoded is required.");return 256*e.x+e.y};var o=new e;return a.octEncodeFloat=function(e){return a.octEncode(e,o),a.octPackFloat(o)},a.octDecodeFloat=function(e,r){if(!t(e))throw new n("value is required.");var i=e/256,o=Math.floor(i),u=256*(i-o);return a.octDecode(o,u,r)},a.octPack=function(e,r,i,u){if(!t(e))throw new n("v1 is required.");if(!t(r))throw new n("v2 is required.");if(!t(i))throw new n("v3 is required.");if(!t(u))throw new n("result is required.");var s=a.octEncodeFloat(e),c=a.octEncodeFloat(r),l=a.octEncode(i,o);return u.x=65536*l.x+s,u.y=65536*l.y+c,u},a.octUnpack=function(e,r,i,o){if(!t(e))throw new n("packed is required.");if(!t(r))throw new n("v1 is required.");if(!t(i))throw new n("v2 is required.");if(!t(o))throw new n("v3 is required.");var u=e.x/65536,s=Math.floor(u),c=65536*(u-s);u=e.y/65536;var l=Math.floor(u),f=65536*(u-l);a.octDecodeFloat(c,r),a.octDecodeFloat(f,i),a.octDecode(s,l,o)},a.compressTextureCoordinates=function(e){if(!t(e))throw new n("textureCoordinates is required.");var r=1===e.x?4095:4096*e.x|0,i=1===e.y?4095:4096*e.y|0;return 4096*r+i},a.decompressTextureCoordinates=function(e,r){if(!t(e))throw new n("compressed is required.");if(!t(r))throw new n("result is required.");var i=e/4096;return r.x=Math.floor(i)/4096,r.y=i-Math.floor(i),r},a}),define("Core/barycentricCoordinates",["./Cartesian2","./Cartesian3","./defined","./DeveloperError"],function(e,r,t,n){"use strict";function i(i,s,c,l,f){if(!(t(i)&&t(s)&&t(c)&&t(l)))throw new n("point, p0, p1, and p2 are required.");t(f)||(f=new r);var h,w,d,m,E,p,y,_;t(s.z)?(h=r.subtract(c,s,a),w=r.subtract(l,s,o),d=r.subtract(i,s,u),m=r.dot(h,h),E=r.dot(h,w),p=r.dot(h,d),y=r.dot(w,w),_=r.dot(w,d)):(h=e.subtract(c,s,a),w=e.subtract(l,s,o),d=e.subtract(i,s,u),m=e.dot(h,h),E=e.dot(h,w),p=e.dot(h,d),y=e.dot(w,w),_=e.dot(w,d));var T=1/(m*y-E*E);return f.y=(y*p-E*_)*T,f.z=(m*_-E*p)*T,f.x=1-f.y-f.z,f}var a=new r,o=new r,u=new r;return i}),define("Core/EncodedCartesian3",["./Cartesian3","./defined","./DeveloperError"],function(e,r,t){"use strict";function n(){this.high=e.clone(e.ZERO),this.low=e.clone(e.ZERO)}n.encode=function(e,n){if(!r(e))throw new t("value is required");r(n)||(n={high:0,low:0});var i;return e>=0?(i=65536*Math.floor(e/65536),n.high=i,n.low=e-i):(i=65536*Math.floor(-e/65536),n.high=-i,n.low=e+i),n};var i={high:0,low:0};n.fromCartesian=function(e,a){if(!r(e))throw new t("cartesian is required");r(a)||(a=new n);var o=a.high,u=a.low;return n.encode(e.x,i),o.x=i.high,u.x=i.low,n.encode(e.y,i),o.y=i.high,u.y=i.low,n.encode(e.z,i),o.z=i.high,u.z=i.low,a};var a=new n;return n.writeElements=function(e,i,o){if(!r(e))throw new t("cartesian is required");if(!r(i))throw new t("cartesianArray is required");if("number"!=typeof o||0>o)throw new t("index must be a number greater than or equal to 0.");n.fromCartesian(e,a);var u=a.high,s=a.low;i[o]=u.x,i[o+1]=u.y,i[o+2]=u.z,i[o+3]=s.x,i[o+4]=s.y,i[o+5]=s.z},n}),define("Core/IndexDatatype",["../Renderer/WebGLConstants","./defined","./DeveloperError","./freezeObject","./Math"],function(e,r,t,n,i){"use strict";var a={UNSIGNED_BYTE:e.UNSIGNED_BYTE,UNSIGNED_SHORT:e.UNSIGNED_SHORT,UNSIGNED_INT:e.UNSIGNED_INT};return a.getSizeInBytes=function(e){switch(e){case a.UNSIGNED_BYTE:return Uint8Array.BYTES_PER_ELEMENT;case a.UNSIGNED_SHORT:return Uint16Array.BYTES_PER_ELEMENT;case a.UNSIGNED_INT:return Uint32Array.BYTES_PER_ELEMENT}throw new t("indexDatatype is required and must be a valid IndexDatatype constant.")},a.validate=function(e){return r(e)&&(e===a.UNSIGNED_BYTE||e===a.UNSIGNED_SHORT||e===a.UNSIGNED_INT)},a.createTypedArray=function(e,n){if(!r(e))throw new t("numberOfVertices is required.");return e>=i.SIXTY_FOUR_KILOBYTES?new Uint32Array(n):new Uint16Array(n)},a.createTypedArrayFromArrayBuffer=function(e,n,a,o){if(!r(e))throw new t("numberOfVertices is required.");if(!r(n))throw new t("sourceArray is required.");if(!r(a))throw new t("byteOffset is required.");return e>=i.SIXTY_FOUR_KILOBYTES?new Uint32Array(n,a,o):new Uint16Array(n,a,o)},n(a)}),define("Core/QuadraticRealPolynomial",["./DeveloperError","./Math"],function(e,r){"use strict";function t(e,t,n){var i=e+t;return r.sign(e)!==r.sign(t)&&Math.abs(i/Math.max(Math.abs(e),Math.abs(t)))<n?0:i}var n={};return n.computeDiscriminant=function(r,t,n){if("number"!=typeof r)throw new e("a is a required number.");if("number"!=typeof t)throw new e("b is a required number.");if("number"!=typeof n)throw new e("c is a required number.");var i=t*t-4*r*n;return i},n.computeRealRoots=function(n,i,a){if("number"!=typeof n)throw new e("a is a required number.");if("number"!=typeof i)throw new e("b is a required number.");if("number"!=typeof a)throw new e("c is a required number.");var o;if(0===n)return 0===i?[]:[-a/i];if(0===i){if(0===a)return[0,0];var u=Math.abs(a),s=Math.abs(n);if(s>u&&u/s<r.EPSILON14)return[0,0];if(u>s&&s/u<r.EPSILON14)return[];if(o=-a/n,0>o)return[];var c=Math.sqrt(o);return[-c,c]}if(0===a)return o=-i/n,0>o?[o,0]:[0,o];var l=i*i,f=4*n*a,h=t(l,-f,r.EPSILON14);if(0>h)return[];var w=-.5*t(i,r.sign(i)*Math.sqrt(h),r.EPSILON14);return i>0?[w/n,a/w]:[a/w,w/n]},n}),define("Core/CubicRealPolynomial",["./DeveloperError","./QuadraticRealPolynomial"],function(e,r){"use strict";function t(e,r,t,n){var i,a,o=e,u=r/3,s=t/3,c=n,l=o*s,f=u*c,h=u*u,w=s*s,d=o*s-h,m=o*c-u*s,E=u*c-w,p=4*d*E-m*m;if(0>p){var y,_,T;h*f>=l*w?(y=o,_=d,T=-2*u*d+o*m):(y=c,_=E,T=-c*m+2*s*E);var R=0>T?-1:1,A=-R*Math.abs(y)*Math.sqrt(-p);a=-T+A;var v=a/2,N=0>v?-Math.pow(-v,1/3):Math.pow(v,1/3),I=a===A?-N:-_/N;return i=0>=_?N+I:-T/(N*N+I*I+_),h*f>=l*w?[(i-u)/o]:[-c/(i+s)]}var S=d,g=-2*u*d+o*m,M=E,O=-c*m+2*s*E,q=Math.sqrt(p),x=Math.sqrt(3)/2,b=Math.abs(Math.atan2(o*q,-g)/3);i=2*Math.sqrt(-S);var P=Math.cos(b);a=i*P;var L=i*(-P/2-x*Math.sin(b)),C=a+L>2*u?a-u:L-u,F=o,U=C/F;b=Math.abs(Math.atan2(c*q,-O)/3),i=2*Math.sqrt(-M),P=Math.cos(b),a=i*P,L=i*(-P/2-x*Math.sin(b));var D=-c,z=2*s>a+L?a+s:L+s,B=D/z,G=F*z,V=-C*z-F*D,X=C*D,W=(s*V-u*X)/(-u*V+s*G);return W>=U?B>=U?B>=W?[U,W,B]:[U,B,W]:[B,U,W]:B>=U?[W,U,B]:B>=W?[W,B,U]:[B,W,U]}var n={};return n.computeDiscriminant=function(r,t,n,i){if("number"!=typeof r)throw new e("a is a required number.");if("number"!=typeof t)throw new e("b is a required number.");if("number"!=typeof n)throw new e("c is a required number.");if("number"!=typeof i)throw new e("d is a required number.");var a=r*r,o=t*t,u=n*n,s=i*i,c=18*r*t*n*i+o*u-27*a*s-4*(r*u*n+o*t*i);return c},n.computeRealRoots=function(n,i,a,o){if("number"!=typeof n)throw new e("a is a required number.");if("number"!=typeof i)throw new e("b is a required number.");if("number"!=typeof a)throw new e("c is a required number.");if("number"!=typeof o)throw new e("d is a required number.");var u,s;if(0===n)return r.computeRealRoots(i,a,o);if(0===i){if(0===a){if(0===o)return[0,0,0];s=-o/n;var c=0>s?-Math.pow(-s,1/3):Math.pow(s,1/3);return[c,c,c]}return 0===o?(u=r.computeRealRoots(n,0,a),0===u.Length?[0]:[u[0],0,u[1]]):t(n,0,a,o)}return 0===a?0===o?(s=-i/n,0>s?[s,0,0]:[0,0,s]):t(n,i,0,o):0===o?(u=r.computeRealRoots(n,i,a),0===u.length?[0]:u[1]<=0?[u[0],u[1],0]:u[0]>=0?[0,u[0],u[1]]:[u[0],0,u[1]]):t(n,i,a,o)},n}),define("Core/QuarticRealPolynomial",["./CubicRealPolynomial","./DeveloperError","./Math","./QuadraticRealPolynomial"],function(e,r,t,n){"use strict";function i(r,i,a,o){var u=r*r,s=i-3*u/8,c=a-i*r/2+u*r/8,l=o-a*r/4+i*u/16-3*u*u/256,f=e.computeRealRoots(1,2*s,s*s-4*l,-c*c);if(f.length>0){var h=-r/4,w=f[f.length-1];if(Math.abs(w)<t.EPSILON14){var d=n.computeRealRoots(1,s,l);if(2===d.length){var m,E=d[0],p=d[1];if(E>=0&&p>=0){var y=Math.sqrt(E),_=Math.sqrt(p);return[h-_,h-y,h+y,h+_]}if(E>=0&&0>p)return m=Math.sqrt(E),[h-m,h+m];if(0>E&&p>=0)return m=Math.sqrt(p),[h-m,h+m]}return[]}if(w>0){var T=Math.sqrt(w),R=(s+w-c/T)/2,A=(s+w+c/T)/2,v=n.computeRealRoots(1,T,R),N=n.computeRealRoots(1,-T,A);return 0!==v.length?(v[0]+=h,v[1]+=h,0!==N.length?(N[0]+=h,N[1]+=h,v[1]<=N[0]?[v[0],v[1],N[0],N[1]]:N[1]<=v[0]?[N[0],N[1],v[0],v[1]]:v[0]>=N[0]&&v[1]<=N[1]?[N[0],v[0],v[1],N[1]]:N[0]>=v[0]&&N[1]<=v[1]?[v[0],N[0],N[1],v[1]]:v[0]>N[0]&&v[0]<N[1]?[N[0],v[0],N[1],v[1]]:[v[0],N[0],v[1],N[1]]):v):0!==N.length?(N[0]+=h,N[1]+=h,N):[]}}return[]}function a(r,i,a,o){var u=a*a,s=i*i,c=r*r,l=-2*i,f=a*r+s-4*o,h=c*o-a*i*r+u,w=e.computeRealRoots(1,l,f,h);if(w.length>0){var d,m,E=w[0],p=i-E,y=p*p,_=r/2,T=p/2,R=y-4*o,A=y+4*Math.abs(o),v=c-4*E,N=c+4*Math.abs(E);if(0>E||v*A>R*N){var I=Math.sqrt(v);d=I/2,m=0===I?0:(r*T-a)/I}else{var S=Math.sqrt(R);d=0===S?0:(r*T-a)/S,m=S/2}var g,M;0===_&&0===d?(g=0,M=0):t.sign(_)===t.sign(d)?(g=_+d,M=E/g):(M=_-d,g=E/M);var O,q;0===T&&0===m?(O=0,q=0):t.sign(T)===t.sign(m)?(O=T+m,q=o/O):(q=T-m,O=o/q);var x=n.computeRealRoots(1,g,O),b=n.computeRealRoots(1,M,q);if(0!==x.length)return 0!==b.length?x[1]<=b[0]?[x[0],x[1],b[0],b[1]]:b[1]<=x[0]?[b[0],b[1],x[0],x[1]]:x[0]>=b[0]&&x[1]<=b[1]?[b[0],x[0],x[1],b[1]]:b[0]>=x[0]&&b[1]<=x[1]?[x[0],b[0],b[1],x[1]]:x[0]>b[0]&&x[0]<b[1]?[b[0],x[0],b[1],x[1]]:[x[0],b[0],x[1],b[1]]:x;if(0!==b.length)return b}return[]}var o={};return o.computeDiscriminant=function(e,t,n,i,a){if("number"!=typeof e)throw new r("a is a required number.");if("number"!=typeof t)throw new r("b is a required number.");if("number"!=typeof n)throw new r("c is a required number.");if("number"!=typeof i)throw new r("d is a required number.");if("number"!=typeof a)throw new r("e is a required number.");var o=e*e,u=o*e,s=t*t,c=s*t,l=n*n,f=l*n,h=i*i,w=h*i,d=a*a,m=d*a,E=s*l*h-4*c*w-4*e*f*h+18*e*t*n*w-27*o*h*h+256*u*m+a*(18*c*n*i-4*s*f+16*e*l*l-80*e*t*l*i-6*e*s*h+144*o*n*h)+d*(144*e*s*n-27*s*s-128*o*l-192*o*t*i);return E},o.computeRealRoots=function(n,o,u,s,c){if("number"!=typeof n)throw new r("a is a required number.");if("number"!=typeof o)throw new r("b is a required number.");if("number"!=typeof u)throw new r("c is a required number.");if("number"!=typeof s)throw new r("d is a required number.");if("number"!=typeof c)throw new r("e is a required number.");if(Math.abs(n)<t.EPSILON15)return e.computeRealRoots(o,u,s,c);var l=o/n,f=u/n,h=s/n,w=c/n,d=0>l?1:0;switch(d+=0>f?d+1:d,d+=0>h?d+1:d,d+=0>w?d+1:d){case 0:return i(l,f,h,w);case 1:return a(l,f,h,w);case 2:return a(l,f,h,w);case 3:return i(l,f,h,w);case 4:return i(l,f,h,w);case 5:return a(l,f,h,w);case 6:return i(l,f,h,w);case 7:return i(l,f,h,w);case 8:return a(l,f,h,w);case 9:return i(l,f,h,w);case 10:return i(l,f,h,w);case 11:return a(l,f,h,w);case 12:return i(l,f,h,w);case 13:return i(l,f,h,w);case 14:return i(l,f,h,w);case 15:return i(l,f,h,w);default:return}},o}),define("Core/Ray",["./Cartesian3","./defaultValue","./defined","./DeveloperError"],function(e,r,t,n){"use strict";function i(t,n){n=e.clone(r(n,e.ZERO)),e.equals(n,e.ZERO)||e.normalize(n,n),this.origin=e.clone(r(t,e.ZERO)),this.direction=n}return i.getPoint=function(r,i,a){if(!t(r))throw new n("ray is requred");if("number"!=typeof i)throw new n("t is a required number");return t(a)||(a=new e),a=e.multiplyByScalar(r.direction,i,a),e.add(r.origin,a,a)},i}),define("Core/IntersectionTests",["./Cartesian3","./Cartographic","./defaultValue","./defined","./DeveloperError","./Math","./Matrix3","./QuadraticRealPolynomial","./QuarticRealPolynomial","./Ray"],function(e,r,t,n,i,a,o,u,s,c){"use strict";function l(r,o,u,s,c){if(!n(r))throw new i("ray is required.");if(!n(o))throw new i("p0 is required.");if(!n(u))throw new i("p1 is required.");if(!n(s))throw new i("p2 is required.");c=t(c,!1);var l,f,h,w,d,m=r.origin,R=r.direction,A=e.subtract(u,o,E),v=e.subtract(s,o,p),N=e.cross(R,v,y),I=e.dot(A,N);if(c){if(I<a.EPSILON6)return;if(l=e.subtract(m,o,_),h=e.dot(l,N),0>h||h>I)return;if(f=e.cross(l,A,T),w=e.dot(R,f),0>w||h+w>I)return;d=e.dot(v,f)/I}else{if(Math.abs(I)<a.EPSILON6)return;var S=1/I;if(l=e.subtract(m,o,_),h=e.dot(l,N)*S,0>h||h>1)return;if(f=e.cross(l,A,T),w=e.dot(R,f)*S,0>w||h+w>1)return;d=e.dot(v,f)*S}return d}function f(e,r,t,n){var i=r*r-4*e*t;if(!(0>i)){if(i>0){var a=1/(2*e),o=Math.sqrt(i),u=(-r+o)*a,s=(-r-o)*a;return s>u?(n.root0=u,n.root1=s):(n.root0=s,n.root1=u),n}var c=-r/(2*e);if(0!==c)return n.root0=n.root1=c,n}}function h(r,t,i){n(i)||(i={});var a=r.origin,o=r.direction,u=t.center,s=t.radius*t.radius,c=e.subtract(a,u,y),l=e.dot(o,o),h=2*e.dot(o,c),w=e.magnitudeSquared(c)-s,d=f(l,h,w,A);return n(d)?(i.start=d.root0,i.stop=d.root1,i):void 0}function w(e,r,t){var n=e+r;return a.sign(e)!==a.sign(r)&&Math.abs(n/Math.max(Math.abs(e),Math.abs(r)))<t?0:n}function d(r,t,n,i,c){var l,f=i*i,h=c*c,d=(r[o.COLUMN1ROW1]-r[o.COLUMN2ROW2])*h,m=c*(i*w(r[o.COLUMN1ROW0],r[o.COLUMN0ROW1],a.EPSILON15)+t.y),E=r[o.COLUMN0ROW0]*f+r[o.COLUMN2ROW2]*h+i*t.x+n,p=h*w(r[o.COLUMN2ROW1],r[o.COLUMN1ROW2],a.EPSILON15),y=c*(i*w(r[o.COLUMN2ROW0],r[o.COLUMN0ROW2])+t.z),_=[];if(0===y&&0===p){if(l=u.computeRealRoots(d,m,E),0===l.length)return _;var T=l[0],R=Math.sqrt(Math.max(1-T*T,0));if(_.push(new e(i,c*T,c*-R)),_.push(new e(i,c*T,c*R)),
  2===l.length){var A=l[1],v=Math.sqrt(Math.max(1-A*A,0));_.push(new e(i,c*A,c*-v)),_.push(new e(i,c*A,c*v))}return _}var N=y*y,I=p*p,S=d*d,g=y*p,M=S+I,O=2*(m*d+g),q=2*E*d+m*m-I+N,x=2*(E*m-g),b=E*E-N;if(0===M&&0===O&&0===q&&0===x)return _;l=s.computeRealRoots(M,O,q,x,b);var P=l.length;if(0===P)return _;for(var L=0;P>L;++L){var C,F=l[L],U=F*F,D=Math.max(1-U,0),z=Math.sqrt(D);C=a.sign(d)===a.sign(E)?w(d*U+E,m*F,a.EPSILON12):a.sign(E)===a.sign(m*F)?w(d*U,m*F+E,a.EPSILON12):w(d*U+m*F,E,a.EPSILON12);var B=w(p*F,y,a.EPSILON15),G=C*B;0>G?_.push(new e(i,c*F,c*z)):G>0?_.push(new e(i,c*F,c*-z)):0!==z?(_.push(new e(i,c*F,c*-z)),_.push(new e(i,c*F,c*z)),++L):_.push(new e(i,c*F,c*z))}return _}var m={};m.rayPlane=function(r,t,o){if(!n(r))throw new i("ray is required.");if(!n(t))throw new i("plane is required.");n(o)||(o=new e);var u=r.origin,s=r.direction,c=t.normal,l=e.dot(c,s);if(!(Math.abs(l)<a.EPSILON15)){var f=(-t.distance-e.dot(c,u))/l;if(!(0>f))return o=e.multiplyByScalar(s,f,o),e.add(u,o,o)}};var E=new e,p=new e,y=new e,_=new e,T=new e;m.rayTriangle=function(r,t,i,a,o,u){var s=l(r,t,i,a,o);if(n(s)&&!(0>s))return n(u)||(u=new e),e.multiplyByScalar(r.direction,s,u),e.add(r.origin,u,u)};var R=new c;m.lineSegmentTriangle=function(r,t,a,o,u,s,c){if(!n(r))throw new i("v0 is required.");if(!n(t))throw new i("v1 is required.");var f=R;e.clone(r,f.origin),e.subtract(t,r,f.direction),e.normalize(f.direction,f.direction);var h=l(f,a,o,u,s);return!n(h)||0>h||h>e.distance(r,t)?void 0:(n(c)||(c=new e),e.multiplyByScalar(f.direction,h,c),e.add(f.origin,c,c))};var A={root0:0,root1:0};m.raySphere=function(e,r,t){if(!n(e))throw new i("ray is required.");if(!n(r))throw new i("sphere is required.");return t=h(e,r,t),!n(t)||t.stop<0?void 0:(t.start=Math.max(t.start,0),t)};var v=new c;m.lineSegmentSphere=function(r,t,a,o){if(!n(r))throw new i("p0 is required.");if(!n(t))throw new i("p1 is required.");if(!n(a))throw new i("sphere is required.");var u=v;e.clone(r,u.origin);var s=e.subtract(t,r,u.direction),c=e.magnitude(s);return e.normalize(s,s),o=h(u,a,o),!n(o)||o.stop<0||o.start>c?void 0:(o.start=Math.max(o.start,0),o.stop=Math.min(o.stop,c),o)};var N=new e,I=new e;m.rayEllipsoid=function(r,t){if(!n(r))throw new i("ray is required.");if(!n(t))throw new i("ellipsoid is required.");var a,o,u,s,c,l=t.oneOverRadii,f=e.multiplyComponents(l,r.origin,N),h=e.multiplyComponents(l,r.direction,I),w=e.magnitudeSquared(f),d=e.dot(f,h);if(w>1){if(d>=0)return;var m=d*d;if(a=w-1,o=e.magnitudeSquared(h),u=o*a,u>m)return;if(m>u){s=d*d-u,c=-d+Math.sqrt(s);var E=c/o,p=a/c;return p>E?{start:E,stop:p}:{start:p,stop:E}}var y=Math.sqrt(a/o);return{start:y,stop:y}}return 1>w?(a=w-1,o=e.magnitudeSquared(h),u=o*a,s=d*d-u,c=-d+Math.sqrt(s),{start:0,stop:c/o}):0>d?(o=e.magnitudeSquared(h),{start:0,stop:-d/o}):void 0};var S=new e,g=new e,M=new e,O=new e,q=new e,x=new o,b=new o,P=new o,L=new o,C=new o,F=new o,U=new o,D=new e,z=new e,B=new r;m.grazingAltitudeLocation=function(r,t){if(!n(r))throw new i("ray is required.");if(!n(t))throw new i("ellipsoid is required.");var u=r.origin,s=r.direction,c=t.geodeticSurfaceNormal(u,S);if(e.dot(s,c)>=0)return u;var l=n(this.rayEllipsoid(r,t)),f=t.transformPositionToScaledSpace(s,S),h=e.normalize(f,f),w=e.mostOrthogonalAxis(f,O),m=e.normalize(e.cross(w,h,g),g),E=e.normalize(e.cross(h,m,M),M),p=x;p[0]=h.x,p[1]=h.y,p[2]=h.z,p[3]=m.x,p[4]=m.y,p[5]=m.z,p[6]=E.x,p[7]=E.y,p[8]=E.z;var y=o.transpose(p,b),_=o.fromScale(t.radii,P),T=o.fromScale(t.oneOverRadii,L),R=C;R[0]=0,R[1]=-s.z,R[2]=s.y,R[3]=s.z,R[4]=0,R[5]=-s.x,R[6]=-s.y,R[7]=s.x,R[8]=0;var A,v,N=o.multiply(o.multiply(y,T,F),R,F),I=o.multiply(o.multiply(N,_,U),p,U),G=o.multiplyByVector(N,u,q),V=d(I,e.negate(G,S),0,0,1),X=V.length;if(X>0){for(var W=e.clone(e.ZERO,z),H=Number.NEGATIVE_INFINITY,Y=0;X>Y;++Y){A=o.multiplyByVector(_,o.multiplyByVector(p,V[Y],D),D);var k=e.normalize(e.subtract(A,u,O),O),K=e.dot(k,s);K>H&&(H=K,W=e.clone(A,W))}var Z=t.cartesianToCartographic(W,B);return H=a.clamp(H,0,1),v=e.magnitude(e.subtract(W,u,O))*Math.sqrt(1-H*H),v=l?-v:v,Z.height=v,t.cartographicToCartesian(Z,new e)}};var G=new e;return m.lineSegmentPlane=function(r,t,o,u){if(!n(r))throw new i("endPoint0 is required.");if(!n(t))throw new i("endPoint1 is required.");if(!n(o))throw new i("plane is required.");n(u)||(u=new e);var s=e.subtract(t,r,G),c=o.normal,l=e.dot(c,s);if(!(Math.abs(l)<a.EPSILON6)){var f=e.dot(c,r),h=-(o.distance+f)/l;if(!(0>h||h>1))return e.multiplyByScalar(s,h,u),e.add(r,u,u),u}},m.trianglePlaneIntersection=function(r,t,a,o){if(!(n(r)&&n(t)&&n(a)&&n(o)))throw new i("p0, p1, p2, and plane are required.");var u=o.normal,s=o.distance,c=e.dot(u,r)+s<0,l=e.dot(u,t)+s<0,f=e.dot(u,a)+s<0,h=0;h+=c?1:0,h+=l?1:0,h+=f?1:0;var w,d;if((1===h||2===h)&&(w=new e,d=new e),1===h){if(c)return m.lineSegmentPlane(r,t,o,w),m.lineSegmentPlane(r,a,o,d),{positions:[r,t,a,w,d],indices:[0,3,4,1,2,4,1,4,3]};if(l)return m.lineSegmentPlane(t,a,o,w),m.lineSegmentPlane(t,r,o,d),{positions:[r,t,a,w,d],indices:[1,3,4,2,0,4,2,4,3]};if(f)return m.lineSegmentPlane(a,r,o,w),m.lineSegmentPlane(a,t,o,d),{positions:[r,t,a,w,d],indices:[2,3,4,0,1,4,0,4,3]}}else if(2===h){if(!c)return m.lineSegmentPlane(t,r,o,w),m.lineSegmentPlane(a,r,o,d),{positions:[r,t,a,w,d],indices:[1,2,4,1,4,3,0,3,4]};if(!l)return m.lineSegmentPlane(a,t,o,w),m.lineSegmentPlane(r,t,o,d),{positions:[r,t,a,w,d],indices:[2,0,4,2,4,3,1,3,4]};if(!f)return m.lineSegmentPlane(r,a,o,w),m.lineSegmentPlane(t,a,o,d),{positions:[r,t,a,w,d],indices:[0,1,4,0,4,3,2,3,4]}}},m}),define("Core/Tipsify",["./defaultValue","./defined","./DeveloperError"],function(e,r,t){"use strict";var n={};return n.calculateACMR=function(n){n=e(n,e.EMPTY_OBJECT);var i=n.indices,a=n.maximumIndex,o=e(n.cacheSize,24);if(!r(i))throw new t("indices is required.");var u=i.length;if(3>u||u%3!==0)throw new t("indices length must be a multiple of three.");if(0>=a)throw new t("maximumIndex must be greater than zero.");if(3>o)throw new t("cacheSize must be greater than two.");if(!r(a)){a=0;for(var s=0,c=i[s];u>s;)c>a&&(a=c),++s,c=i[s]}for(var l=[],f=0;a+1>f;f++)l[f]=0;for(var h=o+1,w=0;u>w;++w)h-l[i[w]]>o&&(l[i[w]]=h,++h);return(h-o+1)/(u/3)},n.tipsify=function(n){function i(e,r,t,n){for(;r.length>=1;){var i=r[r.length-1];if(r.splice(r.length-1,1),e[i].numLiveTriangles>0)return i}for(;n>o;){if(e[o].numLiveTriangles>0)return++o,o-1;++o}return-1}function a(e,r,t,n,a,o,u){for(var s,c=-1,l=-1,f=0;f<t.length;){var h=t[f];n[h].numLiveTriangles&&(s=0,a-n[h].timeStamp+2*n[h].numLiveTriangles<=r&&(s=a-n[h].timeStamp),(s>l||-1===l)&&(l=s,c=h)),++f}return-1===c?i(n,o,e,u):c}n=e(n,e.EMPTY_OBJECT);var o,u=n.indices,s=n.maximumIndex,c=e(n.cacheSize,24);if(!r(u))throw new t("indices is required.");var l=u.length;if(3>l||l%3!==0)throw new t("indices length must be a multiple of three.");if(0>=s)throw new t("maximumIndex must be greater than zero.");if(3>c)throw new t("cacheSize must be greater than two.");var f=0,h=0,w=u[h],d=l;if(r(s))f=s+1;else{for(;d>h;)w>f&&(f=w),++h,w=u[h];if(-1===f)return 0;++f}for(var m=[],E=0;f>E;E++)m[E]={numLiveTriangles:0,timeStamp:0,vertexTriangles:[]};h=0;for(var p=0;d>h;)m[u[h]].vertexTriangles.push(p),++m[u[h]].numLiveTriangles,m[u[h+1]].vertexTriangles.push(p),++m[u[h+1]].numLiveTriangles,m[u[h+2]].vertexTriangles.push(p),++m[u[h+2]].numLiveTriangles,++p,h+=3;var y=0,_=c+1;o=1;var T,R,A=[],v=[],N=0,I=[],S=l/3,g=[];for(E=0;S>E;E++)g[E]=!1;for(var M,O;-1!==y;){A=[],R=m[y],O=R.vertexTriangles.length;for(var q=0;O>q;++q)if(p=R.vertexTriangles[q],!g[p]){g[p]=!0,h=p+p+p;for(var x=0;3>x;++x)M=u[h],A.push(M),v.push(M),I[N]=M,++N,T=m[M],--T.numLiveTriangles,_-T.timeStamp>c&&(T.timeStamp=_,++_),++h}y=a(u,c,A,m,_,v,f)}return I},n}),define("Core/GeometryPipeline",["./AttributeCompression","./barycentricCoordinates","./BoundingSphere","./Cartesian2","./Cartesian3","./Cartesian4","./Cartographic","./ComponentDatatype","./defaultValue","./defined","./DeveloperError","./EncodedCartesian3","./GeographicProjection","./Geometry","./GeometryAttribute","./GeometryInstance","./GeometryType","./IndexDatatype","./Intersect","./IntersectionTests","./Math","./Matrix3","./Matrix4","./Plane","./PrimitiveType","./Tipsify"],function(e,r,t,n,i,a,o,u,s,c,l,f,h,w,d,m,E,p,y,_,T,R,A,v,N,I){"use strict";function S(e,r,t,n,i){e[r++]=t,e[r++]=n,e[r++]=n,e[r++]=i,e[r++]=i,e[r]=t}function g(e){for(var r=e.length,t=r/3*6,n=p.createTypedArray(r,t),i=0,a=0;r>a;a+=3,i+=6)S(n,i,e[a],e[a+1],e[a+2]);return n}function M(e){var r=e.length;if(r>=3){var t=6*(r-2),n=p.createTypedArray(r,t);S(n,0,e[0],e[1],e[2]);for(var i=6,a=3;r>a;++a,i+=6)S(n,i,e[a-1],e[a],e[a-2]);return n}return new Uint16Array}function O(e){if(e.length>0){for(var r=e.length-1,t=6*(r-1),n=p.createTypedArray(r,t),i=e[0],a=0,o=1;r>o;++o,a+=6)S(n,a,i,e[o],e[o+1]);return n}return new Uint16Array}function q(e){var r={};for(var t in e)if(e.hasOwnProperty(t)&&c(e[t])&&c(e[t].values)){var n=e[t];r[t]=new d({componentDatatype:n.componentDatatype,componentsPerAttribute:n.componentsPerAttribute,normalize:n.normalize,values:[]})}return r}function x(e,r,t){for(var n in r)if(r.hasOwnProperty(n)&&c(r[n])&&c(r[n].values))for(var i=r[n],a=0;a<i.componentsPerAttribute;++a)e[n].values.push(i.values[t*i.componentsPerAttribute+a])}function b(e,r){if(c(r))for(var t=r.values,n=t.length,a=0;n>a;a+=3)i.unpack(t,a,ae),A.multiplyByPoint(e,ae,ae),i.pack(ae,t,a)}function P(e,r){if(c(r))for(var t=r.values,n=t.length,a=0;n>a;a+=3)i.unpack(t,a,ae),R.multiplyByVector(e,ae,ae),ae=i.normalize(ae,ae),i.pack(ae,t,a)}function L(e,r){var t,n=e.length,i={},a=e[0][r].attributes;for(t in a)if(a.hasOwnProperty(t)&&c(a[t])&&c(a[t].values)){for(var o=a[t],s=o.values.length,l=!0,f=1;n>f;++f){var h=e[f][r].attributes[t];if(!c(h)||o.componentDatatype!==h.componentDatatype||o.componentsPerAttribute!==h.componentsPerAttribute||o.normalize!==h.normalize){l=!1;break}s+=h.values.length}l&&(i[t]=new d({componentDatatype:o.componentDatatype,componentsPerAttribute:o.componentsPerAttribute,normalize:o.normalize,values:u.createTypedArray(o.componentDatatype,s)}))}return i}function C(e,r){var n,a,o,u,s=e.length,f=e[0].modelMatrix,h=c(e[0][r].indices),d=e[0][r].primitiveType;for(a=1;s>a;++a){if(!A.equals(e[a].modelMatrix,f))throw new l("All instances must have the same modelMatrix.");if(c(e[a][r].indices)!==h)throw new l("All instance geometries must have an indices or not have one.");if(e[a][r].primitiveType!==d)throw new l("All instance geometries must have the same primitiveType.")}var m,E,y,_=L(e,r);for(n in _)if(_.hasOwnProperty(n))for(m=_[n].values,u=0,a=0;s>a;++a)for(E=e[a][r].attributes[n].values,y=E.length,o=0;y>o;++o)m[u++]=E[o];var T;if(h){var R=0;for(a=0;s>a;++a)R+=e[a][r].indices.length;var v=w.computeNumberOfVertices(new w({attributes:_,primitiveType:N.POINTS})),I=p.createTypedArray(v,R),S=0,g=0;for(a=0;s>a;++a){var M=e[a][r].indices,O=M.length;for(u=0;O>u;++u)I[S++]=g+M[u];g+=w.computeNumberOfVertices(e[a][r])}T=I}var q,x=new i,b=0;for(a=0;s>a;++a){if(q=e[a][r].boundingSphere,!c(q)){x=void 0;break}i.add(q.center,x,x)}if(c(x))for(i.divideByScalar(x,s,x),a=0;s>a;++a){q=e[a][r].boundingSphere;var P=i.magnitude(i.subtract(q.center,x,se))+q.radius;P>b&&(b=P)}return new w({attributes:_,indices:T,primitiveType:d,boundingSphere:c(x)?new t(x,b):void 0})}function F(e){if(c(e.indices))return e;var r=w.computeNumberOfVertices(e);if(3>r)throw new l("The number of vertices must be at least three.");if(r%3!==0)throw new l("The number of vertices must be a multiple of three.");for(var t=p.createTypedArray(r,r),n=0;r>n;++n)t[n]=n;return e.indices=t,e}function U(e){var r=w.computeNumberOfVertices(e);if(3>r)throw new l("The number of vertices must be at least three.");var t=p.createTypedArray(r,3*(r-2));t[0]=1,t[1]=0,t[2]=2;for(var n=3,i=3;r>i;++i)t[n++]=i-1,t[n++]=0,t[n++]=i;return e.indices=t,e.primitiveType=N.TRIANGLES,e}function D(e){var r=w.computeNumberOfVertices(e);if(3>r)throw new l("The number of vertices must be at least 3.");var t=p.createTypedArray(r,3*(r-2));t[0]=0,t[1]=1,t[2]=2,r>3&&(t[3]=0,t[4]=2,t[5]=3);for(var n=6,i=3;r-1>i;i+=2)t[n++]=i,t[n++]=i-1,t[n++]=i+1,r>i+2&&(t[n++]=i,t[n++]=i+1,t[n++]=i+2);return e.indices=t,e.primitiveType=N.TRIANGLES,e}function z(e){if(c(e.indices))return e;var r=w.computeNumberOfVertices(e);if(2>r)throw new l("The number of vertices must be at least two.");if(r%2!==0)throw new l("The number of vertices must be a multiple of 2.");for(var t=p.createTypedArray(r,r),n=0;r>n;++n)t[n]=n;return e.indices=t,e}function B(e){var r=w.computeNumberOfVertices(e);if(2>r)throw new l("The number of vertices must be at least two.");var t=p.createTypedArray(r,2*(r-1));t[0]=0,t[1]=1;for(var n=2,i=2;r>i;++i)t[n++]=i-1,t[n++]=i;return e.indices=t,e.primitiveType=N.LINES,e}function G(e){var r=w.computeNumberOfVertices(e);if(2>r)throw new l("The number of vertices must be at least two.");var t=p.createTypedArray(r,2*r);t[0]=0,t[1]=1;for(var n=2,i=2;r>i;++i)t[n++]=i-1,t[n++]=i;return t[n++]=r-1,t[n]=0,e.indices=t,e.primitiveType=N.LINES,e}function V(e){switch(e.primitiveType){case N.TRIANGLE_FAN:return U(e);case N.TRIANGLE_STRIP:return D(e);case N.TRIANGLES:return F(e);case N.LINE_STRIP:return B(e);case N.LINE_LOOP:return G(e);case N.LINES:return z(e)}return e}function X(e,r){Math.abs(e.y)<T.EPSILON6&&(r?e.y=-T.EPSILON6:e.y=T.EPSILON6)}function W(e,r,t){if(0!==e.y&&0!==r.y&&0!==t.y)return X(e,e.y<0),X(r,r.y<0),void X(t,t.y<0);var n,i=Math.abs(e.y),a=Math.abs(r.y),o=Math.abs(t.y);n=i>a?i>o?T.sign(e.y):T.sign(t.y):a>o?T.sign(r.y):T.sign(t.y);var u=0>n;X(e,u),X(r,u),X(t,u)}function H(e,r,t,n){i.add(e,i.multiplyByScalar(i.subtract(r,e,Te),e.y/(e.y-r.y),Te),t),i.clone(t,n),X(t,!0),X(n,!1)}function Y(e,r,t){if(!(e.x>=0||r.x>=0||t.x>=0)){W(e,r,t);var n=e.y<0,i=r.y<0,a=t.y<0,o=0;o+=n?1:0,o+=i?1:0,o+=a?1:0;var u=Ie.indices;1===o?(u[1]=3,u[2]=4,u[5]=6,u[7]=6,u[8]=5,n?(H(e,r,Re,ve),H(e,t,Ae,Ne),u[0]=0,u[3]=1,u[4]=2,u[6]=1):i?(H(r,t,Re,ve),H(r,e,Ae,Ne),u[0]=1,u[3]=2,u[4]=0,u[6]=2):a&&(H(t,e,Re,ve),H(t,r,Ae,Ne),u[0]=2,u[3]=0,u[4]=1,u[6]=0)):2===o&&(u[2]=4,u[4]=4,u[5]=3,u[7]=5,u[8]=6,n?i?a||(H(t,e,Re,ve),H(t,r,Ae,Ne),u[0]=0,u[1]=1,u[3]=0,u[6]=2):(H(r,t,Re,ve),H(r,e,Ae,Ne),u[0]=2,u[1]=0,u[3]=2,u[6]=1):(H(e,r,Re,ve),H(e,t,Ae,Ne),u[0]=1,u[1]=2,u[3]=1,u[6]=0));var s=Ie.positions;return s[0]=e,s[1]=r,s[2]=t,s.length=3,(1===o||2===o)&&(s[3]=Re,s[4]=Ae,s[5]=ve,s[6]=Ne,s.length=7),Ie}}function k(e,r){var n=e.attributes;if(0!==n.position.values.length){for(var i in n)if(n.hasOwnProperty(i)&&c(n[i])&&c(n[i].values)){var a=n[i];a.values=u.createTypedArray(a.componentDatatype,a.values)}var o=w.computeNumberOfVertices(e);return e.indices=p.createTypedArray(o,e.indices),r&&(e.boundingSphere=t.fromVertices(n.position.values)),e}}function K(e){var r=e.attributes,t={};for(var n in r)if(r.hasOwnProperty(n)&&c(r[n])&&c(r[n].values)){var i=r[n];t[n]=new d({componentDatatype:i.componentDatatype,componentsPerAttribute:i.componentsPerAttribute,normalize:i.normalize,values:[]})}return new w({attributes:t,indices:[],primitiveType:e.primitiveType})}function Z(e,r,t){var n=c(e.geometry.boundingSphere);r=k(r,n),t=k(t,n),c(t)&&!c(r)?e.geometry=t:!c(t)&&c(r)?e.geometry=r:(e.westHemisphereGeometry=r,e.eastHemisphereGeometry=t,e.geometry=void 0)}function j(e,t,a,o,u,s,l,f,h,w,d){if(c(s)||c(l)||c(f)||c(h)){var m=i.fromArray(u,3*e,Se),E=i.fromArray(u,3*t,ge),p=i.fromArray(u,3*a,Me),y=r(o,m,E,p,Oe);if(c(s)){var _=i.fromArray(s,3*e,Se),T=i.fromArray(s,3*t,ge),R=i.fromArray(s,3*a,Me);i.multiplyByScalar(_,y.x,_),i.multiplyByScalar(T,y.y,T),i.multiplyByScalar(R,y.z,R);var A=i.add(_,T,_);i.add(A,R,A),i.normalize(A,A),i.pack(A,w.normal.values,3*d)}if(c(l)){var v=i.fromArray(l,3*e,Se),N=i.fromArray(l,3*t,ge),I=i.fromArray(l,3*a,Me);i.multiplyByScalar(v,y.x,v),i.multiplyByScalar(N,y.y,N),i.multiplyByScalar(I,y.z,I);var S=i.add(v,N,v);i.add(S,I,S),i.normalize(S,S),i.pack(S,w.binormal.values,3*d)}if(c(f)){var g=i.fromArray(f,3*e,Se),M=i.fromArray(f,3*t,ge),O=i.fromArray(f,3*a,Me);i.multiplyByScalar(g,y.x,g),i.multiplyByScalar(M,y.y,M),i.multiplyByScalar(O,y.z,O);var q=i.add(g,M,g);i.add(q,O,q),i.normalize(q,q),i.pack(q,w.tangent.values,3*d)}if(c(h)){var x=n.fromArray(h,2*e,qe),b=n.fromArray(h,2*t,xe),P=n.fromArray(h,2*a,be);n.multiplyByScalar(x,y.x,x),n.multiplyByScalar(b,y.y,b),n.multiplyByScalar(P,y.z,P);var L=n.add(x,b,x);n.add(L,P,L),n.pack(L,w.st.values,2*d)}}}function Q(e,r,t,n,i,a){var o=e.position.values.length/3;if(-1!==i){var u=n[i],s=t[u];return-1===s?(t[u]=o,e.position.values.push(a.x,a.y,a.z),r.push(o),o):(r.push(s),s)}return e.position.values.push(a.x,a.y,a.z),r.push(o),o}function J(e){var r,t,n,a,o,u=e.geometry,s=u.attributes,l=s.position.values,f=c(s.normal)?s.normal.values:void 0,h=c(s.binormal)?s.binormal.values:void 0,w=c(s.tangent)?s.tangent.values:void 0,d=c(s.st)?s.st.values:void 0,m=u.indices,E=K(u),p=K(u),y=[];y.length=l.length/3;var _=[];for(_.length=l.length/3,o=0;o<y.length;++o)y[o]=-1,_[o]=-1;var T=m.length;for(o=0;T>o;o+=3){var R=m[o],A=m[o+1],v=m[o+2],N=i.fromArray(l,3*R),I=i.fromArray(l,3*A),S=i.fromArray(l,3*v),g=Y(N,I,S);if(c(g)&&g.positions.length>3)for(var M=g.positions,O=g.indices,q=O.length,x=0;q>x;++x){var b=O[x],P=M[b];P.y<0?(r=p.attributes,t=p.indices,n=y):(r=E.attributes,t=E.indices,n=_),a=Q(r,t,n,m,3>b?o+b:-1,P),j(R,A,v,P,l,f,h,w,d,r,a)}else c(g)&&(N=g.positions[0],I=g.positions[1],S=g.positions[2]),N.y<0?(r=p.attributes,t=p.indices,n=y):(r=E.attributes,t=E.indices,n=_),a=Q(r,t,n,m,o,N),j(R,A,v,N,l,f,h,w,d,r,a),a=Q(r,t,n,m,o+1,I),j(R,A,v,I,l,f,h,w,d,r,a),a=Q(r,t,n,m,o+2,S),j(R,A,v,S,l,f,h,w,d,r,a)}Z(e,p,E)}function $(e){var r,t=e.geometry,n=t.attributes,a=n.position.values,o=t.indices,u=K(t),s=K(t),l=o.length,f=[];f.length=a.length/3;var h=[];for(h.length=a.length/3,r=0;r<f.length;++r)f[r]=-1,h[r]=-1;for(r=0;l>r;r+=2){var w=o[r],d=o[r+1],m=i.fromArray(a,3*w,Se),E=i.fromArray(a,3*d,ge);Math.abs(m.y)<T.EPSILON6&&(m.y<0?m.y=-T.EPSILON6:m.y=T.EPSILON6),Math.abs(E.y)<T.EPSILON6&&(E.y<0?E.y=-T.EPSILON6:E.y=T.EPSILON6);var p=u.attributes,y=u.indices,R=h,A=s.attributes,v=s.indices,N=f,I=_.lineSegmentPlane(m,E,Pe,Me);if(c(I)){var S=i.multiplyByScalar(i.UNIT_Y,5*T.EPSILON9,Le);m.y<0&&(i.negate(S,S),p=s.attributes,y=s.indices,R=f,A=u.attributes,v=u.indices,N=h);var g=i.add(I,S,Ce);Q(p,y,R,o,r,m),Q(p,y,R,o,-1,g),i.negate(S,S),i.add(I,S,g),Q(A,v,N,o,-1,g),Q(A,v,N,o,r+1,E)}else{var M,O,q;m.y<0?(M=s.attributes,O=s.indices,q=f):(M=u.attributes,O=u.indices,q=h),Q(M,O,q,o,r,m),Q(M,O,q,o,r+1,E)}}Z(e,s,u)}function ee(e){var r,t,o,u=e.geometry,s=u.attributes,l=s.position.values,f=s.prevPosition.values,h=s.nextPosition.values,w=s.expandAndWidth.values,d=c(s.st)?s.st.values:void 0,m=c(s.color)?s.color.values:void 0,E=K(u),p=K(u),y=l.length/3;for(r=0;y>r;r+=4){var R=r,A=r+1,v=r+2,N=r+3,I=i.fromArray(l,3*R,De),S=i.fromArray(l,3*A,ze),g=i.fromArray(l,3*v,Be),M=i.fromArray(l,3*N,Ge);Math.abs(I.y)<T.EPSILON6&&(I.y=T.EPSILON6*(g.y<0?-1:1),S.y=I.y),Math.abs(g.y)<T.EPSILON6&&(g.y=T.EPSILON6*(I.y<0?-1:1),M.y=g.y);var O=E.attributes,q=E.indices,x=p.attributes,b=p.indices,P=_.lineSegmentPlane(I,g,Pe,Ve);if(c(P)){var L=i.multiplyByScalar(i.UNIT_Y,5*T.EPSILON9,Xe);I.y<0&&(i.negate(L,L),O=p.attributes,q=p.indices,x=E.attributes,b=E.indices);var C=i.add(P,L,We);for(O.position.values.push(I.x,I.y,I.z,S.x,S.y,S.z),O.position.values.push(C.x,C.y,C.z),O.position.values.push(C.x,C.y,C.z),i.negate(L,L),i.add(P,L,C),x.position.values.push(C.x,C.y,C.z),x.position.values.push(C.x,C.y,C.z),x.position.values.push(g.x,g.y,g.z,M.x,M.y,M.z),t=3*R;3*R+6>t;++t)O.prevPosition.values.push(f[t]);for(O.prevPosition.values.push(I.x,I.y,I.z,I.x,I.y,I.z),x.prevPosition.values.push(I.x,I.y,I.z,I.x,I.y,I.z),t=3*v;3*v+6>t;++t)x.prevPosition.values.push(f[t]);for(t=3*R;3*R+6>t;++t)O.nextPosition.values.push(h[t]);for(O.nextPosition.values.push(g.x,g.y,g.z,g.x,g.y,g.z),x.nextPosition.values.push(g.x,g.y,g.z,g.x,g.y,g.z),t=3*v;3*v+6>t;++t)x.nextPosition.values.push(h[t]);var F=n.fromArray(w,2*R,Fe),U=Math.abs(F.y);O.expandAndWidth.values.push(-1,U,1,U),O.expandAndWidth.values.push(-1,-U,1,-U),x.expandAndWidth.values.push(-1,U,1,U),x.expandAndWidth.values.push(-1,-U,1,-U);var D=i.magnitudeSquared(i.subtract(P,I,Ge));if(D/=i.magnitudeSquared(i.subtract(g,I,Ge)),c(m)){var z=a.fromArray(m,4*R,He),B=a.fromArray(m,4*v,He),G=T.lerp(z.x,B.x,D),V=T.lerp(z.y,B.y,D),X=T.lerp(z.z,B.z,D),W=T.lerp(z.w,B.w,D);for(t=4*R;4*R+8>t;++t)O.color.values.push(m[t]);for(O.color.values.push(G,V,X,W),O.color.values.push(G,V,X,W),x.color.values.push(G,V,X,W),x.color.values.push(G,V,X,W),t=4*v;4*v+8>t;++t)x.color.values.push(m[t])}if(c(d)){var H=n.fromArray(d,2*R,Fe),Y=n.fromArray(d,2*(r+3),Ue),k=T.lerp(H.x,Y.x,D);for(t=2*R;2*R+4>t;++t)O.st.values.push(d[t]);for(O.st.values.push(k,H.y),O.st.values.push(k,Y.y),x.st.values.push(k,H.y),x.st.values.push(k,Y.y),t=2*v;2*v+4>t;++t)x.st.values.push(d[t])}o=O.position.values.length/3-4,q.push(o,o+2,o+1),q.push(o+1,o+2,o+3),o=x.position.values.length/3-4,b.push(o,o+2,o+1),b.push(o+1,o+2,o+3)}else{var j,Q;for(I.y<0?(j=p.attributes,Q=p.indices):(j=E.attributes,Q=E.indices),j.position.values.push(I.x,I.y,I.z),j.position.values.push(S.x,S.y,S.z),j.position.values.push(g.x,g.y,g.z),j.position.values.push(M.x,M.y,M.z),t=3*r;3*r+12>t;++t)j.prevPosition.values.push(f[t]),j.nextPosition.values.push(h[t]);for(t=2*r;2*r+8>t;++t)j.expandAndWidth.values.push(w[t]),c(d)&&j.st.values.push(d[t]);if(c(m))for(t=4*r;4*r+16>t;++t)j.color.values.push(m[t]);o=j.position.values.length/3-4,Q.push(o,o+2,o+1),Q.push(o+1,o+2,o+3)}}Z(e,p,E)}var re={};re.toWireframe=function(e){if(!c(e))throw new l("geometry is required.");var r=e.indices;if(c(r)){switch(e.primitiveType){case N.TRIANGLES:e.indices=g(r);break;case N.TRIANGLE_STRIP:e.indices=M(r);break;case N.TRIANGLE_FAN:e.indices=O(r);break;default:throw new l("geometry.primitiveType must be TRIANGLES, TRIANGLE_STRIP, or TRIANGLE_FAN.")}e.primitiveType=N.LINES}return e},re.createLineSegmentsForVectors=function(e,r,n){if(r=s(r,"normal"),!c(e))throw new l("geometry is required.");if(!c(e.attributes.position))throw new l("geometry.attributes.position is required.");if(!c(e.attributes[r]))throw new l("geometry.attributes must have an attribute with the same name as the attributeName parameter, "+r+".");n=s(n,1e4);for(var i=e.attributes.position.values,a=e.attributes[r].values,o=i.length,f=new Float64Array(2*o),h=0,m=0;o>m;m+=3)f[h++]=i[m],f[h++]=i[m+1],f[h++]=i[m+2],f[h++]=i[m]+a[m]*n,f[h++]=i[m+1]+a[m+1]*n,f[h++]=i[m+2]+a[m+2]*n;var E,p=e.boundingSphere;return c(p)&&(E=new t(p.center,p.radius+n)),new w({attributes:{position:new d({componentDatatype:u.DOUBLE,componentsPerAttribute:3,values:f})},primitiveType:N.LINES,boundingSphere:E})},re.createAttributeLocations=function(e){if(!c(e))throw new l("geometry is required.");var r,t=["position","positionHigh","positionLow","position3DHigh","position3DLow","position2DHigh","position2DLow","pickColor","normal","st","binormal","tangent","compressedAttributes"],n=e.attributes,i={},a=0,o=t.length;for(r=0;o>r;++r){var u=t[r];c(n[u])&&(i[u]=a++)}for(var s in n)n.hasOwnProperty(s)&&!c(i[s])&&(i[s]=a++);return i},re.reorderForPreVertexCache=function(e){if(!c(e))throw new l("geometry is required.");var r=w.computeNumberOfVertices(e),t=e.indices;if(c(t)){for(var n=new Int32Array(r),i=0;r>i;i++)n[i]=-1;for(var a,o=t,s=o.length,f=p.createTypedArray(r,s),h=0,d=0,m=0;s>h;)a=n[o[h]],-1!==a?f[d]=a:(a=o[h],n[a]=m,f[d]=m,++m),++h,++d;e.indices=f;var E=e.attributes;for(var y in E)if(E.hasOwnProperty(y)&&c(E[y])&&c(E[y].values)){for(var _=E[y],T=_.values,R=0,A=_.componentsPerAttribute,v=u.createTypedArray(_.componentDatatype,m*A);r>R;){var N=n[R];if(-1!==N)for(i=0;A>i;i++)v[A*N+i]=T[A*R+i];++R}_.values=v}}return e},re.reorderForPostVertexCache=function(e,r){if(!c(e))throw new l("geometry is required.");var t=e.indices;if(e.primitiveType===N.TRIANGLES&&c(t)){for(var n=t.length,i=0,a=0;n>a;a++)t[a]>i&&(i=t[a]);e.indices=I.tipsify({indices:t,maximumIndex:i,cacheSize:r})}return e},re.fitToUnsignedShortIndices=function(e){if(!c(e))throw new l("geometry is required.");if(c(e.indices)&&e.primitiveType!==N.TRIANGLES&&e.primitiveType!==N.LINES&&e.primitiveType!==N.POINTS)throw new l("geometry.primitiveType must equal to PrimitiveType.TRIANGLES, PrimitiveType.LINES, or PrimitiveType.POINTS.");var r=[],t=w.computeNumberOfVertices(e);if(c(e.indices)&&t>=T.SIXTY_FOUR_KILOBYTES){var n,i=[],a=[],o=0,u=q(e.attributes),s=e.indices,f=s.length;e.primitiveType===N.TRIANGLES?n=3:e.primitiveType===N.LINES?n=2:e.primitiveType===N.POINTS&&(n=1);for(var h=0;f>h;h+=n){for(var d=0;n>d;++d){var m=s[h+d],E=i[m];c(E)||(E=o++,i[m]=E,x(u,e.attributes,m)),a.push(E)}o+n>=T.SIXTY_FOUR_KILOBYTES&&(r.push(new w({attributes:u,indices:a,primitiveType:e.primitiveType,boundingSphere:e.boundingSphere,boundingSphereCV:e.boundingSphereCV})),i=[],a=[],o=0,u=q(e.attributes))}0!==a.length&&r.push(new w({attributes:u,indices:a,primitiveType:e.primitiveType,boundingSphere:e.boundingSphere,boundingSphereCV:e.boundingSphereCV}))}else r.push(e);return r};var te=new i,ne=new o;re.projectTo2D=function(e,r,t,n,a){if(!c(e))throw new l("geometry is required.");if(!c(r))throw new l("attributeName is required.");if(!c(t))throw new l("attributeName3D is required.");if(!c(n))throw new l("attributeName2D is required.");if(!c(e.attributes[r]))throw new l("geometry must have attribute matching the attributeName argument: "+r+".");if(e.attributes[r].componentDatatype!==u.DOUBLE)throw new l("The attribute componentDatatype must be ComponentDatatype.DOUBLE.");var o=e.attributes[r];a=c(a)?a:new h;for(var s=a.ellipsoid,f=o.values,w=new Float64Array(f.length),m=0,E=0;E<f.length;E+=3){var p=i.fromArray(f,E,te),y=s.cartesianToCartographic(p,ne);if(!c(y))throw new l("Could not project point ("+p.x+", "+p.y+", "+p.z+") to 2D.");var _=a.project(y,te);w[m++]=_.x,w[m++]=_.y,w[m++]=_.z}return e.attributes[t]=o,e.attributes[n]=new d({componentDatatype:u.DOUBLE,componentsPerAttribute:3,values:w}),delete e.attributes[r],e};var ie={high:0,low:0};re.encodeAttribute=function(e,r,t,n){if(!c(e))throw new l("geometry is required.");if(!c(r))throw new l("attributeName is required.");if(!c(t))throw new l("attributeHighName is required.");if(!c(n))throw new l("attributeLowName is required.");if(!c(e.attributes[r]))throw new l("geometry must have attribute matching the attributeName argument: "+r+".");if(e.attributes[r].componentDatatype!==u.DOUBLE)throw new l("The attribute componentDatatype must be ComponentDatatype.DOUBLE.");for(var i=e.attributes[r],a=i.values,o=a.length,s=new Float32Array(o),h=new Float32Array(o),w=0;o>w;++w)f.encode(a[w],ie),s[w]=ie.high,h[w]=ie.low;var m=i.componentsPerAttribute;return e.attributes[t]=new d({componentDatatype:u.FLOAT,componentsPerAttribute:m,values:s}),e.attributes[n]=new d({componentDatatype:u.FLOAT,componentsPerAttribute:m,values:h}),delete e.attributes[r],e};var ae=new i,oe=new A,ue=new R;re.transformToWorldCoordinates=function(e){if(!c(e))throw new l("instance is required.");var r=e.modelMatrix;if(A.equals(r,A.IDENTITY))return e;var n=e.geometry.attributes;b(r,n.position),b(r,n.prevPosition),b(r,n.nextPosition),(c(n.normal)||c(n.binormal)||c(n.tangent))&&(A.inverse(r,oe),A.transpose(oe,oe),A.getRotation(oe,ue),P(ue,n.normal),P(ue,n.binormal),P(ue,n.tangent));var i=e.geometry.boundingSphere;return c(i)&&(e.geometry.boundingSphere=t.transform(i,r,i)),e.modelMatrix=A.clone(A.IDENTITY),e};var se=new i;re.combineInstances=function(e){if(!c(e)||e.length<1)throw new l("instances is required and must have length greater than zero.");for(var r=[],t=[],n=e.length,i=0;n>i;++i){var a=e[i];c(a.geometry)?r.push(a):t.push(a)}var o=[];return r.length>0&&o.push(C(r,"geometry")),t.length>0&&(o.push(C(t,"westHemisphereGeometry")),o.push(C(t,"eastHemisphereGeometry"))),o};var ce=new i,le=new i,fe=new i,he=new i;re.computeNormal=function(e){if(!c(e))throw new l("geometry is required.");if(!c(e.attributes.position)||!c(e.attributes.position.values))throw new l("geometry.attributes.position.values is required.");if(!c(e.indices))throw new l("geometry.indices is required.");if(e.indices.length<2||e.indices.length%3!==0)throw new l("geometry.indices length must be greater than 0 and be a multiple of 3.");if(e.primitiveType!==N.TRIANGLES)throw new l("geometry.primitiveType must be PrimitiveType.TRIANGLES.");for(var r=e.indices,t=e.attributes,n=t.position.values,a=t.position.values.length/3,o=r.length,s=new Array(a),f=new Array(o/3),h=new Array(o),w=0;a>w;w++)s[w]={indexOffset:0,count:0,currentCount:0};var m=0;for(w=0;o>w;w+=3){var E=r[w],p=r[w+1],y=r[w+2],_=3*E,T=3*p,R=3*y;le.x=n[_],le.y=n[_+1],le.z=n[_+2],fe.x=n[T],fe.y=n[T+1],fe.z=n[T+2],he.x=n[R],he.y=n[R+1],he.z=n[R+2],s[E].count++,s[p].count++,s[y].count++,i.subtract(fe,le,fe),i.subtract(he,le,he),f[m]=i.cross(fe,he,new i),m++}var A=0;for(w=0;a>w;w++)s[w].indexOffset+=A,A+=s[w].count;m=0;var v;for(w=0;o>w;w+=3){v=s[r[w]];var I=v.indexOffset+v.currentCount;h[I]=m,v.currentCount++,v=s[r[w+1]],I=v.indexOffset+v.currentCount,h[I]=m,v.currentCount++,v=s[r[w+2]],I=v.indexOffset+v.currentCount,h[I]=m,v.currentCount++,m++}var S=new Float32Array(3*a);for(w=0;a>w;w++){var g=3*w;if(v=s[w],v.count>0){for(i.clone(i.ZERO,ce),m=0;m<v.count;m++)i.add(ce,f[h[v.indexOffset+m]],ce);i.normalize(ce,ce),S[g]=ce.x,S[g+1]=ce.y,S[g+2]=ce.z}else S[g]=0,S[g+1]=0,S[g+2]=1}return e.attributes.normal=new d({componentDatatype:u.FLOAT,componentsPerAttribute:3,values:S}),e};var we=new i,de=new i,me=new i;re.computeBinormalAndTangent=function(e){if(!c(e))throw new l("geometry is required.");var r=e.attributes,t=e.indices;if(!c(r.position)||!c(r.position.values))throw new l("geometry.attributes.position.values is required.");if(!c(r.normal)||!c(r.normal.values))throw new l("geometry.attributes.normal.values is required.");if(!c(r.st)||!c(r.st.values))throw new l("geometry.attributes.st.values is required.");if(!c(t))throw new l("geometry.indices is required.");if(t.length<2||t.length%3!==0)throw new l("geometry.indices length must be greater than 0 and be a multiple of 3.");if(e.primitiveType!==N.TRIANGLES)throw new l("geometry.primitiveType must be PrimitiveType.TRIANGLES.");for(var n=e.attributes.position.values,a=e.attributes.normal.values,o=e.attributes.st.values,s=e.attributes.position.values.length/3,f=t.length,h=new Array(3*s),w=0;w<h.length;w++)h[w]=0;var m,E,p;for(w=0;f>w;w+=3){var y=t[w],_=t[w+1],T=t[w+2];m=3*y,E=3*_,p=3*T;var R=2*y,A=2*_,v=2*T,I=n[m],S=n[m+1],g=n[m+2],M=o[R],O=o[R+1],q=o[A+1]-O,x=o[v+1]-O,b=1/((o[A]-M)*x-(o[v]-M)*q),P=(x*(n[E]-I)-q*(n[p]-I))*b,L=(x*(n[E+1]-S)-q*(n[p+1]-S))*b,C=(x*(n[E+2]-g)-q*(n[p+2]-g))*b;h[m]+=P,h[m+1]+=L,h[m+2]+=C,h[E]+=P,h[E+1]+=L,h[E+2]+=C,h[p]+=P,h[p+1]+=L,h[p+2]+=C}var F=new Float32Array(3*s),U=new Float32Array(3*s);for(w=0;s>w;w++){m=3*w,E=m+1,p=m+2;var D=i.fromArray(a,m,we),z=i.fromArray(h,m,me),B=i.dot(D,z);i.multiplyByScalar(D,B,de),i.normalize(i.subtract(z,de,z),z),U[m]=z.x,U[E]=z.y,U[p]=z.z,i.normalize(i.cross(D,z,z),z),F[m]=z.x,F[E]=z.y,F[p]=z.z}return e.attributes.tangent=new d({componentDatatype:u.FLOAT,componentsPerAttribute:3,values:U}),e.attributes.binormal=new d({componentDatatype:u.FLOAT,componentsPerAttribute:3,values:F}),e};var Ee=new n,pe=new i,ye=new i,_e=new i;re.compressVertices=function(r){if(!c(r))throw new l("geometry is required.");var t=r.attributes.normal,a=r.attributes.st;if(!c(t)&&!c(a))return r;var o,s,f,h,w=r.attributes.tangent,m=r.attributes.binormal;c(t)&&(o=t.values),c(a)&&(s=a.values),c(w)&&(f=w.values),m&&(h=m.values);var E=c(o)?o.length:s.length,p=c(o)?3:2,y=E/p,_=y,T=c(s)&&c(o)?2:1;T+=c(f)||c(h)?1:0,_*=T;for(var R=new Float32Array(_),A=0,v=0;y>v;++v){c(s)&&(n.fromArray(s,2*v,Ee),R[A++]=e.compressTextureCoordinates(Ee));var N=3*v;c(o)&&c(f)&&c(h)?(i.fromArray(o,N,pe),i.fromArray(f,N,ye),i.fromArray(h,N,_e),e.octPack(pe,ye,_e,Ee),R[A++]=Ee.x,R[A++]=Ee.y):(c(o)&&(i.fromArray(o,N,pe),R[A++]=e.octEncodeFloat(pe)),c(f)&&(i.fromArray(f,N,pe),R[A++]=e.octEncodeFloat(pe)),c(h)&&(i.fromArray(h,N,pe),R[A++]=e.octEncodeFloat(pe)))}return r.attributes.compressedAttributes=new d({
  componentDatatype:u.FLOAT,componentsPerAttribute:T,values:R}),c(o)&&delete r.attributes.normal,c(s)&&delete r.attributes.st,c(f)&&delete r.attributes.tangent,c(h)&&delete r.attributes.binormal,r};var Te=new i,Re=new i,Ae=new i,ve=new i,Ne=new i,Ie={positions:new Array(7),indices:new Array(9)},Se=new i,ge=new i,Me=new i,Oe=new i,qe=new n,xe=new n,be=new n,Pe=v.fromPointNormal(i.ZERO,i.UNIT_Y),Le=new i,Ce=new i,Fe=new n,Ue=new n,De=new i,ze=new i,Be=new i,Ge=new i,Ve=new i,Xe=new i,We=new i,He=new a;return re.splitLongitude=function(e){if(!c(e))throw new l("instance is required.");var r=e.geometry,n=r.boundingSphere;if(c(n)){var i=n.center.x-n.radius;if(i>0||t.intersectPlane(n,v.ORIGIN_ZX_PLANE)!==y.INTERSECTING)return e}if(r.geometryType!==E.NONE)switch(r.geometryType){case E.POLYLINES:ee(e);break;case E.TRIANGLES:J(e);break;case E.LINES:$(e)}else V(r),r.primitiveType===N.TRIANGLES?J(e):r.primitiveType===N.LINES&&$(e);return e},re}),define("Core/VertexFormat",["./defaultValue","./defined","./DeveloperError","./freezeObject"],function(e,r,t,n){"use strict";function i(r){r=e(r,e.EMPTY_OBJECT),this.position=e(r.position,!1),this.normal=e(r.normal,!1),this.st=e(r.st,!1),this.binormal=e(r.binormal,!1),this.tangent=e(r.tangent,!1),this.color=e(r.color,!1)}return i.POSITION_ONLY=n(new i({position:!0})),i.POSITION_AND_NORMAL=n(new i({position:!0,normal:!0})),i.POSITION_NORMAL_AND_ST=n(new i({position:!0,normal:!0,st:!0})),i.POSITION_AND_ST=n(new i({position:!0,st:!0})),i.POSITION_AND_COLOR=n(new i({position:!0,color:!0})),i.ALL=n(new i({position:!0,normal:!0,st:!0,binormal:!0,tangent:!0})),i.DEFAULT=i.POSITION_NORMAL_AND_ST,i.packedLength=6,i.pack=function(n,i,a){if(!r(n))throw new t("value is required");if(!r(i))throw new t("array is required");a=e(a,0),i[a++]=n.position?1:0,i[a++]=n.normal?1:0,i[a++]=n.st?1:0,i[a++]=n.binormal?1:0,i[a++]=n.tangent?1:0,i[a++]=n.color?1:0},i.unpack=function(n,a,o){if(!r(n))throw new t("array is required");return a=e(a,0),r(o)||(o=new i),o.position=1===n[a++],o.normal=1===n[a++],o.st=1===n[a++],o.binormal=1===n[a++],o.tangent=1===n[a++],o.color=1===n[a++],o},i.clone=function(e,t){return r(e)?(r(t)||(t=new i),t.position=e.position,t.normal=e.normal,t.st=e.st,t.binormal=e.binormal,t.tangent=e.tangent,t.color=e.color,t):void 0},i}),define("Core/EllipseGeometry",["./BoundingSphere","./Cartesian2","./Cartesian3","./Cartographic","./ComponentDatatype","./defaultValue","./defined","./DeveloperError","./EllipseGeometryLibrary","./Ellipsoid","./GeographicProjection","./Geometry","./GeometryAttribute","./GeometryAttributes","./GeometryInstance","./GeometryPipeline","./IndexDatatype","./Math","./Matrix3","./PrimitiveType","./Quaternion","./VertexFormat"],function(e,r,t,n,i,a,o,u,s,c,l,f,h,w,d,m,E,p,y,_,T,R){"use strict";function A(e,n,a){var o=n.vertexFormat,u=n.center,c=n.semiMajorAxis,f=n.semiMinorAxis,d=n.ellipsoid,m=n.stRotation,E=a?e.length/3*2:e.length/3,p=o.st?new Float32Array(2*E):void 0,_=o.normal?new Float32Array(3*E):void 0,R=o.tangent?new Float32Array(3*E):void 0,A=o.binormal?new Float32Array(3*E):void 0,v=0,N=F,I=U,S=D,g=new l(d),M=g.project(d.cartesianToCartographic(u,z),B),b=d.scaleToGeodeticSurface(u,O);d.geodeticSurfaceNormal(b,b);for(var X=T.fromAxisAngle(b,m,C),W=y.fromQuaternion(X,L),H=r.fromElements(Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY,G),Y=r.fromElements(Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY,V),k=e.length,K=a?k:0,Z=K/3*2,j=0;k>j;j+=3){var Q=j+1,J=j+2,$=t.fromArray(e,j,O);if(o.st){var ee=y.multiplyByVector(W,$,q),re=g.project(d.cartesianToCartographic(ee,z),x);t.subtract(re,M,re),P.x=(re.x+c)/(2*c),P.y=(re.y+f)/(2*f),H.x=Math.min(P.x,H.x),H.y=Math.min(P.y,H.y),Y.x=Math.max(P.x,Y.x),Y.y=Math.max(P.y,Y.y),a&&(p[v+Z]=P.x,p[v+1+Z]=P.y),p[v++]=P.x,p[v++]=P.y}N=d.geodeticSurfaceNormal($,N),(o.normal||o.tangent||o.binormal)&&((o.tangent||o.binormal)&&(I=t.normalize(t.cross(t.UNIT_Z,N,I),I),y.multiplyByVector(W,I,I)),o.normal&&(_[j]=N.x,_[Q]=N.y,_[J]=N.z,a&&(_[j+K]=-N.x,_[Q+K]=-N.y,_[J+K]=-N.z)),o.tangent&&(R[j]=I.x,R[Q]=I.y,R[J]=I.z,a&&(R[j+K]=-I.x,R[Q+K]=-I.y,R[J+K]=-I.z)),o.binormal&&(S=t.normalize(t.cross(N,I,S),S),A[j]=S.x,A[Q]=S.y,A[J]=S.z,a&&(A[j+K]=S.x,A[Q+K]=S.y,A[J+K]=S.z)))}if(o.st){k=p.length;for(var te=0;k>te;te+=2)p[te]=(p[te]-H.x)/(Y.x-H.x),p[te+1]=(p[te+1]-H.y)/(Y.y-H.y)}var ne=new w;if(o.position){var ie=s.raisePositionsToHeight(e,n,a);ne.position=new h({componentDatatype:i.DOUBLE,componentsPerAttribute:3,values:ie})}return o.st&&(ne.st=new h({componentDatatype:i.FLOAT,componentsPerAttribute:2,values:p})),o.normal&&(ne.normal=new h({componentDatatype:i.FLOAT,componentsPerAttribute:3,values:_})),o.tangent&&(ne.tangent=new h({componentDatatype:i.FLOAT,componentsPerAttribute:3,values:R})),o.binormal&&(ne.binormal=new h({componentDatatype:i.FLOAT,componentsPerAttribute:3,values:A})),ne}function v(e){var r,t,n,i,a,o=new Array(12*(e*(e+1))-6),u=0;for(r=0,n=1,i=0;3>i;i++)o[u++]=n++,o[u++]=r,o[u++]=n;for(i=2;e+1>i;++i){for(n=i*(i+1)-1,r=(i-1)*i-1,o[u++]=n++,o[u++]=r,o[u++]=n,t=2*i,a=0;t-1>a;++a)o[u++]=n,o[u++]=r++,o[u++]=r,o[u++]=n++,o[u++]=r,o[u++]=n;o[u++]=n++,o[u++]=r,o[u++]=n}for(t=2*e,++n,++r,i=0;t-1>i;++i)o[u++]=n,o[u++]=r++,o[u++]=r,o[u++]=n++,o[u++]=r,o[u++]=n;for(o[u++]=n,o[u++]=r++,o[u++]=r,o[u++]=n++,o[u++]=r++,o[u++]=r,++r,i=e-1;i>1;--i){for(o[u++]=r++,o[u++]=r,o[u++]=n,t=2*i,a=0;t-1>a;++a)o[u++]=n,o[u++]=r++,o[u++]=r,o[u++]=n++,o[u++]=r,o[u++]=n;o[u++]=r++,o[u++]=r++,o[u++]=n++}for(i=0;3>i;i++)o[u++]=r++,o[u++]=r,o[u++]=n;return o}function N(r){var n=r.center;X=t.multiplyByScalar(r.ellipsoid.geodeticSurfaceNormal(n,X),r.height,X),X=t.add(n,X,X);var i=new e(X,r.semiMajorAxis),a=s.computeEllipsePositions(r,!0,!1),o=a.positions,u=a.numPts,c=A(o,r,!1),l=v(u);return l=E.createTypedArray(o.length/3,l),{boundingSphere:i,attributes:c,indices:l}}function I(e,n){var a=n.vertexFormat,o=n.center,u=n.semiMajorAxis,s=n.semiMinorAxis,c=n.ellipsoid,f=n.height,d=n.extrudedHeight,m=n.stRotation,E=e.length/3*2,p=new Float64Array(3*E),_=a.st?new Float32Array(2*E):void 0,R=a.normal?new Float32Array(3*E):void 0,A=a.tangent?new Float32Array(3*E):void 0,v=a.binormal?new Float32Array(3*E):void 0,N=0,I=F,S=U,g=D,M=new l(c),X=M.project(c.cartesianToCartographic(o,z),B),W=c.scaleToGeodeticSurface(o,O);c.geodeticSurfaceNormal(W,W);for(var H=T.fromAxisAngle(W,m,C),Y=y.fromQuaternion(H,L),k=r.fromElements(Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY,G),K=r.fromElements(Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY,V),Z=e.length,j=Z/3*2,Q=0;Z>Q;Q+=3){var J,$=Q+1,ee=Q+2,re=t.fromArray(e,Q,O);if(a.st){var te=y.multiplyByVector(Y,re,q),ne=M.project(c.cartesianToCartographic(te,z),x);t.subtract(ne,X,ne),P.x=(ne.x+u)/(2*u),P.y=(ne.y+s)/(2*s),k.x=Math.min(P.x,k.x),k.y=Math.min(P.y,k.y),K.x=Math.max(P.x,K.x),K.y=Math.max(P.y,K.y),_[N+j]=P.x,_[N+1+j]=P.y,_[N++]=P.x,_[N++]=P.y}re=c.scaleToGeodeticSurface(re,re),J=t.clone(re,q),I=c.geodeticSurfaceNormal(re,I);var ie=t.multiplyByScalar(I,f,b);if(re=t.add(re,ie,re),ie=t.multiplyByScalar(I,d,ie),J=t.add(J,ie,J),a.position&&(p[Q+Z]=J.x,p[$+Z]=J.y,p[ee+Z]=J.z,p[Q]=re.x,p[$]=re.y,p[ee]=re.z),a.normal||a.tangent||a.binormal){g=t.clone(I,g);var ae=t.fromArray(e,(Q+3)%Z,b);t.subtract(ae,re,ae);var oe=t.subtract(J,re,x);I=t.normalize(t.cross(oe,ae,I),I),a.normal&&(R[Q]=I.x,R[$]=I.y,R[ee]=I.z,R[Q+Z]=I.x,R[$+Z]=I.y,R[ee+Z]=I.z),a.tangent&&(S=t.normalize(t.cross(g,I,S),S),A[Q]=S.x,A[$]=S.y,A[ee]=S.z,A[Q+Z]=S.x,A[Q+1+Z]=S.y,A[Q+2+Z]=S.z),a.binormal&&(v[Q]=g.x,v[$]=g.y,v[ee]=g.z,v[Q+Z]=g.x,v[$+Z]=g.y,v[ee+Z]=g.z)}}if(a.st){Z=_.length;for(var ue=0;Z>ue;ue+=2)_[ue]=(_[ue]-k.x)/(K.x-k.x),_[ue+1]=(_[ue+1]-k.y)/(K.y-k.y)}var se=new w;return a.position&&(se.position=new h({componentDatatype:i.DOUBLE,componentsPerAttribute:3,values:p})),a.st&&(se.st=new h({componentDatatype:i.FLOAT,componentsPerAttribute:2,values:_})),a.normal&&(se.normal=new h({componentDatatype:i.FLOAT,componentsPerAttribute:3,values:R})),a.tangent&&(se.tangent=new h({componentDatatype:i.FLOAT,componentsPerAttribute:3,values:A})),a.binormal&&(se.binormal=new h({componentDatatype:i.FLOAT,componentsPerAttribute:3,values:v})),se}function S(e){for(var r=e.length/3,t=E.createTypedArray(r,6*r),n=0,i=0;r>i;i++){var a=i,o=i+r,u=(a+1)%r,s=u+r;t[n++]=a,t[n++]=o,t[n++]=u,t[n++]=u,t[n++]=o,t[n++]=s}return t}function g(r){var n=r.center,i=r.ellipsoid,a=r.semiMajorAxis,o=t.multiplyByScalar(i.geodeticSurfaceNormal(n,O),r.height,O);W.center=t.add(n,o,W.center),W.radius=a,o=t.multiplyByScalar(i.geodeticSurfaceNormal(n,o),r.extrudedHeight,o),H.center=t.add(n,o,H.center),H.radius=a;var u=s.computeEllipsePositions(r,!0,!0),c=u.positions,l=u.numPts,h=u.outerPositions,w=e.union(W,H),p=A(c,r,!0),y=v(l),T=y.length;y.length=2*T;for(var R=c.length/3,N=0;T>N;N+=3)y[N+T]=y[N+2]+R,y[N+1+T]=y[N+1]+R,y[N+2+T]=y[N]+R;var g=E.createTypedArray(2*R/3,y),M=new f({attributes:p,indices:g,primitiveType:_.TRIANGLES}),q=I(h,r);y=S(h);var x=E.createTypedArray(2*h.length/3,y),b=new f({attributes:q,indices:x,primitiveType:_.TRIANGLES}),P=m.combineInstances([new d({geometry:M}),new d({geometry:b})]);return{boundingSphere:w,attributes:P[0].attributes,indices:P[0].indices}}function M(e){e=a(e,a.EMPTY_OBJECT);var r=e.center,n=a(e.ellipsoid,c.WGS84),i=e.semiMajorAxis,s=e.semiMinorAxis,l=a(e.granularity,p.RADIANS_PER_DEGREE),f=a(e.height,0),h=e.extrudedHeight,w=o(h)&&Math.abs(f-h)>1,d=a(e.vertexFormat,R.DEFAULT);if(!o(r))throw new u("center is required.");if(!o(i))throw new u("semiMajorAxis is required.");if(!o(s))throw new u("semiMinorAxis is required.");if(s>i)throw new u("semiMajorAxis must be greater than or equal to the semiMinorAxis.");if(0>=l)throw new u("granularity must be greater than zero.");this._center=t.clone(r),this._semiMajorAxis=i,this._semiMinorAxis=s,this._ellipsoid=c.clone(n),this._rotation=a(e.rotation,0),this._stRotation=a(e.stRotation,0),this._height=f,this._granularity=l,this._vertexFormat=R.clone(d),this._extrudedHeight=a(h,f),this._extrude=w,this._workerName="createEllipseGeometry"}var O=new t,q=new t,x=new t,b=new t,P=new r,L=new y,C=new T,F=new t,U=new t,D=new t,z=new n,B=new t,G=new r,V=new r,X=new t,W=new e,H=new e;M.packedLength=t.packedLength+c.packedLength+R.packedLength+8,M.pack=function(e,r,n){if(!o(e))throw new u("value is required");if(!o(r))throw new u("array is required");n=a(n,0),t.pack(e._center,r,n),n+=t.packedLength,c.pack(e._ellipsoid,r,n),n+=c.packedLength,R.pack(e._vertexFormat,r,n),n+=R.packedLength,r[n++]=e._semiMajorAxis,r[n++]=e._semiMinorAxis,r[n++]=e._rotation,r[n++]=e._stRotation,r[n++]=e._height,r[n++]=e._granularity,r[n++]=e._extrudedHeight,r[n]=e._extrude?1:0};var Y=new t,k=new c,K=new R,Z={center:Y,ellipsoid:k,vertexFormat:K,semiMajorAxis:void 0,semiMinorAxis:void 0,rotation:void 0,stRotation:void 0,height:void 0,granularity:void 0,extrudedHeight:void 0};return M.unpack=function(e,r,n){if(!o(e))throw new u("array is required");r=a(r,0);var i=t.unpack(e,r,Y);r+=t.packedLength;var s=c.unpack(e,r,k);r+=c.packedLength;var l=R.unpack(e,r,K);r+=R.packedLength;var f=e[r++],h=e[r++],w=e[r++],d=e[r++],m=e[r++],E=e[r++],p=e[r++],y=1===e[r];return o(n)?(n._center=t.clone(i,n._center),n._ellipsoid=c.clone(s,n._ellipsoid),n._vertexFormat=R.clone(l,n._vertexFormat),n._semiMajorAxis=f,n._semiMinorAxis=h,n._rotation=w,n._stRotation=d,n._height=m,n._granularity=E,n._extrudedHeight=p,n._extrude=y,n):(Z.height=m,Z.extrudedHeight=p,Z.granularity=E,Z.stRotation=d,Z.rotation=w,Z.semiMajorAxis=f,Z.semiMinorAxis=h,new M(Z))},M.createGeometry=function(e){if(!(e._semiMajorAxis<=0||e._semiMinorAxis<=0)){e._center=e._ellipsoid.scaleToGeodeticSurface(e._center,e._center);var r,t={center:e._center,semiMajorAxis:e._semiMajorAxis,semiMinorAxis:e._semiMinorAxis,ellipsoid:e._ellipsoid,rotation:e._rotation,height:e._height,extrudedHeight:e._extrudedHeight,granularity:e._granularity,vertexFormat:e._vertexFormat,stRotation:e._stRotation};return e._extrude?(t.extrudedHeight=Math.min(e._extrudedHeight,e._height),t.height=Math.max(e._extrudedHeight,e._height),r=g(t)):r=N(t),new f({attributes:r.attributes,indices:r.indices,primitiveType:_.TRIANGLES,boundingSphere:r.boundingSphere})}},M.createShadowVolume=function(e,r,t){var n=e._granularity,i=e._ellipsoid,a=r(n,i),o=t(n,i);return new M({center:e._center,semiMajorAxis:e._semiMajorAxis,semiMinorAxis:e._semiMinorAxis,ellipsoid:i,rotation:e._rotation,stRotation:e._stRotation,granularity:n,extrudedHeight:a,height:o,vertexFormat:R.POSITION_ONLY})},M}),define("Workers/createEllipseGeometry",["../Core/Cartesian3","../Core/defined","../Core/EllipseGeometry","../Core/Ellipsoid"],function(e,r,t,n){"use strict";function i(i,a){return r(a)&&(i=t.unpack(i,a)),i._center=e.clone(i._center),i._ellipsoid=n.clone(i._ellipsoid),t.createGeometry(i)}return i})}();