/**
 * 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.
*/

/**
  @license
  when.js - https://github.com/cujojs/when

  MIT License (c) copyright B Cavalier & J Hann

 * A lightweight CommonJS Promises/A and when() implementation
 * when is part of the cujo.js family of libraries (http://cujojs.com/)
 *
 * Licensed under the MIT License at:
 * http://www.opensource.org/licenses/mit-license.php
 *
 * @version 1.7.1
 */

/**
@license
sprintf.js from the php.js project - https://github.com/kvz/phpjs
Directly from https://github.com/kvz/phpjs/blob/master/functions/strings/sprintf.js

php.js is copyright 2012 Kevin van Zonneveld.

Portions copyright Brett Zamir (http://brett-zamir.me), Kevin van Zonneveld
(http://kevin.vanzonneveld.net), Onno Marsman, Theriault, Michael White
(http://getsprink.com), Waldo Malqui Silva, Paulo Freitas, Jack, Jonas
Raoni Soares Silva (http://www.jsfromhell.com), Philip Peterson, Legaev
Andrey, Ates Goral (http://magnetiq.com), Alex, Ratheous, Martijn Wieringa,
Rafa? Kukawski (http://blog.kukawski.pl), lmeyrick
(https://sourceforge.net/projects/bcmath-js/), Nate, Philippe Baumann,
Enrique Gonzalez, Webtoolkit.info (http://www.webtoolkit.info/), Carlos R.
L. Rodrigues (http://www.jsfromhell.com), Ash Searle
(http://hexmen.com/blog/), Jani Hartikainen, travc, Ole Vrijenhoek,
Erkekjetter, Michael Grier, Rafa? Kukawski (http://kukawski.pl), Johnny
Mast (http://www.phpvrouwen.nl), T.Wild, d3x,
http://stackoverflow.com/questions/57803/how-to-convert-decimal-to-hex-in-javascript,
Rafa? Kukawski (http://blog.kukawski.pl/), stag019, pilus, WebDevHobo
(http://webdevhobo.blogspot.com/), marrtins, GeekFG
(http://geekfg.blogspot.com), Andrea Giammarchi
(http://webreflection.blogspot.com), Arpad Ray (mailto:arpad@php.net),
gorthaur, Paul Smith, Tim de Koning (http://www.kingsquare.nl), Joris, Oleg
Eremeev, Steve Hilder, majak, gettimeofday, KELAN, Josh Fraser
(http://onlineaspect.com/2007/06/08/auto-detect-a-time-zone-with-javascript/),
Marc Palau, Martin
(http://www.erlenwiese.de/), Breaking Par Consulting Inc
(http://www.breakingpar.com/bkp/home.nsf/0/87256B280015193F87256CFB006C45F7),
Chris, Mirek Slugen, saulius, Alfonso Jimenez
(http://www.alfonsojimenez.com), Diplom@t (http://difane.com/), felix,
Mailfaker (http://www.weedem.fr/), Tyler Akins (http://rumkin.com), Caio
Ariede (http://caioariede.com), Robin, Kankrelune
(http://www.webfaktory.info/), Karol Kowalski, Imgen Tata
(http://www.myipdf.com/), mdsjack (http://www.mdsjack.bo.it), Dreamer,
Felix Geisendoerfer (http://www.debuggable.com/felix), Lars Fischer, AJ,
David, Aman Gupta, Michael White, Public Domain
(http://www.json.org/json2.js), Steven Levithan
(http://blog.stevenlevithan.com), Sakimori, Pellentesque Malesuada,
Thunder.m, Dj (http://phpjs.org/functions/htmlentities:425#comment_134018),
Steve Clay, David James, Francois, class_exists, nobbler, T. Wild, Itsacon
(http://www.itsacon.net/), date, Ole Vrijenhoek (http://www.nervous.nl/),
Fox, Raphael (Ao RUDLER), Marco, noname, Mateusz "loonquawl" Zalega, Frank
Forte, Arno, ger, mktime, john (http://www.jd-tech.net), Nick Kolosov
(http://sammy.ru), marc andreu, Scott Cariss, Douglas Crockford
(http://javascript.crockford.com), madipta, Slawomir Kaniecki,
ReverseSyntax, Nathan, Alex Wilson, kenneth, Bayron Guevara, Adam Wallner
(http://web2.bitbaro.hu/), paulo kuong, jmweb, Lincoln Ramsay, djmix,
Pyerre, Jon Hohle, Thiago Mata (http://thiagomata.blog.com), lmeyrick
(https://sourceforge.net/projects/bcmath-js/this.), Linuxworld, duncan,
Gilbert, Sanjoy Roy, Shingo, sankai, Oskar Larsson H?gfeldt
(http://oskar-lh.name/), Denny Wardhana, 0m3r, Everlasto, Subhasis Deb,
josh, jd, Pier Paolo Ramon (http://www.mastersoup.com/), P, merabi, Soren
Hansen, Eugene Bulkin (http://doubleaw.com/), Der Simon
(http://innerdom.sourceforge.net/), echo is bad, Ozh, XoraX
(http://www.xorax.info), EdorFaus, JB, J A R, Marc Jansen, Francesco, LH,
Stoyan Kyosev (http://www.svest.org/), nord_ua, omid
(http://phpjs.org/functions/380:380#comment_137122), Brad Touesnard, MeEtc
(http://yass.meetcweb.com), Peter-Paul Koch
(http://www.quirksmode.org/js/beat.html), Olivier Louvignes
(http://mg-crea.com/), T0bsn, Tim Wiel, Bryan Elliott, Jalal Berrami,
Martin, JT, David Randall, Thomas Beaucourt (http://www.webapp.fr), taith,
vlado houba, Pierre-Luc Paour, Kristof Coomans (SCK-CEN Belgian Nucleair
Research Centre), Martin Pool, Kirk Strobeck, Rick Waldron, Brant Messenger
(http://www.brantmessenger.com/), Devan Penner-Woelk, Saulo Vallory, Wagner
B. Soares, Artur Tchernychev, Valentina De Rosa, Jason Wong
(http://carrot.org/), Christoph, Daniel Esteban, strftime, Mick@el, rezna,
Simon Willison (http://simonwillison.net), Anton Ongson, Gabriel Paderni,
Marco van Oort, penutbutterjelly, Philipp Lenssen, Bjorn Roesbeke
(http://www.bjornroesbeke.be/), Bug?, Eric Nagel, Tomasz Wesolowski,
Evertjan Garretsen, Bobby Drake, Blues (http://tech.bluesmoon.info/), Luke
Godfrey, Pul, uestla, Alan C, Ulrich, Rafal Kukawski, Yves Sucaet,
sowberry, Norman "zEh" Fuchs, hitwork, Zahlii, johnrembo, Nick Callen,
Steven Levithan (stevenlevithan.com), ejsanders, Scott Baker, Brian Tafoya
(http://www.premasolutions.com/), Philippe Jausions
(http://pear.php.net/user/jausions), Aidan Lister
(http://aidanlister.com/), Rob, e-mike, HKM, ChaosNo1, metjay, strcasecmp,
strcmp, Taras Bogach, jpfle, Alexander Ermolaev
(http://snippets.dzone.com/user/AlexanderErmolaev), DxGx, kilops, Orlando,
dptr1988, Le Torbi, James (http://www.james-bell.co.uk/), Pedro Tainha
(http://www.pedrotainha.com), James, Arnout Kazemier
(http://www.3rd-Eden.com), Chris McMacken, gabriel paderni, Yannoo,
FGFEmperor, baris ozdil, Tod Gentille, Greg Frazier, jakes, 3D-GRAF, Allan
Jensen (http://www.winternet.no), Howard Yeend, Benjamin Lupton, davook,
daniel airton wermann (http://wermann.com.br), Atli T¨®r, Maximusya, Ryan
W Tenney (http://ryan.10e.us), Alexander M Beedie, fearphage
(http://http/my.opera.com/fearphage/), Nathan Sepulveda, Victor, Matteo,
Billy, stensi, Cord, Manish, T.J. Leahy, Riddler
(http://www.frontierwebdev.com/), Rafa? Kukawski, FremyCompany, Matt
Bradley, Tim de Koning, Luis Salazar (http://www.freaky-media.com/), Diogo
Resende, Rival, Andrej Pavlovic, Garagoth, Le Torbi
(http://www.letorbi.de/), Dino, Josep Sanz (http://www.ws3.es/), rem,
Russell Walker (http://www.nbill.co.uk/), Jamie Beck
(http://www.terabit.ca/), setcookie, Michael, YUI Library:
http://developer.yahoo.com/yui/docs/YAHOO.util.DateLocale.html, Blues at
http://hacks.bluesmoon.info/strftime/strftime.js, Ben
(http://benblume.co.uk/), DtTvB
(http://dt.in.th/2008-09-16.string-length-in-bytes.html), Andreas, William,
meo, incidence, Cagri Ekin, Amirouche, Amir Habibi
(http://www.residence-mixte.com/), Luke Smith (http://lucassmith.name),
Kheang Hok Chin (http://www.distantia.ca/), Jay Klehr, Lorenzo Pisani,
Tony, Yen-Wei Liu, Greenseed, mk.keck, Leslie Hoare, dude, booeyOH, Ben
Bryan

Licensed under the MIT (MIT-LICENSE.txt) license.

Permission is hereby granted, free of charge, to any person obtaining a
copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:

The above copyright notice and this permission notice shall be included
in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL KEVIN VAN ZONNEVELD BE LIABLE FOR ANY CLAIM, DAMAGES
OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE.
*/

/**
 * @license
 *
 * Grauw URI utilities
 *
 * See: http://hg.grauw.nl/grauw-lib/file/tip/src/uri.js
 *
 * @author Laurens Holst (http://www.grauw.nl/)
 *
 *   Copyright 2012 Laurens Holst
 *
 *   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.
 *
 */

!function(){define("Core/defined",[],function(){"use strict";var e=function(e){return void 0!==e};return e}),define("Core/freezeObject",["./defined"],function(e){"use strict";var t=Object.freeze;return e(t)||(t=function(e){return e}),t}),define("Core/defaultValue",["./freezeObject"],function(e){"use strict";var t=function(e,t){return void 0!==e?e:t};return t.EMPTY_OBJECT=e({}),t}),define("Core/DeveloperError",["./defined"],function(e){"use strict";var t=function(e){this.name="DeveloperError",this.message=e;var t;try{throw new Error}catch(r){t=r.stack}this.stack=t};return t.prototype.toString=function(){var t=this.name+": "+this.message;return e(this.stack)&&(t+="\n"+this.stack.toString()),t},t.throwInstantiationError=function(){throw new t("This function defines an interface and should not be called directly.")},t}),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,t=new Array(0,this.MATRIX_A);if(this.mti>=this.N){var r;for(this.mti==this.N+1&&this.init_genrand(5489),r=0;r<this.N-this.M;r++)e=this.mt[r]&this.UPPER_MASK|this.mt[r+1]&this.LOWER_MASK,this.mt[r]=this.mt[r+this.M]^e>>>1^t[1&e];for(;r<this.N-1;r++)e=this.mt[r]&this.UPPER_MASK|this.mt[r+1]&this.LOWER_MASK,this.mt[r]=this.mt[r+(this.M-this.N)]^e>>>1^t[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^t[1&e],this.mti=0}return e=this.mt[this.mti++],e^=e>>>11,e^=2636928640&e<<7,e^=4022730752&e<<15,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,t){"use strict";var r={};r.EPSILON1=.1,r.EPSILON2=.01,r.EPSILON3=.001,r.EPSILON4=1e-4,r.EPSILON5=1e-5,r.EPSILON6=1e-6,r.EPSILON7=1e-7,r.EPSILON8=1e-8,r.EPSILON9=1e-9,r.EPSILON10=1e-10,r.EPSILON11=1e-11,r.EPSILON12=1e-12,r.EPSILON13=1e-13,r.EPSILON14=1e-14,r.EPSILON15=1e-15,r.EPSILON16=1e-16,r.EPSILON17=1e-17,r.EPSILON18=1e-18,r.EPSILON19=1e-19,r.EPSILON20=1e-20,r.GRAVITATIONALPARAMETER=3986004418e5,r.SOLAR_RADIUS=6955e5,r.LUNAR_RADIUS=1737400,r.SIXTY_FOUR_KILOBYTES=65536,r.sign=function(e){return e>0?1:0>e?-1:0},r.signNotZero=function(e){return 0>e?-1:1},r.toSNorm=function(e){return Math.round(255*(.5*r.clamp(e,-1,1)+.5))},r.fromSNorm=function(e){return 2*(r.clamp(e,0,255)/255)-1},r.sinh=function(e){var t=Math.pow(Math.E,e),r=Math.pow(Math.E,-1*e);return.5*(t-r)},r.cosh=function(e){var t=Math.pow(Math.E,e),r=Math.pow(Math.E,-1*e);return.5*(t+r)},r.lerp=function(e,t,r){return(1-r)*e+r*t},r.PI=Math.PI,r.ONE_OVER_PI=1/Math.PI,r.PI_OVER_TWO=.5*Math.PI,r.PI_OVER_THREE=Math.PI/3,r.PI_OVER_FOUR=Math.PI/4,r.PI_OVER_SIX=Math.PI/6,r.THREE_PI_OVER_TWO=.5*3*Math.PI,r.TWO_PI=2*Math.PI,r.ONE_OVER_TWO_PI=1/(2*Math.PI),r.RADIANS_PER_DEGREE=Math.PI/180,r.DEGREES_PER_RADIAN=180/Math.PI,r.RADIANS_PER_ARCSECOND=r.RADIANS_PER_DEGREE/3600,r.toRadians=function(e){return e*r.RADIANS_PER_DEGREE},r.toDegrees=function(e){return e*r.DEGREES_PER_RADIAN},r.convertLongitudeRange=function(e){var t=r.TWO_PI,n=e-Math.floor(e/t)*t;return n<-Math.PI?n+t:n>=Math.PI?n-t:n},r.negativePiToPi=function(e){return r.zeroToTwoPi(e+r.PI)-r.PI},r.zeroToTwoPi=function(e){var t=r.mod(e,r.TWO_PI);return Math.abs(t)<r.EPSILON14&&Math.abs(e)>r.EPSILON14?r.TWO_PI:t},r.mod=function(e,t){return(e%t+t)%t},r.equalsEpsilon=function(e,r,n,a){a=t(a,n);var i=Math.abs(e-r);return a>=i||i<=n*Math.max(Math.abs(e),Math.abs(r))};var n=[1];r.factorial=function(e){var t=n.length;if(e>=t)for(var r=n[t-1],a=t;e>=a;a++)n.push(r*a);return n[e]},r.incrementWrap=function(e,r,n){return n=t(n,0),++e,e>r&&(e=n),e},r.isPowerOfTwo=function(e){return 0!==e&&0===(e&e-1)},r.nextPowerOfTwo=function(e){return--e,e|=e>>1,e|=e>>2,e|=e>>4,e|=e>>8,e|=e>>16,++e,e},r.clamp=function(e,t,r){return t>e?t:e>r?r:e};var a=new e;return r.setRandomNumberSeed=function(t){a=new e(t)},r.nextRandomNumber=function(){return a.random()},r.acosClamped=function(e){return Math.acos(r.clamp(e,-1,1))},r.asinClamped=function(e){return Math.asin(r.clamp(e,-1,1))},r.chordLength=function(e,t){return 2*t*Math.sin(.5*e)},r}),define("Core/Cartesian3",["./defaultValue","./defined","./DeveloperError","./freezeObject","./Math"],function(e,t,r,n,a){"use strict";var i=function(t,r,n){this.x=e(t,0),this.y=e(r,0),this.z=e(n,0)};i.fromSpherical=function(r,n){t(n)||(n=new i);var a=r.clock,o=r.cone,u=e(r.magnitude,1),s=u*Math.sin(o);return n.x=s*Math.cos(a),n.y=s*Math.sin(a),n.z=u*Math.cos(o),n},i.fromElements=function(e,r,n,a){return t(a)?(a.x=e,a.y=r,a.z=n,a):new i(e,r,n)},i.clone=function(e,r){return t(e)?t(r)?(r.x=e.x,r.y=e.y,r.z=e.z,r):new i(e.x,e.y,e.z):void 0},i.fromCartesian4=i.clone,i.packedLength=3,i.pack=function(t,r,n){n=e(n,0),r[n++]=t.x,r[n++]=t.y,r[n]=t.z},i.unpack=function(r,n,a){return n=e(n,0),t(a)||(a=new i),a.x=r[n++],a.y=r[n++],a.z=r[n],a},i.fromArray=i.unpack,i.maximumComponent=function(e){return Math.max(e.x,e.y,e.z)},i.minimumComponent=function(e){return Math.min(e.x,e.y,e.z)},i.minimumByComponent=function(e,t,r){return r.x=Math.min(e.x,t.x),r.y=Math.min(e.y,t.y),r.z=Math.min(e.z,t.z),r},i.maximumByComponent=function(e,t,r){return r.x=Math.max(e.x,t.x),r.y=Math.max(e.y,t.y),r.z=Math.max(e.z,t.z),r},i.magnitudeSquared=function(e){return e.x*e.x+e.y*e.y+e.z*e.z},i.magnitude=function(e){return Math.sqrt(i.magnitudeSquared(e))};var o=new i;i.distance=function(e,t){return i.subtract(e,t,o),i.magnitude(o)},i.distanceSquared=function(e,t){return i.subtract(e,t,o),i.magnitudeSquared(o)},i.normalize=function(e,t){var r=i.magnitude(e);return t.x=e.x/r,t.y=e.y/r,t.z=e.z/r,t},i.dot=function(e,t){return e.x*t.x+e.y*t.y+e.z*t.z},i.multiplyComponents=function(e,t,r){return r.x=e.x*t.x,r.y=e.y*t.y,r.z=e.z*t.z,r},i.add=function(e,t,r){return r.x=e.x+t.x,r.y=e.y+t.y,r.z=e.z+t.z,r},i.subtract=function(e,t,r){return r.x=e.x-t.x,r.y=e.y-t.y,r.z=e.z-t.z,r},i.multiplyByScalar=function(e,t,r){return r.x=e.x*t,r.y=e.y*t,r.z=e.z*t,r},i.divideByScalar=function(e,t,r){return r.x=e.x/t,r.y=e.y/t,r.z=e.z/t,r},i.negate=function(e,t){return t.x=-e.x,t.y=-e.y,t.z=-e.z,t},i.abs=function(e,t){return t.x=Math.abs(e.x),t.y=Math.abs(e.y),t.z=Math.abs(e.z),t};var u=new i;i.lerp=function(e,t,r,n){return i.multiplyByScalar(t,r,u),n=i.multiplyByScalar(e,1-r,n),i.add(u,n,n)};var s=new i,c=new i;i.angleBetween=function(e,t){i.normalize(e,s),i.normalize(t,c);var r=i.dot(s,c),n=i.magnitude(i.cross(s,c,s));return Math.atan2(n,r)};var l=new i;i.mostOrthogonalAxis=function(e,t){var r=i.normalize(e,l);return i.abs(r,r),t=r.x<=r.y?r.x<=r.z?i.clone(i.UNIT_X,t):i.clone(i.UNIT_Z,t):r.y<=r.z?i.clone(i.UNIT_Y,t):i.clone(i.UNIT_Z,t)},i.equals=function(e,r){return e===r||t(e)&&t(r)&&e.x===r.x&&e.y===r.y&&e.z===r.z},i.equalsArray=function(e,t,r){return e.x===t[r]&&e.y===t[r+1]&&e.z===t[r+2]},i.equalsEpsilon=function(e,r,n,i){return e===r||t(e)&&t(r)&&a.equalsEpsilon(e.x,r.x,n,i)&&a.equalsEpsilon(e.y,r.y,n,i)&&a.equalsEpsilon(e.z,r.z,n,i)},i.cross=function(e,t,r){var n=e.x,a=e.y,i=e.z,o=t.x,u=t.y,s=t.z,c=a*s-i*u,l=i*o-n*s,f=n*u-a*o;return r.x=c,r.y=l,r.z=f,r},i.fromDegrees=function(e,t,r,n,o){var u=a.toRadians(e),s=a.toRadians(t);return i.fromRadians(u,s,r,n,o)};var f=new i,d=new i,h=new i(40680631590769,40680631590769,40408299984661.445);return i.fromRadians=function(r,n,a,o,u){a=e(a,0);var s=t(o)?o.radiiSquared:h,c=Math.cos(n);f.x=c*Math.cos(r),f.y=c*Math.sin(r),f.z=Math.sin(n),f=i.normalize(f,f),i.multiplyComponents(s,f,d);var l=Math.sqrt(i.dot(f,d));return d=i.divideByScalar(d,l,d),f=i.multiplyByScalar(f,a,f),t(u)||(u=new i),i.add(d,f,u)},i.fromDegreesArray=function(e,t,r){for(var n=new Array(e.length),o=0;o<e.length;o++)n[o]=a.toRadians(e[o]);return i.fromRadiansArray(n,t,r)},i.fromRadiansArray=function(e,r,n){var a=e.length;t(n)?n.length=a/2:n=new Array(a/2);for(var o=0;a>o;o+=2){var u=e[o],s=e[o+1];n[o/2]=i.fromRadians(u,s,0,r,n[o/2])}return n},i.fromDegreesArrayHeights=function(e,t,r){for(var n=new Array(e.length),o=0;o<e.length;o+=3)n[o]=a.toRadians(e[o]),n[o+1]=a.toRadians(e[o+1]),n[o+2]=e[o+2];return i.fromRadiansArrayHeights(n,t,r)},i.fromRadiansArrayHeights=function(e,r,n){var a=e.length;t(n)?n.length=a/3:n=new Array(a/3);for(var o=0;a>o;o+=3){var u=e[o],s=e[o+1],c=e[o+2];n[o/3]=i.fromRadians(u,s,c,r,n[o/3])}return n},i.ZERO=n(new i(0,0,0)),i.UNIT_X=n(new i(1,0,0)),i.UNIT_Y=n(new i(0,1,0)),i.UNIT_Z=n(new i(0,0,1)),i.prototype.clone=function(e){return i.clone(this,e)},i.prototype.equals=function(e){return i.equals(this,e)},i.prototype.equalsEpsilon=function(e,t,r){return i.equalsEpsilon(this,e,t,r)},i.prototype.toString=function(){return"("+this.x+", "+this.y+", "+this.z+")"},i}),define("Core/Cartographic",["./defaultValue","./defined","./DeveloperError","./freezeObject","./Math"],function(e,t,r,n,a){"use strict";var i=function(t,r,n){this.longitude=e(t,0),this.latitude=e(r,0),this.height=e(n,0)};return i.fromRadians=function(r,n,a,o){return a=e(a,0),t(o)?(o.longitude=r,o.latitude=n,o.height=a,o):new i(r,n,a)},i.fromDegrees=function(e,t,r,n){return e=a.toRadians(e),t=a.toRadians(t),i.fromRadians(e,t,r,n)},i.clone=function(e,r){return t(e)?t(r)?(r.longitude=e.longitude,r.latitude=e.latitude,r.height=e.height,r):new i(e.longitude,e.latitude,e.height):void 0},i.equals=function(e,r){return e===r||t(e)&&t(r)&&e.longitude===r.longitude&&e.latitude===r.latitude&&e.height===r.height},i.equalsEpsilon=function(e,r,n){return e===r||t(e)&&t(r)&&Math.abs(e.longitude-r.longitude)<=n&&Math.abs(e.latitude-r.latitude)<=n&&Math.abs(e.height-r.height)<=n},i.ZERO=n(new i(0,0,0)),i.prototype.clone=function(e){return i.clone(this,e)},i.prototype.equals=function(e){return i.equals(this,e)},i.prototype.equalsEpsilon=function(e,t){return i.equalsEpsilon(this,e,t)},i.prototype.toString=function(){return"("+this.longitude+", "+this.latitude+", "+this.height+")"},i}),define("Core/defineProperties",["./defined"],function(e){"use strict";var t=function(){try{return"x"in Object.defineProperty({},"x",{})}catch(e){return!1}}(),r=Object.defineProperties;return t&&e(r)||(r=function(e){return e}),r}),define("Core/Ellipsoid",["./Cartesian3","./Cartographic","./defaultValue","./defined","./defineProperties","./DeveloperError","./freezeObject","./Math"],function(e,t,r,n,a,i,o,u){"use strict";function s(t,n,a,i){n=r(n,0),a=r(a,0),i=r(i,0),t._radii=new e(n,a,i),t._radiiSquared=new e(n*n,a*a,i*i),t._radiiToTheFourth=new e(n*n*n*n,a*a*a*a,i*i*i*i),t._oneOverRadii=new e(0===n?0:1/n,0===a?0:1/a,0===i?0:1/i),t._oneOverRadiiSquared=new e(0===n?0:1/(n*n),0===a?0:1/(a*a),0===i?0:1/(i*i)),t._minimumRadius=Math.min(n,a,i),t._maximumRadius=Math.max(n,a,i),t._centerToleranceSquared=u.EPSILON1}var c=function(e,t,r){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,s(this,e,t,r)};a(c.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}}}),c.clone=function(t,r){if(!n(t))return void 0;var a=t._radii;return n(r)?(e.clone(a,r._radii),e.clone(t._radiiSquared,r._radiiSquared),e.clone(t._radiiToTheFourth,r._radiiToTheFourth),e.clone(t._oneOverRadii,r._oneOverRadii),e.clone(t._oneOverRadiiSquared,r._oneOverRadiiSquared),r._minimumRadius=t._minimumRadius,r._maximumRadius=t._maximumRadius,r._centerToleranceSquared=t._centerToleranceSquared,r):new c(a.x,a.y,a.z)},c.fromCartesian3=function(e,t){return n(t)||(t=new c),n(e)?(s(t,e.x,e.y,e.z),t):t},c.WGS84=o(new c(6378137,6378137,6356752.314245179)),c.UNIT_SPHERE=o(new c(1,1,1)),c.MOON=o(new c(u.LUNAR_RADIUS,u.LUNAR_RADIUS,u.LUNAR_RADIUS)),c.prototype.clone=function(e){return c.clone(this,e)},c.packedLength=e.packedLength,c.pack=function(t,n,a){a=r(a,0),e.pack(t._radii,n,a)},c.unpack=function(t,n,a){n=r(n,0);var i=e.unpack(t,n);return c.fromCartesian3(i,a)},c.prototype.geocentricSurfaceNormal=e.normalize,c.prototype.geodeticSurfaceNormalCartographic=function(t,r){var a=t.longitude,i=t.latitude,o=Math.cos(i),u=o*Math.cos(a),s=o*Math.sin(a),c=Math.sin(i);return n(r)||(r=new e),r.x=u,r.y=s,r.z=c,e.normalize(r,r)},c.prototype.geodeticSurfaceNormal=function(t,r){return n(r)||(r=new e),r=e.multiplyComponents(t,this._oneOverRadiiSquared,r),e.normalize(r,r)};var l=new e,f=new e;c.prototype.cartographicToCartesian=function(t,r){var a=l,i=f;this.geodeticSurfaceNormalCartographic(t,a),e.multiplyComponents(this._radiiSquared,a,i);var o=Math.sqrt(e.dot(a,i));return e.divideByScalar(i,o,i),e.multiplyByScalar(a,t.height,a),n(r)||(r=new e),e.add(i,a,r)},c.prototype.cartographicArrayToCartesianArray=function(e,t){var r=e.length;n(t)?t.length=r:t=new Array(r);for(var a=0;r>a;a++)t[a]=this.cartographicToCartesian(e[a],t[a]);return t};var d=new e,h=new e,m=new e;c.prototype.cartesianToCartographic=function(r,a){var i=this.scaleToGeodeticSurface(r,h);if(!n(i))return void 0;var o=this.geodeticSurfaceNormal(i,d),s=e.subtract(r,i,m),c=Math.atan2(o.y,o.x),l=Math.asin(o.z),f=u.sign(e.dot(s,r))*e.magnitude(s);return n(a)?(a.longitude=c,a.latitude=l,a.height=f,a):new t(c,l,f)},c.prototype.cartesianArrayToCartographicArray=function(e,t){var r=e.length;n(t)?t.length=r:t=new Array(r);for(var a=0;r>a;++a)t[a]=this.cartesianToCartographic(e[a],t[a]);return t};var p=new e,y=new e;return c.prototype.scaleToGeodeticSurface=function(t,r){var a=t.x,i=t.y,o=t.z,s=this._oneOverRadii,c=s.x,l=s.y,f=s.z,d=a*a*c*c,h=i*i*l*l,m=o*o*f*f,v=d+h+m,g=Math.sqrt(1/v),w=e.multiplyByScalar(t,g,p);if(v<this._centerToleranceSquared)return isFinite(g)?e.clone(w,r):void 0;var x=this._oneOverRadiiSquared,E=x.x,S=x.y,O=x.z,T=y;T.x=2*w.x*E,T.y=2*w.y*S,T.z=2*w.z*O;var b,M,_,P,N,A,I,R,z,C,D,L=(1-g)*e.magnitude(t)/(.5*e.magnitude(T)),q=0;do{L-=q,_=1/(1+L*E),P=1/(1+L*S),N=1/(1+L*O),A=_*_,I=P*P,R=N*N,z=A*_,C=I*P,D=R*N,b=d*A+h*I+m*R-1,M=d*z*E+h*C*S+m*D*O;var U=-2*M;q=b/U}while(Math.abs(b)>u.EPSILON12);return n(r)?(r.x=a*_,r.y=i*P,r.z=o*N,r):new e(a*_,i*P,o*N)},c.prototype.scaleToGeocentricSurface=function(t,r){n(r)||(r=new e);var a=t.x,i=t.y,o=t.z,u=this._oneOverRadiiSquared,s=1/Math.sqrt(a*a*u.x+i*i*u.y+o*o*u.z);return e.multiplyByScalar(t,s,r)},c.prototype.transformPositionToScaledSpace=function(t,r){return n(r)||(r=new e),e.multiplyComponents(t,this._oneOverRadii,r)},c.prototype.transformPositionFromScaledSpace=function(t,r){return n(r)||(r=new e),e.multiplyComponents(t,this._radii,r)},c.prototype.equals=function(t){return this===t||n(t)&&e.equals(this._radii,t._radii)},c.prototype.toString=function(){return this._radii.toString()},c}),define("Core/Rectangle",["./Cartographic","./defaultValue","./defined","./defineProperties","./DeveloperError","./Ellipsoid","./freezeObject","./Math"],function(e,t,r,n,a,i,o,u){"use strict";var s=function(e,r,n,a){this.west=t(e,0),this.south=t(r,0),this.east=t(n,0),this.north=t(a,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,r,n){n=t(n,0),r[n++]=e.west,r[n++]=e.south,r[n++]=e.east,r[n]=e.north},s.unpack=function(e,n,a){return n=t(n,0),r(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){var t=e.east,r=e.west;return r>t&&(t+=u.TWO_PI),t-r},s.computeHeight=function(e){return e.north-e.south},s.fromDegrees=function(e,n,a,i,o){return e=u.toRadians(t(e,0)),n=u.toRadians(t(n,0)),a=u.toRadians(t(a,0)),i=u.toRadians(t(i,0)),r(o)?(o.west=e,o.south=n,o.east=a,o.north=i,o):new s(e,n,a,i)},s.fromCartographicArray=function(e,t){for(var n=Number.MAX_VALUE,a=-Number.MAX_VALUE,i=Number.MAX_VALUE,o=-Number.MAX_VALUE,u=0,c=e.length;c>u;u++){var l=e[u];n=Math.min(n,l.longitude),a=Math.max(a,l.longitude),i=Math.min(i,l.latitude),o=Math.max(o,l.latitude)}return r(t)?(t.west=n,t.south=i,t.east=a,t.north=o,t):new s(n,i,a,o)},s.packedLength=4,s.pack=function(e,r,n){n=t(n,0),r[n++]=e.west,r[n++]=e.south,r[n++]=e.east,r[n]=e.north},s.unpack=function(e,n,a){return n=t(n,0),r(a)||(a=new s),a.west=e[n++],a.south=e[n++],a.east=e[n++],a.north=e[n],a},s.clone=function(e,t){return r(e)?r(t)?(t.west=e.west,t.south=e.south,t.east=e.east,t.north=e.north,t):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,t){return e===t||r(e)&&r(t)&&e.west===t.west&&e.south===t.south&&e.east===t.east&&e.north===t.north},s.prototype.equalsEpsilon=function(e,t){return r(e)&&Math.abs(this.west-e.west)<=t&&Math.abs(this.south-e.south)<=t&&Math.abs(this.east-e.east)<=t&&Math.abs(this.north-e.north)<=t},s.validate=function(){},s.southwest=function(t,n){return r(n)?(n.longitude=t.west,n.latitude=t.south,n.height=0,n):new e(t.west,t.south)},s.northwest=function(t,n){return r(n)?(n.longitude=t.west,n.latitude=t.north,n.height=0,n):new e(t.west,t.north)},s.northeast=function(t,n){return r(n)?(n.longitude=t.east,n.latitude=t.north,n.height=0,n):new e(t.east,t.north)},s.southeast=function(t,n){return r(n)?(n.longitude=t.east,n.latitude=t.south,n.height=0,n):new e(t.east,t.south)},s.center=function(t,n){var a=t.east,i=t.west;i>a&&(a+=u.TWO_PI);var o=u.negativePiToPi(.5*(i+a)),s=.5*(t.south+t.north);return r(n)?(n.longitude=o,n.latitude=s,n.height=0,n):new e(o,s)},s.intersection=function(e,t,n){var a=e.east,i=e.west,o=t.east,c=t.west;i>a&&o>0?a+=u.TWO_PI:c>o&&a>0&&(o+=u.TWO_PI),i>a&&0>c?c+=u.TWO_PI:c>o&&0>i&&(i+=u.TWO_PI);var l=u.negativePiToPi(Math.max(i,c)),f=u.negativePiToPi(Math.min(a,o));if((e.west<e.east||t.west<t.east)&&l>=f)return void 0;var d=Math.max(e.south,t.south),h=Math.min(e.north,t.north);return d>=h?void 0:r(n)?(n.west=l,n.south=d,n.east=f,n.north=h,n):new s(l,d,f,h)},s.contains=function(e,t){var r=t.longitude,n=t.latitude,a=e.west,i=e.east;return a>i&&(i+=u.TWO_PI,0>r&&(r+=u.TWO_PI)),(r>a||u.equalsEpsilon(r,a,u.EPSILON14))&&(i>r||u.equalsEpsilon(r,i,u.EPSILON14))&&n>=e.south&&n<=e.north};var c=new e;return s.subsample=function(e,n,a,o){n=t(n,i.WGS84),a=t(a,0),r(o)||(o=[]);var l=0,f=e.north,d=e.south,h=e.east,m=e.west,p=c;p.height=a,p.longitude=m,p.latitude=f,o[l]=n.cartographicToCartesian(p,o[l]),l++,p.longitude=h,o[l]=n.cartographicToCartesian(p,o[l]),l++,p.latitude=d,o[l]=n.cartographicToCartesian(p,o[l]),l++,p.longitude=m,o[l]=n.cartographicToCartesian(p,o[l]),l++,p.latitude=0>f?f:d>0?d:0;for(var y=1;8>y;++y)p.longitude=-Math.PI+y*u.PI_OVER_TWO,s.contains(e,p)&&(o[l]=n.cartographicToCartesian(p,o[l]),l++);return 0===p.latitude&&(p.longitude=m,o[l]=n.cartographicToCartesian(p,o[l]),l++,p.longitude=h,o[l]=n.cartographicToCartesian(p,o[l]),l++),o.length=l,o},s.MAX_VALUE=o(new s(-Math.PI,-u.PI_OVER_TWO,Math.PI,u.PI_OVER_TWO)),s}),define("Core/GeographicProjection",["./Cartesian3","./Cartographic","./defaultValue","./defined","./defineProperties","./DeveloperError","./Ellipsoid"],function(e,t,r,n,a,i,o){"use strict";var u=function(e){this._ellipsoid=r(e,o.WGS84),this._semimajorAxis=this._ellipsoid.maximumRadius,this._oneOverSemimajorAxis=1/this._semimajorAxis};return a(u.prototype,{ellipsoid:{get:function(){return this._ellipsoid}}}),u.prototype.project=function(t,r){var a=this._semimajorAxis,i=t.longitude*a,o=t.latitude*a,u=t.height;return n(r)?(r.x=i,r.y=o,r.z=u,r):new e(i,o,u)},u.prototype.unproject=function(e,r){var a=this._oneOverSemimajorAxis,i=e.x*a,o=e.y*a,u=e.z;return n(r)?(r.longitude=i,r.latitude=o,r.height=u,r):new t(i,o,u)},u}),define("Core/Intersect",["./freezeObject"],function(e){"use strict";var t={OUTSIDE:-1,INTERSECTING:0,INSIDE:1};return e(t)}),define("Core/Interval",["./defaultValue"],function(e){"use strict";var t=function(t,r){this.start=e(t,0),this.stop=e(r,0)};return t}),define("Core/Cartesian4",["./defaultValue","./defined","./DeveloperError","./freezeObject","./Math"],function(e,t,r,n,a){"use strict";var i=function(t,r,n,a){this.x=e(t,0),this.y=e(r,0),this.z=e(n,0),this.w=e(a,0)};i.fromElements=function(e,r,n,a,o){return t(o)?(o.x=e,o.y=r,o.z=n,o.w=a,o):new i(e,r,n,a)},i.fromColor=function(e,r){return t(r)?(r.x=e.red,r.y=e.green,r.z=e.blue,r.w=e.alpha,r):new i(e.red,e.green,e.blue,e.alpha)},i.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 i(e.x,e.y,e.z,e.w):void 0},i.packedLength=4,i.pack=function(t,r,n){n=e(n,0),r[n++]=t.x,r[n++]=t.y,r[n++]=t.z,r[n]=t.w},i.unpack=function(r,n,a){return n=e(n,0),t(a)||(a=new i),a.x=r[n++],a.y=r[n++],a.z=r[n++],a.w=r[n],a},i.fromArray=i.unpack,i.maximumComponent=function(e){return Math.max(e.x,e.y,e.z,e.w)},i.minimumComponent=function(e){return Math.min(e.x,e.y,e.z,e.w)},i.minimumByComponent=function(e,t,r){return r.x=Math.min(e.x,t.x),r.y=Math.min(e.y,t.y),r.z=Math.min(e.z,t.z),r.w=Math.min(e.w,t.w),r},i.maximumByComponent=function(e,t,r){return r.x=Math.max(e.x,t.x),r.y=Math.max(e.y,t.y),r.z=Math.max(e.z,t.z),r.w=Math.max(e.w,t.w),r},i.magnitudeSquared=function(e){return e.x*e.x+e.y*e.y+e.z*e.z+e.w*e.w},i.magnitude=function(e){return Math.sqrt(i.magnitudeSquared(e))};var o=new i;i.distance=function(e,t){return i.subtract(e,t,o),i.magnitude(o)},i.distanceSquared=function(e,t){return i.subtract(e,t,o),i.magnitudeSquared(o)},i.normalize=function(e,t){var r=i.magnitude(e);return t.x=e.x/r,t.y=e.y/r,t.z=e.z/r,t.w=e.w/r,t},i.dot=function(e,t){return e.x*t.x+e.y*t.y+e.z*t.z+e.w*t.w},i.multiplyComponents=function(e,t,r){return r.x=e.x*t.x,r.y=e.y*t.y,r.z=e.z*t.z,r.w=e.w*t.w,r},i.add=function(e,t,r){return r.x=e.x+t.x,r.y=e.y+t.y,r.z=e.z+t.z,r.w=e.w+t.w,r},i.subtract=function(e,t,r){return r.x=e.x-t.x,r.y=e.y-t.y,r.z=e.z-t.z,r.w=e.w-t.w,r},i.multiplyByScalar=function(e,t,r){return r.x=e.x*t,r.y=e.y*t,r.z=e.z*t,r.w=e.w*t,r},i.divideByScalar=function(e,t,r){return r.x=e.x/t,r.y=e.y/t,r.z=e.z/t,r.w=e.w/t,r},i.negate=function(e,t){return t.x=-e.x,t.y=-e.y,t.z=-e.z,t.w=-e.w,t},i.abs=function(e,t){return t.x=Math.abs(e.x),t.y=Math.abs(e.y),t.z=Math.abs(e.z),t.w=Math.abs(e.w),t};var u=new i;i.lerp=function(e,t,r,n){return i.multiplyByScalar(t,r,u),n=i.multiplyByScalar(e,1-r,n),i.add(u,n,n)};var s=new i;return i.mostOrthogonalAxis=function(e,t){var r=i.normalize(e,s);return i.abs(r,r),t=r.x<=r.y?r.x<=r.z?r.x<=r.w?i.clone(i.UNIT_X,t):i.clone(i.UNIT_W,t):r.z<=r.w?i.clone(i.UNIT_Z,t):i.clone(i.UNIT_W,t):r.y<=r.z?r.y<=r.w?i.clone(i.UNIT_Y,t):i.clone(i.UNIT_W,t):r.z<=r.w?i.clone(i.UNIT_Z,t):i.clone(i.UNIT_W,t)},i.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},i.equalsArray=function(e,t,r){return e.x===t[r]&&e.y===t[r+1]&&e.z===t[r+2]&&e.w===t[r+3]},i.equalsEpsilon=function(e,r,n,i){return e===r||t(e)&&t(r)&&a.equalsEpsilon(e.x,r.x,n,i)&&a.equalsEpsilon(e.y,r.y,n,i)&&a.equalsEpsilon(e.z,r.z,n,i)&&a.equalsEpsilon(e.w,r.w,n,i)},i.ZERO=n(new i(0,0,0,0)),i.UNIT_X=n(new i(1,0,0,0)),i.UNIT_Y=n(new i(0,1,0,0)),i.UNIT_Z=n(new i(0,0,1,0)),i.UNIT_W=n(new i(0,0,0,1)),i.prototype.clone=function(e){return i.clone(this,e)},i.prototype.equals=function(e){return i.equals(this,e)},i.prototype.equalsEpsilon=function(e,t,r){return i.equalsEpsilon(this,e,t,r)},i.prototype.toString=function(){return"("+this.x+", "+this.y+", "+this.z+", "+this.w+")"},i}),define("Core/Matrix3",["./Cartesian3","./defaultValue","./defined","./DeveloperError","./freezeObject","./Math"],function(e,t,r,n,a,i){"use strict";function o(e){for(var t=0,r=0;9>r;++r){var n=e[r];t+=n*n}return Math.sqrt(t)}function u(e){for(var t=0,r=0;3>r;++r){var n=e[c.getElementIndex(h[r],d[r])];t+=2*n*n}return Math.sqrt(t)}function s(e,t){for(var r=i.EPSILON15,n=0,a=1,o=0;3>o;++o){var u=Math.abs(e[c.getElementIndex(h[o],d[o])]);u>n&&(a=o,n=u)}var s=1,l=0,f=d[a],m=h[a];if(Math.abs(e[c.getElementIndex(m,f)])>r){var p,y=e[c.getElementIndex(m,m)],v=e[c.getElementIndex(f,f)],g=e[c.getElementIndex(m,f)],w=(y-v)/2/g;p=0>w?-1/(-w+Math.sqrt(1+w*w)):1/(w+Math.sqrt(1+w*w)),s=1/Math.sqrt(1+p*p),l=p*s}return t=c.clone(c.IDENTITY,t),t[c.getElementIndex(f,f)]=t[c.getElementIndex(m,m)]=s,t[c.getElementIndex(m,f)]=l,t[c.getElementIndex(f,m)]=-l,t}var c=function(e,r,n,a,i,o,u,s,c){this[0]=t(e,0),this[1]=t(a,0),this[2]=t(u,0),this[3]=t(r,0),this[4]=t(i,0),this[5]=t(s,0),this[6]=t(n,0),this[7]=t(o,0),this[8]=t(c,0)};c.packedLength=9,c.pack=function(e,r,n){n=t(n,0),r[n++]=e[0],r[n++]=e[1],r[n++]=e[2],r[n++]=e[3],r[n++]=e[4],r[n++]=e[5],r[n++]=e[6],r[n++]=e[7],r[n++]=e[8]},c.unpack=function(e,n,a){return n=t(n,0),r(a)||(a=new c),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},c.clone=function(e,t){return r(e)?r(t)?(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):new c(e[0],e[3],e[6],e[1],e[4],e[7],e[2],e[5],e[8]):void 0},c.fromArray=function(e,n,a){return n=t(n,0),r(a)||(a=new c),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},c.fromColumnMajorArray=function(e,t){return c.clone(e,t)},c.fromRowMajorArray=function(e,t){return r(t)?(t[0]=e[0],t[1]=e[3],t[2]=e[6],t[3]=e[1],t[4]=e[4],t[5]=e[7],t[6]=e[2],t[7]=e[5],t[8]=e[8],t):new c(e[0],e[1],e[2],e[3],e[4],e[5],e[6],e[7],e[8])},c.fromQuaternion=function(e,t){var n=e.x*e.x,a=e.x*e.y,i=e.x*e.z,o=e.x*e.w,u=e.y*e.y,s=e.y*e.z,l=e.y*e.w,f=e.z*e.z,d=e.z*e.w,h=e.w*e.w,m=n-u-f+h,p=2*(a-d),y=2*(i+l),v=2*(a+d),g=-n+u-f+h,w=2*(s-o),x=2*(i-l),E=2*(s+o),S=-n-u+f+h;return r(t)?(t[0]=m,t[1]=v,t[2]=x,t[3]=p,t[4]=g,t[5]=E,t[6]=y,t[7]=w,t[8]=S,t):new c(m,p,y,v,g,w,x,E,S)},c.fromScale=function(e,t){return r(t)?(t[0]=e.x,t[1]=0,t[2]=0,t[3]=0,t[4]=e.y,t[5]=0,t[6]=0,t[7]=0,t[8]=e.z,t):new c(e.x,0,0,0,e.y,0,0,0,e.z)},c.fromUniformScale=function(e,t){return r(t)?(t[0]=e,t[1]=0,t[2]=0,t[3]=0,t[4]=e,t[5]=0,t[6]=0,t[7]=0,t[8]=e,t):new c(e,0,0,0,e,0,0,0,e)},c.fromCrossProduct=function(e,t){return r(t)?(t[0]=0,t[1]=e.z,t[2]=-e.y,t[3]=-e.z,t[4]=0,t[5]=e.x,t[6]=e.y,t[7]=-e.x,t[8]=0,t):new c(0,-e.z,e.y,e.z,0,-e.x,-e.y,e.x,0)},c.fromRotationX=function(e,t){var n=Math.cos(e),a=Math.sin(e);return r(t)?(t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=n,t[5]=a,t[6]=0,t[7]=-a,t[8]=n,t):new c(1,0,0,0,n,-a,0,a,n)},c.fromRotationY=function(e,t){var n=Math.cos(e),a=Math.sin(e);return r(t)?(t[0]=n,t[1]=0,t[2]=-a,t[3]=0,t[4]=1,t[5]=0,t[6]=a,t[7]=0,t[8]=n,t):new c(n,0,a,0,1,0,-a,0,n)},c.fromRotationZ=function(e,t){var n=Math.cos(e),a=Math.sin(e);return r(t)?(t[0]=n,t[1]=a,t[2]=0,t[3]=-a,t[4]=n,t[5]=0,t[6]=0,t[7]=0,t[8]=1,t):new c(n,-a,0,a,n,0,0,0,1)},c.toArray=function(e,t){return r(t)?(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):[e[0],e[1],e[2],e[3],e[4],e[5],e[6],e[7],e[8]]},c.getElementIndex=function(e,t){return 3*e+t},c.getColumn=function(e,t,r){var n=3*t,a=e[n],i=e[n+1],o=e[n+2];return r.x=a,r.y=i,r.z=o,r},c.setColumn=function(e,t,r,n){n=c.clone(e,n);var a=3*t;return n[a]=r.x,n[a+1]=r.y,n[a+2]=r.z,n},c.getRow=function(e,t,r){var n=e[t],a=e[t+3],i=e[t+6];return r.x=n,r.y=a,r.z=i,r},c.setRow=function(e,t,r,n){return n=c.clone(e,n),n[t]=r.x,n[t+3]=r.y,n[t+6]=r.z,n};var l=new e;c.getScale=function(t,r){return r.x=e.magnitude(e.fromElements(t[0],t[1],t[2],l)),r.y=e.magnitude(e.fromElements(t[3],t[4],t[5],l)),r.z=e.magnitude(e.fromElements(t[6],t[7],t[8],l)),r};var f=new e;c.getMaximumScale=function(t){return c.getScale(t,f),e.maximumComponent(f)},c.multiply=function(e,t,r){var n=e[0]*t[0]+e[3]*t[1]+e[6]*t[2],a=e[1]*t[0]+e[4]*t[1]+e[7]*t[2],i=e[2]*t[0]+e[5]*t[1]+e[8]*t[2],o=e[0]*t[3]+e[3]*t[4]+e[6]*t[5],u=e[1]*t[3]+e[4]*t[4]+e[7]*t[5],s=e[2]*t[3]+e[5]*t[4]+e[8]*t[5],c=e[0]*t[6]+e[3]*t[7]+e[6]*t[8],l=e[1]*t[6]+e[4]*t[7]+e[7]*t[8],f=e[2]*t[6]+e[5]*t[7]+e[8]*t[8];return r[0]=n,r[1]=a,r[2]=i,r[3]=o,r[4]=u,r[5]=s,r[6]=c,r[7]=l,r[8]=f,r},c.add=function(e,t,r){return r[0]=e[0]+t[0],r[1]=e[1]+t[1],r[2]=e[2]+t[2],r[3]=e[3]+t[3],r[4]=e[4]+t[4],r[5]=e[5]+t[5],r[6]=e[6]+t[6],r[7]=e[7]+t[7],r[8]=e[8]+t[8],r},c.subtract=function(e,t,r){return r[0]=e[0]-t[0],r[1]=e[1]-t[1],r[2]=e[2]-t[2],r[3]=e[3]-t[3],r[4]=e[4]-t[4],r[5]=e[5]-t[5],r[6]=e[6]-t[6],r[7]=e[7]-t[7],r[8]=e[8]-t[8],r},c.multiplyByVector=function(e,t,r){var n=t.x,a=t.y,i=t.z,o=e[0]*n+e[3]*a+e[6]*i,u=e[1]*n+e[4]*a+e[7]*i,s=e[2]*n+e[5]*a+e[8]*i;return r.x=o,r.y=u,r.z=s,r},c.multiplyByScalar=function(e,t,r){return r[0]=e[0]*t,r[1]=e[1]*t,r[2]=e[2]*t,r[3]=e[3]*t,r[4]=e[4]*t,r[5]=e[5]*t,r[6]=e[6]*t,r[7]=e[7]*t,r[8]=e[8]*t,r},c.negate=function(e,t){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},c.transpose=function(e,t){var r=e[0],n=e[3],a=e[6],i=e[1],o=e[4],u=e[7],s=e[2],c=e[5],l=e[8];return t[0]=r,t[1]=n,t[2]=a,t[3]=i,t[4]=o,t[5]=u,t[6]=s,t[7]=c,t[8]=l,t};var d=[1,0,0],h=[2,2,1],m=new c,p=new c;return c.computeEigenDecomposition=function(e,t){var n=i.EPSILON20,a=10,l=0,f=0;r(t)||(t={});for(var d=t.unitary=c.clone(c.IDENTITY,t.unitary),h=t.diagonal=c.clone(e,t.diagonal),y=n*o(h);a>f&&u(h)>y;)s(h,m),c.transpose(m,p),c.multiply(h,m,h),c.multiply(p,h,h),c.multiply(d,m,d),++l>2&&(++f,l=0);return t},c.abs=function(e,t){return t[0]=Math.abs(e[0]),t[1]=Math.abs(e[1]),t[2]=Math.abs(e[2]),t[3]=Math.abs(e[3]),t[4]=Math.abs(e[4]),t[5]=Math.abs(e[5]),t[6]=Math.abs(e[6]),t[7]=Math.abs(e[7]),t[8]=Math.abs(e[8]),t},c.determinant=function(e){var t=e[0],r=e[3],n=e[6],a=e[1],i=e[4],o=e[7],u=e[2],s=e[5],c=e[8];return t*(i*c-s*o)+a*(s*n-r*c)+u*(r*o-i*n)},c.inverse=function(e,t){var r=e[0],a=e[1],o=e[2],u=e[3],s=e[4],l=e[5],f=e[6],d=e[7],h=e[8],m=c.determinant(e);if(Math.abs(m)<=i.EPSILON15)throw new n("matrix is not invertible");t[0]=s*h-d*l,t[1]=d*o-a*h,t[2]=a*l-s*o,t[3]=f*l-u*h,t[4]=r*h-f*o,t[5]=u*o-r*l,t[6]=u*d-f*s,t[7]=f*a-r*d,t[8]=r*s-u*a;var p=1/m;return c.multiplyByScalar(t,p,t)},c.equals=function(e,t){return e===t||r(e)&&r(t)&&e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]&&e[3]===t[3]&&e[4]===t[4]&&e[5]===t[5]&&e[6]===t[6]&&e[7]===t[7]&&e[8]===t[8]},c.equalsEpsilon=function(e,t,n){return e===t||r(e)&&r(t)&&Math.abs(e[0]-t[0])<=n&&Math.abs(e[1]-t[1])<=n&&Math.abs(e[2]-t[2])<=n&&Math.abs(e[3]-t[3])<=n&&Math.abs(e[4]-t[4])<=n&&Math.abs(e[5]-t[5])<=n&&Math.abs(e[6]-t[6])<=n&&Math.abs(e[7]-t[7])<=n&&Math.abs(e[8]-t[8])<=n},c.IDENTITY=a(new c(1,0,0,0,1,0,0,0,1)),c.COLUMN0ROW0=0,c.COLUMN0ROW1=1,c.COLUMN0ROW2=2,c.COLUMN1ROW0=3,c.COLUMN1ROW1=4,c.COLUMN1ROW2=5,c.COLUMN2ROW0=6,c.COLUMN2ROW1=7,c.COLUMN2ROW2=8,c.prototype.clone=function(e){return c.clone(this,e)},c.prototype.equals=function(e){return c.equals(this,e)},c.equalsArray=function(e,t,r){return e[0]===t[r]&&e[1]===t[r+1]&&e[2]===t[r+2]&&e[3]===t[r+3]&&e[4]===t[r+4]&&e[5]===t[r+5]&&e[6]===t[r+6]&&e[7]===t[r+7]&&e[8]===t[r+8]},c.prototype.equalsEpsilon=function(e,t){return c.equalsEpsilon(this,e,t)},c.prototype.toString=function(){return"("+this[0]+", "+this[3]+", "+this[6]+")\n"+"("+this[1]+", "+this[4]+", "+this[7]+")\n"+"("+this[2]+", "+this[5]+", "+this[8]+")"},c}),define("Core/RuntimeError",["./defined"],function(e){"use strict";var t=function(e){this.name="RuntimeError",this.message=e;var t;try{throw new Error}catch(r){t=r.stack}this.stack=t};return t.prototype.toString=function(){var t=this.name+": "+this.message;return e(this.stack)&&(t+="\n"+this.stack.toString()),t},t}),define("Core/Matrix4",["./Cartesian3","./Cartesian4","./defaultValue","./defined","./DeveloperError","./freezeObject","./Math","./Matrix3","./RuntimeError"],function(e,t,r,n,a,i,o,u,s){"use strict";
var c=function(e,t,n,a,i,o,u,s,c,l,f,d,h,m,p,y){this[0]=r(e,0),this[1]=r(i,0),this[2]=r(c,0),this[3]=r(h,0),this[4]=r(t,0),this[5]=r(o,0),this[6]=r(l,0),this[7]=r(m,0),this[8]=r(n,0),this[9]=r(u,0),this[10]=r(f,0),this[11]=r(p,0),this[12]=r(a,0),this[13]=r(s,0),this[14]=r(d,0),this[15]=r(y,0)};c.packedLength=16,c.pack=function(e,t,n){n=r(n,0),t[n++]=e[0],t[n++]=e[1],t[n++]=e[2],t[n++]=e[3],t[n++]=e[4],t[n++]=e[5],t[n++]=e[6],t[n++]=e[7],t[n++]=e[8],t[n++]=e[9],t[n++]=e[10],t[n++]=e[11],t[n++]=e[12],t[n++]=e[13],t[n++]=e[14],t[n]=e[15]},c.unpack=function(e,t,a){return t=r(t,0),n(a)||(a=new c),a[0]=e[t++],a[1]=e[t++],a[2]=e[t++],a[3]=e[t++],a[4]=e[t++],a[5]=e[t++],a[6]=e[t++],a[7]=e[t++],a[8]=e[t++],a[9]=e[t++],a[10]=e[t++],a[11]=e[t++],a[12]=e[t++],a[13]=e[t++],a[14]=e[t++],a[15]=e[t],a},c.clone=function(e,t){return n(e)?n(t)?(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]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15],t):new c(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},c.fromArray=c.unpack,c.fromColumnMajorArray=function(e,t){return c.clone(e,t)},c.fromRowMajorArray=function(e,t){return n(t)?(t[0]=e[0],t[1]=e[4],t[2]=e[8],t[3]=e[12],t[4]=e[1],t[5]=e[5],t[6]=e[9],t[7]=e[13],t[8]=e[2],t[9]=e[6],t[10]=e[10],t[11]=e[14],t[12]=e[3],t[13]=e[7],t[14]=e[11],t[15]=e[15],t):new c(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])},c.fromRotationTranslation=function(t,a,i){return a=r(a,e.ZERO),n(i)?(i[0]=t[0],i[1]=t[1],i[2]=t[2],i[3]=0,i[4]=t[3],i[5]=t[4],i[6]=t[5],i[7]=0,i[8]=t[6],i[9]=t[7],i[10]=t[8],i[11]=0,i[12]=a.x,i[13]=a.y,i[14]=a.z,i[15]=1,i):new c(t[0],t[3],t[6],a.x,t[1],t[4],t[7],a.y,t[2],t[5],t[8],a.z,0,0,0,1)},c.fromTranslationQuaternionRotationScale=function(e,t,r,a){n(a)||(a=new c);var i=r.x,o=r.y,u=r.z,s=t.x*t.x,l=t.x*t.y,f=t.x*t.z,d=t.x*t.w,h=t.y*t.y,m=t.y*t.z,p=t.y*t.w,y=t.z*t.z,v=t.z*t.w,g=t.w*t.w,w=s-h-y+g,x=2*(l-v),E=2*(f+p),S=2*(l+v),O=-s+h-y+g,T=2*(m-d),b=2*(f-p),M=2*(m+d),_=-s-h+y+g;return a[0]=w*i,a[1]=S*i,a[2]=b*i,a[3]=0,a[4]=x*o,a[5]=O*o,a[6]=M*o,a[7]=0,a[8]=E*u,a[9]=T*u,a[10]=_*u,a[11]=0,a[12]=e.x,a[13]=e.y,a[14]=e.z,a[15]=1,a},c.fromTranslation=function(e,t){return c.fromRotationTranslation(u.IDENTITY,e,t)},c.fromScale=function(e,t){return n(t)?(t[0]=e.x,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=e.y,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=e.z,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t):new c(e.x,0,0,0,0,e.y,0,0,0,0,e.z,0,0,0,0,1)},c.fromUniformScale=function(e,t){return n(t)?(t[0]=e,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=e,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=e,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t):new c(e,0,0,0,0,e,0,0,0,0,e,0,0,0,0,1)};var l=new e,f=new e,d=new e;c.fromCamera=function(t,r){var a=t.eye,i=t.target,o=t.up;e.normalize(e.subtract(i,a,l),l),e.normalize(e.cross(l,o,f),f),e.normalize(e.cross(f,l,d),d);var u=f.x,s=f.y,h=f.z,m=l.x,p=l.y,y=l.z,v=d.x,g=d.y,w=d.z,x=a.x,E=a.y,S=a.z,O=u*-x+s*-E+h*-S,T=v*-x+g*-E+w*-S,b=m*x+p*E+y*S;return n(r)?(r[0]=u,r[1]=v,r[2]=-m,r[3]=0,r[4]=s,r[5]=g,r[6]=-p,r[7]=0,r[8]=h,r[9]=w,r[10]=-y,r[11]=0,r[12]=O,r[13]=T,r[14]=b,r[15]=1,r):new c(u,s,h,O,v,g,w,T,-m,-p,-y,b,0,0,0,1)},c.computePerspectiveFieldOfView=function(e,t,r,n,a){var i=Math.tan(.5*e),o=1/i,u=o/t,s=(n+r)/(r-n),c=2*n*r/(r-n);return a[0]=u,a[1]=0,a[2]=0,a[3]=0,a[4]=0,a[5]=o,a[6]=0,a[7]=0,a[8]=0,a[9]=0,a[10]=s,a[11]=-1,a[12]=0,a[13]=0,a[14]=c,a[15]=0,a},c.computeOrthographicOffCenter=function(e,t,r,n,a,i,o){var u=1/(t-e),s=1/(n-r),c=1/(i-a),l=-(t+e)*u,f=-(n+r)*s,d=-(i+a)*c;return u*=2,s*=2,c*=-2,o[0]=u,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]=c,o[11]=0,o[12]=l,o[13]=f,o[14]=d,o[15]=1,o},c.computePerspectiveOffCenter=function(e,t,r,n,a,i,o){var u=2*a/(t-e),s=2*a/(n-r),c=(t+e)/(t-e),l=(n+r)/(n-r),f=-(i+a)/(i-a),d=-1,h=-2*i*a/(i-a);return o[0]=u,o[1]=0,o[2]=0,o[3]=0,o[4]=0,o[5]=s,o[6]=0,o[7]=0,o[8]=c,o[9]=l,o[10]=f,o[11]=d,o[12]=0,o[13]=0,o[14]=h,o[15]=0,o},c.computeInfinitePerspectiveOffCenter=function(e,t,r,n,a,i){var o=2*a/(t-e),u=2*a/(n-r),s=(t+e)/(t-e),c=(n+r)/(n-r),l=-1,f=-1,d=-2*a;return i[0]=o,i[1]=0,i[2]=0,i[3]=0,i[4]=0,i[5]=u,i[6]=0,i[7]=0,i[8]=s,i[9]=c,i[10]=l,i[11]=f,i[12]=0,i[13]=0,i[14]=d,i[15]=0,i},c.computeViewportTransformation=function(e,t,n,a){e=r(e,r.EMPTY_OBJECT);var i=r(e.x,0),o=r(e.y,0),u=r(e.width,0),s=r(e.height,0);t=r(t,0),n=r(n,1);var c=.5*u,l=.5*s,f=.5*(n-t),d=c,h=l,m=f,p=i+c,y=o+l,v=t+f,g=1;return a[0]=d,a[1]=0,a[2]=0,a[3]=0,a[4]=0,a[5]=h,a[6]=0,a[7]=0,a[8]=0,a[9]=0,a[10]=m,a[11]=0,a[12]=p,a[13]=y,a[14]=v,a[15]=g,a},c.toArray=function(e,t){return n(t)?(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]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15],t):[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]]},c.getElementIndex=function(e,t){return 4*e+t},c.getColumn=function(e,t,r){var n=4*t,a=e[n],i=e[n+1],o=e[n+2],u=e[n+3];return r.x=a,r.y=i,r.z=o,r.w=u,r},c.setColumn=function(e,t,r,n){n=c.clone(e,n);var a=4*t;return n[a]=r.x,n[a+1]=r.y,n[a+2]=r.z,n[a+3]=r.w,n},c.getRow=function(e,t,r){var n=e[t],a=e[t+4],i=e[t+8],o=e[t+12];return r.x=n,r.y=a,r.z=i,r.w=o,r},c.setRow=function(e,t,r,n){return n=c.clone(e,n),n[t]=r.x,n[t+4]=r.y,n[t+8]=r.z,n[t+12]=r.w,n};var h=new e;c.getScale=function(t,r){return r.x=e.magnitude(e.fromElements(t[0],t[1],t[2],h)),r.y=e.magnitude(e.fromElements(t[4],t[5],t[6],h)),r.z=e.magnitude(e.fromElements(t[8],t[9],t[10],h)),r};var m=new e;c.getMaximumScale=function(t){return c.getScale(t,m),e.maximumComponent(m)},c.multiply=function(e,t,r){var n=e[0],a=e[1],i=e[2],o=e[3],u=e[4],s=e[5],c=e[6],l=e[7],f=e[8],d=e[9],h=e[10],m=e[11],p=e[12],y=e[13],v=e[14],g=e[15],w=t[0],x=t[1],E=t[2],S=t[3],O=t[4],T=t[5],b=t[6],M=t[7],_=t[8],P=t[9],N=t[10],A=t[11],I=t[12],R=t[13],z=t[14],C=t[15],D=n*w+u*x+f*E+p*S,L=a*w+s*x+d*E+y*S,q=i*w+c*x+h*E+v*S,U=o*w+l*x+m*E+g*S,F=n*O+u*T+f*b+p*M,B=a*O+s*T+d*b+y*M,W=i*O+c*T+h*b+v*M,G=o*O+l*T+m*b+g*M,k=n*_+u*P+f*N+p*A,V=a*_+s*P+d*N+y*A,Y=i*_+c*P+h*N+v*A,j=o*_+l*P+m*N+g*A,H=n*I+u*R+f*z+p*C,X=a*I+s*R+d*z+y*C,Z=i*I+c*R+h*z+v*C,J=o*I+l*R+m*z+g*C;return r[0]=D,r[1]=L,r[2]=q,r[3]=U,r[4]=F,r[5]=B,r[6]=W,r[7]=G,r[8]=k,r[9]=V,r[10]=Y,r[11]=j,r[12]=H,r[13]=X,r[14]=Z,r[15]=J,r},c.add=function(e,t,r){return r[0]=e[0]+t[0],r[1]=e[1]+t[1],r[2]=e[2]+t[2],r[3]=e[3]+t[3],r[4]=e[4]+t[4],r[5]=e[5]+t[5],r[6]=e[6]+t[6],r[7]=e[7]+t[7],r[8]=e[8]+t[8],r[9]=e[9]+t[9],r[10]=e[10]+t[10],r[11]=e[11]+t[11],r[12]=e[12]+t[12],r[13]=e[13]+t[13],r[14]=e[14]+t[14],r[15]=e[15]+t[15],r},c.subtract=function(e,t,r){return r[0]=e[0]-t[0],r[1]=e[1]-t[1],r[2]=e[2]-t[2],r[3]=e[3]-t[3],r[4]=e[4]-t[4],r[5]=e[5]-t[5],r[6]=e[6]-t[6],r[7]=e[7]-t[7],r[8]=e[8]-t[8],r[9]=e[9]-t[9],r[10]=e[10]-t[10],r[11]=e[11]-t[11],r[12]=e[12]-t[12],r[13]=e[13]-t[13],r[14]=e[14]-t[14],r[15]=e[15]-t[15],r},c.multiplyTransformation=function(e,t,r){var n=e[0],a=e[1],i=e[2],o=e[4],u=e[5],s=e[6],c=e[8],l=e[9],f=e[10],d=e[12],h=e[13],m=e[14],p=t[0],y=t[1],v=t[2],g=t[4],w=t[5],x=t[6],E=t[8],S=t[9],O=t[10],T=t[12],b=t[13],M=t[14],_=n*p+o*y+c*v,P=a*p+u*y+l*v,N=i*p+s*y+f*v,A=n*g+o*w+c*x,I=a*g+u*w+l*x,R=i*g+s*w+f*x,z=n*E+o*S+c*O,C=a*E+u*S+l*O,D=i*E+s*S+f*O,L=n*T+o*b+c*M+d,q=a*T+u*b+l*M+h,U=i*T+s*b+f*M+m;return r[0]=_,r[1]=P,r[2]=N,r[3]=0,r[4]=A,r[5]=I,r[6]=R,r[7]=0,r[8]=z,r[9]=C,r[10]=D,r[11]=0,r[12]=L,r[13]=q,r[14]=U,r[15]=1,r},c.multiplyByMatrix3=function(e,t,r){var n=e[0],a=e[1],i=e[2],o=e[4],u=e[5],s=e[6],c=e[8],l=e[9],f=e[10],d=t[0],h=t[1],m=t[2],p=t[3],y=t[4],v=t[5],g=t[6],w=t[7],x=t[8],E=n*d+o*h+c*m,S=a*d+u*h+l*m,O=i*d+s*h+f*m,T=n*p+o*y+c*v,b=a*p+u*y+l*v,M=i*p+s*y+f*v,_=n*g+o*w+c*x,P=a*g+u*w+l*x,N=i*g+s*w+f*x;return r[0]=E,r[1]=S,r[2]=O,r[3]=0,r[4]=T,r[5]=b,r[6]=M,r[7]=0,r[8]=_,r[9]=P,r[10]=N,r[11]=0,r[12]=e[12],r[13]=e[13],r[14]=e[14],r[15]=e[15],r},c.multiplyByTranslation=function(e,t,r){var n=t.x,a=t.y,i=t.z,o=n*e[0]+a*e[4]+i*e[8]+e[12],u=n*e[1]+a*e[5]+i*e[9]+e[13],s=n*e[2]+a*e[6]+i*e[10]+e[14];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]=o,r[13]=u,r[14]=s,r[15]=e[15],r};var p=new e;c.multiplyByUniformScale=function(e,t,r){return p.x=t,p.y=t,p.z=t,c.multiplyByScale(e,p,r)},c.multiplyByScale=function(e,t,r){var n=t.x,a=t.y,i=t.z;return 1===n&&1===a&&1===i?c.clone(e,r):(r[0]=n*e[0],r[1]=n*e[1],r[2]=n*e[2],r[3]=0,r[4]=a*e[4],r[5]=a*e[5],r[6]=a*e[6],r[7]=0,r[8]=i*e[8],r[9]=i*e[9],r[10]=i*e[10],r[11]=0,r[12]=e[12],r[13]=e[13],r[14]=e[14],r[15]=1,r)},c.multiplyByVector=function(e,t,r){var n=t.x,a=t.y,i=t.z,o=t.w,u=e[0]*n+e[4]*a+e[8]*i+e[12]*o,s=e[1]*n+e[5]*a+e[9]*i+e[13]*o,c=e[2]*n+e[6]*a+e[10]*i+e[14]*o,l=e[3]*n+e[7]*a+e[11]*i+e[15]*o;return r.x=u,r.y=s,r.z=c,r.w=l,r},c.multiplyByPointAsVector=function(e,t,r){var n=t.x,a=t.y,i=t.z,o=e[0]*n+e[4]*a+e[8]*i,u=e[1]*n+e[5]*a+e[9]*i,s=e[2]*n+e[6]*a+e[10]*i;return r.x=o,r.y=u,r.z=s,r},c.multiplyByPoint=function(e,t,r){var n=t.x,a=t.y,i=t.z,o=e[0]*n+e[4]*a+e[8]*i+e[12],u=e[1]*n+e[5]*a+e[9]*i+e[13],s=e[2]*n+e[6]*a+e[10]*i+e[14];return r.x=o,r.y=u,r.z=s,r},c.multiplyByScalar=function(e,t,r){return r[0]=e[0]*t,r[1]=e[1]*t,r[2]=e[2]*t,r[3]=e[3]*t,r[4]=e[4]*t,r[5]=e[5]*t,r[6]=e[6]*t,r[7]=e[7]*t,r[8]=e[8]*t,r[9]=e[9]*t,r[10]=e[10]*t,r[11]=e[11]*t,r[12]=e[12]*t,r[13]=e[13]*t,r[14]=e[14]*t,r[15]=e[15]*t,r},c.negate=function(e,t){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]=-e[12],t[13]=-e[13],t[14]=-e[14],t[15]=-e[15],t},c.transpose=function(e,t){var r=e[1],n=e[2],a=e[3],i=e[6],o=e[7],u=e[11];return t[0]=e[0],t[1]=e[4],t[2]=e[8],t[3]=e[12],t[4]=r,t[5]=e[5],t[6]=e[9],t[7]=e[13],t[8]=n,t[9]=i,t[10]=e[10],t[11]=e[14],t[12]=a,t[13]=o,t[14]=u,t[15]=e[15],t},c.abs=function(e,t){return t[0]=Math.abs(e[0]),t[1]=Math.abs(e[1]),t[2]=Math.abs(e[2]),t[3]=Math.abs(e[3]),t[4]=Math.abs(e[4]),t[5]=Math.abs(e[5]),t[6]=Math.abs(e[6]),t[7]=Math.abs(e[7]),t[8]=Math.abs(e[8]),t[9]=Math.abs(e[9]),t[10]=Math.abs(e[10]),t[11]=Math.abs(e[11]),t[12]=Math.abs(e[12]),t[13]=Math.abs(e[13]),t[14]=Math.abs(e[14]),t[15]=Math.abs(e[15]),t},c.equals=function(e,t){return e===t||n(e)&&n(t)&&e[12]===t[12]&&e[13]===t[13]&&e[14]===t[14]&&e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]&&e[4]===t[4]&&e[5]===t[5]&&e[6]===t[6]&&e[8]===t[8]&&e[9]===t[9]&&e[10]===t[10]&&e[3]===t[3]&&e[7]===t[7]&&e[11]===t[11]&&e[15]===t[15]},c.equalsEpsilon=function(e,t,r){return e===t||n(e)&&n(t)&&Math.abs(e[0]-t[0])<=r&&Math.abs(e[1]-t[1])<=r&&Math.abs(e[2]-t[2])<=r&&Math.abs(e[3]-t[3])<=r&&Math.abs(e[4]-t[4])<=r&&Math.abs(e[5]-t[5])<=r&&Math.abs(e[6]-t[6])<=r&&Math.abs(e[7]-t[7])<=r&&Math.abs(e[8]-t[8])<=r&&Math.abs(e[9]-t[9])<=r&&Math.abs(e[10]-t[10])<=r&&Math.abs(e[11]-t[11])<=r&&Math.abs(e[12]-t[12])<=r&&Math.abs(e[13]-t[13])<=r&&Math.abs(e[14]-t[14])<=r&&Math.abs(e[15]-t[15])<=r},c.getTranslation=function(e,t){return t.x=e[12],t.y=e[13],t.z=e[14],t},c.getRotation=function(e,t){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[4],t[4]=e[5],t[5]=e[6],t[6]=e[8],t[7]=e[9],t[8]=e[10],t};var y=new u,v=new u,g=new t,w=new t(0,0,0,1);return c.inverse=function(e,r){if(u.equalsEpsilon(c.getRotation(e,y),v,o.EPSILON7)&&t.equals(c.getRow(e,3,g),w))return r[0]=0,r[1]=0,r[2]=0,r[3]=0,r[4]=0,r[5]=0,r[6]=0,r[7]=0,r[8]=0,r[9]=0,r[10]=0,r[11]=0,r[12]=-e[12],r[13]=-e[13],r[14]=-e[14],r[15]=1,r;var n=e[0],a=e[4],i=e[8],l=e[12],f=e[1],d=e[5],h=e[9],m=e[13],p=e[2],x=e[6],E=e[10],S=e[14],O=e[3],T=e[7],b=e[11],M=e[15],_=E*M,P=S*b,N=x*M,A=S*T,I=x*b,R=E*T,z=p*M,C=S*O,D=p*b,L=E*O,q=p*T,U=x*O,F=_*d+A*h+I*m-(P*d+N*h+R*m),B=P*f+z*h+L*m-(_*f+C*h+D*m),W=N*f+C*d+q*m-(A*f+z*d+U*m),G=R*f+D*d+U*h-(I*f+L*d+q*h),k=P*a+N*i+R*l-(_*a+A*i+I*l),V=_*n+C*i+D*l-(P*n+z*i+L*l),Y=A*n+z*a+U*l-(N*n+C*a+q*l),j=I*n+L*a+q*i-(R*n+D*a+U*i);_=i*m,P=l*h,N=a*m,A=l*d,I=a*h,R=i*d,z=n*m,C=l*f,D=n*h,L=i*f,q=n*d,U=a*f;var H=_*T+A*b+I*M-(P*T+N*b+R*M),X=P*O+z*b+L*M-(_*O+C*b+D*M),Z=N*O+C*T+q*M-(A*O+z*T+U*M),J=R*O+D*T+U*b-(I*O+L*T+q*b),K=N*E+R*S+P*x-(I*S+_*x+A*E),Q=D*S+_*p+C*E-(z*E+L*S+P*p),$=z*x+U*S+A*p-(q*S+N*p+C*x),et=q*E+I*p+L*x-(D*x+U*E+R*p),tt=n*F+a*B+i*W+l*G;if(Math.abs(tt)<o.EPSILON20)throw new s("matrix is not invertible because its determinate is zero.");return tt=1/tt,r[0]=F*tt,r[1]=B*tt,r[2]=W*tt,r[3]=G*tt,r[4]=k*tt,r[5]=V*tt,r[6]=Y*tt,r[7]=j*tt,r[8]=H*tt,r[9]=X*tt,r[10]=Z*tt,r[11]=J*tt,r[12]=K*tt,r[13]=Q*tt,r[14]=$*tt,r[15]=et*tt,r},c.inverseTransformation=function(e,t){var r=e[0],n=e[1],a=e[2],i=e[4],o=e[5],u=e[6],s=e[8],c=e[9],l=e[10],f=e[12],d=e[13],h=e[14],m=-r*f-n*d-a*h,p=-i*f-o*d-u*h,y=-s*f-c*d-l*h;return t[0]=r,t[1]=i,t[2]=s,t[3]=0,t[4]=n,t[5]=o,t[6]=c,t[7]=0,t[8]=a,t[9]=u,t[10]=l,t[11]=0,t[12]=m,t[13]=p,t[14]=y,t[15]=1,t},c.IDENTITY=i(new c(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1)),c.COLUMN0ROW0=0,c.COLUMN0ROW1=1,c.COLUMN0ROW2=2,c.COLUMN0ROW3=3,c.COLUMN1ROW0=4,c.COLUMN1ROW1=5,c.COLUMN1ROW2=6,c.COLUMN1ROW3=7,c.COLUMN2ROW0=8,c.COLUMN2ROW1=9,c.COLUMN2ROW2=10,c.COLUMN2ROW3=11,c.COLUMN3ROW0=12,c.COLUMN3ROW1=13,c.COLUMN3ROW2=14,c.COLUMN3ROW3=15,c.prototype.clone=function(e){return c.clone(this,e)},c.prototype.equals=function(e){return c.equals(this,e)},c.equalsArray=function(e,t,r){return e[0]===t[r]&&e[1]===t[r+1]&&e[2]===t[r+2]&&e[3]===t[r+3]&&e[4]===t[r+4]&&e[5]===t[r+5]&&e[6]===t[r+6]&&e[7]===t[r+7]&&e[8]===t[r+8]&&e[9]===t[r+9]&&e[10]===t[r+10]&&e[11]===t[r+11]&&e[12]===t[r+12]&&e[13]===t[r+13]&&e[14]===t[r+14]&&e[15]===t[r+15]},c.prototype.equalsEpsilon=function(e,t){return c.equalsEpsilon(this,e,t)},c.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]+")"},c}),define("Core/BoundingSphere",["./Cartesian3","./Cartographic","./defaultValue","./defined","./DeveloperError","./Ellipsoid","./GeographicProjection","./Intersect","./Interval","./Matrix4","./Rectangle"],function(e,t,r,n,a,i,o,u,s,c,l){"use strict";var f=function(t,n){this.center=e.clone(r(t,e.ZERO)),this.radius=r(n,0)},d=new e,h=new e,m=new e,p=new e,y=new e,v=new e,g=new e,w=new e,x=new e,E=new e,S=new e,O=new e;f.fromPoints=function(t,r){if(n(r)||(r=new f),!n(t)||0===t.length)return r.center=e.clone(e.ZERO,r.center),r.radius=0,r;for(var a=e.clone(t[0],g),i=e.clone(a,d),o=e.clone(a,h),u=e.clone(a,m),s=e.clone(a,p),c=e.clone(a,y),l=e.clone(a,v),T=t.length,b=1;T>b;b++){e.clone(t[b],a);var M=a.x,_=a.y,P=a.z;M<i.x&&e.clone(a,i),M>s.x&&e.clone(a,s),_<o.y&&e.clone(a,o),_>c.y&&e.clone(a,c),P<u.z&&e.clone(a,u),P>l.z&&e.clone(a,l)}var N=e.magnitudeSquared(e.subtract(s,i,w)),A=e.magnitudeSquared(e.subtract(c,o,w)),I=e.magnitudeSquared(e.subtract(l,u,w)),R=i,z=s,C=N;A>C&&(C=A,R=o,z=c),I>C&&(C=I,R=u,z=l);var D=x;D.x=.5*(R.x+z.x),D.y=.5*(R.y+z.y),D.z=.5*(R.z+z.z);var L=e.magnitudeSquared(e.subtract(z,D,w)),q=Math.sqrt(L),U=E;U.x=i.x,U.y=o.y,U.z=u.z;var F=S;F.x=s.x,F.y=c.y,F.z=l.z;var B=e.multiplyByScalar(e.add(U,F,w),.5,O),W=0;for(b=0;T>b;b++){e.clone(t[b],a);var G=e.magnitude(e.subtract(a,B,w));G>W&&(W=G);var k=e.magnitudeSquared(e.subtract(a,D,w));if(k>L){var V=Math.sqrt(k);q=.5*(q+V),L=q*q;var Y=V-q;D.x=(q*D.x+Y*a.x)/V,D.y=(q*D.y+Y*a.y)/V,D.z=(q*D.z+Y*a.z)/V}}return W>q?(e.clone(D,r.center),r.radius=q):(e.clone(B,r.center),r.radius=W),r};var T=new o,b=new e,M=new e,_=new t,P=new t;f.fromRectangle2D=function(e,t,r){return f.fromRectangleWithHeights2D(e,t,0,0,r)},f.fromRectangleWithHeights2D=function(t,a,i,o,u){if(n(u)||(u=new f),!n(t))return u.center=e.clone(e.ZERO,u.center),u.radius=0,u;a=r(a,T),l.southwest(t,_),_.height=i,l.northeast(t,P),P.height=o;var s=a.project(_,b),c=a.project(P,M),d=c.x-s.x,h=c.y-s.y,m=c.z-s.z;u.radius=.5*Math.sqrt(d*d+h*h+m*m);var p=u.center;return p.x=s.x+.5*d,p.y=s.y+.5*h,p.z=s.z+.5*m,u};var N=[];f.fromRectangle3D=function(e,t,a,o){t=r(t,i.WGS84),a=r(a,0);var u;return n(e)&&(u=l.subsample(e,t,a,N)),f.fromPoints(u,o)},f.fromVertices=function(t,a,i,o){if(n(o)||(o=new f),!n(t)||0===t.length)return o.center=e.clone(e.ZERO,o.center),o.radius=0,o;a=r(a,e.ZERO),i=r(i,3);var u=g;u.x=t[0]+a.x,u.y=t[1]+a.y,u.z=t[2]+a.z;for(var s=e.clone(u,d),c=e.clone(u,h),l=e.clone(u,m),T=e.clone(u,p),b=e.clone(u,y),M=e.clone(u,v),_=t.length,P=0;_>P;P+=i){var N=t[P]+a.x,A=t[P+1]+a.y,I=t[P+2]+a.z;u.x=N,u.y=A,u.z=I,N<s.x&&e.clone(u,s),N>T.x&&e.clone(u,T),A<c.y&&e.clone(u,c),A>b.y&&e.clone(u,b),I<l.z&&e.clone(u,l),I>M.z&&e.clone(u,M)}var R=e.magnitudeSquared(e.subtract(T,s,w)),z=e.magnitudeSquared(e.subtract(b,c,w)),C=e.magnitudeSquared(e.subtract(M,l,w)),D=s,L=T,q=R;z>q&&(q=z,D=c,L=b),C>q&&(q=C,D=l,L=M);var U=x;U.x=.5*(D.x+L.x),U.y=.5*(D.y+L.y),U.z=.5*(D.z+L.z);var F=e.magnitudeSquared(e.subtract(L,U,w)),B=Math.sqrt(F),W=E;W.x=s.x,W.y=c.y,W.z=l.z;var G=S;G.x=T.x,G.y=b.y,G.z=M.z;var k=e.multiplyByScalar(e.add(W,G,w),.5,O),V=0;for(P=0;_>P;P+=i){u.x=t[P]+a.x,u.y=t[P+1]+a.y,u.z=t[P+2]+a.z;var Y=e.magnitude(e.subtract(u,k,w));Y>V&&(V=Y);var j=e.magnitudeSquared(e.subtract(u,U,w));if(j>F){var H=Math.sqrt(j);B=.5*(B+H),F=B*B;var X=H-B;U.x=(B*U.x+X*u.x)/H,U.y=(B*U.y+X*u.y)/H,U.z=(B*U.z+X*u.z)/H}}return V>B?(e.clone(U,o.center),o.radius=B):(e.clone(k,o.center),o.radius=V),o},f.fromCornerPoints=function(t,r,a){n(a)||(a=new f);var i=a.center;return e.add(t,r,i),e.multiplyByScalar(i,.5,i),a.radius=e.distance(i,r),a},f.fromEllipsoid=function(t,r){return n(r)||(r=new f),e.clone(e.ZERO,r.center),r.radius=t.maximumRadius,r};var A=new e;f.fromBoundingSpheres=function(t,r){if(n(r)||(r=new f),!n(t)||0===t.length)return r.center=e.clone(e.ZERO,r.center),r.radius=0,r;var a=t.length;if(1===a)return f.clone(t[0],r);if(2===a)return f.union(t[0],t[1],r);for(var i=[],o=0;a>o;o++)i.push(t[o].center);r=f.fromPoints(i,r);var u=r.center,s=r.radius;for(o=0;a>o;o++){var c=t[o];s=Math.max(s,e.distance(u,c.center,A)+c.radius)}return r.radius=s,r},f.clone=function(t,r){return n(t)?n(r)?(r.center=e.clone(t.center,r.center),r.radius=t.radius,r):new f(t.center,t.radius):void 0},f.packedLength=4,f.pack=function(e,t,n){n=r(n,0);var a=e.center;t[n++]=a.x,t[n++]=a.y,t[n++]=a.z,t[n]=e.radius},f.unpack=function(e,t,a){t=r(t,0),n(a)||(a=new f);var i=a.center;return i.x=e[t++],i.y=e[t++],i.z=e[t++],a.radius=e[t],a};var I=new e,R=new e;f.union=function(t,r,a){n(a)||(a=new f);var i=t.center,o=r.center;e.add(i,o,R);var u=e.multiplyByScalar(R,.5,R),s=e.magnitude(e.subtract(i,u,I))+t.radius,c=e.magnitude(e.subtract(o,u,I))+r.radius;return a.radius=Math.max(s,c),e.clone(u,a.center),a};var z=new e;f.expand=function(t,r,n){n=f.clone(t,n);var a=e.magnitude(e.subtract(r,n.center,z));return a>n.radius&&(n.radius=a),n},f.intersect=function(t,r){var n=t.center,a=t.radius,i=e.dot(r,n)+r.w;return-a>i?u.OUTSIDE:a>i?u.INTERSECTING:u.INSIDE},f.transform=function(e,t,r){return n(r)||(r=new f),r.center=c.multiplyByPoint(t,e.center,r.center),r.radius=c.getMaximumScale(t)*e.radius,r};var C=new e;f.distanceSquaredTo=function(t,r){var n=e.subtract(t.center,r,C);return e.magnitudeSquared(n)-t.radius*t.radius},f.transformWithoutScale=function(e,t,r){return n(r)||(r=new f),r.center=c.multiplyByPoint(t,e.center,r.center),r.radius=e.radius,r};var D=new e;f.computePlaneDistances=function(t,r,a,i){n(i)||(i=new s);var o=e.subtract(t.center,r,D),u=e.multiplyByScalar(a,e.dot(a,o),D),c=e.magnitude(u);return i.start=c-t.radius,i.stop=c+t.radius,i};for(var L=new e,q=new e,U=new e,F=new e,B=new e,W=new t,G=new Array(8),k=0;8>k;++k)G[k]=new e;var V=new o;return f.projectTo2D=function(t,n,a){n=r(n,V);var i=n.ellipsoid,o=t.center,u=t.radius,s=i.geodeticSurfaceNormal(o,L),c=e.cross(e.UNIT_Z,s,q);e.normalize(c,c);var l=e.cross(s,c,U);e.normalize(l,l),e.multiplyByScalar(s,u,s),e.multiplyByScalar(l,u,l),e.multiplyByScalar(c,u,c);var d=e.negate(l,B),h=e.negate(c,F),m=G,p=m[0];e.add(s,l,p),e.add(p,c,p),p=m[1],e.add(s,l,p),e.add(p,h,p),p=m[2],e.add(s,d,p),e.add(p,h,p),p=m[3],e.add(s,d,p),e.add(p,c,p),e.negate(s,s),p=m[4],e.add(s,l,p),e.add(p,c,p),p=m[5],e.add(s,l,p),e.add(p,h,p),p=m[6],e.add(s,d,p),e.add(p,h,p),p=m[7],e.add(s,d,p),e.add(p,c,p);for(var y=m.length,v=0;y>v;++v){var g=m[v];e.add(o,g,g);var w=i.cartesianToCartographic(g,W);n.project(w,g)}a=f.fromPoints(m,a),o=a.center;var x=o.x,E=o.y,S=o.z;return o.x=S,o.y=x,o.z=E,a},f.equals=function(t,r){return t===r||n(t)&&n(r)&&e.equals(t.center,r.center)&&t.radius===r.radius},f.prototype.intersect=function(e){return f.intersect(this,e)},f.prototype.equals=function(e){return f.equals(this,e)},f.prototype.clone=function(e){return f.clone(this,e)},f}),define("Core/Cartesian2",["./defaultValue","./defined","./DeveloperError","./freezeObject","./Math"],function(e,t,r,n,a){"use strict";var i=function(t,r){this.x=e(t,0),this.y=e(r,0)};i.fromElements=function(e,r,n){return t(n)?(n.x=e,n.y=r,n):new i(e,r)},i.clone=function(e,r){return t(e)?t(r)?(r.x=e.x,r.y=e.y,r):new i(e.x,e.y):void 0},i.fromCartesian3=i.clone,i.fromCartesian4=i.clone,i.packedLength=2,i.pack=function(t,r,n){n=e(n,0),r[n++]=t.x,r[n]=t.y},i.unpack=function(r,n,a){return n=e(n,0),t(a)||(a=new i),a.x=r[n++],a.y=r[n],a},i.fromArray=i.unpack,i.maximumComponent=function(e){return Math.max(e.x,e.y)},i.minimumComponent=function(e){return Math.min(e.x,e.y)},i.minimumByComponent=function(e,t,r){return r.x=Math.min(e.x,t.x),r.y=Math.min(e.y,t.y),r},i.maximumByComponent=function(e,t,r){return r.x=Math.max(e.x,t.x),r.y=Math.max(e.y,t.y),r},i.magnitudeSquared=function(e){return e.x*e.x+e.y*e.y},i.magnitude=function(e){return Math.sqrt(i.magnitudeSquared(e))};var o=new i;i.distance=function(e,t){return i.subtract(e,t,o),i.magnitude(o)},i.distanceSquared=function(e,t){return i.subtract(e,t,o),i.magnitudeSquared(o)},i.normalize=function(e,t){var r=i.magnitude(e);return t.x=e.x/r,t.y=e.y/r,t},i.dot=function(e,t){return e.x*t.x+e.y*t.y},i.multiplyComponents=function(e,t,r){return r.x=e.x*t.x,r.y=e.y*t.y,r},i.add=function(e,t,r){return r.x=e.x+t.x,r.y=e.y+t.y,r},i.subtract=function(e,t,r){return r.x=e.x-t.x,r.y=e.y-t.y,r},i.multiplyByScalar=function(e,t,r){return r.x=e.x*t,r.y=e.y*t,r},i.divideByScalar=function(e,t,r){return r.x=e.x/t,r.y=e.y/t,r},i.negate=function(e,t){return t.x=-e.x,t.y=-e.y,t},i.abs=function(e,t){return t.x=Math.abs(e.x),t.y=Math.abs(e.y),t};var u=new i;i.lerp=function(e,t,r,n){return i.multiplyByScalar(t,r,u),n=i.multiplyByScalar(e,1-r,n),i.add(u,n,n)};var s=new i,c=new i;i.angleBetween=function(e,t){return i.normalize(e,s),i.normalize(t,c),a.acosClamped(i.dot(s,c))};var l=new i;return i.mostOrthogonalAxis=function(e,t){var r=i.normalize(e,l);return i.abs(r,r),t=r.x<=r.y?i.clone(i.UNIT_X,t):i.clone(i.UNIT_Y,t)},i.equals=function(e,r){return e===r||t(e)&&t(r)&&e.x===r.x&&e.y===r.y},i.equalsArray=function(e,t,r){return e.x===t[r]&&e.y===t[r+1]},i.equalsEpsilon=function(e,r,n,i){return e===r||t(e)&&t(r)&&a.equalsEpsilon(e.x,r.x,n,i)&&a.equalsEpsilon(e.y,r.y,n,i)},i.ZERO=n(new i(0,0)),i.UNIT_X=n(new i(1,0)),i.UNIT_Y=n(new i(0,1)),i.prototype.clone=function(e){return i.clone(this,e)},i.prototype.equals=function(e){return i.equals(this,e)},i.prototype.equalsEpsilon=function(e,t,r){return i.equalsEpsilon(this,e,t,r)},i.prototype.toString=function(){return"("+this.x+", "+this.y+")"},i}),define("Core/Fullscreen",["./defined","./defineProperties"],function(e,t){"use strict";var r,n={requestFullscreen:void 0,exitFullscreen:void 0,fullscreenEnabled:void 0,fullscreenElement:void 0,fullscreenchange:void 0,fullscreenerror:void 0},a={};return t(a,{element:{get:function(){return a.supportsFullscreen()?document[n.fullscreenElement]:void 0}},changeEventName:{get:function(){return a.supportsFullscreen()?n.fullscreenchange:void 0}},errorEventName:{get:function(){return a.supportsFullscreen()?n.fullscreenerror:void 0}},enabled:{get:function(){return a.supportsFullscreen()?document[n.fullscreenEnabled]:void 0}},fullscreen:{get:function(){return a.supportsFullscreen()?null!==a.element:void 0}}}),a.supportsFullscreen=function(){if(e(r))return r;r=!1;var t=document.body;if("function"==typeof t.requestFullscreen)return n.requestFullscreen="requestFullscreen",n.exitFullscreen="exitFullscreen",n.fullscreenEnabled="fullscreenEnabled",n.fullscreenElement="fullscreenElement",n.fullscreenchange="fullscreenchange",n.fullscreenerror="fullscreenerror",r=!0;for(var a,i=["webkit","moz","o","ms","khtml"],o=0,u=i.length;u>o;++o){var s=i[o];a=s+"RequestFullscreen","function"==typeof t[a]?(n.requestFullscreen=a,r=!0):(a=s+"RequestFullScreen","function"==typeof t[a]&&(n.requestFullscreen=a,r=!0)),a=s+"ExitFullscreen","function"==typeof document[a]?n.exitFullscreen=a:(a=s+"CancelFullScreen","function"==typeof document[a]&&(n.exitFullscreen=a)),a=s+"FullscreenEnabled",e(document[a])?n.fullscreenEnabled=a:(a=s+"FullScreenEnabled",e(document[a])&&(n.fullscreenEnabled=a)),a=s+"FullscreenElement",e(document[a])?n.fullscreenElement=a:(a=s+"FullScreenElement",e(document[a])&&(n.fullscreenElement=a)),a=s+"fullscreenchange",e(document["on"+a])&&("ms"===s&&(a="MSFullscreenChange"),n.fullscreenchange=a),a=s+"fullscreenerror",e(document["on"+a])&&("ms"===s&&(a="MSFullscreenError"),n.fullscreenerror=a)}return r},a.requestFullscreen=function(e){a.supportsFullscreen()&&e[n.requestFullscreen]()},a.exitFullscreen=function(){a.supportsFullscreen()&&document[n.exitFullscreen]()},a}),define("Core/FeatureDetection",["./defaultValue","./defined","./Fullscreen"],function(e,t,r){"use strict";function n(e){for(var t=e.split("."),r=0,n=t.length;n>r;++r)t[r]=parseInt(t[r],10);return t}function a(){if(!t(y)){y=!1;var e=/ Chrome\/([\.0-9]+)/.exec(navigator.userAgent);null!==e&&(y=!0,v=n(e[1]))}return y}function i(){return a()&&v}function o(){if(!t(g)&&(g=!1,!a()&&/ Safari\/[\.0-9]+/.test(navigator.userAgent))){var e=/ Version\/([\.0-9]+)/.exec(navigator.userAgent);null!==e&&(g=!0,w=n(e[1]))}return g}function u(){return o()&&w}function s(){if(!t(x)){x=!1;var e=/ AppleWebKit\/([\.0-9]+)(\+?)/.exec(navigator.userAgent);null!==e&&(x=!0,E=n(e[1]),E.isNightly=!!e[2])}return x}function c(){return s()&&E}function l(){if(!t(S)){S=!1;var e;"Microsoft Internet Explorer"===navigator.appName?(e=/MSIE ([0-9]{1,}[\.0-9]{0,})/.exec(navigator.userAgent),null!==e&&(S=!0,O=n(e[1]))):"Netscape"===navigator.appName&&(e=/Trident\/.*rv:([0-9]{1,}[\.0-9]{0,})/.exec(navigator.userAgent),null!==e&&(S=!0,O=n(e[1])))}return S}function f(){return l()&&O}function d(){if(!t(T)){T=!1;var e=/Firefox\/([\.0-9]+)/.exec(navigator.userAgent);null!==e&&(T=!0,b=n(e[1]))}return T}function h(){return t(M)||(M=/Windows/i.test(navigator.appVersion)),M}function m(){return d()&&b}function p(){return t(_)||(_=t(window.PointerEvent)&&(!t(window.navigator.pointerEnabled)||window.navigator.pointerEnabled)),_}var y,v,g,w,x,E,S,O,T,b,M,_,P={isChrome:a,chromeVersion:i,isSafari:o,safariVersion:u,isWebkit:s,webkitVersion:c,isInternetExplorer:l,internetExplorerVersion:f,isFirefox:d,firefoxVersion:m,isWindows:h,hardwareConcurrency:e(navigator.hardwareConcurrency,3),supportsPointerEvents:p};return P.supportsFullscreen=function(){return r.supportsFullscreen()},P.supportsTypedArrays=function(){return"undefined"!=typeof ArrayBuffer},P.supportsWebWorkers=function(){return"undefined"!=typeof Worker},P}),define("Core/ComponentDatatype",["./defaultValue","./defined","./DeveloperError","./FeatureDetection","./freezeObject"],function(e,t,r,n,a){"use strict";if(!n.supportsTypedArrays())return{};var i={BYTE:5120,UNSIGNED_BYTE:5121,SHORT:5122,UNSIGNED_SHORT:5123,FLOAT:5126,DOUBLE:5130};return i.getSizeInBytes=function(e){switch(e){case i.BYTE:return Int8Array.BYTES_PER_ELEMENT;case i.UNSIGNED_BYTE:return Uint8Array.BYTES_PER_ELEMENT;case i.SHORT:return Int16Array.BYTES_PER_ELEMENT;case i.UNSIGNED_SHORT:return Uint16Array.BYTES_PER_ELEMENT;case i.FLOAT:return Float32Array.BYTES_PER_ELEMENT;case i.DOUBLE:return Float64Array.BYTES_PER_ELEMENT;default:throw new r("componentDatatype is not a valid value.")}},i.fromTypedArray=function(e){return e instanceof Int8Array?i.BYTE:e instanceof Uint8Array?i.UNSIGNED_BYTE:e instanceof Int16Array?i.SHORT:e instanceof Uint16Array?i.UNSIGNED_SHORT:e instanceof Float32Array?i.FLOAT:e instanceof Float64Array?i.DOUBLE:void 0},i.validate=function(e){return t(e)&&(e===i.BYTE||e===i.UNSIGNED_BYTE||e===i.SHORT||e===i.UNSIGNED_SHORT||e===i.FLOAT||e===i.DOUBLE)},i.createTypedArray=function(e,t){switch(e){case i.BYTE:return new Int8Array(t);case i.UNSIGNED_BYTE:return new Uint8Array(t);case i.SHORT:return new Int16Array(t);case i.UNSIGNED_SHORT:return new Uint16Array(t);case i.FLOAT:return new Float32Array(t);case i.DOUBLE:return new Float64Array(t);default:throw new r("componentDatatype is not a valid value.")}},i.createArrayBufferView=function(t,n,a,o){switch(a=e(a,0),o=e(o,(n.byteLength-a)/i.getSizeInBytes(t)),t){case i.BYTE:return new Int8Array(n,a,o);case i.UNSIGNED_BYTE:return new Uint8Array(n,a,o);case i.SHORT:return new Int16Array(n,a,o);case i.UNSIGNED_SHORT:return new Uint16Array(n,a,o);case i.FLOAT:return new Float32Array(n,a,o);case i.DOUBLE:return new Float64Array(n,a,o);default:throw new r("componentDatatype is not a valid value.")}},a(i)}),define("Core/GeometryType",["./freezeObject"],function(e){"use strict";var t={NONE:0,TRIANGLES:1,LINES:2,POLYLINES:3};return e(t)}),define("Core/PrimitiveType",["./freezeObject"],function(e){"use strict";var t={POINTS:0,LINES:1,LINE_LOOP:2,LINE_STRIP:3,TRIANGLES:4,TRIANGLE_STRIP:5,TRIANGLE_FAN:6,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 e(t)}),define("Core/Geometry",["./defaultValue","./defined","./DeveloperError","./GeometryType","./PrimitiveType"],function(e,t,r,n,a){"use strict";var i=function(t){t=e(t,e.EMPTY_OBJECT),this.attributes=t.attributes,this.indices=t.indices,this.primitiveType=e(t.primitiveType,a.TRIANGLES),this.boundingSphere=t.boundingSphere,this.geometryType=e(t.geometryType,n.NONE),this.boundingSphereCV=void 0};return i.computeNumberOfVertices=function(e){var n=-1;for(var a in e.attributes)if(e.attributes.hasOwnProperty(a)&&t(e.attributes[a])&&t(e.attributes[a].values)){var i=e.attributes[a],o=i.values.length/i.componentsPerAttribute;if(n!==o&&-1!==n)throw new r("All attribute lists must have the same number of attributes.");n=o}return n},i}),define("Core/GeometryAttribute",["./defaultValue","./defined","./DeveloperError"],function(e){"use strict";var t=function(t){t=e(t,e.EMPTY_OBJECT),this.componentDatatype=t.componentDatatype,this.componentsPerAttribute=t.componentsPerAttribute,this.normalize=e(t.normalize,!1),this.values=t.values};return t}),define("Core/GeometryAttributes",["./defaultValue"],function(e){"use strict";var t=function(t){t=e(t,e.EMPTY_OBJECT),this.position=t.position,this.normal=t.normal,this.st=t.st,this.binormal=t.binormal,this.tangent=t.tangent,this.color=t.color};return t}),define("Core/GeometryInstance",["./defaultValue","./defined","./DeveloperError","./Matrix4"],function(e,t,r,n){"use strict";var a=function(t){t=e(t,e.EMPTY_OBJECT),this.geometry=t.geometry,this.modelMatrix=n.clone(e(t.modelMatrix,n.IDENTITY)),this.id=t.id,this.pickPrimitive=t.pickPrimitive,this.attributes=e(t.attributes,{}),this.westHemisphereGeometry=void 0,this.eastHemisphereGeometry=void 0};return a}),define("Core/AttributeCompression",["./Cartesian2","./Cartesian3","./defined","./DeveloperError","./Math"],function(e,t,r,n,a){"use strict";var i={};i.octEncode=function(e,t){if(t.x=e.x/(Math.abs(e.x)+Math.abs(e.y)+Math.abs(e.z)),t.y=e.y/(Math.abs(e.x)+Math.abs(e.y)+Math.abs(e.z)),e.z<0){var r=t.x,n=t.y;t.x=(1-Math.abs(n))*a.signNotZero(r),t.y=(1-Math.abs(r))*a.signNotZero(n)}return t.x=a.toSNorm(t.x),t.y=a.toSNorm(t.y),t},i.octDecode=function(e,r,n){if(n.x=a.fromSNorm(e),n.y=a.fromSNorm(r),n.z=1-(Math.abs(n.x)+Math.abs(n.y)),n.z<0){var i=n.x;n.x=(1-Math.abs(n.y))*a.signNotZero(i),n.y=(1-Math.abs(i))*a.signNotZero(n.y)}return t.normalize(n,n)},i.octPackFloat=function(e){return 256*e.x+e.y};var o=new e;return i.octEncodeFloat=function(e){return i.octEncode(e,o),i.octPackFloat(o)
},i.octDecodeFloat=function(e,t){var r=e/256,n=Math.floor(r),a=256*(r-n);return i.octDecode(n,a,t)},i.octPack=function(e,t,r,n){var a=i.octEncodeFloat(e),u=i.octEncodeFloat(t),s=i.octEncode(r,o);return n.x=65536*s.x+a,n.y=65536*s.y+u,n},i.octUnpack=function(e,t,r,n){var a=e.x/65536,o=Math.floor(a),u=65536*(a-o);a=e.y/65536;var s=Math.floor(a),c=65536*(a-s);i.octDecodeFloat(u,t),i.octDecodeFloat(c,r),i.octDecode(o,s,n)},i.compressTextureCoordinates=function(e){var t=1===e.x?4095:0|4096*e.x,r=1===e.y?4095:0|4096*e.y;return 4096*t+r},i.decompressTextureCoordinates=function(e,t){var r=e/4096;return t.x=Math.floor(r)/4096,t.y=r-Math.floor(r),t},i}),define("Core/barycentricCoordinates",["./Cartesian2","./Cartesian3","./defined","./DeveloperError"],function(e,t,r){"use strict";var n=new t,a=new t,i=new t,o=function(o,u,s,c,l){r(l)||(l=new t);var f,d,h,m,p,y,v,g;r(u.z)?(f=t.subtract(s,u,n),d=t.subtract(c,u,a),h=t.subtract(o,u,i),m=t.dot(f,f),p=t.dot(f,d),y=t.dot(f,h),v=t.dot(d,d),g=t.dot(d,h)):(f=e.subtract(s,u,n),d=e.subtract(c,u,a),h=e.subtract(o,u,i),m=e.dot(f,f),p=e.dot(f,d),y=e.dot(f,h),v=e.dot(d,d),g=e.dot(d,h));var w=1/(m*v-p*p);return l.y=(v*y-p*g)*w,l.z=(m*g-p*y)*w,l.x=1-l.y-l.z,l};return o}),define("Core/EncodedCartesian3",["./Cartesian3","./defined","./DeveloperError"],function(e,t){"use strict";var r=function(){this.high=e.clone(e.ZERO),this.low=e.clone(e.ZERO)};r.encode=function(e,r){t(r)||(r={high:0,low:0});var n;return e>=0?(n=65536*Math.floor(e/65536),r.high=n,r.low=e-n):(n=65536*Math.floor(-e/65536),r.high=-n,r.low=e+n),r};var n={high:0,low:0};r.fromCartesian=function(e,a){t(a)||(a=new r);var i=a.high,o=a.low;return r.encode(e.x,n),i.x=n.high,o.x=n.low,r.encode(e.y,n),i.y=n.high,o.y=n.low,r.encode(e.z,n),i.z=n.high,o.z=n.low,a};var a=new r;return r.writeElements=function(e,t,n){r.fromCartesian(e,a);var i=a.high,o=a.low;t[n]=i.x,t[n+1]=i.y,t[n+2]=i.z,t[n+3]=o.x,t[n+4]=o.y,t[n+5]=o.z},r}),define("Core/IndexDatatype",["./defined","./DeveloperError","./freezeObject","./Math"],function(e,t,r,n){"use strict";var a={UNSIGNED_BYTE:5121,UNSIGNED_SHORT:5123,UNSIGNED_INT:5125};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}},a.validate=function(t){return e(t)&&(t===a.UNSIGNED_BYTE||t===a.UNSIGNED_SHORT||t===a.UNSIGNED_INT)},a.createTypedArray=function(e,t){return e>n.SIXTY_FOUR_KILOBYTES?new Uint32Array(t):new Uint16Array(t)},a.createTypedArrayFromArrayBuffer=function(e,t,r,a){return e>n.SIXTY_FOUR_KILOBYTES?new Uint32Array(t,r,a):new Uint16Array(t,r,a)},r(a)}),define("Core/QuadraticRealPolynomial",["./DeveloperError","./Math"],function(e,t){"use strict";function r(e,r,n){var a=e+r;return t.sign(e)!==t.sign(r)&&Math.abs(a/Math.max(Math.abs(e),Math.abs(r)))<n?0:a}var n={};return n.computeDiscriminant=function(e,t,r){var n=t*t-4*e*r;return n},n.computeRealRoots=function(e,n,a){var i;if(0===e)return 0===n?[]:[-a/n];if(0===n){if(0===a)return[0,0];var o=Math.abs(a),u=Math.abs(e);if(u>o&&o/u<t.EPSILON14)return[0,0];if(o>u&&u/o<t.EPSILON14)return[];if(i=-a/e,0>i)return[];var s=Math.sqrt(i);return[-s,s]}if(0===a)return i=-n/e,0>i?[i,0]:[0,i];var c=n*n,l=4*e*a,f=r(c,-l,t.EPSILON14);if(0>f)return[];var d=-.5*r(n,t.sign(n)*Math.sqrt(f),t.EPSILON14);return n>0?[d/e,a/d]:[a/d,d/e]},n}),define("Core/CubicRealPolynomial",["./DeveloperError","./QuadraticRealPolynomial"],function(e,t){"use strict";function r(e,t,r,n){var a,i,o=e,u=t/3,s=r/3,c=n,l=o*s,f=u*c,d=u*u,h=s*s,m=o*s-d,p=o*c-u*s,y=u*c-h,v=4*m*y-p*p;if(0>v){var g,w,x;d*f>=l*h?(g=o,w=m,x=-2*u*m+o*p):(g=c,w=y,x=-c*p+2*s*y);var E=0>x?-1:1,S=-E*Math.abs(g)*Math.sqrt(-v);i=-x+S;var O=i/2,T=0>O?-Math.pow(-O,1/3):Math.pow(O,1/3),b=i===S?-T:-w/T;return a=0>=w?T+b:-x/(T*T+b*b+w),d*f>=l*h?[(a-u)/o]:[-c/(a+s)]}var M=m,_=-2*u*m+o*p,P=y,N=-c*p+2*s*y,A=Math.sqrt(v),I=Math.sqrt(3)/2,R=Math.abs(Math.atan2(o*A,-_)/3);a=2*Math.sqrt(-M);var z=Math.cos(R);i=a*z;var C=a*(-z/2-I*Math.sin(R)),D=i+C>2*u?i-u:C-u,L=o,q=D/L;R=Math.abs(Math.atan2(c*A,-N)/3),a=2*Math.sqrt(-P),z=Math.cos(R),i=a*z,C=a*(-z/2-I*Math.sin(R));var U=-c,F=2*s>i+C?i+s:C+s,B=U/F,W=L*F,G=-D*F-L*U,k=D*U,V=(s*G-u*k)/(-u*G+s*W);return V>=q?B>=q?B>=V?[q,V,B]:[q,B,V]:[B,q,V]:B>=q?[V,q,B]:B>=V?[V,B,q]:[B,V,q]}var n={};return n.computeDiscriminant=function(e,t,r,n){var a=e*e,i=t*t,o=r*r,u=n*n,s=18*e*t*r*n+i*o-27*a*u-4*(e*o*r+i*t*n);return s},n.computeRealRoots=function(e,n,a,i){var o,u;if(0===e)return t.computeRealRoots(n,a,i);if(0===n){if(0===a){if(0===i)return[0,0,0];u=-i/e;var s=0>u?-Math.pow(-u,1/3):Math.pow(u,1/3);return[s,s,s]}return 0===i?(o=t.computeRealRoots(e,0,a),0===o.Length?[0]:[o[0],0,o[1]]):r(e,0,a,i)}return 0===a?0===i?(u=-n/e,0>u?[u,0,0]:[0,0,u]):r(e,n,0,i):0===i?(o=t.computeRealRoots(e,n,a),0===o.length?[0]:o[1]<=0?[o[0],o[1],0]:o[0]>=0?[0,o[0],o[1]]:[o[0],0,o[1]]):r(e,n,a,i)},n}),define("Core/QuarticRealPolynomial",["./CubicRealPolynomial","./DeveloperError","./Math","./QuadraticRealPolynomial"],function(e,t,r,n){"use strict";function a(t,a,i,o){var u=t*t,s=a-3*u/8,c=i-a*t/2+u*t/8,l=o-i*t/4+a*u/16-3*u*u/256,f=e.computeRealRoots(1,2*s,s*s-4*l,-c*c);if(f.length>0){var d=-t/4,h=f[f.length-1];if(Math.abs(h)<r.EPSILON14){var m=n.computeRealRoots(1,s,l);if(2===m.length){var p,y=m[0],v=m[1];if(y>=0&&v>=0){var g=Math.sqrt(y),w=Math.sqrt(v);return[d-w,d-g,d+g,d+w]}if(y>=0&&0>v)return p=Math.sqrt(y),[d-p,d+p];if(0>y&&v>=0)return p=Math.sqrt(v),[d-p,d+p]}return[]}if(h>0){var x=Math.sqrt(h),E=(s+h-c/x)/2,S=(s+h+c/x)/2,O=n.computeRealRoots(1,x,E),T=n.computeRealRoots(1,-x,S);return 0!==O.length?(O[0]+=d,O[1]+=d,0!==T.length?(T[0]+=d,T[1]+=d,O[1]<=T[0]?[O[0],O[1],T[0],T[1]]:T[1]<=O[0]?[T[0],T[1],O[0],O[1]]:O[0]>=T[0]&&O[1]<=T[1]?[T[0],O[0],O[1],T[1]]:T[0]>=O[0]&&T[1]<=O[1]?[O[0],T[0],T[1],O[1]]:O[0]>T[0]&&O[0]<T[1]?[T[0],O[0],T[1],O[1]]:[O[0],T[0],O[1],T[1]]):O):0!==T.length?(T[0]+=d,T[1]+=d,T):[]}}return[]}function i(t,a,i,o){var u=i*i,s=a*a,c=t*t,l=-2*a,f=i*t+s-4*o,d=c*o-i*a*t+u,h=e.computeRealRoots(1,l,f,d);if(h.length>0){var m,p,y=h[0],v=a-y,g=v*v,w=t/2,x=v/2,E=g-4*o,S=g+4*Math.abs(o),O=c-4*y,T=c+4*Math.abs(y);if(0>y||O*S>E*T){var b=Math.sqrt(O);m=b/2,p=0===b?0:(t*x-i)/b}else{var M=Math.sqrt(E);m=0===M?0:(t*x-i)/M,p=M/2}var _,P;0===w&&0===m?(_=0,P=0):r.sign(w)===r.sign(m)?(_=w+m,P=y/_):(P=w-m,_=y/P);var N,A;0===x&&0===p?(N=0,A=0):r.sign(x)===r.sign(p)?(N=x+p,A=o/N):(A=x-p,N=o/A);var I=n.computeRealRoots(1,_,N),R=n.computeRealRoots(1,P,A);if(0!==I.length)return 0!==R.length?I[1]<=R[0]?[I[0],I[1],R[0],R[1]]:R[1]<=I[0]?[R[0],R[1],I[0],I[1]]:I[0]>=R[0]&&I[1]<=R[1]?[R[0],I[0],I[1],R[1]]:R[0]>=I[0]&&R[1]<=I[1]?[I[0],R[0],R[1],I[1]]:I[0]>R[0]&&I[0]<R[1]?[R[0],I[0],R[1],I[1]]:[I[0],R[0],I[1],R[1]]:I;if(0!==R.length)return R}return[]}var o={};return o.computeDiscriminant=function(e,t,r,n,a){var i=e*e,o=i*e,u=t*t,s=u*t,c=r*r,l=c*r,f=n*n,d=f*n,h=a*a,m=h*a,p=u*c*f-4*s*d-4*e*l*f+18*e*t*r*d-27*i*f*f+256*o*m+a*(18*s*r*n-4*u*l+16*e*c*c-80*e*t*c*n-6*e*u*f+144*i*r*f)+h*(144*e*u*r-27*u*u-128*i*c-192*i*t*n);return p},o.computeRealRoots=function(t,n,o,u,s){if(Math.abs(t)<r.EPSILON15)return e.computeRealRoots(n,o,u,s);var c=n/t,l=o/t,f=u/t,d=s/t,h=0>c?1:0;switch(h+=0>l?h+1:h,h+=0>f?h+1:h,h+=0>d?h+1:h){case 0:return a(c,l,f,d);case 1:return i(c,l,f,d);case 2:return i(c,l,f,d);case 3:return a(c,l,f,d);case 4:return a(c,l,f,d);case 5:return i(c,l,f,d);case 6:return a(c,l,f,d);case 7:return a(c,l,f,d);case 8:return i(c,l,f,d);case 9:return a(c,l,f,d);case 10:return a(c,l,f,d);case 11:return i(c,l,f,d);case 12:return a(c,l,f,d);case 13:return a(c,l,f,d);case 14:return a(c,l,f,d);case 15:return a(c,l,f,d);default:return void 0}},o}),define("Core/Ray",["./Cartesian3","./defaultValue","./defined","./DeveloperError"],function(e,t,r){"use strict";var n=function(r,n){n=e.clone(t(n,e.ZERO)),e.equals(n,e.ZERO)||e.normalize(n,n),this.origin=e.clone(t(r,e.ZERO)),this.direction=n};return n.getPoint=function(t,n,a){return r(a)||(a=new e),a=e.multiplyByScalar(t.direction,n,a),e.add(t.origin,a,a)},n}),define("Core/IntersectionTests",["./Cartesian3","./Cartographic","./defaultValue","./defined","./DeveloperError","./Math","./Matrix3","./QuadraticRealPolynomial","./QuarticRealPolynomial","./Ray"],function(e,t,r,n,a,i,o,u,s,c){"use strict";function l(t,n,a,o,u){u=r(u,!1);var s,c,l,f,d,h=t.origin,m=t.direction,p=e.subtract(a,n,y),E=e.subtract(o,n,v),S=e.cross(m,E,g),O=e.dot(p,S);if(u){if(O<i.EPSILON6)return void 0;if(s=e.subtract(h,n,w),l=e.dot(s,S),0>l||l>O)return void 0;if(c=e.cross(s,p,x),f=e.dot(m,c),0>f||l+f>O)return void 0;d=e.dot(E,c)/O}else{if(Math.abs(O)<i.EPSILON6)return void 0;var T=1/O;if(s=e.subtract(h,n,w),l=e.dot(s,S)*T,0>l||l>1)return void 0;if(c=e.cross(s,p,x),f=e.dot(m,c)*T,0>f||l+f>1)return void 0;d=e.dot(E,c)*T}return d}function f(e,t,r,n){var a=t*t-4*e*r;if(0>a)return void 0;if(a>0){var i=1/(2*e),o=Math.sqrt(a),u=(-t+o)*i,s=(-t-o)*i;return s>u?(n.root0=u,n.root1=s):(n.root0=s,n.root1=u),n}var c=-t/(2*e);return 0===c?void 0:(n.root0=n.root1=c,n)}function d(t,r,a){n(a)||(a={});var i=t.origin,o=t.direction,u=r.center,s=r.radius*r.radius,c=e.subtract(i,u,g),l=e.dot(o,o),d=2*e.dot(o,c),h=e.magnitudeSquared(c)-s,m=f(l,d,h,S);return n(m)?(a.start=m.root0,a.stop=m.root1,a):void 0}function h(e,t,r){var n=e+t;return i.sign(e)!==i.sign(t)&&Math.abs(n/Math.max(Math.abs(e),Math.abs(t)))<r?0:n}function m(t,r,n,a,c){var l,f=a*a,d=c*c,m=(t[o.COLUMN1ROW1]-t[o.COLUMN2ROW2])*d,p=c*(a*h(t[o.COLUMN1ROW0],t[o.COLUMN0ROW1],i.EPSILON15)+r.y),y=t[o.COLUMN0ROW0]*f+t[o.COLUMN2ROW2]*d+a*r.x+n,v=d*h(t[o.COLUMN2ROW1],t[o.COLUMN1ROW2],i.EPSILON15),g=c*(a*h(t[o.COLUMN2ROW0],t[o.COLUMN0ROW2])+r.z),w=[];if(0===g&&0===v){if(l=u.computeRealRoots(m,p,y),0===l.length)return w;var x=l[0],E=Math.sqrt(Math.max(1-x*x,0));if(w.push(new e(a,c*x,c*-E)),w.push(new e(a,c*x,c*E)),2===l.length){var S=l[1],O=Math.sqrt(Math.max(1-S*S,0));w.push(new e(a,c*S,c*-O)),w.push(new e(a,c*S,c*O))}return w}var T=g*g,b=v*v,M=m*m,_=g*v,P=M+b,N=2*(p*m+_),A=2*y*m+p*p-b+T,I=2*(y*p-_),R=y*y-T;if(0===P&&0===N&&0===A&&0===I)return w;l=s.computeRealRoots(P,N,A,I,R);var z=l.length;if(0===z)return w;for(var C=0;z>C;++C){var D,L=l[C],q=L*L,U=Math.max(1-q,0),F=Math.sqrt(U);D=i.sign(m)===i.sign(y)?h(m*q+y,p*L,i.EPSILON12):i.sign(y)===i.sign(p*L)?h(m*q,p*L+y,i.EPSILON12):h(m*q+p*L,y,i.EPSILON12);var B=h(v*L,g,i.EPSILON15),W=D*B;0>W?w.push(new e(a,c*L,c*F)):W>0?w.push(new e(a,c*L,c*-F)):0!==F?(w.push(new e(a,c*L,c*-F)),w.push(new e(a,c*L,c*F)),++C):w.push(new e(a,c*L,c*F))}return w}var p={};p.rayPlane=function(t,r,a){n(a)||(a=new e);var o=t.origin,u=t.direction,s=r.normal,c=e.dot(s,u);if(Math.abs(c)<i.EPSILON15)return void 0;var l=(-r.distance-e.dot(s,o))/c;return 0>l?void 0:(a=e.multiplyByScalar(u,l,a),e.add(o,a,a))};var y=new e,v=new e,g=new e,w=new e,x=new e;p.rayTriangle=function(t,r,a,i,o,u){var s=l(t,r,a,i,o);return!n(s)||0>s?void 0:(n(u)||(u=new e),e.multiplyByScalar(t.direction,s,u),e.add(t.origin,u,u))};var E=new c;p.lineSegmentTriangle=function(t,r,a,i,o,u,s){var c=E;e.clone(t,c.origin),e.subtract(r,t,c.direction),e.normalize(c.direction,c.direction);var f=l(c,a,i,o,u);return!n(f)||0>f||f>e.distance(t,r)?void 0:(n(s)||(s=new e),e.multiplyByScalar(c.direction,f,s),e.add(c.origin,s,s))};var S={root0:0,root1:0};p.raySphere=function(e,t,r){return r=d(e,t,r),!n(r)||r.stop<0?void 0:(r.start=Math.max(r.start,0),r)};var O=new c;p.lineSegmentSphere=function(t,r,a,i){var o=O;e.clone(t,o.origin);var u=e.subtract(r,t,o.direction),s=e.magnitude(u);return e.normalize(u,u),i=d(o,a,i),!n(i)||i.stop<0||i.start>s?void 0:(i.start=Math.max(i.start,0),i.stop=Math.min(i.stop,s),i)};var T=new e,b=new e;p.rayEllipsoid=function(t,r){var n,a,i,o,u,s=r.oneOverRadii,c=e.multiplyComponents(s,t.origin,T),l=e.multiplyComponents(s,t.direction,b),f=e.magnitudeSquared(c),d=e.dot(c,l);if(f>1){if(d>=0)return void 0;var h=d*d;if(n=f-1,a=e.magnitudeSquared(l),i=a*n,i>h)return void 0;if(h>i){o=d*d-i,u=-d+Math.sqrt(o);var m=u/a,p=n/u;return p>m?{start:m,stop:p}:{start:p,stop:m}}var y=Math.sqrt(n/a);return{start:y,stop:y}}return 1>f?(n=f-1,a=e.magnitudeSquared(l),i=a*n,o=d*d-i,u=-d+Math.sqrt(o),{start:0,stop:u/a}):0>d?(a=e.magnitudeSquared(l),{start:0,stop:-d/a}):void 0};var M=new e,_=new e,P=new e,N=new e,A=new e,I=new o,R=new o,z=new o,C=new o,D=new o,L=new o,q=new o,U=new e,F=new e,B=new t;p.grazingAltitudeLocation=function(t,r){var a=t.origin,u=t.direction,s=r.geodeticSurfaceNormal(a,M);if(e.dot(u,s)>=0)return a;var c=n(this.rayEllipsoid(t,r)),l=r.transformPositionToScaledSpace(u,M),f=e.normalize(l,l),d=e.mostOrthogonalAxis(l,N),h=e.normalize(e.cross(d,f,_),_),p=e.normalize(e.cross(f,h,P),P),y=I;y[0]=f.x,y[1]=f.y,y[2]=f.z,y[3]=h.x,y[4]=h.y,y[5]=h.z,y[6]=p.x,y[7]=p.y,y[8]=p.z;var v=o.transpose(y,R),g=o.fromScale(r.radii,z),w=o.fromScale(r.oneOverRadii,C),x=D;x[0]=0,x[1]=-u.z,x[2]=u.y,x[3]=u.z,x[4]=0,x[5]=-u.x,x[6]=-u.y,x[7]=u.x,x[8]=0;var E,S,O=o.multiply(o.multiply(v,w,L),x,L),T=o.multiply(o.multiply(O,g,q),y,q),b=o.multiplyByVector(O,a,A),W=m(T,e.negate(b,M),0,0,1),G=W.length;if(G>0){for(var k=e.clone(e.ZERO,F),V=Number.NEGATIVE_INFINITY,Y=0;G>Y;++Y){E=o.multiplyByVector(g,o.multiplyByVector(y,W[Y],U),U);var j=e.normalize(e.subtract(E,a,N),N),H=e.dot(j,u);H>V&&(V=H,k=e.clone(E,k))}var X=r.cartesianToCartographic(k,B);return V=i.clamp(V,0,1),S=e.magnitude(e.subtract(k,a,N))*Math.sqrt(1-V*V),S=c?-S:S,X.height=S,r.cartographicToCartesian(X,new e)}return void 0};var W=new e;return p.lineSegmentPlane=function(t,r,a,o){n(o)||(o=new e);var u=e.subtract(r,t,W),s=a.normal,c=e.dot(s,u);if(Math.abs(c)<i.EPSILON6)return void 0;var l=e.dot(s,t),f=-(a.distance+l)/c;return 0>f||f>1?void 0:(e.multiplyByScalar(u,f,o),e.add(t,o,o),o)},p.trianglePlaneIntersection=function(t,r,n,a){var i=a.normal,o=a.distance,u=e.dot(i,t)+o<0,s=e.dot(i,r)+o<0,c=e.dot(i,n)+o<0,l=0;l+=u?1:0,l+=s?1:0,l+=c?1:0;var f,d;if((1===l||2===l)&&(f=new e,d=new e),1===l){if(u)return p.lineSegmentPlane(t,r,a,f),p.lineSegmentPlane(t,n,a,d),{positions:[t,r,n,f,d],indices:[0,3,4,1,2,4,1,4,3]};if(s)return p.lineSegmentPlane(r,n,a,f),p.lineSegmentPlane(r,t,a,d),{positions:[t,r,n,f,d],indices:[1,3,4,2,0,4,2,4,3]};if(c)return p.lineSegmentPlane(n,t,a,f),p.lineSegmentPlane(n,r,a,d),{positions:[t,r,n,f,d],indices:[2,3,4,0,1,4,0,4,3]}}else if(2===l){if(!u)return p.lineSegmentPlane(r,t,a,f),p.lineSegmentPlane(n,t,a,d),{positions:[t,r,n,f,d],indices:[1,2,4,1,4,3,0,3,4]};if(!s)return p.lineSegmentPlane(n,r,a,f),p.lineSegmentPlane(t,r,a,d),{positions:[t,r,n,f,d],indices:[2,0,4,2,4,3,1,3,4]};if(!c)return p.lineSegmentPlane(t,n,a,f),p.lineSegmentPlane(r,n,a,d),{positions:[t,r,n,f,d],indices:[0,1,4,0,4,3,2,3,4]}}return void 0},p}),define("Core/Plane",["./Cartesian3","./defined","./DeveloperError"],function(e,t){"use strict";var r=function(t,r){this.normal=e.clone(t),this.distance=r};return r.fromPointNormal=function(n,a,i){var o=-e.dot(a,n);return t(i)?(e.clone(a,i.normal),i.distance=o,i):new r(a,o)},r.getPointDistance=function(t,r){return e.dot(t.normal,r)+t.distance},r}),define("Core/Tipsify",["./defaultValue","./defined","./DeveloperError"],function(e,t){"use strict";var r={};return r.calculateACMR=function(r){r=e(r,e.EMPTY_OBJECT);var n=r.indices,a=r.maximumIndex,i=e(r.cacheSize,24),o=n.length;if(!t(a)){a=0;for(var u=0,s=n[u];o>u;)s>a&&(a=s),++u,s=n[u]}for(var c=[],l=0;a+1>l;l++)c[l]=0;for(var f=i+1,d=0;o>d;++d)f-c[n[d]]>i&&(c[n[d]]=f,++f);return(f-i+1)/(o/3)},r.tipsify=function(r){function n(e,t,r,n){for(;t.length>=1;){var a=t[t.length-1];if(t.splice(t.length-1,1),e[a].numLiveTriangles>0)return a}for(;n>i;){if(e[i].numLiveTriangles>0)return++i,i-1;++i}return-1}function a(e,t,r,a,i,o,u){for(var s,c=-1,l=-1,f=0;f<r.length;){var d=r[f];a[d].numLiveTriangles&&(s=0,i-a[d].timeStamp+2*a[d].numLiveTriangles<=t&&(s=i-a[d].timeStamp),(s>l||-1===l)&&(l=s,c=d)),++f}return-1===c?n(a,o,e,u):c}r=e(r,e.EMPTY_OBJECT);var i,o=r.indices,u=r.maximumIndex,s=e(r.cacheSize,24),c=o.length,l=0,f=0,d=o[f],h=c;if(t(u))l=u+1;else{for(;h>f;)d>l&&(l=d),++f,d=o[f];if(-1===l)return 0;++l}for(var m=[],p=0;l>p;p++)m[p]={numLiveTriangles:0,timeStamp:0,vertexTriangles:[]};f=0;for(var y=0;h>f;)m[o[f]].vertexTriangles.push(y),++m[o[f]].numLiveTriangles,m[o[f+1]].vertexTriangles.push(y),++m[o[f+1]].numLiveTriangles,m[o[f+2]].vertexTriangles.push(y),++m[o[f+2]].numLiveTriangles,++y,f+=3;var v=0,g=s+1;i=1;var w,x,E=[],S=[],O=0,T=[],b=c/3,M=[];for(p=0;b>p;p++)M[p]=!1;for(var _,P;-1!==v;){E=[],x=m[v],P=x.vertexTriangles.length;for(var N=0;P>N;++N)if(y=x.vertexTriangles[N],!M[y]){M[y]=!0,f=y+y+y;for(var A=0;3>A;++A)_=o[f],E.push(_),S.push(_),T[O]=_,++O,w=m[_],--w.numLiveTriangles,g-w.timeStamp>s&&(w.timeStamp=g,++g),++f}v=a(o,s,E,m,g,S,l)}return T},r}),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,t,r,n,a,i,o,u,s,c,l,f,d,h,m,p,y,v,g,w,x,E,S,O,T,b){"use strict";function M(e,t,r,n,a){e[t++]=r,e[t++]=n,e[t++]=n,e[t++]=a,e[t++]=a,e[t]=r}function _(e){for(var t=e.length,r=6*(t/3),n=v.createTypedArray(t,r),a=0,i=0;t>i;i+=3,a+=6)M(n,a,e[i],e[i+1],e[i+2]);return n}function P(e){var t=e.length;if(t>=3){var r=6*(t-2),n=v.createTypedArray(t,r);M(n,0,e[0],e[1],e[2]);for(var a=6,i=3;t>i;++i,a+=6)M(n,a,e[i-1],e[i],e[i-2]);return n}return new Uint16Array}function N(e){if(e.length>0){for(var t=e.length-1,r=6*(t-1),n=v.createTypedArray(t,r),a=e[0],i=0,o=1;t>o;++o,i+=6)M(n,i,a,e[o],e[o+1]);return n}return new Uint16Array}function A(e){var t={};for(var r in e)if(e.hasOwnProperty(r)&&c(e[r])&&c(e[r].values)){var n=e[r];t[r]=new m({componentDatatype:n.componentDatatype,componentsPerAttribute:n.componentsPerAttribute,normalize:n.normalize,values:[]})}return t}function I(e,t,r){for(var n in t)if(t.hasOwnProperty(n)&&c(t[n])&&c(t[n].values))for(var a=t[n],i=0;i<a.componentsPerAttribute;++i)e[n].values.push(a.values[r*a.componentsPerAttribute+i])}function R(e,t){if(c(t))for(var r=t.values,n=r.length,i=0;n>i;i+=3)a.unpack(r,i,it),S.multiplyByPoint(e,it,it),a.pack(it,r,i)}function z(e,t){if(c(t))for(var r=t.values,n=r.length,i=0;n>i;i+=3)a.unpack(r,i,it),E.multiplyByVector(e,it,it),it=a.normalize(it,it),a.pack(it,r,i)}function C(e,t){var r,n=e.length,a={},i=e[0][t].attributes;for(r in i)if(i.hasOwnProperty(r)&&c(i[r])&&c(i[r].values)){for(var o=i[r],s=o.values.length,l=!0,f=1;n>f;++f){var d=e[f][t].attributes[r];if(!c(d)||o.componentDatatype!==d.componentDatatype||o.componentsPerAttribute!==d.componentsPerAttribute||o.normalize!==d.normalize){l=!1;break}s+=d.values.length}l&&(a[r]=new m({componentDatatype:o.componentDatatype,componentsPerAttribute:o.componentsPerAttribute,normalize:o.normalize,values:u.createTypedArray(o.componentDatatype,s)}))}return a}function D(e,t){var n,i,o,u,s=e.length;e[0].modelMatrix;var l,f,d,m=c(e[0][t].indices),p=e[0][t].primitiveType,y=C(e,t);for(n in y)if(y.hasOwnProperty(n))for(l=y[n].values,u=0,i=0;s>i;++i)for(f=e[i][t].attributes[n].values,d=f.length,o=0;d>o;++o)l[u++]=f[o];var g;if(m){var w=0;for(i=0;s>i;++i)w+=e[i][t].indices.length;var x=h.computeNumberOfVertices(new h({attributes:y,primitiveType:T.POINTS})),E=v.createTypedArray(x,w),S=0,O=0;for(i=0;s>i;++i){var b=e[i][t].indices,M=b.length;for(u=0;M>u;++u)E[S++]=O+b[u];O+=h.computeNumberOfVertices(e[i][t])}g=E}var _,P=new a,N=0;for(i=0;s>i;++i){if(_=e[i][t].boundingSphere,!c(_)){P=void 0;break}a.add(_.center,P,P)}if(c(P))for(a.divideByScalar(P,s,P),i=0;s>i;++i){_=e[i][t].boundingSphere;var A=a.magnitude(a.subtract(_.center,P,st))+_.radius;A>N&&(N=A)}return new h({attributes:y,indices:g,primitiveType:p,boundingSphere:c(P)?new r(P,N):void 0})}function L(e){if(c(e.indices))return e;for(var t=h.computeNumberOfVertices(e),r=v.createTypedArray(t,t),n=0;t>n;++n)r[n]=n;return e.indices=r,e}function q(e){var t=h.computeNumberOfVertices(e),r=v.createTypedArray(t,3*(t-2));r[0]=1,r[1]=0,r[2]=2;for(var n=3,a=3;t>a;++a)r[n++]=a-1,r[n++]=0,r[n++]=a;return e.indices=r,e.primitiveType=T.TRIANGLES,e}function U(e){var t=h.computeNumberOfVertices(e),r=v.createTypedArray(t,3*(t-2));r[0]=0,r[1]=1,r[2]=2,t>3&&(r[3]=0,r[4]=2,r[5]=3);for(var n=6,a=3;t-1>a;a+=2)r[n++]=a,r[n++]=a-1,r[n++]=a+1,t>a+2&&(r[n++]=a,r[n++]=a+1,r[n++]=a+2);return e.indices=r,e.primitiveType=T.TRIANGLES,e}function F(e){if(c(e.indices))return e;for(var t=h.computeNumberOfVertices(e),r=v.createTypedArray(t,t),n=0;t>n;++n)r[n]=n;return e.indices=r,e}function B(e){var t=h.computeNumberOfVertices(e),r=v.createTypedArray(t,2*(t-1));r[0]=0,r[1]=1;for(var n=2,a=2;t>a;++a)r[n++]=a-1,r[n++]=a;return e.indices=r,e.primitiveType=T.LINES,e}function W(e){var t=h.computeNumberOfVertices(e),r=v.createTypedArray(t,2*t);r[0]=0,r[1]=1;for(var n=2,a=2;t>a;++a)r[n++]=a-1,r[n++]=a;return r[n++]=t-1,r[n]=0,e.indices=r,e.primitiveType=T.LINES,e}function G(e){switch(e.primitiveType){case T.TRIANGLE_FAN:return q(e);case T.TRIANGLE_STRIP:return U(e);case T.TRIANGLES:return L(e);case T.LINE_STRIP:return B(e);case T.LINE_LOOP:return W(e);case T.LINES:return F(e)}return e}function k(e,t){Math.abs(e.y)<x.EPSILON6&&(e.y=t?-x.EPSILON6:x.EPSILON6)}function V(e,t,r){if(0!==e.y&&0!==t.y&&0!==r.y)return k(e,e.y<0),k(t,t.y<0),k(r,r.y<0),void 0;var n,a=Math.abs(e.y),i=Math.abs(t.y),o=Math.abs(r.y);n=a>i?a>o?x.sign(e.y):x.sign(r.y):i>o?x.sign(t.y):x.sign(r.y);var u=0>n;k(e,u),k(t,u),k(r,u)}function Y(e,t,r,n){a.add(e,a.multiplyByScalar(a.subtract(t,e,xt),e.y/(e.y-t.y),xt),r),a.clone(r,n),k(r,!0),k(n,!1)}function j(e,t,r){if(e.x>=0||t.x>=0||r.x>=0)return void 0;V(e,t,r);var n=e.y<0,a=t.y<0,i=r.y<0,o=0;o+=n?1:0,o+=a?1:0,o+=i?1:0;var u=bt.indices;1===o?(u[1]=3,u[2]=4,u[5]=6,u[7]=6,u[8]=5,n?(Y(e,t,Et,Ot),Y(e,r,St,Tt),u[0]=0,u[3]=1,u[4]=2,u[6]=1):a?(Y(t,r,Et,Ot),Y(t,e,St,Tt),u[0]=1,u[3]=2,u[4]=0,u[6]=2):i&&(Y(r,e,Et,Ot),Y(r,t,St,Tt),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?a?i||(Y(r,e,Et,Ot),Y(r,t,St,Tt),u[0]=0,u[1]=1,u[3]=0,u[6]=2):(Y(t,r,Et,Ot),Y(t,e,St,Tt),u[0]=2,u[1]=0,u[3]=2,u[6]=1):(Y(e,t,Et,Ot),Y(e,r,St,Tt),u[0]=1,u[1]=2,u[3]=1,u[6]=0));var s=bt.positions;return s[0]=e,s[1]=t,s[2]=r,s.length=3,(1===o||2===o)&&(s[3]=Et,s[4]=St,s[5]=Ot,s[6]=Tt,s.length=7),bt}function H(e,t){var n=e.attributes;if(0===n.position.values.length)return void 0;for(var a in n)if(n.hasOwnProperty(a)&&c(n[a])&&c(n[a].values)){var i=n[a];i.values=u.createTypedArray(i.componentDatatype,i.values)}var o=h.computeNumberOfVertices(e);return e.indices=v.createTypedArray(o,e.indices),t&&(e.boundingSphere=r.fromVertices(n.position.values)),e}function X(e){var t=e.attributes,r={};for(var n in t)if(t.hasOwnProperty(n)&&c(t[n])&&c(t[n].values)){var a=t[n];r[n]=new m({componentDatatype:a.componentDatatype,componentsPerAttribute:a.componentsPerAttribute,normalize:a.normalize,values:[]})}return new h({attributes:r,indices:[],primitiveType:e.primitiveType})}function Z(e,t,r){var n=c(e.geometry.boundingSphere);t=H(t,n),r=H(r,n),c(r)&&!c(t)?e.geometry=r:!c(r)&&c(t)?e.geometry=t:(e.westHemisphereGeometry=t,e.eastHemisphereGeometry=r,e.geometry=void 0)}function J(e,r,i,o,u,s,l,f,d,h,m){if(c(s)||c(l)||c(f)||c(d)){var p=a.fromArray(u,3*e,Mt),y=a.fromArray(u,3*r,_t),v=a.fromArray(u,3*i,Pt),g=t(o,p,y,v,Nt);if(c(s)){var w=a.fromArray(s,3*e,Mt),x=a.fromArray(s,3*r,_t),E=a.fromArray(s,3*i,Pt);a.multiplyByScalar(w,g.x,w),a.multiplyByScalar(x,g.y,x),a.multiplyByScalar(E,g.z,E);var S=a.add(w,x,w);a.add(S,E,S),a.normalize(S,S),a.pack(S,h.normal.values,3*m)}if(c(l)){var O=a.fromArray(l,3*e,Mt),T=a.fromArray(l,3*r,_t),b=a.fromArray(l,3*i,Pt);a.multiplyByScalar(O,g.x,O),a.multiplyByScalar(T,g.y,T),a.multiplyByScalar(b,g.z,b);var M=a.add(O,T,O);a.add(M,b,M),a.normalize(M,M),a.pack(M,h.binormal.values,3*m)}if(c(f)){var _=a.fromArray(f,3*e,Mt),P=a.fromArray(f,3*r,_t),N=a.fromArray(f,3*i,Pt);a.multiplyByScalar(_,g.x,_),a.multiplyByScalar(P,g.y,P),a.multiplyByScalar(N,g.z,N);var A=a.add(_,P,_);a.add(A,N,A),a.normalize(A,A),a.pack(A,h.tangent.values,3*m)}if(c(d)){var I=n.fromArray(d,2*e,At),R=n.fromArray(d,2*r,It),z=n.fromArray(d,2*i,Rt);n.multiplyByScalar(I,g.x,I),n.multiplyByScalar(R,g.y,R),n.multiplyByScalar(z,g.z,z);var C=n.add(I,R,I);n.add(C,z,C),n.pack(C,h.st.values,2*m)}}}function K(e,t,r,n,a,i){var o=e.position.values.length/3;if(-1!==a){var u=n[a],s=r[u];return-1===s?(r[u]=o,e.position.values.push(i.x,i.y,i.z),t.push(o),o):(t.push(s),s)}return e.position.values.push(i.x,i.y,i.z),t.push(o),o}function Q(e){var t,r,n,i,o,u=e.geometry,s=u.attributes,l=s.position.values,f=c(s.normal)?s.normal.values:void 0,d=c(s.binormal)?s.binormal.values:void 0,h=c(s.tangent)?s.tangent.values:void 0,m=c(s.st)?s.st.values:void 0,p=u.indices,y=X(u),v=X(u),g=[];g.length=l.length/3;var w=[];for(w.length=l.length/3,o=0;o<g.length;++o)g[o]=-1,w[o]=-1;var x=p.length;for(o=0;x>o;o+=3){var E=p[o],S=p[o+1],O=p[o+2],T=a.fromArray(l,3*E),b=a.fromArray(l,3*S),M=a.fromArray(l,3*O),_=j(T,b,M);if(c(_)&&_.positions.length>3)for(var P=_.positions,N=_.indices,A=N.length,I=0;A>I;++I){var R=N[I],z=P[R];z.y<0?(t=v.attributes,r=v.indices,n=g):(t=y.attributes,r=y.indices,n=w),i=K(t,r,n,p,3>R?o+R:-1,z),J(E,S,O,z,l,f,d,h,m,t,i)}else c(_)&&(T=_.positions[0],b=_.positions[1],M=_.positions[2]),T.y<0?(t=v.attributes,r=v.indices,n=g):(t=y.attributes,r=y.indices,n=w),i=K(t,r,n,p,o,T),J(E,S,O,T,l,f,d,h,m,t,i),i=K(t,r,n,p,o+1,b),J(E,S,O,b,l,f,d,h,m,t,i),i=K(t,r,n,p,o+2,M),J(E,S,O,M,l,f,d,h,m,t,i)}Z(e,v,y)}function $(e){var t,r=e.geometry,n=r.attributes,i=n.position.values,o=r.indices,u=X(r),s=X(r),l=o.length,f=[];f.length=i.length/3;var d=[];for(d.length=i.length/3,t=0;t<f.length;++t)f[t]=-1,d[t]=-1;for(t=0;l>t;t+=2){var h=o[t],m=o[t+1],p=a.fromArray(i,3*h,Mt),y=a.fromArray(i,3*m,_t);Math.abs(p.y)<x.EPSILON6&&(p.y=p.y<0?-x.EPSILON6:x.EPSILON6),Math.abs(y.y)<x.EPSILON6&&(y.y=y.y<0?-x.EPSILON6:x.EPSILON6);var v=u.attributes,g=u.indices,E=d,S=s.attributes,O=s.indices,T=f,b=w.lineSegmentPlane(p,y,zt,Pt);if(c(b)){var M=a.multiplyByScalar(a.UNIT_Y,5*x.EPSILON9,Ct);p.y<0&&(a.negate(M,M),v=s.attributes,g=s.indices,E=f,S=u.attributes,O=u.indices,T=d);var _=a.add(b,M,Dt);K(v,g,E,o,t,p),K(v,g,E,o,-1,_),a.negate(M,M),a.add(b,M,_),K(S,O,T,o,-1,_),K(S,O,T,o,t+1,y)}else{var P,N,A;p.y<0?(P=s.attributes,N=s.indices,A=f):(P=u.attributes,N=u.indices,A=d),K(P,N,A,o,t,p),K(P,N,A,o,t+1,y)}}Z(e,s,u)}function et(e){var t=e.geometry,r=t.attributes,o=r.position.values,u=r.prevPosition.values,s=r.nextPosition.values,l=r.expandAndWidth.values;t.indices;var f,d,h,m=c(r.st)?r.st.values:void 0,p=c(r.color)?r.color.values:void 0,y=X(t),v=X(t),g=o.length/3;for(f=0;g>f;f+=4){var E=f,S=f+1,O=f+2,T=f+3,b=a.fromArray(o,3*E,Ut),M=a.fromArray(o,3*S,Ft),_=a.fromArray(o,3*O,Bt),P=a.fromArray(o,3*T,Wt);Math.abs(b.y)<x.EPSILON6&&(b.y=x.EPSILON6*(_.y<0?-1:1),M.y=b.y),Math.abs(_.y)<x.EPSILON6&&(_.y=x.EPSILON6*(b.y<0?-1:1),P.y=_.y);var N=y.attributes,A=y.indices,I=v.attributes,R=v.indices,z=w.lineSegmentPlane(b,_,zt,Gt);if(c(z)){var C=a.multiplyByScalar(a.UNIT_Y,5*x.EPSILON9,kt);b.y<0&&(a.negate(C,C),N=v.attributes,A=v.indices,I=y.attributes,R=y.indices);var D=a.add(z,C,Vt);for(N.position.values.push(b.x,b.y,b.z,M.x,M.y,M.z),N.position.values.push(D.x,D.y,D.z),N.position.values.push(D.x,D.y,D.z),a.negate(C,C),a.add(z,C,D),I.position.values.push(D.x,D.y,D.z),I.position.values.push(D.x,D.y,D.z),I.position.values.push(_.x,_.y,_.z,P.x,P.y,P.z),d=3*E;3*E+6>d;++d)N.prevPosition.values.push(u[d]);for(N.prevPosition.values.push(b.x,b.y,b.z,b.x,b.y,b.z),I.prevPosition.values.push(b.x,b.y,b.z,b.x,b.y,b.z),d=3*O;3*O+6>d;++d)I.prevPosition.values.push(u[d]);for(d=3*E;3*E+6>d;++d)N.nextPosition.values.push(s[d]);for(N.nextPosition.values.push(_.x,_.y,_.z,_.x,_.y,_.z),I.nextPosition.values.push(_.x,_.y,_.z,_.x,_.y,_.z),d=3*O;3*O+6>d;++d)I.nextPosition.values.push(s[d]);var L=n.fromArray(l,2*E,Lt),q=Math.abs(L.y);N.expandAndWidth.values.push(-1,q,1,q),N.expandAndWidth.values.push(-1,-q,1,-q),I.expandAndWidth.values.push(-1,q,1,q),I.expandAndWidth.values.push(-1,-q,1,-q);var U=a.magnitudeSquared(a.subtract(z,b,Wt));if(U/=a.magnitudeSquared(a.subtract(_,b,Wt)),c(p)){var F=i.fromArray(p,4*E,Yt),B=i.fromArray(p,4*O,Yt),W=x.lerp(F.x,B.x,U),G=x.lerp(F.y,B.y,U),k=x.lerp(F.z,B.z,U),V=x.lerp(F.w,B.w,U);for(d=4*E;4*E+8>d;++d)N.color.values.push(p[d]);for(N.color.values.push(W,G,k,V),N.color.values.push(W,G,k,V),I.color.values.push(W,G,k,V),I.color.values.push(W,G,k,V),d=4*O;4*O+8>d;++d)I.color.values.push(p[d])}if(c(m)){var Y=n.fromArray(m,2*E,Lt),j=n.fromArray(m,2*(f+3),qt),H=x.lerp(Y.x,j.x,U);for(d=2*E;2*E+4>d;++d)N.st.values.push(m[d]);for(N.st.values.push(H,Y.y),N.st.values.push(H,j.y),I.st.values.push(H,Y.y),I.st.values.push(H,j.y),d=2*O;2*O+4>d;++d)I.st.values.push(m[d])}h=N.position.values.length/3-4,A.push(h,h+2,h+1),A.push(h+1,h+2,h+3),h=I.position.values.length/3-4,R.push(h,h+2,h+1),R.push(h+1,h+2,h+3)}else{var J,K;for(b.y<0?(J=v.attributes,K=v.indices):(J=y.attributes,K=y.indices),J.position.values.push(b.x,b.y,b.z),J.position.values.push(M.x,M.y,M.z),J.position.values.push(_.x,_.y,_.z),J.position.values.push(P.x,P.y,P.z),d=3*f;3*f+12>d;++d)J.prevPosition.values.push(u[d]),J.nextPosition.values.push(s[d]);for(d=2*f;2*f+8>d;++d)J.expandAndWidth.values.push(l[d]),c(m)&&J.st.values.push(m[d]);if(c(p))for(d=4*f;4*f+16>d;++d)J.color.values.push(p[d]);h=J.position.values.length/3-4,K.push(h,h+2,h+1),K.push(h+1,h+2,h+3)}}Z(e,v,y)}var tt={};tt.toWireframe=function(e){var t=e.indices;if(c(t)){switch(e.primitiveType){case T.TRIANGLES:e.indices=_(t);break;case T.TRIANGLE_STRIP:e.indices=P(t);break;case T.TRIANGLE_FAN:e.indices=N(t);break;default:throw new l("geometry.primitiveType must be TRIANGLES, TRIANGLE_STRIP, or TRIANGLE_FAN.")}e.primitiveType=T.LINES}return e},tt.createLineSegmentsForVectors=function(e,t,n){t=s(t,"normal"),n=s(n,1e4);for(var a=e.attributes.position.values,i=e.attributes[t].values,o=a.length,l=new Float64Array(2*o),f=0,d=0;o>d;d+=3)l[f++]=a[d],l[f++]=a[d+1],l[f++]=a[d+2],l[f++]=a[d]+i[d]*n,l[f++]=a[d+1]+i[d+1]*n,l[f++]=a[d+2]+i[d+2]*n;var p,y=e.boundingSphere;return c(y)&&(p=new r(y.center,y.radius+n)),new h({attributes:{position:new m({componentDatatype:u.DOUBLE,componentsPerAttribute:3,values:l})},primitiveType:T.LINES,boundingSphere:p})},tt.createAttributeLocations=function(e){var t,r=["position","positionHigh","positionLow","position3DHigh","position3DLow","position2DHigh","position2DLow","pickColor","normal","st","binormal","tangent","compressedAttributes"],n=e.attributes,a={},i=0,o=r.length;for(t=0;o>t;++t){var u=r[t];c(n[u])&&(a[u]=i++)}for(var s in n)n.hasOwnProperty(s)&&!c(a[s])&&(a[s]=i++);return a},tt.reorderForPreVertexCache=function(e){var t=h.computeNumberOfVertices(e),r=e.indices;if(c(r)){for(var n=new Int32Array(t),a=0;t>a;a++)n[a]=-1;for(var i,o=r,s=o.length,l=v.createTypedArray(t,s),f=0,d=0,m=0;s>f;)i=n[o[f]],-1!==i?l[d]=i:(i=o[f],n[i]=m,l[d]=m,++m),++f,++d;e.indices=l;var p=e.attributes;for(var y in p)if(p.hasOwnProperty(y)&&c(p[y])&&c(p[y].values)){for(var g=p[y],w=g.values,x=0,E=g.componentsPerAttribute,S=u.createTypedArray(g.componentDatatype,m*E);t>x;){var O=n[x];if(-1!==O)for(a=0;E>a;a++)S[E*O+a]=w[E*x+a];++x}g.values=S}}return e},tt.reorderForPostVertexCache=function(e,t){var r=e.indices;if(e.primitiveType===T.TRIANGLES&&c(r)){for(var n=r.length,a=0,i=0;n>i;i++)r[i]>a&&(a=r[i]);e.indices=b.tipsify({indices:r,maximumIndex:a,cacheSize:t})}return e},tt.fitToUnsignedShortIndices=function(e){var t=[],r=h.computeNumberOfVertices(e);if(c(e.indices)&&r>x.SIXTY_FOUR_KILOBYTES){var n,a=[],i=[],o=0,u=A(e.attributes),s=e.indices,l=s.length;e.primitiveType===T.TRIANGLES?n=3:e.primitiveType===T.LINES?n=2:e.primitiveType===T.POINTS&&(n=1);for(var f=0;l>f;f+=n){for(var d=0;n>d;++d){var m=s[f+d],p=a[m];c(p)||(p=o++,a[m]=p,I(u,e.attributes,m)),i.push(p)}o+n>x.SIXTY_FOUR_KILOBYTES&&(t.push(new h({attributes:u,indices:i,primitiveType:e.primitiveType,boundingSphere:e.boundingSphere,boundingSphereCV:e.boundingSphereCV})),a=[],i=[],o=0,u=A(e.attributes))
}0!==i.length&&t.push(new h({attributes:u,indices:i,primitiveType:e.primitiveType,boundingSphere:e.boundingSphere,boundingSphereCV:e.boundingSphereCV}))}else t.push(e);return t};var rt=new a,nt=new o;tt.projectTo2D=function(e,t,r,n,i){var o=e.attributes[t];i=c(i)?i:new d;for(var s=i.ellipsoid,f=o.values,h=new Float64Array(f.length),p=0,y=0;y<f.length;y+=3){var v=a.fromArray(f,y,rt),g=s.cartesianToCartographic(v,nt);if(!c(g))throw new l("Could not project point ("+v.x+", "+v.y+", "+v.z+") to 2D.");var w=i.project(g,rt);h[p++]=w.x,h[p++]=w.y,h[p++]=w.z}return e.attributes[r]=o,e.attributes[n]=new m({componentDatatype:u.DOUBLE,componentsPerAttribute:3,values:h}),delete e.attributes[t],e};var at={high:0,low:0};tt.encodeAttribute=function(e,t,r,n){for(var a=e.attributes[t],i=a.values,o=i.length,s=new Float32Array(o),c=new Float32Array(o),l=0;o>l;++l)f.encode(i[l],at),s[l]=at.high,c[l]=at.low;var d=a.componentsPerAttribute;return e.attributes[r]=new m({componentDatatype:u.FLOAT,componentsPerAttribute:d,values:s}),e.attributes[n]=new m({componentDatatype:u.FLOAT,componentsPerAttribute:d,values:c}),delete e.attributes[t],e};var it=new a,ot=new S,ut=new E;tt.transformToWorldCoordinates=function(e){var t=e.modelMatrix;if(S.equals(t,S.IDENTITY))return e;var n=e.geometry.attributes;R(t,n.position),R(t,n.prevPosition),R(t,n.nextPosition),(c(n.normal)||c(n.binormal)||c(n.tangent))&&(S.inverse(t,ot),S.transpose(ot,ot),S.getRotation(ot,ut),z(ut,n.normal),z(ut,n.binormal),z(ut,n.tangent));var a=e.geometry.boundingSphere;return c(a)&&(e.geometry.boundingSphere=r.transform(a,t,a)),e.modelMatrix=S.clone(S.IDENTITY),e};var st=new a;tt.combineInstances=function(e){for(var t=[],r=[],n=e.length,a=0;n>a;++a){var i=e[a];c(i.geometry)?t.push(i):r.push(i)}var o=[];return t.length>0&&o.push(D(t,"geometry")),r.length>0&&(o.push(D(r,"westHemisphereGeometry")),o.push(D(r,"eastHemisphereGeometry"))),o};var ct=new a,lt=new a,ft=new a,dt=new a;tt.computeNormal=function(e){for(var t=e.indices,r=e.attributes,n=r.position.values,i=r.position.values.length/3,o=t.length,s=new Array(i),c=new Array(o/3),l=new Array(o),f=0;i>f;f++)s[f]={indexOffset:0,count:0,currentCount:0};var d=0;for(f=0;o>f;f+=3){var h=t[f],p=t[f+1],y=t[f+2],v=3*h,g=3*p,w=3*y;lt.x=n[v],lt.y=n[v+1],lt.z=n[v+2],ft.x=n[g],ft.y=n[g+1],ft.z=n[g+2],dt.x=n[w],dt.y=n[w+1],dt.z=n[w+2],s[h].count++,s[p].count++,s[y].count++,a.subtract(ft,lt,ft),a.subtract(dt,lt,dt),c[d]=a.cross(ft,dt,new a),d++}var x=0;for(f=0;i>f;f++)s[f].indexOffset+=x,x+=s[f].count;d=0;var E;for(f=0;o>f;f+=3){E=s[t[f]];var S=E.indexOffset+E.currentCount;l[S]=d,E.currentCount++,E=s[t[f+1]],S=E.indexOffset+E.currentCount,l[S]=d,E.currentCount++,E=s[t[f+2]],S=E.indexOffset+E.currentCount,l[S]=d,E.currentCount++,d++}var O=new Float32Array(3*i);for(f=0;i>f;f++){var T=3*f;if(E=s[f],E.count>0){for(a.clone(a.ZERO,ct),d=0;d<E.count;d++)a.add(ct,c[l[E.indexOffset+d]],ct);a.normalize(ct,ct),O[T]=ct.x,O[T+1]=ct.y,O[T+2]=ct.z}else O[T]=0,O[T+1]=0,O[T+2]=1}return e.attributes.normal=new m({componentDatatype:u.FLOAT,componentsPerAttribute:3,values:O}),e};var ht=new a,mt=new a,pt=new a;tt.computeBinormalAndTangent=function(e){e.attributes;for(var t=e.indices,r=e.attributes.position.values,n=e.attributes.normal.values,i=e.attributes.st.values,o=e.attributes.position.values.length/3,s=t.length,c=new Array(3*o),l=0;l<c.length;l++)c[l]=0;var f,d,h;for(l=0;s>l;l+=3){var p=t[l],y=t[l+1],v=t[l+2];f=3*p,d=3*y,h=3*v;var g=2*p,w=2*y,x=2*v,E=r[f],S=r[f+1],O=r[f+2],T=i[g],b=i[g+1],M=i[w+1]-b,_=i[x+1]-b,P=1/((i[w]-T)*_-(i[x]-T)*M),N=(_*(r[d]-E)-M*(r[h]-E))*P,A=(_*(r[d+1]-S)-M*(r[h+1]-S))*P,I=(_*(r[d+2]-O)-M*(r[h+2]-O))*P;c[f]+=N,c[f+1]+=A,c[f+2]+=I,c[d]+=N,c[d+1]+=A,c[d+2]+=I,c[h]+=N,c[h+1]+=A,c[h+2]+=I}var R=new Float32Array(3*o),z=new Float32Array(3*o);for(l=0;o>l;l++){f=3*l,d=f+1,h=f+2;var C=a.fromArray(n,f,ht),D=a.fromArray(c,f,pt),L=a.dot(C,D);a.multiplyByScalar(C,L,mt),a.normalize(a.subtract(D,mt,D),D),z[f]=D.x,z[d]=D.y,z[h]=D.z,a.normalize(a.cross(C,D,D),D),R[f]=D.x,R[d]=D.y,R[h]=D.z}return e.attributes.tangent=new m({componentDatatype:u.FLOAT,componentsPerAttribute:3,values:z}),e.attributes.binormal=new m({componentDatatype:u.FLOAT,componentsPerAttribute:3,values:R}),e};var yt=new n,vt=new a,gt=new a,wt=new a;tt.compressVertices=function(t){var r=t.attributes.normal,i=t.attributes.st;if(!c(r)&&!c(i))return t;var o,s,l,f,d=t.attributes.tangent,h=t.attributes.binormal;c(r)&&(o=r.values),c(i)&&(s=i.values),c(d)&&(l=d.values),h&&(f=h.values);var p=c(o)?o.length:s.length,y=c(o)?3:2,v=p/y,g=v,w=c(s)&&c(o)?2:1;w+=c(l)||c(f)?1:0,g*=w;for(var x=new Float32Array(g),E=0,S=0;v>S;++S){c(s)&&(n.fromArray(s,2*S,yt),x[E++]=e.compressTextureCoordinates(yt));var O=3*S;c(o)&&c(l)&&c(f)?(a.fromArray(o,O,vt),a.fromArray(l,O,gt),a.fromArray(f,O,wt),e.octPack(vt,gt,wt,yt),x[E++]=yt.x,x[E++]=yt.y):(c(o)&&(a.fromArray(o,O,vt),x[E++]=e.octEncodeFloat(vt)),c(l)&&(a.fromArray(l,O,vt),x[E++]=e.octEncodeFloat(vt)),c(f)&&(a.fromArray(f,O,vt),x[E++]=e.octEncodeFloat(vt)))}return t.attributes.compressedAttributes=new m({componentDatatype:u.FLOAT,componentsPerAttribute:w,values:x}),c(o)&&delete t.attributes.normal,c(s)&&delete t.attributes.st,c(l)&&delete t.attributes.tangent,c(f)&&delete t.attributes.binormal,t};var xt=new a,Et=new a,St=new a,Ot=new a,Tt=new a,bt={positions:new Array(7),indices:new Array(9)},Mt=new a,_t=new a,Pt=new a,Nt=new a,At=new n,It=new n,Rt=new n,zt=O.fromPointNormal(a.ZERO,a.UNIT_Y),Ct=new a,Dt=new a,Lt=new n,qt=new n,Ut=new a,Ft=new a,Bt=new a,Wt=new a,Gt=new a,kt=new a,Vt=new a,Yt=new i;return new i,tt.splitLongitude=function(e){var t=e.geometry,n=t.boundingSphere;if(c(n)){var a=n.center.x-n.radius;if(a>0||r.intersect(n,i.UNIT_Y)!==g.INTERSECTING)return e}if(t.geometryType!==y.NONE)switch(t.geometryType){case y.POLYLINES:et(e);break;case y.TRIANGLES:Q(e);break;case y.LINES:$(e)}else G(t),t.primitiveType===T.TRIANGLES?Q(e):t.primitiveType===T.LINES&&$(e);return e},tt}),define("Core/Matrix2",["./Cartesian2","./defaultValue","./defined","./DeveloperError","./freezeObject"],function(e,t,r,n,a){"use strict";var i=function(e,r,n,a){this[0]=t(e,0),this[1]=t(n,0),this[2]=t(r,0),this[3]=t(a,0)};i.packedLength=4,i.pack=function(e,r,n){n=t(n,0),r[n++]=e[0],r[n++]=e[1],r[n++]=e[2],r[n++]=e[3]},i.unpack=function(e,n,a){return n=t(n,0),r(a)||(a=new i),a[0]=e[n++],a[1]=e[n++],a[2]=e[n++],a[3]=e[n++],a},i.clone=function(e,t){return r(e)?r(t)?(t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t):new i(e[0],e[2],e[1],e[3]):void 0},i.fromArray=function(e,n,a){return n=t(n,0),r(a)||(a=new i),a[0]=e[n],a[1]=e[n+1],a[2]=e[n+2],a[3]=e[n+3],a},i.fromColumnMajorArray=function(e,t){return i.clone(e,t)},i.fromRowMajorArray=function(e,t){return r(t)?(t[0]=e[0],t[1]=e[2],t[2]=e[1],t[3]=e[3],t):new i(e[0],e[1],e[2],e[3])},i.fromScale=function(e,t){return r(t)?(t[0]=e.x,t[1]=0,t[2]=0,t[3]=e.y,t):new i(e.x,0,0,e.y)},i.fromUniformScale=function(e,t){return r(t)?(t[0]=e,t[1]=0,t[2]=0,t[3]=e,t):new i(e,0,0,e)},i.fromRotation=function(e,t){var n=Math.cos(e),a=Math.sin(e);return r(t)?(t[0]=n,t[1]=a,t[2]=-a,t[3]=n,t):new i(n,-a,a,n)},i.toArray=function(e,t){return r(t)?(t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t):[e[0],e[1],e[2],e[3]]},i.getElementIndex=function(e,t){return 2*e+t},i.getColumn=function(e,t,r){var n=2*t,a=e[n],i=e[n+1];return r.x=a,r.y=i,r},i.setColumn=function(e,t,r,n){n=i.clone(e,n);var a=2*t;return n[a]=r.x,n[a+1]=r.y,n},i.getRow=function(e,t,r){var n=e[t],a=e[t+2];return r.x=n,r.y=a,r},i.setRow=function(e,t,r,n){return n=i.clone(e,n),n[t]=r.x,n[t+2]=r.y,n};var o=new e;i.getScale=function(t,r){return r.x=e.magnitude(e.fromElements(t[0],t[1],o)),r.y=e.magnitude(e.fromElements(t[2],t[3],o)),r};var u=new e;return i.getMaximumScale=function(t){return i.getScale(t,u),e.maximumComponent(u)},i.multiply=function(e,t,r){var n=e[0]*t[0]+e[2]*t[1],a=e[0]*t[2]+e[2]*t[3],i=e[1]*t[0]+e[3]*t[1],o=e[1]*t[2]+e[3]*t[3];return r[0]=n,r[1]=i,r[2]=a,r[3]=o,r},i.add=function(e,t,r){return r[0]=e[0]+t[0],r[1]=e[1]+t[1],r[2]=e[2]+t[2],r[3]=e[3]+t[3],r},i.subtract=function(e,t,r){return r[0]=e[0]-t[0],r[1]=e[1]-t[1],r[2]=e[2]-t[2],r[3]=e[3]-t[3],r},i.multiplyByVector=function(e,t,r){var n=e[0]*t.x+e[2]*t.y,a=e[1]*t.x+e[3]*t.y;return r.x=n,r.y=a,r},i.multiplyByScalar=function(e,t,r){return r[0]=e[0]*t,r[1]=e[1]*t,r[2]=e[2]*t,r[3]=e[3]*t,r},i.negate=function(e,t){return t[0]=-e[0],t[1]=-e[1],t[2]=-e[2],t[3]=-e[3],t},i.transpose=function(e,t){var r=e[0],n=e[2],a=e[1],i=e[3];return t[0]=r,t[1]=n,t[2]=a,t[3]=i,t},i.abs=function(e,t){return t[0]=Math.abs(e[0]),t[1]=Math.abs(e[1]),t[2]=Math.abs(e[2]),t[3]=Math.abs(e[3]),t},i.equals=function(e,t){return e===t||r(e)&&r(t)&&e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]&&e[3]===t[3]},i.equalsArray=function(e,t,r){return e[0]===t[r]&&e[1]===t[r+1]&&e[2]===t[r+2]&&e[3]===t[r+3]},i.equalsEpsilon=function(e,t,n){return e===t||r(e)&&r(t)&&Math.abs(e[0]-t[0])<=n&&Math.abs(e[1]-t[1])<=n&&Math.abs(e[2]-t[2])<=n&&Math.abs(e[3]-t[3])<=n},i.IDENTITY=a(new i(1,0,0,1)),i.COLUMN0ROW0=0,i.COLUMN0ROW1=1,i.COLUMN1ROW0=2,i.COLUMN1ROW1=3,i.prototype.clone=function(e){return i.clone(this,e)},i.prototype.equals=function(e){return i.equals(this,e)},i.prototype.equalsEpsilon=function(e,t){return i.equalsEpsilon(this,e,t)},i.prototype.toString=function(){return"("+this[0]+", "+this[2]+")\n"+"("+this[1]+", "+this[3]+")"},i}),define("Core/AxisAlignedBoundingBox",["./Cartesian3","./defaultValue","./defined","./DeveloperError","./Intersect"],function(e,t,r,n,a){"use strict";var i=function(n,a,i){this.minimum=e.clone(t(n,e.ZERO)),this.maximum=e.clone(t(a,e.ZERO)),r(i)?i=e.clone(i):(i=e.add(this.minimum,this.maximum,new e),e.multiplyByScalar(i,.5,i)),this.center=i};i.fromPoints=function(t,n){if(r(n)||(n=new i),!r(t)||0===t.length)return n.minimum=e.clone(e.ZERO,n.minimum),n.maximum=e.clone(e.ZERO,n.maximum),n.center=e.clone(e.ZERO,n.center),n;for(var a=t[0].x,o=t[0].y,u=t[0].z,s=t[0].x,c=t[0].y,l=t[0].z,f=t.length,d=1;f>d;d++){var h=t[d],m=h.x,p=h.y,y=h.z;a=Math.min(m,a),s=Math.max(m,s),o=Math.min(p,o),c=Math.max(p,c),u=Math.min(y,u),l=Math.max(y,l)}var v=n.minimum;v.x=a,v.y=o,v.z=u;var g=n.maximum;g.x=s,g.y=c,g.z=l;var w=e.add(v,g,n.center);return e.multiplyByScalar(w,.5,w),n},i.clone=function(t,n){return r(t)?r(n)?(n.minimum=e.clone(t.minimum,n.minimum),n.maximum=e.clone(t.maximum,n.maximum),n.center=e.clone(t.center,n.center),n):new i(t.minimum,t.maximum):void 0},i.equals=function(t,n){return t===n||r(t)&&r(n)&&e.equals(t.center,n.center)&&e.equals(t.minimum,n.minimum)&&e.equals(t.maximum,n.maximum)};var o=new e;return i.intersect=function(t,r){o=e.subtract(t.maximum,t.minimum,o);var n=e.multiplyByScalar(o,.5,o),i=n.x*Math.abs(r.x)+n.y*Math.abs(r.y)+n.z*Math.abs(r.z),u=e.dot(t.center,r)+r.w;return u-i>0?a.INSIDE:0>u+i?a.OUTSIDE:a.INTERSECTING},i.prototype.clone=function(e){return i.clone(this,e)},i.prototype.intersect=function(e){return i.intersect(this,e)},i.prototype.equals=function(e){return i.equals(this,e)},i}),function(e){"use strict";e("ThirdParty/when",[],function(){function e(e,r,n,a){return t(e).then(r,n,a)}function t(e){var t,r;return e instanceof n?t=e:u(e)?(r=o(),e.then(function(e){r.resolve(e)},function(e){r.reject(e)},function(e){r.progress(e)}),t=r.promise):t=a(e),t}function r(t){return e(t,i)}function n(e){this.then=e}function a(e){var r=new n(function(r){try{return t(r?r(e):e)}catch(n){return i(n)}});return r}function i(e){var r=new n(function(r,n){try{return n?t(n(e)):i(e)}catch(a){return i(a)}});return r}function o(){function e(e,t,r){return d(e,t,r)}function r(e){return m(e)}function a(e){return m(i(e))}function u(e){return h(e)}var s,c,l,f,d,h,m;return c=new n(e),s={then:e,resolve:r,reject:a,progress:u,promise:c,resolver:{resolve:r,reject:a,progress:u}},l=[],f=[],d=function(e,t,r){var n,a;return n=o(),a="function"==typeof r?function(e){try{n.progress(r(e))}catch(t){n.progress(t)}}:function(e){n.progress(e)},l.push(function(r){r.then(e,t).then(n.resolve,n.reject,a)}),f.push(a),n.promise},h=function(e){return p(f,e),e},m=function(e){return e=t(e),d=e.then,m=t,h=v,p(l,e),f=l=E,e},s}function u(e){return e&&"function"==typeof e.then}function s(t,r,n,a,i){return y(2,arguments),e(t,function(t){function u(e){p(e)}function s(e){m(e)}var c,l,f,d,h,m,p,y,g,w;if(g=t.length>>>0,c=Math.max(0,Math.min(r,g)),f=[],l=g-c+1,d=[],h=o(),c)for(y=h.progress,p=function(e){d.push(e),--l||(m=p=v,h.reject(d))},m=function(e){f.push(e),--c||(m=p=v,h.resolve(f))},w=0;g>w;++w)w in t&&e(t[w],s,u,y);else h.resolve(f);return h.then(n,a,i)})}function c(e,t,r,n){function a(e){return t?t(e[0]):e[0]}return s(e,1,a,r,n)}function l(e,t,r,n){return y(1,arguments),d(e,g).then(t,r,n)}function f(){return d(arguments,g)}function d(t,r){return e(t,function(t){var n,a,i,u,s,c;if(i=a=t.length>>>0,n=[],c=o(),i)for(u=function(t,a){e(t,r).then(function(e){n[a]=e,--i||c.resolve(n)},c.reject)},s=0;a>s;s++)s in t?u(t[s],s):--i;else c.resolve(n);return c.promise})}function h(t,r){var n=x.call(arguments,1);return e(t,function(t){var a;return a=t.length,n[0]=function(t,n,i){return e(t,function(t){return e(n,function(e){return r(t,e,i,a)})})},w.apply(t,n)})}function m(t,r,n){var a=arguments.length>2;return e(t,function(e){return e=a?n:e,r.resolve(e),e},function(e){return r.reject(e),i(e)},r.progress)}function p(e,t){for(var r,n=0;r=e[n++];)r(t)}function y(e,t){for(var r,n=t.length;n>e;)if(r=t[--n],null!=r&&"function"!=typeof r)throw new Error("arg "+n+" must be a function")}function v(){}function g(e){return e}var w,x,E;return e.defer=o,e.resolve=t,e.reject=r,e.join=f,e.all=l,e.map=d,e.reduce=h,e.any=c,e.some=s,e.chain=m,e.isPromise=u,n.prototype={always:function(e,t){return this.then(e,e,t)},otherwise:function(e){return this.then(E,e)},yield:function(e){return this.then(function(){return e})},spread:function(e){return this.then(function(t){return l(t,function(t){return e.apply(E,t)})})}},x=[].slice,w=[].reduce||function(e){var t,r,n,a,i;if(i=0,t=Object(this),a=t.length>>>0,r=arguments,r.length<=1)for(;;){if(i in t){n=t[i++];break}if(++i>=a)throw new TypeError}else n=r[1];for(;a>i;++i)i in t&&(n=e(n,t[i],i,t));return n},e})}("function"==typeof define&&define.amd?define:function(e){"object"==typeof exports?module.exports=e():this.when=e()}),define("Core/binarySearch",["./defined","./DeveloperError"],function(){"use strict";var e=function(e,t,r){for(var n,a,i=0,o=e.length-1;o>=i;)if(n=~~((i+o)/2),a=r(e[n],t),0>a)i=n+1;else{if(!(a>0))return n;o=n-1}return~(o+1)};return e}),define("Core/EarthOrientationParametersSample",[],function(){"use strict";var e=function(e,t,r,n,a){this.xPoleWander=e,this.yPoleWander=t,this.xPoleOffset=r,this.yPoleOffset=n,this.ut1MinusUtc=a};return e}),define("ThirdParty/sprintf",[],function(){function e(){var e=/%%|%(\d+\$)?([-+\'#0 ]*)(\*\d+\$|\*|\d+)?(\.(\*\d+\$|\*|\d+))?([scboxXuideEfFgG])/g,t=arguments,r=0,n=t[r++],a=function(e,t,r,n){r||(r=" ");var a=e.length>=t?"":Array(1+t-e.length>>>0).join(r);return n?e+a:a+e},i=function(e,t,r,n,i,o){var u=n-e.length;return u>0&&(e=r||!i?a(e,n,o,r):e.slice(0,t.length)+a("",u,"0",!0)+e.slice(t.length)),e},o=function(e,t,r,n,o,u,s){var c=e>>>0;return r=r&&c&&{2:"0b",8:"0",16:"0x"}[t]||"",e=r+a(c.toString(t),u||0,"0",!1),i(e,r,n,o,s)},u=function(e,t,r,n,a,o){return null!=n&&(e=e.slice(0,n)),i(e,"",t,r,a,o)},s=function(e,n,s,c,l,f,d){var h,m,p,y,v;if("%%"==e)return"%";for(var g=!1,w="",x=!1,E=!1,S=" ",O=s.length,T=0;s&&O>T;T++)switch(s.charAt(T)){case" ":w=" ";break;case"+":w="+";break;case"-":g=!0;break;case"'":S=s.charAt(T+1);break;case"0":x=!0;break;case"#":E=!0}if(c=c?"*"==c?+t[r++]:"*"==c.charAt(0)?+t[c.slice(1,-1)]:+c:0,0>c&&(c=-c,g=!0),!isFinite(c))throw new Error("sprintf: (minimum-)width must be finite");switch(f=f?"*"==f?+t[r++]:"*"==f.charAt(0)?+t[f.slice(1,-1)]:+f:"fFeE".indexOf(d)>-1?6:"d"==d?0:void 0,v=n?t[n.slice(0,-1)]:t[r++],d){case"s":return u(String(v),g,c,f,x,S);case"c":return u(String.fromCharCode(+v),g,c,f,x);case"b":return o(v,2,E,g,c,f,x);case"o":return o(v,8,E,g,c,f,x);case"x":return o(v,16,E,g,c,f,x);case"X":return o(v,16,E,g,c,f,x).toUpperCase();case"u":return o(v,10,E,g,c,f,x);case"i":case"d":return h=+v||0,h=Math.round(h-h%1),m=0>h?"-":w,v=m+a(String(Math.abs(h)),f,"0",!1),i(v,m,g,c,x);case"e":case"E":case"f":case"F":case"g":case"G":return h=+v,m=0>h?"-":w,p=["toExponential","toFixed","toPrecision"]["efg".indexOf(d.toLowerCase())],y=["toString","toUpperCase"]["eEfFgG".indexOf(d)%2],v=m+Math.abs(h)[p](f),i(v,m,g,c,x)[y]();default:return e}};return n.replace(e,s)}return e}),define("Core/GregorianDate",[],function(){"use strict";var e=function(e,t,r,n,a,i,o,u){this.year=e,this.month=t,this.day=r,this.hour=n,this.minute=a,this.second=i,this.millisecond=o,this.isLeapSecond=u};return e}),define("Core/isLeapYear",["./DeveloperError"],function(){"use strict";function e(e){return 0===e%4&&0!==e%100||0===e%400}return e}),define("Core/LeapSecond",[],function(){"use strict";var e=function(e,t){this.julianDate=e,this.offset=t};return e}),define("Core/TimeConstants",["./freezeObject"],function(e){"use strict";var t={SECONDS_PER_MILLISECOND:.001,SECONDS_PER_MINUTE:60,MINUTES_PER_HOUR:60,HOURS_PER_DAY:24,SECONDS_PER_HOUR:3600,MINUTES_PER_DAY:1440,SECONDS_PER_DAY:86400,DAYS_PER_JULIAN_CENTURY:36525,PICOSECOND:1e-9,MODIFIED_JULIAN_DATE_DIFFERENCE:2400000.5};return e(t)}),define("Core/TimeStandard",["./freezeObject"],function(e){"use strict";var t={UTC:0,TAI:1};return e(t)}),define("Core/JulianDate",["../ThirdParty/sprintf","./binarySearch","./defaultValue","./defined","./DeveloperError","./GregorianDate","./isLeapYear","./LeapSecond","./TimeConstants","./TimeStandard"],function(e,t,r,n,a,i,o,u,s,c){"use strict";function l(e,t){return N.compare(e.julianDate,t.julianDate)}function f(e){g.julianDate=e;var r=N.leapSeconds,n=t(r,g,l);0>n&&(n=~n),n>=r.length&&(n=r.length-1);var a=r[n].offset;if(n>0){var i=N.secondsDifference(r[n].julianDate,e);i>a&&(n--,a=r[n].offset)}N.addSeconds(e,a,e)}function d(e,r){g.julianDate=e;var n=N.leapSeconds,a=t(n,g,l);if(0>a&&(a=~a),0===a)return N.addSeconds(e,-n[0].offset,r);if(a>=n.length)return N.addSeconds(e,-n[a-1].offset,r);var i=N.secondsDifference(n[a].julianDate,e);return 0===i?N.addSeconds(e,-n[a].offset,r):1>=i?void 0:N.addSeconds(e,-n[--a].offset,r)}function h(e,t,r){var n=0|t/s.SECONDS_PER_DAY;return e+=n,t-=s.SECONDS_PER_DAY*n,0>t&&(e--,t+=s.SECONDS_PER_DAY),r.dayNumber=e,r.secondsOfDay=t,r}function m(e,t,r,n,a,i,o){var u=0|(t-14)/12,c=e+4800+u,l=(0|1461*c/4)+(0|367*(t-2-12*u)/12)-(0|3*((c+100)/100)/4)+r-32075;n-=12,0>n&&(n+=24);var f=i+(n*s.SECONDS_PER_HOUR+a*s.SECONDS_PER_MINUTE+o*s.SECONDS_PER_MILLISECOND);return f>=43200&&(l-=1),[l,f]}var p=new i,y=[31,28,31,30,31,30,31,31,30,31,30,31],v=29,g=new u,w=/^(\d{4})$/,x=/^(\d{4})-(\d{2})$/,E=/^(\d{4})-?(\d{3})$/,S=/^(\d{4})-?W(\d{2})-?(\d{1})?$/,O=/^(\d{4})-?(\d{2})-?(\d{2})$/,T=/([Z+\-])?(\d{2})?:?(\d{2})?$/,b=/^(\d{2})(\.\d+)?/.source+T.source,M=/^(\d{2}):?(\d{2})(\.\d+)?/.source+T.source,_=/^(\d{2}):?(\d{2}):?(\d{2})(\.\d+)?/.source+T.source,P="Invalid ISO 8601 date.",N=function(e,t,n){this.dayNumber=void 0,this.secondsOfDay=void 0,e=r(e,0),t=r(t,0),n=r(n,c.UTC);var a=0|e;t+=(e-a)*s.SECONDS_PER_DAY,h(a,t,this),n===c.UTC&&f(this)};N.fromDate=function(e,t){var r=m(e.getUTCFullYear(),e.getUTCMonth()+1,e.getUTCDate(),e.getUTCHours(),e.getUTCMinutes(),e.getUTCSeconds(),e.getUTCMilliseconds());return n(t)?(h(r[0],r[1],t),f(t),t):new N(r[0],r[1],c.UTC)},N.fromIso8601=function(e,t){e=e.replace(",",".");var r,i,u,s=e.split("T"),l=1,d=1,p=0,g=0,T=0,A=0,I=s[0],R=s[1];if(!n(I))throw new a(P);var z;if(s=I.match(O),null!==s){if(z=I.split("-").length-1,z>0&&2!==z)throw new a(P);r=+s[1],l=+s[2],d=+s[3]}else if(s=I.match(x),null!==s)r=+s[1],l=+s[2];else if(s=I.match(w),null!==s)r=+s[1];else{var C;if(s=I.match(E),null!==s){if(r=+s[1],C=+s[2],u=o(r),1>C||u&&C>366||!u&&C>365)throw new a(P)}else{if(s=I.match(S),null===s)throw new a(P);r=+s[1];var D=+s[2],L=+s[3]||0;if(z=I.split("-").length-1,z>0&&(!n(s[3])&&1!==z||n(s[3])&&2!==z))throw new a(P);var q=new Date(Date.UTC(r,0,4));C=7*D+L-q.getUTCDay()-3}i=new Date(Date.UTC(r,0,1)),i.setUTCDate(C),l=i.getUTCMonth()+1,d=i.getUTCDate()}if(u=o(r),1>l||l>12||1>d||(2!==l||!u)&&d>y[l-1]||u&&2===l&&d>v)throw new a(P);var U;if(n(R)){if(s=R.match(_),null!==s){if(z=R.split(":").length-1,z>0&&2!==z&&3!==z)throw new a(P);p=+s[1],g=+s[2],T=+s[3],A=1e3*+(s[4]||0),U=5}else if(s=R.match(M),null!==s){if(z=R.split(":").length-1,z>0&&1!==z)throw new a(P);p=+s[1],g=+s[2],T=60*+(s[3]||0),U=4}else{if(s=R.match(b),null===s)throw new a(P);p=+s[1],g=60*+(s[2]||0),U=3}if(g>=60||T>=61||p>24||24===p&&(g>0||T>0||A>0))throw new a(P);var F=s[U],B=+s[U+1],W=+(s[U+2]||0);switch(F){case"+":p-=B,g-=W;break;case"-":p+=B,g+=W;break;case"Z":break;default:g+=new Date(Date.UTC(r,l-1,d,p,g)).getTimezoneOffset()}}else g+=new Date(r,l-1,d).getTimezoneOffset();var G=60===T;for(G&&T--;g>=60;)g-=60,p++;for(;p>=24;)p-=24,d++;for(i=u&&2===l?v:y[l-1];d>i;)d-=i,l++,l>12&&(l-=12,r++),i=u&&2===l?v:y[l-1];for(;0>g;)g+=60,p--;for(;0>p;)p+=24,d--;for(;1>d;)l--,1>l&&(l+=12,r--),i=u&&2===l?v:y[l-1],d+=i;var k=m(r,l,d,p,g,T,A);return n(t)?(h(k[0],k[1],t),f(t)):t=new N(k[0],k[1],c.UTC),G&&N.addSeconds(t,1,t),t},N.now=function(e){return N.fromDate(new Date,e)};var A=new N(0,0,c.TAI);return N.toGregorianDate=function(e,t){var r=!1,a=d(e,A);n(a)||(N.addSeconds(e,-1,A),a=d(A,A),r=!0);var o=a.dayNumber,u=a.secondsOfDay;u>=43200&&(o+=1);var c=0|o+68569,l=0|4*c/146097;c=0|c-(0|(146097*l+3)/4);var f=0|4e3*(c+1)/1461001;c=0|c-(0|1461*f/4)+31;var h=0|80*c/2447,m=0|c-(0|2447*h/80);c=0|h/11;var p=0|h+2-12*c,y=0|100*(l-49)+f+c,v=0|u/s.SECONDS_PER_HOUR,g=u-v*s.SECONDS_PER_HOUR,w=0|g/s.SECONDS_PER_MINUTE;g-=w*s.SECONDS_PER_MINUTE;var x=0|g,E=(g-x)/s.SECONDS_PER_MILLISECOND;return v+=12,v>23&&(v-=24),r&&(x+=1),n(t)?(t.year=y,t.month=p,t.day=m,t.hour=v,t.minute=w,t.second=x,t.millisecond=E,t.isLeapSecond=r,t):new i(y,p,m,v,w,x,E,r)},N.toDate=function(e){var t=N.toGregorianDate(e,p),r=t.second;return t.isLeapSecond&&(r-=1),new Date(Date.UTC(t.year,t.month-1,t.day,t.hour,t.minute,r,t.millisecond))},N.toIso8601=function(t,r){var a,i=N.toGregorianDate(t,i);return n(r)||0===i.millisecond?n(r)&&0!==r?(a=(.01*i.millisecond).toFixed(r).replace(".","").slice(0,r),e("%04d-%02d-%02dT%02d:%02d:%02d.%sZ",i.year,i.month,i.day,i.hour,i.minute,i.second,a)):e("%04d-%02d-%02dT%02d:%02d:%02dZ",i.year,i.month,i.day,i.hour,i.minute,i.second):(a=(.01*i.millisecond).toString().replace(".",""),e("%04d-%02d-%02dT%02d:%02d:%02d.%sZ",i.year,i.month,i.day,i.hour,i.minute,i.second,a))},N.clone=function(e,t){return n(e)?n(t)?(t.dayNumber=e.dayNumber,t.secondsOfDay=e.secondsOfDay,t):new N(e.dayNumber,e.secondsOfDay,c.TAI):void 0},N.compare=function(e,t){var r=e.dayNumber-t.dayNumber;return 0!==r?r:e.secondsOfDay-t.secondsOfDay},N.equals=function(e,t){return e===t||n(e)&&n(t)&&e.dayNumber===t.dayNumber&&e.secondsOfDay===t.secondsOfDay},N.equalsEpsilon=function(e,t,r){return e===t||n(e)&&n(t)&&Math.abs(N.secondsDifference(e,t))<=r},N.totalDays=function(e){return e.dayNumber+e.secondsOfDay/s.SECONDS_PER_DAY},N.secondsDifference=function(e,t){var r=(e.dayNumber-t.dayNumber)*s.SECONDS_PER_DAY;return r+(e.secondsOfDay-t.secondsOfDay)},N.daysDifference=function(e,t){var r=e.dayNumber-t.dayNumber,n=(e.secondsOfDay-t.secondsOfDay)/s.SECONDS_PER_DAY;return r+n},N.computeTaiMinusUtc=function(e){g.julianDate=e;var r=N.leapSeconds,n=t(r,g,l);return 0>n&&(n=~n,--n,0>n&&(n=0)),r[n].offset},N.addSeconds=function(e,t,r){return h(e.dayNumber,e.secondsOfDay+t,r)},N.addMinutes=function(e,t,r){var n=e.secondsOfDay+t*s.SECONDS_PER_MINUTE;return h(e.dayNumber,n,r)},N.addHours=function(e,t,r){var n=e.secondsOfDay+t*s.SECONDS_PER_HOUR;return h(e.dayNumber,n,r)},N.addDays=function(e,t,r){var n=e.dayNumber+t;return h(n,e.secondsOfDay,r)},N.lessThan=function(e,t){return N.compare(e,t)<0},N.lessThanOrEquals=function(e,t){return N.compare(e,t)<=0},N.greaterThan=function(e,t){return N.compare(e,t)>0},N.greaterThanOrEquals=function(e,t){return N.compare(e,t)>=0},N.prototype.clone=function(e){return N.clone(this,e)},N.prototype.equals=function(e){return N.equals(this,e)},N.prototype.equalsEpsilon=function(e,t){return N.equalsEpsilon(this,e,t)},N.prototype.toString=function(){return N.toIso8601(this)},N.leapSeconds=[new u(new N(2441317,43210,c.TAI),10),new u(new N(2441499,43211,c.TAI),11),new u(new N(2441683,43212,c.TAI),12),new u(new N(2442048,43213,c.TAI),13),new u(new N(2442413,43214,c.TAI),14),new u(new N(2442778,43215,c.TAI),15),new u(new N(2443144,43216,c.TAI),16),new u(new N(2443509,43217,c.TAI),17),new u(new N(2443874,43218,c.TAI),18),new u(new N(2444239,43219,c.TAI),19),new u(new N(2444786,43220,c.TAI),20),new u(new N(2445151,43221,c.TAI),21),new u(new N(2445516,43222,c.TAI),22),new u(new N(2446247,43223,c.TAI),23),new u(new N(2447161,43224,c.TAI),24),new u(new N(2447892,43225,c.TAI),25),new u(new N(2448257,43226,c.TAI),26),new u(new N(2448804,43227,c.TAI),27),new u(new N(2449169,43228,c.TAI),28),new u(new N(2449534,43229,c.TAI),29),new u(new N(2450083,43230,c.TAI),30),new u(new N(2450630,43231,c.TAI),31),new u(new N(2451179,43232,c.TAI),32),new u(new N(2453736,43233,c.TAI),33),new u(new N(2454832,43234,c.TAI),34),new u(new N(2456109,43235,c.TAI),35)],N}),define("Core/clone",["./defaultValue"],function(e){"use strict";var t=function(r,n){if(null===r||"object"!=typeof r)return r;n=e(n,!1);var a=new r.constructor;for(var i in r)if(r.hasOwnProperty(i)){var o=r[i];n&&(o=t(o,n)),a[i]=o}return a};return t}),define("Core/parseResponseHeaders",[],function(){"use strict";var e=function(e){var t={};if(!e)return t;for(var r=e.split("\r\n"),n=0;n<r.length;++n){var a=r[n],i=a.indexOf(": ");if(i>0){var o=a.substring(0,i),u=a.substring(i+2);t[o]=u}}return t};return e}),define("Core/RequestErrorEvent",["./defined","./parseResponseHeaders"],function(e,t){"use strict";var r=function(e,r,n){this.statusCode=e,this.response=r,this.responseHeaders=n,"string"==typeof this.responseHeaders&&(this.responseHeaders=t(this.responseHeaders))};return r.prototype.toString=function(){var t="Request has failed.";return e(this.statusCode)&&(t+=" Status Code: "+this.statusCode),t},r}),define("Core/loadWithXhr",["../ThirdParty/when","./defaultValue","./defined","./DeveloperError","./RequestErrorEvent","./RuntimeError"],function(e,t,r,n,a,i){"use strict";function o(e,t){var r=decodeURIComponent(t);return e?atob(r):r}function u(e,t){for(var r=o(e,t),n=new ArrayBuffer(r.length),a=new Uint8Array(n),i=0;i<r.length;i++)a[i]=r.charCodeAt(i);return n}function s(e,r){r=t(r,"");var a=e[1],i=!!e[2],s=e[3];switch(r){case"":case"text":return o(i,s);case"arraybuffer":return u(i,s);case"blob":var c=u(i,s);return new Blob([c],{type:a});case"document":var l=new DOMParser;return l.parseFromString(o(i,s),a);case"json":return JSON.parse(o(i,s));default:throw new n("Unhandled responseType: "+r)}}var c=function(r){r=t(r,t.EMPTY_OBJECT);var n=r.responseType,a=t(r.method,"GET"),i=r.data,o=r.headers,u=r.overrideMimeType;return e(r.url,function(t){var r=e.defer();return c.load(t,n,a,i,o,r,u),r.promise})},l=/^data:(.*?)(;base64)?,(.*)$/;return c.load=function(e,t,n,o,u,c,f){var d=l.exec(e);if(null!==d)return c.resolve(s(d,t)),void 0;var h=new XMLHttpRequest;if(r(f)&&r(h.overrideMimeType)&&h.overrideMimeType(f),h.open(n,e,!0),r(u))for(var m in u)u.hasOwnProperty(m)&&h.setRequestHeader(m,u[m]);r(t)&&(h.responseType=t),h.onload=function(){200===h.status?r(h.response)?c.resolve(h.response):r(h.responseXML)&&h.responseXML.hasChildNodes()?c.resolve(h.responseXML):r(h.responseText)?c.resolve(h.responseText):c.reject(new i("unknown XMLHttpRequest response type.")):c.reject(new a(h.status,h.response,h.getAllResponseHeaders()))},h.onerror=function(){c.reject(new a)},h.send(o)},c.defaultLoad=c.load,c}),define("Core/loadText",["./loadWithXhr"],function(e){"use strict";var t=function(t,r){return e({url:t,headers:r})};return t}),define("Core/loadJson",["./clone","./defined","./DeveloperError","./loadText"],function(e,t,r,n){"use strict";var a={Accept:"application/json,*/*;q=0.01"},i=function(r,i){return t(i)?t(i.Accept)||(i=e(i),i.Accept=a.Accept):i=a,n(r,i).then(function(e){return JSON.parse(e)})};return i}),define("Core/EarthOrientationParameters",["../ThirdParty/when","./binarySearch","./defaultValue","./defined","./EarthOrientationParametersSample","./freezeObject","./JulianDate","./LeapSecond","./loadJson","./RuntimeError","./TimeConstants","./TimeStandard"],function(e,t,r,n,a,i,o,u,s,c,l,f){"use strict";function d(e,t){return o.compare(e.julianDate,t)}function h(e,r){if(!n(r.columnNames))return e._dataError="Error in loaded EOP data: The columnNames property is required.",void 0;if(!n(r.samples))return e._dataError="Error in loaded EOP data: The samples property is required.",void 0;var a=r.columnNames.indexOf("modifiedJulianDateUtc"),i=r.columnNames.indexOf("xPoleWanderRadians"),s=r.columnNames.indexOf("yPoleWanderRadians"),c=r.columnNames.indexOf("ut1MinusUtcSeconds"),h=r.columnNames.indexOf("xCelestialPoleOffsetRadians"),m=r.columnNames.indexOf("yCelestialPoleOffsetRadians"),p=r.columnNames.indexOf("taiMinusUtcSeconds");if(0>a||0>i||0>s||0>c||0>h||0>m||0>p)return e._dataError="Error in loaded EOP data: The columnNames property must include modifiedJulianDateUtc, xPoleWanderRadians, yPoleWanderRadians, ut1MinusUtcSeconds, xCelestialPoleOffsetRadians, yCelestialPoleOffsetRadians, and taiMinusUtcSeconds columns",void 0;var y=e._samples=r.samples,v=e._dates=[];e._dateColumn=a,e._xPoleWanderRadiansColumn=i,e._yPoleWanderRadiansColumn=s,e._ut1MinusUtcSecondsColumn=c,e._xCelestialPoleOffsetRadiansColumn=h,e._yCelestialPoleOffsetRadiansColumn=m,e._taiMinusUtcSecondsColumn=p,e._columnCount=r.columnNames.length,e._lastIndex=void 0;for(var g,w=e._addNewLeapSeconds,x=0,E=y.length;E>x;x+=e._columnCount){var S=y[x+a],O=y[x+p],T=S+l.MODIFIED_JULIAN_DATE_DIFFERENCE,b=new o(T,O,f.TAI);if(v.push(b),w){if(O!==g&&n(g)){var M=o.leapSeconds,_=t(M,b,d);if(0>_){var P=new u(b,O);M.splice(~_,0,P)}}g=O}}}function m(e,t,r,n,a){var i=r*n;a.xPoleWander=t[i+e._xPoleWanderRadiansColumn],a.yPoleWander=t[i+e._yPoleWanderRadiansColumn],a.xPoleOffset=t[i+e._xCelestialPoleOffsetRadiansColumn],a.yPoleOffset=t[i+e._yCelestialPoleOffsetRadiansColumn],a.ut1MinusUtc=t[i+e._ut1MinusUtcSecondsColumn]}function p(e,t,r){return t+e*(r-t)}function y(e,t,r,n,a,i,u){var s=e._columnCount;if(i>t.length-1)return u.xPoleWander=0,u.yPoleWander=0,u.xPoleOffset=0,u.yPoleOffset=0,u.ut1MinusUtc=0,u;var c=t[a],l=t[i];if(c.equals(l)||n.equals(c))return m(e,r,a,s,u),u;if(n.equals(l))return m(e,r,i,s,u),u;var f=o.secondsDifference(n,c)/o.secondsDifference(l,c),d=a*s,h=i*s,y=r[d+e._ut1MinusUtcSecondsColumn],v=r[h+e._ut1MinusUtcSecondsColumn],g=v-y;if(g>.5||-.5>g){var w=r[d+e._taiMinusUtcSecondsColumn],x=r[h+e._taiMinusUtcSecondsColumn];w!==x&&(l.equals(n)?y=v:v-=x-w)}return u.xPoleWander=p(f,r[d+e._xPoleWanderRadiansColumn],r[h+e._xPoleWanderRadiansColumn]),u.yPoleWander=p(f,r[d+e._yPoleWanderRadiansColumn],r[h+e._yPoleWanderRadiansColumn]),u.xPoleOffset=p(f,r[d+e._xCelestialPoleOffsetRadiansColumn],r[h+e._xCelestialPoleOffsetRadiansColumn]),u.yPoleOffset=p(f,r[d+e._yCelestialPoleOffsetRadiansColumn],r[h+e._yCelestialPoleOffsetRadiansColumn]),u.ut1MinusUtc=p(f,y,v),u}var v=function(t){if(t=r(t,r.EMPTY_OBJECT),this._dates=void 0,this._samples=void 0,this._dateColumn=-1,this._xPoleWanderRadiansColumn=-1,this._yPoleWanderRadiansColumn=-1,this._ut1MinusUtcSecondsColumn=-1,this._xCelestialPoleOffsetRadiansColumn=-1,this._yCelestialPoleOffsetRadiansColumn=-1,this._taiMinusUtcSecondsColumn=-1,this._columnCount=0,this._lastIndex=-1,this._downloadPromise=void 0,this._dataError=void 0,this._addNewLeapSeconds=r(t.addNewLeapSeconds,!0),n(t.data))h(this,t.data);else if(n(t.url)){var a=this;this._downloadPromise=e(s(t.url),function(e){h(a,e)},function(){a._dataError="An error occurred while retrieving the EOP data from the URL "+t.url+"."})}else h(this,{columnNames:["dateIso8601","modifiedJulianDateUtc","xPoleWanderRadians","yPoleWanderRadians","ut1MinusUtcSeconds","lengthOfDayCorrectionSeconds","xCelestialPoleOffsetRadians","yCelestialPoleOffsetRadians","taiMinusUtcSeconds"],samples:[]})
};return v.NONE=i({getPromiseToLoad:function(){return e()},compute:function(e,t){return n(t)?(t.xPoleWander=0,t.yPoleWander=0,t.xPoleOffset=0,t.yPoleOffset=0,t.ut1MinusUtc=0):t=new a(0,0,0,0,0),t}}),v.prototype.getPromiseToLoad=function(){return e(this._downloadPromise)},v.prototype.compute=function(e,r){if(!n(this._samples)){if(n(this._dataError))throw new c(this._dataError);return void 0}if(n(r)||(r=new a(0,0,0,0,0)),0===this._samples.length)return r.xPoleWander=0,r.yPoleWander=0,r.xPoleOffset=0,r.yPoleOffset=0,r.ut1MinusUtc=0,r;var i=this._dates,u=this._lastIndex,s=0,l=0;if(n(u)){var f=i[u],d=i[u+1],h=o.lessThanOrEquals(f,e),m=!n(d),p=m||o.greaterThanOrEquals(d,e);if(h&&p)return s=u,!m&&d.equals(e)&&++s,l=s+1,y(this,i,this._samples,e,s,l,r),r}var v=t(i,e,o.compare,this._dateColumn);return v>=0?(v<i.length-1&&i[v+1].equals(e)&&++v,s=v,l=v):(l=~v,s=l-1,0>s&&(s=0)),this._lastIndex=s,y(this,i,this._samples,e,s,l,r),r},v}),define("ThirdParty/Uri",[],function(){function e(t){if(t instanceof e)this.scheme=t.scheme,this.authority=t.authority,this.path=t.path,this.query=t.query,this.fragment=t.fragment;else if(t){var r=n.exec(t);this.scheme=r[1],this.authority=r[2],this.path=r[3],this.query=r[4],this.fragment=r[5]}}function t(e){var t=unescape(e);return i.test(t)?t:e.toUpperCase()}function r(e,t,r,n){return(t||"")+r.toLowerCase()+(n||"")}e.prototype.scheme=null,e.prototype.authority=null,e.prototype.path="",e.prototype.query=null,e.prototype.fragment=null;var n=new RegExp("^(?:([^:/?#]+):)?(?://([^/?#]*))?([^?#]*)(?:\\?([^#]*))?(?:#(.*))?$");e.prototype.getScheme=function(){return this.scheme},e.prototype.getAuthority=function(){return this.authority},e.prototype.getPath=function(){return this.path},e.prototype.getQuery=function(){return this.query},e.prototype.getFragment=function(){return this.fragment},e.prototype.isAbsolute=function(){return!!this.scheme&&!this.fragment},e.prototype.isSameDocumentAs=function(e){return e.scheme==this.scheme&&e.authority==this.authority&&e.path==this.path&&e.query==this.query},e.prototype.equals=function(e){return this.isSameDocumentAs(e)&&e.fragment==this.fragment},e.prototype.normalize=function(){this.removeDotSegments(),this.scheme&&(this.scheme=this.scheme.toLowerCase()),this.authority&&(this.authority=this.authority.replace(o,r).replace(a,t)),this.path&&(this.path=this.path.replace(a,t)),this.query&&(this.query=this.query.replace(a,t)),this.fragment&&(this.fragment=this.fragment.replace(a,t))};var a=/%[0-9a-z]{2}/gi,i=/[a-zA-Z0-9\-\._~]/,o=/(.*@)?([^@:]*)(:.*)?/;return e.prototype.resolve=function(t){var r=new e;return this.scheme?(r.scheme=this.scheme,r.authority=this.authority,r.path=this.path,r.query=this.query):(r.scheme=t.scheme,this.authority?(r.authority=this.authority,r.path=this.path,r.query=this.query):(r.authority=t.authority,""==this.path?(r.path=t.path,r.query=this.query||t.query):("/"==this.path.charAt(0)?(r.path=this.path,r.removeDotSegments()):(r.path=t.authority&&""==t.path?"/"+this.path:t.path.substring(0,t.path.lastIndexOf("/")+1)+this.path,r.removeDotSegments()),r.query=this.query))),r.fragment=this.fragment,r},e.prototype.removeDotSegments=function(){var e,t=this.path.split("/"),r=[],n=""==t[0];for(n&&t.shift(),""==t[0]?t.shift():null;t.length;)e=t.shift(),".."==e?r.pop():"."!=e&&r.push(e);("."==e||".."==e)&&r.push(""),n&&r.unshift(""),this.path=r.join("/")},e.prototype.toString=function(){var e="";return this.scheme&&(e+=this.scheme+":"),this.authority&&(e+="//"+this.authority),e+=this.path,this.query&&(e+="?"+this.query),this.fragment&&(e+="#"+this.fragment),e},e}),define("Core/buildModuleUrl",["../ThirdParty/Uri","./defined","./DeveloperError","require"],function(e,t,r,n){"use strict";function a(){for(var e=document.getElementsByTagName("script"),t=0,r=e.length;r>t;++t){var n=e[t].getAttribute("src"),a=f.exec(n);if(null!==a)return a[1]}return void 0}function i(){if(t(s))return s;var n;if(n="undefined"!=typeof CESIUM_BASE_URL?CESIUM_BASE_URL:a(),!t(n))throw new r("Unable to determine Cesium base URL automatically, try defining a global variable called CESIUM_BASE_URL.");return s=new e(n).resolve(new e(document.location.href))}function o(e){return n.toUrl("../"+e)}function u(t){return new e(t).resolve(i()).toString()}var s,c,l,f=/((?:.*\/)|^)cesium[\w-]*\.js(?:\W|$)/i,d=function(e){t(c)||(c=t(n.toUrl)?o:u),t(l)||(l=document.createElement("a"));var r=c(e);return l.href=r,l.href=l.href,l.href};return d._cesiumScriptRegex=f,d}),define("Core/Iau2006XysSample",[],function(){"use strict";var e=function(e,t,r){this.x=e,this.y=t,this.s=r};return e}),define("Core/Iau2006XysData",["../ThirdParty/when","./buildModuleUrl","./defaultValue","./defined","./Iau2006XysSample","./JulianDate","./loadJson","./TimeStandard"],function(e,t,r,n,a,i,o,u){"use strict";function s(e,t,r){var n=f;return n.dayNumber=t,n.secondsOfDay=r,i.daysDifference(n,e._sampleZeroDateTT)}function c(r,a){if(r._chunkDownloadsInProgress[a])return r._chunkDownloadsInProgress[a];var i=e.defer();r._chunkDownloadsInProgress[a]=i;var u,s=r._xysFileUrlTemplate;return u=n(s)?s.replace("{0}",a):t("Assets/IAU2006_XYS/IAU2006_XYS_"+a+".json"),e(o(u),function(e){r._chunkDownloadsInProgress[a]=!1;for(var t=r._samples,n=e.samples,o=3*a*r._samplesPerXysFile,u=0,s=n.length;s>u;++u)t[o+u]=n[u];i.resolve()}),i.promise}var l=function(e){e=r(e,r.EMPTY_OBJECT),this._xysFileUrlTemplate=e.xysFileUrlTemplate,this._interpolationOrder=r(e.interpolationOrder,9),this._sampleZeroJulianEphemerisDate=r(e.sampleZeroJulianEphemerisDate,2442396.5),this._sampleZeroDateTT=new i(this._sampleZeroJulianEphemerisDate,0,u.TAI),this._stepSizeDays=r(e.stepSizeDays,1),this._samplesPerXysFile=r(e.samplesPerXysFile,1e3),this._totalSamples=r(e.totalSamples,27426),this._samples=new Array(3*this._totalSamples),this._chunkDownloadsInProgress=[];for(var t=this._interpolationOrder,n=this._denominators=new Array(t+1),a=this._xTable=new Array(t+1),o=Math.pow(this._stepSizeDays,t),s=0;t>=s;++s){n[s]=o,a[s]=s*this._stepSizeDays;for(var c=0;t>=c;++c)c!==s&&(n[s]*=s-c);n[s]=1/n[s]}this._work=new Array(t+1),this._coef=new Array(t+1)},f=new i(0,0,u.TAI);return l.prototype.preload=function(t,r,n,a){var i=s(this,t,r),o=s(this,n,a),u=0|i/this._stepSizeDays-this._interpolationOrder/2;0>u&&(u=0);var l=o/this._stepSizeDays-this._interpolationOrder/2|0+this._interpolationOrder;l>=this._totalSamples&&(l=this._totalSamples-1);for(var f=0|u/this._samplesPerXysFile,d=0|l/this._samplesPerXysFile,h=[],m=f;d>=m;++m)h.push(c(this,m));return e.all(h)},l.prototype.computeXysRadians=function(e,t,r){var i=s(this,e,t);if(0>i)return void 0;var o=0|i/this._stepSizeDays;if(o>=this._totalSamples)return void 0;var u=this._interpolationOrder,l=o-(0|u/2);0>l&&(l=0);var f=l+u;f>=this._totalSamples&&(f=this._totalSamples-1,l=f-u,0>l&&(l=0));var d=!1,h=this._samples;if(n(h[3*l])||(c(this,0|l/this._samplesPerXysFile),d=!0),n(h[3*f])||(c(this,0|f/this._samplesPerXysFile),d=!0),d)return void 0;n(r)?(r.x=0,r.y=0,r.s=0):r=new a(0,0,0);var m,p,y=i-l*this._stepSizeDays,v=this._work,g=this._denominators,w=this._coef,x=this._xTable;for(m=0;u>=m;++m)v[m]=y-x[m];for(m=0;u>=m;++m){for(w[m]=1,p=0;u>=p;++p)p!==m&&(w[m]*=v[p]);w[m]*=g[m];var E=3*(l+m);r.x+=w[m]*h[E++],r.y+=w[m]*h[E++],r.s+=w[m]*h[E]}return r},l}),define("Core/Quaternion",["./Cartesian3","./defaultValue","./defined","./DeveloperError","./FeatureDetection","./freezeObject","./Math","./Matrix3"],function(e,t,r,n,a,i,o,u){"use strict";var s=function(e,r,n,a){this.x=t(e,0),this.y=t(r,0),this.z=t(n,0),this.w=t(a,0)},c=new e;s.fromAxisAngle=function(t,n,a){var i=n/2,o=Math.sin(i);c=e.normalize(t,c);var u=c.x*o,l=c.y*o,f=c.z*o,d=Math.cos(i);return r(a)?(a.x=u,a.y=l,a.z=f,a.w=d,a):new s(u,l,f,d)};var l=[1,2,0],f=new Array(3);s.fromRotationMatrix=function(e,t){var n,a,i,o,c,d=e[u.COLUMN0ROW0],h=e[u.COLUMN1ROW1],m=e[u.COLUMN2ROW2],p=d+h+m;if(p>0)n=Math.sqrt(p+1),c=.5*n,n=.5/n,a=(e[u.COLUMN1ROW2]-e[u.COLUMN2ROW1])*n,i=(e[u.COLUMN2ROW0]-e[u.COLUMN0ROW2])*n,o=(e[u.COLUMN0ROW1]-e[u.COLUMN1ROW0])*n;else{var y=l,v=0;h>d&&(v=1),m>d&&m>h&&(v=2);var g=y[v],w=y[g];n=Math.sqrt(e[u.getElementIndex(v,v)]-e[u.getElementIndex(g,g)]-e[u.getElementIndex(w,w)]+1);var x=f;x[v]=.5*n,n=.5/n,c=(e[u.getElementIndex(w,g)]-e[u.getElementIndex(g,w)])*n,x[g]=(e[u.getElementIndex(g,v)]+e[u.getElementIndex(v,g)])*n,x[w]=(e[u.getElementIndex(w,v)]+e[u.getElementIndex(v,w)])*n,a=-x[0],i=-x[1],o=-x[2]}return r(t)?(t.x=a,t.y=i,t.z=o,t.w=c,t):new s(a,i,o,c)};var d=new s;s.fromHeadingPitchRoll=function(t,r,n,a){var i=s.fromAxisAngle(e.UNIT_X,n,d),o=s.fromAxisAngle(e.UNIT_Y,-r,a);a=s.multiply(o,i,o);var u=s.fromAxisAngle(e.UNIT_Z,-t,d);return s.multiply(u,a,a)};var h=new e,m=new e,p=new s,y=new s,v=new s;s.packedLength=4,s.pack=function(e,r,n){n=t(n,0),r[n++]=e.x,r[n++]=e.y,r[n++]=e.z,r[n]=e.w},s.unpack=function(e,n,a){return n=t(n,0),r(a)||(a=new s),a.x=e[n],a.y=e[n+1],a.z=e[n+2],a.w=e[n+3],a},s.packedInterpolationLength=3,s.convertPackedArrayForInterpolation=function(e,t,r,n){s.unpack(e,4*r,v),s.conjugate(v,v);for(var a=0,i=r-t+1;i>a;a++){var o=3*a;s.unpack(e,4*(t+a),p),s.multiply(p,v,p),p.w<0&&s.negate(p,p),s.computeAxis(p,h);var u=s.computeAngle(p);n[o]=h.x*u,n[o+1]=h.y*u,n[o+2]=h.z*u}},s.unpackInterpolationResult=function(t,n,a,i,o){r(o)||(o=new s),e.fromArray(t,0,m);var u=e.magnitude(m);return s.unpack(n,4*i,y),0===u?s.clone(s.IDENTITY,p):s.fromAxisAngle(m,u,p),s.multiply(p,y,o)},s.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 s(e.x,e.y,e.z,e.w):void 0},s.conjugate=function(e,t){return t.x=-e.x,t.y=-e.y,t.z=-e.z,t.w=e.w,t},s.magnitudeSquared=function(e){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,t){var r=1/s.magnitude(e),n=e.x*r,a=e.y*r,i=e.z*r,o=e.w*r;return t.x=n,t.y=a,t.z=i,t.w=o,t},s.inverse=function(e,t){var r=s.magnitudeSquared(e);return t=s.conjugate(e,t),s.multiplyByScalar(t,1/r,t)},s.add=function(e,t,r){return r.x=e.x+t.x,r.y=e.y+t.y,r.z=e.z+t.z,r.w=e.w+t.w,r},s.subtract=function(e,t,r){return r.x=e.x-t.x,r.y=e.y-t.y,r.z=e.z-t.z,r.w=e.w-t.w,r},s.negate=function(e,t){return t.x=-e.x,t.y=-e.y,t.z=-e.z,t.w=-e.w,t},s.dot=function(e,t){return e.x*t.x+e.y*t.y+e.z*t.z+e.w*t.w},s.multiply=function(e,t,r){var n=e.x,a=e.y,i=e.z,o=e.w,u=t.x,s=t.y,c=t.z,l=t.w,f=o*u+n*l+a*c-i*s,d=o*s-n*c+a*l+i*u,h=o*c+n*s-a*u+i*l,m=o*l-n*u-a*s-i*c;return r.x=f,r.y=d,r.z=h,r.w=m,r},s.multiplyByScalar=function(e,t,r){return r.x=e.x*t,r.y=e.y*t,r.z=e.z*t,r.w=e.w*t,r},s.divideByScalar=function(e,t,r){return r.x=e.x/t,r.y=e.y/t,r.z=e.z/t,r.w=e.w/t,r},s.computeAxis=function(e,t){var r=e.w;if(Math.abs(r-1)<o.EPSILON6)return t.x=t.y=t.z=0,t;var n=1/Math.sqrt(1-r*r);return t.x=e.x*n,t.y=e.y*n,t.z=e.z*n,t},s.computeAngle=function(e){return Math.abs(e.w-1)<o.EPSILON6?0:2*Math.acos(e.w)};var g=new s;s.lerp=function(e,t,r,n){return g=s.multiplyByScalar(t,r,g),n=s.multiplyByScalar(e,1-r,n),s.add(g,n,n)};var w=new s,x=new s,E=new s;s.slerp=function(e,t,r,n){var a=s.dot(e,t),i=t;if(0>a&&(a=-a,i=w=s.negate(t,w)),1-a<o.EPSILON6)return s.lerp(e,i,r,n);var u=Math.acos(a);return x=s.multiplyByScalar(e,Math.sin((1-r)*u),x),E=s.multiplyByScalar(i,Math.sin(r*u),E),n=s.add(x,E,n),s.multiplyByScalar(n,1/Math.sin(u),n)},s.log=function(t,r){var n=o.acosClamped(t.w),a=0;return 0!==n&&(a=n/Math.sin(n)),e.multiplyByScalar(t,a,r)},s.exp=function(t,r){var n=e.magnitude(t),a=0;return 0!==n&&(a=Math.sin(n)/n),r.x=t.x*a,r.y=t.y*a,r.z=t.z*a,r.w=Math.cos(n),r};var S=new e,O=new e,T=new s,b=new s;s.computeInnerQuadrangle=function(t,r,n,a){var i=s.conjugate(r,T);s.multiply(i,n,b);var o=s.log(b,S);s.multiply(i,t,b);var u=s.log(b,O);return e.add(o,u,o),e.multiplyByScalar(o,.25,o),e.negate(o,o),s.exp(o,T),s.multiply(r,T,a)},s.squad=function(e,t,r,n,a,i){var o=s.slerp(e,t,a,T),u=s.slerp(r,n,a,b);return s.slerp(o,u,2*a*(1-a),i)};for(var M=new s,_=1.9011074535173003,P=a.supportsTypedArrays()?new Float32Array(8):[],N=a.supportsTypedArrays()?new Float32Array(8):[],A=a.supportsTypedArrays()?new Float32Array(8):[],I=a.supportsTypedArrays()?new Float32Array(8):[],R=0;7>R;++R){var z=R+1,C=2*z+1;P[R]=1/(z*C),N[R]=z/C}return P[7]=_/136,N[7]=8*_/17,s.fastSlerp=function(e,t,r,n){var a,i=s.dot(e,t);i>=0?a=1:(a=-1,i=-i);for(var o=i-1,u=1-r,c=r*r,l=u*u,f=7;f>=0;--f)A[f]=(P[f]*c-N[f])*o,I[f]=(P[f]*l-N[f])*o;var d=a*r*(1+A[0]*(1+A[1]*(1+A[2]*(1+A[3]*(1+A[4]*(1+A[5]*(1+A[6]*(1+A[7])))))))),h=u*(1+I[0]*(1+I[1]*(1+I[2]*(1+I[3]*(1+I[4]*(1+I[5]*(1+I[6]*(1+I[7])))))))),m=s.multiplyByScalar(e,h,M);return s.multiplyByScalar(t,d,n),s.add(m,n,n)},s.fastSquad=function(e,t,r,n,a,i){var o=s.fastSlerp(e,t,a,T),u=s.fastSlerp(r,n,a,b);return s.fastSlerp(o,u,2*a*(1-a),i)},s.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},s.equalsEpsilon=function(e,t,n){return e===t||r(e)&&r(t)&&Math.abs(e.x-t.x)<=n&&Math.abs(e.y-t.y)<=n&&Math.abs(e.z-t.z)<=n&&Math.abs(e.w-t.w)<=n},s.ZERO=i(new s(0,0,0,0)),s.IDENTITY=i(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,t){return s.equalsEpsilon(this,e,t)},s.prototype.toString=function(){return"("+this.x+", "+this.y+", "+this.z+", "+this.w+")"},s}),define("Core/Transforms",["../ThirdParty/when","./Cartesian2","./Cartesian3","./Cartesian4","./defaultValue","./defined","./DeveloperError","./EarthOrientationParameters","./EarthOrientationParametersSample","./Ellipsoid","./Iau2006XysData","./Iau2006XysSample","./JulianDate","./Math","./Matrix3","./Matrix4","./Quaternion","./TimeConstants"],function(e,t,r,n,a,i,o,u,s,c,l,f,d,h,m,p,y,v){"use strict";var g={},w=new r,x=new r,E=new r;g.eastNorthUpToFixedFrame=function(e,t,n){if(h.equalsEpsilon(e.x,0,h.EPSILON14)&&h.equalsEpsilon(e.y,0,h.EPSILON14)){var o=h.sign(e.z);return i(n)?(n[0]=0,n[1]=1,n[2]=0,n[3]=0,n[4]=-o,n[5]=0,n[6]=0,n[7]=0,n[8]=0,n[9]=0,n[10]=o,n[11]=0,n[12]=e.x,n[13]=e.y,n[14]=e.z,n[15]=1,n):new p(0,-o,0,e.x,1,0,0,e.y,0,0,o,e.z,0,0,0,1)}var u=w,s=x,l=E;return t=a(t,c.WGS84),t.geodeticSurfaceNormal(e,u),s.x=-e.y,s.y=e.x,s.z=0,r.normalize(s,s),r.cross(u,s,l),i(n)?(n[0]=s.x,n[1]=s.y,n[2]=s.z,n[3]=0,n[4]=l.x,n[5]=l.y,n[6]=l.z,n[7]=0,n[8]=u.x,n[9]=u.y,n[10]=u.z,n[11]=0,n[12]=e.x,n[13]=e.y,n[14]=e.z,n[15]=1,n):new p(s.x,l.x,u.x,e.x,s.y,l.y,u.y,e.y,s.z,l.z,u.z,e.z,0,0,0,1)};var S=new r,O=new r,T=new r;g.northEastDownToFixedFrame=function(e,t,n){if(h.equalsEpsilon(e.x,0,h.EPSILON14)&&h.equalsEpsilon(e.y,0,h.EPSILON14)){var o=h.sign(e.z);return i(n)?(n[0]=-o,n[1]=0,n[2]=0,n[3]=0,n[4]=0,n[5]=1,n[6]=0,n[7]=0,n[8]=0,n[9]=0,n[10]=-o,n[11]=0,n[12]=e.x,n[13]=e.y,n[14]=e.z,n[15]=1,n):new p(-o,0,0,e.x,0,1,0,e.y,0,0,-o,e.z,0,0,0,1)}var u=S,s=O,l=T;return t=a(t,c.WGS84),t.geodeticSurfaceNormal(e,u),s.x=-e.y,s.y=e.x,s.z=0,r.normalize(s,s),r.cross(u,s,l),i(n)?(n[0]=l.x,n[1]=l.y,n[2]=l.z,n[3]=0,n[4]=s.x,n[5]=s.y,n[6]=s.z,n[7]=0,n[8]=-u.x,n[9]=-u.y,n[10]=-u.z,n[11]=0,n[12]=e.x,n[13]=e.y,n[14]=e.z,n[15]=1,n):new p(l.x,s.x,-u.x,e.x,l.y,s.y,-u.y,e.y,l.z,s.z,-u.z,e.z,0,0,0,1)},g.northUpEastToFixedFrame=function(e,t,n){if(h.equalsEpsilon(e.x,0,h.EPSILON14)&&h.equalsEpsilon(e.y,0,h.EPSILON14)){var o=h.sign(e.z);return i(n)?(n[0]=-o,n[1]=0,n[2]=0,n[3]=0,n[4]=0,n[5]=0,n[6]=o,n[7]=0,n[8]=0,n[9]=1,n[10]=0,n[11]=0,n[12]=e.x,n[13]=e.y,n[14]=e.z,n[15]=1,n):new p(-o,0,0,e.x,0,0,1,e.y,0,o,0,e.z,0,0,0,1)}var u=w,s=x,l=E;return t=a(t,c.WGS84),t.geodeticSurfaceNormal(e,u),s.x=-e.y,s.y=e.x,s.z=0,r.normalize(s,s),r.cross(u,s,l),i(n)?(n[0]=l.x,n[1]=l.y,n[2]=l.z,n[3]=0,n[4]=u.x,n[5]=u.y,n[6]=u.z,n[7]=0,n[8]=s.x,n[9]=s.y,n[10]=s.z,n[11]=0,n[12]=e.x,n[13]=e.y,n[14]=e.z,n[15]=1,n):new p(l.x,u.x,s.x,e.x,l.y,u.y,s.y,e.y,l.z,u.z,s.z,e.z,0,0,0,1)};var b=new y,M=new r(1,1,1),_=new p;g.headingPitchRollToFixedFrame=function(e,t,n,a,i,o){var u=y.fromHeadingPitchRoll(t,n,a,b),s=p.fromTranslationQuaternionRotationScale(r.ZERO,u,M,_);return o=g.eastNorthUpToFixedFrame(e,i,o),p.multiply(o,s,o)};var P=new p,N=new m;g.headingPitchRollQuaternion=function(e,t,r,n,a,i){var o=g.headingPitchRollToFixedFrame(e,t,r,n,a,P),u=p.getRotation(o,N);return y.fromRotationMatrix(u,i)};var A=24110.54841,I=8640184.812866,R=.093104,z=-62e-7,C=1.1772758384668e-19,D=72921158553e-15,L=h.TWO_PI/86400,q=new d;g.computeTemeToPseudoFixedMatrix=function(e,t){q=d.addSeconds(e,-d.computeTaiMinusUtc(e),q);var r,n=q.dayNumber,a=q.secondsOfDay,o=n-2451545;r=a>=43200?(o+.5)/v.DAYS_PER_JULIAN_CENTURY:(o-.5)/v.DAYS_PER_JULIAN_CENTURY;var u=A+r*(I+r*(R+r*z)),s=u*L%h.TWO_PI,c=D+C*(n-2451545.5),l=(a+.5*v.SECONDS_PER_DAY)%v.SECONDS_PER_DAY,f=s+c*l,p=Math.cos(f),y=Math.sin(f);return i(t)?(t[0]=p,t[1]=-y,t[2]=0,t[3]=y,t[4]=p,t[5]=0,t[6]=0,t[7]=0,t[8]=1,t):new m(p,y,0,-y,p,0,0,0,1)},g.iau2006XysData=new l,g.earthOrientationParameters=u.NONE;var U=32.184,F=2451545;g.preloadIcrfFixed=function(t){var r=t.start.dayNumber,n=t.start.secondsOfDay+U,a=t.stop.dayNumber,i=t.stop.secondsOfDay+U,o=g.iau2006XysData.preload(r,n,a,i),u=g.earthOrientationParameters.getPromiseToLoad();return e.all([o,u])},g.computeIcrfToFixedMatrix=function(e,t){i(t)||(t=new m);var r=g.computeFixedToIcrfMatrix(e,t);return i(r)?m.transpose(r,t):void 0};var B=new f(0,0,0),W=new s(0,0,0,0,0,0),G=new m,k=new m;g.computeFixedToIcrfMatrix=function(e,t){i(t)||(t=new m);var r=g.earthOrientationParameters.compute(e,W);if(!i(r))return void 0;var n=e.dayNumber,a=e.secondsOfDay+U,o=g.iau2006XysData.computeXysRadians(n,a,B);if(!i(o))return void 0;var u=o.x+r.xPoleOffset,s=o.y+r.yPoleOffset,c=1/(1+Math.sqrt(1-u*u-s*s)),l=G;l[0]=1-c*u*u,l[3]=-c*u*s,l[6]=u,l[1]=-c*u*s,l[4]=1-c*s*s,l[7]=s,l[2]=-u,l[5]=-s,l[8]=1-c*(u*u+s*s);var f=m.fromRotationZ(-o.s,k),p=m.multiply(l,f,G),y=e.dayNumber,w=e.secondsOfDay-d.computeTaiMinusUtc(e)+r.ut1MinusUtc,x=y-2451545,E=w/v.SECONDS_PER_DAY,S=.779057273264+E+.00273781191135448*(x+E);S=S%1*h.TWO_PI;var O=m.fromRotationZ(S,k),T=m.multiply(p,O,G),b=Math.cos(r.xPoleWander),M=Math.cos(r.yPoleWander),_=Math.sin(r.xPoleWander),P=Math.sin(r.yPoleWander),N=n-F+a/v.SECONDS_PER_DAY;N/=36525;var A=-47e-6*N*h.RADIANS_PER_DEGREE/3600,I=Math.cos(A),R=Math.sin(A),z=k;return z[0]=b*I,z[1]=b*R,z[2]=_,z[3]=-M*R+P*_*I,z[4]=M*I+P*_*R,z[5]=-P*b,z[6]=-P*R-M*_*I,z[7]=P*I-M*_*R,z[8]=M*b,m.multiply(T,z,t)};var V=new n;g.pointToWindowCoordinates=function(e,t,r,n){return n=g.pointToGLWindowCoordinates(e,t,r,n),n.y=2*t[5]-n.y,n},g.pointToGLWindowCoordinates=function(e,r,a,o){i(o)||(o=new t);var u=V;return p.multiplyByVector(e,n.fromElements(a.x,a.y,a.z,1,u),u),n.multiplyByScalar(u,1/u.w,u),p.multiplyByVector(r,u,u),t.fromCartesian4(u,o)};var Y=new r,j=new r,H=new r;return g.rotationMatrixFromPositionVelocity=function(e,t,n,o){var u=a(n,c.WGS84).geodeticSurfaceNormal(e,Y),s=r.cross(t,u,j);r.equalsEpsilon(s,r.ZERO,h.EPSILON6)&&(s=r.clone(r.UNIT_X,s));var l=r.cross(s,t,H);return r.cross(t,l,s),r.negate(s,s),i(o)||(o=new m),o[0]=t.x,o[1]=t.y,o[2]=t.z,o[3]=s.x,o[4]=s.y,o[5]=s.z,o[6]=l.x,o[7]=l.y,o[8]=l.z,o},g}),define("Core/EllipsoidTangentPlane",["./AxisAlignedBoundingBox","./Cartesian2","./Cartesian3","./Cartesian4","./defaultValue","./defined","./defineProperties","./DeveloperError","./Ellipsoid","./IntersectionTests","./Matrix4","./Plane","./Ray","./Transforms"],function(e,t,r,n,a,i,o,u,s,c,l,f,d,h){"use strict";var m=new n,p=function(e,t){t=a(t,s.WGS84),e=t.scaleToGeodeticSurface(e);var n=h.eastNorthUpToFixedFrame(e,t);this._ellipsoid=t,this._origin=e,this._xAxis=r.fromCartesian4(l.getColumn(n,0,m)),this._yAxis=r.fromCartesian4(l.getColumn(n,1,m));var i=r.fromCartesian4(l.getColumn(n,2,m));this._plane=f.fromPointNormal(e,i)};o(p.prototype,{ellipsoid:{get:function(){return this._ellipsoid}},origin:{get:function(){return this._origin}}});var y=new e;p.fromPoints=function(t,r){var n=e.fromPoints(t,y);return new p(n.center,r)};var v=new d,g=new r;p.prototype.projectPointOntoPlane=function(e,n){var a=v;a.origin=e,r.normalize(e,a.direction);var o=c.rayPlane(a,this._plane,g);if(i(o)||(r.negate(a.direction,a.direction),o=c.rayPlane(a,this._plane,g)),i(o)){var u=r.subtract(o,this._origin,o),s=r.dot(this._xAxis,u),l=r.dot(this._yAxis,u);return i(n)?(n.x=s,n.y=l,n):new t(s,l)}return void 0},p.prototype.projectPointsOntoPlane=function(e,t){i(t)||(t=[]);for(var r=0,n=e.length,a=0;n>a;a++){var o=this.projectPointOntoPlane(e[a],t[r]);i(o)&&(t[r]=o,r++)}return t.length=r,t};var w=new r;return p.prototype.projectPointsOntoEllipsoid=function(e,t){var n=e.length;i(t)?t.length=n:t=new Array(n);for(var a=this._ellipsoid,o=this._origin,u=this._xAxis,s=this._yAxis,c=w,l=0;n>l;++l){var f=e[l];r.multiplyByScalar(u,f.x,c),i(t[l])||(t[l]=new r);var d=r.add(o,c,t[l]);r.multiplyByScalar(s,f.y,c),r.add(d,c,d),a.scaleToGeocentricSurface(d,d)}return t},p}),define("Core/pointInsideTriangle",["./barycentricCoordinates","./Cartesian3"],function(e,t){"use strict";var r=new t,n=function(t,n,a,i){return e(t,n,a,i,r),r.x>0&&r.y>0&&r.z>0};return n}),define("Core/Queue",[],function(){"use strict";var e=function(){this._array=[],this._offset=0,this.length=0};return e.prototype.enqueue=function(e){this._array.push(e),this.length++},e.prototype.dequeue=function(){if(0===this.length)return void 0;var e=this._array,t=this._offset,r=e[t];return e[t]=void 0,t++,t>10&&2*t>e.length&&(this._array=e.slice(t),t=0),this._offset=t,this.length--,r},e.prototype.contains=function(e){return-1!==this._array.indexOf(e)},e.prototype.clear=function(){this._array.length=this._offset=this.length=0},e.prototype.sort=function(e){this._offset>0&&(this._array=this._array.slice(this._offset),this._offset=0),this._array.sort(e)},e}),define("Core/WindingOrder",["./freezeObject"],function(e){"use strict";var t={CLOCKWISE:2304,COUNTER_CLOCKWISE:2305,validate:function(e){return e===t.CLOCKWISE||e===t.COUNTER_CLOCKWISE}};return e(t)}),define("Core/PolygonPipeline",["./Cartesian2","./Cartesian3","./ComponentDatatype","./defaultValue","./defined","./DeveloperError","./Ellipsoid","./EllipsoidTangentPlane","./Geometry","./GeometryAttribute","./Math","./pointInsideTriangle","./PrimitiveType","./Queue","./WindingOrder"],function(e,t,r,n,a,i,o,u,s,c,l,f,d,h,m){"use strict";function p(t,r,n){var a=e.subtract(r,t,D),i=e.subtract(n,r,L);return a.x*i.y-a.y*i.x>=0}function y(e){for(var t=e[0].x,r=0,n=0;n<e.length;n++)e[n].x>t&&(t=e[n].x,r=n);return r}function v(e){for(var t=e[0][0].x,r=0,n=0;n<e.length;n++){var a=e[n][y(e[n])].x;a>t&&(t=a,r=n)}return r}function g(e){for(var t=[],r=0;r<e.length;r++){var n=e[(r-1+e.length)%e.length],a=e[r],i=e[(r+1)%e.length];p(n,a,i)||t.push(a)}return t}function w(t,r){for(var n=0;n<t.length;n++)if(e.equals(r,t[n]))return n;return-1}function x(r,a,i){i=n(i,[]);var o=Number.MAX_VALUE,u=y(a),s=new e(a[u].x,r.y);i.push(u),i.push((u+1)%a.length);for(var c=a[0].x,l=c,f=1;f<a.length;++f)a[f].x<c?c=a[f].x:a[f].x>l&&(l=a[f].x);l+=l-c;var d=new t(l,r.y,0);for(f=0;f<a.length;f++){var h=a[f],m=a[(f+1)%a.length];if((h.x>=r.x||m.x>=r.x)&&(h.y>=r.y&&m.y<=r.y||h.y<=r.y&&m.y>=r.y)){var p=(m.y-h.y)*(d.x-r.x)-(m.x-h.x)*(d.y-r.y);if(0!==p){p=1/p;var v=((m.x-h.x)*(r.y-h.y)-(m.y-h.y)*(r.x-h.x))*p,g=((d.x-r.x)*(r.y-h.y)-(d.y-r.y)*(r.x-h.x))*p;if(v>=0&&1>=v&&g>=0&&1>=g){var w=new e(r.x+v*(d.x-r.x),r.y+v*(d.y-r.y)),x=e.subtract(w,r,q);p=e.magnitudeSquared(x),o>p&&(s=w,o=p,i[0]=f,i[1]=(f+1)%a.length)}}}}return s}function E(t,r){var n=v(r),a=r[n],i=y(a),o=a[i],u=[],s=x(o,t,u),c=w(t,s);if(-1!==c)return c;var d=e.magnitudeSquared(e.subtract(t[u[0]],o,U)),h=e.magnitudeSquared(e.subtract(t[u[1]],o,U)),m=h>d?t[u[0]]:t[u[1]],p=g(t),E=p.indexOf(m);-1!==E&&p.splice(E,1);for(var S=[],O=0;O<p.length;O++){var T=p[O];f(T,o,s,m)&&S.push(T)}var b=Number.MAX_VALUE;if(S.length>0){var M=e.fromElements(1,0,U);for(O=0;O<S.length;O++){var _=e.subtract(S[O],o,F),P=e.magnitude(M)*e.magnitudeSquared(_);if(0!==P){var N=Math.abs(l.acosClamped(e.dot(M,_)/P));b>N&&(b=N,m=S[O])}}}return t.indexOf(m)}function S(e,r,n){for(var a=$.computeWindingOrder2D(e),i=0;i<r.length;i++){var o=r[i];t.equals(o[0],o[o.length-1])||o.push(o[0]);var s=$.computeWindingOrder2D(o);s===a&&o.reverse()}var c=u.fromPoints(e,n),l=c.projectPointsOntoPlane(e),f=[];for(i=0;i<r.length;i++)f.push(c.projectPointsOntoPlane(r[i]));var d=E(l,f),h=v(f),m=y(f[h]),p=r[h],g=[];for(i=0;i<e.length;i++)g.push(e[i]);var w,x=[];if(0!==m)for(w=0;w<=p.length;w++){var S=(w+m)%p.length;0!==S&&x.push(p[S])}else for(w=0;w<p.length;w++)x.push(p[(w+m)%p.length]);var O=g.lastIndexOf(e[d]);x.push(e[O]);var T=g.slice(0,O+1),b=g.slice(O+1);return g=T.concat(x,b),r.splice(h,1),g}function O(e){var t=l.nextRandomNumber(),r=Math.floor(t*e);return r===e&&r--,r}function T(e,t,r,n){var a=n[e].position,i=n[t].position,o=n[r].position,u=o.x,s=o.y,c=a.x-u,l=a.y-s,f=i.x-u,d=i.y-s;return c*d-l*f}function b(e,t){return e.x*t.y-e.y*t.x}function M(e,t){var r=t.length,n=l.mod(e-1,r),a=l.mod(e+1,r);return 0===T(n,a,e,t)?!1:!0}function _(t,r){return e.magnitudeSquared(r)<e.magnitudeSquared(t)}function P(t,r,n){if(!M(t,n))return t;var a=n[t].position,i=n[r].position,o=n.length,u=l.mod(t-1,o);if(!M(u,n))return u;var s=l.mod(t+1,o);if(!M(s,n))return s;var c=e.subtract(n[u].position,a,G),f=e.subtract(n[s].position,a,k),d=e.subtract(i,a,V),h=b(c,d),m=b(f,d);if(0===h)return _(c,d)?B:W;if(0===m)return _(f,d)?B:W;var p=b(c,f);return 0>p?0>h&&m>0?B:W:p>0?h>0&&0>m?W:B:void 0}function N(e,t,r){return(e>t||e>r)&&(t>e||r>e)||t===r&&t===e}function A(t,r,n,a){var i=e.subtract(n,t,j),o=r.x*a.y-r.y*a.x,u=o*o,s=e.magnitudeSquared(r),c=e.magnitudeSquared(a);if(u>Y*s*c){var l=(i.x*a.y-i.y*a.x)/o;return e.add(t,e.multiplyByScalar(r,l,j),j)}return void 0}function I(t,r,n){for(var i=e.subtract(r,t,H),o=n.length,u=0;o>u;u++){var s=n[u].position,c=n[l.mod(u+1,o)].position;if(!(e.equals(t,s)||e.equals(r,c)||e.equals(t,c)||e.equals(r,s))){var f=e.subtract(c,s,X),d=A(t,i,s,f);if(a(d)&&!(e.equals(d,t)||e.equals(d,r)||e.equals(d,s)||e.equals(d,c))){var h=d.x,m=d.y,p=N(h,t.x,r.x)&&N(m,t.y,r.y)&&N(h,s.x,c.x)&&N(m,s.y,c.y);if(p)return!0}}}return!1}function R(t,r,n){var a=P(t,r,n);if(a>=0)return a;var i=P(r,t,n);return i>=0?i:a!==B||i!==B||I(n[t].position,n[r].position,n)||e.equals(n[t].position,n[r].position)?J:Z}function z(e){return 0===T(1,2,0,e)}function C(e){var t=e.length;if(3===t)return z(e)?[]:[e[0].index,e[1].index,e[2].index];if(e.length<3)throw new i("Invalid polygon: must have at least three vertices.");for(var r,n,a=0,o=10*e.length,u=J;Z>u&&a++<o;){for(r=O(e.length),n=r+1;Math.abs(r-n)<2||Math.abs(r-n)>e.length-2;)n=O(e.length);if(r>n){var s=r;r=n,n=s}u=R(r,n,e)}if(u===Z){var c=e.splice(r,n-r+1,e[r],e[n]);return C(e).concat(C(c))}return u>=0?(e.splice(u,1),C(e)):[]}var D=new e,L=new e,q=new e,U=new e(1,0),F=new e,B=-1,W=-2,G=new t,k=new t,V=new t,Y=l.EPSILON14,j=new e;new e;var H=new e,X=new e,Z=-1,J=-2,K=new t,Q=new t,$={};$.removeDuplicates=function(e){for(var r=e.length,n=[],a=r-1,i=0;r>i;a=i++){var o=e[a],u=e[i];t.equals(o,u)||n.push(u)}return n},$.computeArea2D=function(e){for(var t=e.length,r=0,n=t-1,a=0;t>a;n=a++){var i=e[n],o=e[a];r+=i.x*o.y-o.x*i.y}return.5*r},$.computeWindingOrder2D=function(e){var t=$.computeArea2D(e);return t>0?m.COUNTER_CLOCKWISE:m.CLOCKWISE},$.triangulate=function(e){for(var t=e.length,r=[],n=0;t>n;++n)r[n]={position:e[n],index:n};return C(r)};var et=new t,tt=new t,rt=new t,nt=new t,at=new t,it=new t,ot=new t;return $.computeSubdivision=function(e,i,o,u){u=n(u,l.RADIANS_PER_DEGREE);var f,h=o.slice(0),m=i.length,p=new Array(3*m),y=0;for(f=0;m>f;f++){var v=i[f];p[y++]=v.x,p[y++]=v.y,p[y++]=v.z}for(var g=[],w={},x=e.maximumRadius,E=l.chordLength(u,x),S=E*E;h.length>0;){var O,T,b=h.pop(),M=h.pop(),_=h.pop(),P=t.fromArray(p,3*_,et),N=t.fromArray(p,3*M,tt),A=t.fromArray(p,3*b,rt),I=t.multiplyByScalar(t.normalize(P,nt),x,nt),R=t.multiplyByScalar(t.normalize(N,at),x,at),z=t.multiplyByScalar(t.normalize(A,it),x,it),C=t.magnitudeSquared(t.subtract(I,R,ot)),D=t.magnitudeSquared(t.subtract(R,z,ot)),L=t.magnitudeSquared(t.subtract(z,I,ot)),q=Math.max(C,D,L);q>S?C===q?(O=Math.min(_,M)+" "+Math.max(_,M),f=w[O],a(f)||(T=t.add(P,N,ot),t.multiplyByScalar(T,.5,T),p.push(T.x,T.y,T.z),f=p.length/3-1,w[O]=f),h.push(_,f,b),h.push(f,M,b)):D===q?(O=Math.min(M,b)+" "+Math.max(M,b),f=w[O],a(f)||(T=t.add(N,A,ot),t.multiplyByScalar(T,.5,T),p.push(T.x,T.y,T.z),f=p.length/3-1,w[O]=f),h.push(M,f,_),h.push(f,b,_)):L===q&&(O=Math.min(b,_)+" "+Math.max(b,_),f=w[O],a(f)||(T=t.add(A,P,ot),t.multiplyByScalar(T,.5,T),p.push(T.x,T.y,T.z),f=p.length/3-1,w[O]=f),h.push(b,f,M),h.push(f,_,M)):(g.push(_),g.push(M),g.push(b))}return new s({attributes:{position:new c({componentDatatype:r.DOUBLE,componentsPerAttribute:3,values:p})},indices:g,primitiveType:d.TRIANGLES})},$.scaleToGeodeticHeight=function(e,r,i,u){i=n(i,o.WGS84);var s=K,c=Q;if(r=n(r,0),u=n(u,!0),a(e)&&a(e.attributes)&&a(e.attributes.position))for(var l=e.attributes.position.values,f=l.length,d=0;f>d;d+=3)t.fromArray(l,d,c),u&&(c=i.scaleToGeodeticSurface(c,c)),s=i.geodeticSurfaceNormal(c,s),t.multiplyByScalar(s,r,s),t.add(c,s,c),l[d]=c.x,l[d+1]=c.y,l[d+2]=c.z;return e},$.eliminateHoles=function(e,r,a){a=n(a,o.WGS84);for(var i=[],u=0;u<r.length;u++){for(var s=[],c=0;c<r[u].length;c++)s.push(t.clone(r[u][c]));i.push(s)}for(var l=e;i.length>0;)l=S(l,i,a);return l},$}),define("Core/RectangleGeometryLibrary",["./Cartesian3","./Cartographic","./defined","./DeveloperError","./GeographicProjection","./Math","./Matrix2","./Rectangle"],function(e,t,r,n,a,i,o,u){"use strict";var s=Math.cos,c=Math.sin,l=Math.sqrt,f={};f.computePosition=function(e,t,n,a,i){var u=e.ellipsoid.radiiSquared,f=e.nwCorner,d=e.rectangle,h=f.latitude-e.granYCos*t+n*e.granXSin,m=s(h),p=c(h),y=u.z*p,v=f.longitude+t*e.granYSin+n*e.granXCos,g=m*s(v),w=m*c(v),x=u.x*g,E=u.y*w,S=l(x*g+E*w+y*p);a.x=x/S,a.y=E/S,a.z=y/S,r(e.vertexFormat)&&e.vertexFormat.st&&(i.x=(v-d.west)*e.lonScalar-.5,i.y=(h-d.south)*e.latScalar-.5,o.multiplyByVector(e.textureMatrix,i,i),i.x+=.5,i.y+=.5)};var d=new o,h=new e,m=new t,p=new e,y=new a;return f.computeOptions=function(t,a,s){var c,l,f,v,g,w=t._granularity,x=t._ellipsoid,E=t._surfaceHeight,S=t._rotation,O=t._extrudedHeight,T=a.east,b=a.west,M=a.north,_=a.south,P=M-_;b>T?(g=i.TWO_PI-b+T,c=Math.ceil(g/w)+1,l=Math.ceil(P/w)+1,f=g/(c-1),v=P/(l-1)):(g=T-b,c=Math.ceil(g/w)+1,l=Math.ceil(P/w)+1,f=g/(c-1),v=P/(l-1)),s=u.northwest(a,s);var N=u.center(a,m),A=v,I=f,R=0,z=0;if(r(S)){var C=Math.cos(S);A*=C,I*=C;var D=Math.sin(S);R=v*D,z=f*D,h=y.project(s,h),p=y.project(N,p),h=e.subtract(h,p,h);var L=o.fromRotation(S,d);h=o.multiplyByVector(L,h,h),h=e.add(h,p,h),s=y.unproject(h,s);var q=s.latitude,U=q+(c-1)*z,F=q-A*(l-1),B=q-A*(l-1)+(c-1)*z;M=Math.max(q,U,F,B),_=Math.min(q,U,F,B);var W=s.longitude,G=W+(c-1)*I,k=W+(l-1)*R,V=W+(l-1)*R+(c-1)*I;if(T=Math.max(W,G,k,V),b=Math.min(W,G,k,V),M<-i.PI_OVER_TWO||M>i.PI_OVER_TWO||_<-i.PI_OVER_TWO||_>i.PI_OVER_TWO)throw new n("Rotated extent is invalid.");a.north=M,a.south=_,a.east=T,a.west=b}return{granYCos:A,granYSin:R,granXCos:I,granXSin:z,ellipsoid:x,width:c,height:l,surfaceHeight:E,extrudedHeight:O,nwCorner:s,rectangle:a}},f}),define("Core/VertexFormat",["./defaultValue","./defined","./DeveloperError","./freezeObject"],function(e,t,r,n){"use strict";var a=function(t){t=e(t,e.EMPTY_OBJECT),this.position=e(t.position,!1),this.normal=e(t.normal,!1),this.st=e(t.st,!1),this.binormal=e(t.binormal,!1),this.tangent=e(t.tangent,!1),this.color=e(t.color,!1)};return a.POSITION_ONLY=n(new a({position:!0})),a.POSITION_AND_NORMAL=n(new a({position:!0,normal:!0})),a.POSITION_NORMAL_AND_ST=n(new a({position:!0,normal:!0,st:!0})),a.POSITION_AND_ST=n(new a({position:!0,st:!0})),a.POSITION_AND_COLOR=n(new a({position:!0,color:!0})),a.ALL=n(new a({position:!0,normal:!0,st:!0,binormal:!0,tangent:!0})),a.DEFAULT=a.POSITION_NORMAL_AND_ST,a.packedLength=6,a.pack=function(t,r,n){n=e(n,0),r[n++]=t.position?1:0,r[n++]=t.normal?1:0,r[n++]=t.st?1:0,r[n++]=t.binormal?1:0,r[n++]=t.tangent?1:0,r[n++]=t.color?1:0},a.unpack=function(r,n,i){return n=e(n,0),t(i)||(i=new a),i.position=1===r[n++],i.normal=1===r[n++],i.st=1===r[n++],i.binormal=1===r[n++],i.tangent=1===r[n++],i.color=1===r[n++],i},a.clone=function(e,r){return t(e)?(t(r)||(r=new a),r.position=e.position,r.normal=e.normal,r.st=e.st,r.binormal=e.binormal,r.tangent=e.tangent,r.color=e.color,r):void 0
},a}),define("Core/RectangleGeometry",["./BoundingSphere","./Cartesian2","./Cartesian3","./Cartographic","./ComponentDatatype","./defaultValue","./defined","./DeveloperError","./Ellipsoid","./Geometry","./GeometryAttribute","./GeometryAttributes","./GeometryInstance","./GeometryPipeline","./IndexDatatype","./Math","./Matrix2","./Matrix3","./PolygonPipeline","./PrimitiveType","./Quaternion","./Rectangle","./RectangleGeometryLibrary","./VertexFormat"],function(e,t,r,n,a,i,o,u,s,c,l,f,d,h,m,p,y,v,g,w,x,E,S,O){"use strict";function T(e,t){var r=new c({attributes:new f,primitiveType:w.TRIANGLES});return r.attributes.position=new l({componentDatatype:a.DOUBLE,componentsPerAttribute:3,values:t.positions}),e.normal&&(r.attributes.normal=new l({componentDatatype:a.FLOAT,componentsPerAttribute:3,values:t.normals})),e.tangent&&(r.attributes.tangent=new l({componentDatatype:a.FLOAT,componentsPerAttribute:3,values:t.tangents})),e.binormal&&(r.attributes.binormal=new l({componentDatatype:a.FLOAT,componentsPerAttribute:3,values:t.binormals})),r}function b(e,t,n,a){for(var i=e.length,o=t.normal?new Float32Array(i):void 0,u=t.tangent?new Float32Array(i):void 0,s=t.binormal?new Float32Array(i):void 0,c=0,l=C,f=z,d=R,h=0;i>h;h+=3){var m=r.fromArray(e,h,I),p=c+1,y=c+2;(t.normal||t.tangent||t.binormal)&&(d=n.geodeticSurfaceNormal(m,d),(t.tangent||t.binormal)&&(r.cross(r.UNIT_Z,d,f),v.multiplyByVector(a,f,f),r.normalize(f,f),t.binormal&&r.normalize(r.cross(d,f,l),l)),t.normal&&(o[c]=d.x,o[p]=d.y,o[y]=d.z),t.tangent&&(u[c]=f.x,u[p]=f.y,u[y]=f.z),t.binormal&&(s[c]=l.x,s[p]=l.y,s[y]=l.z)),c+=3}return T(t,{positions:e,normals:o,tangents:u,binormals:s})}function M(e,t,n){for(var a=e.length,i=t.normal?new Float32Array(a):void 0,o=t.tangent?new Float32Array(a):void 0,u=t.binormal?new Float32Array(a):void 0,s=0,c=0,l=0,f=!0,d=C,h=z,m=R,y=0;a>y;y+=6){var v=r.fromArray(e,y,I);if(t.normal||t.tangent||t.binormal){var g=r.fromArray(e,(y+6)%a,F);if(f){var w=r.fromArray(e,(y+3)%a,B);r.subtract(g,v,g),r.subtract(w,v,w),m=r.normalize(r.cross(w,g,m),m),f=!1}r.equalsEpsilon(g,v,p.EPSILON10)&&(f=!0),(t.tangent||t.binormal)&&(d=n.geodeticSurfaceNormal(v,d),t.tangent&&(h=r.normalize(r.cross(d,m,h),h))),t.normal&&(i[s++]=m.x,i[s++]=m.y,i[s++]=m.z,i[s++]=m.x,i[s++]=m.y,i[s++]=m.z),t.tangent&&(o[c++]=h.x,o[c++]=h.y,o[c++]=h.z,o[c++]=h.x,o[c++]=h.y,o[c++]=h.z),t.binormal&&(u[l++]=d.x,u[l++]=d.y,u[l++]=d.z,u[l++]=d.x,u[l++]=d.y,u[l++]=d.z)}}return T(t,{positions:e,normals:i,tangents:o,binormals:u})}function _(e){for(var t=e.vertexFormat,r=e.ellipsoid,n=e.size,i=e.height,o=e.width,u=t.position?new Float64Array(3*n):void 0,s=t.st?new Float32Array(2*n):void 0,c=0,f=0,d=I,h=L,p=Number.MAX_VALUE,y=Number.MAX_VALUE,v=Number.MIN_VALUE,g=Number.MIN_VALUE,w=0;i>w;++w)for(var x=0;o>x;++x)S.computePosition(e,w,x,d,h),u[c++]=d.x,u[c++]=d.y,u[c++]=d.z,t.st&&(s[f++]=h.x,s[f++]=h.y,p=Math.min(p,h.x),y=Math.min(y,h.y),v=Math.max(v,h.x),g=Math.max(g,h.y));if(t.st&&(0>p||0>y||v>1||g>1))for(var E=0;E<s.length;E+=2)s[E]=(s[E]-p)/(v-p),s[E+1]=(s[E+1]-y)/(g-y);for(var O=b(u,t,r,e.tangentRotationMatrix),T=6*(o-1)*(i-1),M=m.createTypedArray(n,T),_=0,P=0,N=0;i-1>N;++N){for(var A=0;o-1>A;++A){var R=_,z=R+o,C=z+1,D=R+1;M[P++]=R,M[P++]=z,M[P++]=D,M[P++]=D,M[P++]=z,M[P++]=C,++_}++_}return O.indices=M,t.st&&(O.attributes.st=new l({componentDatatype:a.FLOAT,componentsPerAttribute:2,values:s})),O}function P(e,t,r,n,a){return e[t++]=n[r],e[t++]=n[r+1],e[t++]=n[r+2],e[t++]=a[r],e[t++]=a[r+1],e[t++]=a[r+2],e}function N(e,t,r,n){return e[t++]=n[r],e[t++]=n[r+1],e[t++]=n[r],e[t++]=n[r+1],e}function A(e){var t,n=e.vertexFormat,i=e.surfaceHeight,o=e.extrudedHeight,u=Math.min(o,i),s=Math.max(o,i),c=e.height,f=e.width,y=e.ellipsoid,v=_(e);if(p.equalsEpsilon(u,s,.1))return v;v=g.scaleToGeodeticHeight(v,s,y,!1);var w=new Float64Array(v.attributes.position.values),x=w.length,E=2*x,S=new Float64Array(E);S.set(w),v=g.scaleToGeodeticHeight(v,u,y);var O=v.attributes.position.values;S.set(O,x),v.attributes.position.values=S;var T,b=n.normal?new Float32Array(E):void 0,A=n.tangent?new Float32Array(E):void 0,I=n.binormal?new Float32Array(E):void 0,R=n.st?new Float32Array(2*(E/3)):void 0;if(n.normal){var z=v.attributes.normal.values;for(b.set(z),t=0;x>t;t++)z[t]=-z[t];b.set(z,x),v.attributes.normal.values=b}if(n.tangent){var C=v.attributes.tangent.values;for(A.set(C),t=0;x>t;t++)C[t]=-C[t];A.set(C,x),v.attributes.tangent.values=A}if(n.binormal){var D=v.attributes.binormal.values;I.set(D),I.set(D,x),v.attributes.binormal.values=I}n.st&&(T=v.attributes.st.values,R.set(T),R.set(T,2*(x/3)),v.attributes.st.values=R);var L=v.indices,q=L.length,U=x/3,W=m.createTypedArray(E/3,2*q);for(W.set(L),t=0;q>t;t+=3)W[t+q]=L[t+2]+U,W[t+1+q]=L[t+1]+U,W[t+2+q]=L[t]+U;v.indices=W;var G=2*f+2*c-4,k=2*(G+4),V=new Float64Array(3*k),Y=n.st?new Float32Array(2*k):void 0,j=0,H=0,X=f*c;for(t=0;X>t;t+=f)V=P(V,j,3*t,w,O),j+=6,n.st&&(Y=N(Y,H,2*t,T),H+=4);for(t=X-f;X>t;t++)V=P(V,j,3*t,w,O),j+=6,n.st&&(Y=N(Y,H,2*t,T),H+=4);for(t=X-1;t>0;t-=f)V=P(V,j,3*t,w,O),j+=6,n.st&&(Y=N(Y,H,2*t,T),H+=4);for(t=f-1;t>=0;t--)V=P(V,j,3*t,w,O),j+=6,n.st&&(Y=N(Y,H,2*t,T),H+=4);var Z=M(V,n,y);n.st&&(Z.attributes.st=new l({componentDatatype:a.FLOAT,componentsPerAttribute:2,values:Y}));var J,K,Q,$,et=m.createTypedArray(k,6*G);x=V.length/3;var tt=0;for(t=0;x-1>t;t+=2){J=t,$=(J+2)%x;var rt=r.fromArray(V,3*J,F),nt=r.fromArray(V,3*$,B);r.equalsEpsilon(rt,nt,p.EPSILON10)||(K=(J+1)%x,Q=(K+2)%x,et[tt++]=J,et[tt++]=K,et[tt++]=$,et[tt++]=$,et[tt++]=K,et[tt++]=Q)}return Z.indices=et,Z=h.combineInstances([new d({geometry:v}),new d({geometry:Z})]),Z[0]}var I=new r,R=new r,z=new r,C=new r,D=new E,L=new t,q=new e,U=new e,F=new r,B=new r,W=function(e){e=i(e,i.EMPTY_OBJECT);var t=e.rectangle,r=i(e.granularity,p.RADIANS_PER_DEGREE),n=i(e.ellipsoid,s.WGS84),a=i(e.height,0),u=i(e.rotation,0),c=i(e.stRotation,0),l=i(e.vertexFormat,O.DEFAULT),f=e.extrudedHeight,d=o(f)&&Math.abs(a-f)>1,h=i(e.closeTop,!0),m=i(e.closeBottom,!0);this._rectangle=t,this._granularity=r,this._ellipsoid=s.clone(n),this._surfaceHeight=a,this._rotation=u,this._stRotation=c,this._vertexFormat=O.clone(l),this._extrudedHeight=i(f,0),this._extrude=d,this._closeTop=h,this._closeBottom=m,this._workerName="createRectangleGeometry"};W.packedLength=E.packedLength+s.packedLength+O.packedLength+8,W.pack=function(e,t,r){r=i(r,0),E.pack(e._rectangle,t,r),r+=E.packedLength,s.pack(e._ellipsoid,t,r),r+=s.packedLength,O.pack(e._vertexFormat,t,r),r+=O.packedLength,t[r++]=e._granularity,t[r++]=e._surfaceHeight,t[r++]=e._rotation,t[r++]=e._stRotation,t[r++]=e._extrudedHeight,t[r++]=e._extrude?1:0,t[r++]=e._closeTop?1:0,t[r]=e._closeBottom?1:0};var G=new E,k=s.clone(s.UNIT_SPHERE),V=new O,Y={rectangle:G,ellipsoid:k,vertexFormat:V,granularity:void 0,height:void 0,rotation:void 0,stRotation:void 0,extrudedHeight:void 0,closeTop:void 0,closeBottom:void 0};W.unpack=function(e,t,r){t=i(t,0);var n=E.unpack(e,t,G);t+=E.packedLength;var a=s.unpack(e,t,k);t+=s.packedLength;var u=O.unpack(e,t,V);t+=O.packedLength;var c=e[t++],l=e[t++],f=e[t++],d=e[t++],h=e[t++],m=1===e[t++],p=1===e[t++],y=1===e[t];return o(r)?(r._rectangle=E.clone(n,r._rectangle),r._ellipsoid=s.clone(a,r._ellipsoid),r._vertexFormat=O.clone(u,r._vertexFormat),r._granularity=c,r._surfaceHeight=l,r._rotation=f,r._stRotation=d,r._extrudedHeight=m?h:void 0,r._extrude=m,r._closeTop=p,r._closeBottom=y,r):(Y.granularity=c,Y.height=l,Y.rotation=f,Y.stRotation=d,Y.extrudedHeight=m?h:void 0,Y.closeTop=p,Y.closeBottom=y,new W(Y))};var j=new y,H=new v,X=new n,Z=new x,J=new n;return W.createGeometry=function(t){var n=E.clone(t._rectangle,D),a=t._ellipsoid,i=t._surfaceHeight,u=t._extrude,s=t._extrudedHeight,l=t._stRotation,d=t._vertexFormat,h=S.computeOptions(t,n,X),m=j,p=H;if(o(l)){y.fromRotation(-l,m);var w=E.center(n,J),O=a.cartographicToCartesian(w,F);r.normalize(O,O),x.fromAxisAngle(O,-l,Z),v.fromQuaternion(Z,p)}else y.clone(y.IDENTITY,m),v.clone(v.IDENTITY,p);h.lonScalar=1/n.width,h.latScalar=1/n.height,h.vertexFormat=d,h.textureMatrix=m,h.tangentRotationMatrix=p,h.size=h.width*h.height;var T,b;if(n=t._rectangle,u){T=A(h);var M=e.fromRectangle3D(n,a,i,U),P=e.fromRectangle3D(n,a,s,q);b=e.union(M,P)}else T=_(h),T=g.scaleToGeodeticHeight(T,i,a,!1),b=e.fromRectangle3D(n,a,i);return d.position||delete T.attributes.position,new c({attributes:new f(T.attributes),indices:T.indices,primitiveType:T.primitiveType,boundingSphere:b})},W}),define("Workers/createRectangleGeometry",["../Core/defined","../Core/Ellipsoid","../Core/Rectangle","../Core/RectangleGeometry"],function(e,t,r,n){"use strict";function a(a,i){return e(i)&&(a=n.unpack(a,i)),a._ellipsoid=t.clone(a._ellipsoid),a._rectangle=r.clone(a._rectangle),n.createGeometry(a)}return a})}();