text: /**
   * Cesium - https://github.com/AnalyticalGraphicsInc/cesium
   *
   * Copyright 2011-2015 Cesium Contributors
   *
   * Licensed under the Apache License, Version 2.0 (the "License");
   * you may not use this file except in compliance with the License.
   * You may obtain a copy of the License at
   *
   * http://www.apache.org/licenses/LICENSE-2.0
   *
   * Unless required by applicable law or agreed to in writing, software
   * distributed under the License is distributed on an "AS IS" BASIS,
   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   * See the License for the specific language governing permissions and
   * limitations under the License.
   *
   * Columbus View (Pat. Pend.)
   *
   * Portions licensed separately.
   * See https://github.com/AnalyticalGraphicsInc/cesium/blob/master/LICENSE.md for full licensing details.
   */
  /**
  @license
  mersenne-twister.js - https://gist.github.com/banksean/300494
  
     Copyright (C) 1997 - 2002, Makoto Matsumoto and Takuji Nishimura,
     All rights reserved.
  
     Redistribution and use in source and binary forms, with or without
     modification, are permitted provided that the following conditions
     are met:
  
       1. Redistributions of source code must retain the above copyright
          notice, this list of conditions and the following disclaimer.
  
       2. Redistributions in binary form must reproduce the above copyright
          notice, this list of conditions and the following disclaimer in the
          documentation and/or other materials provided with the distribution.
  
       3. The names of its contributors may not be used to endorse or promote
          products derived from this software without specific prior written
          permission.
  
     THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
     "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
     LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
     A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT OWNER OR
     CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
     EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
     PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
     PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
     LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
     NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
     SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
  
  /**
    @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 r=Object.freeze;return e(r)||(r=function(e){return e}),r}),define("Core/defaultValue",["./freezeObject"],function(e){"use strict";var r=function(e,r){return void 0!==e?e:r};return r.EMPTY_OBJECT=e({}),r}),define("Core/DeveloperError",["./defined"],function(e){"use strict";var r=function(e){this.name="DeveloperError",this.message=e;var r;try{throw new Error}catch(t){r=t.stack}this.stack=r};return r.prototype.toString=function(){var r=this.name+": "+this.message;return e(this.stack)&&(r+="\n"+this.stack.toString()),r},r.throwInstantiationError=function(){throw new r("This function defines an interface and should not be called directly.")},r}),define("ThirdParty/mersenne-twister",[],function(){var e=function(e){void 0==e&&(e=(new Date).getTime()),this.N=624,this.M=397,this.MATRIX_A=2567483615,this.UPPER_MASK=2147483648,this.LOWER_MASK=2147483647,this.mt=new Array(this.N),this.mti=this.N+1,this.init_genrand(e)};return e.prototype.init_genrand=function(e){for(this.mt[0]=e>>>0,this.mti=1;this.mti<this.N;this.mti++){var e=this.mt[this.mti-1]^this.mt[this.mti-1]>>>30;this.mt[this.mti]=(1812433253*((4294901760&e)>>>16)<<16)+1812433253*(65535&e)+this.mti,this.mt[this.mti]>>>=0}},e.prototype.genrand_int32=function(){var e,r=new Array(0,this.MATRIX_A);if(this.mti>=this.N){var t;for(this.mti==this.N+1&&this.init_genrand(5489),t=0;t<this.N-this.M;t++)e=this.mt[t]&this.UPPER_MASK|this.mt[t+1]&this.LOWER_MASK,this.mt[t]=this.mt[t+this.M]^e>>>1^r[1&e];for(;t<this.N-1;t++)e=this.mt[t]&this.UPPER_MASK|this.mt[t+1]&this.LOWER_MASK,this.mt[t]=this.mt[t+(this.M-this.N)]^e>>>1^r[1&e];e=this.mt[this.N-1]&this.UPPER_MASK|this.mt[0]&this.LOWER_MASK,this.mt[this.N-1]=this.mt[this.M-1]^e>>>1^r[1&e],this.mti=0}return e=this.mt[this.mti++],e^=e>>>11,e^=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,r,t,n){"use strict";var i={};i.EPSILON1=.1,i.EPSILON2=.01,i.EPSILON3=.001,i.EPSILON4=1e-4,i.EPSILON5=1e-5,i.EPSILON6=1e-6,i.EPSILON7=1e-7,i.EPSILON8=1e-8,i.EPSILON9=1e-9,i.EPSILON10=1e-10,i.EPSILON11=1e-11,i.EPSILON12=1e-12,i.EPSILON13=1e-13,i.EPSILON14=1e-14,i.EPSILON15=1e-15,i.EPSILON16=1e-16,i.EPSILON17=1e-17,i.EPSILON18=1e-18,i.EPSILON19=1e-19,i.EPSILON20=1e-20,i.GRAVITATIONALPARAMETER=3986004418e5,i.SOLAR_RADIUS=6955e5,i.LUNAR_RADIUS=1737400,i.SIXTY_FOUR_KILOBYTES=65536,i.sign=function(e){return e>0?1:0>e?-1:0},i.signNotZero=function(e){return 0>e?-1:1},i.toSNorm=function(e){return Math.round(255*(.5*i.clamp(e,-1,1)+.5))},i.fromSNorm=function(e){return 2*(i.clamp(e,0,255)/255)-1},i.sinh=function(e){var r=Math.pow(Math.E,e),t=Math.pow(Math.E,-1*e);return.5*(r-t)},i.cosh=function(e){var r=Math.pow(Math.E,e),t=Math.pow(Math.E,-1*e);return.5*(r+t)},i.lerp=function(e,r,t){return(1-t)*e+t*r},i.PI=Math.PI,i.ONE_OVER_PI=1/Math.PI,i.PI_OVER_TWO=.5*Math.PI,i.PI_OVER_THREE=Math.PI/3,i.PI_OVER_FOUR=Math.PI/4,i.PI_OVER_SIX=Math.PI/6,i.THREE_PI_OVER_TWO=.5*3*Math.PI,i.TWO_PI=2*Math.PI,i.ONE_OVER_TWO_PI=1/(2*Math.PI),i.RADIANS_PER_DEGREE=Math.PI/180,i.DEGREES_PER_RADIAN=180/Math.PI,i.RADIANS_PER_ARCSECOND=i.RADIANS_PER_DEGREE/3600,i.toRadians=function(e){if(!t(e))throw new n("degrees is required.");return e*i.RADIANS_PER_DEGREE},i.toDegrees=function(e){if(!t(e))throw new n("radians is required.");return e*i.DEGREES_PER_RADIAN},i.convertLongitudeRange=function(e){if(!t(e))throw new n("angle is required.");var r=i.TWO_PI,a=e-Math.floor(e/r)*r;return a<-Math.PI?a+r:a>=Math.PI?a-r:a},i.negativePiToPi=function(e){if(!t(e))throw new n("x is required.");return i.zeroToTwoPi(e+i.PI)-i.PI},i.zeroToTwoPi=function(e){if(!t(e))throw new n("x is required.");var r=i.mod(e,i.TWO_PI);return Math.abs(r)<i.EPSILON14&&Math.abs(e)>i.EPSILON14?i.TWO_PI:r},i.mod=function(e,r){if(!t(e))throw new n("m is required.");if(!t(r))throw new n("n is required.");return(e%r+r)%r},i.equalsEpsilon=function(e,i,a,o){if(!t(e))throw new n("left is required.");if(!t(i))throw new n("right is required.");if(!t(a))throw new n("relativeEpsilon is required.");o=r(o,a);var u=Math.abs(e-i);return o>=u||u<=a*Math.max(Math.abs(e),Math.abs(i))};var a=[1];i.factorial=function(e){if("number"!=typeof e||0>e)throw new n("A number greater than or equal to 0 is required.");var r=a.length;if(e>=r)for(var t=a[r-1],i=r;e>=i;i++)a.push(t*i);return a[e]},i.incrementWrap=function(e,i,a){if(a=r(a,0),!t(e))throw new n("n is required.");if(a>=i)throw new n("maximumValue must be greater than minimumValue.");return++e,e>i&&(e=a),e},i.isPowerOfTwo=function(e){if("number"!=typeof e||0>e)throw new n("A number greater than or equal to 0 is required.");return 0!==e&&0===(e&e-1)},i.nextPowerOfTwo=function(e){if("number"!=typeof e||0>e)throw new n("A number greater than or equal to 0 is required.");return--e,e|=e>>1,e|=e>>2,e|=e>>4,e|=e>>8,e|=e>>16,++e,e},i.clamp=function(e,r,i){if(!t(e))throw new n("value is required");if(!t(r))throw new n("min is required.");if(!t(i))throw new n("max is required.");return r>e?r:e>i?i:e};var o=new e;return i.setRandomNumberSeed=function(r){if(!t(r))throw new n("seed is required.");o=new e(r)},i.nextRandomNumber=function(){return o.random()},i.acosClamped=function(e){if(!t(e))throw new n("value is required.");return Math.acos(i.clamp(e,-1,1))},i.asinClamped=function(e){if(!t(e))throw new n("value is required.");return Math.asin(i.clamp(e,-1,1))},i.chordLength=function(e,r){if(!t(e))throw new n("angle is required.");if(!t(r))throw new n("radius is required.");return 2*r*Math.sin(.5*e)},i}),define("Core/Cartesian3",["./defaultValue","./defined","./DeveloperError","./freezeObject","./Math"],function(e,r,t,n,i){"use strict";var a=function(r,t,n){this.x=e(r,0),this.y=e(t,0),this.z=e(n,0)};a.fromSpherical=function(n,i){if(!r(n))throw new t("spherical is required");r(i)||(i=new a);var o=n.clock,u=n.cone,s=e(n.magnitude,1),l=s*Math.sin(u);return i.x=l*Math.cos(o),i.y=l*Math.sin(o),i.z=s*Math.cos(u),i},a.fromElements=function(e,t,n,i){return r(i)?(i.x=e,i.y=t,i.z=n,i):new a(e,t,n)},a.clone=function(e,t){return r(e)?r(t)?(t.x=e.x,t.y=e.y,t.z=e.z,t):new a(e.x,e.y,e.z):void 0},a.fromCartesian4=a.clone,a.packedLength=3,a.pack=function(n,i,a){if(!r(n))throw new t("value is required");if(!r(i))throw new t("array is required");a=e(a,0),i[a++]=n.x,i[a++]=n.y,i[a]=n.z},a.unpack=function(n,i,o){if(!r(n))throw new t("array is required");return i=e(i,0),r(o)||(o=new a),o.x=n[i++],o.y=n[i++],o.z=n[i],o},a.fromArray=a.unpack,a.maximumComponent=function(e){if(!r(e))throw new t("cartesian is required");return Math.max(e.x,e.y,e.z)},a.minimumComponent=function(e){if(!r(e))throw new t("cartesian is required");return Math.min(e.x,e.y,e.z)},a.minimumByComponent=function(e,n,i){if(!r(e))throw new t("first is required.");if(!r(n))throw new t("second is required.");if(!r(i))throw new t("result is required.");return i.x=Math.min(e.x,n.x),i.y=Math.min(e.y,n.y),i.z=Math.min(e.z,n.z),i},a.maximumByComponent=function(e,n,i){if(!r(e))throw new t("first is required.");if(!r(n))throw new t("second is required.");if(!r(i))throw new t("result is required.");return i.x=Math.max(e.x,n.x),i.y=Math.max(e.y,n.y),i.z=Math.max(e.z,n.z),i},a.magnitudeSquared=function(e){if(!r(e))throw new t("cartesian is required");return e.x*e.x+e.y*e.y+e.z*e.z},a.magnitude=function(e){return Math.sqrt(a.magnitudeSquared(e))};var o=new a;a.distance=function(e,n){if(!r(e)||!r(n))throw new t("left and right are required.");return a.subtract(e,n,o),a.magnitude(o)},a.distanceSquared=function(e,n){if(!r(e)||!r(n))throw new t("left and right are required.");return a.subtract(e,n,o),a.magnitudeSquared(o)},a.normalize=function(e,n){if(!r(e))throw new t("cartesian is required");if(!r(n))throw new t("result is required");var i=a.magnitude(e);return n.x=e.x/i,n.y=e.y/i,n.z=e.z/i,n},a.dot=function(e,n){if(!r(e))throw new t("left is required");if(!r(n))throw new t("right is required");return e.x*n.x+e.y*n.y+e.z*n.z},a.multiplyComponents=function(e,n,i){if(!r(e))throw new t("left is required");if(!r(n))throw new t("right is required");if(!r(i))throw new t("result is required");return i.x=e.x*n.x,i.y=e.y*n.y,i.z=e.z*n.z,i},a.add=function(e,n,i){if(!r(e))throw new t("left is required");if(!r(n))throw new t("right is required");if(!r(i))throw new t("result is required");return i.x=e.x+n.x,i.y=e.y+n.y,i.z=e.z+n.z,i},a.subtract=function(e,n,i){if(!r(e))throw new t("left is required");if(!r(n))throw new t("right is required");if(!r(i))throw new t("result is required");return i.x=e.x-n.x,i.y=e.y-n.y,i.z=e.z-n.z,i},a.multiplyByScalar=function(e,n,i){if(!r(e))throw new t("cartesian is required");if("number"!=typeof n)throw new t("scalar is required and must be a number.");if(!r(i))throw new t("result is required");return i.x=e.x*n,i.y=e.y*n,i.z=e.z*n,i},a.divideByScalar=function(e,n,i){if(!r(e))throw new t("cartesian is required");if("number"!=typeof n)throw new t("scalar is required and must be a number.");if(!r(i))throw new t("result is required");return i.x=e.x/n,i.y=e.y/n,i.z=e.z/n,i},a.negate=function(e,n){if(!r(e))throw new t("cartesian is required");if(!r(n))throw new t("result is required");return n.x=-e.x,n.y=-e.y,n.z=-e.z,n},a.abs=function(e,n){if(!r(e))throw new t("cartesian is required");if(!r(n))throw new t("result is required");return n.x=Math.abs(e.x),n.y=Math.abs(e.y),n.z=Math.abs(e.z),n};var u=new a;a.lerp=function(e,n,i,o){if(!r(e))throw new t("start is required.");if(!r(n))throw new t("end is required.");if("number"!=typeof i)throw new t("t is required and must be a number.");if(!r(o))throw new t("result is required.");return a.multiplyByScalar(n,i,u),o=a.multiplyByScalar(e,1-i,o),a.add(u,o,o)};var s=new a,l=new a;a.angleBetween=function(e,n){if(!r(e))throw new t("left is required");if(!r(n))throw new t("right is required");a.normalize(e,s),a.normalize(n,l);var i=a.dot(s,l),o=a.magnitude(a.cross(s,l,s));return Math.atan2(o,i)};var c=new a;a.mostOrthogonalAxis=function(e,n){if(!r(e))throw new t("cartesian is required.");if(!r(n))throw new t("result is required.");var i=a.normalize(e,c);return a.abs(i,i),n=i.x<=i.y?i.x<=i.z?a.clone(a.UNIT_X,n):a.clone(a.UNIT_Z,n):i.y<=i.z?a.clone(a.UNIT_Y,n):a.clone(a.UNIT_Z,n)},a.equals=function(e,t){return e===t||r(e)&&r(t)&&e.x===t.x&&e.y===t.y&&e.z===t.z},a.equalsArray=function(e,r,t){return e.x===r[t]&&e.y===r[t+1]&&e.z===r[t+2]},a.equalsEpsilon=function(e,t,n,a){return e===t||r(e)&&r(t)&&i.equalsEpsilon(e.x,t.x,n,a)&&i.equalsEpsilon(e.y,t.y,n,a)&&i.equalsEpsilon(e.z,t.z,n,a)},a.cross=function(e,n,i){if(!r(e))throw new t("left is required");if(!r(n))throw new t("right is required");if(!r(i))throw new t("result is required");var a=e.x,o=e.y,u=e.z,s=n.x,l=n.y,c=n.z,f=o*c-u*l,d=u*s-a*c,h=a*l-o*s;return i.x=f,i.y=d,i.z=h,i},a.fromDegrees=function(e,n,o,u,s){if(!r(e))throw new t("longitude is required");if(!r(n))throw new t("latitude is required");var l=i.toRadians(e),c=i.toRadians(n);return a.fromRadians(l,c,o,u,s)};var f=new a,d=new a,h=new a(40680631590769,40680631590769,40408299984661.445);return a.fromRadians=function(n,i,o,u,s){if(!r(n))throw new t("longitude is required");if(!r(i))throw new t("latitude is required");o=e(o,0);var l=r(u)?u.radiiSquared:h,c=Math.cos(i);f.x=c*Math.cos(n),f.y=c*Math.sin(n),f.z=Math.sin(i),f=a.normalize(f,f),a.multiplyComponents(l,f,d);var w=Math.sqrt(a.dot(f,d));return d=a.divideByScalar(d,w,d),f=a.multiplyByScalar(f,o,f),r(s)||(s=new a),a.add(d,f,s)},a.fromDegreesArray=function(e,n,o){if(!r(e))throw new t("positions is required.");for(var u=new Array(e.length),s=0;s<e.length;s++)u[s]=i.toRadians(e[s]);return a.fromRadiansArray(u,n,o)},a.fromRadiansArray=function(e,n,i){if(!r(e))throw new t("positions is required.");if(e.length<2)throw new t("positions length cannot be less than 2.");if(0!==e.length%2)throw new t("positions length must be a multiple of 2.");var o=e.length;r(i)?i.length=o/2:i=new Array(o/2);for(var u=0;o>u;u+=2){var s=e[u],l=e[u+1];i[u/2]=a.fromRadians(s,l,0,n,i[u/2])}return i},a.fromDegreesArrayHeights=function(e,n,o){if(!r(e))throw new t("positions is required.");if(e.length<3)throw new t("positions length cannot be less than 3.");if(0!==e.length%3)throw new t("positions length must be a multiple of 3.");for(var u=new Array(e.length),s=0;s<e.length;s+=3)u[s]=i.toRadians(e[s]),u[s+1]=i.toRadians(e[s+1]),u[s+2]=e[s+2];return a.fromRadiansArrayHeights(u,n,o)},a.fromRadiansArrayHeights=function(e,n,i){if(!r(e))throw new t("positions is required.");if(e.length<3)throw new t("positions length cannot be less than 3.");if(0!==e.length%3)throw new t("positions length must be a multiple of 3.");var o=e.length;r(i)?i.length=o/3:i=new Array(o/3);for(var u=0;o>u;u+=3){var s=e[u],l=e[u+1],c=e[u+2];i[u/3]=a.fromRadians(s,l,c,n,i[u/3])}return i},a.ZERO=n(new a(0,0,0)),a.UNIT_X=n(new a(1,0,0)),a.UNIT_Y=n(new a(0,1,0)),a.UNIT_Z=n(new a(0,0,1)),a.prototype.clone=function(e){return a.clone(this,e)},a.prototype.equals=function(e){return a.equals(this,e)},a.prototype.equalsEpsilon=function(e,r,t){return a.equalsEpsilon(this,e,r,t)},a.prototype.toString=function(){return"("+this.x+", "+this.y+", "+this.z+")"},a}),define("Core/Cartographic",["./defaultValue","./defined","./DeveloperError","./freezeObject","./Math"],function(e,r,t,n,i){"use strict";var a=function(r,t,n){this.longitude=e(r,0),this.latitude=e(t,0),this.height=e(n,0)};return a.fromRadians=function(n,i,o,u){if(!r(n))throw new t("longitude is required.");if(!r(i))throw new t("latitude is required.");return o=e(o,0),r(u)?(u.longitude=n,u.latitude=i,u.height=o,u):new a(n,i,o)},a.fromDegrees=function(e,n,o,u){if(!r(e))throw new t("longitude is required.");if(!r(n))throw new t("latitude is required.");return e=i.toRadians(e),n=i.toRadians(n),a.fromRadians(e,n,o,u)},a.clone=function(e,t){return r(e)?r(t)?(t.longitude=e.longitude,t.latitude=e.latitude,t.height=e.height,t):new a(e.longitude,e.latitude,e.height):void 0},a.equals=function(e,t){return e===t||r(e)&&r(t)&&e.longitude===t.longitude&&e.latitude===t.latitude&&e.height===t.height},a.equalsEpsilon=function(e,n,i){if("number"!=typeof i)throw new t("epsilon is required and must be a number.");return e===n||r(e)&&r(n)&&Math.abs(e.longitude-n.longitude)<=i&&Math.abs(e.latitude-n.latitude)<=i&&Math.abs(e.height-n.height)<=i},a.ZERO=n(new a(0,0,0)),a.prototype.clone=function(e){return a.clone(this,e)},a.prototype.equals=function(e){return a.equals(this,e)},a.prototype.equalsEpsilon=function(e,r){return a.equalsEpsilon(this,e,r)},a.prototype.toString=function(){return"("+this.longitude+", "+this.latitude+", "+this.height+")"},a}),define("Core/defineProperties",["./defined"],function(e){"use strict";var r=function(){try{return"x"in Object.defineProperty({},"x",{})}catch(e){return!1}}(),t=Object.defineProperties;return r&&e(t)||(t=function(e){return e}),t}),define("Core/Ellipsoid",["./Cartesian3","./Cartographic","./defaultValue","./defined","./defineProperties","./DeveloperError","./freezeObject","./Math"],function(e,r,t,n,i,a,o,u){"use strict";function s(r,n,i,o){if(n=t(n,0),i=t(i,0),o=t(o,0),0>n||0>i||0>o)throw new a("All radii components must be greater than or equal to zero.");r._radii=new e(n,i,o),r._radiiSquared=new e(n*n,i*i,o*o),r._radiiToTheFourth=new e(n*n*n*n,i*i*i*i,o*o*o*o),r._oneOverRadii=new e(0===n?0:1/n,0===i?0:1/i,0===o?0:1/o),r._oneOverRadiiSquared=new e(0===n?0:1/(n*n),0===i?0:1/(i*i),0===o?0:1/(o*o)),r._minimumRadius=Math.min(n,i,o),r._maximumRadius=Math.max(n,i,o),r._centerToleranceSquared=u.EPSILON1}var l=function(e,r,t){this._radii=void 0,this._radiiSquared=void 0,this._radiiToTheFourth=void 0,this._oneOverRadii=void 0,this._oneOverRadiiSquared=void 0,this._minimumRadius=void 0,this._maximumRadius=void 0,this._centerToleranceSquared=void 0,s(this,e,r,t)};i(l.prototype,{radii:{get:function(){return this._radii}},radiiSquared:{get:function(){return this._radiiSquared}},radiiToTheFourth:{get:function(){return this._radiiToTheFourth}},oneOverRadii:{get:function(){return this._oneOverRadii}},oneOverRadiiSquared:{get:function(){return this._oneOverRadiiSquared}},minimumRadius:{get:function(){return this._minimumRadius}},maximumRadius:{get:function(){return this._maximumRadius}}}),l.clone=function(r,t){if(!n(r))return void 0;var i=r._radii;return n(t)?(e.clone(i,t._radii),e.clone(r._radiiSquared,t._radiiSquared),e.clone(r._radiiToTheFourth,t._radiiToTheFourth),e.clone(r._oneOverRadii,t._oneOverRadii),e.clone(r._oneOverRadiiSquared,t._oneOverRadiiSquared),t._minimumRadius=r._minimumRadius,t._maximumRadius=r._maximumRadius,t._centerToleranceSquared=r._centerToleranceSquared,t):new l(i.x,i.y,i.z)},l.fromCartesian3=function(e,r){return n(r)||(r=new l),n(e)?(s(r,e.x,e.y,e.z),r):r},l.WGS84=o(new l(6378137,6378137,6356752.314245179)),l.UNIT_SPHERE=o(new l(1,1,1)),l.MOON=o(new l(u.LUNAR_RADIUS,u.LUNAR_RADIUS,u.LUNAR_RADIUS)),l.prototype.clone=function(e){return l.clone(this,e)},l.packedLength=e.packedLength,l.pack=function(r,i,o){if(!n(r))throw new a("value is required");if(!n(i))throw new a("array is required");o=t(o,0),e.pack(r._radii,i,o)},l.unpack=function(r,i,o){if(!n(r))throw new a("array is required");i=t(i,0);var u=e.unpack(r,i);return l.fromCartesian3(u,o)},l.prototype.geocentricSurfaceNormal=e.normalize,l.prototype.geodeticSurfaceNormalCartographic=function(r,t){if(!n(r))throw new a("cartographic is required.");var i=r.longitude,o=r.latitude,u=Math.cos(o),s=u*Math.cos(i),l=u*Math.sin(i),c=Math.sin(o);return n(t)||(t=new e),t.x=s,t.y=l,t.z=c,e.normalize(t,t)},l.prototype.geodeticSurfaceNormal=function(r,t){return n(t)||(t=new e),t=e.multiplyComponents(r,this._oneOverRadiiSquared,t),e.normalize(t,t)};var c=new e,f=new e;l.prototype.cartographicToCartesian=function(r,t){var i=c,a=f;this.geodeticSurfaceNormalCartographic(r,i),e.multiplyComponents(this._radiiSquared,i,a);var o=Math.sqrt(e.dot(i,a));return e.divideByScalar(a,o,a),e.multiplyByScalar(i,r.height,i),n(t)||(t=new e),e.add(a,i,t)},l.prototype.cartographicArrayToCartesianArray=function(e,r){if(!n(e))throw new a("cartographics is required.");var t=e.length;n(r)?r.length=t:r=new Array(t);for(var i=0;t>i;i++)r[i]=this.cartographicToCartesian(e[i],r[i]);return r};var d=new e,h=new e,w=new e;l.prototype.cartesianToCartographic=function(t,i){var a=this.scaleToGeodeticSurface(t,h);if(!n(a))return void 0;var o=this.geodeticSurfaceNormal(a,d),s=e.subtract(t,a,w),l=Math.atan2(o.y,o.x),c=Math.asin(o.z),f=u.sign(e.dot(s,t))*e.magnitude(s);return n(i)?(i.longitude=l,i.latitude=c,i.height=f,i):new r(l,c,f)},l.prototype.cartesianArrayToCartographicArray=function(e,r){if(!n(e))throw new a("cartesians is required.");var t=e.length;n(r)?r.length=t:r=new Array(t);for(var i=0;t>i;++i)r[i]=this.cartesianToCartographic(e[i],r[i]);return r};var m=new e,p=new e;return l.prototype.scaleToGeodeticSurface=function(r,t){if(!n(r))throw new a("cartesian is required.");var i=r.x,o=r.y,s=r.z,l=this._oneOverRadii,c=l.x,f=l.y,d=l.z,h=i*i*c*c,w=o*o*f*f,y=s*s*d*d,v=h+w+y,g=Math.sqrt(1/v),q=e.multiplyByScalar(r,g,m);if(v<this._centerToleranceSquared)return isFinite(g)?e.clone(q,t):void 0;var x=this._oneOverRadiiSquared,E=x.x,b=x.y,S=x.z,_=p;_.x=2*q.x*E,_.y=2*q.y*b,_.z=2*q.z*S;var M,O,T,P,A,R,N,z,I,C,D,U=(1-g)*e.magnitude(r)/(.5*e.magnitude(_)),L=0;do{U-=L,T=1/(1+U*E),P=1/(1+U*b),A=1/(1+U*S),R=T*T,N=P*P,z=A*A,I=R*T,C=N*P,D=z*A,M=h*R+w*N+y*z-1,O=h*I*E+w*C*b+y*D*S;var B=-2*O;L=M/B}while(Math.abs(M)>u.EPSILON12);return n(t)?(t.x=i*T,t.y=o*P,t.z=s*A,t):new e(i*T,o*P,s*A)},l.prototype.scaleToGeocentricSurface=function(r,t){if(!n(r))throw new a("cartesian is required.");n(t)||(t=new e);var i=r.x,o=r.y,u=r.z,s=this._oneOverRadiiSquared,l=1/Math.sqrt(i*i*s.x+o*o*s.y+u*u*s.z);return e.multiplyByScalar(r,l,t)},l.prototype.transformPositionToScaledSpace=function(r,t){return n(t)||(t=new e),e.multiplyComponents(r,this._oneOverRadii,t)},l.prototype.transformPositionFromScaledSpace=function(r,t){return n(t)||(t=new e),e.multiplyComponents(r,this._radii,t)},l.prototype.equals=function(r){return this===r||n(r)&&e.equals(this._radii,r._radii)},l.prototype.toString=function(){return this._radii.toString()},l}),define("Core/GeographicProjection",["./Cartesian3","./Cartographic","./defaultValue","./defined","./defineProperties","./DeveloperError","./Ellipsoid"],function(e,r,t,n,i,a,o){"use strict";var u=function(e){this._ellipsoid=t(e,o.WGS84),this._semimajorAxis=this._ellipsoid.maximumRadius,this._oneOverSemimajorAxis=1/this._semimajorAxis};return i(u.prototype,{ellipsoid:{get:function(){return this._ellipsoid}}}),u.prototype.project=function(r,t){var i=this._semimajorAxis,a=r.longitude*i,o=r.latitude*i,u=r.height;return n(t)?(t.x=a,t.y=o,t.z=u,t):new e(a,o,u)},u.prototype.unproject=function(e,t){if(!n(e))throw new a("cartesian is required");var i=this._oneOverSemimajorAxis,o=e.x*i,u=e.y*i,s=e.z;return n(t)?(t.longitude=o,t.latitude=u,t.height=s,t):new r(o,u,s)},u}),define("Core/Intersect",["./freezeObject"],function(e){"use strict";var r={OUTSIDE:-1,INTERSECTING:0,INSIDE:1};return e(r)}),define("Core/Interval",["./defaultValue"],function(e){"use strict";var r=function(r,t){this.start=e(r,0),this.stop=e(t,0)};return r}),define("Core/Cartesian4",["./defaultValue","./defined","./DeveloperError","./freezeObject","./Math"],function(e,r,t,n,i){"use strict";var a=function(r,t,n,i){this.x=e(r,0),this.y=e(t,0),this.z=e(n,0),this.w=e(i,0)};a.fromElements=function(e,t,n,i,o){return r(o)?(o.x=e,o.y=t,o.z=n,o.w=i,o):new a(e,t,n,i)},a.fromColor=function(e,n){if(!r(e))throw new t("color is required");return r(n)?(n.x=e.red,n.y=e.green,n.z=e.blue,n.w=e.alpha,n):new a(e.red,e.green,e.blue,e.alpha)},a.clone=function(e,t){return r(e)?r(t)?(t.x=e.x,t.y=e.y,t.z=e.z,t.w=e.w,t):new a(e.x,e.y,e.z,e.w):void 0},a.packedLength=4,a.pack=function(n,i,a){if(!r(n))throw new t("value is required");if(!r(i))throw new t("array is required");a=e(a,0),i[a++]=n.x,i[a++]=n.y,i[a++]=n.z,i[a]=n.w},a.unpack=function(n,i,o){if(!r(n))throw new t("array is required");return i=e(i,0),r(o)||(o=new a),o.x=n[i++],o.y=n[i++],o.z=n[i++],o.w=n[i],o},a.fromArray=a.unpack,a.maximumComponent=function(e){if(!r(e))throw new t("cartesian is required");return Math.max(e.x,e.y,e.z,e.w)},a.minimumComponent=function(e){if(!r(e))throw new t("cartesian is required");return Math.min(e.x,e.y,e.z,e.w)},a.minimumByComponent=function(e,n,i){if(!r(e))throw new t("first is required.");if(!r(n))throw new t("second is required.");if(!r(i))throw new t("result is required.");return i.x=Math.min(e.x,n.x),i.y=Math.min(e.y,n.y),i.z=Math.min(e.z,n.z),i.w=Math.min(e.w,n.w),i},a.maximumByComponent=function(e,n,i){if(!r(e))throw new t("first is required.");if(!r(n))throw new t("second is required.");if(!r(i))throw new t("result is required.");return i.x=Math.max(e.x,n.x),i.y=Math.max(e.y,n.y),i.z=Math.max(e.z,n.z),i.w=Math.max(e.w,n.w),i},a.magnitudeSquared=function(e){if(!r(e))throw new t("cartesian is required");return e.x*e.x+e.y*e.y+e.z*e.z+e.w*e.w},a.magnitude=function(e){return Math.sqrt(a.magnitudeSquared(e))};var o=new a;a.distance=function(e,n){if(!r(e)||!r(n))throw new t("left and right are required.");return a.subtract(e,n,o),a.magnitude(o)},a.distanceSquared=function(e,n){if(!r(e)||!r(n))throw new t("left and right are required.");return a.subtract(e,n,o),a.magnitudeSquared(o)},a.normalize=function(e,n){if(!r(e))throw new t("cartesian is required");if(!r(n))throw new t("result is required");var i=a.magnitude(e);return n.x=e.x/i,n.y=e.y/i,n.z=e.z/i,n.w=e.w/i,n},a.dot=function(e,n){if(!r(e))throw new t("left is required");if(!r(n))throw new t("right is required");return e.x*n.x+e.y*n.y+e.z*n.z+e.w*n.w},a.multiplyComponents=function(e,n,i){if(!r(e))throw new t("left is required");if(!r(n))throw new t("right is required");if(!r(i))throw new t("result is required");return i.x=e.x*n.x,i.y=e.y*n.y,i.z=e.z*n.z,i.w=e.w*n.w,i},a.add=function(e,n,i){if(!r(e))throw new t("left is required");if(!r(n))throw new t("right is required");if(!r(i))throw new t("result is required");return i.x=e.x+n.x,i.y=e.y+n.y,i.z=e.z+n.z,i.w=e.w+n.w,i},a.subtract=function(e,n,i){if(!r(e))throw new t("left is required");if(!r(n))throw new t("right is required");if(!r(i))throw new t("result is required");return i.x=e.x-n.x,i.y=e.y-n.y,i.z=e.z-n.z,i.w=e.w-n.w,i},a.multiplyByScalar=function(e,n,i){if(!r(e))throw new t("cartesian is required");if("number"!=typeof n)throw new t("scalar is required and must be a number.");if(!r(i))throw new t("result is required");return i.x=e.x*n,i.y=e.y*n,i.z=e.z*n,i.w=e.w*n,i},a.divideByScalar=function(e,n,i){if(!r(e))throw new t("cartesian is required");if("number"!=typeof n)throw new t("scalar is required and must be a number.");if(!r(i))throw new t("result is required");return i.x=e.x/n,i.y=e.y/n,i.z=e.z/n,i.w=e.w/n,i},a.negate=function(e,n){if(!r(e))throw new t("cartesian is required");if(!r(n))throw new t("result is required");return n.x=-e.x,n.y=-e.y,n.z=-e.z,n.w=-e.w,n},a.abs=function(e,n){if(!r(e))throw new t("cartesian is required");if(!r(n))throw new t("result is required");return n.x=Math.abs(e.x),n.y=Math.abs(e.y),n.z=Math.abs(e.z),n.w=Math.abs(e.w),n};var u=new a;a.lerp=function(e,n,i,o){if(!r(e))throw new t("start is required.");if(!r(n))throw new t("end is required.");if("number"!=typeof i)throw new t("t is required and must be a number.");if(!r(o))throw new t("result is required.");return a.multiplyByScalar(n,i,u),o=a.multiplyByScalar(e,1-i,o),a.add(u,o,o)};var s=new a;return a.mostOrthogonalAxis=function(e,n){if(!r(e))throw new t("cartesian is required.");if(!r(n))throw new t("result is required.");var i=a.normalize(e,s);return a.abs(i,i),n=i.x<=i.y?i.x<=i.z?i.x<=i.w?a.clone(a.UNIT_X,n):a.clone(a.UNIT_W,n):i.z<=i.w?a.clone(a.UNIT_Z,n):a.clone(a.UNIT_W,n):i.y<=i.z?i.y<=i.w?a.clone(a.UNIT_Y,n):a.clone(a.UNIT_W,n):i.z<=i.w?a.clone(a.UNIT_Z,n):a.clone(a.UNIT_W,n)},a.equals=function(e,t){return e===t||r(e)&&r(t)&&e.x===t.x&&e.y===t.y&&e.z===t.z&&e.w===t.w},a.equalsArray=function(e,r,t){return e.x===r[t]&&e.y===r[t+1]&&e.z===r[t+2]&&e.w===r[t+3]},a.equalsEpsilon=function(e,t,n,a){return e===t||r(e)&&r(t)&&i.equalsEpsilon(e.x,t.x,n,a)&&i.equalsEpsilon(e.y,t.y,n,a)&&i.equalsEpsilon(e.z,t.z,n,a)&&i.equalsEpsilon(e.w,t.w,n,a)},a.ZERO=n(new a(0,0,0,0)),a.UNIT_X=n(new a(1,0,0,0)),a.UNIT_Y=n(new a(0,1,0,0)),a.UNIT_Z=n(new a(0,0,1,0)),a.UNIT_W=n(new a(0,0,0,1)),a.prototype.clone=function(e){return a.clone(this,e)},a.prototype.equals=function(e){return a.equals(this,e)},a.prototype.equalsEpsilon=function(e,r,t){return a.equalsEpsilon(this,e,r,t)},a.prototype.toString=function(){return"("+this.x+", "+this.y+", "+this.z+", "+this.w+")"},a}),define("Core/Matrix3",["./Cartesian3","./defaultValue","./defined","./DeveloperError","./freezeObject","./Math"],function(e,r,t,n,i,a){"use strict";function o(e){for(var r=0,t=0;9>t;++t){var n=e[t];r+=n*n}return Math.sqrt(r)}function u(e){for(var r=0,t=0;3>t;++t){var n=e[l.getElementIndex(h[t],d[t])];r+=2*n*n}return Math.sqrt(r)}function s(e,r){for(var t=a.EPSILON15,n=0,i=1,o=0;3>o;++o){var u=Math.abs(e[l.getElementIndex(h[o],d[o])]);u>n&&(i=o,n=u)}var s=1,c=0,f=d[i],w=h[i];if(Math.abs(e[l.getElementIndex(w,f)])>t){var m,p=e[l.getElementIndex(w,w)],y=e[l.getElementIndex(f,f)],v=e[l.getElementIndex(w,f)],g=(p-y)/2/v;m=0>g?-1/(-g+Math.sqrt(1+g*g)):1/(g+Math.sqrt(1+g*g)),s=1/Math.sqrt(1+m*m),c=m*s}return r=l.clone(l.IDENTITY,r),r[l.getElementIndex(f,f)]=r[l.getElementIndex(w,w)]=s,r[l.getElementIndex(w,f)]=c,r[l.getElementIndex(f,w)]=-c,r}var l=function(e,t,n,i,a,o,u,s,l){this[0]=r(e,0),this[1]=r(i,0),this[2]=r(u,0),this[3]=r(t,0),this[4]=r(a,0),this[5]=r(s,0),this[6]=r(n,0),this[7]=r(o,0),this[8]=r(l,0)};l.packedLength=9,l.pack=function(e,i,a){if(!t(e))throw new n("value is required");if(!t(i))throw new n("array is required");a=r(a,0),i[a++]=e[0],i[a++]=e[1],i[a++]=e[2],i[a++]=e[3],i[a++]=e[4],i[a++]=e[5],i[a++]=e[6],i[a++]=e[7],i[a++]=e[8]},l.unpack=function(e,i,a){if(!t(e))throw new n("array is required");return i=r(i,0),t(a)||(a=new l),a[0]=e[i++],a[1]=e[i++],a[2]=e[i++],a[3]=e[i++],a[4]=e[i++],a[5]=e[i++],a[6]=e[i++],a[7]=e[i++],a[8]=e[i++],a},l.clone=function(e,r){return t(e)?t(r)?(r[0]=e[0],r[1]=e[1],r[2]=e[2],r[3]=e[3],r[4]=e[4],r[5]=e[5],r[6]=e[6],r[7]=e[7],r[8]=e[8],r):new l(e[0],e[3],e[6],e[1],e[4],e[7],e[2],e[5],e[8]):void 0},l.fromArray=function(e,i,a){if(!t(e))throw new n("array is required");return i=r(i,0),t(a)||(a=new l),a[0]=e[i],a[1]=e[i+1],a[2]=e[i+2],a[3]=e[i+3],a[4]=e[i+4],a[5]=e[i+5],a[6]=e[i+6],a[7]=e[i+7],a[8]=e[i+8],a},l.fromColumnMajorArray=function(e,r){if(!t(e))throw new n("values parameter is required");return l.clone(e,r)},l.fromRowMajorArray=function(e,r){if(!t(e))throw new n("values is required.");return t(r)?(r[0]=e[0],r[1]=e[3],r[2]=e[6],r[3]=e[1],r[4]=e[4],r[5]=e[7],r[6]=e[2],r[7]=e[5],r[8]=e[8],r):new l(e[0],e[1],e[2],e[3],e[4],e[5],e[6],e[7],e[8])},l.fromQuaternion=function(e,r){if(!t(e))throw new n("quaternion is required");var i=e.x*e.x,a=e.x*e.y,o=e.x*e.z,u=e.x*e.w,s=e.y*e.y,c=e.y*e.z,f=e.y*e.w,d=e.z*e.z,h=e.z*e.w,w=e.w*e.w,m=i-s-d+w,p=2*(a-h),y=2*(o+f),v=2*(a+h),g=-i+s-d+w,q=2*(c-u),x=2*(o-f),E=2*(c+u),b=-i-s+d+w;return t(r)?(r[0]=m,r[1]=v,r[2]=x,r[3]=p,r[4]=g,r[5]=E,r[6]=y,r[7]=q,r[8]=b,r):new l(m,p,y,v,g,q,x,E,b)},l.fromScale=function(e,r){if(!t(e))throw new n("scale is required.");return t(r)?(r[0]=e.x,r[1]=0,r[2]=0,r[3]=0,r[4]=e.y,r[5]=0,r[6]=0,r[7]=0,r[8]=e.z,r):new l(e.x,0,0,0,e.y,0,0,0,e.z)},l.fromUniformScale=function(e,r){if("number"!=typeof e)throw new n("scale is required.");return t(r)?(r[0]=e,r[1]=0,r[2]=0,r[3]=0,r[4]=e,r[5]=0,r[6]=0,r[7]=0,r[8]=e,r):new l(e,0,0,0,e,0,0,0,e)},l.fromCrossProduct=function(e,r){if(!t(e))throw new n("vector is required.");return t(r)?(r[0]=0,r[1]=e.z,r[2]=-e.y,r[3]=-e.z,r[4]=0,r[5]=e.x,r[6]=e.y,r[7]=-e.x,r[8]=0,r):new l(0,-e.z,e.y,e.z,0,-e.x,-e.y,e.x,0)},l.fromRotationX=function(e,r){if(!t(e))throw new n("angle is required.");var i=Math.cos(e),a=Math.sin(e);return t(r)?(r[0]=1,r[1]=0,r[2]=0,r[3]=0,r[4]=i,r[5]=a,r[6]=0,r[7]=-a,r[8]=i,r):new l(1,0,0,0,i,-a,0,a,i)},l.fromRotationY=function(e,r){if(!t(e))throw new n("angle is required.");var i=Math.cos(e),a=Math.sin(e);return t(r)?(r[0]=i,r[1]=0,r[2]=-a,r[3]=0,r[4]=1,r[5]=0,r[6]=a,r[7]=0,r[8]=i,r):new l(i,0,a,0,1,0,-a,0,i)},l.fromRotationZ=function(e,r){if(!t(e))throw new n("angle is required.");var i=Math.cos(e),a=Math.sin(e);return t(r)?(r[0]=i,r[1]=a,r[2]=0,r[3]=-a,r[4]=i,r[5]=0,r[6]=0,r[7]=0,r[8]=1,r):new l(i,-a,0,a,i,0,0,0,1)},l.toArray=function(e,r){if(!t(e))throw new n("matrix is required");return t(r)?(r[0]=e[0],r[1]=e[1],r[2]=e[2],r[3]=e[3],r[4]=e[4],r[5]=e[5],r[6]=e[6],r[7]=e[7],r[8]=e[8],r):[e[0],e[1],e[2],e[3],e[4],e[5],e[6],e[7],e[8]]},l.getElementIndex=function(e,r){if("number"!=typeof r||0>r||r>2)throw new n("row must be 0, 1, or 2.");if("number"!=typeof e||0>e||e>2)throw new n("column must be 0, 1, or 2.");return 3*e+r},l.getColumn=function(e,r,i){if(!t(e))throw new n("matrix is required.");if("number"!=typeof r||0>r||r>2)throw new n("index must be 0, 1, or 2.");if(!t(i))throw new n("result is required");var a=3*r,o=e[a],u=e[a+1],s=e[a+2];return i.x=o,i.y=u,i.z=s,i},l.setColumn=function(e,r,i,a){if(!t(e))throw new n("matrix is required");if(!t(i))throw new n("cartesian is required");if("number"!=typeof r||0>r||r>2)throw new n("index must be 0, 1, or 2.");if(!t(a))throw new n("result is required");a=l.clone(e,a);var o=3*r;return a[o]=i.x,a[o+1]=i.y,a[o+2]=i.z,a},l.getRow=function(e,r,i){if(!t(e))throw new n("matrix is required.");if("number"!=typeof r||0>r||r>2)throw new n("index must be 0, 1, or 2.");if(!t(i))throw new n("result is required");var a=e[r],o=e[r+3],u=e[r+6];return i.x=a,i.y=o,i.z=u,i},l.setRow=function(e,r,i,a){if(!t(e))throw new n("matrix is required");if(!t(i))throw new n("cartesian is required");if("number"!=typeof r||0>r||r>2)throw new n("index must be 0, 1, or 2.");
  if(!t(a))throw new n("result is required");return a=l.clone(e,a),a[r]=i.x,a[r+3]=i.y,a[r+6]=i.z,a};var c=new e;l.getScale=function(r,i){if(!t(r))throw new n("matrix is required.");if(!t(i))throw new n("result is required");return i.x=e.magnitude(e.fromElements(r[0],r[1],r[2],c)),i.y=e.magnitude(e.fromElements(r[3],r[4],r[5],c)),i.z=e.magnitude(e.fromElements(r[6],r[7],r[8],c)),i};var f=new e;l.getMaximumScale=function(r){return l.getScale(r,f),e.maximumComponent(f)},l.multiply=function(e,r,i){if(!t(e))throw new n("left is required");if(!t(r))throw new n("right is required");if(!t(i))throw new n("result is required");var a=e[0]*r[0]+e[3]*r[1]+e[6]*r[2],o=e[1]*r[0]+e[4]*r[1]+e[7]*r[2],u=e[2]*r[0]+e[5]*r[1]+e[8]*r[2],s=e[0]*r[3]+e[3]*r[4]+e[6]*r[5],l=e[1]*r[3]+e[4]*r[4]+e[7]*r[5],c=e[2]*r[3]+e[5]*r[4]+e[8]*r[5],f=e[0]*r[6]+e[3]*r[7]+e[6]*r[8],d=e[1]*r[6]+e[4]*r[7]+e[7]*r[8],h=e[2]*r[6]+e[5]*r[7]+e[8]*r[8];return i[0]=a,i[1]=o,i[2]=u,i[3]=s,i[4]=l,i[5]=c,i[6]=f,i[7]=d,i[8]=h,i},l.add=function(e,r,i){if(!t(e))throw new n("left is required");if(!t(r))throw new n("right is required");if(!t(i))throw new n("result is required");return i[0]=e[0]+r[0],i[1]=e[1]+r[1],i[2]=e[2]+r[2],i[3]=e[3]+r[3],i[4]=e[4]+r[4],i[5]=e[5]+r[5],i[6]=e[6]+r[6],i[7]=e[7]+r[7],i[8]=e[8]+r[8],i},l.subtract=function(e,r,i){if(!t(e))throw new n("left is required");if(!t(r))throw new n("right is required");if(!t(i))throw new n("result is required");return i[0]=e[0]-r[0],i[1]=e[1]-r[1],i[2]=e[2]-r[2],i[3]=e[3]-r[3],i[4]=e[4]-r[4],i[5]=e[5]-r[5],i[6]=e[6]-r[6],i[7]=e[7]-r[7],i[8]=e[8]-r[8],i},l.multiplyByVector=function(e,r,i){if(!t(e))throw new n("matrix is required");if(!t(r))throw new n("cartesian is required");if(!t(i))throw new n("result is required");var a=r.x,o=r.y,u=r.z,s=e[0]*a+e[3]*o+e[6]*u,l=e[1]*a+e[4]*o+e[7]*u,c=e[2]*a+e[5]*o+e[8]*u;return i.x=s,i.y=l,i.z=c,i},l.multiplyByScalar=function(e,r,i){if(!t(e))throw new n("matrix is required");if("number"!=typeof r)throw new n("scalar must be a number");if(!t(i))throw new n("result is required");return i[0]=e[0]*r,i[1]=e[1]*r,i[2]=e[2]*r,i[3]=e[3]*r,i[4]=e[4]*r,i[5]=e[5]*r,i[6]=e[6]*r,i[7]=e[7]*r,i[8]=e[8]*r,i},l.negate=function(e,r){if(!t(e))throw new n("matrix is required");if(!t(r))throw new n("result is required");return r[0]=-e[0],r[1]=-e[1],r[2]=-e[2],r[3]=-e[3],r[4]=-e[4],r[5]=-e[5],r[6]=-e[6],r[7]=-e[7],r[8]=-e[8],r},l.transpose=function(e,r){if(!t(e))throw new n("matrix is required");if(!t(r))throw new n("result is required");var i=e[0],a=e[3],o=e[6],u=e[1],s=e[4],l=e[7],c=e[2],f=e[5],d=e[8];return r[0]=i,r[1]=a,r[2]=o,r[3]=u,r[4]=s,r[5]=l,r[6]=c,r[7]=f,r[8]=d,r};var d=[1,0,0],h=[2,2,1],w=new l,m=new l;return l.computeEigenDecomposition=function(e,r){if(!t(e))throw new n("matrix is required.");var i=a.EPSILON20,c=10,f=0,d=0;t(r)||(r={});for(var h=r.unitary=l.clone(l.IDENTITY,r.unitary),p=r.diagonal=l.clone(e,r.diagonal),y=i*o(p);c>d&&u(p)>y;)s(p,w),l.transpose(w,m),l.multiply(p,w,p),l.multiply(m,p,p),l.multiply(h,w,h),++f>2&&(++d,f=0);return r},l.abs=function(e,r){if(!t(e))throw new n("matrix is required");if(!t(r))throw new n("result is required");return r[0]=Math.abs(e[0]),r[1]=Math.abs(e[1]),r[2]=Math.abs(e[2]),r[3]=Math.abs(e[3]),r[4]=Math.abs(e[4]),r[5]=Math.abs(e[5]),r[6]=Math.abs(e[6]),r[7]=Math.abs(e[7]),r[8]=Math.abs(e[8]),r},l.determinant=function(e){if(!t(e))throw new n("matrix is required");var r=e[0],i=e[3],a=e[6],o=e[1],u=e[4],s=e[7],l=e[2],c=e[5],f=e[8];return r*(u*f-c*s)+o*(c*a-i*f)+l*(i*s-u*a)},l.inverse=function(e,r){if(!t(e))throw new n("matrix is required");if(!t(r))throw new n("result is required");var i=e[0],o=e[1],u=e[2],s=e[3],c=e[4],f=e[5],d=e[6],h=e[7],w=e[8],m=l.determinant(e);if(Math.abs(m)<=a.EPSILON15)throw new n("matrix is not invertible");r[0]=c*w-h*f,r[1]=h*u-o*w,r[2]=o*f-c*u,r[3]=d*f-s*w,r[4]=i*w-d*u,r[5]=s*u-i*f,r[6]=s*h-d*c,r[7]=d*o-i*h,r[8]=i*c-s*o;var p=1/m;return l.multiplyByScalar(r,p,r)},l.equals=function(e,r){return e===r||t(e)&&t(r)&&e[0]===r[0]&&e[1]===r[1]&&e[2]===r[2]&&e[3]===r[3]&&e[4]===r[4]&&e[5]===r[5]&&e[6]===r[6]&&e[7]===r[7]&&e[8]===r[8]},l.equalsEpsilon=function(e,r,i){if("number"!=typeof i)throw new n("epsilon must be a number");return e===r||t(e)&&t(r)&&Math.abs(e[0]-r[0])<=i&&Math.abs(e[1]-r[1])<=i&&Math.abs(e[2]-r[2])<=i&&Math.abs(e[3]-r[3])<=i&&Math.abs(e[4]-r[4])<=i&&Math.abs(e[5]-r[5])<=i&&Math.abs(e[6]-r[6])<=i&&Math.abs(e[7]-r[7])<=i&&Math.abs(e[8]-r[8])<=i},l.IDENTITY=i(new l(1,0,0,0,1,0,0,0,1)),l.COLUMN0ROW0=0,l.COLUMN0ROW1=1,l.COLUMN0ROW2=2,l.COLUMN1ROW0=3,l.COLUMN1ROW1=4,l.COLUMN1ROW2=5,l.COLUMN2ROW0=6,l.COLUMN2ROW1=7,l.COLUMN2ROW2=8,l.prototype.clone=function(e){return l.clone(this,e)},l.prototype.equals=function(e){return l.equals(this,e)},l.equalsArray=function(e,r,t){return e[0]===r[t]&&e[1]===r[t+1]&&e[2]===r[t+2]&&e[3]===r[t+3]&&e[4]===r[t+4]&&e[5]===r[t+5]&&e[6]===r[t+6]&&e[7]===r[t+7]&&e[8]===r[t+8]},l.prototype.equalsEpsilon=function(e,r){return l.equalsEpsilon(this,e,r)},l.prototype.toString=function(){return"("+this[0]+", "+this[3]+", "+this[6]+")\n"+"("+this[1]+", "+this[4]+", "+this[7]+")\n"+"("+this[2]+", "+this[5]+", "+this[8]+")"},l}),define("Core/RuntimeError",["./defined"],function(e){"use strict";var r=function(e){this.name="RuntimeError",this.message=e;var r;try{throw new Error}catch(t){r=t.stack}this.stack=r};return r.prototype.toString=function(){var r=this.name+": "+this.message;return e(this.stack)&&(r+="\n"+this.stack.toString()),r},r}),define("Core/Matrix4",["./Cartesian3","./Cartesian4","./defaultValue","./defined","./DeveloperError","./freezeObject","./Math","./Matrix3","./RuntimeError"],function(e,r,t,n,i,a,o,u,s){"use strict";var l=function(e,r,n,i,a,o,u,s,l,c,f,d,h,w,m,p){this[0]=t(e,0),this[1]=t(a,0),this[2]=t(l,0),this[3]=t(h,0),this[4]=t(r,0),this[5]=t(o,0),this[6]=t(c,0),this[7]=t(w,0),this[8]=t(n,0),this[9]=t(u,0),this[10]=t(f,0),this[11]=t(m,0),this[12]=t(i,0),this[13]=t(s,0),this[14]=t(d,0),this[15]=t(p,0)};l.packedLength=16,l.pack=function(e,r,a){if(!n(e))throw new i("value is required");if(!n(r))throw new i("array is required");a=t(a,0),r[a++]=e[0],r[a++]=e[1],r[a++]=e[2],r[a++]=e[3],r[a++]=e[4],r[a++]=e[5],r[a++]=e[6],r[a++]=e[7],r[a++]=e[8],r[a++]=e[9],r[a++]=e[10],r[a++]=e[11],r[a++]=e[12],r[a++]=e[13],r[a++]=e[14],r[a]=e[15]},l.unpack=function(e,r,a){if(!n(e))throw new i("array is required");return r=t(r,0),n(a)||(a=new l),a[0]=e[r++],a[1]=e[r++],a[2]=e[r++],a[3]=e[r++],a[4]=e[r++],a[5]=e[r++],a[6]=e[r++],a[7]=e[r++],a[8]=e[r++],a[9]=e[r++],a[10]=e[r++],a[11]=e[r++],a[12]=e[r++],a[13]=e[r++],a[14]=e[r++],a[15]=e[r],a},l.clone=function(e,r){return n(e)?n(r)?(r[0]=e[0],r[1]=e[1],r[2]=e[2],r[3]=e[3],r[4]=e[4],r[5]=e[5],r[6]=e[6],r[7]=e[7],r[8]=e[8],r[9]=e[9],r[10]=e[10],r[11]=e[11],r[12]=e[12],r[13]=e[13],r[14]=e[14],r[15]=e[15],r):new l(e[0],e[4],e[8],e[12],e[1],e[5],e[9],e[13],e[2],e[6],e[10],e[14],e[3],e[7],e[11],e[15]):void 0},l.fromArray=l.unpack,l.fromColumnMajorArray=function(e,r){if(!n(e))throw new i("values is required");return l.clone(e,r)},l.fromRowMajorArray=function(e,r){if(!n(e))throw new i("values is required.");return n(r)?(r[0]=e[0],r[1]=e[4],r[2]=e[8],r[3]=e[12],r[4]=e[1],r[5]=e[5],r[6]=e[9],r[7]=e[13],r[8]=e[2],r[9]=e[6],r[10]=e[10],r[11]=e[14],r[12]=e[3],r[13]=e[7],r[14]=e[11],r[15]=e[15],r):new l(e[0],e[1],e[2],e[3],e[4],e[5],e[6],e[7],e[8],e[9],e[10],e[11],e[12],e[13],e[14],e[15])},l.fromRotationTranslation=function(r,a,o){if(!n(r))throw new i("rotation is required.");return a=t(a,e.ZERO),n(o)?(o[0]=r[0],o[1]=r[1],o[2]=r[2],o[3]=0,o[4]=r[3],o[5]=r[4],o[6]=r[5],o[7]=0,o[8]=r[6],o[9]=r[7],o[10]=r[8],o[11]=0,o[12]=a.x,o[13]=a.y,o[14]=a.z,o[15]=1,o):new l(r[0],r[3],r[6],a.x,r[1],r[4],r[7],a.y,r[2],r[5],r[8],a.z,0,0,0,1)},l.fromTranslationQuaternionRotationScale=function(e,r,t,a){if(!n(e))throw new i("translation is required.");if(!n(r))throw new i("rotation is required.");if(!n(t))throw new i("scale is required.");n(a)||(a=new l);var o=t.x,u=t.y,s=t.z,c=r.x*r.x,f=r.x*r.y,d=r.x*r.z,h=r.x*r.w,w=r.y*r.y,m=r.y*r.z,p=r.y*r.w,y=r.z*r.z,v=r.z*r.w,g=r.w*r.w,q=c-w-y+g,x=2*(f-v),E=2*(d+p),b=2*(f+v),S=-c+w-y+g,_=2*(m-h),M=2*(d-p),O=2*(m+h),T=-c-w+y+g;return a[0]=q*o,a[1]=b*o,a[2]=M*o,a[3]=0,a[4]=x*u,a[5]=S*u,a[6]=O*u,a[7]=0,a[8]=E*s,a[9]=_*s,a[10]=T*s,a[11]=0,a[12]=e.x,a[13]=e.y,a[14]=e.z,a[15]=1,a},l.fromTranslation=function(e,r){if(!n(e))throw new i("translation is required.");return l.fromRotationTranslation(u.IDENTITY,e,r)},l.fromScale=function(e,r){if(!n(e))throw new i("scale is required.");return n(r)?(r[0]=e.x,r[1]=0,r[2]=0,r[3]=0,r[4]=0,r[5]=e.y,r[6]=0,r[7]=0,r[8]=0,r[9]=0,r[10]=e.z,r[11]=0,r[12]=0,r[13]=0,r[14]=0,r[15]=1,r):new l(e.x,0,0,0,0,e.y,0,0,0,0,e.z,0,0,0,0,1)},l.fromUniformScale=function(e,r){if("number"!=typeof e)throw new i("scale is required.");return n(r)?(r[0]=e,r[1]=0,r[2]=0,r[3]=0,r[4]=0,r[5]=e,r[6]=0,r[7]=0,r[8]=0,r[9]=0,r[10]=e,r[11]=0,r[12]=0,r[13]=0,r[14]=0,r[15]=1,r):new l(e,0,0,0,0,e,0,0,0,0,e,0,0,0,0,1)};var c=new e,f=new e,d=new e;l.fromCamera=function(r,t){if(!n(r))throw new i("camera is required.");var a=r.eye,o=r.target,u=r.up;if(!n(a))throw new i("camera.eye is required.");if(!n(o))throw new i("camera.target is required.");if(!n(u))throw new i("camera.up is required.");e.normalize(e.subtract(o,a,c),c),e.normalize(e.cross(c,u,f),f),e.normalize(e.cross(f,c,d),d);var s=f.x,h=f.y,w=f.z,m=c.x,p=c.y,y=c.z,v=d.x,g=d.y,q=d.z,x=a.x,E=a.y,b=a.z,S=s*-x+h*-E+w*-b,_=v*-x+g*-E+q*-b,M=m*x+p*E+y*b;return n(t)?(t[0]=s,t[1]=v,t[2]=-m,t[3]=0,t[4]=h,t[5]=g,t[6]=-p,t[7]=0,t[8]=w,t[9]=q,t[10]=-y,t[11]=0,t[12]=S,t[13]=_,t[14]=M,t[15]=1,t):new l(s,h,w,S,v,g,q,_,-m,-p,-y,M,0,0,0,1)},l.computePerspectiveFieldOfView=function(e,r,t,a,o){if(0>=e||e>Math.PI)throw new i("fovY must be in [0, PI).");if(0>=r)throw new i("aspectRatio must be greater than zero.");if(0>=t)throw new i("near must be greater than zero.");if(0>=a)throw new i("far must be greater than zero.");if(!n(o))throw new i("result is required");var u=Math.tan(.5*e),s=1/u,l=s/r,c=(a+t)/(t-a),f=2*a*t/(t-a);return o[0]=l,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]=-1,o[12]=0,o[13]=0,o[14]=f,o[15]=0,o},l.computeOrthographicOffCenter=function(e,r,t,a,o,u,s){if(!n(e))throw new i("left is required.");if(!n(r))throw new i("right is required.");if(!n(t))throw new i("bottom is required.");if(!n(a))throw new i("top is required.");if(!n(o))throw new i("near is required.");if(!n(u))throw new i("far is required.");if(!n(s))throw new i("result is required");var l=1/(r-e),c=1/(a-t),f=1/(u-o),d=-(r+e)*l,h=-(a+t)*c,w=-(u+o)*f;return l*=2,c*=2,f*=-2,s[0]=l,s[1]=0,s[2]=0,s[3]=0,s[4]=0,s[5]=c,s[6]=0,s[7]=0,s[8]=0,s[9]=0,s[10]=f,s[11]=0,s[12]=d,s[13]=h,s[14]=w,s[15]=1,s},l.computePerspectiveOffCenter=function(e,r,t,a,o,u,s){if(!n(e))throw new i("left is required.");if(!n(r))throw new i("right is required.");if(!n(t))throw new i("bottom is required.");if(!n(a))throw new i("top is required.");if(!n(o))throw new i("near is required.");if(!n(u))throw new i("far is required.");if(!n(s))throw new i("result is required");var l=2*o/(r-e),c=2*o/(a-t),f=(r+e)/(r-e),d=(a+t)/(a-t),h=-(u+o)/(u-o),w=-1,m=-2*u*o/(u-o);return s[0]=l,s[1]=0,s[2]=0,s[3]=0,s[4]=0,s[5]=c,s[6]=0,s[7]=0,s[8]=f,s[9]=d,s[10]=h,s[11]=w,s[12]=0,s[13]=0,s[14]=m,s[15]=0,s},l.computeInfinitePerspectiveOffCenter=function(e,r,t,a,o,u){if(!n(e))throw new i("left is required.");if(!n(r))throw new i("right is required.");if(!n(t))throw new i("bottom is required.");if(!n(a))throw new i("top is required.");if(!n(o))throw new i("near is required.");if(!n(u))throw new i("result is required");var s=2*o/(r-e),l=2*o/(a-t),c=(r+e)/(r-e),f=(a+t)/(a-t),d=-1,h=-1,w=-2*o;return u[0]=s,u[1]=0,u[2]=0,u[3]=0,u[4]=0,u[5]=l,u[6]=0,u[7]=0,u[8]=c,u[9]=f,u[10]=d,u[11]=h,u[12]=0,u[13]=0,u[14]=w,u[15]=0,u},l.computeViewportTransformation=function(e,r,a,o){if(!n(o))throw new i("result is required");e=t(e,t.EMPTY_OBJECT);var u=t(e.x,0),s=t(e.y,0),l=t(e.width,0),c=t(e.height,0);r=t(r,0),a=t(a,1);var f=.5*l,d=.5*c,h=.5*(a-r),w=f,m=d,p=h,y=u+f,v=s+d,g=r+h,q=1;return o[0]=w,o[1]=0,o[2]=0,o[3]=0,o[4]=0,o[5]=m,o[6]=0,o[7]=0,o[8]=0,o[9]=0,o[10]=p,o[11]=0,o[12]=y,o[13]=v,o[14]=g,o[15]=q,o},l.toArray=function(e,r){if(!n(e))throw new i("matrix is required");return n(r)?(r[0]=e[0],r[1]=e[1],r[2]=e[2],r[3]=e[3],r[4]=e[4],r[5]=e[5],r[6]=e[6],r[7]=e[7],r[8]=e[8],r[9]=e[9],r[10]=e[10],r[11]=e[11],r[12]=e[12],r[13]=e[13],r[14]=e[14],r[15]=e[15],r):[e[0],e[1],e[2],e[3],e[4],e[5],e[6],e[7],e[8],e[9],e[10],e[11],e[12],e[13],e[14],e[15]]},l.getElementIndex=function(e,r){if("number"!=typeof r||0>r||r>3)throw new i("row must be 0, 1, 2, or 3.");if("number"!=typeof e||0>e||e>3)throw new i("column must be 0, 1, 2, or 3.");return 4*e+r},l.getColumn=function(e,r,t){if(!n(e))throw new i("matrix is required.");if("number"!=typeof r||0>r||r>3)throw new i("index must be 0, 1, 2, or 3.");if(!n(t))throw new i("result is required");var a=4*r,o=e[a],u=e[a+1],s=e[a+2],l=e[a+3];return t.x=o,t.y=u,t.z=s,t.w=l,t},l.setColumn=function(e,r,t,a){if(!n(e))throw new i("matrix is required");if(!n(t))throw new i("cartesian is required");if("number"!=typeof r||0>r||r>3)throw new i("index must be 0, 1, 2, or 3.");if(!n(a))throw new i("result is required");a=l.clone(e,a);var o=4*r;return a[o]=t.x,a[o+1]=t.y,a[o+2]=t.z,a[o+3]=t.w,a},l.setTranslation=function(e,r,t){if(!n(e))throw new i("matrix is required");if(!n(r))throw new i("translation is required");if(!n(t))throw new i("result is required");return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[4]=e[4],t[5]=e[5],t[6]=e[6],t[7]=e[7],t[8]=e[8],t[9]=e[9],t[10]=e[10],t[11]=e[11],t[12]=r.x,t[13]=r.y,t[14]=r.z,t[15]=e[15],t},l.getRow=function(e,r,t){if(!n(e))throw new i("matrix is required.");if("number"!=typeof r||0>r||r>3)throw new i("index must be 0, 1, 2, or 3.");if(!n(t))throw new i("result is required");var a=e[r],o=e[r+4],u=e[r+8],s=e[r+12];return t.x=a,t.y=o,t.z=u,t.w=s,t},l.setRow=function(e,r,t,a){if(!n(e))throw new i("matrix is required");if(!n(t))throw new i("cartesian is required");if("number"!=typeof r||0>r||r>3)throw new i("index must be 0, 1, 2, or 3.");if(!n(a))throw new i("result is required");return a=l.clone(e,a),a[r]=t.x,a[r+4]=t.y,a[r+8]=t.z,a[r+12]=t.w,a};var h=new e;l.getScale=function(r,t){if(!n(r))throw new i("matrix is required.");if(!n(t))throw new i("result is required");return t.x=e.magnitude(e.fromElements(r[0],r[1],r[2],h)),t.y=e.magnitude(e.fromElements(r[4],r[5],r[6],h)),t.z=e.magnitude(e.fromElements(r[8],r[9],r[10],h)),t};var w=new e;l.getMaximumScale=function(r){return l.getScale(r,w),e.maximumComponent(w)},l.multiply=function(e,r,t){if(!n(e))throw new i("left is required");if(!n(r))throw new i("right is required");if(!n(t))throw new i("result is required");var a=e[0],o=e[1],u=e[2],s=e[3],l=e[4],c=e[5],f=e[6],d=e[7],h=e[8],w=e[9],m=e[10],p=e[11],y=e[12],v=e[13],g=e[14],q=e[15],x=r[0],E=r[1],b=r[2],S=r[3],_=r[4],M=r[5],O=r[6],T=r[7],P=r[8],A=r[9],R=r[10],N=r[11],z=r[12],I=r[13],C=r[14],D=r[15],U=a*x+l*E+h*b+y*S,L=o*x+c*E+w*b+v*S,B=u*x+f*E+m*b+g*S,F=s*x+d*E+p*b+q*S,W=a*_+l*M+h*O+y*T,G=o*_+c*M+w*O+v*T,V=u*_+f*M+m*O+g*T,k=s*_+d*M+p*O+q*T,j=a*P+l*A+h*R+y*N,Y=o*P+c*A+w*R+v*N,H=u*P+f*A+m*R+g*N,Z=s*P+d*A+p*R+q*N,X=a*z+l*I+h*C+y*D,J=o*z+c*I+w*C+v*D,Q=u*z+f*I+m*C+g*D,K=s*z+d*I+p*C+q*D;return t[0]=U,t[1]=L,t[2]=B,t[3]=F,t[4]=W,t[5]=G,t[6]=V,t[7]=k,t[8]=j,t[9]=Y,t[10]=H,t[11]=Z,t[12]=X,t[13]=J,t[14]=Q,t[15]=K,t},l.add=function(e,r,t){if(!n(e))throw new i("left is required");if(!n(r))throw new i("right is required");if(!n(t))throw new i("result is required");return t[0]=e[0]+r[0],t[1]=e[1]+r[1],t[2]=e[2]+r[2],t[3]=e[3]+r[3],t[4]=e[4]+r[4],t[5]=e[5]+r[5],t[6]=e[6]+r[6],t[7]=e[7]+r[7],t[8]=e[8]+r[8],t[9]=e[9]+r[9],t[10]=e[10]+r[10],t[11]=e[11]+r[11],t[12]=e[12]+r[12],t[13]=e[13]+r[13],t[14]=e[14]+r[14],t[15]=e[15]+r[15],t},l.subtract=function(e,r,t){if(!n(e))throw new i("left is required");if(!n(r))throw new i("right is required");if(!n(t))throw new i("result is required");return t[0]=e[0]-r[0],t[1]=e[1]-r[1],t[2]=e[2]-r[2],t[3]=e[3]-r[3],t[4]=e[4]-r[4],t[5]=e[5]-r[5],t[6]=e[6]-r[6],t[7]=e[7]-r[7],t[8]=e[8]-r[8],t[9]=e[9]-r[9],t[10]=e[10]-r[10],t[11]=e[11]-r[11],t[12]=e[12]-r[12],t[13]=e[13]-r[13],t[14]=e[14]-r[14],t[15]=e[15]-r[15],t},l.multiplyTransformation=function(e,r,t){if(!n(e))throw new i("left is required");if(!n(r))throw new i("right is required");if(!n(t))throw new i("result is required");var a=e[0],o=e[1],u=e[2],s=e[4],l=e[5],c=e[6],f=e[8],d=e[9],h=e[10],w=e[12],m=e[13],p=e[14],y=r[0],v=r[1],g=r[2],q=r[4],x=r[5],E=r[6],b=r[8],S=r[9],_=r[10],M=r[12],O=r[13],T=r[14],P=a*y+s*v+f*g,A=o*y+l*v+d*g,R=u*y+c*v+h*g,N=a*q+s*x+f*E,z=o*q+l*x+d*E,I=u*q+c*x+h*E,C=a*b+s*S+f*_,D=o*b+l*S+d*_,U=u*b+c*S+h*_,L=a*M+s*O+f*T+w,B=o*M+l*O+d*T+m,F=u*M+c*O+h*T+p;return t[0]=P,t[1]=A,t[2]=R,t[3]=0,t[4]=N,t[5]=z,t[6]=I,t[7]=0,t[8]=C,t[9]=D,t[10]=U,t[11]=0,t[12]=L,t[13]=B,t[14]=F,t[15]=1,t},l.multiplyByMatrix3=function(e,r,t){if(!n(e))throw new i("matrix is required");if(!n(r))throw new i("rotation is required");if(!n(t))throw new i("result is required");var a=e[0],o=e[1],u=e[2],s=e[4],l=e[5],c=e[6],f=e[8],d=e[9],h=e[10],w=r[0],m=r[1],p=r[2],y=r[3],v=r[4],g=r[5],q=r[6],x=r[7],E=r[8],b=a*w+s*m+f*p,S=o*w+l*m+d*p,_=u*w+c*m+h*p,M=a*y+s*v+f*g,O=o*y+l*v+d*g,T=u*y+c*v+h*g,P=a*q+s*x+f*E,A=o*q+l*x+d*E,R=u*q+c*x+h*E;return t[0]=b,t[1]=S,t[2]=_,t[3]=0,t[4]=M,t[5]=O,t[6]=T,t[7]=0,t[8]=P,t[9]=A,t[10]=R,t[11]=0,t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15],t},l.multiplyByTranslation=function(e,r,t){if(!n(e))throw new i("matrix is required");if(!n(r))throw new i("translation is required");if(!n(t))throw new i("result is required");var a=r.x,o=r.y,u=r.z,s=a*e[0]+o*e[4]+u*e[8]+e[12],l=a*e[1]+o*e[5]+u*e[9]+e[13],c=a*e[2]+o*e[6]+u*e[10]+e[14];return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[4]=e[4],t[5]=e[5],t[6]=e[6],t[7]=e[7],t[8]=e[8],t[9]=e[9],t[10]=e[10],t[11]=e[11],t[12]=s,t[13]=l,t[14]=c,t[15]=e[15],t};var m=new e;l.multiplyByUniformScale=function(e,r,t){if(!n(e))throw new i("matrix is required");if("number"!=typeof r)throw new i("scale is required");if(!n(t))throw new i("result is required");return m.x=r,m.y=r,m.z=r,l.multiplyByScale(e,m,t)},l.multiplyByScale=function(e,r,t){if(!n(e))throw new i("matrix is required");if(!n(r))throw new i("scale is required");if(!n(t))throw new i("result is required");var a=r.x,o=r.y,u=r.z;return 1===a&&1===o&&1===u?l.clone(e,t):(t[0]=a*e[0],t[1]=a*e[1],t[2]=a*e[2],t[3]=0,t[4]=o*e[4],t[5]=o*e[5],t[6]=o*e[6],t[7]=0,t[8]=u*e[8],t[9]=u*e[9],t[10]=u*e[10],t[11]=0,t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=1,t)},l.multiplyByVector=function(e,r,t){if(!n(e))throw new i("matrix is required");if(!n(r))throw new i("cartesian is required");if(!n(t))throw new i("result is required");var a=r.x,o=r.y,u=r.z,s=r.w,l=e[0]*a+e[4]*o+e[8]*u+e[12]*s,c=e[1]*a+e[5]*o+e[9]*u+e[13]*s,f=e[2]*a+e[6]*o+e[10]*u+e[14]*s,d=e[3]*a+e[7]*o+e[11]*u+e[15]*s;return t.x=l,t.y=c,t.z=f,t.w=d,t},l.multiplyByPointAsVector=function(e,r,t){if(!n(e))throw new i("matrix is required");if(!n(r))throw new i("cartesian is required");if(!n(t))throw new i("result is required");var a=r.x,o=r.y,u=r.z,s=e[0]*a+e[4]*o+e[8]*u,l=e[1]*a+e[5]*o+e[9]*u,c=e[2]*a+e[6]*o+e[10]*u;return t.x=s,t.y=l,t.z=c,t},l.multiplyByPoint=function(e,r,t){if(!n(e))throw new i("matrix is required");if(!n(r))throw new i("cartesian is required");if(!n(t))throw new i("result is required");var a=r.x,o=r.y,u=r.z,s=e[0]*a+e[4]*o+e[8]*u+e[12],l=e[1]*a+e[5]*o+e[9]*u+e[13],c=e[2]*a+e[6]*o+e[10]*u+e[14];return t.x=s,t.y=l,t.z=c,t},l.multiplyByScalar=function(e,r,t){if(!n(e))throw new i("matrix is required");if("number"!=typeof r)throw new i("scalar must be a number");if(!n(t))throw new i("result is required");return t[0]=e[0]*r,t[1]=e[1]*r,t[2]=e[2]*r,t[3]=e[3]*r,t[4]=e[4]*r,t[5]=e[5]*r,t[6]=e[6]*r,t[7]=e[7]*r,t[8]=e[8]*r,t[9]=e[9]*r,t[10]=e[10]*r,t[11]=e[11]*r,t[12]=e[12]*r,t[13]=e[13]*r,t[14]=e[14]*r,t[15]=e[15]*r,t},l.negate=function(e,r){if(!n(e))throw new i("matrix is required");if(!n(r))throw new i("result is required");return r[0]=-e[0],r[1]=-e[1],r[2]=-e[2],r[3]=-e[3],r[4]=-e[4],r[5]=-e[5],r[6]=-e[6],r[7]=-e[7],r[8]=-e[8],r[9]=-e[9],r[10]=-e[10],r[11]=-e[11],r[12]=-e[12],r[13]=-e[13],r[14]=-e[14],r[15]=-e[15],r},l.transpose=function(e,r){if(!n(e))throw new i("matrix is required");if(!n(r))throw new i("result is required");var t=e[1],a=e[2],o=e[3],u=e[6],s=e[7],l=e[11];return r[0]=e[0],r[1]=e[4],r[2]=e[8],r[3]=e[12],r[4]=t,r[5]=e[5],r[6]=e[9],r[7]=e[13],r[8]=a,r[9]=u,r[10]=e[10],r[11]=e[14],r[12]=o,r[13]=s,r[14]=l,r[15]=e[15],r},l.abs=function(e,r){if(!n(e))throw new i("matrix is required");if(!n(r))throw new i("result is required");return r[0]=Math.abs(e[0]),r[1]=Math.abs(e[1]),r[2]=Math.abs(e[2]),r[3]=Math.abs(e[3]),r[4]=Math.abs(e[4]),r[5]=Math.abs(e[5]),r[6]=Math.abs(e[6]),r[7]=Math.abs(e[7]),r[8]=Math.abs(e[8]),r[9]=Math.abs(e[9]),r[10]=Math.abs(e[10]),r[11]=Math.abs(e[11]),r[12]=Math.abs(e[12]),r[13]=Math.abs(e[13]),r[14]=Math.abs(e[14]),r[15]=Math.abs(e[15]),r},l.equals=function(e,r){return e===r||n(e)&&n(r)&&e[12]===r[12]&&e[13]===r[13]&&e[14]===r[14]&&e[0]===r[0]&&e[1]===r[1]&&e[2]===r[2]&&e[4]===r[4]&&e[5]===r[5]&&e[6]===r[6]&&e[8]===r[8]&&e[9]===r[9]&&e[10]===r[10]&&e[3]===r[3]&&e[7]===r[7]&&e[11]===r[11]&&e[15]===r[15]},l.equalsEpsilon=function(e,r,t){if("number"!=typeof t)throw new i("epsilon must be a number");return e===r||n(e)&&n(r)&&Math.abs(e[0]-r[0])<=t&&Math.abs(e[1]-r[1])<=t&&Math.abs(e[2]-r[2])<=t&&Math.abs(e[3]-r[3])<=t&&Math.abs(e[4]-r[4])<=t&&Math.abs(e[5]-r[5])<=t&&Math.abs(e[6]-r[6])<=t&&Math.abs(e[7]-r[7])<=t&&Math.abs(e[8]-r[8])<=t&&Math.abs(e[9]-r[9])<=t&&Math.abs(e[10]-r[10])<=t&&Math.abs(e[11]-r[11])<=t&&Math.abs(e[12]-r[12])<=t&&Math.abs(e[13]-r[13])<=t&&Math.abs(e[14]-r[14])<=t&&Math.abs(e[15]-r[15])<=t},l.getTranslation=function(e,r){if(!n(e))throw new i("matrix is required");if(!n(r))throw new i("result is required");return r.x=e[12],r.y=e[13],r.z=e[14],r},l.getRotation=function(e,r){if(!n(e))throw new i("matrix is required");if(!n(r))throw new i("result is required");return r[0]=e[0],r[1]=e[1],r[2]=e[2],r[3]=e[4],r[4]=e[5],r[5]=e[6],r[6]=e[8],r[7]=e[9],r[8]=e[10],r};var p=new u,y=new u,v=new r,g=new r(0,0,0,1);return l.inverse=function(e,t){if(!n(e))throw new i("matrix is required");if(!n(t))throw new i("result is required");if(u.equalsEpsilon(l.getRotation(e,p),y,o.EPSILON7)&&r.equals(l.getRow(e,3,v),g))return t[0]=0,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=0,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=0,t[11]=0,t[12]=-e[12],t[13]=-e[13],t[14]=-e[14],t[15]=1,t;var a=e[0],c=e[4],f=e[8],d=e[12],h=e[1],w=e[5],m=e[9],q=e[13],x=e[2],E=e[6],b=e[10],S=e[14],_=e[3],M=e[7],O=e[11],T=e[15],P=b*T,A=S*O,R=E*T,N=S*M,z=E*O,I=b*M,C=x*T,D=S*_,U=x*O,L=b*_,B=x*M,F=E*_,W=P*w+N*m+z*q-(A*w+R*m+I*q),G=A*h+C*m+L*q-(P*h+D*m+U*q),V=R*h+D*w+B*q-(N*h+C*w+F*q),k=I*h+U*w+F*m-(z*h+L*w+B*m),j=A*c+R*f+I*d-(P*c+N*f+z*d),Y=P*a+D*f+U*d-(A*a+C*f+L*d),H=N*a+C*c+F*d-(R*a+D*c+B*d),Z=z*a+L*c+B*f-(I*a+U*c+F*f);P=f*q,A=d*m,R=c*q,N=d*w,z=c*m,I=f*w,C=a*q,D=d*h,U=a*m,L=f*h,B=a*w,F=c*h;var X=P*M+N*O+z*T-(A*M+R*O+I*T),J=A*_+C*O+L*T-(P*_+D*O+U*T),Q=R*_+D*M+B*T-(N*_+C*M+F*T),K=I*_+U*M+F*O-(z*_+L*M+B*O),$=R*b+I*S+A*E-(z*S+P*E+N*b),er=U*S+P*x+D*b-(C*b+L*S+A*x),rr=C*E+F*S+N*x-(B*S+R*x+D*E),tr=B*b+z*x+L*E-(U*E+F*b+I*x),nr=a*W+c*G+f*V+d*k;if(Math.abs(nr)<o.EPSILON20)throw new s("matrix is not invertible because its determinate is zero.");return nr=1/nr,t[0]=W*nr,t[1]=G*nr,t[2]=V*nr,t[3]=k*nr,t[4]=j*nr,t[5]=Y*nr,t[6]=H*nr,t[7]=Z*nr,t[8]=X*nr,t[9]=J*nr,t[10]=Q*nr,t[11]=K*nr,t[12]=$*nr,t[13]=er*nr,t[14]=rr*nr,t[15]=tr*nr,t},l.inverseTransformation=function(e,r){if(!n(e))throw new i("matrix is required");if(!n(r))throw new i("result is required");var t=e[0],a=e[1],o=e[2],u=e[4],s=e[5],l=e[6],c=e[8],f=e[9],d=e[10],h=e[12],w=e[13],m=e[14],p=-t*h-a*w-o*m,y=-u*h-s*w-l*m,v=-c*h-f*w-d*m;return r[0]=t,r[1]=u,r[2]=c,r[3]=0,r[4]=a,r[5]=s,r[6]=f,r[7]=0,r[8]=o,r[9]=l,r[10]=d,r[11]=0,r[12]=p,r[13]=y,r[14]=v,r[15]=1,r},l.IDENTITY=a(new l(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1)),l.COLUMN0ROW0=0,l.COLUMN0ROW1=1,l.COLUMN0ROW2=2,l.COLUMN0ROW3=3,l.COLUMN1ROW0=4,l.COLUMN1ROW1=5,l.COLUMN1ROW2=6,l.COLUMN1ROW3=7,l.COLUMN2ROW0=8,l.COLUMN2ROW1=9,l.COLUMN2ROW2=10,l.COLUMN2ROW3=11,l.COLUMN3ROW0=12,l.COLUMN3ROW1=13,l.COLUMN3ROW2=14,l.COLUMN3ROW3=15,l.prototype.clone=function(e){return l.clone(this,e)},l.prototype.equals=function(e){return l.equals(this,e)},l.equalsArray=function(e,r,t){return e[0]===r[t]&&e[1]===r[t+1]&&e[2]===r[t+2]&&e[3]===r[t+3]&&e[4]===r[t+4]&&e[5]===r[t+5]&&e[6]===r[t+6]&&e[7]===r[t+7]&&e[8]===r[t+8]&&e[9]===r[t+9]&&e[10]===r[t+10]&&e[11]===r[t+11]&&e[12]===r[t+12]&&e[13]===r[t+13]&&e[14]===r[t+14]&&e[15]===r[t+15]},l.prototype.equalsEpsilon=function(e,r){return l.equalsEpsilon(this,e,r)},l.prototype.toString=function(){return"("+this[0]+", "+this[4]+", "+this[8]+", "+this[12]+")\n"+"("+this[1]+", "+this[5]+", "+this[9]+", "+this[13]+")\n"+"("+this[2]+", "+this[6]+", "+this[10]+", "+this[14]+")\n"+"("+this[3]+", "+this[7]+", "+this[11]+", "+this[15]+")"},l}),define("Core/Rectangle",["./Cartographic","./defaultValue","./defined","./defineProperties","./DeveloperError","./Ellipsoid","./freezeObject","./Math"],function(e,r,t,n,i,a,o,u){"use strict";var s=function(e,t,n,i){this.west=r(e,0),this.south=r(t,0),this.east=r(n,0),this.north=r(i,0)};n(s.prototype,{width:{get:function(){return s.computeWidth(this)}},height:{get:function(){return s.computeHeight(this)}}}),s.packedLength=4,s.pack=function(e,n,a){if(!t(e))throw new i("value is required");if(!t(n))throw new i("array is required");a=r(a,0),n[a++]=e.west,n[a++]=e.south,n[a++]=e.east,n[a]=e.north},s.unpack=function(e,n,a){if(!t(e))throw new i("array is required");return n=r(n,0),t(a)||(a=new s),a.west=e[n++],a.south=e[n++],a.east=e[n++],a.north=e[n],a},s.computeWidth=function(e){if(!t(e))throw new i("rectangle is required.");var r=e.east,n=e.west;return n>r&&(r+=u.TWO_PI),r-n},s.computeHeight=function(e){if(!t(e))throw new i("rectangle is required.");return e.north-e.south},s.fromDegrees=function(e,n,i,a,o){return e=u.toRadians(r(e,0)),n=u.toRadians(r(n,0)),i=u.toRadians(r(i,0)),a=u.toRadians(r(a,0)),t(o)?(o.west=e,o.south=n,o.east=i,o.north=a,o):new s(e,n,i,a)},s.fromCartographicArray=function(e,r){if(!t(e))throw new i("cartographics is required.");for(var n=Number.MAX_VALUE,a=-Number.MAX_VALUE,o=Number.MAX_VALUE,u=-Number.MAX_VALUE,l=0,c=e.length;c>l;l++){var f=e[l];n=Math.min(n,f.longitude),a=Math.max(a,f.longitude),o=Math.min(o,f.latitude),u=Math.max(u,f.latitude)}return t(r)?(r.west=n,r.south=o,r.east=a,r.north=u,r):new s(n,o,a,u)},s.clone=function(e,r){return t(e)?t(r)?(r.west=e.west,r.south=e.south,r.east=e.east,r.north=e.north,r):new s(e.west,e.south,e.east,e.north):void 0},s.prototype.clone=function(e){return s.clone(this,e)},s.prototype.equals=function(e){return s.equals(this,e)},s.equals=function(e,r){return e===r||t(e)&&t(r)&&e.west===r.west&&e.south===r.south&&e.east===r.east&&e.north===r.north},s.prototype.equalsEpsilon=function(e,r){if("number"!=typeof r)throw new i("epsilon is required and must be a number.");return t(e)&&Math.abs(this.west-e.west)<=r&&Math.abs(this.south-e.south)<=r&&Math.abs(this.east-e.east)<=r&&Math.abs(this.north-e.north)<=r},s.validate=function(e){if(!t(e))throw new i("rectangle is required");var r=e.north;if("number"!=typeof r)throw new i("north is required to be a number.");if(r<-u.PI_OVER_TWO||r>u.PI_OVER_TWO)throw new i("north must be in the interval [-Pi/2, Pi/2].");var n=e.south;if("number"!=typeof n)throw new i("south is required to be a number.");if(n<-u.PI_OVER_TWO||n>u.PI_OVER_TWO)throw new i("south must be in the interval [-Pi/2, Pi/2].");var a=e.west;if("number"!=typeof a)throw new i("west is required to be a number.");if(a<-Math.PI||a>Math.PI)throw new i("west must be in the interval [-Pi, Pi].");var o=e.east;if("number"!=typeof o)throw new i("east is required to be a number.");if(o<-Math.PI||o>Math.PI)throw new i("east must be in the interval [-Pi, Pi].")},s.southwest=function(r,n){if(!t(r))throw new i("rectangle is required");return t(n)?(n.longitude=r.west,n.latitude=r.south,n.height=0,n):new e(r.west,r.south)},s.northwest=function(r,n){if(!t(r))throw new i("rectangle is required");return t(n)?(n.longitude=r.west,n.latitude=r.north,n.height=0,n):new e(r.west,r.north)},s.northeast=function(r,n){if(!t(r))throw new i("rectangle is required");return t(n)?(n.longitude=r.east,n.latitude=r.north,n.height=0,n):new e(r.east,r.north)},s.southeast=function(r,n){if(!t(r))throw new i("rectangle is required");return t(n)?(n.longitude=r.east,n.latitude=r.south,n.height=0,n):new e(r.east,r.south)},s.center=function(r,n){if(!t(r))throw new i("rectangle is required");var a=r.east,o=r.west;o>a&&(a+=u.TWO_PI);var s=u.negativePiToPi(.5*(o+a)),l=.5*(r.south+r.north);return t(n)?(n.longitude=s,n.latitude=l,n.height=0,n):new e(s,l)},s.intersection=function(e,r,n){if(!t(e))throw new i("rectangle is required");if(!t(r))throw new i("otherRectangle is required.");var a=e.east,o=e.west,l=r.east,c=r.west;o>a&&l>0?a+=u.TWO_PI:c>l&&a>0&&(l+=u.TWO_PI),o>a&&0>c?c+=u.TWO_PI:c>l&&0>o&&(o+=u.TWO_PI);var f=u.negativePiToPi(Math.max(o,c)),d=u.negativePiToPi(Math.min(a,l));if((e.west<e.east||r.west<r.east)&&f>=d)return void 0;var h=Math.max(e.south,r.south),w=Math.min(e.north,r.north);return h>=w?void 0:t(n)?(n.west=f,n.south=h,n.east=d,n.north=w,n):new s(f,h,d,w)},s.contains=function(e,r){if(!t(e))throw new i("rectangle is required");if(!t(r))throw new i("cartographic is required.");var n=r.longitude,a=r.latitude,o=e.west,s=e.east;return o>s&&(s+=u.TWO_PI,0>n&&(n+=u.TWO_PI)),(n>o||u.equalsEpsilon(n,o,u.EPSILON14))&&(s>n||u.equalsEpsilon(n,s,u.EPSILON14))&&a>=e.south&&a<=e.north};var l=new e;return s.subsample=function(e,n,o,c){if(!t(e))throw new i("rectangle is required");n=r(n,a.WGS84),o=r(o,0),t(c)||(c=[]);var f=0,d=e.north,h=e.south,w=e.east,m=e.west,p=l;p.height=o,p.longitude=m,p.latitude=d,c[f]=n.cartographicToCartesian(p,c[f]),f++,p.longitude=w,c[f]=n.cartographicToCartesian(p,c[f]),f++,p.latitude=h,c[f]=n.cartographicToCartesian(p,c[f]),f++,p.longitude=m,c[f]=n.cartographicToCartesian(p,c[f]),f++,p.latitude=0>d?d:h>0?h:0;for(var y=1;8>y;++y)p.longitude=-Math.PI+y*u.PI_OVER_TWO,s.contains(e,p)&&(c[f]=n.cartographicToCartesian(p,c[f]),f++);return 0===p.latitude&&(p.longitude=m,c[f]=n.cartographicToCartesian(p,c[f]),f++,p.longitude=w,c[f]=n.cartographicToCartesian(p,c[f]),f++),c.length=f,c},s.MAX_VALUE=o(new s(-Math.PI,-u.PI_OVER_TWO,Math.PI,u.PI_OVER_TWO)),s}),define("Core/BoundingSphere",["./Cartesian3","./Cartographic","./defaultValue","./defined","./DeveloperError","./Ellipsoid","./GeographicProjection","./Intersect","./Interval","./Matrix4","./Rectangle"],function(e,r,t,n,i,a,o,u,s,l,c){"use strict";var f=function(r,n){this.center=e.clone(t(r,e.ZERO)),this.radius=t(n,0)},d=new e,h=new e,w=new e,m=new e,p=new e,y=new e,v=new e,g=new e,q=new e,x=new e,E=new e,b=new e;f.fromPoints=function(r,t){if(n(t)||(t=new f),!n(r)||0===r.length)return t.center=e.clone(e.ZERO,t.center),t.radius=0,t;for(var i=e.clone(r[0],v),a=e.clone(i,d),o=e.clone(i,h),u=e.clone(i,w),s=e.clone(i,m),l=e.clone(i,p),c=e.clone(i,y),S=r.length,_=1;S>_;_++){e.clone(r[_],i);var M=i.x,O=i.y,T=i.z;M<a.x&&e.clone(i,a),M>s.x&&e.clone(i,s),O<o.y&&e.clone(i,o),O>l.y&&e.clone(i,l),T<u.z&&e.clone(i,u),T>c.z&&e.clone(i,c)}var P=e.magnitudeSquared(e.subtract(s,a,g)),A=e.magnitudeSquared(e.subtract(l,o,g)),R=e.magnitudeSquared(e.subtract(c,u,g)),N=a,z=s,I=P;A>I&&(I=A,N=o,z=l),R>I&&(I=R,N=u,z=c);var C=q;C.x=.5*(N.x+z.x),C.y=.5*(N.y+z.y),C.z=.5*(N.z+z.z);var D=e.magnitudeSquared(e.subtract(z,C,g)),U=Math.sqrt(D),L=x;L.x=a.x,L.y=o.y,L.z=u.z;var B=E;B.x=s.x,B.y=l.y,B.z=c.z;var F=e.multiplyByScalar(e.add(L,B,g),.5,b),W=0;for(_=0;S>_;_++){e.clone(r[_],i);var G=e.magnitude(e.subtract(i,F,g));G>W&&(W=G);var V=e.magnitudeSquared(e.subtract(i,C,g));if(V>D){var k=Math.sqrt(V);U=.5*(U+k),D=U*U;var j=k-U;C.x=(U*C.x+j*i.x)/k,C.y=(U*C.y+j*i.y)/k,C.z=(U*C.z+j*i.z)/k}}return W>U?(e.clone(C,t.center),t.radius=U):(e.clone(F,t.center),t.radius=W),t
  };var S=new o,_=new e,M=new e,O=new r,T=new r;f.fromRectangle2D=function(e,r,t){return f.fromRectangleWithHeights2D(e,r,0,0,t)},f.fromRectangleWithHeights2D=function(r,i,a,o,u){if(n(u)||(u=new f),!n(r))return u.center=e.clone(e.ZERO,u.center),u.radius=0,u;i=t(i,S),c.southwest(r,O),O.height=a,c.northeast(r,T),T.height=o;var s=i.project(O,_),l=i.project(T,M),d=l.x-s.x,h=l.y-s.y,w=l.z-s.z;u.radius=.5*Math.sqrt(d*d+h*h+w*w);var m=u.center;return m.x=s.x+.5*d,m.y=s.y+.5*h,m.z=s.z+.5*w,u};var P=[];f.fromRectangle3D=function(e,r,i,o){r=t(r,a.WGS84),i=t(i,0);var u;return n(e)&&(u=c.subsample(e,r,i,P)),f.fromPoints(u,o)},f.fromVertices=function(r,a,o,u){if(n(u)||(u=new f),!n(r)||0===r.length)return u.center=e.clone(e.ZERO,u.center),u.radius=0,u;if(a=t(a,e.ZERO),o=t(o,3),3>o)throw new i("stride must be 3 or greater.");var s=v;s.x=r[0]+a.x,s.y=r[1]+a.y,s.z=r[2]+a.z;for(var l=e.clone(s,d),c=e.clone(s,h),S=e.clone(s,w),_=e.clone(s,m),M=e.clone(s,p),O=e.clone(s,y),T=r.length,P=0;T>P;P+=o){var A=r[P]+a.x,R=r[P+1]+a.y,N=r[P+2]+a.z;s.x=A,s.y=R,s.z=N,A<l.x&&e.clone(s,l),A>_.x&&e.clone(s,_),R<c.y&&e.clone(s,c),R>M.y&&e.clone(s,M),N<S.z&&e.clone(s,S),N>O.z&&e.clone(s,O)}var z=e.magnitudeSquared(e.subtract(_,l,g)),I=e.magnitudeSquared(e.subtract(M,c,g)),C=e.magnitudeSquared(e.subtract(O,S,g)),D=l,U=_,L=z;I>L&&(L=I,D=c,U=M),C>L&&(L=C,D=S,U=O);var B=q;B.x=.5*(D.x+U.x),B.y=.5*(D.y+U.y),B.z=.5*(D.z+U.z);var F=e.magnitudeSquared(e.subtract(U,B,g)),W=Math.sqrt(F),G=x;G.x=l.x,G.y=c.y,G.z=S.z;var V=E;V.x=_.x,V.y=M.y,V.z=O.z;var k=e.multiplyByScalar(e.add(G,V,g),.5,b),j=0;for(P=0;T>P;P+=o){s.x=r[P]+a.x,s.y=r[P+1]+a.y,s.z=r[P+2]+a.z;var Y=e.magnitude(e.subtract(s,k,g));Y>j&&(j=Y);var H=e.magnitudeSquared(e.subtract(s,B,g));if(H>F){var Z=Math.sqrt(H);W=.5*(W+Z),F=W*W;var X=Z-W;B.x=(W*B.x+X*s.x)/Z,B.y=(W*B.y+X*s.y)/Z,B.z=(W*B.z+X*s.z)/Z}}return j>W?(e.clone(B,u.center),u.radius=W):(e.clone(k,u.center),u.radius=j),u},f.fromCornerPoints=function(r,t,a){if(!n(r)||!n(t))throw new i("corner and oppositeCorner are required.");n(a)||(a=new f);var o=a.center;return e.add(r,t,o),e.multiplyByScalar(o,.5,o),a.radius=e.distance(o,t),a},f.fromEllipsoid=function(r,t){if(!n(r))throw new i("ellipsoid is required.");return n(t)||(t=new f),e.clone(e.ZERO,t.center),t.radius=r.maximumRadius,t};var A=new e;f.fromBoundingSpheres=function(r,t){if(n(t)||(t=new f),!n(r)||0===r.length)return t.center=e.clone(e.ZERO,t.center),t.radius=0,t;var i=r.length;if(1===i)return f.clone(r[0],t);if(2===i)return f.union(r[0],r[1],t);for(var a=[],o=0;i>o;o++)a.push(r[o].center);t=f.fromPoints(a,t);var u=t.center,s=t.radius;for(o=0;i>o;o++){var l=r[o];s=Math.max(s,e.distance(u,l.center,A)+l.radius)}return t.radius=s,t},f.clone=function(r,t){return n(r)?n(t)?(t.center=e.clone(r.center,t.center),t.radius=r.radius,t):new f(r.center,r.radius):void 0},f.packedLength=4,f.pack=function(e,r,a){if(!n(e))throw new i("value is required");if(!n(r))throw new i("array is required");a=t(a,0);var o=e.center;r[a++]=o.x,r[a++]=o.y,r[a++]=o.z,r[a]=e.radius},f.unpack=function(e,r,a){if(!n(e))throw new i("array is required");r=t(r,0),n(a)||(a=new f);var o=a.center;return o.x=e[r++],o.y=e[r++],o.z=e[r++],a.radius=e[r],a};var R=new e,N=new e;f.union=function(r,t,a){if(!n(r))throw new i("left is required.");if(!n(t))throw new i("right is required.");n(a)||(a=new f);var o=r.center,u=t.center;e.add(o,u,N);var s=e.multiplyByScalar(N,.5,N),l=e.magnitude(e.subtract(o,s,R))+r.radius,c=e.magnitude(e.subtract(u,s,R))+t.radius;return a.radius=Math.max(l,c),e.clone(s,a.center),a};var z=new e;f.expand=function(r,t,a){if(!n(r))throw new i("sphere is required.");if(!n(t))throw new i("point is required.");a=f.clone(r,a);var o=e.magnitude(e.subtract(t,a.center,z));return o>a.radius&&(a.radius=o),a},f.intersect=function(r,t){if(!n(r))throw new i("sphere is required.");if(!n(t))throw new i("plane is required.");var a=r.center,o=r.radius,s=e.dot(t,a)+t.w;return-o>s?u.OUTSIDE:o>s?u.INTERSECTING:u.INSIDE},f.transform=function(e,r,t){if(!n(e))throw new i("sphere is required.");if(!n(r))throw new i("transform is required.");return n(t)||(t=new f),t.center=l.multiplyByPoint(r,e.center,t.center),t.radius=l.getMaximumScale(r)*e.radius,t};var I=new e;f.distanceSquaredTo=function(r,t){if(!n(r))throw new i("sphere is required.");if(!n(t))throw new i("cartesian is required.");var a=e.subtract(r.center,t,I);return e.magnitudeSquared(a)-r.radius*r.radius},f.transformWithoutScale=function(e,r,t){if(!n(e))throw new i("sphere is required.");if(!n(r))throw new i("transform is required.");return n(t)||(t=new f),t.center=l.multiplyByPoint(r,e.center,t.center),t.radius=e.radius,t};var C=new e;f.computePlaneDistances=function(r,t,a,o){if(!n(r))throw new i("sphere is required.");if(!n(t))throw new i("position is required.");if(!n(a))throw new i("direction is required.");n(o)||(o=new s);var u=e.subtract(r.center,t,C),l=e.multiplyByScalar(a,e.dot(a,u),C),c=e.magnitude(l);return o.start=c-r.radius,o.stop=c+r.radius,o};for(var D=new e,U=new e,L=new e,B=new e,F=new e,W=new r,G=new Array(8),V=0;8>V;++V)G[V]=new e;var k=new o;return f.projectTo2D=function(r,a,o){if(!n(r))throw new i("sphere is required.");a=t(a,k);var u=a.ellipsoid,s=r.center,l=r.radius,c=u.geodeticSurfaceNormal(s,D),d=e.cross(e.UNIT_Z,c,U);e.normalize(d,d);var h=e.cross(c,d,L);e.normalize(h,h),e.multiplyByScalar(c,l,c),e.multiplyByScalar(h,l,h),e.multiplyByScalar(d,l,d);var w=e.negate(h,F),m=e.negate(d,B),p=G,y=p[0];e.add(c,h,y),e.add(y,d,y),y=p[1],e.add(c,h,y),e.add(y,m,y),y=p[2],e.add(c,w,y),e.add(y,m,y),y=p[3],e.add(c,w,y),e.add(y,d,y),e.negate(c,c),y=p[4],e.add(c,h,y),e.add(y,d,y),y=p[5],e.add(c,h,y),e.add(y,m,y),y=p[6],e.add(c,w,y),e.add(y,m,y),y=p[7],e.add(c,w,y),e.add(y,d,y);for(var v=p.length,g=0;v>g;++g){var q=p[g];e.add(s,q,q);var x=u.cartesianToCartographic(q,W);a.project(x,q)}o=f.fromPoints(p,o),s=o.center;var E=s.x,b=s.y,S=s.z;return s.x=S,s.y=E,s.z=b,o},f.equals=function(r,t){return r===t||n(r)&&n(t)&&e.equals(r.center,t.center)&&r.radius===t.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/Fullscreen",["./defined","./defineProperties"],function(e,r){"use strict";var t,n={requestFullscreen:void 0,exitFullscreen:void 0,fullscreenEnabled:void 0,fullscreenElement:void 0,fullscreenchange:void 0,fullscreenerror:void 0},i={};return r(i,{element:{get:function(){return i.supportsFullscreen()?document[n.fullscreenElement]:void 0}},changeEventName:{get:function(){return i.supportsFullscreen()?n.fullscreenchange:void 0}},errorEventName:{get:function(){return i.supportsFullscreen()?n.fullscreenerror:void 0}},enabled:{get:function(){return i.supportsFullscreen()?document[n.fullscreenEnabled]:void 0}},fullscreen:{get:function(){return i.supportsFullscreen()?null!==i.element:void 0}}}),i.supportsFullscreen=function(){if(e(t))return t;t=!1;var r=document.body;if("function"==typeof r.requestFullscreen)return n.requestFullscreen="requestFullscreen",n.exitFullscreen="exitFullscreen",n.fullscreenEnabled="fullscreenEnabled",n.fullscreenElement="fullscreenElement",n.fullscreenchange="fullscreenchange",n.fullscreenerror="fullscreenerror",t=!0;for(var i,a=["webkit","moz","o","ms","khtml"],o=0,u=a.length;u>o;++o){var s=a[o];i=s+"RequestFullscreen","function"==typeof r[i]?(n.requestFullscreen=i,t=!0):(i=s+"RequestFullScreen","function"==typeof r[i]&&(n.requestFullscreen=i,t=!0)),i=s+"ExitFullscreen","function"==typeof document[i]?n.exitFullscreen=i:(i=s+"CancelFullScreen","function"==typeof document[i]&&(n.exitFullscreen=i)),i=s+"FullscreenEnabled",e(document[i])?n.fullscreenEnabled=i:(i=s+"FullScreenEnabled",e(document[i])&&(n.fullscreenEnabled=i)),i=s+"FullscreenElement",e(document[i])?n.fullscreenElement=i:(i=s+"FullScreenElement",e(document[i])&&(n.fullscreenElement=i)),i=s+"fullscreenchange",e(document["on"+i])&&("ms"===s&&(i="MSFullscreenChange"),n.fullscreenchange=i),i=s+"fullscreenerror",e(document["on"+i])&&("ms"===s&&(i="MSFullscreenError"),n.fullscreenerror=i)}return t},i.requestFullscreen=function(e){i.supportsFullscreen()&&e[n.requestFullscreen]()},i.exitFullscreen=function(){i.supportsFullscreen()&&document[n.exitFullscreen]()},i}),define("Core/FeatureDetection",["./defaultValue","./defined","./Fullscreen"],function(e,r,t){"use strict";function n(e){for(var r=e.split("."),t=0,n=r.length;n>t;++t)r[t]=parseInt(r[t],10);return r}function i(){if(!r(p)){p=!1;var e=/ Chrome\/([\.0-9]+)/.exec(navigator.userAgent);null!==e&&(p=!0,y=n(e[1]))}return p}function a(){return i()&&y}function o(){if(!r(v)&&(v=!1,!i()&&/ Safari\/[\.0-9]+/.test(navigator.userAgent))){var e=/ Version\/([\.0-9]+)/.exec(navigator.userAgent);null!==e&&(v=!0,g=n(e[1]))}return v}function u(){return o()&&g}function s(){if(!r(q)){q=!1;var e=/ AppleWebKit\/([\.0-9]+)(\+?)/.exec(navigator.userAgent);null!==e&&(q=!0,x=n(e[1]),x.isNightly=!!e[2])}return q}function l(){return s()&&x}function c(){if(!r(E)){E=!1;var e;"Microsoft Internet Explorer"===navigator.appName?(e=/MSIE ([0-9]{1,}[\.0-9]{0,})/.exec(navigator.userAgent),null!==e&&(E=!0,b=n(e[1]))):"Netscape"===navigator.appName&&(e=/Trident\/.*rv:([0-9]{1,}[\.0-9]{0,})/.exec(navigator.userAgent),null!==e&&(E=!0,b=n(e[1])))}return E}function f(){return c()&&b}function d(){if(!r(S)){S=!1;var e=/Firefox\/([\.0-9]+)/.exec(navigator.userAgent);null!==e&&(S=!0,_=n(e[1]))}return S}function h(){return r(M)||(M=/Windows/i.test(navigator.appVersion)),M}function w(){return d()&&_}function m(){return r(O)||(O=r(window.PointerEvent)&&(!r(window.navigator.pointerEnabled)||window.navigator.pointerEnabled)),O}var p,y,v,g,q,x,E,b,S,_,M,O,T={isChrome:i,chromeVersion:a,isSafari:o,safariVersion:u,isWebkit:s,webkitVersion:l,isInternetExplorer:c,internetExplorerVersion:f,isFirefox:d,firefoxVersion:w,isWindows:h,hardwareConcurrency:e(navigator.hardwareConcurrency,3),supportsPointerEvents:m};return T.supportsFullscreen=function(){return t.supportsFullscreen()},T.supportsTypedArrays=function(){return"undefined"!=typeof ArrayBuffer},T.supportsWebWorkers=function(){return"undefined"!=typeof Worker},T}),define("Core/ComponentDatatype",["./defaultValue","./defined","./DeveloperError","./FeatureDetection","./freezeObject"],function(e,r,t,n,i){"use strict";if(!n.supportsTypedArrays())return{};var a={BYTE:5120,UNSIGNED_BYTE:5121,SHORT:5122,UNSIGNED_SHORT:5123,FLOAT:5126,DOUBLE:5130};return a.getSizeInBytes=function(e){if(!r(e))throw new t("value is required.");switch(e){case a.BYTE:return Int8Array.BYTES_PER_ELEMENT;case a.UNSIGNED_BYTE:return Uint8Array.BYTES_PER_ELEMENT;case a.SHORT:return Int16Array.BYTES_PER_ELEMENT;case a.UNSIGNED_SHORT:return Uint16Array.BYTES_PER_ELEMENT;case a.FLOAT:return Float32Array.BYTES_PER_ELEMENT;case a.DOUBLE:return Float64Array.BYTES_PER_ELEMENT;default:throw new t("componentDatatype is not a valid value.")}},a.fromTypedArray=function(e){return e instanceof Int8Array?a.BYTE:e instanceof Uint8Array?a.UNSIGNED_BYTE:e instanceof Int16Array?a.SHORT:e instanceof Uint16Array?a.UNSIGNED_SHORT:e instanceof Float32Array?a.FLOAT:e instanceof Float64Array?a.DOUBLE:void 0},a.validate=function(e){return r(e)&&(e===a.BYTE||e===a.UNSIGNED_BYTE||e===a.SHORT||e===a.UNSIGNED_SHORT||e===a.FLOAT||e===a.DOUBLE)},a.createTypedArray=function(e,n){if(!r(e))throw new t("componentDatatype is required.");if(!r(n))throw new t("valuesOrLength is required.");switch(e){case a.BYTE:return new Int8Array(n);case a.UNSIGNED_BYTE:return new Uint8Array(n);case a.SHORT:return new Int16Array(n);case a.UNSIGNED_SHORT:return new Uint16Array(n);case a.FLOAT:return new Float32Array(n);case a.DOUBLE:return new Float64Array(n);default:throw new t("componentDatatype is not a valid value.")}},a.createArrayBufferView=function(n,i,o,u){if(!r(n))throw new t("componentDatatype is required.");if(!r(i))throw new t("buffer is required.");switch(o=e(o,0),u=e(u,(i.byteLength-o)/a.getSizeInBytes(n)),n){case a.BYTE:return new Int8Array(i,o,u);case a.UNSIGNED_BYTE:return new Uint8Array(i,o,u);case a.SHORT:return new Int16Array(i,o,u);case a.UNSIGNED_SHORT:return new Uint16Array(i,o,u);case a.FLOAT:return new Float32Array(i,o,u);case a.DOUBLE:return new Float64Array(i,o,u);default:throw new t("componentDatatype is not a valid value.")}},i(a)}),define("Core/CornerType",["./freezeObject"],function(e){"use strict";var r={ROUNDED:0,MITERED:1,BEVELED:2};return e(r)}),define("Core/isArray",["./defined"],function(e){"use strict";var r=Array.isArray;return e(r)||(r=function(e){return"[object Array]"===Object.prototype.toString.call(e)}),r}),define("Core/EllipsoidGeodesic",["./Cartesian3","./Cartographic","./defaultValue","./defined","./defineProperties","./DeveloperError","./Ellipsoid","./Math"],function(e,r,t,n,i,a,o,u){"use strict";function s(e){var r=e._uSquared,t=e._ellipsoid.maximumRadius,n=e._ellipsoid.minimumRadius,i=(t-n)/t,a=Math.cos(e._startHeading),o=Math.sin(e._startHeading),u=(1-i)*Math.tan(e._start.latitude),s=1/Math.sqrt(1+u*u),l=s*u,c=Math.atan2(u,a),f=s*o,d=f*f,h=1-d,w=Math.sqrt(h),m=r/4,p=m*m,y=p*m,v=p*p,g=1+m-3*p/4+5*y/4-175*v/64,q=1-m+15*p/8-35*y/8,x=1-3*m+35*p/4,E=1-5*m,b=g*c-q*Math.sin(2*c)*m/2-x*Math.sin(4*c)*p/16-E*Math.sin(6*c)*y/48-5*Math.sin(8*c)*v/512,S=e._constants;S.a=t,S.b=n,S.f=i,S.cosineHeading=a,S.sineHeading=o,S.tanU=u,S.cosineU=s,S.sineU=l,S.sigma=c,S.sineAlpha=f,S.sineSquaredAlpha=d,S.cosineSquaredAlpha=h,S.cosineAlpha=w,S.u2Over4=m,S.u4Over16=p,S.u6Over64=y,S.u8Over256=v,S.a0=g,S.a1=q,S.a2=x,S.a3=E,S.distanceRatio=b}function l(e,r){return e*r*(4+e*(4-3*r))/16}function c(e,r,t,n,i,a,o){var u=l(e,t);return(1-u)*e*r*(n+u*i*(o+u*a*(2*o*o-1)))}function f(e,r,t,n,i,a,o){var s,l,f,d,h,w=(r-t)/r,m=a-n,p=Math.atan((1-w)*Math.tan(i)),y=Math.atan((1-w)*Math.tan(o)),v=Math.cos(p),g=Math.sin(p),q=Math.cos(y),x=Math.sin(y),E=v*q,b=v*x,S=g*x,_=g*q,M=m,O=u.TWO_PI,T=Math.cos(M),P=Math.sin(M);do{T=Math.cos(M),P=Math.sin(M);var A=b-_*T;f=Math.sqrt(q*q*P*P+A*A),l=S+E*T,s=Math.atan2(f,l);var R;0===f?(R=0,d=1):(R=E*P/f,d=1-R*R),O=M,h=l-2*S/d,isNaN(h)&&(h=0),M=m+c(w,R,d,s,f,l,h)}while(Math.abs(M-O)>u.EPSILON12);var N=d*(r*r-t*t)/(t*t),z=1+N*(4096+N*(N*(320-175*N)-768))/16384,I=N*(256+N*(N*(74-47*N)-128))/1024,C=h*h,D=I*f*(h+I*(l*(2*C-1)-I*h*(4*f*f-3)*(4*C-3)/6)/4),U=t*z*(s-D),L=Math.atan2(q*P,b-_*T),B=Math.atan2(v*P,b*T-_);e._distance=U,e._startHeading=L,e._endHeading=B,e._uSquared=N}function d(t,n,i,o){var u=e.normalize(o.cartographicToCartesian(n,w),h),l=e.normalize(o.cartographicToCartesian(i,w),w);if(Math.abs(Math.abs(e.angleBetween(u,l))-Math.PI)<.0125)throw new a("geodesic position is not unique");f(t,o.maximumRadius,o.minimumRadius,n.longitude,n.latitude,i.longitude,i.latitude),t._start=r.clone(n,t._start),t._end=r.clone(i,t._end),t._start.height=0,t._end.height=0,s(t)}var h=new e,w=new e,m=function(e,i,a){var u=t(a,o.WGS84);this._ellipsoid=u,this._start=new r,this._end=new r,this._constants={},this._startHeading=void 0,this._endHeading=void 0,this._distance=void 0,this._uSquared=void 0,n(e)&&n(i)&&d(this,e,i,u)};return i(m.prototype,{surfaceDistance:{get:function(){if(!n(this._distance))throw new a("set end positions before getting surfaceDistance");return this._distance}},start:{get:function(){return this._start}},end:{get:function(){return this._end}},startHeading:{get:function(){if(!n(this._distance))throw new a("set end positions before getting startHeading");return this._startHeading}},endHeading:{get:function(){if(!n(this._distance))throw new a("set end positions before getting endHeading");return this._endHeading}}}),m.prototype.setEndPoints=function(e,r){if(!n(e))throw new a("start cartographic position is required");if(!n(r))throw new a("end cartgraphic position is required");d(this,e,r,this._ellipsoid)},m.prototype.interpolateUsingFraction=function(e,r){return this.interpolateUsingSurfaceDistance(this._distance*e,r)},m.prototype.interpolateUsingSurfaceDistance=function(e,t){if(!n(this._distance))throw new a("start and end must be set before calling funciton interpolateUsingSurfaceDistance");var i=this._constants,o=i.distanceRatio+e/i.b,u=Math.cos(2*o),s=Math.cos(4*o),l=Math.cos(6*o),f=Math.sin(2*o),d=Math.sin(4*o),h=Math.sin(6*o),w=Math.sin(8*o),m=o*o,p=o*m,y=i.u8Over256,v=i.u2Over4,g=i.u6Over64,q=i.u4Over16,x=2*p*y*u/3+o*(1-v+7*q/4-15*g/4+579*y/64-(q-15*g/4+187*y/16)*u-(5*g/4-115*y/16)*s-29*y*l/16)+(v/2-q+71*g/32-85*y/16)*f+(5*q/16-5*g/4+383*y/96)*d-m*((g-11*y/2)*f+5*y*d/2)+(29*g/96-29*y/16)*h+539*y*w/1536,E=Math.asin(Math.sin(x)*i.cosineAlpha),b=Math.atan(i.a/i.b*Math.tan(E));x-=i.sigma;var S=Math.cos(2*i.sigma+x),_=Math.sin(x),M=Math.cos(x),O=i.cosineU*M,T=i.sineU*_,P=Math.atan2(_*i.sineHeading,O-T*i.cosineHeading),A=P-c(i.f,i.sineAlpha,i.cosineSquaredAlpha,x,_,M,S);return n(t)?(t.longitude=this._start.longitude+A,t.latitude=b,t.height=0,t):new r(this._start.longitude+A,b,0)},m}),define("Core/QuadraticRealPolynomial",["./DeveloperError","./Math"],function(e,r){"use strict";function t(e,t,n){var i=e+t;return r.sign(e)!==r.sign(t)&&Math.abs(i/Math.max(Math.abs(e),Math.abs(t)))<n?0:i}var n={};return n.computeDiscriminant=function(r,t,n){if("number"!=typeof r)throw new e("a is a required number.");if("number"!=typeof t)throw new e("b is a required number.");if("number"!=typeof n)throw new e("c is a required number.");var i=t*t-4*r*n;return i},n.computeRealRoots=function(n,i,a){if("number"!=typeof n)throw new e("a is a required number.");if("number"!=typeof i)throw new e("b is a required number.");if("number"!=typeof a)throw new e("c is a required number.");var o;if(0===n)return 0===i?[]:[-a/i];if(0===i){if(0===a)return[0,0];var u=Math.abs(a),s=Math.abs(n);if(s>u&&u/s<r.EPSILON14)return[0,0];if(u>s&&s/u<r.EPSILON14)return[];if(o=-a/n,0>o)return[];var l=Math.sqrt(o);return[-l,l]}if(0===a)return o=-i/n,0>o?[o,0]:[0,o];var c=i*i,f=4*n*a,d=t(c,-f,r.EPSILON14);if(0>d)return[];var h=-.5*t(i,r.sign(i)*Math.sqrt(d),r.EPSILON14);return i>0?[h/n,a/h]:[a/h,h/n]},n}),define("Core/CubicRealPolynomial",["./DeveloperError","./QuadraticRealPolynomial"],function(e,r){"use strict";function t(e,r,t,n){var i,a,o=e,u=r/3,s=t/3,l=n,c=o*s,f=u*l,d=u*u,h=s*s,w=o*s-d,m=o*l-u*s,p=u*l-h,y=4*w*p-m*m;if(0>y){var v,g,q;d*f>=c*h?(v=o,g=w,q=-2*u*w+o*m):(v=l,g=p,q=-l*m+2*s*p);var x=0>q?-1:1,E=-x*Math.abs(v)*Math.sqrt(-y);a=-q+E;var b=a/2,S=0>b?-Math.pow(-b,1/3):Math.pow(b,1/3),_=a===E?-S:-g/S;return i=0>=g?S+_:-q/(S*S+_*_+g),d*f>=c*h?[(i-u)/o]:[-l/(i+s)]}var M=w,O=-2*u*w+o*m,T=p,P=-l*m+2*s*p,A=Math.sqrt(y),R=Math.sqrt(3)/2,N=Math.abs(Math.atan2(o*A,-O)/3);i=2*Math.sqrt(-M);var z=Math.cos(N);a=i*z;var I=i*(-z/2-R*Math.sin(N)),C=a+I>2*u?a-u:I-u,D=o,U=C/D;N=Math.abs(Math.atan2(l*A,-P)/3),i=2*Math.sqrt(-T),z=Math.cos(N),a=i*z,I=i*(-z/2-R*Math.sin(N));var L=-l,B=2*s>a+I?a+s:I+s,F=L/B,W=D*B,G=-C*B-D*L,V=C*L,k=(s*G-u*V)/(-u*G+s*W);return k>=U?F>=U?F>=k?[U,k,F]:[U,F,k]:[F,U,k]:F>=U?[k,U,F]:F>=k?[k,F,U]:[F,k,U]}var n={};return n.computeDiscriminant=function(r,t,n,i){if("number"!=typeof r)throw new e("a is a required number.");if("number"!=typeof t)throw new e("b is a required number.");if("number"!=typeof n)throw new e("c is a required number.");if("number"!=typeof i)throw new e("d is a required number.");var a=r*r,o=t*t,u=n*n,s=i*i,l=18*r*t*n*i+o*u-27*a*s-4*(r*u*n+o*t*i);return l},n.computeRealRoots=function(n,i,a,o){if("number"!=typeof n)throw new e("a is a required number.");if("number"!=typeof i)throw new e("b is a required number.");if("number"!=typeof a)throw new e("c is a required number.");if("number"!=typeof o)throw new e("d is a required number.");var u,s;if(0===n)return r.computeRealRoots(i,a,o);if(0===i){if(0===a){if(0===o)return[0,0,0];s=-o/n;var l=0>s?-Math.pow(-s,1/3):Math.pow(s,1/3);return[l,l,l]}return 0===o?(u=r.computeRealRoots(n,0,a),0===u.Length?[0]:[u[0],0,u[1]]):t(n,0,a,o)}return 0===a?0===o?(s=-i/n,0>s?[s,0,0]:[0,0,s]):t(n,i,0,o):0===o?(u=r.computeRealRoots(n,i,a),0===u.length?[0]:u[1]<=0?[u[0],u[1],0]:u[0]>=0?[0,u[0],u[1]]:[u[0],0,u[1]]):t(n,i,a,o)},n}),define("Core/QuarticRealPolynomial",["./CubicRealPolynomial","./DeveloperError","./Math","./QuadraticRealPolynomial"],function(e,r,t,n){"use strict";function i(r,i,a,o){var u=r*r,s=i-3*u/8,l=a-i*r/2+u*r/8,c=o-a*r/4+i*u/16-3*u*u/256,f=e.computeRealRoots(1,2*s,s*s-4*c,-l*l);if(f.length>0){var d=-r/4,h=f[f.length-1];if(Math.abs(h)<t.EPSILON14){var w=n.computeRealRoots(1,s,c);if(2===w.length){var m,p=w[0],y=w[1];if(p>=0&&y>=0){var v=Math.sqrt(p),g=Math.sqrt(y);return[d-g,d-v,d+v,d+g]}if(p>=0&&0>y)return m=Math.sqrt(p),[d-m,d+m];if(0>p&&y>=0)return m=Math.sqrt(y),[d-m,d+m]}return[]}if(h>0){var q=Math.sqrt(h),x=(s+h-l/q)/2,E=(s+h+l/q)/2,b=n.computeRealRoots(1,q,x),S=n.computeRealRoots(1,-q,E);return 0!==b.length?(b[0]+=d,b[1]+=d,0!==S.length?(S[0]+=d,S[1]+=d,b[1]<=S[0]?[b[0],b[1],S[0],S[1]]:S[1]<=b[0]?[S[0],S[1],b[0],b[1]]:b[0]>=S[0]&&b[1]<=S[1]?[S[0],b[0],b[1],S[1]]:S[0]>=b[0]&&S[1]<=b[1]?[b[0],S[0],S[1],b[1]]:b[0]>S[0]&&b[0]<S[1]?[S[0],b[0],S[1],b[1]]:[b[0],S[0],b[1],S[1]]):b):0!==S.length?(S[0]+=d,S[1]+=d,S):[]}}return[]}function a(r,i,a,o){var u=a*a,s=i*i,l=r*r,c=-2*i,f=a*r+s-4*o,d=l*o-a*i*r+u,h=e.computeRealRoots(1,c,f,d);if(h.length>0){var w,m,p=h[0],y=i-p,v=y*y,g=r/2,q=y/2,x=v-4*o,E=v+4*Math.abs(o),b=l-4*p,S=l+4*Math.abs(p);if(0>p||b*E>x*S){var _=Math.sqrt(b);w=_/2,m=0===_?0:(r*q-a)/_}else{var M=Math.sqrt(x);w=0===M?0:(r*q-a)/M,m=M/2}var O,T;0===g&&0===w?(O=0,T=0):t.sign(g)===t.sign(w)?(O=g+w,T=p/O):(T=g-w,O=p/T);var P,A;0===q&&0===m?(P=0,A=0):t.sign(q)===t.sign(m)?(P=q+m,A=o/P):(A=q-m,P=o/A);var R=n.computeRealRoots(1,O,P),N=n.computeRealRoots(1,T,A);if(0!==R.length)return 0!==N.length?R[1]<=N[0]?[R[0],R[1],N[0],N[1]]:N[1]<=R[0]?[N[0],N[1],R[0],R[1]]:R[0]>=N[0]&&R[1]<=N[1]?[N[0],R[0],R[1],N[1]]:N[0]>=R[0]&&N[1]<=R[1]?[R[0],N[0],N[1],R[1]]:R[0]>N[0]&&R[0]<N[1]?[N[0],R[0],N[1],R[1]]:[R[0],N[0],R[1],N[1]]:R;if(0!==N.length)return N}return[]}var o={};return o.computeDiscriminant=function(e,t,n,i,a){if("number"!=typeof e)throw new r("a is a required number.");if("number"!=typeof t)throw new r("b is a required number.");if("number"!=typeof n)throw new r("c is a required number.");if("number"!=typeof i)throw new r("d is a required number.");if("number"!=typeof a)throw new r("e is a required number.");var o=e*e,u=o*e,s=t*t,l=s*t,c=n*n,f=c*n,d=i*i,h=d*i,w=a*a,m=w*a,p=s*c*d-4*l*h-4*e*f*d+18*e*t*n*h-27*o*d*d+256*u*m+a*(18*l*n*i-4*s*f+16*e*c*c-80*e*t*c*i-6*e*s*d+144*o*n*d)+w*(144*e*s*n-27*s*s-128*o*c-192*o*t*i);return p},o.computeRealRoots=function(n,o,u,s,l){if("number"!=typeof n)throw new r("a is a required number.");if("number"!=typeof o)throw new r("b is a required number.");if("number"!=typeof u)throw new r("c is a required number.");if("number"!=typeof s)throw new r("d is a required number.");if("number"!=typeof l)throw new r("e is a required number.");if(Math.abs(n)<t.EPSILON15)return e.computeRealRoots(o,u,s,l);var c=o/n,f=u/n,d=s/n,h=l/n,w=0>c?1:0;switch(w+=0>f?w+1:w,w+=0>d?w+1:w,w+=0>h?w+1:w){case 0:return i(c,f,d,h);case 1:return a(c,f,d,h);case 2:return a(c,f,d,h);case 3:return i(c,f,d,h);case 4:return i(c,f,d,h);case 5:return a(c,f,d,h);case 6:return i(c,f,d,h);case 7:return i(c,f,d,h);case 8:return a(c,f,d,h);case 9:return i(c,f,d,h);case 10:return i(c,f,d,h);case 11:return a(c,f,d,h);case 12:return i(c,f,d,h);case 13:return i(c,f,d,h);case 14:return i(c,f,d,h);case 15:return i(c,f,d,h);default:return void 0}},o}),define("Core/Ray",["./Cartesian3","./defaultValue","./defined","./DeveloperError"],function(e,r,t,n){"use strict";var i=function(t,n){n=e.clone(r(n,e.ZERO)),e.equals(n,e.ZERO)||e.normalize(n,n),this.origin=e.clone(r(t,e.ZERO)),this.direction=n};return i.getPoint=function(r,i,a){if(!t(r))throw new n("ray is requred");if("number"!=typeof i)throw new n("t is a required number");return t(a)||(a=new e),a=e.multiplyByScalar(r.direction,i,a),e.add(r.origin,a,a)},i}),define("Core/IntersectionTests",["./Cartesian3","./Cartographic","./defaultValue","./defined","./DeveloperError","./Math","./Matrix3","./QuadraticRealPolynomial","./QuarticRealPolynomial","./Ray"],function(e,r,t,n,i,a,o,u,s,l){"use strict";function c(r,o,u,s,l){if(!n(r))throw new i("ray is required.");if(!n(o))throw new i("p0 is required.");if(!n(u))throw new i("p1 is required.");if(!n(s))throw new i("p2 is required.");l=t(l,!1);var c,f,d,h,w,m=r.origin,x=r.direction,E=e.subtract(u,o,p),b=e.subtract(s,o,y),S=e.cross(x,b,v),_=e.dot(E,S);if(l){if(_<a.EPSILON6)return void 0;if(c=e.subtract(m,o,g),d=e.dot(c,S),0>d||d>_)return void 0;if(f=e.cross(c,E,q),h=e.dot(x,f),0>h||d+h>_)return void 0;w=e.dot(b,f)/_}else{if(Math.abs(_)<a.EPSILON6)return void 0;var M=1/_;if(c=e.subtract(m,o,g),d=e.dot(c,S)*M,0>d||d>1)return void 0;if(f=e.cross(c,E,q),h=e.dot(x,f)*M,0>h||d+h>1)return void 0;w=e.dot(b,f)*M}return w}function f(e,r,t,n){var i=r*r-4*e*t;if(0>i)return void 0;if(i>0){var a=1/(2*e),o=Math.sqrt(i),u=(-r+o)*a,s=(-r-o)*a;return s>u?(n.root0=u,n.root1=s):(n.root0=s,n.root1=u),n}var l=-r/(2*e);return 0===l?void 0:(n.root0=n.root1=l,n)}function d(r,t,i){n(i)||(i={});var a=r.origin,o=r.direction,u=t.center,s=t.radius*t.radius,l=e.subtract(a,u,v),c=e.dot(o,o),d=2*e.dot(o,l),h=e.magnitudeSquared(l)-s,w=f(c,d,h,E);return n(w)?(i.start=w.root0,i.stop=w.root1,i):void 0}function h(e,r,t){var n=e+r;return a.sign(e)!==a.sign(r)&&Math.abs(n/Math.max(Math.abs(e),Math.abs(r)))<t?0:n}function w(r,t,n,i,l){var c,f=i*i,d=l*l,w=(r[o.COLUMN1ROW1]-r[o.COLUMN2ROW2])*d,m=l*(i*h(r[o.COLUMN1ROW0],r[o.COLUMN0ROW1],a.EPSILON15)+t.y),p=r[o.COLUMN0ROW0]*f+r[o.COLUMN2ROW2]*d+i*t.x+n,y=d*h(r[o.COLUMN2ROW1],r[o.COLUMN1ROW2],a.EPSILON15),v=l*(i*h(r[o.COLUMN2ROW0],r[o.COLUMN0ROW2])+t.z),g=[];if(0===v&&0===y){if(c=u.computeRealRoots(w,m,p),0===c.length)return g;var q=c[0],x=Math.sqrt(Math.max(1-q*q,0));if(g.push(new e(i,l*q,l*-x)),g.push(new e(i,l*q,l*x)),2===c.length){var E=c[1],b=Math.sqrt(Math.max(1-E*E,0));g.push(new e(i,l*E,l*-b)),g.push(new e(i,l*E,l*b))}return g}var S=v*v,_=y*y,M=w*w,O=v*y,T=M+_,P=2*(m*w+O),A=2*p*w+m*m-_+S,R=2*(p*m-O),N=p*p-S;if(0===T&&0===P&&0===A&&0===R)return g;c=s.computeRealRoots(T,P,A,R,N);var z=c.length;if(0===z)return g;for(var I=0;z>I;++I){var C,D=c[I],U=D*D,L=Math.max(1-U,0),B=Math.sqrt(L);C=a.sign(w)===a.sign(p)?h(w*U+p,m*D,a.EPSILON12):a.sign(p)===a.sign(m*D)?h(w*U,m*D+p,a.EPSILON12):h(w*U+m*D,p,a.EPSILON12);var F=h(y*D,v,a.EPSILON15),W=C*F;0>W?g.push(new e(i,l*D,l*B)):W>0?g.push(new e(i,l*D,l*-B)):0!==B?(g.push(new e(i,l*D,l*-B)),g.push(new e(i,l*D,l*B)),++I):g.push(new e(i,l*D,l*B))}return g}var m={};m.rayPlane=function(r,t,o){if(!n(r))throw new i("ray is required.");if(!n(t))throw new i("plane is required.");n(o)||(o=new e);var u=r.origin,s=r.direction,l=t.normal,c=e.dot(l,s);if(Math.abs(c)<a.EPSILON15)return void 0;var f=(-t.distance-e.dot(l,u))/c;return 0>f?void 0:(o=e.multiplyByScalar(s,f,o),e.add(u,o,o))};var p=new e,y=new e,v=new e,g=new e,q=new e;m.rayTriangle=function(r,t,i,a,o,u){var s=c(r,t,i,a,o);return!n(s)||0>s?void 0:(n(u)||(u=new e),e.multiplyByScalar(r.direction,s,u),e.add(r.origin,u,u))};var x=new l;m.lineSegmentTriangle=function(r,t,a,o,u,s,l){if(!n(r))throw new i("v0 is required.");if(!n(t))throw new i("v1 is required.");var f=x;e.clone(r,f.origin),e.subtract(t,r,f.direction),e.normalize(f.direction,f.direction);var d=c(f,a,o,u,s);return!n(d)||0>d||d>e.distance(r,t)?void 0:(n(l)||(l=new e),e.multiplyByScalar(f.direction,d,l),e.add(f.origin,l,l))};var E={root0:0,root1:0};m.raySphere=function(e,r,t){if(!n(e))throw new i("ray is required.");if(!n(r))throw new i("sphere is required.");return t=d(e,r,t),!n(t)||t.stop<0?void 0:(t.start=Math.max(t.start,0),t)};var b=new l;m.lineSegmentSphere=function(r,t,a,o){if(!n(r))throw new i("p0 is required.");if(!n(t))throw new i("p1 is required.");if(!n(a))throw new i("sphere is required.");var u=b;e.clone(r,u.origin);var s=e.subtract(t,r,u.direction),l=e.magnitude(s);return e.normalize(s,s),o=d(u,a,o),!n(o)||o.stop<0||o.start>l?void 0:(o.start=Math.max(o.start,0),o.stop=Math.min(o.stop,l),o)};var S=new e,_=new e;m.rayEllipsoid=function(r,t){if(!n(r))throw new i("ray is required.");if(!n(t))throw new i("ellipsoid is required.");var a,o,u,s,l,c=t.oneOverRadii,f=e.multiplyComponents(c,r.origin,S),d=e.multiplyComponents(c,r.direction,_),h=e.magnitudeSquared(f),w=e.dot(f,d);if(h>1){if(w>=0)return void 0;var m=w*w;if(a=h-1,o=e.magnitudeSquared(d),u=o*a,u>m)return void 0;if(m>u){s=w*w-u,l=-w+Math.sqrt(s);var p=l/o,y=a/l;return y>p?{start:p,stop:y}:{start:y,stop:p}}var v=Math.sqrt(a/o);return{start:v,stop:v}}return 1>h?(a=h-1,o=e.magnitudeSquared(d),u=o*a,s=w*w-u,l=-w+Math.sqrt(s),{start:0,stop:l/o}):0>w?(o=e.magnitudeSquared(d),{start:0,stop:-w/o}):void 0};var M=new e,O=new e,T=new e,P=new e,A=new e,R=new o,N=new o,z=new o,I=new o,C=new o,D=new o,U=new o,L=new e,B=new e,F=new r;m.grazingAltitudeLocation=function(r,t){if(!n(r))throw new i("ray is required.");if(!n(t))throw new i("ellipsoid is required.");var u=r.origin,s=r.direction,l=t.geodeticSurfaceNormal(u,M);if(e.dot(s,l)>=0)return u;var c=n(this.rayEllipsoid(r,t)),f=t.transformPositionToScaledSpace(s,M),d=e.normalize(f,f),h=e.mostOrthogonalAxis(f,P),m=e.normalize(e.cross(h,d,O),O),p=e.normalize(e.cross(d,m,T),T),y=R;y[0]=d.x,y[1]=d.y,y[2]=d.z,y[3]=m.x,y[4]=m.y,y[5]=m.z,y[6]=p.x,y[7]=p.y,y[8]=p.z;var v=o.transpose(y,N),g=o.fromScale(t.radii,z),q=o.fromScale(t.oneOverRadii,I),x=C;x[0]=0,x[1]=-s.z,x[2]=s.y,x[3]=s.z,x[4]=0,x[5]=-s.x,x[6]=-s.y,x[7]=s.x,x[8]=0;var E,b,S=o.multiply(o.multiply(v,q,D),x,D),_=o.multiply(o.multiply(S,g,U),y,U),W=o.multiplyByVector(S,u,A),G=w(_,e.negate(W,M),0,0,1),V=G.length;if(V>0){for(var k=e.clone(e.ZERO,B),j=Number.NEGATIVE_INFINITY,Y=0;V>Y;++Y){E=o.multiplyByVector(g,o.multiplyByVector(y,G[Y],L),L);var H=e.normalize(e.subtract(E,u,P),P),Z=e.dot(H,s);Z>j&&(j=Z,k=e.clone(E,k))}var X=t.cartesianToCartographic(k,F);return j=a.clamp(j,0,1),b=e.magnitude(e.subtract(k,u,P))*Math.sqrt(1-j*j),b=c?-b:b,X.height=b,t.cartographicToCartesian(X,new e)}return void 0};var W=new e;return m.lineSegmentPlane=function(r,t,o,u){if(!n(r))throw new i("endPoint0 is required.");if(!n(t))throw new i("endPoint1 is required.");if(!n(o))throw new i("plane is required.");n(u)||(u=new e);var s=e.subtract(t,r,W),l=o.normal,c=e.dot(l,s);if(Math.abs(c)<a.EPSILON6)return void 0;var f=e.dot(l,r),d=-(o.distance+f)/c;return 0>d||d>1?void 0:(e.multiplyByScalar(s,d,u),e.add(r,u,u),u)},m.trianglePlaneIntersection=function(r,t,a,o){if(!(n(r)&&n(t)&&n(a)&&n(o)))throw new i("p0, p1, p2, and plane are required.");var u=o.normal,s=o.distance,l=e.dot(u,r)+s<0,c=e.dot(u,t)+s<0,f=e.dot(u,a)+s<0,d=0;d+=l?1:0,d+=c?1:0,d+=f?1:0;var h,w;if((1===d||2===d)&&(h=new e,w=new e),1===d){if(l)return m.lineSegmentPlane(r,t,o,h),m.lineSegmentPlane(r,a,o,w),{positions:[r,t,a,h,w],indices:[0,3,4,1,2,4,1,4,3]};if(c)return m.lineSegmentPlane(t,a,o,h),m.lineSegmentPlane(t,r,o,w),{positions:[r,t,a,h,w],indices:[1,3,4,2,0,4,2,4,3]};if(f)return m.lineSegmentPlane(a,r,o,h),m.lineSegmentPlane(a,t,o,w),{positions:[r,t,a,h,w],indices:[2,3,4,0,1,4,0,4,3]}}else if(2===d){if(!l)return m.lineSegmentPlane(t,r,o,h),m.lineSegmentPlane(a,r,o,w),{positions:[r,t,a,h,w],indices:[1,2,4,1,4,3,0,3,4]};if(!c)return m.lineSegmentPlane(a,t,o,h),m.lineSegmentPlane(r,t,o,w),{positions:[r,t,a,h,w],indices:[2,0,4,2,4,3,1,3,4]};if(!f)return m.lineSegmentPlane(r,a,o,h),m.lineSegmentPlane(t,a,o,w),{positions:[r,t,a,h,w],indices:[0,1,4,0,4,3,2,3,4]}}return void 0},m}),define("Core/Plane",["./Cartesian3","./defined","./DeveloperError"],function(e,r,t){"use strict";var n=function(n,i){if(!r(n))throw new t("normal is required.");if(!r(i))throw new t("distance is required.");this.normal=e.clone(n),this.distance=i};return n.fromPointNormal=function(i,a,o){if(!r(i))throw new t("point is required.");if(!r(a))throw new t("normal is required.");var u=-e.dot(a,i);return r(o)?(e.clone(a,o.normal),o.distance=u,o):new n(a,u)},n.getPointDistance=function(n,i){if(!r(n))throw new t("plane is required.");if(!r(i))throw new t("point is required.");return e.dot(n.normal,i)+n.distance},n}),define("Core/PolylinePipeline",["./Cartesian3","./Cartographic","./defaultValue","./defined","./DeveloperError","./Ellipsoid","./EllipsoidGeodesic","./IntersectionTests","./isArray","./Math","./Matrix4","./Plane"],function(e,r,t,n,i,a,o,u,s,l,c,f){"use strict";
  function d(e,r,t){var n=S;n.length=e;var i;if(r===t){for(i=0;e>i;i++)n[i]=r;return n}var a=t-r,o=a/e;for(i=0;e>i;i++){var u=r+i*o;n[i]=u}return n}function h(r,t,n,i,a,o,u,s){var l=i.scaleToGeodeticSurface(r,T),c=i.scaleToGeodeticSurface(t,P),f=w.numberOfPoints(r,t,n),h=i.cartesianToCartographic(l,_),m=i.cartesianToCartographic(c,M),p=d(f,a,o);A.setEndPoints(h,m);var y=A.surfaceDistance/f,v=s;h.height=a;var g=i.cartographicToCartesian(h,O);e.pack(g,u,v),v+=3;for(var q=1;f>q;q++){var x=A.interpolateUsingSurfaceDistance(q*y,M);x.height=p[q],g=i.cartographicToCartesian(x,O),e.pack(g,u,v),v+=3}return v}var w={};w.numberOfPoints=function(r,t,n){var i=e.distance(r,t);return Math.ceil(i/n)};var m=new r;w.extractHeights=function(e,r){for(var t=e.length,n=new Array(t),i=0;t>i;i++){var a=e[i];n[i]=r.cartesianToCartographic(a,m).height}return n};var p=new c,y=new e,v=new e,g=new f(e.ZERO,0),q=new e,x=new f(e.ZERO,0),E=new e,b=new e,S=[],_=new r,M=new r,O=new e,T=new e,P=new e,A=new o;w.wrapLongitude=function(r,i){var a=[],o=[];if(n(r)&&r.length>0){i=t(i,c.IDENTITY);var s=c.inverseTransformation(i,p),l=c.multiplyByPoint(s,e.ZERO,y),d=c.multiplyByPointAsVector(s,e.UNIT_Y,v),h=f.fromPointNormal(l,d,g),w=c.multiplyByPointAsVector(s,e.UNIT_X,q),m=f.fromPointNormal(l,w,x),S=1;a.push(e.clone(r[0]));for(var _=a[0],M=r.length,O=1;M>O;++O){var T=r[O];if(f.getPointDistance(m,_)<0||f.getPointDistance(m,T)<0){var P=u.lineSegmentPlane(_,T,h,E);if(n(P)){var A=e.multiplyByScalar(d,5e-9,b);f.getPointDistance(h,_)<0&&e.negate(A,A),a.push(e.add(P,A,new e)),o.push(S+1),e.negate(A,A),a.push(e.add(P,A,new e)),S=1}}a.push(e.clone(r[O])),S++,_=T}o.push(S)}return{positions:a,lengths:o}};var R=l.EPSILON7;return w.removeDuplicates=function(r){if(!n(r))throw new i("positions is required.");var t=r.length;if(2>t)return void 0;var a,o,u;for(a=1;t>a&&(o=r[a-1],u=r[a],!e.equalsEpsilon(o,u,R));++a);if(a===t)return void 0;for(var s=r.slice(0,a);t>a;++a)u=r[a],e.equalsEpsilon(o,u,R)||(s.push(e.clone(u)),o=u);return s},w.generateArc=function(r){n(r)||(r={});var o=r.positions;if(!n(o))throw new i("options.positions is required.");var u=t(r.ellipsoid,a.WGS84),c=t(r.height,0),f=r.minDistance;if(!n(f)){var d=t(r.granularity,l.RADIANS_PER_DEGREE);f=l.chordLength(d,u.maximumRadius)}var m,p=o.length,y=0;for(m=0;p-1>m;m++)y+=w.numberOfPoints(o[m],o[m+1],f);var v=3*(y+1),g=new Array(v),q=0,x=s(c);for(m=0;p-1>m;m++){var E=o[m],b=o[m+1],M=x?c[m]:c,T=x?c[m+1]:c;q=h(E,b,f,u,M,T,g,q)}S.length=0;var P=o[p-1],A=u.cartesianToCartographic(P,_);A.height=x?c[p-1]:c;var R=u.cartographicToCartesian(A,O);return e.pack(R,g,v-3),g},w.generateCartesianArc=function(r){for(var t=w.generateArc(r),n=t.length/3,i=new Array(n),a=0;n>a;a++)i[a]=e.unpack(t,3*a);return i},w}),define("Core/Cartesian2",["./defaultValue","./defined","./DeveloperError","./freezeObject","./Math"],function(e,r,t,n,i){"use strict";var a=function(r,t){this.x=e(r,0),this.y=e(t,0)};a.fromElements=function(e,t,n){return r(n)?(n.x=e,n.y=t,n):new a(e,t)},a.clone=function(e,t){return r(e)?r(t)?(t.x=e.x,t.y=e.y,t):new a(e.x,e.y):void 0},a.fromCartesian3=a.clone,a.fromCartesian4=a.clone,a.packedLength=2,a.pack=function(n,i,a){if(!r(n))throw new t("value is required");if(!r(i))throw new t("array is required");a=e(a,0),i[a++]=n.x,i[a]=n.y},a.unpack=function(n,i,o){if(!r(n))throw new t("array is required");return i=e(i,0),r(o)||(o=new a),o.x=n[i++],o.y=n[i],o},a.fromArray=a.unpack,a.maximumComponent=function(e){if(!r(e))throw new t("cartesian is required");return Math.max(e.x,e.y)},a.minimumComponent=function(e){if(!r(e))throw new t("cartesian is required");return Math.min(e.x,e.y)},a.minimumByComponent=function(e,n,i){if(!r(e))throw new t("first is required.");if(!r(n))throw new t("second is required.");if(!r(i))throw new t("result is required.");return i.x=Math.min(e.x,n.x),i.y=Math.min(e.y,n.y),i},a.maximumByComponent=function(e,n,i){if(!r(e))throw new t("first is required.");if(!r(n))throw new t("second is required.");if(!r(i))throw new t("result is required.");return i.x=Math.max(e.x,n.x),i.y=Math.max(e.y,n.y),i},a.magnitudeSquared=function(e){if(!r(e))throw new t("cartesian is required");return e.x*e.x+e.y*e.y},a.magnitude=function(e){return Math.sqrt(a.magnitudeSquared(e))};var o=new a;a.distance=function(e,n){if(!r(e)||!r(n))throw new t("left and right are required.");return a.subtract(e,n,o),a.magnitude(o)},a.distanceSquared=function(e,n){if(!r(e)||!r(n))throw new t("left and right are required.");return a.subtract(e,n,o),a.magnitudeSquared(o)},a.normalize=function(e,n){if(!r(e))throw new t("cartesian is required");if(!r(n))throw new t("result is required");var i=a.magnitude(e);return n.x=e.x/i,n.y=e.y/i,n},a.dot=function(e,n){if(!r(e))throw new t("left is required");if(!r(n))throw new t("right is required");return e.x*n.x+e.y*n.y},a.multiplyComponents=function(e,n,i){if(!r(e))throw new t("left is required");if(!r(n))throw new t("right is required");if(!r(i))throw new t("result is required");return i.x=e.x*n.x,i.y=e.y*n.y,i},a.add=function(e,n,i){if(!r(e))throw new t("left is required");if(!r(n))throw new t("right is required");if(!r(i))throw new t("result is required");return i.x=e.x+n.x,i.y=e.y+n.y,i},a.subtract=function(e,n,i){if(!r(e))throw new t("left is required");if(!r(n))throw new t("right is required");if(!r(i))throw new t("result is required");return i.x=e.x-n.x,i.y=e.y-n.y,i},a.multiplyByScalar=function(e,n,i){if(!r(e))throw new t("cartesian is required");if("number"!=typeof n)throw new t("scalar is required and must be a number.");if(!r(i))throw new t("result is required");return i.x=e.x*n,i.y=e.y*n,i},a.divideByScalar=function(e,n,i){if(!r(e))throw new t("cartesian is required");if("number"!=typeof n)throw new t("scalar is required and must be a number.");if(!r(i))throw new t("result is required");return i.x=e.x/n,i.y=e.y/n,i},a.negate=function(e,n){if(!r(e))throw new t("cartesian is required");if(!r(n))throw new t("result is required");return n.x=-e.x,n.y=-e.y,n},a.abs=function(e,n){if(!r(e))throw new t("cartesian is required");if(!r(n))throw new t("result is required");return n.x=Math.abs(e.x),n.y=Math.abs(e.y),n};var u=new a;a.lerp=function(e,n,i,o){if(!r(e))throw new t("start is required.");if(!r(n))throw new t("end is required.");if("number"!=typeof i)throw new t("t is required and must be a number.");if(!r(o))throw new t("result is required.");return a.multiplyByScalar(n,i,u),o=a.multiplyByScalar(e,1-i,o),a.add(u,o,o)};var s=new a,l=new a;a.angleBetween=function(e,n){if(!r(e))throw new t("left is required");if(!r(n))throw new t("right is required");return a.normalize(e,s),a.normalize(n,l),i.acosClamped(a.dot(s,l))};var c=new a;return a.mostOrthogonalAxis=function(e,n){if(!r(e))throw new t("cartesian is required.");if(!r(n))throw new t("result is required.");var i=a.normalize(e,c);return a.abs(i,i),n=i.x<=i.y?a.clone(a.UNIT_X,n):a.clone(a.UNIT_Y,n)},a.equals=function(e,t){return e===t||r(e)&&r(t)&&e.x===t.x&&e.y===t.y},a.equalsArray=function(e,r,t){return e.x===r[t]&&e.y===r[t+1]},a.equalsEpsilon=function(e,t,n,a){return e===t||r(e)&&r(t)&&i.equalsEpsilon(e.x,t.x,n,a)&&i.equalsEpsilon(e.y,t.y,n,a)},a.ZERO=n(new a(0,0)),a.UNIT_X=n(new a(1,0)),a.UNIT_Y=n(new a(0,1)),a.prototype.clone=function(e){return a.clone(this,e)},a.prototype.equals=function(e){return a.equals(this,e)},a.prototype.equalsEpsilon=function(e,r,t){return a.equalsEpsilon(this,e,r,t)},a.prototype.toString=function(){return"("+this.x+", "+this.y+")"},a}),define("Core/AxisAlignedBoundingBox",["./Cartesian3","./defaultValue","./defined","./DeveloperError","./Intersect"],function(e,r,t,n,i){"use strict";var a=function(n,i,a){this.minimum=e.clone(r(n,e.ZERO)),this.maximum=e.clone(r(i,e.ZERO)),t(a)?a=e.clone(a):(a=e.add(this.minimum,this.maximum,new e),e.multiplyByScalar(a,.5,a)),this.center=a};a.fromPoints=function(r,n){if(t(n)||(n=new a),!t(r)||0===r.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 i=r[0].x,o=r[0].y,u=r[0].z,s=r[0].x,l=r[0].y,c=r[0].z,f=r.length,d=1;f>d;d++){var h=r[d],w=h.x,m=h.y,p=h.z;i=Math.min(w,i),s=Math.max(w,s),o=Math.min(m,o),l=Math.max(m,l),u=Math.min(p,u),c=Math.max(p,c)}var y=n.minimum;y.x=i,y.y=o,y.z=u;var v=n.maximum;v.x=s,v.y=l,v.z=c;var g=e.add(y,v,n.center);return e.multiplyByScalar(g,.5,g),n},a.clone=function(r,n){return t(r)?t(n)?(n.minimum=e.clone(r.minimum,n.minimum),n.maximum=e.clone(r.maximum,n.maximum),n.center=e.clone(r.center,n.center),n):new a(r.minimum,r.maximum):void 0},a.equals=function(r,n){return r===n||t(r)&&t(n)&&e.equals(r.center,n.center)&&e.equals(r.minimum,n.minimum)&&e.equals(r.maximum,n.maximum)};var o=new e;return a.intersect=function(r,a){if(!t(r))throw new n("box is required.");if(!t(a))throw new n("plane is required.");o=e.subtract(r.maximum,r.minimum,o);var u=e.multiplyByScalar(o,.5,o),s=u.x*Math.abs(a.x)+u.y*Math.abs(a.y)+u.z*Math.abs(a.z),l=e.dot(r.center,a)+a.w;return l-s>0?i.INSIDE:0>l+s?i.OUTSIDE:i.INTERSECTING},a.prototype.clone=function(e){return a.clone(this,e)},a.prototype.intersect=function(e){return a.intersect(this,e)},a.prototype.equals=function(e){return a.equals(this,e)},a}),function(e){"use strict";e("ThirdParty/when",[],function(){function e(e,t,n,i){return r(e).then(t,n,i)}function r(e){var r,t;return e instanceof n?r=e:u(e)?(t=o(),e.then(function(e){t.resolve(e)},function(e){t.reject(e)},function(e){t.progress(e)}),r=t.promise):r=i(e),r}function t(r){return e(r,a)}function n(e){this.then=e}function i(e){var t=new n(function(t){try{return r(t?t(e):e)}catch(n){return a(n)}});return t}function a(e){var t=new n(function(t,n){try{return n?r(n(e)):a(e)}catch(i){return a(i)}});return t}function o(){function e(e,r,t){return d(e,r,t)}function t(e){return w(e)}function i(e){return w(a(e))}function u(e){return h(e)}var s,l,c,f,d,h,w;return l=new n(e),s={then:e,resolve:t,reject:i,progress:u,promise:l,resolver:{resolve:t,reject:i,progress:u}},c=[],f=[],d=function(e,r,t){var n,i;return n=o(),i="function"==typeof t?function(e){try{n.progress(t(e))}catch(r){n.progress(r)}}:function(e){n.progress(e)},c.push(function(t){t.then(e,r).then(n.resolve,n.reject,i)}),f.push(i),n.promise},h=function(e){return m(f,e),e},w=function(e){return e=r(e),d=e.then,w=r,h=y,m(c,e),f=c=x,e},s}function u(e){return e&&"function"==typeof e.then}function s(r,t,n,i,a){return p(2,arguments),e(r,function(r){function u(e){m(e)}function s(e){w(e)}var l,c,f,d,h,w,m,p,v,g;if(v=r.length>>>0,l=Math.max(0,Math.min(t,v)),f=[],c=v-l+1,d=[],h=o(),l)for(p=h.progress,m=function(e){d.push(e),--c||(w=m=y,h.reject(d))},w=function(e){f.push(e),--l||(w=m=y,h.resolve(f))},g=0;v>g;++g)g in r&&e(r[g],s,u,p);else h.resolve(f);return h.then(n,i,a)})}function l(e,r,t,n){function i(e){return r?r(e[0]):e[0]}return s(e,1,i,t,n)}function c(e,r,t,n){return p(1,arguments),d(e,v).then(r,t,n)}function f(){return d(arguments,v)}function d(r,t){return e(r,function(r){var n,i,a,u,s,l;if(a=i=r.length>>>0,n=[],l=o(),a)for(u=function(r,i){e(r,t).then(function(e){n[i]=e,--a||l.resolve(n)},l.reject)},s=0;i>s;s++)s in r?u(r[s],s):--a;else l.resolve(n);return l.promise})}function h(r,t){var n=q.call(arguments,1);return e(r,function(r){var i;return i=r.length,n[0]=function(r,n,a){return e(r,function(r){return e(n,function(e){return t(r,e,a,i)})})},g.apply(r,n)})}function w(r,t,n){var i=arguments.length>2;return e(r,function(e){return e=i?n:e,t.resolve(e),e},function(e){return t.reject(e),a(e)},t.progress)}function m(e,r){for(var t,n=0;t=e[n++];)t(r)}function p(e,r){for(var t,n=r.length;n>e;)if(t=r[--n],null!=t&&"function"!=typeof t)throw new Error("arg "+n+" must be a function")}function y(){}function v(e){return e}var g,q,x;return e.defer=o,e.resolve=r,e.reject=t,e.join=f,e.all=c,e.map=d,e.reduce=h,e.any=l,e.some=s,e.chain=w,e.isPromise=u,n.prototype={always:function(e,r){return this.then(e,e,r)},otherwise:function(e){return this.then(x,e)},yield:function(e){return this.then(function(){return e})},spread:function(e){return this.then(function(r){return c(r,function(r){return e.apply(x,r)})})}},q=[].slice,g=[].reduce||function(e){var r,t,n,i,a;if(a=0,r=Object(this),i=r.length>>>0,t=arguments,t.length<=1)for(;;){if(a in r){n=r[a++];break}if(++a>=i)throw new TypeError}else n=t[1];for(;i>a;++a)a in r&&(n=e(n,r[a],a,r));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(e,r){"use strict";var t=function(t,n,i){if(!e(t))throw new r("array is required.");if(!e(n))throw new r("itemToFind is required.");if(!e(i))throw new r("comparator is required.");for(var a,o,u=0,s=t.length-1;s>=u;)if(a=~~((u+s)/2),o=i(t[a],n),0>o)u=a+1;else{if(!(o>0))return a;s=a-1}return~(s+1)};return t}),define("Core/EarthOrientationParametersSample",[],function(){"use strict";var e=function(e,r,t,n,i){this.xPoleWander=e,this.yPoleWander=r,this.xPoleOffset=t,this.yPoleOffset=n,this.ut1MinusUtc=i};return e}),define("ThirdParty/sprintf",[],function(){function e(){var e=/%%|%(\d+\$)?([-+\'#0 ]*)(\*\d+\$|\*|\d+)?(\.(\*\d+\$|\*|\d+))?([scboxXuideEfFgG])/g,r=arguments,t=0,n=r[t++],i=function(e,r,t,n){t||(t=" ");var i=e.length>=r?"":Array(1+r-e.length>>>0).join(t);return n?e+i:i+e},a=function(e,r,t,n,a,o){var u=n-e.length;return u>0&&(e=t||!a?i(e,n,o,t):e.slice(0,r.length)+i("",u,"0",!0)+e.slice(r.length)),e},o=function(e,r,t,n,o,u,s){var l=e>>>0;return t=t&&l&&{2:"0b",8:"0",16:"0x"}[r]||"",e=t+i(l.toString(r),u||0,"0",!1),a(e,t,n,o,s)},u=function(e,r,t,n,i,o){return null!=n&&(e=e.slice(0,n)),a(e,"",r,t,i,o)},s=function(e,n,s,l,c,f,d){var h,w,m,p,y;if("%%"==e)return"%";for(var v=!1,g="",q=!1,x=!1,E=" ",b=s.length,S=0;s&&b>S;S++)switch(s.charAt(S)){case" ":g=" ";break;case"+":g="+";break;case"-":v=!0;break;case"'":E=s.charAt(S+1);break;case"0":q=!0;break;case"#":x=!0}if(l=l?"*"==l?+r[t++]:"*"==l.charAt(0)?+r[l.slice(1,-1)]:+l:0,0>l&&(l=-l,v=!0),!isFinite(l))throw new Error("sprintf: (minimum-)width must be finite");switch(f=f?"*"==f?+r[t++]:"*"==f.charAt(0)?+r[f.slice(1,-1)]:+f:"fFeE".indexOf(d)>-1?6:"d"==d?0:void 0,y=n?r[n.slice(0,-1)]:r[t++],d){case"s":return u(String(y),v,l,f,q,E);case"c":return u(String.fromCharCode(+y),v,l,f,q);case"b":return o(y,2,x,v,l,f,q);case"o":return o(y,8,x,v,l,f,q);case"x":return o(y,16,x,v,l,f,q);case"X":return o(y,16,x,v,l,f,q).toUpperCase();case"u":return o(y,10,x,v,l,f,q);case"i":case"d":return h=+y||0,h=Math.round(h-h%1),w=0>h?"-":g,y=w+i(String(Math.abs(h)),f,"0",!1),a(y,w,v,l,q);case"e":case"E":case"f":case"F":case"g":case"G":return h=+y,w=0>h?"-":g,m=["toExponential","toFixed","toPrecision"]["efg".indexOf(d.toLowerCase())],p=["toString","toUpperCase"]["eEfFgG".indexOf(d)%2],y=w+Math.abs(h)[m](f),a(y,w,v,l,q)[p]();default:return e}};return n.replace(e,s)}return e}),define("Core/GregorianDate",[],function(){"use strict";var e=function(e,r,t,n,i,a,o,u){this.year=e,this.month=r,this.day=t,this.hour=n,this.minute=i,this.second=a,this.millisecond=o,this.isLeapSecond=u};return e}),define("Core/isLeapYear",["./DeveloperError"],function(e){"use strict";function r(r){if(null===r||isNaN(r))throw new e("year is required and must be a number.");return 0===r%4&&0!==r%100||0===r%400}return r}),define("Core/LeapSecond",[],function(){"use strict";var e=function(e,r){this.julianDate=e,this.offset=r};return e}),define("Core/TimeConstants",["./freezeObject"],function(e){"use strict";var r={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(r)}),define("Core/TimeStandard",["./freezeObject"],function(e){"use strict";var r={UTC:0,TAI:1};return e(r)}),define("Core/JulianDate",["../ThirdParty/sprintf","./binarySearch","./defaultValue","./defined","./DeveloperError","./GregorianDate","./isLeapYear","./LeapSecond","./TimeConstants","./TimeStandard"],function(e,r,t,n,i,a,o,u,s,l){"use strict";function c(e,r){return P.compare(e.julianDate,r.julianDate)}function f(e){v.julianDate=e;var t=P.leapSeconds,n=r(t,v,c);0>n&&(n=~n),n>=t.length&&(n=t.length-1);var i=t[n].offset;if(n>0){var a=P.secondsDifference(t[n].julianDate,e);a>i&&(n--,i=t[n].offset)}P.addSeconds(e,i,e)}function d(e,t){v.julianDate=e;var n=P.leapSeconds,i=r(n,v,c);if(0>i&&(i=~i),0===i)return P.addSeconds(e,-n[0].offset,t);if(i>=n.length)return P.addSeconds(e,-n[i-1].offset,t);var a=P.secondsDifference(n[i].julianDate,e);return 0===a?P.addSeconds(e,-n[i].offset,t):1>=a?void 0:P.addSeconds(e,-n[--i].offset,t)}function h(e,r,t){var n=0|r/s.SECONDS_PER_DAY;return e+=n,r-=s.SECONDS_PER_DAY*n,0>r&&(e--,r+=s.SECONDS_PER_DAY),t.dayNumber=e,t.secondsOfDay=r,t}function w(e,r,t,n,i,a,o){var u=0|(r-14)/12,l=e+4800+u,c=(0|1461*l/4)+(0|367*(r-2-12*u)/12)-(0|3*((l+100)/100)/4)+t-32075;n-=12,0>n&&(n+=24);var f=a+(n*s.SECONDS_PER_HOUR+i*s.SECONDS_PER_MINUTE+o*s.SECONDS_PER_MILLISECOND);return f>=43200&&(c-=1),[c,f]}var m=new a,p=[31,28,31,30,31,30,31,31,30,31,30,31],y=29,v=new u,g=/^(\d{4})$/,q=/^(\d{4})-(\d{2})$/,x=/^(\d{4})-?(\d{3})$/,E=/^(\d{4})-?W(\d{2})-?(\d{1})?$/,b=/^(\d{4})-?(\d{2})-?(\d{2})$/,S=/([Z+\-])?(\d{2})?:?(\d{2})?$/,_=/^(\d{2})(\.\d+)?/.source+S.source,M=/^(\d{2}):?(\d{2})(\.\d+)?/.source+S.source,O=/^(\d{2}):?(\d{2}):?(\d{2})(\.\d+)?/.source+S.source,T="Invalid ISO 8601 date.",P=function(e,r,n){this.dayNumber=void 0,this.secondsOfDay=void 0,e=t(e,0),r=t(r,0),n=t(n,l.UTC);var i=0|e;r+=(e-i)*s.SECONDS_PER_DAY,h(i,r,this),n===l.UTC&&f(this)};P.fromDate=function(e,r){if(!(e instanceof Date)||isNaN(e.getTime()))throw new i("date must be a valid JavaScript Date.");var t=w(e.getUTCFullYear(),e.getUTCMonth()+1,e.getUTCDate(),e.getUTCHours(),e.getUTCMinutes(),e.getUTCSeconds(),e.getUTCMilliseconds());return n(r)?(h(t[0],t[1],r),f(r),r):new P(t[0],t[1],l.UTC)},P.fromIso8601=function(e,r){if("string"!=typeof e)throw new i(T);e=e.replace(",",".");var t,a,u,s=e.split("T"),c=1,d=1,m=0,v=0,S=0,A=0,R=s[0],N=s[1];if(!n(R))throw new i(T);var z;if(s=R.match(b),null!==s){if(z=R.split("-").length-1,z>0&&2!==z)throw new i(T);t=+s[1],c=+s[2],d=+s[3]}else if(s=R.match(q),null!==s)t=+s[1],c=+s[2];else if(s=R.match(g),null!==s)t=+s[1];else{var I;if(s=R.match(x),null!==s){if(t=+s[1],I=+s[2],u=o(t),1>I||u&&I>366||!u&&I>365)throw new i(T)}else{if(s=R.match(E),null===s)throw new i(T);t=+s[1];var C=+s[2],D=+s[3]||0;if(z=R.split("-").length-1,z>0&&(!n(s[3])&&1!==z||n(s[3])&&2!==z))throw new i(T);var U=new Date(Date.UTC(t,0,4));I=7*C+D-U.getUTCDay()-3}a=new Date(Date.UTC(t,0,1)),a.setUTCDate(I),c=a.getUTCMonth()+1,d=a.getUTCDate()}if(u=o(t),1>c||c>12||1>d||(2!==c||!u)&&d>p[c-1]||u&&2===c&&d>y)throw new i(T);var L;if(n(N)){if(s=N.match(O),null!==s){if(z=N.split(":").length-1,z>0&&2!==z&&3!==z)throw new i(T);m=+s[1],v=+s[2],S=+s[3],A=1e3*+(s[4]||0),L=5}else if(s=N.match(M),null!==s){if(z=N.split(":").length-1,z>0&&1!==z)throw new i(T);m=+s[1],v=+s[2],S=60*+(s[3]||0),L=4}else{if(s=N.match(_),null===s)throw new i(T);m=+s[1],v=60*+(s[2]||0),L=3}if(v>=60||S>=61||m>24||24===m&&(v>0||S>0||A>0))throw new i(T);var B=s[L],F=+s[L+1],W=+(s[L+2]||0);switch(B){case"+":m-=F,v-=W;break;case"-":m+=F,v+=W;break;case"Z":break;default:v+=new Date(Date.UTC(t,c-1,d,m,v)).getTimezoneOffset()}}else v+=new Date(t,c-1,d).getTimezoneOffset();var G=60===S;for(G&&S--;v>=60;)v-=60,m++;for(;m>=24;)m-=24,d++;for(a=u&&2===c?y:p[c-1];d>a;)d-=a,c++,c>12&&(c-=12,t++),a=u&&2===c?y:p[c-1];for(;0>v;)v+=60,m--;for(;0>m;)m+=24,d--;for(;1>d;)c--,1>c&&(c+=12,t--),a=u&&2===c?y:p[c-1],d+=a;var V=w(t,c,d,m,v,S,A);return n(r)?(h(V[0],V[1],r),f(r)):r=new P(V[0],V[1],l.UTC),G&&P.addSeconds(r,1,r),r},P.now=function(e){return P.fromDate(new Date,e)};var A=new P(0,0,l.TAI);return P.toGregorianDate=function(e,r){if(!n(e))throw new i("julianDate is required.");var t=!1,o=d(e,A);n(o)||(P.addSeconds(e,-1,A),o=d(A,A),t=!0);var u=o.dayNumber,l=o.secondsOfDay;l>=43200&&(u+=1);var c=0|u+68569,f=0|4*c/146097;c=0|c-(0|(146097*f+3)/4);var h=0|4e3*(c+1)/1461001;c=0|c-(0|1461*h/4)+31;var w=0|80*c/2447,m=0|c-(0|2447*w/80);c=0|w/11;var p=0|w+2-12*c,y=0|100*(f-49)+h+c,v=0|l/s.SECONDS_PER_HOUR,g=l-v*s.SECONDS_PER_HOUR,q=0|g/s.SECONDS_PER_MINUTE;g-=q*s.SECONDS_PER_MINUTE;var x=0|g,E=(g-x)/s.SECONDS_PER_MILLISECOND;return v+=12,v>23&&(v-=24),t&&(x+=1),n(r)?(r.year=y,r.month=p,r.day=m,r.hour=v,r.minute=q,r.second=x,r.millisecond=E,r.isLeapSecond=t,r):new a(y,p,m,v,q,x,E,t)},P.toDate=function(e){if(!n(e))throw new i("julianDate is required.");var r=P.toGregorianDate(e,m),t=r.second;return r.isLeapSecond&&(t-=1),new Date(Date.UTC(r.year,r.month-1,r.day,r.hour,r.minute,t,r.millisecond))},P.toIso8601=function(r,t){if(!n(r))throw new i("julianDate is required.");var a,o=P.toGregorianDate(r,o);return n(t)||0===o.millisecond?n(t)&&0!==t?(a=(.01*o.millisecond).toFixed(t).replace(".","").slice(0,t),e("%04d-%02d-%02dT%02d:%02d:%02d.%sZ",o.year,o.month,o.day,o.hour,o.minute,o.second,a)):e("%04d-%02d-%02dT%02d:%02d:%02dZ",o.year,o.month,o.day,o.hour,o.minute,o.second):(a=(.01*o.millisecond).toString().replace(".",""),e("%04d-%02d-%02dT%02d:%02d:%02d.%sZ",o.year,o.month,o.day,o.hour,o.minute,o.second,a))},P.clone=function(e,r){return n(e)?n(r)?(r.dayNumber=e.dayNumber,r.secondsOfDay=e.secondsOfDay,r):new P(e.dayNumber,e.secondsOfDay,l.TAI):void 0},P.compare=function(e,r){if(!n(e))throw new i("left is required.");if(!n(r))throw new i("right is required.");var t=e.dayNumber-r.dayNumber;return 0!==t?t:e.secondsOfDay-r.secondsOfDay},P.equals=function(e,r){return e===r||n(e)&&n(r)&&e.dayNumber===r.dayNumber&&e.secondsOfDay===r.secondsOfDay},P.equalsEpsilon=function(e,r,t){if(!n(t))throw new i("epsilon is required.");return e===r||n(e)&&n(r)&&Math.abs(P.secondsDifference(e,r))<=t},P.totalDays=function(e){if(!n(e))throw new i("julianDate is required.");return e.dayNumber+e.secondsOfDay/s.SECONDS_PER_DAY},P.secondsDifference=function(e,r){if(!n(e))throw new i("left is required.");if(!n(r))throw new i("right is required.");var t=(e.dayNumber-r.dayNumber)*s.SECONDS_PER_DAY;return t+(e.secondsOfDay-r.secondsOfDay)},P.daysDifference=function(e,r){if(!n(e))throw new i("left is required.");if(!n(r))throw new i("right is required.");var t=e.dayNumber-r.dayNumber,a=(e.secondsOfDay-r.secondsOfDay)/s.SECONDS_PER_DAY;return t+a},P.computeTaiMinusUtc=function(e){v.julianDate=e;var t=P.leapSeconds,n=r(t,v,c);return 0>n&&(n=~n,--n,0>n&&(n=0)),t[n].offset},P.addSeconds=function(e,r,t){if(!n(e))throw new i("julianDate is required.");if(!n(r))throw new i("seconds is required.");if(!n(t))throw new i("result is required.");return h(e.dayNumber,e.secondsOfDay+r,t)},P.addMinutes=function(e,r,t){if(!n(e))throw new i("julianDate is required.");if(!n(r))throw new i("minutes is required.");if(!n(t))throw new i("result is required.");var a=e.secondsOfDay+r*s.SECONDS_PER_MINUTE;return h(e.dayNumber,a,t)},P.addHours=function(e,r,t){if(!n(e))throw new i("julianDate is required.");if(!n(r))throw new i("hours is required.");if(!n(t))throw new i("result is required.");var a=e.secondsOfDay+r*s.SECONDS_PER_HOUR;return h(e.dayNumber,a,t)},P.addDays=function(e,r,t){if(!n(e))throw new i("julianDate is required.");if(!n(r))throw new i("days is required.");if(!n(t))throw new i("result is required.");var a=e.dayNumber+r;return h(a,e.secondsOfDay,t)},P.lessThan=function(e,r){return P.compare(e,r)<0},P.lessThanOrEquals=function(e,r){return P.compare(e,r)<=0},P.greaterThan=function(e,r){return P.compare(e,r)>0},P.greaterThanOrEquals=function(e,r){return P.compare(e,r)>=0},P.prototype.clone=function(e){return P.clone(this,e)},P.prototype.equals=function(e){return P.equals(this,e)},P.prototype.equalsEpsilon=function(e,r){return P.equalsEpsilon(this,e,r)},P.prototype.toString=function(){return P.toIso8601(this)},P.leapSeconds=[new u(new P(2441317,43210,l.TAI),10),new u(new P(2441499,43211,l.TAI),11),new u(new P(2441683,43212,l.TAI),12),new u(new P(2442048,43213,l.TAI),13),new u(new P(2442413,43214,l.TAI),14),new u(new P(2442778,43215,l.TAI),15),new u(new P(2443144,43216,l.TAI),16),new u(new P(2443509,43217,l.TAI),17),new u(new P(2443874,43218,l.TAI),18),new u(new P(2444239,43219,l.TAI),19),new u(new P(2444786,43220,l.TAI),20),new u(new P(2445151,43221,l.TAI),21),new u(new P(2445516,43222,l.TAI),22),new u(new P(2446247,43223,l.TAI),23),new u(new P(2447161,43224,l.TAI),24),new u(new P(2447892,43225,l.TAI),25),new u(new P(2448257,43226,l.TAI),26),new u(new P(2448804,43227,l.TAI),27),new u(new P(2449169,43228,l.TAI),28),new u(new P(2449534,43229,l.TAI),29),new u(new P(2450083,43230,l.TAI),30),new u(new P(2450630,43231,l.TAI),31),new u(new P(2451179,43232,l.TAI),32),new u(new P(2453736,43233,l.TAI),33),new u(new P(2454832,43234,l.TAI),34),new u(new P(2456109,43235,l.TAI),35),new u(new P(2457204,43236,l.TAI),36)],P}),define("Core/clone",["./defaultValue"],function(e){"use strict";var r=function(t,n){if(null===t||"object"!=typeof t)return t;n=e(n,!1);var i=new t.constructor;for(var a in t)if(t.hasOwnProperty(a)){var o=t[a];n&&(o=r(o,n)),i[a]=o}return i};return r}),define("Core/parseResponseHeaders",[],function(){"use strict";var e=function(e){var r={};if(!e)return r;for(var t=e.split("\r\n"),n=0;n<t.length;++n){var i=t[n],a=i.indexOf(": ");if(a>0){var o=i.substring(0,a),u=i.substring(a+2);r[o]=u}}return r};return e}),define("Core/RequestErrorEvent",["./defined","./parseResponseHeaders"],function(e,r){"use strict";var t=function(e,t,n){this.statusCode=e,this.response=t,this.responseHeaders=n,"string"==typeof this.responseHeaders&&(this.responseHeaders=r(this.responseHeaders))};return t.prototype.toString=function(){var r="Request has failed.";return e(this.statusCode)&&(r+=" Status Code: "+this.statusCode),r},t}),define("Core/loadWithXhr",["../ThirdParty/when","./defaultValue","./defined","./DeveloperError","./RequestErrorEvent","./RuntimeError"],function(e,r,t,n,i,a){"use strict";function o(e,r){var t=decodeURIComponent(r);return e?atob(t):t}function u(e,r){for(var t=o(e,r),n=new ArrayBuffer(t.length),i=new Uint8Array(n),a=0;a<t.length;a++)i[a]=t.charCodeAt(a);return n}function s(e,t){t=r(t,"");var i=e[1],a=!!e[2],s=e[3];switch(t){case"":case"text":return o(a,s);case"arraybuffer":return u(a,s);case"blob":var l=u(a,s);return new Blob([l],{type:i});case"document":var c=new DOMParser;return c.parseFromString(o(a,s),i);case"json":return JSON.parse(o(a,s));default:throw new n("Unhandled responseType: "+t)}}var l=function(i){if(i=r(i,r.EMPTY_OBJECT),!t(i.url))throw new n("options.url is required.");var a=i.responseType,o=r(i.method,"GET"),u=i.data,s=i.headers,c=i.overrideMimeType;return e(i.url,function(r){var t=e.defer();return l.load(r,a,o,u,s,t,c),t.promise})},c=/^data:(.*?)(;base64)?,(.*)$/;return l.load=function(e,r,n,o,u,l,f){var d=c.exec(e);if(null!==d)return l.resolve(s(d,r)),void 0;var h=new XMLHttpRequest;if(t(f)&&t(h.overrideMimeType)&&h.overrideMimeType(f),h.open(n,e,!0),t(u))for(var w in u)u.hasOwnProperty(w)&&h.setRequestHeader(w,u[w]);t(r)&&(h.responseType=r),h.onload=function(){200===h.status?t(h.response)?l.resolve(h.response):t(h.responseXML)&&h.responseXML.hasChildNodes()?l.resolve(h.responseXML):t(h.responseText)?l.resolve(h.responseText):l.reject(new a("unknown XMLHttpRequest response type.")):l.reject(new i(h.status,h.response,h.getAllResponseHeaders()))},h.onerror=function(){l.reject(new i)},h.send(o)},l.defaultLoad=l.load,l}),define("Core/loadText",["./loadWithXhr"],function(e){"use strict";var r=function(r,t){return e({url:r,headers:t})};return r}),define("Core/loadJson",["./clone","./defined","./DeveloperError","./loadText"],function(e,r,t,n){"use strict";var i={Accept:"application/json,*/*;q=0.01"},a=function(a,o){if(!r(a))throw new t("url is required.");return r(o)?r(o.Accept)||(o=e(o),o.Accept=i.Accept):o=i,n(a,o).then(function(e){return JSON.parse(e)})};return a}),define("Core/EarthOrientationParameters",["../ThirdParty/when","./binarySearch","./defaultValue","./defined","./EarthOrientationParametersSample","./freezeObject","./JulianDate","./LeapSecond","./loadJson","./RuntimeError","./TimeConstants","./TimeStandard"],function(e,r,t,n,i,a,o,u,s,l,c,f){"use strict";function d(e,r){return o.compare(e.julianDate,r)}function h(e,t){if(!n(t.columnNames))return e._dataError="Error in loaded EOP data: The columnNames property is required.",void 0;if(!n(t.samples))return e._dataError="Error in loaded EOP data: The samples property is required.",void 0;var i=t.columnNames.indexOf("modifiedJulianDateUtc"),a=t.columnNames.indexOf("xPoleWanderRadians"),s=t.columnNames.indexOf("yPoleWanderRadians"),l=t.columnNames.indexOf("ut1MinusUtcSeconds"),h=t.columnNames.indexOf("xCelestialPoleOffsetRadians"),w=t.columnNames.indexOf("yCelestialPoleOffsetRadians"),m=t.columnNames.indexOf("taiMinusUtcSeconds");if(0>i||0>a||0>s||0>l||0>h||0>w||0>m)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 p=e._samples=t.samples,y=e._dates=[];e._dateColumn=i,e._xPoleWanderRadiansColumn=a,e._yPoleWanderRadiansColumn=s,e._ut1MinusUtcSecondsColumn=l,e._xCelestialPoleOffsetRadiansColumn=h,e._yCelestialPoleOffsetRadiansColumn=w,e._taiMinusUtcSecondsColumn=m,e._columnCount=t.columnNames.length,e._lastIndex=void 0;for(var v,g=e._addNewLeapSeconds,q=0,x=p.length;x>q;q+=e._columnCount){var E=p[q+i],b=p[q+m],S=E+c.MODIFIED_JULIAN_DATE_DIFFERENCE,_=new o(S,b,f.TAI);if(y.push(_),g){if(b!==v&&n(v)){var M=o.leapSeconds,O=r(M,_,d);if(0>O){var T=new u(_,b);M.splice(~O,0,T)}}v=b}}}function w(e,r,t,n,i){var a=t*n;i.xPoleWander=r[a+e._xPoleWanderRadiansColumn],i.yPoleWander=r[a+e._yPoleWanderRadiansColumn],i.xPoleOffset=r[a+e._xCelestialPoleOffsetRadiansColumn],i.yPoleOffset=r[a+e._yCelestialPoleOffsetRadiansColumn],i.ut1MinusUtc=r[a+e._ut1MinusUtcSecondsColumn]}function m(e,r,t){return r+e*(t-r)}function p(e,r,t,n,i,a,u){var s=e._columnCount;if(a>r.length-1)return u.xPoleWander=0,u.yPoleWander=0,u.xPoleOffset=0,u.yPoleOffset=0,u.ut1MinusUtc=0,u;var l=r[i],c=r[a];if(l.equals(c)||n.equals(l))return w(e,t,i,s,u),u;if(n.equals(c))return w(e,t,a,s,u),u;var f=o.secondsDifference(n,l)/o.secondsDifference(c,l),d=i*s,h=a*s,p=t[d+e._ut1MinusUtcSecondsColumn],y=t[h+e._ut1MinusUtcSecondsColumn],v=y-p;if(v>.5||-.5>v){var g=t[d+e._taiMinusUtcSecondsColumn],q=t[h+e._taiMinusUtcSecondsColumn];g!==q&&(c.equals(n)?p=y:y-=q-g)}return u.xPoleWander=m(f,t[d+e._xPoleWanderRadiansColumn],t[h+e._xPoleWanderRadiansColumn]),u.yPoleWander=m(f,t[d+e._yPoleWanderRadiansColumn],t[h+e._yPoleWanderRadiansColumn]),u.xPoleOffset=m(f,t[d+e._xCelestialPoleOffsetRadiansColumn],t[h+e._xCelestialPoleOffsetRadiansColumn]),u.yPoleOffset=m(f,t[d+e._yCelestialPoleOffsetRadiansColumn],t[h+e._yCelestialPoleOffsetRadiansColumn]),u.ut1MinusUtc=m(f,p,y),u}var y=function(r){if(r=t(r,t.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=t(r.addNewLeapSeconds,!0),n(r.data))h(this,r.data);else if(n(r.url)){var i=this;this._downloadPromise=e(s(r.url),function(e){h(i,e)},function(){i._dataError="An error occurred while retrieving the EOP data from the URL "+r.url+"."})}else h(this,{columnNames:["dateIso8601","modifiedJulianDateUtc","xPoleWanderRadians","yPoleWanderRadians","ut1MinusUtcSeconds","lengthOfDayCorrectionSeconds","xCelestialPoleOffsetRadians","yCelestialPoleOffsetRadians","taiMinusUtcSeconds"],samples:[]})};return y.NONE=a({getPromiseToLoad:function(){return e()},compute:function(e,r){return n(r)?(r.xPoleWander=0,r.yPoleWander=0,r.xPoleOffset=0,r.yPoleOffset=0,r.ut1MinusUtc=0):r=new i(0,0,0,0,0),r
  }}),y.prototype.getPromiseToLoad=function(){return e(this._downloadPromise)},y.prototype.compute=function(e,t){if(!n(this._samples)){if(n(this._dataError))throw new l(this._dataError);return void 0}if(n(t)||(t=new i(0,0,0,0,0)),0===this._samples.length)return t.xPoleWander=0,t.yPoleWander=0,t.xPoleOffset=0,t.yPoleOffset=0,t.ut1MinusUtc=0,t;var a=this._dates,u=this._lastIndex,s=0,c=0;if(n(u)){var f=a[u],d=a[u+1],h=o.lessThanOrEquals(f,e),w=!n(d),m=w||o.greaterThanOrEquals(d,e);if(h&&m)return s=u,!w&&d.equals(e)&&++s,c=s+1,p(this,a,this._samples,e,s,c,t),t}var y=r(a,e,o.compare,this._dateColumn);return y>=0?(y<a.length-1&&a[y+1].equals(e)&&++y,s=y,c=y):(c=~y,s=c-1,0>s&&(s=0)),this._lastIndex=s,p(this,a,this._samples,e,s,c,t),t},y}),define("ThirdParty/Uri",[],function(){function e(r){if(r instanceof e)this.scheme=r.scheme,this.authority=r.authority,this.path=r.path,this.query=r.query,this.fragment=r.fragment;else if(r){var t=n.exec(r);this.scheme=t[1],this.authority=t[2],this.path=t[3],this.query=t[4],this.fragment=t[5]}}function r(e){var r=unescape(e);return a.test(r)?r:e.toUpperCase()}function t(e,r,t,n){return(r||"")+t.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,t).replace(i,r)),this.path&&(this.path=this.path.replace(i,r)),this.query&&(this.query=this.query.replace(i,r)),this.fragment&&(this.fragment=this.fragment.replace(i,r))};var i=/%[0-9a-z]{2}/gi,a=/[a-zA-Z0-9\-\._~]/,o=/(.*@)?([^@:]*)(:.*)?/;return e.prototype.resolve=function(r){var t=new e;return this.scheme?(t.scheme=this.scheme,t.authority=this.authority,t.path=this.path,t.query=this.query):(t.scheme=r.scheme,this.authority?(t.authority=this.authority,t.path=this.path,t.query=this.query):(t.authority=r.authority,""==this.path?(t.path=r.path,t.query=this.query||r.query):("/"==this.path.charAt(0)?(t.path=this.path,t.removeDotSegments()):(t.path=r.authority&&""==r.path?"/"+this.path:r.path.substring(0,r.path.lastIndexOf("/")+1)+this.path,t.removeDotSegments()),t.query=this.query))),t.fragment=this.fragment,t},e.prototype.removeDotSegments=function(){var e,r=this.path.split("/"),t=[],n=""==r[0];for(n&&r.shift(),""==r[0]?r.shift():null;r.length;)e=r.shift(),".."==e?t.pop():"."!=e&&t.push(e);("."==e||".."==e)&&t.push(""),n&&t.unshift(""),this.path=t.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,r,t,n){"use strict";function i(){for(var e=document.getElementsByTagName("script"),r=0,t=e.length;t>r;++r){var n=e[r].getAttribute("src"),i=f.exec(n);if(null!==i)return i[1]}return void 0}function a(){if(r(s))return s;var n;if(n="undefined"!=typeof CESIUM_BASE_URL?CESIUM_BASE_URL:i(),!r(n))throw new t("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(r){return new e(r).resolve(a()).toString()}var s,l,c,f=/((?:.*\/)|^)cesium[\w-]*\.js(?:\W|$)/i,d=function(e){r(l)||(l=r(n.toUrl)?o:u),r(c)||(c=document.createElement("a"));var t=l(e);return c.href=t,c.href=c.href,c.href};return d._cesiumScriptRegex=f,d.setBaseUrl=function(r){s=new e(r).resolve(new e(document.location.href))},d}),define("Core/Iau2006XysSample",[],function(){"use strict";var e=function(e,r,t){this.x=e,this.y=r,this.s=t};return e}),define("Core/Iau2006XysData",["../ThirdParty/when","./buildModuleUrl","./defaultValue","./defined","./Iau2006XysSample","./JulianDate","./loadJson","./TimeStandard"],function(e,r,t,n,i,a,o,u){"use strict";function s(e,r,t){var n=f;return n.dayNumber=r,n.secondsOfDay=t,a.daysDifference(n,e._sampleZeroDateTT)}function l(t,i){if(t._chunkDownloadsInProgress[i])return t._chunkDownloadsInProgress[i];var a=e.defer();t._chunkDownloadsInProgress[i]=a;var u,s=t._xysFileUrlTemplate;return u=n(s)?s.replace("{0}",i):r("Assets/IAU2006_XYS/IAU2006_XYS_"+i+".json"),e(o(u),function(e){t._chunkDownloadsInProgress[i]=!1;for(var r=t._samples,n=e.samples,o=3*i*t._samplesPerXysFile,u=0,s=n.length;s>u;++u)r[o+u]=n[u];a.resolve()}),a.promise}var c=function(e){e=t(e,t.EMPTY_OBJECT),this._xysFileUrlTemplate=e.xysFileUrlTemplate,this._interpolationOrder=t(e.interpolationOrder,9),this._sampleZeroJulianEphemerisDate=t(e.sampleZeroJulianEphemerisDate,2442396.5),this._sampleZeroDateTT=new a(this._sampleZeroJulianEphemerisDate,0,u.TAI),this._stepSizeDays=t(e.stepSizeDays,1),this._samplesPerXysFile=t(e.samplesPerXysFile,1e3),this._totalSamples=t(e.totalSamples,27426),this._samples=new Array(3*this._totalSamples),this._chunkDownloadsInProgress=[];for(var r=this._interpolationOrder,n=this._denominators=new Array(r+1),i=this._xTable=new Array(r+1),o=Math.pow(this._stepSizeDays,r),s=0;r>=s;++s){n[s]=o,i[s]=s*this._stepSizeDays;for(var l=0;r>=l;++l)l!==s&&(n[s]*=s-l);n[s]=1/n[s]}this._work=new Array(r+1),this._coef=new Array(r+1)},f=new a(0,0,u.TAI);return c.prototype.preload=function(r,t,n,i){var a=s(this,r,t),o=s(this,n,i),u=0|a/this._stepSizeDays-this._interpolationOrder/2;0>u&&(u=0);var c=o/this._stepSizeDays-this._interpolationOrder/2|0+this._interpolationOrder;c>=this._totalSamples&&(c=this._totalSamples-1);for(var f=0|u/this._samplesPerXysFile,d=0|c/this._samplesPerXysFile,h=[],w=f;d>=w;++w)h.push(l(this,w));return e.all(h)},c.prototype.computeXysRadians=function(e,r,t){var a=s(this,e,r);if(0>a)return void 0;var o=0|a/this._stepSizeDays;if(o>=this._totalSamples)return void 0;var u=this._interpolationOrder,c=o-(0|u/2);0>c&&(c=0);var f=c+u;f>=this._totalSamples&&(f=this._totalSamples-1,c=f-u,0>c&&(c=0));var d=!1,h=this._samples;if(n(h[3*c])||(l(this,0|c/this._samplesPerXysFile),d=!0),n(h[3*f])||(l(this,0|f/this._samplesPerXysFile),d=!0),d)return void 0;n(t)?(t.x=0,t.y=0,t.s=0):t=new i(0,0,0);var w,m,p=a-c*this._stepSizeDays,y=this._work,v=this._denominators,g=this._coef,q=this._xTable;for(w=0;u>=w;++w)y[w]=p-q[w];for(w=0;u>=w;++w){for(g[w]=1,m=0;u>=m;++m)m!==w&&(g[w]*=y[m]);g[w]*=v[w];var x=3*(c+w);t.x+=g[w]*h[x++],t.y+=g[w]*h[x++],t.s+=g[w]*h[x]}return t},c}),define("Core/Quaternion",["./Cartesian3","./defaultValue","./defined","./DeveloperError","./FeatureDetection","./freezeObject","./Math","./Matrix3"],function(e,r,t,n,i,a,o,u){"use strict";var s=function(e,t,n,i){this.x=r(e,0),this.y=r(t,0),this.z=r(n,0),this.w=r(i,0)},l=new e;s.fromAxisAngle=function(r,i,a){if(!t(r))throw new n("axis is required.");if("number"!=typeof i)throw new n("angle is required and must be a number.");var o=i/2,u=Math.sin(o);l=e.normalize(r,l);var c=l.x*u,f=l.y*u,d=l.z*u,h=Math.cos(o);return t(a)?(a.x=c,a.y=f,a.z=d,a.w=h,a):new s(c,f,d,h)};var c=[1,2,0],f=new Array(3);s.fromRotationMatrix=function(e,r){if(!t(e))throw new n("matrix is required.");var i,a,o,l,d,h=e[u.COLUMN0ROW0],w=e[u.COLUMN1ROW1],m=e[u.COLUMN2ROW2],p=h+w+m;if(p>0)i=Math.sqrt(p+1),d=.5*i,i=.5/i,a=(e[u.COLUMN1ROW2]-e[u.COLUMN2ROW1])*i,o=(e[u.COLUMN2ROW0]-e[u.COLUMN0ROW2])*i,l=(e[u.COLUMN0ROW1]-e[u.COLUMN1ROW0])*i;else{var y=c,v=0;w>h&&(v=1),m>h&&m>w&&(v=2);var g=y[v],q=y[g];i=Math.sqrt(e[u.getElementIndex(v,v)]-e[u.getElementIndex(g,g)]-e[u.getElementIndex(q,q)]+1);var x=f;x[v]=.5*i,i=.5/i,d=(e[u.getElementIndex(q,g)]-e[u.getElementIndex(g,q)])*i,x[g]=(e[u.getElementIndex(g,v)]+e[u.getElementIndex(v,g)])*i,x[q]=(e[u.getElementIndex(q,v)]+e[u.getElementIndex(v,q)])*i,a=-x[0],o=-x[1],l=-x[2]}return t(r)?(r.x=a,r.y=o,r.z=l,r.w=d,r):new s(a,o,l,d)};var d=new s;s.fromHeadingPitchRoll=function(r,i,a,o){if(!t(r))throw new n("heading is required.");if(!t(i))throw new n("pitch is required.");if(!t(a))throw new n("roll is required.");var u=s.fromAxisAngle(e.UNIT_X,a,d),l=s.fromAxisAngle(e.UNIT_Y,-i,o);o=s.multiply(l,u,l);var c=s.fromAxisAngle(e.UNIT_Z,-r,d);return s.multiply(c,o,o)};var h=new e,w=new e,m=new s,p=new s,y=new s;s.packedLength=4,s.pack=function(e,i,a){if(!t(e))throw new n("value is required");if(!t(i))throw new n("array is required");a=r(a,0),i[a++]=e.x,i[a++]=e.y,i[a++]=e.z,i[a]=e.w},s.unpack=function(e,i,a){if(!t(e))throw new n("array is required");return i=r(i,0),t(a)||(a=new s),a.x=e[i],a.y=e[i+1],a.z=e[i+2],a.w=e[i+3],a},s.packedInterpolationLength=3,s.convertPackedArrayForInterpolation=function(e,r,t,n){s.unpack(e,4*t,y),s.conjugate(y,y);for(var i=0,a=t-r+1;a>i;i++){var o=3*i;s.unpack(e,4*(r+i),m),s.multiply(m,y,m),m.w<0&&s.negate(m,m),s.computeAxis(m,h);var u=s.computeAngle(m);n[o]=h.x*u,n[o+1]=h.y*u,n[o+2]=h.z*u}},s.unpackInterpolationResult=function(r,n,i,a,o){t(o)||(o=new s),e.fromArray(r,0,w);var u=e.magnitude(w);return s.unpack(n,4*a,p),0===u?s.clone(s.IDENTITY,m):s.fromAxisAngle(w,u,m),s.multiply(m,p,o)},s.clone=function(e,r){return t(e)?t(r)?(r.x=e.x,r.y=e.y,r.z=e.z,r.w=e.w,r):new s(e.x,e.y,e.z,e.w):void 0},s.conjugate=function(e,r){if(!t(e))throw new n("quaternion is required");if(!t(r))throw new n("result is required");return r.x=-e.x,r.y=-e.y,r.z=-e.z,r.w=e.w,r},s.magnitudeSquared=function(e){if(!t(e))throw new n("quaternion is required");return e.x*e.x+e.y*e.y+e.z*e.z+e.w*e.w},s.magnitude=function(e){return Math.sqrt(s.magnitudeSquared(e))},s.normalize=function(e,r){if(!t(r))throw new n("result is required");var i=1/s.magnitude(e),a=e.x*i,o=e.y*i,u=e.z*i,l=e.w*i;return r.x=a,r.y=o,r.z=u,r.w=l,r},s.inverse=function(e,r){if(!t(r))throw new n("result is required");var i=s.magnitudeSquared(e);return r=s.conjugate(e,r),s.multiplyByScalar(r,1/i,r)},s.add=function(e,r,i){if(!t(e))throw new n("left is required");if(!t(r))throw new n("right is required");if(!t(i))throw new n("result is required");return i.x=e.x+r.x,i.y=e.y+r.y,i.z=e.z+r.z,i.w=e.w+r.w,i},s.subtract=function(e,r,i){if(!t(e))throw new n("left is required");if(!t(r))throw new n("right is required");if(!t(i))throw new n("result is required");return i.x=e.x-r.x,i.y=e.y-r.y,i.z=e.z-r.z,i.w=e.w-r.w,i},s.negate=function(e,r){if(!t(e))throw new n("quaternion is required");if(!t(r))throw new n("result is required");return r.x=-e.x,r.y=-e.y,r.z=-e.z,r.w=-e.w,r},s.dot=function(e,r){if(!t(e))throw new n("left is required");if(!t(r))throw new n("right is required");return e.x*r.x+e.y*r.y+e.z*r.z+e.w*r.w},s.multiply=function(e,r,i){if(!t(e))throw new n("left is required");if(!t(r))throw new n("right is required");if(!t(i))throw new n("result is required");var a=e.x,o=e.y,u=e.z,s=e.w,l=r.x,c=r.y,f=r.z,d=r.w,h=s*l+a*d+o*f-u*c,w=s*c-a*f+o*d+u*l,m=s*f+a*c-o*l+u*d,p=s*d-a*l-o*c-u*f;return i.x=h,i.y=w,i.z=m,i.w=p,i},s.multiplyByScalar=function(e,r,i){if(!t(e))throw new n("quaternion is required");if("number"!=typeof r)throw new n("scalar is required and must be a number.");if(!t(i))throw new n("result is required");return i.x=e.x*r,i.y=e.y*r,i.z=e.z*r,i.w=e.w*r,i},s.divideByScalar=function(e,r,i){if(!t(e))throw new n("quaternion is required");if("number"!=typeof r)throw new n("scalar is required and must be a number.");if(!t(i))throw new n("result is required");return i.x=e.x/r,i.y=e.y/r,i.z=e.z/r,i.w=e.w/r,i},s.computeAxis=function(e,r){if(!t(e))throw new n("quaternion is required");if(!t(r))throw new n("result is required");var i=e.w;if(Math.abs(i-1)<o.EPSILON6)return r.x=r.y=r.z=0,r;var a=1/Math.sqrt(1-i*i);return r.x=e.x*a,r.y=e.y*a,r.z=e.z*a,r},s.computeAngle=function(e){if(!t(e))throw new n("quaternion is required");return Math.abs(e.w-1)<o.EPSILON6?0:2*Math.acos(e.w)};var v=new s;s.lerp=function(e,r,i,a){if(!t(e))throw new n("start is required.");if(!t(r))throw new n("end is required.");if("number"!=typeof i)throw new n("t is required and must be a number.");if(!t(a))throw new n("result is required");return v=s.multiplyByScalar(r,i,v),a=s.multiplyByScalar(e,1-i,a),s.add(v,a,a)};var g=new s,q=new s,x=new s;s.slerp=function(e,r,i,a){if(!t(e))throw new n("start is required.");if(!t(r))throw new n("end is required.");if("number"!=typeof i)throw new n("t is required and must be a number.");if(!t(a))throw new n("result is required");var u=s.dot(e,r),l=r;if(0>u&&(u=-u,l=g=s.negate(r,g)),1-u<o.EPSILON6)return s.lerp(e,l,i,a);var c=Math.acos(u);return q=s.multiplyByScalar(e,Math.sin((1-i)*c),q),x=s.multiplyByScalar(l,Math.sin(i*c),x),a=s.add(q,x,a),s.multiplyByScalar(a,1/Math.sin(c),a)},s.log=function(r,i){if(!t(r))throw new n("quaternion is required.");if(!t(i))throw new n("result is required");var a=o.acosClamped(r.w),u=0;return 0!==a&&(u=a/Math.sin(a)),e.multiplyByScalar(r,u,i)},s.exp=function(r,i){if(!t(r))throw new n("cartesian is required.");if(!t(i))throw new n("result is required");var a=e.magnitude(r),o=0;return 0!==a&&(o=Math.sin(a)/a),i.x=r.x*o,i.y=r.y*o,i.z=r.z*o,i.w=Math.cos(a),i};var E=new e,b=new e,S=new s,_=new s;s.computeInnerQuadrangle=function(r,i,a,o){if(!t(r)||!t(i)||!t(a))throw new n("q0, q1, and q2 are required.");if(!t(o))throw new n("result is required");var u=s.conjugate(i,S);s.multiply(u,a,_);var l=s.log(_,E);s.multiply(u,r,_);var c=s.log(_,b);return e.add(l,c,l),e.multiplyByScalar(l,.25,l),e.negate(l,l),s.exp(l,S),s.multiply(i,S,o)},s.squad=function(e,r,i,a,o,u){if(!(t(e)&&t(r)&&t(i)&&t(a)))throw new n("q0, q1, s0, and s1 are required.");if("number"!=typeof o)throw new n("t is required and must be a number.");if(!t(u))throw new n("result is required");var l=s.slerp(e,r,o,S),c=s.slerp(i,a,o,_);return s.slerp(l,c,2*o*(1-o),u)};for(var M=new s,O=1.9011074535173003,T=i.supportsTypedArrays()?new Float32Array(8):[],P=i.supportsTypedArrays()?new Float32Array(8):[],A=i.supportsTypedArrays()?new Float32Array(8):[],R=i.supportsTypedArrays()?new Float32Array(8):[],N=0;7>N;++N){var z=N+1,I=2*z+1;T[N]=1/(z*I),P[N]=z/I}return T[7]=O/136,P[7]=8*O/17,s.fastSlerp=function(e,r,i,a){if(!t(e))throw new n("start is required.");if(!t(r))throw new n("end is required.");if("number"!=typeof i)throw new n("t is required and must be a number.");if(!t(a))throw new n("result is required");var o,u=s.dot(e,r);u>=0?o=1:(o=-1,u=-u);for(var l=u-1,c=1-i,f=i*i,d=c*c,h=7;h>=0;--h)A[h]=(T[h]*f-P[h])*l,R[h]=(T[h]*d-P[h])*l;var w=o*i*(1+A[0]*(1+A[1]*(1+A[2]*(1+A[3]*(1+A[4]*(1+A[5]*(1+A[6]*(1+A[7])))))))),m=c*(1+R[0]*(1+R[1]*(1+R[2]*(1+R[3]*(1+R[4]*(1+R[5]*(1+R[6]*(1+R[7])))))))),p=s.multiplyByScalar(e,m,M);return s.multiplyByScalar(r,w,a),s.add(p,a,a)},s.fastSquad=function(e,r,i,a,o,u){if(!(t(e)&&t(r)&&t(i)&&t(a)))throw new n("q0, q1, s0, and s1 are required.");if("number"!=typeof o)throw new n("t is required and must be a number.");if(!t(u))throw new n("result is required");var l=s.fastSlerp(e,r,o,S),c=s.fastSlerp(i,a,o,_);return s.fastSlerp(l,c,2*o*(1-o),u)},s.equals=function(e,r){return e===r||t(e)&&t(r)&&e.x===r.x&&e.y===r.y&&e.z===r.z&&e.w===r.w},s.equalsEpsilon=function(e,r,i){if("number"!=typeof i)throw new n("epsilon is required and must be a number.");return e===r||t(e)&&t(r)&&Math.abs(e.x-r.x)<=i&&Math.abs(e.y-r.y)<=i&&Math.abs(e.z-r.z)<=i&&Math.abs(e.w-r.w)<=i},s.ZERO=a(new s(0,0,0,0)),s.IDENTITY=a(new s(0,0,0,1)),s.prototype.clone=function(e){return s.clone(this,e)},s.prototype.equals=function(e){return s.equals(this,e)},s.prototype.equalsEpsilon=function(e,r){return s.equalsEpsilon(this,e,r)},s.prototype.toString=function(){return"("+this.x+", "+this.y+", "+this.z+", "+this.w+")"},s}),define("Core/Transforms",["../ThirdParty/when","./Cartesian2","./Cartesian3","./Cartesian4","./defaultValue","./defined","./DeveloperError","./EarthOrientationParameters","./EarthOrientationParametersSample","./Ellipsoid","./Iau2006XysData","./Iau2006XysSample","./JulianDate","./Math","./Matrix3","./Matrix4","./Quaternion","./TimeConstants"],function(e,r,t,n,i,a,o,u,s,l,c,f,d,h,w,m,p,y){"use strict";var v={},g=new t,q=new t,x=new t;v.eastNorthUpToFixedFrame=function(e,r,n){if(!a(e))throw new o("origin is required.");if(h.equalsEpsilon(e.x,0,h.EPSILON14)&&h.equalsEpsilon(e.y,0,h.EPSILON14)){var u=h.sign(e.z);return a(n)?(n[0]=0,n[1]=1,n[2]=0,n[3]=0,n[4]=-u,n[5]=0,n[6]=0,n[7]=0,n[8]=0,n[9]=0,n[10]=u,n[11]=0,n[12]=e.x,n[13]=e.y,n[14]=e.z,n[15]=1,n):new m(0,-u,0,e.x,1,0,0,e.y,0,0,u,e.z,0,0,0,1)}var s=g,c=q,f=x;return r=i(r,l.WGS84),r.geodeticSurfaceNormal(e,s),c.x=-e.y,c.y=e.x,c.z=0,t.normalize(c,c),t.cross(s,c,f),a(n)?(n[0]=c.x,n[1]=c.y,n[2]=c.z,n[3]=0,n[4]=f.x,n[5]=f.y,n[6]=f.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 m(c.x,f.x,s.x,e.x,c.y,f.y,s.y,e.y,c.z,f.z,s.z,e.z,0,0,0,1)};var E=new t,b=new t,S=new t;v.northEastDownToFixedFrame=function(e,r,n){if(!a(e))throw new o("origin is required.");if(h.equalsEpsilon(e.x,0,h.EPSILON14)&&h.equalsEpsilon(e.y,0,h.EPSILON14)){var u=h.sign(e.z);return a(n)?(n[0]=-u,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]=-u,n[11]=0,n[12]=e.x,n[13]=e.y,n[14]=e.z,n[15]=1,n):new m(-u,0,0,e.x,0,1,0,e.y,0,0,-u,e.z,0,0,0,1)}var s=E,c=b,f=S;return r=i(r,l.WGS84),r.geodeticSurfaceNormal(e,s),c.x=-e.y,c.y=e.x,c.z=0,t.normalize(c,c),t.cross(s,c,f),a(n)?(n[0]=f.x,n[1]=f.y,n[2]=f.z,n[3]=0,n[4]=c.x,n[5]=c.y,n[6]=c.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 m(f.x,c.x,-s.x,e.x,f.y,c.y,-s.y,e.y,f.z,c.z,-s.z,e.z,0,0,0,1)},v.northUpEastToFixedFrame=function(e,r,n){if(!a(e))throw new o("origin is required.");if(h.equalsEpsilon(e.x,0,h.EPSILON14)&&h.equalsEpsilon(e.y,0,h.EPSILON14)){var u=h.sign(e.z);return a(n)?(n[0]=-u,n[1]=0,n[2]=0,n[3]=0,n[4]=0,n[5]=0,n[6]=u,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 m(-u,0,0,e.x,0,0,1,e.y,0,u,0,e.z,0,0,0,1)}var s=g,c=q,f=x;return r=i(r,l.WGS84),r.geodeticSurfaceNormal(e,s),c.x=-e.y,c.y=e.x,c.z=0,t.normalize(c,c),t.cross(s,c,f),a(n)?(n[0]=f.x,n[1]=f.y,n[2]=f.z,n[3]=0,n[4]=s.x,n[5]=s.y,n[6]=s.z,n[7]=0,n[8]=c.x,n[9]=c.y,n[10]=c.z,n[11]=0,n[12]=e.x,n[13]=e.y,n[14]=e.z,n[15]=1,n):new m(f.x,s.x,c.x,e.x,f.y,s.y,c.y,e.y,f.z,s.z,c.z,e.z,0,0,0,1)};var _=new p,M=new t(1,1,1),O=new m;v.headingPitchRollToFixedFrame=function(e,r,n,i,a,o){var u=p.fromHeadingPitchRoll(r,n,i,_),s=m.fromTranslationQuaternionRotationScale(t.ZERO,u,M,O);return o=v.eastNorthUpToFixedFrame(e,a,o),m.multiply(o,s,o)};var T=new m,P=new w;v.headingPitchRollQuaternion=function(e,r,t,n,i,a){var o=v.headingPitchRollToFixedFrame(e,r,t,n,i,T),u=m.getRotation(o,P);return p.fromRotationMatrix(u,a)};var A=24110.54841,R=8640184.812866,N=.093104,z=-62e-7,I=1.1772758384668e-19,C=72921158553e-15,D=h.TWO_PI/86400,U=new d;v.computeTemeToPseudoFixedMatrix=function(e,r){if(!a(e))throw new o("date is required.");U=d.addSeconds(e,-d.computeTaiMinusUtc(e),U);var t,n=U.dayNumber,i=U.secondsOfDay,u=n-2451545;t=i>=43200?(u+.5)/y.DAYS_PER_JULIAN_CENTURY:(u-.5)/y.DAYS_PER_JULIAN_CENTURY;var s=A+t*(R+t*(N+t*z)),l=s*D%h.TWO_PI,c=C+I*(n-2451545.5),f=(i+.5*y.SECONDS_PER_DAY)%y.SECONDS_PER_DAY,m=l+c*f,p=Math.cos(m),v=Math.sin(m);return a(r)?(r[0]=p,r[1]=-v,r[2]=0,r[3]=v,r[4]=p,r[5]=0,r[6]=0,r[7]=0,r[8]=1,r):new w(p,v,0,-v,p,0,0,0,1)},v.iau2006XysData=new c,v.earthOrientationParameters=u.NONE;var L=32.184,B=2451545;v.preloadIcrfFixed=function(r){var t=r.start.dayNumber,n=r.start.secondsOfDay+L,i=r.stop.dayNumber,a=r.stop.secondsOfDay+L,o=v.iau2006XysData.preload(t,n,i,a),u=v.earthOrientationParameters.getPromiseToLoad();return e.all([o,u])},v.computeIcrfToFixedMatrix=function(e,r){if(!a(e))throw new o("date is required.");a(r)||(r=new w);var t=v.computeFixedToIcrfMatrix(e,r);return a(t)?w.transpose(t,r):void 0};var F=new f(0,0,0),W=new s(0,0,0,0,0,0),G=new w,V=new w;v.computeFixedToIcrfMatrix=function(e,r){if(!a(e))throw new o("date is required.");a(r)||(r=new w);var t=v.earthOrientationParameters.compute(e,W);if(!a(t))return void 0;var n=e.dayNumber,i=e.secondsOfDay+L,u=v.iau2006XysData.computeXysRadians(n,i,F);if(!a(u))return void 0;var s=u.x+t.xPoleOffset,l=u.y+t.yPoleOffset,c=1/(1+Math.sqrt(1-s*s-l*l)),f=G;f[0]=1-c*s*s,f[3]=-c*s*l,f[6]=s,f[1]=-c*s*l,f[4]=1-c*l*l,f[7]=l,f[2]=-s,f[5]=-l,f[8]=1-c*(s*s+l*l);var m=w.fromRotationZ(-u.s,V),p=w.multiply(f,m,G),g=e.dayNumber,q=e.secondsOfDay-d.computeTaiMinusUtc(e)+t.ut1MinusUtc,x=g-2451545,E=q/y.SECONDS_PER_DAY,b=.779057273264+E+.00273781191135448*(x+E);b=b%1*h.TWO_PI;var S=w.fromRotationZ(b,V),_=w.multiply(p,S,G),M=Math.cos(t.xPoleWander),O=Math.cos(t.yPoleWander),T=Math.sin(t.xPoleWander),P=Math.sin(t.yPoleWander),A=n-B+i/y.SECONDS_PER_DAY;A/=36525;var R=-47e-6*A*h.RADIANS_PER_DEGREE/3600,N=Math.cos(R),z=Math.sin(R),I=V;return I[0]=M*N,I[1]=M*z,I[2]=T,I[3]=-O*z+P*T*N,I[4]=O*N+P*T*z,I[5]=-P*M,I[6]=-P*z-O*T*N,I[7]=P*N-O*T*z,I[8]=O*M,w.multiply(_,I,r)};var k=new n;v.pointToWindowCoordinates=function(e,r,t,n){return n=v.pointToGLWindowCoordinates(e,r,t,n),n.y=2*r[5]-n.y,n},v.pointToGLWindowCoordinates=function(e,t,i,u){if(!a(e))throw new o("modelViewProjectionMatrix is required.");if(!a(t))throw new o("viewportTransformation is required.");if(!a(i))throw new o("point is required.");a(u)||(u=new r);var s=k;return m.multiplyByVector(e,n.fromElements(i.x,i.y,i.z,1,s),s),n.multiplyByScalar(s,1/s.w,s),m.multiplyByVector(t,s,s),r.fromCartesian4(s,u)};var j=new t,Y=new t,H=new t;return v.rotationMatrixFromPositionVelocity=function(e,r,n,u){if(!a(e))throw new o("position is required.");if(!a(r))throw new o("velocity is required.");var s=i(n,l.WGS84).geodeticSurfaceNormal(e,j),c=t.cross(r,s,Y);t.equalsEpsilon(c,t.ZERO,h.EPSILON6)&&(c=t.clone(t.UNIT_X,c));var f=t.cross(c,r,H);return t.cross(r,f,c),t.negate(c,c),a(u)||(u=new w),u[0]=r.x,u[1]=r.y,u[2]=r.z,u[3]=c.x,u[4]=c.y,u[5]=c.z,u[6]=f.x,u[7]=f.y,u[8]=f.z,u},v}),define("Core/EllipsoidTangentPlane",["./AxisAlignedBoundingBox","./Cartesian2","./Cartesian3","./Cartesian4","./defaultValue","./defined","./defineProperties","./DeveloperError","./Ellipsoid","./IntersectionTests","./Matrix4","./Plane","./Ray","./Transforms"],function(e,r,t,n,i,a,o,u,s,l,c,f,d,h){"use strict";var w=new n,m=function(e,r){if(!a(e))throw new u("origin is required.");if(r=i(r,s.WGS84),e=r.scaleToGeodeticSurface(e),!a(e))throw new u("origin must not be at the center of the ellipsoid.");var n=h.eastNorthUpToFixedFrame(e,r);this._ellipsoid=r,this._origin=e,this._xAxis=t.fromCartesian4(c.getColumn(n,0,w)),this._yAxis=t.fromCartesian4(c.getColumn(n,1,w));var o=t.fromCartesian4(c.getColumn(n,2,w));this._plane=f.fromPointNormal(e,o)};o(m.prototype,{ellipsoid:{get:function(){return this._ellipsoid}},origin:{get:function(){return this._origin}}});var p=new e;m.fromPoints=function(r,t){if(!a(r))throw new u("cartesians is required.");var n=e.fromPoints(r,p);return new m(n.center,t)};var y=new d,v=new t;m.prototype.projectPointOntoPlane=function(e,n){if(!a(e))throw new u("cartesian is required.");var i=y;i.origin=e,t.normalize(e,i.direction);var o=l.rayPlane(i,this._plane,v);if(a(o)||(t.negate(i.direction,i.direction),o=l.rayPlane(i,this._plane,v)),a(o)){var s=t.subtract(o,this._origin,o),c=t.dot(this._xAxis,s),f=t.dot(this._yAxis,s);return a(n)?(n.x=c,n.y=f,n):new r(c,f)}return void 0},m.prototype.projectPointsOntoPlane=function(e,r){if(!a(e))throw new u("cartesians is required.");a(r)||(r=[]);for(var t=0,n=e.length,i=0;n>i;i++){var o=this.projectPointOntoPlane(e[i],r[t]);a(o)&&(r[t]=o,t++)}return r.length=t,r};var g=new t;return m.prototype.projectPointsOntoEllipsoid=function(e,r){if(!a(e))throw new u("cartesians is required.");var n=e.length;a(r)?r.length=n:r=new Array(n);for(var i=this._ellipsoid,o=this._origin,s=this._xAxis,l=this._yAxis,c=g,f=0;n>f;++f){var d=e[f];t.multiplyByScalar(s,d.x,c),a(r[f])||(r[f]=new t);var h=t.add(o,c,r[f]);t.multiplyByScalar(l,d.y,c),t.add(h,c,h),i.scaleToGeocentricSurface(h,h)}return r},m}),define("Core/PolylineVolumeGeometryLibrary",["./Cartesian2","./Cartesian3","./Cartesian4","./Cartographic","./CornerType","./EllipsoidTangentPlane","./Math","./Matrix3","./Matrix4","./PolylinePipeline","./Quaternion","./Transforms"],function(e,r,t,n,i,a,o,u,s,l,c,f){"use strict";function d(e,r){for(var t=new Array(e.length),n=0;n<e.length;n++){var i=e[n];I=r.cartesianToCartographic(i,I),t[n]=I.height,e[n]=r.scaleToGeodeticSurface(i,i)}return t}function h(e,t,n,i){var a,o=e[0],u=e[1],s=r.angleBetween(o,u),l=Math.ceil(s/i),c=new Array(l);if(t===n){for(a=0;l>a;a++)c[a]=t;return c.push(n),c}var f=n-t,d=f/l;for(a=1;l>a;a++){var h=t+a*d;c[a]=h}return c[0]=t,c.push(n),c}function w(t,n,i,o){var u=new a(i,o),s=u.projectPointOntoPlane(r.add(i,t,H),H),l=u.projectPointOntoPlane(r.add(i,n,Z),Z),c=e.angleBetween(s,l);return l.x*s.y-l.y*s.x>=0?-c:c}function m(e,t,n,i,a,o,l,c){var d=F,h=W;D=f.eastNorthUpToFixedFrame(e,a,D),d=s.multiplyByPointAsVector(D,C,d),d=r.normalize(d,d);var m=w(d,t,e,a);L=u.fromRotationZ(m,L),G.z=o,D=s.multiplyTransformation(D,s.fromRotationTranslation(L,G,U),D);var p=B;p[0]=l;for(var y=0;c>y;y++)for(var v=0;v<n.length;v+=3)h=r.fromArray(n,v,h),h=u.multiplyByVector(p,h,h),h=s.multiplyByPoint(D,h,h),i.push(h.x,h.y,h.z);return i}function p(e,t,n,i,a,o,u){for(var s=0;s<e.length;s+=3){var l=r.fromArray(e,s,V);i=m(l,t,n,i,a,o[s/3],u,1)}return i}function y(e,r){var t=e.length,n=new Array(6*t),i=0,a=r.x+r.width/2,o=r.y+r.height/2,u=e[0];n[i++]=u.x-a,n[i++]=0,n[i++]=u.y-o;for(var s=1;t>s;s++){u=e[s];var l=u.x-a,c=u.y-o;n[i++]=l,n[i++]=0,n[i++]=c,n[i++]=l,n[i++]=0,n[i++]=c}return u=e[0],n[i++]=u.x-a,n[i++]=0,n[i++]=u.y-o,n}function v(e,r){for(var t=e.length,n=new Array(3*t),i=0,a=r.x+r.width/2,o=r.y+r.height/2,u=0;t>u;u++)n[i++]=e[u].x-a,n[i++]=0,n[i++]=e[u].y-o;return n}function g(e,t,n,a,s,l,f,d,h,w){var p,y=r.angleBetween(r.subtract(t,e,R),r.subtract(n,e,N)),v=a===i.BEVELED?0:Math.ceil(y/o.toRadians(5));p=s?u.fromQuaternion(c.fromAxisAngle(r.negate(e,R),y/(v+1),k),Y):u.fromQuaternion(c.fromAxisAngle(e,y/(v+1),k),Y);var g,q;if(t=r.clone(t,j),v>0)for(var x=w?2:1,E=0;v>E;E++)t=u.multiplyByVector(p,t,t),g=r.subtract(t,e,R),g=r.normalize(g,g),s||(g=r.negate(g,g)),q=l.scaleToGeodeticSurface(t,N),f=m(q,g,d,f,l,h,1,x);else g=r.subtract(t,e,R),g=r.normalize(g,g),s||(g=r.negate(g,g)),q=l.scaleToGeodeticSurface(t,N),f=m(q,g,d,f,l,h,1,1),n=r.clone(n,j),g=r.subtract(n,e,R),g=r.normalize(g,g),s||(g=r.negate(g,g)),q=l.scaleToGeodeticSurface(n,N),f=m(q,g,d,f,l,h,1,1);return f}function q(e,r){return o.equalsEpsilon(e.latitude,r.latitude,o.EPSILON6)&&o.equalsEpsilon(e.longitude,r.longitude,o.EPSILON6)}var x=[new r,new r],E=new r,b=new r,S=new r,_=new r,M=new r,O=new r,T=new r,P=new r,A=new r,R=new r,N=new r,z={},I=new n,C=new r(-1,0,0),D=new s,U=new s,L=new u,B=u.IDENTITY.clone(),F=new r,W=new t,G=new r,V=new r,k=new c,j=new r,Y=new u;z.removeDuplicatesFromShape=function(r){for(var t=r.length,n=[],i=t-1,a=0;t>a;i=a++){var o=r[i],u=r[a];e.equals(o,u)||n.push(u)}return n};var H=new r,Z=new r;z.angleIsGreaterThanPi=function(e,t,n,i){var o=new a(n,i),u=o.projectPointOntoPlane(r.add(n,e,H),H),s=o.projectPointOntoPlane(r.add(n,t,Z),Z);return s.x*u.y-s.y*u.x>=0};var X=new n,J=new n;z.removeDuplicatesFromPositions=function(e,r){var t=e.length;if(2>t)return e.slice(0);var n=[];n.push(e[0]);for(var i=1;t>i;++i){var a=e[i-1],o=e[i],u=r.cartesianToCartographic(a,X),s=r.cartesianToCartographic(o,J);q(u,s)||n.push(o)}return n};var Q=new r,K=new r;return z.computePositions=function(e,t,n,a,u){var s=a._ellipsoid,c=d(e,s),f=a._granularity,w=a._cornerType,q=u?y(t,n):v(t,n),N=u?v(t,n):void 0,I=n.height/2,C=n.width/2,D=e.length,U=[],L=u?[]:void 0,B=E,F=b,W=S,G=_,V=M,k=O,j=T,Y=P,H=A,Z=e[0],X=e[1];G=s.geodeticSurfaceNormal(Z,G),B=r.subtract(X,Z,B),B=r.normalize(B,B),Y=r.cross(G,B,Y),Y=r.normalize(Y,Y);var J=c[0],$=c[1];u&&(L=m(Z,Y,N,L,s,J+I,1,1)),H=r.clone(Z,H),Z=X,F=r.negate(B,F);for(var er,rr,tr=1;D-1>tr;tr++){var nr=u?2:1;X=e[tr+1],B=r.subtract(X,Z,B),B=r.normalize(B,B),W=r.add(B,F,W),W=r.normalize(W,W),G=s.geodeticSurfaceNormal(Z,G);var ir=r.multiplyByScalar(G,r.dot(B,G),Q);r.subtract(B,ir,ir),r.normalize(ir,ir);var ar=r.multiplyByScalar(G,r.dot(F,G),K);r.subtract(F,ar,ar),r.normalize(ar,ar);var or=!o.equalsEpsilon(Math.abs(r.dot(ir,ar)),1,o.EPSILON7);if(or){W=r.cross(W,G,W),W=r.cross(G,W,W),W=r.normalize(W,W);var ur=1/Math.max(.25,r.magnitude(r.cross(W,F,R))),sr=z.angleIsGreaterThanPi(B,F,Z,s);sr?(V=r.add(Z,r.multiplyByScalar(W,ur*C,W),V),k=r.add(V,r.multiplyByScalar(Y,C,k),k),x[0]=r.clone(H,x[0]),x[1]=r.clone(k,x[1]),er=h(x,J+I,$+I,f),rr=l.generateArc({positions:x,granularity:f,ellipsoid:s}),U=p(rr,Y,q,U,s,er,1),Y=r.cross(G,B,Y),Y=r.normalize(Y,Y),j=r.add(V,r.multiplyByScalar(Y,C,j),j),w===i.ROUNDED||w===i.BEVELED?g(V,k,j,w,sr,s,U,q,$+I,u):(W=r.negate(W,W),U=m(Z,W,q,U,s,$+I,ur,nr)),H=r.clone(j,H)):(V=r.add(Z,r.multiplyByScalar(W,ur*C,W),V),k=r.add(V,r.multiplyByScalar(Y,-C,k),k),x[0]=r.clone(H,x[0]),x[1]=r.clone(k,x[1]),er=h(x,J+I,$+I,f),rr=l.generateArc({positions:x,granularity:f,ellipsoid:s}),U=p(rr,Y,q,U,s,er,1),Y=r.cross(G,B,Y),Y=r.normalize(Y,Y),j=r.add(V,r.multiplyByScalar(Y,-C,j),j),w===i.ROUNDED||w===i.BEVELED?g(V,k,j,w,sr,s,U,q,$+I,u):U=m(Z,W,q,U,s,$+I,ur,nr),H=r.clone(j,H)),F=r.negate(B,F)}else U=m(H,Y,q,U,s,J+I,1,1),H=Z;J=$,$=c[tr+1],Z=X}x[0]=r.clone(H,x[0]),x[1]=r.clone(Z,x[1]),er=h(x,J+I,$+I,f),rr=l.generateArc({positions:x,granularity:f,ellipsoid:s}),U=p(rr,Y,q,U,s,er,1),u&&(L=m(Z,Y,N,L,s,$+I,1,1)),D=U.length;var lr=u?D+L.length:D,cr=new Float64Array(lr);return cr.set(U),u&&cr.set(L,D),cr},z}),define("Core/CorridorGeometryLibrary",["./Cartesian3","./CornerType","./defined","./isArray","./Math","./Matrix3","./PolylinePipeline","./PolylineVolumeGeometryLibrary","./Quaternion"],function(e,r,t,n,i,a,o,u,s){"use strict";function l(t,n,o,u,l){var c=e.angleBetween(e.subtract(n,t,m),e.subtract(o,t,p)),f=u===r.BEVELED?1:Math.ceil(c/i.toRadians(5))+1,d=3*f,h=new Array(d);h[d-3]=o.x,h[d-2]=o.y,h[d-1]=o.z;var w;w=l?a.fromQuaternion(s.fromAxisAngle(e.negate(t,m),c/f,A),R):a.fromQuaternion(s.fromAxisAngle(t,c/f,A),R);var y=0;n=e.clone(n,m);for(var v=0;f>v;v++)n=a.multiplyByVector(w,n,n),h[y++]=n.x,h[y++]=n.y,h[y++]=n.z;return h}function c(t){var n=q,i=x,a=E,o=t[1];i=e.fromArray(t[1],o.length-3,i),a=e.fromArray(t[0],0,a),n=e.multiplyByScalar(e.add(i,a,n),.5,n);var u=l(n,i,a,r.ROUNDED,!1),s=t.length-1,c=t[s-1];o=t[s],i=e.fromArray(c,c.length-3,i),a=e.fromArray(o,0,a),n=e.multiplyByScalar(e.add(i,a,n),.5,n);var f=l(n,i,a,r.ROUNDED,!1);return[u,f]}function f(r,t,n,i){var a=m;return i?a=e.add(r,t,a):(t=e.negate(t,t),a=e.add(r,t,a)),[a.x,a.y,a.z,n.x,n.y,n.z]}function d(r,t,n,i){for(var a=new Array(r.length),o=new Array(r.length),u=e.multiplyByScalar(t,n,m),s=e.negate(u,p),l=0,c=r.length-1,f=0;f<r.length;f+=3){var d=e.fromArray(r,f,y),h=e.add(d,s,v);a[l++]=h.x,a[l++]=h.y,a[l++]=h.z;var w=e.add(d,u,v);o[c--]=w.z,o[c--]=w.y,o[c--]=w.x}return i.push(a,o),i}function h(e,r){for(var t=0;t<e.length;t++)e[t]=r.scaleToGeodeticSurface(e[t],e[t]);return e}var w={},m=new e,p=new e,y=new e,v=new e,g=[new e,new e],q=new e,x=new e,E=new e,b=new e,S=new e,_=new e,M=new e,O=new e,T=new e,P=new e,A=new s,R=new a;w.addAttribute=function(e,r,n,i){var a=r.x,o=r.y,u=r.z;t(n)&&(e[n]=a,e[n+1]=o,e[n+2]=u),t(i)&&(e[i]=u,e[i-1]=o,e[i-2]=a)};var N=new e,z=new e;w.computePositions=function(t){var n=t.granularity,a=t.positions,s=t.ellipsoid;a=h(a,s);var w=t.width/2,p=t.cornerType,y=t.saveAttributes,v=q,A=x,R=E,I=b,C=S,D=_,U=M,L=O,B=T,F=P,W=[],G=y?[]:void 0,V=y?[]:void 0,k=a[0],j=a[1];A=e.normalize(e.subtract(j,k,A),A),v=s.geodeticSurfaceNormal(k,v),I=e.normalize(e.cross(v,A,I),I),y&&(G.push(I.x,I.y,I.z),V.push(v.x,v.y,v.z)),U=e.clone(k,U),k=j,R=e.negate(A,R);
  var Y,H,Z=[],X=a.length;for(H=1;X-1>H;H++){v=s.geodeticSurfaceNormal(k,v),j=a[H+1],A=e.normalize(e.subtract(j,k,A),A),C=e.normalize(e.add(A,R,C),C);var J=e.multiplyByScalar(v,e.dot(A,v),N);e.subtract(A,J,J),e.normalize(J,J);var Q=e.multiplyByScalar(v,e.dot(R,v),z);e.subtract(R,Q,Q),e.normalize(Q,Q);var K=!i.equalsEpsilon(Math.abs(e.dot(J,Q)),1,i.EPSILON7);if(K){C=e.cross(C,v,C),C=e.cross(v,C,C);var $=w/Math.max(.25,e.magnitude(e.cross(C,R,m))),er=u.angleIsGreaterThanPi(A,R,k,s);C=e.multiplyByScalar(C,$,C),er?(L=e.add(k,C,L),F=e.add(L,e.multiplyByScalar(I,w,F),F),B=e.add(L,e.multiplyByScalar(I,2*w,B),B),g[0]=e.clone(U,g[0]),g[1]=e.clone(F,g[1]),Y=o.generateArc({positions:g,granularity:n,ellipsoid:s}),W=d(Y,I,w,W),y&&(G.push(I.x,I.y,I.z),V.push(v.x,v.y,v.z)),D=e.clone(B,D),I=e.normalize(e.cross(v,A,I),I),B=e.add(L,e.multiplyByScalar(I,2*w,B),B),U=e.add(L,e.multiplyByScalar(I,w,U),U),p===r.ROUNDED||p===r.BEVELED?Z.push({leftPositions:l(L,D,B,p,er)}):Z.push({leftPositions:f(k,e.negate(C,C),B,er)})):(B=e.add(k,C,B),F=e.add(B,e.negate(e.multiplyByScalar(I,w,F),F),F),L=e.add(B,e.negate(e.multiplyByScalar(I,2*w,L),L),L),g[0]=e.clone(U,g[0]),g[1]=e.clone(F,g[1]),Y=o.generateArc({positions:g,granularity:n,ellipsoid:s}),W=d(Y,I,w,W),y&&(G.push(I.x,I.y,I.z),V.push(v.x,v.y,v.z)),D=e.clone(L,D),I=e.normalize(e.cross(v,A,I),I),L=e.add(B,e.negate(e.multiplyByScalar(I,2*w,L),L),L),U=e.add(B,e.negate(e.multiplyByScalar(I,w,U),U),U),p===r.ROUNDED||p===r.BEVELED?Z.push({rightPositions:l(B,D,L,p,er)}):Z.push({rightPositions:f(k,C,L,er)})),R=e.negate(A,R)}k=j}v=s.geodeticSurfaceNormal(k,v),g[0]=e.clone(U,g[0]),g[1]=e.clone(k,g[1]),Y=o.generateArc({positions:g,granularity:n,ellipsoid:s}),W=d(Y,I,w,W),y&&(G.push(I.x,I.y,I.z),V.push(v.x,v.y,v.z));var rr;return p===r.ROUNDED&&(rr=c(W)),{positions:W,corners:Z,lefts:G,normals:V,endPositions:rr}};var I=new e,C=new e;return w.scaleToGeodeticHeight=function(r,t,i,a){var o=r.length,u=n(a)?a:new Array(r.length);u.length=r.length;for(var s=t,l=0;o>l;l+=3){var c=i.scaleToGeodeticSurface(e.fromArray(r,l,C),C),f=I;0!==t&&(f=i.geodeticSurfaceNormal(c,f),f=e.multiplyByScalar(f,s,f),c=e.add(c,f,c)),u[l]=c.x,u[l+1]=c.y,u[l+2]=c.z}return u},w}),define("Core/GeometryType",["./freezeObject"],function(e){"use strict";var r={NONE:0,TRIANGLES:1,LINES:2,POLYLINES:3};return e(r)}),define("Core/PrimitiveType",["./freezeObject"],function(e){"use strict";var r={POINTS:0,LINES:1,LINE_LOOP:2,LINE_STRIP:3,TRIANGLES:4,TRIANGLE_STRIP:5,TRIANGLE_FAN:6,validate:function(e){return e===r.POINTS||e===r.LINES||e===r.LINE_LOOP||e===r.LINE_STRIP||e===r.TRIANGLES||e===r.TRIANGLE_STRIP||e===r.TRIANGLE_FAN}};return e(r)}),define("Core/Geometry",["./defaultValue","./defined","./DeveloperError","./GeometryType","./PrimitiveType"],function(e,r,t,n,i){"use strict";var a=function(a){if(a=e(a,e.EMPTY_OBJECT),!r(a.attributes))throw new t("options.attributes is required.");this.attributes=a.attributes,this.indices=a.indices,this.primitiveType=e(a.primitiveType,i.TRIANGLES),this.boundingSphere=a.boundingSphere,this.geometryType=e(a.geometryType,n.NONE),this.boundingSphereCV=void 0};return a.computeNumberOfVertices=function(e){if(!r(e))throw new t("geometry is required.");var n=-1;for(var i in e.attributes)if(e.attributes.hasOwnProperty(i)&&r(e.attributes[i])&&r(e.attributes[i].values)){var a=e.attributes[i],o=a.values.length/a.componentsPerAttribute;if(n!==o&&-1!==n)throw new t("All attribute lists must have the same number of attributes.");n=o}return n},a}),define("Core/GeometryAttribute",["./defaultValue","./defined","./DeveloperError"],function(e,r,t){"use strict";var n=function(n){if(n=e(n,e.EMPTY_OBJECT),!r(n.componentDatatype))throw new t("options.componentDatatype is required.");if(!r(n.componentsPerAttribute))throw new t("options.componentsPerAttribute is required.");if(n.componentsPerAttribute<1||n.componentsPerAttribute>4)throw new t("options.componentsPerAttribute must be between 1 and 4.");if(!r(n.values))throw new t("options.values is required.");this.componentDatatype=n.componentDatatype,this.componentsPerAttribute=n.componentsPerAttribute,this.normalize=e(n.normalize,!1),this.values=n.values};return n}),define("Core/GeometryAttributes",["./defaultValue"],function(e){"use strict";var r=function(r){r=e(r,e.EMPTY_OBJECT),this.position=r.position,this.normal=r.normal,this.st=r.st,this.binormal=r.binormal,this.tangent=r.tangent,this.color=r.color};return r}),define("Core/IndexDatatype",["./defined","./DeveloperError","./freezeObject","./Math"],function(e,r,t,n){"use strict";var i={UNSIGNED_BYTE:5121,UNSIGNED_SHORT:5123,UNSIGNED_INT:5125};return i.getSizeInBytes=function(e){switch(e){case i.UNSIGNED_BYTE:return Uint8Array.BYTES_PER_ELEMENT;case i.UNSIGNED_SHORT:return Uint16Array.BYTES_PER_ELEMENT;case i.UNSIGNED_INT:return Uint32Array.BYTES_PER_ELEMENT}throw new r("indexDatatype is required and must be a valid IndexDatatype constant.")},i.validate=function(r){return e(r)&&(r===i.UNSIGNED_BYTE||r===i.UNSIGNED_SHORT||r===i.UNSIGNED_INT)},i.createTypedArray=function(t,i){if(!e(t))throw new r("numberOfVertices is required.");return t>n.SIXTY_FOUR_KILOBYTES?new Uint32Array(i):new Uint16Array(i)},i.createTypedArrayFromArrayBuffer=function(t,i,a,o){if(!e(t))throw new r("numberOfVertices is required.");if(!e(i))throw new r("sourceArray is required.");if(!e(a))throw new r("byteOffset is required.");return t>n.SIXTY_FOUR_KILOBYTES?new Uint32Array(i,a,o):new Uint16Array(i,a,o)},t(i)}),define("Core/VertexFormat",["./defaultValue","./defined","./DeveloperError","./freezeObject"],function(e,r,t,n){"use strict";var i=function(r){r=e(r,e.EMPTY_OBJECT),this.position=e(r.position,!1),this.normal=e(r.normal,!1),this.st=e(r.st,!1),this.binormal=e(r.binormal,!1),this.tangent=e(r.tangent,!1),this.color=e(r.color,!1)};return i.POSITION_ONLY=n(new i({position:!0})),i.POSITION_AND_NORMAL=n(new i({position:!0,normal:!0})),i.POSITION_NORMAL_AND_ST=n(new i({position:!0,normal:!0,st:!0})),i.POSITION_AND_ST=n(new i({position:!0,st:!0})),i.POSITION_AND_COLOR=n(new i({position:!0,color:!0})),i.ALL=n(new i({position:!0,normal:!0,st:!0,binormal:!0,tangent:!0})),i.DEFAULT=i.POSITION_NORMAL_AND_ST,i.packedLength=6,i.pack=function(n,i,a){if(!r(n))throw new t("value is required");if(!r(i))throw new t("array is required");a=e(a,0),i[a++]=n.position?1:0,i[a++]=n.normal?1:0,i[a++]=n.st?1:0,i[a++]=n.binormal?1:0,i[a++]=n.tangent?1:0,i[a++]=n.color?1:0},i.unpack=function(n,a,o){if(!r(n))throw new t("array is required");return a=e(a,0),r(o)||(o=new i),o.position=1===n[a++],o.normal=1===n[a++],o.st=1===n[a++],o.binormal=1===n[a++],o.tangent=1===n[a++],o.color=1===n[a++],o},i.clone=function(e,t){return r(e)?(r(t)||(t=new i),t.position=e.position,t.normal=e.normal,t.st=e.st,t.binormal=e.binormal,t.tangent=e.tangent,t.color=e.color,t):void 0},i}),define("Core/CorridorGeometry",["./BoundingSphere","./Cartesian3","./ComponentDatatype","./CornerType","./CorridorGeometryLibrary","./defaultValue","./defined","./DeveloperError","./Ellipsoid","./Geometry","./GeometryAttribute","./GeometryAttributes","./IndexDatatype","./Math","./PolylinePipeline","./PrimitiveType","./VertexFormat"],function(e,r,t,n,i,a,o,u,s,l,c,f,d,h,w,m,p){"use strict";function y(e,t,n,a,o,u){var s=e.normals,l=e.tangents,c=e.binormals,f=r.normalize(r.cross(n,t,T),T);u.normal&&i.addAttribute(s,t,a,o),u.binormal&&i.addAttribute(c,n,a,o),u.tangent&&i.addAttribute(l,f,a,o)}function v(e,n,a){var u,s,l,w=e.positions,m=e.corners,p=e.endPositions,v=e.lefts,g=e.normals,q=new f,x=0,M=0,A=0;for(s=0;s<w.length;s+=2)l=w[s].length-3,x+=l,A+=2*l,M+=w[s+1].length-3;for(x+=3,M+=3,s=0;s<m.length;s++){u=m[s];var R=m[s].leftPositions;o(R)?(l=R.length,x+=l,A+=l):(l=m[s].rightPositions.length,M+=l,A+=l)}var N,z=o(p);z&&(N=p[0].length-3,x+=N,M+=N,N/=3,A+=6*N);var I,C,D,U,L,B,F=x+M,W=new Float64Array(F),G=n.normal?new Float32Array(F):void 0,V=n.tangent?new Float32Array(F):void 0,k=n.binormal?new Float32Array(F):void 0,j={normals:G,tangents:V,binormals:k},Y=0,H=F-1,Z=E,X=b,J=N/2,Q=d.createTypedArray(F/3,A),K=0;if(z){B=S,L=_;var $=p[0];for(Z=r.fromArray(g,0,Z),X=r.fromArray(v,0,X),s=0;J>s;s++)B=r.fromArray($,3*(J-1-s),B),L=r.fromArray($,3*(J+s),L),i.addAttribute(W,L,Y),i.addAttribute(W,B,void 0,H),y(j,Z,X,Y,H,n),C=Y/3,U=C+1,I=(H-2)/3,D=I-1,Q[K++]=I,Q[K++]=C,Q[K++]=D,Q[K++]=D,Q[K++]=C,Q[K++]=U,Y+=3,H-=3}var er=0,rr=0,tr=w[er++],nr=w[er++];W.set(tr,Y),W.set(nr,H-nr.length+1),X=r.fromArray(v,rr,X);var ir,ar;for(l=nr.length-3,s=0;l>s;s+=3)ir=a.geodeticSurfaceNormal(r.fromArray(tr,s,T),T),ar=a.geodeticSurfaceNormal(r.fromArray(nr,l-s,P),P),Z=r.normalize(r.add(ir,ar,Z),Z),y(j,Z,X,Y,H,n),C=Y/3,U=C+1,I=(H-2)/3,D=I-1,Q[K++]=I,Q[K++]=C,Q[K++]=D,Q[K++]=D,Q[K++]=C,Q[K++]=U,Y+=3,H-=3;for(ir=a.geodeticSurfaceNormal(r.fromArray(tr,l,T),T),ar=a.geodeticSurfaceNormal(r.fromArray(nr,l,P),P),Z=r.normalize(r.add(ir,ar,Z),Z),rr+=3,s=0;s<m.length;s++){var or;u=m[s];var ur,sr,lr=u.leftPositions,cr=u.rightPositions,fr=O,dr=S,hr=_;if(Z=r.fromArray(g,rr,Z),o(lr)){for(y(j,Z,X,void 0,H,n),H-=3,ur=U,sr=D,or=0;or<lr.length/3;or++)fr=r.fromArray(lr,3*or,fr),Q[K++]=ur,Q[K++]=sr-or-1,Q[K++]=sr-or,i.addAttribute(W,fr,void 0,H),dr=r.fromArray(W,3*(sr-or-1),dr),hr=r.fromArray(W,3*ur,hr),X=r.normalize(r.subtract(dr,hr,X),X),y(j,Z,X,void 0,H,n),H-=3;fr=r.fromArray(W,3*ur,fr),dr=r.subtract(r.fromArray(W,3*sr,dr),fr,dr),hr=r.subtract(r.fromArray(W,3*(sr-or),hr),fr,hr),X=r.normalize(r.add(dr,hr,X),X),y(j,Z,X,Y,void 0,n),Y+=3}else{for(y(j,Z,X,Y,void 0,n),Y+=3,ur=D,sr=U,or=0;or<cr.length/3;or++)fr=r.fromArray(cr,3*or,fr),Q[K++]=ur,Q[K++]=sr+or,Q[K++]=sr+or+1,i.addAttribute(W,fr,Y),dr=r.fromArray(W,3*ur,dr),hr=r.fromArray(W,3*(sr+or),hr),X=r.normalize(r.subtract(dr,hr,X),X),y(j,Z,X,Y,void 0,n),Y+=3;fr=r.fromArray(W,3*ur,fr),dr=r.subtract(r.fromArray(W,3*(sr+or),dr),fr,dr),hr=r.subtract(r.fromArray(W,3*sr,hr),fr,hr),X=r.normalize(r.negate(r.add(hr,dr,X),X),X),y(j,Z,X,void 0,H,n),H-=3}for(tr=w[er++],nr=w[er++],tr.splice(0,3),nr.splice(nr.length-3,3),W.set(tr,Y),W.set(nr,H-nr.length+1),l=nr.length-3,rr+=3,X=r.fromArray(v,rr,X),or=0;or<nr.length;or+=3)ir=a.geodeticSurfaceNormal(r.fromArray(tr,or,T),T),ar=a.geodeticSurfaceNormal(r.fromArray(nr,l-or,P),P),Z=r.normalize(r.add(ir,ar,Z),Z),y(j,Z,X,Y,H,n),U=Y/3,C=U-1,D=(H-2)/3,I=D+1,Q[K++]=I,Q[K++]=C,Q[K++]=D,Q[K++]=D,Q[K++]=C,Q[K++]=U,Y+=3,H-=3;Y-=3,H+=3}if(Z=r.fromArray(g,g.length-3,Z),y(j,Z,X,Y,H,n),z){Y+=3,H-=3,B=S,L=_;var wr=p[1];for(s=0;J>s;s++)B=r.fromArray(wr,3*(N-s-1),B),L=r.fromArray(wr,3*s,L),i.addAttribute(W,B,void 0,H),i.addAttribute(W,L,Y),y(j,Z,X,Y,H,n),U=Y/3,C=U-1,D=(H-2)/3,I=D+1,Q[K++]=I,Q[K++]=C,Q[K++]=D,Q[K++]=D,Q[K++]=C,Q[K++]=U,Y+=3,H-=3}if(q.position=new c({componentDatatype:t.DOUBLE,componentsPerAttribute:3,values:W}),n.st){var mr,pr,yr=new Float32Array(2*(F/3)),vr=0;if(z){x/=3,M/=3;var gr=Math.PI/(N+1);pr=1/(x-N+1),mr=1/(M-N+1);var qr,xr=N/2;for(s=xr+1;N+1>s;s++)qr=h.PI_OVER_TWO+gr*s,yr[vr++]=mr*(1+Math.cos(qr)),yr[vr++]=.5*(1+Math.sin(qr));for(s=1;M-N+1>s;s++)yr[vr++]=s*mr,yr[vr++]=0;for(s=N;s>xr;s--)qr=h.PI_OVER_TWO-s*gr,yr[vr++]=1-mr*(1+Math.cos(qr)),yr[vr++]=.5*(1+Math.sin(qr));for(s=xr;s>0;s--)qr=h.PI_OVER_TWO-gr*s,yr[vr++]=1-pr*(1+Math.cos(qr)),yr[vr++]=.5*(1+Math.sin(qr));for(s=x-N;s>0;s--)yr[vr++]=s*pr,yr[vr++]=1;for(s=1;xr+1>s;s++)qr=h.PI_OVER_TWO+gr*s,yr[vr++]=pr*(1+Math.cos(qr)),yr[vr++]=.5*(1+Math.sin(qr))}else{for(x/=3,M/=3,pr=1/(x-1),mr=1/(M-1),s=0;M>s;s++)yr[vr++]=s*mr,yr[vr++]=0;for(s=x;s>0;s--)yr[vr++]=(s-1)*pr,yr[vr++]=1}q.st=new c({componentDatatype:t.FLOAT,componentsPerAttribute:2,values:yr})}return n.normal&&(q.normal=new c({componentDatatype:t.FLOAT,componentsPerAttribute:3,values:j.normals})),n.tangent&&(q.tangent=new c({componentDatatype:t.FLOAT,componentsPerAttribute:3,values:j.tangents})),n.binormal&&(q.binormal=new c({componentDatatype:t.FLOAT,componentsPerAttribute:3,values:j.binormals})),{attributes:q,indices:Q}}function g(e,t){if(!(t.normal||t.binormal||t.tangent||t.st))return e;var n,a,o=e.position.values;(t.normal||t.binormal)&&(n=e.normal.values,a=e.binormal.values);var u,s=e.position.values.length/18,l=3*s,c=2*s,f=2*l;if(t.normal||t.binormal||t.tangent){var d=t.normal?new Float32Array(6*l):void 0,h=t.binormal?new Float32Array(6*l):void 0,w=t.tangent?new Float32Array(6*l):void 0,m=E,p=b,y=S,v=_,g=M,q=O,x=f;for(u=0;l>u;u+=3){var T=x+f;m=r.fromArray(o,u,m),p=r.fromArray(o,u+l,p),y=r.fromArray(o,(u+3)%l,y),p=r.subtract(p,m,p),y=r.subtract(y,m,y),v=r.normalize(r.cross(p,y,v),v),t.normal&&(i.addAttribute(d,v,T),i.addAttribute(d,v,T+3),i.addAttribute(d,v,x),i.addAttribute(d,v,x+3)),(t.tangent||t.binormal)&&(q=r.fromArray(n,u,q),t.binormal&&(i.addAttribute(h,q,T),i.addAttribute(h,q,T+3),i.addAttribute(h,q,x),i.addAttribute(h,q,x+3)),t.tangent&&(g=r.normalize(r.cross(q,v,g),g),i.addAttribute(w,g,T),i.addAttribute(w,g,T+3),i.addAttribute(w,g,x),i.addAttribute(w,g,x+3))),x+=6}if(t.normal){for(d.set(n),u=0;l>u;u+=3)d[u+l]=-n[u],d[u+l+1]=-n[u+1],d[u+l+2]=-n[u+2];e.normal.values=d}else e.normal=void 0;if(t.binormal?(h.set(a),h.set(a,l),e.binormal.values=h):e.binormal=void 0,t.tangent){var P=e.tangent.values;w.set(P),w.set(P,l),e.tangent.values=w}}if(t.st){var A=e.st.values,R=new Float32Array(6*c);R.set(A),R.set(A,c);for(var N=2*c,z=0;2>z;z++){for(R[N++]=A[0],R[N++]=A[1],u=2;c>u;u+=2){var I=A[u],C=A[u+1];R[N++]=I,R[N++]=C,R[N++]=I,R[N++]=C}R[N++]=A[0],R[N++]=A[1]}e.st.values=R}return e}function q(e,r,t){t[r++]=e[0],t[r++]=e[1],t[r++]=e[2];for(var n=3;n<e.length;n+=3){var i=e[n],a=e[n+1],o=e[n+2];t[r++]=i,t[r++]=a,t[r++]=o,t[r++]=i,t[r++]=a,t[r++]=o}return t[r++]=e[0],t[r++]=e[1],t[r++]=e[2],t}function x(e,r){var t=new p({position:r.positon,normal:r.normal||r.binormal,tangent:r.tangent,binormal:r.normal||r.binormal,st:r.st}),n=e.ellipsoid,a=i.computePositions(e),o=v(a,t,n),u=e.height,s=e.extrudedHeight,l=o.attributes,c=o.indices,f=l.position.values,h=f.length,w=new Float64Array(6*h),m=new Float64Array(h);m.set(f);var y=new Float64Array(4*h);f=i.scaleToGeodeticHeight(f,u,n,f),y=q(f,0,y),m=i.scaleToGeodeticHeight(m,s,n,m),y=q(m,2*h,y),w.set(f),w.set(m,h),w.set(y,2*h),l.position.values=w,h/=3;var x,E=c.length,b=h+h,S=d.createTypedArray(w.length/3,2*E+3*b);S.set(c);var _=E;for(x=0;E>x;x+=3){var M=c[x],O=c[x+1],T=c[x+2];S[_++]=T+h,S[_++]=O+h,S[_++]=M+h}l=g(l,r);var P,A,R,N;for(x=0;b>x;x+=2)P=x+b,A=P+b,R=P+1,N=A+1,S[_++]=P,S[_++]=A,S[_++]=R,S[_++]=R,S[_++]=A,S[_++]=N;return{attributes:l,indices:S}}var E=new r,b=new r,S=new r,_=new r,M=new r,O=new r,T=new r,P=new r,A=function(e){e=a(e,a.EMPTY_OBJECT);var t=e.positions,i=e.width;if(!o(t))throw new u("options.positions is required.");if(!o(i))throw new u("options.width is required.");this._positions=t,this._ellipsoid=s.clone(a(e.ellipsoid,s.WGS84)),this._vertexFormat=p.clone(a(e.vertexFormat,p.DEFAULT)),this._width=i,this._height=a(e.height,0),this._extrudedHeight=a(e.extrudedHeight,this._height),this._cornerType=a(e.cornerType,n.ROUNDED),this._granularity=a(e.granularity,h.RADIANS_PER_DEGREE),this._workerName="createCorridorGeometry",this.packedLength=1+t.length*r.packedLength+s.packedLength+p.packedLength+5};A.pack=function(e,t,n){if(!o(e))throw new u("value is required");if(!o(t))throw new u("array is required");n=a(n,0);var i=e._positions,l=i.length;t[n++]=l;for(var c=0;l>c;++c,n+=r.packedLength)r.pack(i[c],t,n);s.pack(e._ellipsoid,t,n),n+=s.packedLength,p.pack(e._vertexFormat,t,n),n+=p.packedLength,t[n++]=e._width,t[n++]=e._height,t[n++]=e._extrudedHeight,t[n++]=e._cornerType,t[n]=e._granularity};var R=s.clone(s.UNIT_SPHERE),N=new p,z={positions:void 0,ellipsoid:R,vertexFormat:N,width:void 0,height:void 0,extrudedHeight:void 0,cornerType:void 0,granularity:void 0};return A.unpack=function(e,t,n){if(!o(e))throw new u("array is required");t=a(t,0);for(var i=e[t++],l=new Array(i),c=0;i>c;++c,t+=r.packedLength)l[c]=r.unpack(e,t);var f=s.unpack(e,t,R);t+=s.packedLength;var d=p.unpack(e,t,N);t+=p.packedLength;var h=e[t++],w=e[t++],m=e[t++],y=e[t++],v=e[t];return o(n)?(n._positions=l,n._ellipsoid=s.clone(f,n._ellipsoid),n._vertexFormat=p.clone(d,n._vertexFormat),n._width=h,n._height=w,n._extrudedHeight=m,n._cornerType=y,n._granularity=v,n):(z.positions=l,z.width=h,z.height=w,z.extrudedHeight=m,z.cornerType=y,z.granularity=v,new A(z))},A.createGeometry=function(r){var t=r._positions,n=r._height,a=r._extrudedHeight,u=n!==a,s=w.removeDuplicates(t);if(o(s)||(s=t),s.length<2)return void 0;var c,f=r._ellipsoid,d=r._vertexFormat,h={ellipsoid:f,positions:s,width:r._width,cornerType:r._cornerType,granularity:r._granularity,saveAttributes:!0};if(u){var p=Math.max(n,a);a=Math.min(n,a),n=p,h.height=n,h.extrudedHeight=a,c=x(h,d)}else{var y=i.computePositions(h);c=v(y,d,f),c.attributes.position.values=i.scaleToGeodeticHeight(c.attributes.position.values,n,f,c.attributes.position.values)}var g=c.attributes,q=e.fromVertices(g.position.values,void 0,3);return d.position||(c.attributes.position.values=void 0),new l({attributes:g,indices:c.indices,primitiveType:m.TRIANGLES,boundingSphere:q})},A}),define("Workers/createCorridorGeometry",["../Core/CorridorGeometry","../Core/defined","../Core/Ellipsoid"],function(e,r,t){"use strict";function n(n,i){return r(i)&&(n=e.unpack(n,i)),n._ellipsoid=t.clone(n._ellipsoid),e.createGeometry(n)}return n})}();