From 6fccf2ca973e20910926dbdbd6f5db90a6667295 Mon Sep 17 00:00:00 2001 From: Gael Le Bihan Date: Thu, 17 Mar 2016 17:31:34 +0100 Subject: [PATCH] feat(scene): add cache texture to model chore(bower) update version to 1.18.2 --- Cesium.js | 28 ++++++++++++++-------------- bower.json | 2 +- 2 files changed, 15 insertions(+), 15 deletions(-) diff --git a/Cesium.js b/Cesium.js index 79af92d..08d1e1d 100644 --- a/Cesium.js +++ b/Cesium.js @@ -448,20 +448,20 @@ this._primitive=void 0,this._outlinePrimitive=void 0,this._geometryUpdater=t,thi this._updateTableLength=!0,this._definitionChanged.raiseEvent(this)},d.prototype.equals=function(e){if(this===e)return!0;if(!i(e))return!1;if(this._type!==e._type||this._interpolationDegree!==e._interpolationDegree||this._interpolationAlgorithm!==e._interpolationAlgorithm)return!1;var t=this._derivativeTypes,r=i(t),n=e._derivativeTypes,o=i(n);if(r!==o)return!1;var a,l;if(r){if(l=t.length,l!==n.length)return!1;for(a=0;l>a;a++)if(t[a]!==n[a])return!1}var u=this._times,c=e._times;if(l=u.length,l!==c.length)return!1;for(a=0;l>a;a++)if(!s.equals(u[a],c[a]))return!1;var h=this._values,d=e._values;for(a=0;l>a;a++)if(h[a]!==d[a])return!1;return!0},d._mergeNewSamples=h,d}),i("DataSources/SampledPositionProperty",["../Core/Cartesian3","../Core/defaultValue","../Core/defined","../Core/defineProperties","../Core/DeveloperError","../Core/Event","../Core/ReferenceFrame","./PositionProperty","./Property","./SampledProperty"],function(e,t,i,r,n,o,a,s,l,u){"use strict";function c(i,r){r=t(r,0);var n;if(r>0){n=new Array(r);for(var s=0;r>s;s++)n[s]=e}this._numberOfDerivatives=r,this._property=new u(e,n),this._definitionChanged=new o,this._referenceFrame=t(i,a.FIXED),this._property._definitionChanged.addEventListener(function(){this._definitionChanged.raiseEvent(this)},this)}return r(c.prototype,{isConstant:{get:function(){return this._property.isConstant}},definitionChanged:{get:function(){return this._definitionChanged}},referenceFrame:{get:function(){return this._referenceFrame}},interpolationDegree:{get:function(){return this._property.interpolationDegree}},interpolationAlgorithm:{get:function(){return this._property.interpolationAlgorithm}},numberOfDerivatives:{get:function(){return this._numberOfDerivatives}},forwardExtrapolationType:{get:function(){return this._property.forwardExtrapolationType},set:function(e){this._property.forwardExtrapolationType=e}},forwardExtrapolationDuration:{get:function(){return this._property.forwardExtrapolationDuration},set:function(e){this._property.forwardExtrapolationDuration=e}},backwardExtrapolationType:{get:function(){return this._property.backwardExtrapolationType},set:function(e){this._property.backwardExtrapolationType=e}},backwardExtrapolationDuration:{get:function(){return this._property.backwardExtrapolationDuration},set:function(e){this._property.backwardExtrapolationDuration=e}}}),c.prototype.getValue=function(e,t){return this.getValueInReferenceFrame(e,a.FIXED,t)},c.prototype.getValueInReferenceFrame=function(e,t,r){return r=this._property.getValue(e,r),i(r)?s.convertToReferenceFrame(e,r,this._referenceFrame,t,r):void 0},c.prototype.setInterpolationOptions=function(e){this._property.setInterpolationOptions(e)},c.prototype.addSample=function(e,t,i){this._numberOfDerivatives;this._property.addSample(e,t,i)},c.prototype.addSamples=function(e,t,i){this._property.addSamples(e,t,i)},c.prototype.addSamplesPackedArray=function(e,t){this._property.addSamplesPackedArray(e,t)},c.prototype.equals=function(e){return this===e||e instanceof c&&l.equals(this._property,e._property)&&this._referenceFrame===e._referenceFrame},c}),i("DataSources/StripeOrientation",["../Core/freezeObject"],function(e){"use strict";var t={HORIZONTAL:0,VERTICAL:1};return e(t)}),i("DataSources/StripeMaterialProperty",["../Core/Color","../Core/defaultValue","../Core/defined","../Core/defineProperties","../Core/Event","./createPropertyDescriptor","./Property","./StripeOrientation"],function(e,t,i,r,n,o,a,s){"use strict";function l(e){e=t(e,t.EMPTY_OBJECT),this._definitionChanged=new n,this._orientation=void 0,this._orientationSubscription=void 0,this._evenColor=void 0,this._evenColorSubscription=void 0,this._oddColor=void 0,this._oddColorSubscription=void 0,this._offset=void 0,this._offsetSubscription=void 0,this._repeat=void 0,this._repeatSubscription=void 0,this.orientation=e.orientation,this.evenColor=e.evenColor,this.oddColor=e.oddColor,this.offset=e.offset,this.repeat=e.repeat}var u=s.HORIZONTAL,c=e.WHITE,h=e.BLACK,d=0,p=1;return r(l.prototype,{isConstant:{get:function(){return a.isConstant(this._orientation)&&a.isConstant(this._evenColor)&&a.isConstant(this._oddColor)&&a.isConstant(this._offset)&&a.isConstant(this._repeat)}},definitionChanged:{get:function(){return this._definitionChanged}},orientation:o("orientation"),evenColor:o("evenColor"),oddColor:o("oddColor"),offset:o("offset"),repeat:o("repeat")}),l.prototype.getType=function(e){return"Stripe"},l.prototype.getValue=function(e,t){return i(t)||(t={}),t.horizontal=a.getValueOrDefault(this._orientation,e,u)===s.HORIZONTAL,t.evenColor=a.getValueOrClonedDefault(this._evenColor,e,c,t.evenColor),t.oddColor=a.getValueOrClonedDefault(this._oddColor,e,h,t.oddColor),t.offset=a.getValueOrDefault(this._offset,e,d),t.repeat=a.getValueOrDefault(this._repeat,e,p),t},l.prototype.equals=function(e){return this===e||e instanceof l&&a.equals(this._orientation,e._orientation)&&a.equals(this._evenColor,e._evenColor)&&a.equals(this._oddColor,e._oddColor)&&a.equals(this._offset,e._offset)&&a.equals(this._repeat,e._repeat)},l}),i("DataSources/TimeIntervalCollectionPositionProperty",["../Core/defaultValue","../Core/defined","../Core/defineProperties","../Core/DeveloperError","../Core/Event","../Core/ReferenceFrame","../Core/TimeIntervalCollection","./PositionProperty","./Property"],function(e,t,i,r,n,o,a,s,l){"use strict";function u(t){this._definitionChanged=new n,this._intervals=new a,this._intervals.changedEvent.addEventListener(u.prototype._intervalsChanged,this),this._referenceFrame=e(t,o.FIXED)}return i(u.prototype,{isConstant:{get:function(){return this._intervals.isEmpty}},definitionChanged:{get:function(){return this._definitionChanged}},intervals:{get:function(){return this._intervals}},referenceFrame:{get:function(){return this._referenceFrame}}}),u.prototype.getValue=function(e,t){return this.getValueInReferenceFrame(e,o.FIXED,t)},u.prototype.getValueInReferenceFrame=function(e,i,r){var n=this._intervals.findDataForIntervalContainingDate(e);return t(n)?s.convertToReferenceFrame(e,n,this._referenceFrame,i,r):void 0},u.prototype.equals=function(e){return this===e||e instanceof u&&this._intervals.equals(e._intervals,l.equals)&&this._referenceFrame===e._referenceFrame},u.prototype._intervalsChanged=function(){this._definitionChanged.raiseEvent(this)},u}),i("DataSources/TimeIntervalCollectionProperty",["../Core/defined","../Core/defineProperties","../Core/DeveloperError","../Core/Event","../Core/TimeIntervalCollection","./Property"],function(e,t,i,r,n,o){"use strict";function a(){this._definitionChanged=new r,this._intervals=new n,this._intervals.changedEvent.addEventListener(a.prototype._intervalsChanged,this)}return t(a.prototype,{isConstant:{get:function(){return this._intervals.isEmpty}},definitionChanged:{get:function(){return this._definitionChanged}},intervals:{get:function(){return this._intervals}}}),a.prototype.getValue=function(t,i){var r=this._intervals.findDataForIntervalContainingDate(t);return e(r)&&"function"==typeof r.clone?r.clone(i):r},a.prototype.equals=function(e){return this===e||e instanceof a&&this._intervals.equals(e._intervals,o.equals)},a.prototype._intervalsChanged=function(){this._definitionChanged.raiseEvent(this)},a}),i("DataSources/CzmlDataSource",["../Core/Cartesian2","../Core/Cartesian3","../Core/Cartographic","../Core/ClockRange","../Core/ClockStep","../Core/Color","../Core/createGuid","../Core/defaultValue","../Core/defined","../Core/defineProperties","../Core/DeveloperError","../Core/Ellipsoid","../Core/Event","../Core/ExtrapolationType","../Core/getAbsoluteUri","../Core/getFilenameFromUri","../Core/HermitePolynomialApproximation","../Core/isArray","../Core/Iso8601","../Core/JulianDate","../Core/LagrangePolynomialApproximation","../Core/LinearApproximation","../Core/loadJson","../Core/Math","../Core/Quaternion","../Core/Rectangle","../Core/ReferenceFrame","../Core/RuntimeError","../Core/Spherical","../Core/TimeInterval","../Core/TimeIntervalCollection","../Scene/HorizontalOrigin","../Scene/LabelStyle","../Scene/VerticalOrigin","../ThirdParty/Uri","../ThirdParty/when","./BillboardGraphics","./ColorMaterialProperty","./CompositeMaterialProperty","./CompositePositionProperty","./CompositeProperty","./ConstantPositionProperty","./ConstantProperty","./DataSource","./DataSourceClock","./EllipseGraphics","./EllipsoidGraphics","./EntityCollection","./GridMaterialProperty","./ImageMaterialProperty","./LabelGraphics","./ModelGraphics","./NodeTransformationProperty","./PathGraphics","./PointGraphics","./PolygonGraphics","./PolylineGlowMaterialProperty","./PolylineGraphics","./PolylineOutlineMaterialProperty","./PositionPropertyArray","./PropertyBag","./RectangleGraphics","./ReferenceProperty","./Rotation","./SampledPositionProperty","./SampledProperty","./StripeMaterialProperty","./StripeOrientation","./TimeIntervalCollectionPositionProperty","./TimeIntervalCollectionProperty","./WallGraphics"],function(e,t,i,r,n,o,a,s,l,u,c,h,d,p,m,f,v,g,_,y,C,E,S,w,T,x,b,A,P,I,M,D,R,O,N,L,F,B,V,k,z,U,G,W,H,q,j,Y,X,Z,K,Q,J,$,ee,te,ie,re,ne,oe,ae,se,le,ue,ce,he,de,pe,me,fe,ve){"use strict";function ge(e,t){return"#"===t[0]&&(t=ot+t),le.fromString(e,t)}function _e(e){var t=e.rgbaf;if(l(t))return t;var i=e.rgba;if(l(i)){if(i.length===o.length)return[o.byteToFloat(i[0]),o.byteToFloat(i[1]),o.byteToFloat(i[2]),o.byteToFloat(i[3])];var r=i.length;t=new Array(r);for(var n=0;r>n;n+=5)t[n]=i[n],t[n+1]=o.byteToFloat(i[n+1]),t[n+2]=o.byteToFloat(i[n+2]),t[n+3]=o.byteToFloat(i[n+3]),t[n+4]=o.byteToFloat(i[n+4]);return t}}function ye(e,t){var i=s(e.uri,e);return l(t)&&(i=m(i,m(t))),i}function Ce(e){var t=e.wsenDegrees;if(l(t)){for(var i=t.length,r=0;i>r;r++)t[r]=w.toRadians(t[r]);return t}return e.wsen}function Ee(e){if(l(e.cartesian))return e.cartesian;if(l(e.cartesianVelocity))return e.cartesianVelocity;if(l(e.unitCartesian))return e.unitCartesian;var i,r,n,o=e.unitSpherical;if(l(o)){if(r=o.length,2===r)st.clock=o[0],st.cone=o[1],t.fromSpherical(st,at),n=[at.x,at.y,at.z];else{var a=0;for(n=new Array(r/3*4),i=0;r>i;i+=4)n[i]=o[a++],st.clock=o[a++],st.cone=o[a++],t.fromSpherical(st,at),n[i+1]=at.x,n[i+2]=at.y,n[i+3]=at.z}return n}var s=e.cartographicRadians;if(l(s)){if(3===s.length)lt.longitude=s[0],lt.latitude=s[1],lt.height=s[2],h.WGS84.cartographicToCartesian(lt,at),n=[at.x,at.y,at.z];else for(r=s.length,n=new Array(r),i=0;r>i;i+=4)lt.longitude=s[i+1],lt.latitude=s[i+2],lt.height=s[i+3],h.WGS84.cartographicToCartesian(lt,at),n[i]=s[i],n[i+1]=at.x,n[i+2]=at.y,n[i+3]=at.z;return n}var u=e.cartographicDegrees;if(!l(u))throw new A(JSON.stringify(e)+" is not a valid CZML interval.");if(3===u.length)lt.longitude=w.toRadians(u[0]),lt.latitude=w.toRadians(u[1]),lt.height=u[2],h.WGS84.cartographicToCartesian(lt,at),n=[at.x,at.y,at.z];else for(r=u.length,n=new Array(r),i=0;r>i;i+=4)lt.longitude=w.toRadians(u[i+1]),lt.latitude=w.toRadians(u[i+2]),lt.height=u[i+3],h.WGS84.cartographicToCartesian(lt,at),n[i]=u[i],n[i+1]=at.x,n[i+2]=at.y,n[i+3]=at.z;return n}function Se(e,t){var i=e[t],r=e[t+1],n=e[t+2],o=e[t+3],a=1/Math.sqrt(i*i+r*r+n*n+o*o);e[t]=i*a,e[t+1]=r*a,e[t+2]=n*a,e[t+3]=o*a}function we(e){var t=e.unitQuaternion;if(l(t)){if(4===t.length)return Se(t,0),t;for(var i=1;ih);var g="function"==typeof e.unpack&&e!==ue;if(!d&&!v)return void(f?t[i]=ge(a,r.reference):g?t[i]=new G(e.unpack(p,0)):t[i]=new G(p));var C,E=t[i],S=r.epoch;if(l(S)&&(C=y.fromIso8601(S)),d&&!v)return E instanceof he||(E=new he(e),t[i]=E),E.addSamplesPackedArray(p,C),void xe(r,E);var w;if(!d&&v)return u=u.clone(),f?u.data=ge(a,r.reference):g?u.data=e.unpack(p,0):u.data=p,l(E)||(E=f?new z:new fe,t[i]=E),void(!f&&E instanceof fe?E.intervals.addInterval(u):E instanceof z?(u.data=f?u.data:new G(u.data),E.intervals.addInterval(u)):(w=_.MAXIMUM_INTERVAL.clone(),w.data=E,E=new z,t[i]=E,E.intervals.addInterval(w),u.data=f?u.data:new G(u.data),E.intervals.addInterval(u)));l(E)||(E=new z,t[i]=E),E instanceof z||(w=_.MAXIMUM_INTERVAL.clone(),w.data=E,E=new z,t[i]=E,E.intervals.addInterval(w));var T=E.intervals;w=T.findInterval(u),l(w)&&w.data instanceof he||(w=u.clone(),w.data=new he(e),T.addInterval(w)),w.data.addSamplesPackedArray(p,C),xe(r,w.data)}function Ae(e,t,i,r,n,o,a){if(l(r))if(g(r))for(var s=0,u=r.length;u>s;s++)be(e,t,i,r[s],n,o,a);else be(e,t,i,r,n,o,a)}function Pe(e,i,r,n,o,a){var u,c=r.interval;l(c)?(ht.iso8601=c,u=I.fromIso8601(ht),l(n)&&(u=I.intersect(u,n,ut))):l(n)&&(u=n);var h,d,p,m=!1,f=l(r.cartesianVelocity)?1:0,v=t.packedLength*(f+1),g=l(r.reference),C=l(u)&&!u.equals(_.MAXIMUM_INTERVAL);if(g||(l(r.referenceFrame)&&(h=b[r.referenceFrame]),h=s(h,b.FIXED),d=Ee(r),p=s(d.length,1),m=p>v),!m&&!C)return void(g?e[i]=ge(a,r.reference):e[i]=new U(t.unpack(d),h));var E,S=e[i],w=r.epoch;if(l(w)&&(E=y.fromIso8601(w)),m&&!C)return(!(S instanceof ce)||l(h)&&S.referenceFrame!==h)&&(S=new ce(h,f),e[i]=S),S.addSamplesPackedArray(d,E),void xe(r,S);var T;if(!m&&C)return u=u.clone(),g?u.data=ge(a,r.reference):u.data=t.unpack(d),l(S)||(S=g?new k(h):new me(h),e[i]=S),void(!g&&S instanceof me&&l(h)&&S.referenceFrame===h?S.intervals.addInterval(u):S instanceof k?(u.data=g?u.data:new U(u.data,h),S.intervals.addInterval(u)):(T=_.MAXIMUM_INTERVAL.clone(),T.data=S,S=new k(S.referenceFrame),e[i]=S,S.intervals.addInterval(T),u.data=g?u.data:new U(u.data,h),S.intervals.addInterval(u)));l(S)?S instanceof k||(T=_.MAXIMUM_INTERVAL.clone(),T.data=S,S=new k(S.referenceFrame),e[i]=S,S.intervals.addInterval(T)):(S=new k(h),e[i]=S);var x=S.intervals;T=x.findInterval(u),l(T)&&T.data instanceof ce&&(!l(h)||T.data.referenceFrame===h)||(T=u.clone(),T.data=new ce(h,f),x.addInterval(T)),T.data.addSamplesPackedArray(d,E),xe(r,T.data)}function Ie(e,t,i,r,n,o){if(l(i))if(g(i))for(var a=0,s=i.length;s>a;a++)Pe(e,t,i[a],r,n,o);else Pe(e,t,i,r,n,o)}function Me(t,i,r,n,a,s){var u,c=r.interval;l(c)?(ht.iso8601=c,u=I.fromIso8601(ht),l(n)&&(u=I.intersect(u,n,ut))):l(n)&&(u=n);var h,d,p=t[i];if(l(u)){p instanceof V||(p=new V,t[i]=p);var m=p.intervals;d=m.findInterval({start:u.start,stop:u.stop}),l(d)?h=d.data:(d=u.clone(),m.addInterval(d))}else h=p;var f;l(r.solidColor)?(h instanceof B||(h=new B),f=r.solidColor,Ae(o,h,"color",f.color,void 0,void 0,s)):l(r.grid)?(h instanceof X||(h=new X),f=r.grid,Ae(o,h,"color",f.color,void 0,a,s),Ae(Number,h,"cellAlpha",f.cellAlpha,void 0,a,s),Ae(e,h,"lineThickness",f.lineThickness,void 0,a,s),Ae(e,h,"lineOffset",f.lineOffset,void 0,a,s),Ae(e,h,"lineCount",f.lineCount,void 0,a,s)):l(r.image)?(h instanceof Z||(h=new Z),f=r.image,Ae(Image,h,"image",f.image,void 0,a,s),Ae(e,h,"repeat",f.repeat,void 0,a,s),Ae(Number,h,"alpha",f.alpha,void 0,a,s)):l(r.stripe)?(h instanceof de||(h=new de),f=r.stripe,Ae(pe,h,"orientation",f.orientation,void 0,a,s),Ae(o,h,"evenColor",f.evenColor,void 0,a,s),Ae(o,h,"oddColor",f.oddColor,void 0,a,s),Ae(Number,h,"offset",f.offset,void 0,a,s),Ae(Number,h,"repeat",f.repeat,void 0,a,s)):l(r.polylineOutline)?(h instanceof ne||(h=new ne),f=r.polylineOutline,Ae(o,h,"color",f.color,void 0,a,s),Ae(o,h,"outlineColor",f.outlineColor,void 0,a,s),Ae(Number,h,"outlineWidth",f.outlineWidth,void 0,a,s)):l(r.polylineGlow)&&(h instanceof ie||(h=new ie),f=r.polylineGlow,Ae(o,h,"color",f.color,void 0,a,s),Ae(Number,h,"glowPower",f.glowPower,void 0,a,s)),l(d)?d.data=h:t[i]=h}function De(e,t,i,r,n,o){if(l(i))if(g(i))for(var a=0,s=i.length;s>a;a++)Me(e,t,i[a],r,n,o);else Me(e,t,i,r,n,o)}function Re(e,t,i,r){e.name=s(t.name,e.name)}function Oe(e,t,i,r){var n=t.description;l(n)&&Ae(String,e,"description",n,void 0,r,i)}function Ne(e,t,i,r){var n=t.position;l(n)&&Ie(e,"position",n,void 0,r,i)}function Le(e,i,r,n){var o=i.viewFrom;l(o)&&Ae(t,e,"viewFrom",o,void 0,n,r)}function Fe(e,t,i,r){var n=t.orientation;l(n)&&Ae(T,e,"orientation",n,void 0,r,i)}function Be(e,i,r,n){var o,a,s=r.references;if(l(s)){var u=[];for(o=0,a=s.length;a>o;o++)u.push(ge(n,s[o]));var c=r.interval;if(l(c)){if(c=I.fromIso8601(c),!(e[i]instanceof k)){c.data=new oe(u);var d=new k;d.intervals.addInterval(c),e[i]=d}}else e[i]=new oe(u)}else{var p=[],m=r.cartesian;if(l(m)){for(o=0,a=m.length;a>o;o+=3)p.push(new t(m[o],m[o+1],m[o+2]));r.array=p}else if(m=r.cartographicRadians,l(m)){for(o=0,a=m.length;a>o;o+=3)lt.longitude=m[o],lt.latitude=m[o+1],lt.height=m[o+2],p.push(h.WGS84.cartographicToCartesian(lt));r.array=p}else if(m=r.cartographicDegrees,l(m)){for(o=0,a=m.length;a>o;o+=3)p.push(t.fromDegrees(m[o],m[o+1],m[o+2]));r.array=p}l(r.array)&&Ae(Array,e,i,r,void 0,void 0,n)}}function Ve(e,t,i,r){if(l(i))if(g(i))for(var n=i.length,o=0;n>o;o++)Be(e,t,i[o],r);else Be(e,t,i,r)}function ke(e,t,i,r){var n,o=t.availability;if(l(o)){var a;if(g(o))for(var s=o.length,u=0;s>u;u++)l(a)||(a=new M),ht.iso8601=o[u],n=I.fromIso8601(ht),a.addInterval(n);else ht.iso8601=o,n=I.fromIso8601(ht),a=new M,a.addInterval(n);e.availability=a}}function ze(i,r,n,a){var s=r.billboard;if(l(s)){var u,c=s.interval;l(c)&&(ht.iso8601=c,u=I.fromIso8601(ht));var h=i.billboard;l(h)||(i.billboard=h=new F),Ae(o,h,"color",s.color,u,a,n),Ae(t,h,"eyeOffset",s.eyeOffset,u,a,n),Ae(D,h,"horizontalOrigin",s.horizontalOrigin,u,a,n),Ae(Image,h,"image",s.image,u,a,n),Ae(e,h,"pixelOffset",s.pixelOffset,u,a,n),Ae(Number,h,"scale",s.scale,u,a,n),Ae(ue,h,"rotation",s.rotation,u,a,n),Ae(t,h,"alignedAxis",s.alignedAxis,u,a,n),Ae(Boolean,h,"show",s.show,u,a,n),Ae(O,h,"verticalOrigin",s.verticalOrigin,u,a,n),Ae(Boolean,h,"sizeInMeters",s.sizeInMeters,u,a,n)}}function Ue(e,t){var i=e.version;if(l(i)&&"string"==typeof i){var r=i.split(".");if(2===r.length){if("1"!==r[0])throw new A("Cesium only supports CZML version 1.");t._version=i}}if(!l(t._version))throw new A("CZML version information invalid. It is expected to be a property on the document object in the . version format.");var n=t._documentPacket;l(e.name)&&(n.name=e.name);var o=e.clock;if(l(o)){var a=n.clock;l(a)?(a.interval=s(o.interval,a.interval),a.currentTime=s(o.currentTime,a.currentTime),a.range=s(o.range,a.range),a.step=s(o.step,a.step),a.multiplier=s(o.multiplier,a.multiplier)):n.clock={interval:o.interval,currentTime:o.currentTime,range:o.range,step:o.step,multiplier:o.multiplier}}}function Ge(e,t,i,r){var n=t.ellipse;if(l(n)){var a,s=n.interval;l(s)&&(ht.iso8601=s,a=I.fromIso8601(ht));var u=e.ellipse;l(u)||(e.ellipse=u=new q),Ae(Boolean,u,"show",n.show,a,r,i),Ae(ue,u,"rotation",n.rotation,a,r,i),Ae(Number,u,"semiMajorAxis",n.semiMajorAxis,a,r,i),Ae(Number,u,"semiMinorAxis",n.semiMinorAxis,a,r,i),Ae(Number,u,"height",n.height,a,r,i),Ae(Number,u,"extrudedHeight",n.extrudedHeight,a,r,i),Ae(Number,u,"granularity",n.granularity,a,r,i),Ae(ue,u,"stRotation",n.stRotation,a,r,i),De(u,"material",n.material,a,r,i),Ae(Boolean,u,"fill",n.fill,a,r,i),Ae(Boolean,u,"outline",n.outline,a,r,i),Ae(o,u,"outlineColor",n.outlineColor,a,r,i),Ae(Number,u,"outlineWidth",n.outlineWidth,a,r,i),Ae(Number,u,"numberOfVerticalLines",n.numberOfVerticalLines,a,r,i)}}function We(e,i,r,n){var a=i.ellipsoid;if(l(a)){var s,u=a.interval;l(u)&&(ht.iso8601=u,s=I.fromIso8601(ht));var c=e.ellipsoid;l(c)||(e.ellipsoid=c=new j),Ae(Boolean,c,"show",a.show,s,n,r),Ae(t,c,"radii",a.radii,s,n,r),De(c,"material",a.material,s,n,r),Ae(Boolean,c,"fill",a.fill,s,n,r),Ae(Boolean,c,"outline",a.outline,s,n,r),Ae(o,c,"outlineColor",a.outlineColor,s,n,r),Ae(Number,c,"outlineWidth",a.outlineWidth,s,n,r)}}function He(i,r,n,a){var s=r.label;if(l(s)){var u,c=s.interval;l(c)&&(ht.iso8601=c,u=I.fromIso8601(ht));var h=i.label;l(h)||(i.label=h=new K),Ae(o,h,"fillColor",s.fillColor,u,a,n),Ae(o,h,"outlineColor",s.outlineColor,u,a,n),Ae(Number,h,"outlineWidth",s.outlineWidth,u,a,n),Ae(t,h,"eyeOffset",s.eyeOffset,u,a,n),Ae(D,h,"horizontalOrigin",s.horizontalOrigin,u,a,n),Ae(String,h,"text",s.text,u,a,n),Ae(e,h,"pixelOffset",s.pixelOffset,u,a,n),Ae(Number,h,"scale",s.scale,u,a,n),Ae(Boolean,h,"show",s.show,u,a,n),Ae(O,h,"verticalOrigin",s.verticalOrigin,u,a,n),Ae(String,h,"font",s.font,u,a,n),Ae(R,h,"style",s.style,u,a,n)}}function qe(e,t,i,r){var n=t.model;if(l(n)){var o,a=n.interval;l(a)&&(ht.iso8601=a,o=I.fromIso8601(ht));var s=e.model;l(s)||(e.model=s=new Q),Ae(Boolean,s,"show",n.show,o,r,i),Ae(Number,s,"scale",n.scale,o,r,i),Ae(Number,s,"minimumPixelSize",n.minimumPixelSize,o,r,i),Ae(Boolean,s,"incrementallyLoadTextures",n.incrementallyLoadTextures,o,r,i),Ae(N,s,"uri",n.gltf,o,r,i),Ae(Boolean,s,"runAnimations",n.runAnimations,o,r,i);var u=n.nodeTransformations;if(l(u))if(g(u))for(var c=0,h=u.length;h>c;c++)je(s,u[c],o,r,i);else je(s,u,o,r,i)}}function je(e,i,r,n,o){var a,s=i.interval;l(s)?(ht.iso8601=s,a=I.fromIso8601(ht),l(r)&&(a=I.intersect(a,r,ut))):l(r)&&(a=r);for(var u=e.nodeTransformations,c=Object.keys(i),h=0,d=c.length;d>h;++h){var p=c[h];if("interval"!==p){var m=i[p];if(l(m)){l(u)||(e.nodeTransformations=u=new ae),u.hasProperty(p)||u.addProperty(p);var f=u[p];l(f)||(u[p]=f=new J),Ae(t,f,"translation",m.translation,a,n,o),Ae(T,f,"rotation",m.rotation,a,n,o),Ae(t,f,"scale",m.scale,a,n,o)}}}}function Ye(e,t,i,r){var n=t.path;if(l(n)){var o,a=n.interval;l(a)&&(ht.iso8601=a,o=I.fromIso8601(ht));var s=e.path;l(s)||(e.path=s=new $),Ae(Boolean,s,"show",n.show,o,r,i),Ae(Number,s,"width",n.width,o,r,i),Ae(Number,s,"resolution",n.resolution,o,r,i),Ae(Number,s,"leadTime",n.leadTime,o,r,i),Ae(Number,s,"trailTime",n.trailTime,o,r,i),De(s,"material",n.material,o,r,i)}}function Xe(e,t,i,r){var n=t.point;if(l(n)){var a,s=n.interval;l(s)&&(ht.iso8601=s,a=I.fromIso8601(ht));var u=e.point;l(u)||(e.point=u=new ee),Ae(o,u,"color",n.color,a,r,i),Ae(Number,u,"pixelSize",n.pixelSize,a,r,i),Ae(o,u,"outlineColor",n.outlineColor,a,r,i),Ae(Number,u,"outlineWidth",n.outlineWidth,a,r,i),Ae(Boolean,u,"show",n.show,a,r,i)}}function Ze(e,t,i,r){var n=t.polygon;if(l(n)){var a,s=n.interval;l(s)&&(ht.iso8601=s,a=I.fromIso8601(ht));var u=e.polygon;l(u)||(e.polygon=u=new te),Ae(Boolean,u,"show",n.show,a,r,i),De(u,"material",n.material,a,r,i),Ae(Number,u,"height",n.height,a,r,i),Ae(Number,u,"extrudedHeight",n.extrudedHeight,a,r,i),Ae(Number,u,"granularity",n.granularity,a,r,i),Ae(ue,u,"stRotation",n.stRotation,a,r,i),Ae(Boolean,u,"fill",n.fill,a,r,i),Ae(Boolean,u,"outline",n.outline,a,r,i),Ae(o,u,"outlineColor",n.outlineColor,a,r,i),Ae(Number,u,"outlineWidth",n.outlineWidth,a,r,i),Ae(Boolean,u,"perPositionHeight",n.perPositionHeight,a,r,i),Ve(u,"hierarchy",n.positions,i)}}function Ke(e,t,i,r){var n=t.rectangle;if(l(n)){var a,s=n.interval;l(s)&&(ht.iso8601=s,a=I.fromIso8601(ht));var u=e.rectangle;l(u)||(e.rectangle=u=new se),Ae(Boolean,u,"show",n.show,a,r,i),Ae(x,u,"coordinates",n.coordinates,a,r,i),De(u,"material",n.material,a,r,i),Ae(Number,u,"height",n.height,a,r,i),Ae(Number,u,"extrudedHeight",n.extrudedHeight,a,r,i),Ae(Number,u,"granularity",n.granularity,a,r,i),Ae(ue,u,"rotation",n.rotation,a,r,i),Ae(ue,u,"stRotation",n.stRotation,a,r,i),Ae(Boolean,u,"fill",n.fill,a,r,i),Ae(Boolean,u,"outline",n.outline,a,r,i),Ae(o,u,"outlineColor",n.outlineColor,a,r,i),Ae(Number,u,"outlineWidth",n.outlineWidth,a,r,i),Ae(Boolean,u,"closeBottom",n.closeBottom,a,r,i),Ae(Boolean,u,"closeTop",n.closeTop,a,r,i)}}function Qe(e,t,i,r){var n=t.wall;if(l(n)){var a,s=n.interval;l(s)&&(ht.iso8601=s,a=I.fromIso8601(ht));var u=e.wall;l(u)||(e.wall=u=new ve),Ae(Boolean,u,"show",n.show,a,r,i),De(u,"material",n.material,a,r,i),Ae(Array,u,"minimumHeights",n.minimumHeights,a,r,i),Ae(Array,u,"maximumHeights",n.maximumHeights,a,r,i),Ae(Number,u,"granularity",n.granularity,a,r,i),Ae(Boolean,u,"fill",n.fill,a,r,i),Ae(Boolean,u,"outline",n.outline,a,r,i),Ae(o,u,"outlineColor",n.outlineColor,a,r,i),Ae(Number,u,"outlineWidth",n.outlineWidth,a,r,i),Ve(u,"positions",n.positions,i)}}function Je(e,t,i,r){var n=t.polyline;if(l(n)){var o,a=n.interval;l(a)&&(ht.iso8601=a,o=I.fromIso8601(ht));var s=e.polyline;l(s)||(e.polyline=s=new re),Ae(Boolean,s,"show",n.show,o,r,i),Ae(Number,s,"width",n.width,o,r,i),De(s,"material",n.material,o,r,i),Ae(Boolean,s,"followSurface",n.followSurface,o,r,i),Ae(Number,s,"granularity",n.granularity,o,r,i),Ve(s,"positions",n.positions,i)}}function $e(e,t,i,r,n){var o=e.id;if(l(o)||(o=a()),ot=o,!l(n._version)&&"document"!==o)throw new A("The first CZML packet is required to be the document object.");if(e["delete"]===!0)t.removeById(o);else if("document"===o)Ue(e,n);else{var s=t.getOrCreateEntity(o),u=e.parent;l(u)&&(s.parent=t.getOrCreateEntity(u));for(var c=i.length-1;c>-1;c--)i[c](s,e,t,r)}ot=void 0}function et(e){var t,i=e._documentPacket.clock;if(!l(i)){if(!l(e._clock)){var o=e._entityCollection.computeAvailability();if(!o.start.equals(_.MINIMUM_VALUE)){var a=o.start,u=o.stop,c=y.secondsDifference(u,a),h=Math.round(c/120);return t=new H,t.startTime=y.clone(a),t.stopTime=y.clone(u),t.clockRange=r.LOOP_STOP,t.multiplier=h,t.currentTime=y.clone(a),t.clockStep=n.SYSTEM_CLOCK_MULTIPLIER,e._clock=t,!0}}return!1}if(l(e._clock)?t=e._clock.clone():(t=new H,t.startTime=_.MINIMUM_VALUE.clone(),t.stopTime=_.MAXIMUM_VALUE.clone(),t.currentTime=_.MINIMUM_VALUE.clone(),t.clockRange=r.LOOP_STOP,t.clockStep=n.SYSTEM_CLOCK_MULTIPLIER,t.multiplier=1),l(i.interval)){ht.iso8601=i.interval;var d=I.fromIso8601(ht);t.startTime=d.start,t.stopTime=d.stop}return l(i.currentTime)&&(t.currentTime=y.fromIso8601(i.currentTime)),l(i.range)&&(t.clockRange=s(r[i.range],r.LOOP_STOP)),l(i.step)&&(t.clockStep=s(n[i.step],n.SYSTEM_CLOCK_MULTIPLIER)),l(i.multiplier)&&(t.multiplier=i.multiplier),t.equals(e._clock)?!1:(e._clock=t.clone(e._clock),!0)}function tt(e,t,i,r){i=s(i,s.EMPTY_OBJECT);var n=t,o=i.sourceUri;return"string"==typeof t&&(n=S(t),o=s(o,t)),W.setLoading(e,!0),L(n,function(t){return it(e,t,o,r)}).otherwise(function(t){return W.setLoading(e,!1),e._error.raiseEvent(e,t),console.log(t),L.reject(t)})}function it(e,t,i,r){W.setLoading(e,!0);var n=e._entityCollection;r&&(e._version=void 0,e._documentPacket=new rt,n.removeAll()),nt._processCzml(t,n,i,void 0,e);var o=et(e),a=e._documentPacket;return l(a.name)&&e._name!==a.name?(e._name=a.name,o=!0):!l(e._name)&&l(i)&&(e._name=f(i),o=!0),W.setLoading(e,!1),o&&e._changed.raiseEvent(e),e}function rt(){this.name=void 0,this.clock=void 0}function nt(e){this._name=e,this._changed=new d,this._error=new d,this._isLoading=!1,this._loading=new d,this._clock=void 0,this._documentPacket=new rt,this._version=void 0,this._entityCollection=new Y(this)}var ot,at=new t,st=new P,lt=new i,ut=new I,ct={HERMITE:v,LAGRANGE:C,LINEAR:E},ht={iso8601:void 0};return nt.load=function(e,t){return(new nt).load(e,t)},u(nt.prototype,{name:{get:function(){return this._name}},clock:{get:function(){return this._clock}},entities:{get:function(){return this._entityCollection}},isLoading:{get:function(){return this._isLoading}},changedEvent:{get:function(){return this._changed}},errorEvent:{get:function(){return this._error}},loadingEvent:{get:function(){return this._loading}}}),nt.updaters=[ze,Ge,We,He,qe,Re,Oe,Ye,Xe,Ze,Je,Ke,Ne,Le,Qe,Fe,ke],nt.prototype.process=function(e,t){return tt(this,e,t,!1)},nt.prototype.load=function(e,t){return tt(this,e,t,!0)},nt.processPacketData=Ae,nt.processPositionPacketData=Ie,nt.processMaterialPacketData=De,nt._processCzml=function(e,t,i,r,n){if(r=l(r)?r:nt.updaters,g(e))for(var o=0,a=e.length;a>o;o++)$e(e[o],t,r,i,n);else $e(e,t,r,i,n)},nt}),i("DataSources/DataSourceCollection",["../Core/defaultValue","../Core/defined","../Core/defineProperties","../Core/destroyObject","../Core/DeveloperError","../Core/Event","../ThirdParty/when"],function(e,t,i,r,n,o,a){"use strict";function s(){this._dataSources=[],this._dataSourceAdded=new o,this._dataSourceRemoved=new o}return i(s.prototype,{length:{get:function(){return this._dataSources.length}},dataSourceAdded:{get:function(){return this._dataSourceAdded}},dataSourceRemoved:{get:function(){return this._dataSourceRemoved}}}),s.prototype.add=function(e){var t=this,i=this._dataSources;return a(e,function(e){return i===t._dataSources&&(t._dataSources.push(e),t._dataSourceAdded.raiseEvent(t,e)),e})},s.prototype.remove=function(t,i){i=e(i,!1);var r=this._dataSources.indexOf(t);return-1!==r?(this._dataSources.splice(r,1),this._dataSourceRemoved.raiseEvent(this,t),i&&"function"==typeof t.destroy&&t.destroy(),!0):!1},s.prototype.removeAll=function(t){t=e(t,!1);for(var i=this._dataSources,r=0,n=i.length;n>r;++r){var o=i[r];this._dataSourceRemoved.raiseEvent(this,o),t&&"function"==typeof o.destroy&&o.destroy()}this._dataSources=[]},s.prototype.contains=function(e){return-1!==this.indexOf(e)},s.prototype.indexOf=function(e){return this._dataSources.indexOf(e)},s.prototype.get=function(e){return this._dataSources[e]},s.prototype.isDestroyed=function(){return!1},s.prototype.destroy=function(){return this.removeAll(!0),r(this)},s}),i("DataSources/EllipseGeometryUpdater",["../Core/Color","../Core/ColorGeometryInstanceAttribute","../Core/defaultValue","../Core/defined","../Core/defineProperties","../Core/destroyObject","../Core/DeveloperError","../Core/EllipseGeometry","../Core/EllipseOutlineGeometry","../Core/Event","../Core/GeometryInstance","../Core/Iso8601","../Core/ShowGeometryInstanceAttribute","../Scene/MaterialAppearance","../Scene/PerInstanceColorAppearance","../Scene/Primitive","./ColorMaterialProperty","./ConstantProperty","./dynamicGeometryGetBoundingSphere","./MaterialProperty","./Property"],function(e,t,i,r,n,o,a,s,l,u,c,h,d,p,m,f,v,g,_,y,C){"use strict";function E(e){this.id=e,this.vertexFormat=void 0,this.center=void 0,this.semiMajorAxis=void 0,this.semiMinorAxis=void 0,this.rotation=void 0,this.height=void 0,this.extrudedHeight=void 0,this.granularity=void 0,this.stRotation=void 0,this.numberOfVerticalLines=void 0}function S(e,t){this._entity=e,this._scene=t,this._entitySubscription=e.definitionChanged.addEventListener(S.prototype._onEntityPropertyChanged,this),this._fillEnabled=!1,this._isClosed=!1,this._dynamic=!1,this._outlineEnabled=!1,this._geometryChanged=new u,this._showProperty=void 0,this._materialProperty=void 0,this._hasConstantOutline=!0,this._showOutlineProperty=void 0,this._outlineColorProperty=void 0,this._outlineWidth=1,this._options=new E(e),this._onEntityPropertyChanged(e,"ellipse",e.ellipse,void 0)}function w(e,t){this._primitives=e,this._primitive=void 0,this._outlinePrimitive=void 0,this._geometryUpdater=t,this._options=new E(t._entity)}var T=new v(e.WHITE),x=new g(!0),b=new g(!0),A=new g(!1),P=new g(e.BLACK),I=new e;return n(S,{perInstanceColorAppearanceType:{value:m},materialAppearanceType:{value:p}}),n(S.prototype,{entity:{get:function(){return this._entity}},fillEnabled:{get:function(){return this._fillEnabled}},hasConstantFill:{get:function(){return!this._fillEnabled||!r(this._entity.availability)&&C.isConstant(this._showProperty)&&C.isConstant(this._fillProperty)}},fillMaterialProperty:{get:function(){ return this._materialProperty}},outlineEnabled:{get:function(){return this._outlineEnabled}},hasConstantOutline:{get:function(){return!this._outlineEnabled||!r(this._entity.availability)&&C.isConstant(this._showProperty)&&C.isConstant(this._showOutlineProperty)}},outlineColorProperty:{get:function(){return this._outlineColorProperty}},outlineWidth:{get:function(){return this._outlineWidth}},isDynamic:{get:function(){return this._dynamic}},isClosed:{get:function(){return this._isClosed}},geometryChanged:{get:function(){return this._geometryChanged}}}),S.prototype.isOutlineVisible=function(e){var t=this._entity;return this._outlineEnabled&&t.isAvailable(e)&&this._showProperty.getValue(e)&&this._showOutlineProperty.getValue(e)},S.prototype.isFilled=function(e){var t=this._entity;return this._fillEnabled&&t.isAvailable(e)&&this._showProperty.getValue(e)&&this._fillProperty.getValue(e)},S.prototype.createFillGeometryInstance=function(i){var n,o,a=this._entity,l=a.isAvailable(i),u=new d(l&&a.isShowing&&this._showProperty.getValue(i)&&this._fillProperty.getValue(i));if(this._materialProperty instanceof v){var h=e.WHITE;r(this._materialProperty.color)&&(this._materialProperty.color.isConstant||l)&&(h=this._materialProperty.color.getValue(i)),o=t.fromColor(h),n={show:u,color:o}}else n={show:u};return new c({id:a,geometry:new s(this._options),attributes:n})},S.prototype.createOutlineGeometryInstance=function(i){var r=this._entity,n=r.isAvailable(i),o=C.getValueOrDefault(this._outlineColorProperty,i,e.BLACK);return new c({id:r,geometry:new l(this._options),attributes:{show:new d(n&&r.isShowing&&this._showProperty.getValue(i)&&this._showOutlineProperty.getValue(i)),color:t.fromColor(o)}})},S.prototype.isDestroyed=function(){return!1},S.prototype.destroy=function(){this._entitySubscription(),o(this)},S.prototype._onEntityPropertyChanged=function(e,t,n,o){if("availability"===t||"position"===t||"ellipse"===t){var a=this._entity.ellipse;if(!r(a))return void((this._fillEnabled||this._outlineEnabled)&&(this._fillEnabled=!1,this._outlineEnabled=!1,this._geometryChanged.raiseEvent(this)));var s=a.fill,l=r(s)&&s.isConstant?s.getValue(h.MINIMUM_VALUE):!0,u=a.outline,c=r(u);if(c&&u.isConstant&&(c=u.getValue(h.MINIMUM_VALUE)),!l&&!c)return void((this._fillEnabled||this._outlineEnabled)&&(this._fillEnabled=!1,this._outlineEnabled=!1,this._geometryChanged.raiseEvent(this)));var d=this._entity.position,f=a.semiMajorAxis,g=a.semiMinorAxis,_=a.show;if(r(_)&&_.isConstant&&!_.getValue(h.MINIMUM_VALUE)||!r(d)||!r(f)||!r(g))return void((this._fillEnabled||this._outlineEnabled)&&(this._fillEnabled=!1,this._outlineEnabled=!1,this._geometryChanged.raiseEvent(this)));var y=i(a.material,T),E=y instanceof v;this._materialProperty=y,this._fillProperty=i(s,b),this._showProperty=i(_,x),this._showOutlineProperty=i(a.outline,A),this._outlineColorProperty=c?i(a.outlineColor,P):void 0;var S=a.rotation,w=a.height,I=a.extrudedHeight,M=a.granularity,D=a.stRotation,R=a.outlineWidth,O=a.numberOfVerticalLines;if(this._isClosed=r(I),this._fillEnabled=l,this._outlineEnabled=c,d.isConstant&&f.isConstant&&g.isConstant&&C.isConstant(S)&&C.isConstant(w)&&C.isConstant(I)&&C.isConstant(M)&&C.isConstant(D)&&C.isConstant(R)&&C.isConstant(O)){var N=this._options;N.vertexFormat=E?m.VERTEX_FORMAT:p.MaterialSupport.TEXTURED.vertexFormat,N.center=d.getValue(h.MINIMUM_VALUE,N.center),N.semiMajorAxis=f.getValue(h.MINIMUM_VALUE,N.semiMajorAxis),N.semiMinorAxis=g.getValue(h.MINIMUM_VALUE,N.semiMinorAxis),N.rotation=r(S)?S.getValue(h.MINIMUM_VALUE):void 0,N.height=r(w)?w.getValue(h.MINIMUM_VALUE):void 0,N.extrudedHeight=r(I)?I.getValue(h.MINIMUM_VALUE):void 0,N.granularity=r(M)?M.getValue(h.MINIMUM_VALUE):void 0,N.stRotation=r(D)?D.getValue(h.MINIMUM_VALUE):void 0,N.numberOfVerticalLines=r(O)?O.getValue(h.MINIMUM_VALUE):void 0,this._outlineWidth=r(R)?R.getValue(h.MINIMUM_VALUE):1,this._dynamic=!1,this._geometryChanged.raiseEvent(this)}else this._dynamic||(this._dynamic=!0,this._geometryChanged.raiseEvent(this))}},S.prototype.createDynamicUpdater=function(e){return new w(e,this)},w.prototype.update=function(i){var n=this._primitives;n.removeAndDestroy(this._primitive),n.removeAndDestroy(this._outlinePrimitive),this._primitive=void 0,this._outlinePrimitive=void 0;var o=this._geometryUpdater,a=o._entity,u=a.ellipse;if(a.isShowing&&a.isAvailable(i)&&C.getValueOrDefault(u.show,i,!0)){var h=this._options,d=C.getValueOrUndefined(a.position,i,h.center),v=C.getValueOrUndefined(u.semiMajorAxis,i),g=C.getValueOrUndefined(u.semiMinorAxis,i);if(r(d)&&r(v)&&r(g)){if(h.center=d,h.semiMajorAxis=v,h.semiMinorAxis=g,h.rotation=C.getValueOrUndefined(u.rotation,i),h.height=C.getValueOrUndefined(u.height,i),h.extrudedHeight=C.getValueOrUndefined(u.extrudedHeight,i),h.granularity=C.getValueOrUndefined(u.granularity,i),h.stRotation=C.getValueOrUndefined(u.stRotation,i),h.numberOfVerticalLines=C.getValueOrUndefined(u.numberOfVerticalLines,i),C.getValueOrDefault(u.fill,i,!0)){var _=y.getValue(i,o.fillMaterialProperty,this._material);this._material=_;var E=new p({material:_,translucent:_.isTranslucent(),closed:r(h.extrudedHeight)});h.vertexFormat=E.vertexFormat,this._primitive=n.add(new f({geometryInstances:new c({id:a,geometry:new s(h)}),appearance:E,asynchronous:!1}))}if(C.getValueOrDefault(u.outline,i,!1)){h.vertexFormat=m.VERTEX_FORMAT;var S=C.getValueOrClonedDefault(u.outlineColor,i,e.BLACK,I),w=C.getValueOrDefault(u.outlineWidth,i,1),T=1!==S.alpha;this._outlinePrimitive=n.add(new f({geometryInstances:new c({id:a,geometry:new l(h),attributes:{color:t.fromColor(S)}}),appearance:new m({flat:!0,translucent:T,renderState:{lineWidth:o._scene.clampLineWidth(w)}}),asynchronous:!1}))}}}},w.prototype.getBoundingSphere=function(e,t){return _(e,this._primitive,this._outlinePrimitive,t)},w.prototype.isDestroyed=function(){return!1},w.prototype.destroy=function(){var e=this._primitives;e.removeAndDestroy(this._primitive),e.removeAndDestroy(this._outlinePrimitive),o(this)},S}),i("DataSources/EllipsoidGeometryUpdater",["../Core/Cartesian3","../Core/Color","../Core/ColorGeometryInstanceAttribute","../Core/defaultValue","../Core/defined","../Core/defineProperties","../Core/destroyObject","../Core/DeveloperError","../Core/EllipsoidGeometry","../Core/EllipsoidOutlineGeometry","../Core/Event","../Core/GeometryInstance","../Core/Iso8601","../Core/Matrix4","../Core/ShowGeometryInstanceAttribute","../Scene/MaterialAppearance","../Scene/PerInstanceColorAppearance","../Scene/Primitive","../Scene/SceneMode","./ColorMaterialProperty","./ConstantProperty","./dynamicGeometryGetBoundingSphere","./MaterialProperty","./Property"],function(e,t,i,r,n,o,a,s,l,u,c,h,d,p,m,f,v,g,_,y,C,E,S,w){"use strict";function T(e){this.id=e,this.vertexFormat=void 0,this.radii=void 0,this.stackPartitions=void 0,this.slicePartitions=void 0,this.subdivisions=void 0}function x(e,t){this._scene=t,this._entity=e,this._entitySubscription=e.definitionChanged.addEventListener(x.prototype._onEntityPropertyChanged,this),this._fillEnabled=!1,this._dynamic=!1,this._outlineEnabled=!1,this._geometryChanged=new c,this._showProperty=void 0,this._materialProperty=void 0,this._hasConstantOutline=!0,this._showOutlineProperty=void 0,this._outlineColorProperty=void 0,this._outlineWidth=1,this._options=new T(e),this._onEntityPropertyChanged(e,"ellipsoid",e.ellipsoid,void 0)}function b(e,t){this._entity=t._entity,this._scene=t._scene,this._primitives=e,this._primitive=void 0,this._outlinePrimitive=void 0,this._geometryUpdater=t,this._options=new T(t._entity),this._modelMatrix=new p,this._material=void 0,this._attributes=void 0,this._outlineAttributes=void 0,this._lastSceneMode=void 0,this._lastShow=void 0,this._lastOutlineShow=void 0,this._lastOutlineWidth=void 0,this._lastOutlineColor=void 0}var A=new y(t.WHITE),P=new C(!0),I=new C(!0),M=new C(!1),D=new C(t.BLACK),R=new e,O=new t,N=new e(1,1,1);return o(x,{perInstanceColorAppearanceType:{value:v},materialAppearanceType:{value:f}}),o(x.prototype,{entity:{get:function(){return this._entity}},fillEnabled:{get:function(){return this._fillEnabled}},hasConstantFill:{get:function(){return!this._fillEnabled||!n(this._entity.availability)&&w.isConstant(this._showProperty)&&w.isConstant(this._fillProperty)}},fillMaterialProperty:{get:function(){return this._materialProperty}},outlineEnabled:{get:function(){return this._outlineEnabled}},hasConstantOutline:{get:function(){return!this._outlineEnabled||!n(this._entity.availability)&&w.isConstant(this._showProperty)&&w.isConstant(this._showOutlineProperty)}},outlineColorProperty:{get:function(){return this._outlineColorProperty}},outlineWidth:{get:function(){return this._outlineWidth}},isDynamic:{get:function(){return this._dynamic}},isClosed:{value:!0},geometryChanged:{get:function(){return this._geometryChanged}}}),x.prototype.isOutlineVisible=function(e){var t=this._entity;return this._outlineEnabled&&t.isAvailable(e)&&this._showProperty.getValue(e)&&this._showOutlineProperty.getValue(e)},x.prototype.isFilled=function(e){var t=this._entity;return this._fillEnabled&&t.isAvailable(e)&&this._showProperty.getValue(e)&&this._fillProperty.getValue(e)},x.prototype.createFillGeometryInstance=function(e){var r,o,a=this._entity,s=a.isAvailable(e),u=new m(s&&a.isShowing&&this._showProperty.getValue(e)&&this._fillProperty.getValue(e));if(this._materialProperty instanceof y){var c=t.WHITE;n(this._materialProperty.color)&&(this._materialProperty.color.isConstant||s)&&(c=this._materialProperty.color.getValue(e)),o=i.fromColor(c),r={show:u,color:o}}else r={show:u};return new h({id:a,geometry:new l(this._options),modelMatrix:a._getModelMatrix(d.MINIMUM_VALUE),attributes:r})},x.prototype.createOutlineGeometryInstance=function(e){var r=this._entity,n=r.isAvailable(e),o=w.getValueOrDefault(this._outlineColorProperty,e,t.BLACK);return new h({id:r,geometry:new u(this._options),modelMatrix:r._getModelMatrix(d.MINIMUM_VALUE),attributes:{show:new m(n&&r.isShowing&&this._showProperty.getValue(e)&&this._showOutlineProperty.getValue(e)),color:i.fromColor(o)}})},x.prototype.isDestroyed=function(){return!1},x.prototype.destroy=function(){this._entitySubscription(),a(this)},x.prototype._onEntityPropertyChanged=function(e,t,i,o){if("availability"===t||"position"===t||"orientation"===t||"ellipsoid"===t){var a=e.ellipsoid;if(!n(a))return void((this._fillEnabled||this._outlineEnabled)&&(this._fillEnabled=!1,this._outlineEnabled=!1,this._geometryChanged.raiseEvent(this)));var s=a.fill,l=n(s)&&s.isConstant?s.getValue(d.MINIMUM_VALUE):!0,u=a.outline,c=n(u);if(c&&u.isConstant&&(c=u.getValue(d.MINIMUM_VALUE)),!l&&!c)return void((this._fillEnabled||this._outlineEnabled)&&(this._fillEnabled=!1,this._outlineEnabled=!1,this._geometryChanged.raiseEvent(this)));var h=e.position,p=a.radii,m=a.show;if(n(m)&&m.isConstant&&!m.getValue(d.MINIMUM_VALUE)||!n(h)||!n(p))return void((this._fillEnabled||this._outlineEnabled)&&(this._fillEnabled=!1,this._outlineEnabled=!1,this._geometryChanged.raiseEvent(this)));var g=r(a.material,A),_=g instanceof y;this._materialProperty=g,this._fillProperty=r(s,I),this._showProperty=r(m,P),this._showOutlineProperty=r(a.outline,M),this._outlineColorProperty=c?r(a.outlineColor,D):void 0,this._fillEnabled=l,this._outlineEnabled=c;var C=a.stackPartitions,E=a.slicePartitions,S=a.outlineWidth,T=a.subdivisions;if(h.isConstant&&w.isConstant(e.orientation)&&p.isConstant&&w.isConstant(C)&&w.isConstant(E)&&w.isConstant(S)&&w.isConstant(T)){var x=this._options;x.vertexFormat=_?v.VERTEX_FORMAT:f.MaterialSupport.TEXTURED.vertexFormat,x.radii=p.getValue(d.MINIMUM_VALUE,x.radii),x.stackPartitions=n(C)?C.getValue(d.MINIMUM_VALUE):void 0,x.slicePartitions=n(E)?E.getValue(d.MINIMUM_VALUE):void 0,x.subdivisions=n(T)?T.getValue(d.MINIMUM_VALUE):void 0,this._outlineWidth=n(S)?S.getValue(d.MINIMUM_VALUE):1,this._dynamic=!1,this._geometryChanged.raiseEvent(this)}else this._dynamic||(this._dynamic=!0,this._geometryChanged.raiseEvent(this))}},x.prototype.createDynamicUpdater=function(e){return new b(e,this)},b.prototype.update=function(e){var o=this._entity,a=o.ellipsoid;if(!o.isShowing||!o.isAvailable(e)||!w.getValueOrDefault(a.show,e,!0))return n(this._primitive)&&(this._primitive.show=!1),void(n(this._outlinePrimitive)&&(this._outlinePrimitive.show=!1));var s=w.getValueOrUndefined(a.radii,e,R),c=o._getModelMatrix(e,this._modelMatrix);if(!n(c)||!n(s))return n(this._primitive)&&(this._primitive.show=!1),void(n(this._outlinePrimitive)&&(this._outlinePrimitive.show=!1));var d,y=w.getValueOrDefault(a.fill,e,!0),C=w.getValueOrDefault(a.outline,e,!1),E=w.getValueOrClonedDefault(a.outlineColor,e,t.BLACK,O),T=S.getValue(e,r(a.material,A),this._material);this._material=T;var x=w.getValueOrUndefined(a.stackPartitions,e),b=w.getValueOrUndefined(a.slicePartitions,e),P=w.getValueOrUndefined(a.subdivisions,e),I=w.getValueOrDefault(a.outlineWidth,e,1),M=this._scene.mode,D=M===_.SCENE3D,L=this._options,F=!D||this._lastSceneMode!==M||!n(this._primitive)||L.stackPartitions!==x||L.slicePartitions!==b||L.subdivisions!==P||this._lastOutlineWidth!==I;if(F){var B=this._primitives;B.removeAndDestroy(this._primitive),B.removeAndDestroy(this._outlinePrimitive),this._primitive=void 0,this._outlinePrimitive=void 0,this._lastSceneMode=M,this._lastOutlineWidth=I,L.stackPartitions=x,L.slicePartitions=b,L.subdivisions=P,L.radii=D?N:s,d=new f({material:T,translucent:T.isTranslucent(),closed:!0}),L.vertexFormat=d.vertexFormat,this._primitive=B.add(new g({geometryInstances:new h({id:o,geometry:new l(L),modelMatrix:D?void 0:c,attributes:{show:new m(y)}}),appearance:d,asynchronous:!1})),L.vertexFormat=v.VERTEX_FORMAT,this._outlinePrimitive=B.add(new g({geometryInstances:new h({id:o,geometry:new u(L),modelMatrix:D?void 0:c,attributes:{show:new m(C),color:i.fromColor(E)}}),appearance:new v({flat:!0,translucent:1!==E.alpha,renderState:{lineWidth:this._geometryUpdater._scene.clampLineWidth(I)}}),asynchronous:!1})),this._lastShow=y,this._lastOutlineShow=C,this._lastOutlineColor=t.clone(E,this._lastOutlineColor)}else if(this._primitive.ready){var V=this._primitive,k=this._outlinePrimitive;V.show=!0,k.show=!0,d=V.appearance,d.material=T;var z=this._attributes;n(z)||(z=V.getGeometryInstanceAttributes(o),this._attributes=z),y!==this._lastShow&&(z.show=m.toValue(y,z.show),this._lastShow=y);var U=this._outlineAttributes;n(U)||(U=k.getGeometryInstanceAttributes(o),this._outlineAttributes=U),C!==this._lastOutlineShow&&(U.show=m.toValue(C,U.show),this._lastOutlineShow=C),t.equals(E,this._lastOutlineColor)||(U.color=i.toValue(E,U.color),t.clone(E,this._lastOutlineColor))}D&&(s.x=Math.max(s.x,.001),s.y=Math.max(s.y,.001),s.z=Math.max(s.z,.001),c=p.multiplyByScale(c,s,c),this._primitive.modelMatrix=c,this._outlinePrimitive.modelMatrix=c)},b.prototype.getBoundingSphere=function(e,t){return E(e,this._primitive,this._outlinePrimitive,t)},b.prototype.isDestroyed=function(){return!1},b.prototype.destroy=function(){var e=this._primitives;e.removeAndDestroy(this._primitive),e.removeAndDestroy(this._outlinePrimitive),a(this)},x}),i("DataSources/StaticGeometryColorBatch",["../Core/AssociativeArray","../Core/Color","../Core/ColorGeometryInstanceAttribute","../Core/defined","../Core/ShowGeometryInstanceAttribute","../Scene/Primitive","./BoundingSphereState"],function(e,t,i,r,n,o,a){"use strict";function s(t,i,r,n){this.translucent=i,this.appearanceType=r,this.closed=n,this.primitives=t,this.createPrimitive=!1,this.waitingOnCreate=!1,this.primitive=void 0,this.oldPrimitive=void 0,this.geometry=new e,this.updaters=new e,this.updatersWithAttributes=new e,this.attributes=new e,this.subscriptions=new e,this.showsUpdated=new e,this.itemsToRemove=[]}function l(e,t,i){this._solidBatch=new s(e,!1,t,i),this._translucentBatch=new s(e,!0,t,i)}var u=new t;return s.prototype.add=function(e,t){var i=e.entity.id;if(this.createPrimitive=!0,this.geometry.set(i,t),this.updaters.set(i,e),e.hasConstantFill&&e.fillMaterialProperty.isConstant){var r=this;this.subscriptions.set(i,e.entity.definitionChanged.addEventListener(function(t,i,n,o){"isShowing"===i&&r.showsUpdated.set(t.id,e)}))}else this.updatersWithAttributes.set(i,e)},s.prototype.remove=function(e){var t=e.entity.id;if(this.createPrimitive=this.geometry.remove(t)||this.createPrimitive,this.updaters.remove(t)){this.updatersWithAttributes.remove(t);var i=this.subscriptions.get(t);r(i)&&(i(),this.subscriptions.remove(t))}},s.prototype.update=function(e){var a,s,l=!0,c=0,h=this.primitive,d=this.primitives;if(this.createPrimitive){var p=this.geometry.values,m=p.length;if(m>0){for(r(h)&&(r(this.oldPrimitive)?d.remove(h):this.oldPrimitive=h),s=0;m>s;s++){var f=p[s],v=f.attributes;a=this.attributes.get(f.id.id),r(a)&&(r(v.show)&&(v.show.value=a.show),r(v.color)&&(v.color.value=a.color))}h=new o({asynchronous:!0,geometryInstances:p,appearance:new this.appearanceType({translucent:this.translucent,closed:this.closed})}),d.add(h),l=!1}else{r(h)&&(d.remove(h),h=void 0);var g=this.oldPrimitive;r(g)&&(d.remove(g),this.oldPrimitive=void 0)}this.attributes.removeAll(),this.primitive=h,this.createPrimitive=!1,this.waitingOnCreate=!0}else if(r(h)&&h.ready){r(this.oldPrimitive)&&(d.remove(this.oldPrimitive),this.oldPrimitive=void 0);var _=this.updatersWithAttributes.values,y=_.length,C=this.waitingOnCreate;for(s=0;y>s;s++){var E=_[s],S=this.geometry.get(E.entity.id);if(a=this.attributes.get(S.id.id),r(a)||(a=h.getGeometryInstanceAttributes(S.id),this.attributes.set(S.id.id,a)),!E.fillMaterialProperty.isConstant||C){var w=E.fillMaterialProperty.color;w.getValue(e,u),t.equals(a._lastColor,u)||(a._lastColor=t.clone(u,a._lastColor),a.color=i.toValue(u,a.color),(this.translucent&&255===a.color[3]||!this.translucent&&255!==a.color[3])&&(this.itemsToRemove[c++]=E))}var T=E.entity.isShowing&&(E.hasConstantFill||E.isFilled(e)),x=1===a.show[0];T!==x&&(a.show=n.toValue(T,a.show))}this.updateShows(h),this.waitingOnCreate=!1}else r(h)&&!h.ready&&(l=!1);return this.itemsToRemove.length=c,l},s.prototype.updateShows=function(e){for(var t=this.showsUpdated.values,i=t.length,o=0;i>o;o++){var a=t[o],s=this.geometry.get(a.entity.id),l=this.attributes.get(s.id.id);r(l)||(l=e.getGeometryInstanceAttributes(s.id),this.attributes.set(s.id.id,l));var u=a.entity.isShowing,c=1===l.show[0];u!==c&&(l.show=n.toValue(u,l.show))}this.showsUpdated.removeAll()},s.prototype.contains=function(e){return this.updaters.contains(e.id)},s.prototype.getBoundingSphere=function(e,t){var i=this.primitive;if(!i.ready)return a.PENDING;var n=i.getGeometryInstanceAttributes(e);return!r(n)||!r(n.boundingSphere)||r(n.show)&&0===n.show[0]?a.FAILED:(n.boundingSphere.clone(t),a.DONE)},s.prototype.removeAllPrimitives=function(){var e=this.primitives,t=this.primitive;r(t)&&(e.remove(t),this.primitive=void 0,this.geometry.removeAll(),this.updaters.removeAll());var i=this.oldPrimitive;r(i)&&(e.remove(i),this.oldPrimitive=void 0)},l.prototype.add=function(e,t){var i=t.createFillGeometryInstance(e);255===i.attributes.color.value[3]?this._solidBatch.add(t,i):this._translucentBatch.add(t,i)},l.prototype.remove=function(e){this._solidBatch.remove(e)||this._translucentBatch.remove(e)},l.prototype.update=function(e){var t,i,r=this._solidBatch.update(e);r=this._translucentBatch.update(e)&&r;var n=this._solidBatch.itemsToRemove,o=n.length;if(o>0)for(t=0;o>t;t++)i=n[t],this._solidBatch.remove(i),this._translucentBatch.add(i,i.createFillGeometryInstance(e));n=this._translucentBatch.itemsToRemove;var a=n.length;if(a>0)for(t=0;a>t;t++)i=n[t],this._translucentBatch.remove(i),this._solidBatch.add(i,i.createFillGeometryInstance(e));return(o>0||a>0)&&(r=this._solidBatch.update(e)&&r,r=this._translucentBatch.update(e)&&r),r},l.prototype.getBoundingSphere=function(e,t){return this._solidBatch.contains(e)?this._solidBatch.getBoundingSphere(e,t):this._translucentBatch.contains(e)?this._translucentBatch.getBoundingSphere(e,t):a.FAILED},l.prototype.removeAllPrimitives=function(){this._solidBatch.removeAllPrimitives(),this._translucentBatch.removeAllPrimitives()},l}),i("DataSources/StaticGeometryPerMaterialBatch",["../Core/AssociativeArray","../Core/defined","../Core/ShowGeometryInstanceAttribute","../Scene/Primitive","./BoundingSphereState","./MaterialProperty"],function(e,t,i,r,n,o){"use strict";function a(t,i,r,n){this.primitives=t,this.appearanceType=i,this.materialProperty=r,this.closed=n,this.updaters=new e,this.createPrimitive=!0,this.primitive=void 0,this.oldPrimitive=void 0,this.geometry=new e,this.material=void 0,this.updatersWithAttributes=new e,this.attributes=new e,this.invalidated=!1,this.removeMaterialSubscription=r.definitionChanged.addEventListener(a.prototype.onMaterialChanged,this),this.subscriptions=new e,this.showsUpdated=new e}function s(e,t,i){this._items=[],this._primitives=e,this._appearanceType=t,this._closed=i}return a.prototype.onMaterialChanged=function(){this.invalidated=!0},a.prototype.isMaterial=function(e){var i=this.materialProperty,r=e.fillMaterialProperty;return r===i?!0:t(i)?i.equals(r):!1},a.prototype.add=function(e,t){var i=t.entity.id;if(this.updaters.set(i,t),this.geometry.set(i,t.createFillGeometryInstance(e)),t.hasConstantFill&&t.fillMaterialProperty.isConstant){var r=this;this.subscriptions.set(i,t.entity.definitionChanged.addEventListener(function(e,i,n,o){"isShowing"===i&&r.showsUpdated.set(e.id,t)}))}else this.updatersWithAttributes.set(i,t);this.createPrimitive=!0},a.prototype.remove=function(e){var i=e.entity.id,r=this.updaters.remove(i);if(r){this.geometry.remove(i),this.updatersWithAttributes.remove(i);var n=this.subscriptions.get(i);t(n)&&(n(),this.subscriptions.remove(i))}return this.createPrimitive=r,r},a.prototype.update=function(e){var n,a,s=!0,l=this.primitive,u=this.primitives,c=this.geometry.values;if(this.createPrimitive){var h=c.length;if(h>0){for(t(l)&&(t(this.oldPrimitive)?u.remove(l):this.oldPrimitive=l),a=0;h>a;a++){var d=c[a],p=d.attributes;n=this.attributes.get(d.id.id),t(n)&&(t(p.show)&&(p.show.value=n.show),t(p.color)&&(p.color.value=n.color))}this.material=o.getValue(e,this.materialProperty,this.material),l=new r({asynchronous:!0,geometryInstances:c,appearance:new this.appearanceType({material:this.material,translucent:this.material.isTranslucent(),closed:this.closed})}),u.add(l),s=!1}else{t(l)&&(u.remove(l),l=void 0);var m=this.oldPrimitive;t(m)&&(u.remove(m),this.oldPrimitive=void 0)}this.attributes.removeAll(),this.primitive=l,this.createPrimitive=!1}else if(t(l)&&l.ready){t(this.oldPrimitive)&&(u.remove(this.oldPrimitive),this.oldPrimitive=void 0),this.material=o.getValue(e,this.materialProperty,this.material),this.primitive.appearance.material=this.material;var f=this.updatersWithAttributes.values,v=f.length;for(a=0;v>a;a++){var g=f[a],_=g.entity,y=this.geometry.get(_.id);n=this.attributes.get(y.id.id),t(n)||(n=l.getGeometryInstanceAttributes(y.id),this.attributes.set(y.id.id,n));var C=_.isShowing&&(g.hasConstantFill||g.isFilled(e)),E=1===n.show[0];C!==E&&(n.show=i.toValue(C,n.show))}this.updateShows(l)}else t(l)&&!l.ready&&(s=!1);return s},a.prototype.updateShows=function(e){for(var r=this.showsUpdated.values,n=r.length,o=0;n>o;o++){var a=r[o],s=a.entity,l=this.geometry.get(s.id),u=this.attributes.get(l.id.id);t(u)||(u=e.getGeometryInstanceAttributes(l.id),this.attributes.set(l.id.id,u));var c=s.isShowing,h=1===u.show[0];c!==h&&(u.show=i.toValue(c,u.show))}this.showsUpdated.removeAll()},a.prototype.contains=function(e){return this.updaters.contains(e.id)},a.prototype.getBoundingSphere=function(e,i){var r=this.primitive;if(!r.ready)return n.PENDING;var o=r.getGeometryInstanceAttributes(e);return!t(o)||!t(o.boundingSphere)||t(o.show)&&0===o.show[0]?n.FAILED:(o.boundingSphere.clone(i),n.DONE)},a.prototype.destroy=function(e){var i=this.primitive,r=this.primitives;t(i)&&r.remove(i);var n=this.oldPrimitive;t(n)&&r.remove(n),this.removeMaterialSubscription()},s.prototype.add=function(e,t){for(var i=this._items,r=i.length,n=0;r>n;n++){var o=i[n];if(o.isMaterial(t))return void o.add(e,t)}var s=new a(this._primitives,this._appearanceType,t.fillMaterialProperty,this._closed);s.add(e,t),i.push(s)},s.prototype.remove=function(e){for(var t=this._items,i=t.length,r=i-1;r>=0;r--){var n=t[r];if(n.remove(e)){0===n.updaters.length&&(t.splice(r,1),n.destroy());break}}},s.prototype.update=function(e){var t,i=this._items,r=i.length;for(t=r-1;t>=0;t--){var n=i[t];if(n.invalidated){i.splice(t,1);for(var o=n.updaters.values,a=o.length,s=0;a>s;s++)this.add(e,o[s]);n.destroy()}}var l=!0;for(t=0;r>t;t++)l=i[t].update(e)&&l;return l},s.prototype.getBoundingSphere=function(e,t){for(var i=this._items,r=i.length,o=0;r>o;o++){var a=i[o];if(a.contains(e))return a.getBoundingSphere(e,t)}return n.FAILED},s.prototype.removeAllPrimitives=function(){for(var e=this._items,t=e.length,i=0;t>i;i++)e[i].destroy();this._items.length=0},s}),i("DataSources/StaticOutlineGeometryBatch",["../Core/AssociativeArray","../Core/Color","../Core/ColorGeometryInstanceAttribute","../Core/defined","../Core/ShowGeometryInstanceAttribute","../Scene/PerInstanceColorAppearance","../Scene/Primitive","./BoundingSphereState"],function(e,t,i,r,n,o,a,s){"use strict";function l(t,i,r){this.translucent=i,this.primitives=t,this.createPrimitive=!1,this.waitingOnCreate=!1,this.primitive=void 0,this.oldPrimitive=void 0,this.geometry=new e,this.updaters=new e,this.updatersWithAttributes=new e,this.attributes=new e,this.itemsToRemove=[],this.width=r,this.subscriptions=new e,this.showsUpdated=new e}function u(t,i){this._primitives=t,this._scene=i,this._solidBatches=new e,this._translucentBatches=new e}l.prototype.add=function(e,t){var i=e.entity.id;if(this.createPrimitive=!0,this.geometry.set(i,t),this.updaters.set(i,e),e.hasConstantOutline&&e.outlineColorProperty.isConstant){var r=this;this.subscriptions.set(i,e.entity.definitionChanged.addEventListener(function(t,i,n,o){"isShowing"===i&&r.showsUpdated.set(t.id,e)}))}else this.updatersWithAttributes.set(i,e)},l.prototype.remove=function(e){var t=e.entity.id;if(this.createPrimitive=this.geometry.remove(t)||this.createPrimitive,this.updaters.remove(t)){this.updatersWithAttributes.remove(t);var i=this.subscriptions.get(t);r(i)&&(i(),this.subscriptions.remove(t))}};var c=new t;return l.prototype.update=function(e){var s,l,u=!0,h=0,d=this.primitive,p=this.primitives;if(this.createPrimitive){var m=this.geometry.values,f=m.length;if(f>0){for(r(d)&&(r(this.oldPrimitive)?p.remove(d):this.oldPrimitive=d),l=0;f>l;l++){var v=m[l],g=v.attributes;s=this.attributes.get(v.id.id),r(s)&&(r(g.show)&&(g.show.value=s.show),r(g.color)&&(g.color.value=s.color))}d=new a({asynchronous:!0,geometryInstances:m,appearance:new o({flat:!0,translucent:this.translucent,renderState:{lineWidth:this.width}})}),p.add(d),u=!1}else{r(d)&&(p.remove(d),d=void 0);var _=this.oldPrimitive;r(_)&&(p.remove(_),this.oldPrimitive=void 0)}this.attributes.removeAll(),this.primitive=d,this.createPrimitive=!1,this.waitingOnCreate=!0}else if(r(d)&&d.ready){r(this.oldPrimitive)&&(p.remove(this.oldPrimitive),this.oldPrimitive=void 0);var y=this.updatersWithAttributes.values,C=y.length,E=this.waitingOnCreate;for(l=0;C>l;l++){var S=y[l],w=this.geometry.get(S.entity.id);if(s=this.attributes.get(w.id.id),r(s)||(s=d.getGeometryInstanceAttributes(w.id),this.attributes.set(w.id.id,s)),!S.outlineColorProperty.isConstant||E){var T=S.outlineColorProperty;T.getValue(e,c),t.equals(s._lastColor,c)||(s._lastColor=t.clone(c,s._lastColor),s.color=i.toValue(c,s.color),(this.translucent&&255===s.color[3]||!this.translucent&&255!==s.color[3])&&(this.itemsToRemove[h++]=S))}var x=S.entity.isShowing&&(S.hasConstantOutline||S.isOutlineVisible(e)),b=1===s.show[0];x!==b&&(s.show=n.toValue(x,s.show))}this.updateShows(d),this.waitingOnCreate=!1}else r(d)&&!d.ready&&(u=!1);return this.itemsToRemove.length=h,u},l.prototype.updateShows=function(e){for(var t=this.showsUpdated.values,i=t.length,o=0;i>o;o++){var a=t[o],s=this.geometry.get(a.entity.id),l=this.attributes.get(s.id.id);r(l)||(l=e.getGeometryInstanceAttributes(s.id),this.attributes.set(s.id.id,l));var u=a.entity.isShowing,c=1===l.show[0];u!==c&&(l.show=n.toValue(u,l.show))}this.showsUpdated.removeAll()},l.prototype.contains=function(e){return this.updaters.contains(e.id)},l.prototype.getBoundingSphere=function(e,t){var i=this.primitive;if(!i.ready)return s.PENDING;var n=i.getGeometryInstanceAttributes(e);return!r(n)||!r(n.boundingSphere)||r(n.show)&&0===n.show[0]?s.FAILED:(n.boundingSphere.clone(t),s.DONE)},l.prototype.removeAllPrimitives=function(){var e=this.primitives,t=this.primitive;r(t)&&(e.remove(t),this.primitive=void 0,this.geometry.removeAll(),this.updaters.removeAll());var i=this.oldPrimitive;r(i)&&(e.remove(i),this.oldPrimitive=void 0)},u.prototype.add=function(e,t){var i,n,o=t.createOutlineGeometryInstance(e),a=this._scene.clampLineWidth(t.outlineWidth);255===o.attributes.color.value[3]?(i=this._solidBatches,n=i.get(a),r(n)||(n=new l(this._primitives,!1,a),i.set(a,n)),n.add(t,o)):(i=this._translucentBatches,n=i.get(a),r(n)||(n=new l(this._primitives,!0,a),i.set(a,n)),n.add(t,o))},u.prototype.remove=function(e){var t,i=this._solidBatches.values,r=i.length;for(t=0;r>t;t++)if(i[t].remove(e))return;var n=this._translucentBatches.values,o=n.length;for(t=0;o>t;t++)if(n[t].remove(e))return},u.prototype.update=function(e){var t,i,r,n,o,a=this._solidBatches.values,s=a.length,l=this._translucentBatches.values,u=l.length,c=!0,h=!1;do{for(h=!1,i=0;s>i;i++){n=a[i],c=n.update(e),o=n.itemsToRemove;var d=o.length;if(d>0)for(h=!0,t=0;d>t;t++)r=o[t],n.remove(r),this.add(e,r)}for(i=0;u>i;i++){n=l[i],c=n.update(e),o=n.itemsToRemove;var p=o.length;if(p>0)for(h=!0,t=0;p>t;t++)r=o[t],n.remove(r),this.add(e,r)}}while(h);return c},u.prototype.getBoundingSphere=function(e,t){var i,r=this._solidBatches.values,n=r.length;for(i=0;n>i;i++){var o=r[i];if(o.contains(e))return o.getBoundingSphere(e,t)}var a=this._translucentBatches.values,l=a.length;for(i=0;l>i;i++){var u=a[i];if(u.contains(e))return u.getBoundingSphere(e,t)}return s.FAILED},u.prototype.removeAllPrimitives=function(){var e,t=this._solidBatches.values,i=t.length;for(e=0;i>e;e++)t[e].removeAllPrimitives();var r=this._translucentBatches.values,n=r.length;for(e=0;n>e;e++)r[e].removeAllPrimitives()},u}),i("DataSources/GeometryVisualizer",["../Core/AssociativeArray","../Core/BoundingSphere","../Core/defined","../Core/destroyObject","../Core/DeveloperError","./BoundingSphereState","./ColorMaterialProperty","./StaticGeometryColorBatch","./StaticGeometryPerMaterialBatch","./StaticOutlineGeometryBatch"],function(e,t,i,r,n,o,a,s,l,u){"use strict";function c(t){this._primitives=t,this._dynamicUpdaters=new e}function h(e,t){for(var i=e._batches,r=i.length,n=0;r>n;n++)i[n].remove(t)}function d(e,t,i){return i.isDynamic?void e._dynamicBatch.add(t,i):(i.outlineEnabled&&e._outlineBatch.add(t,i),void(i.fillEnabled&&(i.isClosed?i.fillMaterialProperty instanceof a?e._closedColorBatch.add(t,i):e._closedMaterialBatch.add(t,i):i.fillMaterialProperty instanceof a?e._openColorBatch.add(t,i):e._openMaterialBatch.add(t,i))))}function p(t,i,r){this._type=t;var n=i.primitives;this._scene=i,this._primitives=n,this._entityCollection=void 0,this._addedObjects=new e,this._removedObjects=new e,this._changedObjects=new e,this._outlineBatch=new u(n,i),this._closedColorBatch=new s(n,t.perInstanceColorAppearanceType,!0),this._closedMaterialBatch=new l(n,t.materialAppearanceType,!0),this._openColorBatch=new s(n,t.perInstanceColorAppearanceType,!1),this._openMaterialBatch=new l(n,t.materialAppearanceType,!1),this._dynamicBatch=new c(n),this._batches=[this._closedColorBatch,this._closedMaterialBatch,this._openColorBatch,this._openMaterialBatch,this._dynamicBatch,this._outlineBatch],this._subscriptions=new e,this._updaters=new e,this._entityCollection=r,r.collectionChanged.addEventListener(p.prototype._onCollectionChanged,this),this._onCollectionChanged(r,r.values,m)}var m=[];c.prototype.add=function(e,t){this._dynamicUpdaters.set(t.entity.id,t.createDynamicUpdater(this._primitives))},c.prototype.remove=function(e){ var t=e.entity.id,r=this._dynamicUpdaters.get(t);i(r)&&(this._dynamicUpdaters.remove(t),r.destroy())},c.prototype.update=function(e){for(var t=this._dynamicUpdaters.values,i=0,r=t.length;r>i;i++)t[i].update(e);return!0},c.prototype.removeAllPrimitives=function(){for(var e=this._dynamicUpdaters.values,t=0,i=e.length;i>t;t++)e[t].destroy();this._dynamicUpdaters.removeAll()},c.prototype.getBoundingSphere=function(e,t){var r=this._dynamicUpdaters.get(e.id);return i(r)&&i(r.getBoundingSphere)?r.getBoundingSphere(e,t):o.FAILED},p.prototype.update=function(e){var t,i,r,n,o=this._addedObjects,a=o.values,s=this._removedObjects,l=s.values,u=this._changedObjects,c=u.values;for(t=c.length-1;t>-1;t--)i=c[t],r=i.id,n=this._updaters.get(r),n.entity===i?(h(this,n),d(this,e,n)):(l.push(i),a.push(i));for(t=l.length-1;t>-1;t--)i=l[t],r=i.id,n=this._updaters.get(r),h(this,n),n.destroy(),this._updaters.remove(r),this._subscriptions.get(r)(),this._subscriptions.remove(r);for(t=a.length-1;t>-1;t--)i=a[t],r=i.id,n=new this._type(i,this._scene),this._updaters.set(r,n),d(this,e,n),this._subscriptions.set(r,n.geometryChanged.addEventListener(p._onGeometryChanged,this));o.removeAll(),s.removeAll(),u.removeAll();var m=!0,f=this._batches,v=f.length;for(t=0;v>t;t++)m=f[t].update(e)&&m;return m};var f=[],v=new t;return p.prototype.getBoundingSphere=function(e,i){for(var r=f,n=v,a=0,s=o.DONE,l=this._batches,u=l.length,c=0;u>c;c++){if(s=l[c].getBoundingSphere(e,n),s===o.PENDING)return o.PENDING;s===o.DONE&&(r[a]=t.clone(n,r[a]),a++)}return 0===a?o.FAILED:(r.length=a,t.fromBoundingSpheres(r,i),o.DONE)},p.prototype.isDestroyed=function(){return!1},p.prototype.destroy=function(){this._entityCollection.collectionChanged.removeEventListener(p.prototype._onCollectionChanged,this),this._addedObjects.removeAll(),this._removedObjects.removeAll();var e,t=this._batches,i=t.length;for(e=0;i>e;e++)t[e].removeAllPrimitives();var n=this._subscriptions.values;for(i=n.length,e=0;i>e;e++)n[e]();return this._subscriptions.removeAll(),r(this)},p._onGeometryChanged=function(e){var t=this._removedObjects,r=this._changedObjects,n=e.entity,o=n.id;i(t.get(o))||i(r.get(o))||r.set(o,n)},p.prototype._onCollectionChanged=function(e,t,i){var r,n,o,a=this._addedObjects,s=this._removedObjects,l=this._changedObjects;for(r=i.length-1;r>-1;r--)o=i[r],n=o.id,a.remove(n)||(s.set(n,o),l.remove(n));for(r=t.length-1;r>-1;r--)o=t[r],n=o.id,s.remove(n)?l.set(n,o):a.set(n,o)},p}),i("Scene/Label",["../Core/Cartesian2","../Core/Cartesian3","../Core/Color","../Core/defaultValue","../Core/defined","../Core/defineProperties","../Core/DeveloperError","../Core/NearFarScalar","./Billboard","./HeightReference","./HorizontalOrigin","./LabelStyle","./VerticalOrigin"],function(e,t,i,r,n,o,a,s,l,u,c,h,d){"use strict";function p(e){e._rebindAllGlyphs||e._repositionAllGlyphs||e._labelCollection._labelsToUpdate.push(e),e._rebindAllGlyphs=!0}function m(e){e._rebindAllGlyphs||e._repositionAllGlyphs||e._labelCollection._labelsToUpdate.push(e),e._repositionAllGlyphs=!0}function f(n,o){n=r(n,r.EMPTY_OBJECT),this._text=r(n.text,""),this._show=r(n.show,!0),this._font=r(n.font,"30px sans-serif"),this._fillColor=i.clone(r(n.fillColor,i.WHITE)),this._outlineColor=i.clone(r(n.outlineColor,i.BLACK)),this._outlineWidth=r(n.outlineWidth,1),this._style=r(n.style,h.FILL),this._verticalOrigin=r(n.verticalOrigin,d.BOTTOM),this._horizontalOrigin=r(n.horizontalOrigin,c.LEFT),this._pixelOffset=e.clone(r(n.pixelOffset,e.ZERO)),this._eyeOffset=t.clone(r(n.eyeOffset,t.ZERO)),this._position=t.clone(r(n.position,t.ZERO)),this._scale=r(n.scale,1),this._id=n.id,this._translucencyByDistance=n.translucencyByDistance,this._pixelOffsetScaleByDistance=n.pixelOffsetScaleByDistance,this._heightReference=r(n.heightReference,u.NONE),this._labelCollection=o,this._glyphs=[],this._rebindAllGlyphs=!0,this._repositionAllGlyphs=!0,this._actualClampedPosition=void 0,this._removeCallbackFunc=void 0,this._mode=void 0,this._updateClamping()}return o(f.prototype,{show:{get:function(){return this._show},set:function(e){if(this._show!==e){this._show=e;for(var t=this._glyphs,i=0,r=t.length;r>i;i++){var o=t[i];n(o.billboard)&&(o.billboard.show=e)}}}},position:{get:function(){return this._position},set:function(e){var i=this._position;if(!t.equals(i,e))if(t.clone(e,i),this._heightReference===u.NONE)for(var r=this._glyphs,o=0,a=r.length;a>o;o++){var s=r[o];n(s.billboard)&&(s.billboard.position=e)}else this._updateClamping()}},heightReference:{get:function(){return this._heightReference},set:function(e){e!==this._heightReference&&(this._heightReference=e,this._updateClamping())}},text:{get:function(){return this._text},set:function(e){this._text!==e&&(this._text=e,p(this))}},font:{get:function(){return this._font},set:function(e){this._font!==e&&(this._font=e,p(this))}},fillColor:{get:function(){return this._fillColor},set:function(e){var t=this._fillColor;i.equals(t,e)||(i.clone(e,t),p(this))}},outlineColor:{get:function(){return this._outlineColor},set:function(e){var t=this._outlineColor;i.equals(t,e)||(i.clone(e,t),p(this))}},outlineWidth:{get:function(){return this._outlineWidth},set:function(e){this._outlineWidth!==e&&(this._outlineWidth=e,p(this))}},style:{get:function(){return this._style},set:function(e){this._style!==e&&(this._style=e,p(this))}},pixelOffset:{get:function(){return this._pixelOffset},set:function(t){var i=this._pixelOffset;if(!e.equals(i,t)){e.clone(t,i);for(var r=this._glyphs,o=0,a=r.length;a>o;o++){var s=r[o];n(s.billboard)&&(s.billboard.pixelOffset=t)}}}},translucencyByDistance:{get:function(){return this._translucencyByDistance},set:function(e){var t=this._translucencyByDistance;if(!s.equals(t,e)){this._translucencyByDistance=s.clone(e,t);for(var i=this._glyphs,r=0,o=i.length;o>r;r++){var a=i[r];n(a.billboard)&&(a.billboard.translucencyByDistance=e)}}}},pixelOffsetScaleByDistance:{get:function(){return this._pixelOffsetScaleByDistance},set:function(e){var t=this._pixelOffsetScaleByDistance;if(!s.equals(t,e)){this._pixelOffsetScaleByDistance=s.clone(e,t);for(var i=this._glyphs,r=0,o=i.length;o>r;r++){var a=i[r];n(a.billboard)&&(a.billboard.pixelOffsetScaleByDistance=e)}}}},eyeOffset:{get:function(){return this._eyeOffset},set:function(e){var i=this._eyeOffset;if(!t.equals(i,e)){t.clone(e,i);for(var r=this._glyphs,o=0,a=r.length;a>o;o++){var s=r[o];n(s.billboard)&&(s.billboard.eyeOffset=e)}}}},horizontalOrigin:{get:function(){return this._horizontalOrigin},set:function(e){this._horizontalOrigin!==e&&(this._horizontalOrigin=e,m(this))}},verticalOrigin:{get:function(){return this._verticalOrigin},set:function(e){if(this._verticalOrigin!==e){this._verticalOrigin=e;for(var t=this._glyphs,i=0,r=t.length;r>i;i++){var o=t[i];n(o.billboard)&&(o.billboard.verticalOrigin=e)}m(this)}}},scale:{get:function(){return this._scale},set:function(e){if(this._scale!==e){this._scale=e;for(var t=this._glyphs,i=0,r=t.length;r>i;i++){var o=t[i];n(o.billboard)&&(o.billboard.scale=e)}m(this)}}},id:{get:function(){return this._id},set:function(e){if(this._id!==e){this._id=e;for(var t=this._glyphs,i=0,r=t.length;r>i;i++){var o=t[i];n(o.billboard)&&(o.billboard.id=e)}}}},_clampedPosition:{get:function(){return this._actualClampedPosition},set:function(e){this._actualClampedPosition=t.clone(e,this._actualClampedPosition);for(var i=this._glyphs,r=0,o=i.length;o>r;r++){var a=i[r];n(a.billboard)&&(a.billboard.position=e)}}}}),f.prototype._updateClamping=function(){l._updateClamping(this._labelCollection,this)},f.prototype.computeScreenSpacePosition=function(t,i){n(i)||(i=new e);var r=this._labelCollection,o=r.modelMatrix,a=l._computeActualPosition(this,this._position,t.frameState,o),s=l._computeScreenSpacePosition(o,a,this._eyeOffset,this._pixelOffset,t,i);return s.y=t.canvas.clientHeight-s.y,s},f.prototype.equals=function(r){return this===r||n(r)&&this._show===r._show&&this._scale===r._scale&&this._style===r._style&&this._verticalOrigin===r._verticalOrigin&&this._horizontalOrigin===r._horizontalOrigin&&this._text===r._text&&this._font===r._font&&t.equals(this._position,r._position)&&i.equals(this._fillColor,r._fillColor)&&i.equals(this._outlineColor,r._outlineColor)&&e.equals(this._pixelOffset,r._pixelOffset)&&t.equals(this._eyeOffset,r._eyeOffset)&&s.equals(this._translucencyByDistance,r._translucencyByDistance)&&s.equals(this._pixelOffsetScaleByDistance,r._pixelOffsetScaleByDistance)&&this._id===r._id},f.prototype.isDestroyed=function(){return!1},f}),i("Scene/LabelCollection",["../Core/Cartesian2","../Core/defaultValue","../Core/defined","../Core/defineProperties","../Core/destroyObject","../Core/DeveloperError","../Core/Matrix4","../Core/writeTextToCanvas","./BillboardCollection","./HorizontalOrigin","./Label","./LabelStyle","./TextureAtlas","./VerticalOrigin"],function(e,t,i,r,n,o,a,s,l,u,c,h,d,p){"use strict";function m(){this.textureInfo=void 0,this.dimensions=void 0,this.billboard=void 0}function f(e,t,i){this.labelCollection=e,this.index=t,this.dimensions=i}function v(e,t,i,r,n,o,a){return w.font=t,w.fillColor=i,w.strokeColor=r,w.strokeWidth=n,a===p.BOTTOM?w.textBaseline="bottom":a===p.TOP?w.textBaseline="top":w.textBaseline="middle",w.fill=o===h.FILL||o===h.FILL_AND_OUTLINE,w.stroke=o===h.OUTLINE||o===h.FILL_AND_OUTLINE,s(e,w)}function g(e,t){t.textureInfo=void 0,t.dimensions=void 0;var r=t.billboard;i(r)&&(r.show=!1,r.image=void 0,e._spareBillboards.push(r),t.billboard=void 0)}function _(e,t,i,r){e.addImage(t,i).then(function(e,t){r.index=e})}function y(e,t){var r,n,o,a=t._text,s=a.length,l=t._glyphs,c=l.length;if(c>s)for(n=s;c>n;++n)g(e,l[n]);l.length=s;var h=e._glyphTextureCache;for(o=0;s>o;++o){var d=a.charAt(o),p=t._font,y=t._fillColor,C=t._outlineColor,E=t._outlineWidth,S=t._style,w=t._verticalOrigin,T=JSON.stringify([d,p,y.toRgba(),C.toRgba(),E,+S,+w]),x=h[T];if(!i(x)){var b=v(d,p,y,C,E,S,w);x=new f(e,-1,b.dimensions),h[T]=x,b.width>0&&b.height>0&&_(e._textureAtlas,T,b,x)}if(r=l[o],i(r)?-1===x.index?g(e,r):i(r.textureInfo)&&(r.textureInfo=void 0):(r=new m,l[o]=r),r.textureInfo=x,r.dimensions=x.dimensions,-1!==x.index){var A=r.billboard;i(A)||(A=e._spareBillboards.length>0?e._spareBillboards.pop():e._billboardCollection.add({collection:e}),r.billboard=A),A.show=t._show,A.position=t._position,A.eyeOffset=t._eyeOffset,A.pixelOffset=t._pixelOffset,A.horizontalOrigin=u.LEFT,A.verticalOrigin=t._verticalOrigin,A.scale=t._scale,A.pickPrimitive=t,A.id=t._id,A.image=T,A.translucencyByDistance=t._translucencyByDistance,A.pixelOffsetScaleByDistance=t._pixelOffsetScaleByDistance}}t._repositionAllGlyphs=!0}function C(e,t){var r,n,o=e._glyphs,a=0,s=0,l=0,c=o.length;for(l=0;c>l;++l)r=o[l],n=r.dimensions,a+=n.computedWidth,s=Math.max(s,n.height);var h=e._scale,d=e._horizontalOrigin,m=0;d===u.CENTER?m-=a/2*h:d===u.RIGHT&&(m-=a*h),T.x=m*t,T.y=0;var f=e._verticalOrigin;for(l=0;c>l;++l)r=o[l],n=r.dimensions,f===p.BOTTOM||n.height===s?T.y=-n.descent*h:f===p.TOP?T.y=-(s-n.height)*h-n.descent*h:f===p.CENTER&&(T.y=-(s-n.height)/2*h-n.descent*h),T.y*=t,i(r.billboard)&&r.billboard._setTranslate(T),T.x+=n.computedWidth*h*t}function E(e,t){for(var r=t._glyphs,o=0,a=r.length;a>o;++o)g(e,r[o]);t._labelCollection=void 0,i(t._removeCallbackFunc)&&t._removeCallbackFunc(),n(t)}function S(e){e=t(e,t.EMPTY_OBJECT),this._scene=e.scene,this._textureAtlas=void 0,this._billboardCollection=new l({scene:this._scene}),this._billboardCollection.destroyTextureAtlas=!1,this._spareBillboards=[],this._glyphTextureCache={},this._labels=[],this._labelsToUpdate=[],this._totalGlyphCount=0,this._resolutionScale=void 0,this.modelMatrix=a.clone(t(e.modelMatrix,a.IDENTITY)),this.debugShowBoundingVolume=t(e.debugShowBoundingVolume,!1)}var w={},T=new e;return r(S.prototype,{length:{get:function(){return this._labels.length}}}),S.prototype.add=function(e){var t=new c(e,this);return this._labels.push(t),this._labelsToUpdate.push(t),t},S.prototype.remove=function(e){if(i(e)&&e._labelCollection===this){var t=this._labels.indexOf(e);if(-1!==t)return this._labels.splice(t,1),E(this,e),!0}return!1},S.prototype.removeAll=function(){for(var e=this._labels,t=0,i=e.length;i>t;++t)E(this,e[t]);e.length=0},S.prototype.contains=function(e){return i(e)&&e._labelCollection===this},S.prototype.get=function(e){return this._labels[e]},S.prototype.update=function(e){var t=this._billboardCollection;t.modelMatrix=this.modelMatrix,t.debugShowBoundingVolume=this.debugShowBoundingVolume;var r=e.context;i(this._textureAtlas)||(this._textureAtlas=new d({context:r}),t.textureAtlas=this._textureAtlas);var n=r.uniformState,o=n.resolutionScale,a=this._resolutionScale!==o;this._resolutionScale=o;var s;s=a?this._labels:this._labelsToUpdate;for(var l=s.length,u=0;l>u;++u){var c=s[u];if(!c.isDestroyed()){var h=c._glyphs.length;c._rebindAllGlyphs&&(y(this,c),c._rebindAllGlyphs=!1),(a||c._repositionAllGlyphs)&&(C(c,o),c._repositionAllGlyphs=!1);var p=c._glyphs.length-h;this._totalGlyphCount+=p}}this._labelsToUpdate.length=0,t.update(e)},S.prototype.isDestroyed=function(){return!1},S.prototype.destroy=function(){return this.removeAll(),this._billboardCollection=this._billboardCollection.destroy(),this._textureAtlas=this._textureAtlas&&this._textureAtlas.destroy(),n(this)},S}),i("DataSources/LabelVisualizer",["../Core/AssociativeArray","../Core/Cartesian2","../Core/Cartesian3","../Core/Color","../Core/defined","../Core/destroyObject","../Core/DeveloperError","../Core/NearFarScalar","../Scene/HorizontalOrigin","../Scene/LabelCollection","../Scene/LabelStyle","../Scene/VerticalOrigin","./BoundingSphereState","./Property"],function(e,t,i,r,n,o,a,s,l,u,c,h,d,p){"use strict";function m(e){this.entity=e,this.label=void 0,this.index=void 0}function f(t,i){i.collectionChanged.addEventListener(f.prototype._onCollectionChanged,this),this._scene=t,this._unusedIndexes=[],this._labelCollection=void 0,this._entityCollection=i,this._items=new e,this._onCollectionChanged(i,i.values,[],[])}function v(e,t){if(n(e)){var i=e.label;n(i)&&(t.push(e.index),i.show=!1,e.label=void 0,e.index=-1)}}var g=1,_="30px sans-serif",y=c.FILL,C=r.WHITE,E=r.BLACK,S=1,w=t.ZERO,T=i.ZERO,x=l.CENTER,b=h.CENTER,A=new i,P=new r,I=new r,M=new i,D=new t,R=new s,O=new s;return f.prototype.update=function(e){for(var t=this._items.values,i=this._unusedIndexes,r=0,o=t.length;o>r;r++){var a,s=t[r],l=s.entity,c=l._label,h=s.label,d=l.isShowing&&l.isAvailable(e)&&p.getValueOrDefault(c._show,e,!0);if(d&&(A=p.getValueOrUndefined(l._position,e,A),a=p.getValueOrUndefined(c._text,e),d=n(A)&&n(a)),d){if(!n(h)){var m=this._labelCollection;n(m)||(m=new u,this._labelCollection=m,this._scene.primitives.add(m));var f=i.length;if(f>0){var N=i.pop();s.index=N,h=m.get(N)}else h=m.add(),s.index=m.length-1;h.id=l,s.label=h}h.show=!0,h.position=A,h.text=a,h.scale=p.getValueOrDefault(c._scale,e,g),h.font=p.getValueOrDefault(c._font,e,_),h.style=p.getValueOrDefault(c._style,e,y),h.fillColor=p.getValueOrDefault(c._fillColor,e,C,P),h.outlineColor=p.getValueOrDefault(c._outlineColor,e,E,I),h.outlineWidth=p.getValueOrDefault(c._outlineWidth,e,S),h.pixelOffset=p.getValueOrDefault(c._pixelOffset,e,w,D),h.eyeOffset=p.getValueOrDefault(c._eyeOffset,e,T,M),h.horizontalOrigin=p.getValueOrDefault(c._horizontalOrigin,e,x),h.verticalOrigin=p.getValueOrDefault(c._verticalOrigin,e,b),h.translucencyByDistance=p.getValueOrUndefined(c._translucencyByDistance,e,R),h.pixelOffsetScaleByDistance=p.getValueOrUndefined(c._pixelOffsetScaleByDistance,e,O)}else v(s,i)}return!0},f.prototype.getBoundingSphere=function(e,t){var r=this._items.get(e.id);return n(r)&&n(r.label)?(t.center=i.clone(r.label.position,t.center),t.radius=0,d.DONE):d.FAILED},f.prototype.isDestroyed=function(){return!1},f.prototype.destroy=function(){return this._entityCollection.collectionChanged.removeEventListener(f.prototype._onCollectionChanged,this),n(this._labelCollection)&&this._scene.primitives.remove(this._labelCollection),o(this)},f.prototype._onCollectionChanged=function(e,t,i,r){var o,a,s=this._unusedIndexes,l=this._items;for(o=t.length-1;o>-1;o--)a=t[o],n(a._label)&&n(a._position)&&l.set(a.id,new m(a));for(o=r.length-1;o>-1;o--)a=r[o],n(a._label)&&n(a._position)?l.contains(a.id)||l.set(a.id,new m(a)):(v(l.get(a.id),s),l.remove(a.id));for(o=i.length-1;o>-1;o--)a=i[o],v(l.get(a.id),s),l.remove(a.id)},f}),i("ThirdParty/gltfDefaults",["../Core/Cartesian3","../Core/defaultValue","../Core/defined","../Core/Quaternion","../Renderer/WebGLConstants"],function(e,t,i,r,n){"use strict";function o(e){i(e.accessors)||(e.accessors={});var r=e.accessors;for(var n in r)if(r.hasOwnProperty(n)){var o=r[n];o.byteStride=t(o.byteStride,0)}}function a(e){i(e.animations)||(e.animations={});var r=e.animations;for(var n in r)if(r.hasOwnProperty(n)){var o=r[n];i(o.channels)||(o.channels=[]),i(o.parameters)||(o.parameters={}),i(o.samplers)||(o.samplers={});var a=r.samplers;for(var s in a)if(a.hasOwnProperty(s)){var l=a[s];l.interpolation=t(l.interpolation,"LINEAR")}}}function s(e){i(e.asset)||(e.asset={});var r=e.asset;i(r.profile)&&"string"!=typeof r.profile||(r.profile={});var n=r.profile;r.premultipliedAlpha=t(r.premultipliedAlpha,!1),n.api=t(n.api,"WebGL"),n.version=t(n.version,"1.0.2"),i(e.version)&&(r.version=t(r.version,e.version),delete e.version),"number"==typeof r.version&&(r.version=r.version.toFixed(1).toString())}function l(e){i(e.buffers)||(e.buffers={});var r=e.buffers;for(var n in r)if(r.hasOwnProperty(n)){var o=r[n];o.type=t(o.type,"arraybuffer")}}function u(e){i(e.bufferViews)||(e.bufferViews={})}function c(e){i(e.cameras)||(e.cameras={})}function h(e){i(e.images)||(e.images={})}function d(e){i(e.extensions)||(e.extensions={});var r=e.extensions;i(r.KHR_materials_common)||(r.KHR_materials_common={});var n=r.KHR_materials_common;i(e.lights)?(n.lights=e.lights,delete e.lights):i(n.lights)||(n.lights={});var o=n.lights;for(var a in o)if(o.hasOwnProperty(a)){var s=o[a];if("ambient"===s.type){i(s.ambient)||(s.ambient={});var l=s.ambient;i(l.color)||(l.color=[1,1,1])}else if("directional"===s.type){i(s.directional)||(s.directional={});var u=s.directional;i(u.color)||(u.color=[1,1,1])}else if("point"===s.type){i(s.point)||(s.point={});var c=s.point;i(c.color)||(c.color=[1,1,1]),c.constantAttenuation=t(c.constantAttenuation,1),c.linearAttenuation=t(c.linearAttenuation,0),c.quadraticAttenuation=t(c.quadraticAttenuation,0)}else if("spot"===s.type){i(s.spot)||(s.spot={});var h=s.spot;i(h.color)||(h.color=[1,1,1]),h.constantAttenuation=t(h.constantAttenuation,1),h.fallOffAngle=t(h.fallOffAngle,3.14159265),h.fallOffExponent=t(h.fallOffExponent,0),h.linearAttenuation=t(h.linearAttenuation,0),h.quadraticAttenuation=t(h.quadraticAttenuation,0)}}}function p(e){i(e.materials)||(e.materials={});var t=e.materials;for(var r in t)if(t.hasOwnProperty(r)){var o=t[r],a=o.instanceTechnique;if(i(a)&&(o.technique=a.technique,o.values=a.values,delete o.instanceTechnique),!i(o.extensions))if(i(o.technique))i(o.values)||(o.values={});else{delete o.values,o.extensions={KHR_materials_common:{technique:"CONSTANT",transparent:!1,values:{emission:{type:n.FLOAT_VEC4,value:[.5,.5,.5,1]}}}},i(e.extensionsUsed)||(e.extensionsUsed=[]);var s=e.extensionsUsed;-1===s.indexOf("KHR_materials_common")&&s.push("KHR_materials_common")}}}function m(e){i(e.meshes)||(e.meshes={});var r=e.meshes;for(var o in r)if(r.hasOwnProperty(o)){var a=r[o];i(a.primitives)||(a.primitives=[]);for(var s=a.primitives.length,l=s.length,u=0;l>u;++u){var c=s[u];i(c.attributes)||(c.attributes={});var h=t(c.primitive,n.TRIANGLES);c.mode=t(c.mode,h)}}}function f(t){i(t.nodes)||(t.nodes={});var n=t.nodes,o=parseFloat(t.asset.version)<1,a=new e,s=new r;for(var l in n)if(n.hasOwnProperty(l)){var u=n[l];if(i(u.children)||(u.children=[]),o&&i(u.rotation)){var c=u.rotation;e.fromArray(c,0,a),r.fromAxisAngle(a,c[3],s),u.rotation=[s.x,s.y,s.z,s.w]}i(u.matrix)||(i(u.translation)||i(u.rotation)||i(u.scale)?(i(u.translation)||(u.translation=[0,0,0]),i(u.rotation)||(u.rotation=[0,0,0,1]),i(u.scale)||(u.scale=[1,1,1])):u.matrix=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]);var h=u.instanceSkin;i(h)&&(u.skeletons=h.skeletons,u.skin=h.skin,u.meshes=h.meshes,delete u.instanceSkin)}}function v(e){i(e.programs)||(e.programs={});var t=e.programs;for(var r in t)if(t.hasOwnProperty(r)){var n=t[r];i(n.attributes)||(n.attributes=[])}}function g(e){i(e.samplers)||(e.samplers={});var r=e.samplers;for(var o in r)if(r.hasOwnProperty(o)){var a=r[o];a.magFilter=t(a.magFilter,n.LINEAR),a.minFilter=t(a.minFilter,n.NEAREST_MIPMAP_LINEAR),a.wrapS=t(a.wrapS,n.REPEAT),a.wrapT=t(a.wrapT,n.REPEAT)}}function _(e){i(e.scenes)||(e.scenes={});var t=e.scenes;for(var r in t)if(t.hasOwnProperty(r)){var n=t[r];i(n.node)||(n.node=[])}}function y(e){i(e.shaders)||(e.shaders={})}function C(e){i(e.skins)||(e.skins={});var t=e.skins;for(var r in t)if(t.hasOwnProperty(r)){var n=t[r];i(n.bindShapeMatrix)&&(n.bindShapeMatrix=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1])}}function E(e){i(e.enable)||(e.enable=[]),i(e.disable)||(e.disable=[])}function S(e){i(e.techniques)||(e.techniques={});var r=e.techniques;for(var n in r)if(r.hasOwnProperty(n)){var o=r[n];i(o.parameters)||(o.parameters={});var a=o.parameters;for(var s in a){var l=a[s];l.node=t(l.node,l.source),l.source=void 0}var u=o.passes;if(i(u)){var c=t(o.pass,"defaultPass");if(u.hasOwnProperty(c)){var h=u[c],d=h.instanceProgram;o.attributes=t(o.attributes,d.attributes),o.program=t(o.program,d.program),o.uniforms=t(o.uniforms,d.uniforms),o.states=t(o.states,h.states)}o.passes=void 0,o.pass=void 0}i(o.attributes)||(o.attributes={}),i(o.uniforms)||(o.uniforms={}),i(o.states)||(o.states={}),E(o.states)}}function w(e){i(e.textures)||(e.textures={});var r=e.textures;for(var o in r)if(r.hasOwnProperty(o)){var a=r[o];a.format=t(a.format,n.RGBA),a.internalFormat=t(a.internalFormat,a.format),a.target=t(a.target,n.TEXTURE_2D),a.type=t(a.type,n.UNSIGNED_BYTE)}}var T=function(e){return i(e)?(i(e.allExtensions)&&(e.extensionsUsed=e.allExtensions,e.allExtensions=void 0),e.extensionsUsed=t(e.extensionsUsed,[]),o(e),a(e),s(e),l(e),u(e),c(e),h(e),d(e),p(e),m(e),f(e),v(e),g(e),_(e),y(e),C(e),S(e),w(e),e):void 0};return T}),i("Scene/getModelAccessor",["../Core/ComponentDatatype"],function(e){"use strict";function t(t){var r=t.componentType,n=i[t.type];return{componentsPerAttribute:n,createArrayBufferView:function(t,i,o){return e.createArrayBufferView(r,t,i,n*o)}}}var i={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16};return t}),i("Scene/ModelAnimationCache",["../Core/Cartesian3","../Core/defaultValue","../Core/defined","../Core/LinearSpline","../Core/Matrix4","../Core/Quaternion","../Core/QuaternionSpline","../Renderer/WebGLConstants","./getModelAccessor"],function(e,t,i,r,n,o,a,s,l){"use strict";function u(){}function c(e,i){var r=e.gltf,n=r.buffers,o=r.bufferViews,a=o[i.bufferView],s=n[a.buffer],u=a.byteOffset+i.byteOffset,c=i.count*l(i).componentsPerAttribute;return e.cacheKey+"//"+t(s.path,"")+"/"+u+"/"+c}function h(e,t,i){return e.cacheKey+"//"+t+"/"+i}function d(e){this._value=e}var p={},m=new e;u.getAnimationParameterValues=function(t,r){var n=c(t,r),a=p[n];if(!i(a)){var u,h=t._loadResources,d=t.gltf,f=parseFloat(d.asset.version)<1,v=d.bufferViews,g=v[r.bufferView],_=r.componentType,y=r.type,C=r.count,E=h.getBuffer(g),S=l(r).createArrayBufferView(E.buffer,E.byteOffset+r.byteOffset,C);if(_===s.FLOAT&&"SCALAR"===y)a=S;else if(_===s.FLOAT&&"VEC3"===y)for(a=new Array(C),u=0;C>u;++u)a[u]=e.fromArray(S,3*u);else if(_===s.FLOAT&&"VEC4"===y)for(a=new Array(C),u=0;C>u;++u){var w=4*u;f?a[u]=o.fromAxisAngle(e.fromArray(S,w,m),S[w+3]):a[u]=o.unpack(S,w)}i(t.cacheKey)&&(p[n]=a)}return a};var f={};d.prototype.evaluate=function(e,t){return this._value},u.getAnimationSpline=function(e,t,n,o,l,u){var c=h(e,t,o),p=f[c];if(!i(p)){var m=u[l.input],v=e.gltf.accessors[n.parameters[l.output]],g=u[l.output];if(1===m.length&&1===g.length)p=new d(g[0]);else{var _=v.componentType,y=v.type;"LINEAR"===l.interpolation&&(_===s.FLOAT&&"VEC3"===y?p=new r({times:m,points:g}):_===s.FLOAT&&"VEC4"===y&&(p=new a({times:m,points:g})))}i(e.cacheKey)&&(f[c]=p)}return p};var v={};return u.getSkinInverseBindMatrices=function(e,t){var r=c(e,t),o=v[r];if(!i(o)){var a=e._loadResources,u=e.gltf,h=u.bufferViews,d=h[t.bufferView],p=t.componentType,m=t.type,f=t.count,g=a.getBuffer(d),_=l(t).createArrayBufferView(g.buffer,g.byteOffset+t.byteOffset,f);if(o=new Array(f),p===s.FLOAT&&"MAT4"===m)for(var y=0;f>y;++y)o[y]=n.fromArray(_,16*y);v[r]=o}return o},u}),i("Scene/ModelAnimationLoop",["../Core/freezeObject"],function(e){"use strict";var t={NONE:0,REPEAT:1,MIRRORED_REPEAT:2};return e(t)}),i("Scene/ModelAnimationState",["../Core/freezeObject"],function(e){"use strict";return e({STOPPED:0,ANIMATING:1})}),i("Scene/ModelAnimation",["../Core/defaultValue","../Core/defineProperties","../Core/Event","../Core/JulianDate","./ModelAnimationLoop","./ModelAnimationState"],function(e,t,i,r,n,o){"use strict";function a(t,a,s){this._name=t.name,this._startTime=r.clone(t.startTime),this._delay=e(t.delay,0),this._stopTime=t.stopTime,this.removeOnStop=e(t.removeOnStop,!1),this._speedup=e(t.speedup,1),this._reverse=e(t.reverse,!1),this._loop=e(t.loop,n.NONE),this.start=new i,this.update=new i,this.stop=new i,this._state=o.STOPPED,this._runtimeAnimation=s,this._computedStartTime=void 0,this._duration=void 0;var l=this;this._raiseStartEvent=function(){l.start.raiseEvent(a,l)},this._updateEventTime=0,this._raiseUpdateEvent=function(){l.update.raiseEvent(a,l,l._updateEventTime)},this._raiseStopEvent=function(){l.stop.raiseEvent(a,l)}}return t(a.prototype,{name:{get:function(){return this._name}},startTime:{get:function(){return this._startTime}},delay:{get:function(){return this._delay}},stopTime:{get:function(){return this._stopTime}},speedup:{get:function(){return this._speedup}},reverse:{get:function(){return this._reverse}},loop:{get:function(){return this._loop}}}),a}),i("Scene/ModelAnimationCollection",["../Core/clone","../Core/defaultValue","../Core/defined","../Core/defineProperties","../Core/DeveloperError","../Core/Event","../Core/JulianDate","../Core/Math","./ModelAnimation","./ModelAnimationLoop","./ModelAnimationState"],function(e,t,i,r,n,o,a,s,l,u,c){"use strict";function h(e){this.animationAdded=new o,this.animationRemoved=new o,this._model=e,this._scheduledAnimations=[],this._previousTime=void 0}function d(e,t){for(var i=e.channelEvaluators,r=i.length,n=0;r>n;++n)i[n](t)}function p(e,t,i){return function(){e.animationRemoved.raiseEvent(t,i)}}r(h.prototype,{length:{get:function(){return this._scheduledAnimations.length}}}),h.prototype.add=function(e){e=t(e,t.EMPTY_OBJECT);var i=this._model,r=i._runtime.animations,n=r[e.name],o=new l(e,i,n);return this._scheduledAnimations.push(o),this.animationAdded.raiseEvent(i,o),o},h.prototype.addAll=function(i){i=t(i,t.EMPTY_OBJECT),i=e(i);for(var r=[],n=this._model._animationIds,o=n.length,a=0;o>a;++a)i.name=n[a],r.push(this.add(i));return r},h.prototype.remove=function(e){if(i(e)){var t=this._scheduledAnimations,r=t.indexOf(e);if(-1!==r)return t.splice(r,1),this.animationRemoved.raiseEvent(this._model,e),!0}return!1},h.prototype.removeAll=function(){var e=this._model,t=this._scheduledAnimations,i=t.length;this._scheduledAnimations=[];for(var r=0;i>r;++r)this.animationRemoved.raiseEvent(e,t[r])},h.prototype.contains=function(e){return i(e)?-1!==this._scheduledAnimations.indexOf(e):!1},h.prototype.get=function(e){return this._scheduledAnimations[e]};var m=[];return h.prototype.update=function(e){var r=this._scheduledAnimations,n=r.length;if(0===n)return this._previousTime=void 0,!1;if(a.equals(e.time,this._previousTime))return!1;this._previousTime=a.clone(e.time,this._previousTime);for(var o=!1,l=e.time,h=this._model,f=0;n>f;++f){var v=r[f],g=v._runtimeAnimation;i(v._computedStartTime)||(v._computedStartTime=a.addSeconds(t(v.startTime,l),v.delay,new a)),i(v._duration)||(v._duration=g.stopTime*(1/v.speedup));var _=v._computedStartTime,y=v._duration,C=v.stopTime,E=0!==y?a.secondsDifference(l,_)/y:0,S=E>=0,w=S&&(1>=E||v.loop===u.REPEAT||v.loop===u.MIRRORED_REPEAT)&&(!i(C)||a.lessThanOrEquals(l,C));if(w){if(v._state===c.STOPPED&&(v._state=c.ANIMATING,v.start.numberOfListeners>0&&e.afterRender.push(v._raiseStartEvent)),v.loop===u.REPEAT)E-=Math.floor(E);else if(v.loop===u.MIRRORED_REPEAT){var T=Math.floor(E),x=E-T;E=T%2===1?1-x:x}v.reverse&&(E=1-E);var b=E*y*v.speedup;b=s.clamp(b,g.startTime,g.stopTime),d(g,b),v.update.numberOfListeners>0&&(v._updateEventTime=b,e.afterRender.push(v._raiseUpdateEvent)),o=!0}else S&&v._state===c.ANIMATING&&(v._state=c.STOPPED,v.stop.numberOfListeners>0&&e.afterRender.push(v._raiseStopEvent),v.removeOnStop&&m.push(v))}n=m.length;for(var A=0;n>A;++A){var P=m[A];r.splice(r.indexOf(P),1),e.afterRender.push(p(this,h,P))}return m.length=0,o},h}),i("Scene/ModelMaterial",["../Core/defined","../Core/defineProperties","../Core/DeveloperError"],function(e,t,i){"use strict";function r(e,t,i){this._name=t.name,this._id=i,this._uniformMap=e._uniformMaps[i]}return t(r.prototype,{name:{get:function(){return this._name}},id:{get:function(){return this._id}}}),r.prototype.setValue=function(e,t){var i=this._uniformMap.values[e];i.value=i.clone(t,i.value)},r.prototype.getValue=function(t){var i=this._uniformMap.values[t];if(e(i))return i.value},r}),i("Scene/modelMaterialsCommon",["../Core/defaultValue","../Core/defined","../Renderer/WebGLConstants"],function(e,t,i){"use strict";function r(e){switch(e){case i.FLOAT:return"float";case i.FLOAT_VEC2:return"vec2";case i.FLOAT_VEC3:return"vec3";case i.FLOAT_VEC4:return"vec4";case i.FLOAT_MAT2:return"mat2";case i.FLOAT_MAT3:return"mat3";case i.FLOAT_MAT4:return"mat4";case i.SAMPLER_2D:return"sampler2D"}}function n(e){var r,n={};if(t(e.extensions)&&t(e.extensions.KHR_materials_common)&&(r=e.extensions.KHR_materials_common.lights),t(r)){var o=e.nodes;for(var a in o)if(o.hasOwnProperty(a)){var s=o[a];if(t(s.extensions)&&t(s.extensions.KHR_materials_common)){var l=s.extensions.KHR_materials_common.light;t(l)&&t(r[l])&&(r[l].node=a),delete s.extensions.KHR_materials_common}}var u=0;for(var c in r)if(r.hasOwnProperty(c)){var h=r[c],d=h.type;if("ambient"!==d&&!t(h.node)){delete r[c];continue}var p="light"+u.toString();switch(h.baseName=p,d){case"ambient":var m=h.ambient;n[p+"Color"]={type:i.FLOAT_VEC3,value:m.color};break;case"directional":var f=h.directional;n[p+"Color"]={type:i.FLOAT_VEC3,value:f.color},t(h.node)&&(n[p+"Transform"]={node:h.node,semantic:"MODELVIEW",type:i.FLOAT_MAT4});break;case"point":var v=h.point;n[p+"Color"]={type:i.FLOAT_VEC3,value:v.color},t(h.node)&&(n[p+"Transform"]={node:h.node,semantic:"MODELVIEW",type:i.FLOAT_MAT4}),n[p+"Attenuation"]={type:i.FLOAT_VEC3,value:[v.constantAttenuation,v.linearAttenuation,v.quadraticAttenuation]};break;case"spot":var g=h.spot;n[p+"Color"]={type:i.FLOAT_VEC3,value:g.color},t(h.node)&&(n[p+"Transform"]={node:h.node,semantic:"MODELVIEW",type:i.FLOAT_MAT4},n[p+"InverseTransform"]={node:h.node,semantic:"MODELVIEWINVERSE",type:i.FLOAT_MAT4,useInFragment:!0}),n[p+"Attenuation"]={type:i.FLOAT_VEC3,value:[g.constantAttenuation,g.linearAttenuation,g.quadraticAttenuation]},n[p+"FallOff"]={type:i.FLOAT_VEC2,value:[g.fallOffAngle,g.fallOffExponent]}}++u}}return n}function o(i,r,n){var o,a=e(n,0);do o=r+(a++).toString();while(t(i[o]));return o}function a(n,a,l){var u,m=n.techniques,f=n.shaders,v=n.programs,g=a.technique.toUpperCase();t(n.extensions)&&t(n.extensions.KHR_materials_common)&&(u=n.extensions.KHR_materials_common.lights);var _=e(a.jointCount,0),y=_>0,C=a.values,E="precision highp float;\n",S="precision highp float;\n",w=o(m,"technique",c),T=o(f,"vertexShader",h),x=o(f,"fragmentShader",d),b=o(v,"program",p),A="CONSTANT"!==g,P={modelViewMatrix:{semantic:"MODELVIEW",type:i.FLOAT_MAT4},projectionMatrix:{semantic:"PROJECTION",type:i.FLOAT_MAT4}};A&&(P.normalMatrix={semantic:"MODELVIEWINVERSETRANSPOSE",type:i.FLOAT_MAT3}),y&&(P.jointMatrix={count:_,semantic:"JOINTMATRIX",type:i.FLOAT_MAT4});var I,M=!1;for(var D in C)if(C.hasOwnProperty(D)&&"transparent"!==D&&"doubleSided"!==D){ -var R=s(D,C[D]);I=D.toLowerCase(),M||R!==i.SAMPLER_2D||(M=!0),P[I]={type:R}}if(t(l))for(var O in l)l.hasOwnProperty(O)&&(P[O]=l[O]);var N={};for(var L in P)if(P.hasOwnProperty(L)){var F=P[L];N["u_"+L]=L;var B=t(F.count)?"["+F.count+"]":"";F.type!==i.FLOAT_MAT3&&F.type!==i.FLOAT_MAT4||F.useInFragment?(S+="uniform "+r(F.type)+" u_"+L+B+";\n",delete F.useInFragment):E+="uniform "+r(F.type)+" u_"+L+B+";\n"}var V="";y&&(V+=" mat4 skinMat = a_weight.x * u_jointMatrix[int(a_joint.x)];\n",V+=" skinMat += a_weight.y * u_jointMatrix[int(a_joint.y)];\n",V+=" skinMat += a_weight.z * u_jointMatrix[int(a_joint.z)];\n",V+=" skinMat += a_weight.w * u_jointMatrix[int(a_joint.w)];\n");var k={a_position:"position"};P.position={semantic:"POSITION",type:i.FLOAT_VEC3},E+="attribute vec3 a_position;\n",E+="varying vec3 v_positionEC;\n",V+=y?" vec4 pos = u_modelViewMatrix * skinMat * vec4(a_position,1.0);\n":" vec4 pos = u_modelViewMatrix * vec4(a_position,1.0);\n",V+=" v_positionEC = pos.xyz;\n",V+=" gl_Position = u_projectionMatrix * pos;\n",S+="varying vec3 v_positionEC;\n",A&&(k.a_normal="normal",P.normal={semantic:"NORMAL",type:i.FLOAT_VEC3},E+="attribute vec3 a_normal;\n",E+="varying vec3 v_normal;\n",V+=y?" v_normal = u_normalMatrix * mat3(skinMat) * a_normal;\n":" v_normal = u_normalMatrix * a_normal;\n",S+="varying vec3 v_normal;\n");var z;M&&(k.a_texcoord_0="texcoord_0",P.texcoord_0={semantic:"TEXCOORD_0",type:i.FLOAT_VEC2},z="v_texcoord_0",E+="attribute vec2 a_texcoord_0;\n",E+="varying vec2 "+z+";\n",V+=" "+z+" = a_texcoord_0;\n",S+="varying vec2 "+z+";\n"),y&&(k.a_joint="joint",P.joint={semantic:"JOINT",type:i.FLOAT_VEC4},k.a_weight="weight",P.weight={semantic:"WEIGHT",type:i.FLOAT_VEC4},E+="attribute vec4 a_joint;\n",E+="attribute vec4 a_weight;\n");var U=A&&("BLINN"===g||"PHONG"===g)&&t(P.specular)&&t(P.shininess),G=!1,W=!1,H="";for(var q in u)if(u.hasOwnProperty(q)){var j=u[q],Y=j.type.toLowerCase(),X=j.baseName;H+=" {\n";var Z,K,Q="u_"+X+"Color";"ambient"===Y?(W=!0,H+=" ambientLight += "+Q+";\n"):A&&(G=!0,Z="v_"+X+"Direction",K="v_"+X+"Position","point"!==Y&&(E+="varying vec3 "+Z+";\n",S+="varying vec3 "+Z+";\n",V+=" "+Z+" = mat3(u_"+X+"Transform) * vec3(0.,0.,1.);\n","directional"===Y&&(H+=" vec3 l = normalize("+Z+");\n")),"directional"!==Y?(E+="varying vec3 "+K+";\n",S+="varying vec3 "+K+";\n",V+=" "+K+" = u_"+X+"Transform[3].xyz;\n",H+=" vec3 VP = "+K+" - v_positionEC;\n",H+=" vec3 l = normalize(VP);\n",H+=" float range = length(VP);\n",H+=" float attenuation = 1.0 / (u_"+X+"Attenuation.x + ",H+="(u_"+X+"Attenuation.y * range) + ",H+="(u_"+X+"Attenuation.z * range * range));\n"):H+=" float attenuation = 1.0;\n","spot"===Y&&(H+=" float spotDot = dot(l, normalize("+Z+"));\n",H+=" if (spotDot < cos(u_"+X+"FallOff.x * 0.5))\n",H+=" {\n",H+=" attenuation = 0.0;\n",H+=" }\n",H+=" else\n",H+=" {\n",H+=" attenuation *= max(0.0, pow(spotDot, u_"+X+"FallOff.y));\n",H+=" }\n"),H+=" diffuseLight += "+Q+"* max(dot(normal,l), 0.) * attenuation;\n",U&&("BLINN"===g?(H+=" vec3 h = normalize(l + viewDir);\n",H+=" float specularIntensity = max(0., pow(max(dot(normal, h), 0.), u_shininess)) * attenuation;\n"):(H+=" vec3 reflectDir = reflect(-l, normal);\n",H+=" float specularIntensity = max(0., pow(max(dot(reflectDir, viewDir), 0.), u_shininess)) * attenuation;\n"),H+=" specularLight += "+Q+" * specularIntensity;\n")),H+=" }\n"}W||(H+=" ambientLight += vec3(0.2, 0.2, 0.2);\n"),G||"CONSTANT"===g||(H+=" vec3 l = normalize(czm_sunDirectionEC);\n",H+=" diffuseLight += vec3(1.0, 1.0, 1.0) * max(dot(normal,l), 0.);\n",U&&("BLINN"===g?(H+=" vec3 h = normalize(l + viewDir);\n",H+=" float specularIntensity = max(0., pow(max(dot(normal, h), 0.), u_shininess));\n"):(H+=" vec3 reflectDir = reflect(-l, normal);\n",H+=" float specularIntensity = max(0., pow(max(dot(reflectDir, viewDir), 0.), u_shininess));\n"),H+=" specularLight += vec3(1.0, 1.0, 1.0) * specularIntensity;\n")),E+="void main(void) {\n",E+=V,E+="}\n",S+="void main(void) {\n";var J=" vec3 color = vec3(0.0, 0.0, 0.0);\n";A&&(S+=" vec3 normal = normalize(v_normal);\n",a.doubleSided&&(S+=" if (gl_FrontFacing == false)\n",S+=" {\n",S+=" normal = -normal;\n",S+=" }\n"));var $;"CONSTANT"!==g?(t(P.diffuse)&&(S+=P.diffuse.type===i.SAMPLER_2D?" vec4 diffuse = texture2D(u_diffuse, "+z+");\n":" vec4 diffuse = u_diffuse;\n",S+=" vec3 diffuseLight = vec3(0.0, 0.0, 0.0);\n",J+=" color += diffuse.rgb * diffuseLight;\n"),U&&(S+=P.specular.type===i.SAMPLER_2D?" vec3 specular = texture2D(u_specular, "+z+").rgb;\n":" vec3 specular = u_specular.rgb;\n",S+=" vec3 specularLight = vec3(0.0, 0.0, 0.0);\n",J+=" color += specular * specularLight;\n"),$=t(P.transparency)?" gl_FragColor = vec4(color * diffuse.a, diffuse.a * u_transparency);\n":" gl_FragColor = vec4(color * diffuse.a, diffuse.a);\n"):$=t(P.transparency)?" gl_FragColor = vec4(color, u_transparency);\n":" gl_FragColor = vec4(color, 1.0);\n",t(P.emission)&&(S+=P.emission.type===i.SAMPLER_2D?" vec3 emission = texture2D(u_emission, "+z+").rgb;\n":" vec3 emission = u_emission.rgb;\n",J+=" color += emission;\n"),(t(P.ambient)||"CONSTANT"!==g)&&(S+=t(P.ambient)?P.ambient.type===i.SAMPLER_2D?" vec3 ambient = texture2D(u_ambient, "+z+").rgb;\n":" vec3 ambient = u_ambient.rgb;\n":" vec3 ambient = diffuse.rgb;\n",J+=" color += ambient * ambientLight;\n"),S+=" vec3 viewDir = -normalize(v_positionEC);\n",S+=" vec3 ambientLight = vec3(0.0, 0.0, 0.0);\n",S+=H,S+=J,S+=$,S+="}\n";var ee;ee=a.transparent?{enable:[i.DEPTH_TEST,i.BLEND],depthMask:!1,functions:{blendEquationSeparate:[i.FUNC_ADD,i.FUNC_ADD],blendFuncSeparate:[i.ONE,i.ONE_MINUS_SRC_ALPHA,i.ONE,i.ONE_MINUS_SRC_ALPHA]}}:a.doubleSided?{enable:[i.DEPTH_TEST]}:{enable:[i.CULL_FACE,i.DEPTH_TEST]},m[w]={attributes:k,parameters:P,program:b,states:ee,uniforms:N},f[T]={type:i.VERTEX_SHADER,uri:"",extras:{source:E}},f[x]={type:i.FRAGMENT_SHADER,uri:"",extras:{source:S}};var te=Object.keys(k);return v[b]={attributes:te,fragmentShader:x,vertexShader:T},w}function s(e,r){var n;switch(n=t(r.value)?r.value:r,e){case"ambient":return n instanceof String||"string"==typeof n?i.SAMPLER_2D:i.FLOAT_VEC4;case"diffuse":return n instanceof String||"string"==typeof n?i.SAMPLER_2D:i.FLOAT_VEC4;case"emission":return n instanceof String||"string"==typeof n?i.SAMPLER_2D:i.FLOAT_VEC4;case"specular":return n instanceof String||"string"==typeof n?i.SAMPLER_2D:i.FLOAT_VEC4;case"shininess":return i.FLOAT;case"transparency":return i.FLOAT;case"transparent":return i.BOOL;case"doubleSided":return i.BOOL}}function l(t){var i="";i+="technique:"+t.technique+";";for(var r=t.values,n=Object.keys(r).sort(),o=n.length,a=0;o>a;++a){var l=n[a];r.hasOwnProperty(l)&&"transparent"!==l&&"doubleSided"!==l&&(i+=l+":"+s(l,r[l]),i+=";")}var u=e(t.doubleSided,!1);i+=u.toString()+";";var c=e(t.transparent,!1);i+=c.toString()+";";var h=e(t.jointCount,0);return i+=h.toString()+";"}function u(e){if(t(e)){var i=!1,r=e.extensionsUsed;if(t(r))for(var o=r.length,s=0;o>s;++s)if("KHR_materials_common"===r[s]){i=!0,r.splice(s,1);break}if(i){t(e.programs)||(e.programs={}),t(e.shaders)||(e.shaders={}),t(e.techniques)||(e.techniques={});var u=n(e),c={},h=e.materials;for(var d in h)if(h.hasOwnProperty(d)){var p=h[d];if(t(p.extensions)&&t(p.extensions.KHR_materials_common)){var m=p.extensions.KHR_materials_common,f=l(m),v=c[f];t(v)||(v=a(e,m,u),c[f]=v),p.values={};var g=m.values;for(var _ in g)if(g.hasOwnProperty(_)){var y=g[_];t(y.value)?p.values[_]=y.value:p.values[_]=y}p.technique=v,delete p.extensions.KHR_materials_common}}t(e.extensions)&&delete e.extensions.KHR_materials_common}return e}}var c=0,h=0,d=0,p=0;return u}),i("Scene/ModelMesh",["../Core/defineProperties"],function(e){"use strict";function t(e,t,i){for(var r=[],n=e.primitives,o=n.length,a=0;o>a;++a){var s=n[a];r[a]=t[s.material]}this._name=e.name,this._materials=r,this._id=i}return e(t.prototype,{name:{get:function(){return this._name}},id:{get:function(){return this._id}},materials:{get:function(){return this._materials}}}),t}),i("Scene/ModelNode",["../Core/defaultValue","../Core/defineProperties","../Core/Matrix4"],function(e,t,i){"use strict";function r(e,t,r,n,o){this._model=e,this._runtimeNode=r,this._name=t.name,this._id=n,this.useMatrix=!1,this._show=!0,this._matrix=i.clone(o)}return t(r.prototype,{name:{get:function(){return this._name}},id:{get:function(){return this._id}},show:{get:function(){return this._show},set:function(e){this._show!==e&&(this._show=e,this._model._perNodeShowDirty=!0)}},matrix:{get:function(){return this._matrix},set:function(e){this._matrix=i.clone(e,this._matrix),this.useMatrix=!0;var t=this._model;t._cesiumAnimationsDirty=!0,this._runtimeNode.dirtyNumber=t._maxDirtyNumber}}}),r.prototype.setMatrix=function(e){i.clone(e,this._matrix)},r}),i("Scene/Model",["../Core/BoundingSphere","../Core/Cartesian2","../Core/Cartesian3","../Core/Cartesian4","../Core/clone","../Core/combine","../Core/ComponentDatatype","../Core/defaultValue","../Core/defined","../Core/defineProperties","../Core/destroyObject","../Core/DeveloperError","../Core/FeatureDetection","../Core/getAbsoluteUri","../Core/getBaseUri","../Core/getMagic","../Core/getStringFromTypedArray","../Core/IndexDatatype","../Core/loadArrayBuffer","../Core/loadImage","../Core/loadImageFromTypedArray","../Core/loadText","../Core/Math","../Core/Matrix2","../Core/Matrix3","../Core/Matrix4","../Core/PrimitiveType","../Core/Quaternion","../Core/Queue","../Core/RuntimeError","../Core/throttleRequestByServer","../Renderer/Buffer","../Renderer/BufferUsage","../Renderer/DrawCommand","../Renderer/RenderState","../Renderer/Sampler","../Renderer/ShaderProgram","../Renderer/ShaderSource","../Renderer/Texture","../Renderer/TextureMinificationFilter","../Renderer/TextureWrap","../Renderer/VertexArray","../Renderer/WebGLConstants","../ThirdParty/gltfDefaults","../ThirdParty/Uri","../ThirdParty/when","./getModelAccessor","./ModelAnimationCache","./ModelAnimationCollection","./ModelMaterial","./modelMaterialsCommon","./ModelMesh","./ModelNode","./Pass","./SceneMode"],function(e,t,i,r,n,o,a,s,l,u,c,h,d,p,m,f,v,g,_,y,C,E,S,w,T,x,b,A,P,I,M,D,R,O,N,L,F,B,V,k,z,U,G,W,H,q,j,Y,X,Z,K,Q,J,$,ee){"use strict";function te(){this.buffersToCreate=new P,this.buffers={},this.pendingBufferLoads=0,this.programsToCreate=new P,this.shaders={},this.pendingShaderLoads=0,this.texturesToCreate=new P,this.pendingTextureLoads=0,this.texturesToCreateFromBufferView=new P,this.pendingBufferViewToImage=0,this.createSamplers=!0,this.createSkins=!0,this.createRuntimeAnimations=!0,this.createVertexArrays=!0,this.createRenderStates=!0,this.createUniformMaps=!0,this.createRuntimeNodes=!0,this.skinnedNodesIds=[]}function ie(e,t){e._cachedGltf=t,e._animationIds=ne(t)}function re(e){this._gltf=K(W(e.gltf)),this._bgltf=e.bgltf,this.ready=e.ready,this.modelsToLoad=[],this.count=0}function ne(e){var t=[];if(l(e)&&l(e.gltf)){var i=e.gltf.animations;for(var r in i)i.hasOwnProperty(r)&&t.push(r)}return t}function oe(t){t=s(t,s.EMPTY_OBJECT);var i=t.cacheKey;this._cacheKey=i,this._cachedGltf=void 0,this._releaseGltfJson=s(t.releaseGltfJson,!1),this._animationIds=void 0;var r;if(l(i)&&l(At[i])&&At[i].ready)r=At[i],++r.count;else{var n=t.gltf;if(l(n)){if(n instanceof ArrayBuffer&&(n=new Uint8Array(n)),n instanceof Uint8Array){var o=le(n);0!==o.binaryOffset&&(n=n.subarray(o.binaryOffset)),r=new re({gltf:o.glTF,bgltf:n,ready:!0})}else r=new re({gltf:t.gltf,ready:!0});r.count=1,l(i)&&(At[i]=r)}}ie(this,r),this._cache=t.cache,this._shaderOverride=t.shaderOverride,this._basePath=s(t.basePath,"");var a=new H(document.location.href),u=new H(this._basePath);this._baseUri=u.resolve(a),this.show=s(t.show,!0),this.modelMatrix=x.clone(s(t.modelMatrix,x.IDENTITY)),this._modelMatrix=x.clone(this.modelMatrix),this.scale=s(t.scale,1),this._scale=this.scale,this.minimumPixelSize=s(t.minimumPixelSize,0),this._minimumPixelSize=this.minimumPixelSize,this.maximumScale=t.maximumScale,this._maximumScale=this.maximumScale,this.id=t.id,this._id=t.id,this.pickPrimitive=t.pickPrimitive,this._allowPicking=s(t.allowPicking,!0),this._ready=!1,this._readyPromise=q.defer(),this.activeAnimations=new X(this),this._defaultTexture=void 0,this._incrementallyLoadTextures=s(t.incrementallyLoadTextures,!0),this._asynchronous=s(t.asynchronous,!0),this.debugShowBoundingVolume=s(t.debugShowBoundingVolume,!1),this._debugShowBoundingVolume=!1,this.debugWireframe=s(t.debugWireframe,!1),this._debugWireframe=!1,this._precreatedAttributes=t.precreatedAttributes,this._vertexShaderLoaded=t.vertexShaderLoaded,this._fragmentShaderLoaded=t.fragmentShaderLoaded,this._uniformMapLoaded=t.uniformMapLoaded,this._pickVertexShaderLoaded=t.pickVertexShaderLoaded,this._pickFragmentShaderLoaded=t.pickFragmentShaderLoaded,this._pickUniformMapLoaded=t.pickUniformMapLoaded,this._ignoreCommands=s(t.ignoreCommands,!1),this.cull=s(t.cull,!0),this._computedModelMatrix=new x,this._initialRadius=void 0,this._boundingSphere=void 0,this._scaledBoundingSphere=new e,this._state=xt.NEEDS_LOAD,this._loadResources=void 0,this._perNodeShowDirty=!1,this._cesiumAnimationsDirty=!1,this._dirty=!1,this._maxDirtyNumber=0,this._runtime={animations:void 0,rootNodes:void 0,nodes:void 0,nodesByName:void 0,skinnedNodes:void 0,meshesByName:void 0,materialsByName:void 0,materialsById:void 0},this._uniformMaps={},this._rendererResources={buffers:{},vertexArrays:{},programs:{},pickPrograms:{},textures:{},samplers:{},renderStates:{}},this._cachedRendererResources=void 0,this._loadRendererResourcesFromCache=!1,this._nodeCommands=[],this._pickIds=[],this._rtcCenter=void 0,this._rtcCenterEye=void 0,this._loadOptions=t.loadOptions}function ae(e,t,i){return e.subarray(t,t+i)}function se(e){var t=f(e);return"glTF"===t}function le(e){if(!se(e))throw new h("bgltf is not a valid Binary glTF file.");var t=new DataView(e.buffer,e.byteOffset,e.byteLength),i=0;i+=Pt,i+=Pt,i+=Pt;var r=t.getUint32(i,!0);i+=Pt+Pt;var n=i,o=n+r,a=v(e,n,r);return{glTF:JSON.parse(a),binaryOffset:o}}function ue(e,t,i){return e._runtime[t][i]}function ce(t){for(var r=t.nodes,n=t.meshes,o=t.accessors,a=t.scenes[t.scene].nodes,s=a.length,u=[],c=new i(Number.MAX_VALUE,Number.MAX_VALUE,Number.MAX_VALUE),h=new i(-Number.MAX_VALUE,-Number.MAX_VALUE,-Number.MAX_VALUE),d=0;s>d;++d){var p=r[a[d]];for(p._transformToRoot=Ce(p),u.push(p);u.length>0;){p=u.pop();var m=p._transformToRoot,f=p.meshes;if(l(f))for(var v=f.length,g=0;v>g;++g)for(var _=n[f[g]].primitives,y=_.length,C=0;y>C;++C){var E=_[C].attributes.POSITION;if(l(E)){var S=o[E],w=i.fromArray(S.min,0,It),T=i.fromArray(S.max,0,Mt);l(c)&&l(h)&&(x.multiplyByPoint(m,w,w),x.multiplyByPoint(m,T,T),i.minimumByComponent(c,w,c),i.maximumByComponent(h,T,h))}}for(var b=p.children,A=b.length,P=0;A>P;++P){var I=r[b[P]];I._transformToRoot=Ce(I),x.multiplyTransformation(m,I._transformToRoot,I._transformToRoot),u.push(I)}delete p._transformToRoot}}var M=e.fromCornerPoints(c,h);return e.transformWithoutScale(M,wt,M)}function he(e,t,i){return function(){e._state=xt.FAILED,e._readyPromise.reject(new I("Failed to load "+t+": "+i))}}function de(e,t){return function(i){var r=e._loadResources;r.buffers[t]=new Uint8Array(i),--r.pendingBufferLoads}}function pe(e){var t=e.gltf.buffers;for(var i in t)if(t.hasOwnProperty(i)){var r=t[i];if("binary_glTF"===i||"KHR_binary_glTF"===i){var n=e._loadResources;n.buffers[i]=e._cachedGltf.bgltf}else if("arraybuffer"===r.type){++e._loadResources.pendingBufferLoads;var o=new H(r.uri),a=o.resolve(e._baseUri).toString();_(a).then(de(e,i)).otherwise(he(e,"buffer",a))}}}function me(e){var t=e.gltf.bufferViews;for(var i in t)t.hasOwnProperty(i)&&t[i].target===G.ARRAY_BUFFER&&e._loadResources.buffersToCreate.enqueue(i)}function fe(e,t){return function(i){var r=e._loadResources;r.shaders[t]={source:i,bufferView:void 0},--r.pendingShaderLoads}}function ve(e){var t=e.gltf.shaders;if(!l(e._shaderParser)||!e._shaderParser(t))for(var i in t)if(t.hasOwnProperty(i)){var r=t[i];if(l(r.extras)&&l(r.extras.source))e._loadResources.shaders[i]={source:r.extras.source,bufferView:void 0};else if(l(r.extensions)&&l(r.extensions.KHR_binary_glTF)){var n=r.extensions.KHR_binary_glTF;e._loadResources.shaders[i]={source:void 0,bufferView:n.bufferView}}else{var o;if(e._shaderOverride&&(o=e._shaderOverride(r,i,e.gltf)))++e._loadResources.pendingShaderLoads,fe(e,i)(o);else{++e._loadResources.pendingShaderLoads;var a=new H(r.uri),s=a.resolve(e._baseUri).toString();E(s,e._loadOptions).then(fe(e,i)).otherwise(he(e,"shader",s))}}}}function ge(e){var t=e.gltf.programs;for(var i in t)t.hasOwnProperty(i)&&e._loadResources.programsToCreate.enqueue(i)}function _e(e,t){return function(i){var r=e._loadResources;--r.pendingTextureLoads,r.texturesToCreate.enqueue({id:t,image:i,bufferView:void 0})}}function ye(e){var t=e.gltf.images,i=e.gltf.textures;for(var r in i)if(i.hasOwnProperty(r)){var n=t[i[r].source];if(l(n.extensions)&&l(n.extensions.KHR_binary_glTF)){var o=n.extensions.KHR_binary_glTF;e._loadResources.texturesToCreateFromBufferView.enqueue({id:r,image:void 0,bufferView:o.bufferView,mimeType:o.mimeType})}else{var a=void 0,s=new H(n.uri),u=s.resolve(e._baseUri).toString();l(e._cache)&&(a=e._cache.get(u),l(a)&&(++e._loadResources.pendingTextureLoads,a.ref(),a.then(function(t,i,r){e._rendererResources.textures[t]=r,r.ref(),i.unref(),--e._loadResources.pendingTextureLoads}.bind(e,r,a),function(e){console.log("error",e)}))),l(a)||(++e._loadResources.pendingTextureLoads,l(e._cache)&&e._cache.reserve(u),y(u).then(_e(e,r)).otherwise(he(e,"image",u)))}}}function Ce(e){return l(e.matrix)?x.fromArray(e.matrix):x.fromTranslationQuaternionRotationScale(i.fromArray(e.translation,0,Dt),A.unpack(e.rotation,0,Rt),i.fromArray(e.scale,0,Ot))}function Ee(e){var t={},i={},r=[],n=e._loadResources.skinnedNodesIds,o=e.gltf.nodes;for(var a in o)if(o.hasOwnProperty(a)){var s=o[a],u={matrix:void 0,translation:void 0,rotation:void 0,scale:void 0,computedShow:!0,transformToRoot:new x,computedMatrix:new x,dirtyNumber:0,commands:[],inverseBindMatrices:void 0,bindShapeMatrix:void 0,joints:[],computedJointMatrices:[],jointName:s.jointName,children:[],parents:[],publicNode:void 0};u.publicNode=new J(e,s,u,a,Ce(s)),t[a]=u,i[s.name]=u,l(s.skin)&&(n.push(a),r.push(u))}e._runtime.nodes=t,e._runtime.nodesByName=i,e._runtime.skinnedNodes=r}function Se(e){var t={},i={},r=e.gltf.materials,n=e._uniformMaps;for(var o in r)if(r.hasOwnProperty(o)){n[o]={uniformMap:void 0,values:void 0,jointMatrixUniformName:void 0};var a=r[o],s=new Z(e,a,o);t[a.name]=s,i[o]=s}e._runtime.materialsByName=t,e._runtime.materialsById=i}function we(e){var t={},i=e._runtime.materialsById,r=e.gltf.meshes;for(var n in r)if(r.hasOwnProperty(n)){var o=r[n];t[o.name]=new Q(o,i,n)}e._runtime.meshesByName=t}function Te(e){e._loadRendererResourcesFromCache||(pe(e),me(e),ve(e),ge(e),ye(e)),Se(e),we(e),Ee(e)}function xe(e,t){var i=e._loadResources;if(0===i.pendingBufferLoads){for(var r,n=e.gltf.bufferViews,o=e._rendererResources.buffers;i.buffersToCreate.length>0;){var a=i.buffersToCreate.dequeue();r=n[a];var s=D.createVertexBuffer({context:t,typedArray:i.getBuffer(r),usage:R.STATIC_DRAW});s.vertexArrayDestroyable=!1,o[a]=s}if(!i.elementBufferCreated){var u=e.gltf.accessors;for(var c in u)if(u.hasOwnProperty(c)){var h=u[c];if(r=n[h.bufferView],r.target===G.ELEMENT_ARRAY_BUFFER&&!l(o[h.bufferView])){var d=D.createIndexBuffer({context:t,typedArray:i.getBuffer(r),usage:R.STATIC_DRAW,indexDatatype:h.componentType});d.vertexArrayDestroyable=!1,o[h.bufferView]=d}}i.elementBufferCreated=!0}}}function be(e){for(var t={},i=e.length,r=0;i>r;++r)t[e[r]]=r;return t}function Ae(e,t){if(l(t.source))return t.source;var i=e._loadResources,r=e.gltf,n=r.bufferViews[t.bufferView];return v(i.getBuffer(n))}function Pe(e,t,i){return l(i)&&(e=i(e,t)),e}function Ie(e,t,i){var r=t.gltf.programs,n=t._loadResources.shaders,o=r[e],a=be(o.attributes),s=Ae(t,n[o.vertexShader]),u=Ae(t,n[o.fragmentShader]),c=Pe(s,e,t._vertexShaderLoaded),h=Pe(u,e,t._fragmentShaderLoaded),d=o.attributes.length,p=t._precreatedAttributes;if(l(p))for(var m in p)p.hasOwnProperty(m)&&(a[m]=d++);if(t._rendererResources.programs[e]=F.fromCache({context:i,vertexShaderSource:c,fragmentShaderSource:h,attributeLocations:a}),t.allowPicking){var f=Pe(s,e,t._pickVertexShaderLoaded),v=Pe(u,e,t._pickFragmentShaderLoaded);t._pickFragmentShaderLoaded||(v=B.createPickFragmentShaderSource(u,"uniform")),t._rendererResources.pickPrograms[e]=F.fromCache({context:i,vertexShaderSource:f,fragmentShaderSource:v,attributeLocations:a})}}function Me(e,t){var i,r=e._loadResources;if(0===r.pendingShaderLoads&&0===r.pendingBufferLoads)if(e.asynchronous)r.programsToCreate.length>0&&(i=r.programsToCreate.dequeue(),Ie(i,e,t));else for(;r.programsToCreate.length>0;)i=r.programsToCreate.dequeue(),Ie(i,e,t)}function De(e,t){return function(i){e.texturesToCreate.enqueue({id:t.id,image:i,bufferView:void 0}),--e.pendingBufferViewToImage}}function Re(e){var t=e._loadResources;if(0===t.pendingBufferLoads)for(;t.texturesToCreateFromBufferView.length>0;){var i=t.texturesToCreateFromBufferView.dequeue(),r=e.gltf,n=r.bufferViews[i.bufferView],o=De(t,i),a=he(e,"image","id: "+i.id+", bufferView: "+i.bufferView);C(t.getBuffer(n),i.mimeType).then(o).otherwise(a),++t.pendingBufferViewToImage}}function Oe(e,t){var i=e._loadResources;if(i.createSamplers){i.createSamplers=!1;var r=e._rendererResources.samplers,n=e.gltf.samplers;for(var o in n)if(n.hasOwnProperty(o)){var a=n[o];r[o]=new L({wrapS:a.wrapS,wrapT:a.wrapT,minificationFilter:a.minFilter,magnificationFilter:a.magFilter})}}}function Ne(e,t,i){var r=t.gltf.textures,n=r[e.id],o=t._rendererResources.samplers,a=o[n.sampler],s=a.minificationFilter===k.NEAREST_MIPMAP_NEAREST||a.minificationFilter===k.NEAREST_MIPMAP_LINEAR||a.minificationFilter===k.LINEAR_MIPMAP_NEAREST||a.minificationFilter===k.LINEAR_MIPMAP_LINEAR,u=s||a.wrapS===z.REPEAT||a.wrapS===z.MIRRORED_REPEAT||a.wrapT===z.REPEAT||a.wrapT===z.MIRRORED_REPEAT,c=e.image,h=!S.isPowerOfTwo(c.width)||!S.isPowerOfTwo(c.height);if(u&&h){var d=document.createElement("canvas");d.width=S.nextPowerOfTwo(c.width),d.height=S.nextPowerOfTwo(c.height);var p=d.getContext("2d");p.drawImage(c,0,0,c.width,c.height,0,0,d.width,d.height),c=d}var m;n.target===G.TEXTURE_2D&&(m=new V({context:i,source:c,pixelFormat:n.internalFormat,pixelDatatype:n.type,sampler:a,flipY:!1})),s&&m.generateMipmap(),t._rendererResources.textures[e.id]=m,l(t._cache)&&t._cache.resolve(e.image.src,m)}function Le(e,t){var i,r=e._loadResources;if(e.asynchronous)r.texturesToCreate.length>0&&(i=r.texturesToCreate.dequeue(),Ne(i,e,t));else for(;r.texturesToCreate.length>0;)i=r.texturesToCreate.dequeue(),Ne(i,e,t)}function Fe(e,t){var i=e.gltf,r=i.techniques,n=i.materials,o={},a=r[n[t.material].technique],s=a.parameters,u=a.attributes,c=e._rendererResources.programs[a.program].vertexAttributes;for(var h in c)if(c.hasOwnProperty(h)){var d=u[h],p=c[h].index;if(l(d)){var m=s[d];o[m.semantic]=p}else o[h]=p}return o}function Be(e,t,i){for(var r=e.length,n=0;r>n;++n)for(var o=[e[n]];o.length>0;){var a=o.pop(),s=i[a];if(s.jointName===t)return a;for(var l=s.children,u=l.length,c=0;u>c;++c)o.push(l[c])}}function Ve(e,t){for(var i=e.gltf,r=i.skins,n=i.nodes,o=e._runtime.nodes,a=e._loadResources.skinnedNodesIds,s=a.length,l=0;s>l;++l){var u=a[l],c=o[u],h=n[u],d=t[h.skin];c.inverseBindMatrices=d.inverseBindMatrices,c.bindShapeMatrix=d.bindShapeMatrix;for(var p=[],m=h.skeletons,f=m.length,v=0;f>v;++v)p.push(m[v]);for(var g=r[h.skin].jointNames,_=g.length,y=0;_>y;++y){var C=g[y],E=o[Be(p,C,n)];c.joints.push(E)}}}function ke(e){var t=e._loadResources;if(0===t.pendingBufferLoads&&t.createSkins){t.createSkins=!1;var i=e.gltf,r=i.accessors,n=i.skins,o={};for(var a in n)if(n.hasOwnProperty(a)){var s,l=n[a],u=r[l.inverseBindMatrices];x.equals(l.bindShapeMatrix,x.IDENTITY)||(s=x.clone(l.bindShapeMatrix)),o[a]={inverseBindMatrices:Y.getSkinInverseBindMatrices(e,u),bindShapeMatrix:s}}Ve(e,o)}}function ze(e,t,i,r){return function(n){t[i]=r.evaluate(n,t[i]),t.dirtyNumber=e._maxDirtyNumber}}function Ue(e){var t=e._loadResources;if(t.finishedPendingBufferLoads()&&t.createRuntimeAnimations){t.createRuntimeAnimations=!1,e._runtime.animations={};var i=e._runtime.nodes,r=e.gltf.animations,n=e.gltf.accessors;for(var o in r)if(r.hasOwnProperty(o)){var a=r[o],s=a.channels,l=a.parameters,u=a.samplers,c={};for(var h in l)l.hasOwnProperty(h)&&(c[h]=Y.getAnimationParameterValues(e,n[l[h]]));for(var d=Number.MAX_VALUE,p=-Number.MAX_VALUE,m=s.length,f=new Array(m),v=0;m>v;++v){var g=s[v],_=g.target,y=u[g.sampler],C=c[y.input];d=Math.min(d,C[0]),p=Math.max(p,C[C.length-1]);var E=Y.getAnimationSpline(e,o,a,g.sampler,y,c);f[v]=ze(e,i[_.id],_.path,E)}e._runtime.animations[o]={startTime:d,stopTime:p,channelEvaluators:f}}}}function Ge(e,t){var i=e._loadResources;if(i.finishedBuffersCreation()&&i.finishedProgramCreation()&&i.createVertexArrays){i.createVertexArrays=!1;var r=e._rendererResources.buffers,n=e._rendererResources.vertexArrays,o=e.gltf,a=o.accessors,s=o.meshes;for(var u in s)if(s.hasOwnProperty(u))for(var c=s[u].primitives,h=c.length,d=0;h>d;++d){var p,m,f,v=c[d],g=Fe(e,v),_=[],y=v.attributes;for(p in y)if(y.hasOwnProperty(p)&&(m=g[p],l(m))){var C=a[y[p]];_.push({index:m,vertexBuffer:r[C.bufferView],componentsPerAttribute:j(C).componentsPerAttribute,componentDatatype:C.componentType,normalize:!1,offsetInBytes:C.byteOffset,strideInBytes:C.byteStride})}var E=e._precreatedAttributes;if(l(E))for(p in E)E.hasOwnProperty(p)&&(m=g[p],l(m)&&(f=E[p],f.index=m,_.push(f)));var S;if(l(v.indices)){var w=a[v.indices];S=r[w.bufferView]}n[u+".primitive."+d]=new U({context:t,attributes:_,indexBuffer:S})}}}function We(e){var t={};t[G.BLEND]=!1,t[G.CULL_FACE]=!1,t[G.DEPTH_TEST]=!1,t[G.POLYGON_OFFSET_FILL]=!1,t[G.SCISSOR_TEST]=!1;var i,r=e.enable,n=r.length;for(i=0;n>i;++i)t[r[i]]=!0;return t}function He(e,t){var i=e._loadResources;if(i.createRenderStates){i.createRenderStates=!1;var r=e._rendererResources.renderStates,n=e.gltf.techniques;for(var o in n)if(n.hasOwnProperty(o)){var a=n[o],u=a.states,c=We(u),h=s(u.functions,s.EMPTY_OBJECT),d=s(h.blendColor,[0,0,0,0]),p=s(h.blendEquationSeparate,[G.FUNC_ADD,G.FUNC_ADD]),m=s(h.blendFuncSeparate,[G.ONE,G.ONE,G.ZERO,G.ZERO]),f=s(h.colorMask,[!0,!0,!0,!0]),v=s(h.depthRange,[0,1]),g=s(h.polygonOffset,[0,0]),_=s(h.scissor,[0,0,0,0]);r[o]=N.fromCache({frontFace:l(h.frontFace)?h.frontFace[0]:G.CCW,cull:{enabled:c[G.CULL_FACE],face:l(h.cullFace)?h.cullFace[0]:G.BACK},lineWidth:l(h.lineWidth)?h.lineWidth[0]:1,polygonOffset:{enabled:c[G.POLYGON_OFFSET_FILL],factor:g[0],units:g[1]},scissorTest:{enabled:c[G.SCISSOR_TEST],rectangle:{x:_[0],y:_[1],width:_[2],height:_[3]}},depthRange:{near:v[0],far:v[1]},depthTest:{enabled:c[G.DEPTH_TEST],func:l(h.depthFunc)?h.depthFunc[0]:G.LESS},colorMask:{red:f[0],green:f[1],blue:f[2],alpha:f[3]},depthMask:l(h.depthMask)?h.depthMask[0]:!0,blending:{enabled:c[G.BLEND],color:{red:d[0],green:d[1],blue:d[2],alpha:d[3]},equationRgb:p[0],equationAlpha:p[1],functionSourceRgb:m[0],functionSourceAlpha:m[1],functionDestinationRgb:m[2],functionDestinationAlpha:m[3]}})}}}function qe(e,t){var i={value:e,clone:function(e,t){return e},func:function(){return i.value}};return i}function je(e,i){var r={value:t.fromArray(e),clone:t.clone,func:function(){return r.value}};return r}function Ye(e,t){var r={value:i.fromArray(e),clone:i.clone,func:function(){return r.value}};return r}function Xe(e,t){var i={value:r.fromArray(e),clone:r.clone,func:function(){return i.value}};return i}function Ze(e,t){var i={value:w.fromColumnMajorArray(e),clone:w.clone,func:function(){return i.value}};return i}function Ke(e,t){var i={value:T.fromColumnMajorArray(e),clone:T.clone,func:function(){return i.value}};return i}function Qe(e,t){var i={value:x.fromColumnMajorArray(e),clone:x.clone,func:function(){return i.value}};return i}function Je(e,t){this._value=void 0,this._textureId=e,this._model=t}function $e(e,t){var i=new Je(e,t);return i.func=function(){return i.value},i}function et(e,t,i,r){var n=t._runtime.nodes[e];return Bt[i](r,t,n)}function tt(e,t){var i=e._loadResources;if(i.finishedProgramCreation()&&i.createUniformMaps){i.createUniformMaps=!1;var r=e.gltf,n=r.materials,o=r.techniques,a=e._uniformMaps;for(var s in n)if(n.hasOwnProperty(s)){var u,c=n[s],h=c.values,d=o[c.technique],p=d.parameters,m=d.uniforms,f={},v={};for(var g in m)if(m.hasOwnProperty(g)){var _=m[g],y=p[_];if(l(h[_])){var C=Ft[y.type](h[_],e);f[g]=C.func,v[_]=C}else if(l(y.node))f[g]=et(y.node,e,y.semantic,t.uniformState);else if(l(y.semantic))"JOINTMATRIX"!==y.semantic?f[g]=Lt[y.semantic](t.uniformState,e):u=g;else if(l(y.value)){var E=Ft[y.type](y.value,e);f[g]=E.func,v[_]=E}}var S=a[s];S.uniformMap=f,S.values=v,S.jointMatrixUniformName=u}}}function it(e){return function(){return e}}function rt(e){return function(){return e.computedJointMatrices}}function nt(t,r,n,u){for(var c=t._nodeCommands,h=t._pickIds,d=t.allowPicking,p=t._runtime.meshesByName,m=t._rendererResources,f=m.vertexArrays,v=m.programs,_=m.pickPrograms,y=m.renderStates,C=t._uniformMaps,E=t.gltf,S=E.accessors,w=E.meshes,T=E.techniques,b=E.materials,A=r.meshes,P=A.length,I=0;P>I;++I)for(var M=A[I],D=w[M],R=D.primitives,N=R.length,L=0;N>L;++L){var F,B=R[L],V=S[B.indices],k=b[B.material],z=T[k.technique],U=z.program,G=B.attributes.POSITION;if(l(G)){var W=S[G];F=e.fromCornerPoints(i.fromArray(W.min),i.fromArray(W.max))}var H,q,Y=f[M+".primitive."+L];if(l(V))q=V.count,H=V.byteOffset/g.getSizeInBytes(V.componentType);else{var X=S[B.attributes.POSITION];q=X.count;var Z=j(X);H=X.byteOffset/(Z.componentsPerAttribute*a.getSizeInBytes(X.componentType))}var K=C[B.material],Q=K.uniformMap;if(l(K.jointMatrixUniformName)){var J={};J[K.jointMatrixUniformName]=rt(n),Q=o(Q,J)}l(t._uniformMapLoaded)&&(Q=t._uniformMapLoaded(Q,U,n));var ee,te=y[k.technique],ie=te.blending.enabled,re={primitive:s(t.pickPrimitive,t),id:t.id,node:n.publicNode,mesh:p[D.name]},ne=new O({boundingVolume:new e,cull:t.cull,modelMatrix:new x,primitiveType:B.mode,vertexArray:Y,count:q,offset:H,shaderProgram:v[z.program],uniformMap:Q,renderState:te,owner:re,pass:ie?$.TRANSLUCENT:$.OPAQUE});if(d){var oe;if(l(t._pickFragmentShaderLoaded))oe=l(t._pickUniformMapLoaded)?t._pickUniformMapLoaded(Q):o(Q);else{var ae=u.createPickId(re);h.push(ae);var se={czm_pickColor:it(ae.color)};oe=o(Q,se)}ee=new O({boundingVolume:new e,cull:t.cull,modelMatrix:new x,primitiveType:B.mode,vertexArray:Y,count:q,offset:H,shaderProgram:_[z.program],uniformMap:oe,renderState:te,owner:re,pass:ie?$.TRANSLUCENT:$.OPAQUE})}var le={show:!0,boundingSphere:F,command:ne,pickCommand:ee};n.commands.push(le),c.push(le)}}function ot(e,t){var r=e._loadResources;if(r.finishedEverythingButTextureCreation()&&r.createRuntimeNodes){r.createRuntimeNodes=!1;for(var n=[],o=e._runtime.nodes,a=e.gltf,s=a.nodes,u=a.scenes[a.scene],c=u.nodes,h=c.length,d=[],p=0;h>p;++p)for(d.push({parentRuntimeNode:void 0,gltfNode:s[c[p]],id:c[p]});d.length>0;){var m=d.pop(),f=m.parentRuntimeNode,v=m.gltfNode,g=o[m.id];if(0===g.parents.length)if(l(v.matrix))g.matrix=x.fromColumnMajorArray(v.matrix);else{var _=v.rotation;g.translation=i.fromArray(v.translation),g.rotation=A.unpack(_),g.scale=i.fromArray(v.scale)}l(f)?(f.children.push(g),g.parents.push(f)):n.push(g),l(v.meshes)&&nt(e,v,g,t);for(var y=v.children,C=y.length,E=0;C>E;++E)d.push({parentRuntimeNode:g,gltfNode:s[y[E]],id:y[E]})}e._runtime.rootNodes=n,e._runtime.nodes=o}}function at(e,t){var i=t.context;if(e._loadRendererResourcesFromCache){var r=e._rendererResources,n=e._cachedRendererResources;n.assign(r),l(e._precreatedAttributes)&&Ge(e,i)}else xe(e,i),Me(e,i),Oe(e,i),Re(e),Le(e,i);ke(e),Ue(e),e._loadRendererResourcesFromCache||(Ge(e,i),He(e,i)),tt(e,i),ot(e,i)}function st(e,t){var i=e.publicNode,r=i.matrix;i.useMatrix&&l(r)?x.clone(r,t):l(e.matrix)?x.clone(e.matrix,t):(x.fromTranslationQuaternionRotationScale(e.translation,e.rotation,e.scale,t), -i.setMatrix(t))}function lt(t,r,n){for(var o=t._maxDirtyNumber,a=t.allowPicking,s=t._runtime.rootNodes,u=s.length,c=Vt,h=t._computedModelMatrix,d=0;u>d;++d){var p=s[d];for(st(p,p.transformToRoot),c.push(p);c.length>0;){p=c.pop();var m=p.transformToRoot,f=p.commands;if(p.dirtyNumber===o||r||n){var v=x.multiplyTransformation(h,m,p.computedMatrix),g=f.length;if(g>0)for(var _=0;g>_;++_){var y=f[_],C=y.command;if(x.clone(v,C.modelMatrix),e.transform(y.boundingSphere,C.modelMatrix,C.boundingVolume),l(t._rtcCenter)&&i.add(t._rtcCenter,C.boundingVolume.center,C.boundingVolume.center),a){var E=y.pickCommand;x.clone(C.modelMatrix,E.modelMatrix),e.clone(C.boundingVolume,E.boundingVolume)}}}for(var S=p.children,w=S.length,T=0;w>T;++T){var b=S[T];b.dirtyNumber=Math.max(b.dirtyNumber,p.dirtyNumber),(b.dirtyNumber===o||n)&&(st(b,b.transformToRoot),x.multiplyTransformation(m,b.transformToRoot,b.transformToRoot)),c.push(b)}}}++t._maxDirtyNumber}function ut(e){for(var t=e._runtime.skinnedNodes,i=t.length,r=0;i>r;++r){var n=t[r];kt=x.inverseTransformation(n.transformToRoot,kt);for(var o=n.computedJointMatrices,a=n.joints,s=n.bindShapeMatrix,u=n.inverseBindMatrices,c=u.length,h=0;c>h;++h)l(o[h])||(o[h]=new x),o[h]=x.multiplyTransformation(kt,a[h].transformToRoot,o[h]),o[h]=x.multiplyTransformation(o[h],u[h],o[h]),l(s)&&(o[h]=x.multiplyTransformation(o[h],s,o[h]))}}function ct(e){for(var t=e._runtime.rootNodes,i=t.length,r=Vt,n=0;i>n;++n){var o=t[n];for(o.computedShow=o.publicNode.show,r.push(o);r.length>0;){o=r.pop();for(var a=o.computedShow,s=o.commands,l=s.length,u=0;l>u;++u)s[u].show=a;for(var c=o.children,h=c.length,d=0;h>d;++d){var p=c[d];p.computedShow=a&&p.publicNode.show,r.push(p)}}}}function ht(e,t){var i=e.id;if(e._id!==i){e._id=i;for(var r=e._pickIds,n=r.length,o=0;n>o;++o)r[o].object.id=i}}function dt(e){if(e._debugWireframe!==e.debugWireframe){e._debugWireframe=e.debugWireframe;for(var t=e.debugWireframe?b.LINES:b.TRIANGLES,i=e._nodeCommands,r=i.length,n=0;r>n;++n)i[n].command.primitiveType=t}}function pt(e){if(e.debugShowBoundingVolume!==e._debugShowBoundingVolume){e._debugShowBoundingVolume=e.debugShowBoundingVolume;for(var t=e.debugShowBoundingVolume,i=e._nodeCommands,r=i.length,n=0;r>n;n++)i[n].command.debugShowBoundingVolume=t}}function mt(e,t,i){return zt.center=e,zt.radius=t,i.camera.getPixelSize(zt,i.context.drawingBufferWidth,i.context.drawingBufferHeight)}function ft(e,t){var r=e.scale;if(0!==e.minimumPixelSize){var n=t.context,o=Math.max(n.drawingBufferWidth,n.drawingBufferHeight),a=e.modelMatrix;Ut.x=a[12],Ut.y=a[13],Ut.z=a[14],l(e._rtcCenter)&&i.add(e._rtcCenter,Ut,Ut);var s=e.boundingSphere.radius,u=mt(Ut,s,t),c=1/u,h=Math.min(c*(2*s),o);hr;++r){var n=t[r];if("CESIUM_RTC"!==n&&"KHR_binary_glTF"!==n&&"KHR_materials_common"!==n)throw new I("Unsupported glTF Extension: "+n)}}function _t(e,t){this.buffers=void 0,this.vertexArrays=void 0,this.programs=void 0,this.pickPrograms=void 0,this.textures=void 0,this.samplers=void 0,this.renderStates=void 0,this.ready=!1,this.context=e,this.cacheKey=t,this.count=0}function yt(e){for(var t in e)e.hasOwnProperty(t)&&(l(e[t].unref)?e[t].unref():e[t].destroy())}function Ct(e){yt(e.buffers),yt(e.vertexArrays),yt(e.programs),yt(e.pickPrograms),yt(e.textures)}function Et(e){for(var t in e)e.hasOwnProperty(t)&&e[t].ref&&e[t].ref()}function St(e){for(var t in e)e.hasOwnProperty(t)&&e[t].unref&&e[t].unref()}if(!d.supportsTypedArrays())return{};var wt=x.fromRotationTranslation(T.fromRotationX(S.PI_OVER_TWO)),Tt=new i,xt={NEEDS_LOAD:0,LOADING:1,LOADED:2,FAILED:3},bt="model/vnd.gltf.binary,model/vnd.gltf+json,model/gltf.binary,model/gltf+json;q=0.8,application/json;q=0.2,*/*;q=0.01";te.prototype.getBuffer=function(e){return ae(this.buffers[e.buffer],e.byteOffset,e.byteLength)},te.prototype.finishedPendingBufferLoads=function(){return 0===this.pendingBufferLoads},te.prototype.finishedBuffersCreation=function(){return 0===this.pendingBufferLoads&&0===this.buffersToCreate.length},te.prototype.finishedProgramCreation=function(){return 0===this.pendingShaderLoads&&0===this.programsToCreate.length},te.prototype.finishedTextureCreation=function(){var e=0===this.pendingTextureLoads,t=0===this.texturesToCreate.length&&0===this.texturesToCreateFromBufferView.length;return e&&t},te.prototype.finishedEverythingButTextureCreation=function(){var e=0===this.pendingBufferLoads&&0===this.pendingShaderLoads,t=0===this.buffersToCreate.length&&0===this.programsToCreate.length&&0===this.pendingBufferViewToImage;return e&&t},te.prototype.finished=function(){return this.finishedTextureCreation()&&this.finishedEverythingButTextureCreation()},u(re.prototype,{gltf:{set:function(e){this._gltf=K(W(e))},get:function(){return this._gltf}},bgltf:{get:function(){return this._bgltf}}}),re.prototype.makeReady=function(e,t){this.gltf=e,this._bgltf=t;for(var i=this.modelsToLoad,r=i.length,n=0;r>n;++n){var o=i[n];o.isDestroyed()||ie(o,this)}this.modelsToLoad=void 0,this.ready=!0};var At={};u(oe.prototype,{gltf:{get:function(){return l(this._cachedGltf)?this._cachedGltf.gltf:void 0}},releaseGltfJson:{get:function(){return this._releaseGltfJson}},cacheKey:{get:function(){return this._cacheKey}},basePath:{get:function(){return this._basePath}},boundingSphere:{get:function(){var e=x.getScale(this.modelMatrix,Tt),t=l(this.maximumScale)?Math.min(this.maximumScale,this.scale):this.scale;i.multiplyByScalar(e,t,e);var r=this._scaledBoundingSphere;return r.center=i.multiplyComponents(this._boundingSphere.center,e,r.center),r.radius=i.maximumComponent(e)*this._initialRadius,l(this._rtcCenter)&&i.add(this._rtcCenter,r.center,r.center),r}},ready:{get:function(){return this._ready}},readyPromise:{get:function(){return this._readyPromise.promise}},asynchronous:{get:function(){return this._asynchronous}},allowPicking:{get:function(){return this._allowPicking}},incrementallyLoadTextures:{get:function(){return this._incrementallyLoadTextures}},pendingTextureLoads:{get:function(){return l(this._loadResources)?this._loadResources.pendingTextureLoads:0}},dirty:{get:function(){return this._dirty}}});var Pt=Uint32Array.BYTES_PER_ELEMENT;oe.fromGltf=function(e){var t=e.url,i=new oe(e);return i.loadGltf(t,e),i},oe.prototype.loadGltf=function(e){var t=e.url,i=s(e.cacheKey,p(t));e=n(e),e.basePath=m(t),e.cacheKey=i,this._basePath=e.basePath,this._cacheKey=e.cacheKey;var r=new H(document.location.href),o=new H(this._basePath);this._baseUri=o.resolve(r),e.headers=l(e.headers)?n(e.headers):{},l(e.headers.Accept)||(e.headers.Accept=bt);var a=At[i];return l(a)?a.ready||(++a.count,a.modelsToLoad.push(this)):(a=new re({ready:!1}),a.count=1,a.modelsToLoad.push(this),ie(this,a),At[i]=a,_(t,e.headers).then(function(t){var i=new Uint8Array(t);if(se(i)){var r=le(i);0!==r.binaryOffset&&(i=i.subarray(r.binaryOffset)),a.makeReady(r.glTF,i)}else{var n=v(i),o=JSON.parse(n);e.gltfModifier&&(o=e.gltfModifier(o)),a.makeReady(o)}}).otherwise(he(this,"model",t))),this._readyPromise},oe._gltfCache=At,oe.prototype.getNode=function(e){var t=ue(this,"nodesByName",e);return l(t)?t.publicNode:void 0},oe.prototype.getMesh=function(e){return ue(this,"meshesByName",e)},oe.prototype.getMaterial=function(e){return ue(this,"materialsByName",e)};var It=new i,Mt=new i,Dt=new i,Rt=new A,Ot=new i,Nt=new i,Lt={MODEL:function(e,t){return function(){return e.model}},VIEW:function(e,t){return function(){return e.view}},PROJECTION:function(e,t){return function(){return e.projection}},MODELVIEW:function(e,t){return function(){return e.modelView}},CESIUM_RTC_MODELVIEW:function(e,t){var r=new x;return function(){return x.getTranslation(e.model,Nt),i.add(Nt,t._rtcCenter,Nt),x.multiplyByPoint(e.view,Nt,Nt),x.setTranslation(e.modelView,Nt,r)}},MODELVIEWPROJECTION:function(e,t){return function(){return e.modelViewProjection}},MODELINVERSE:function(e,t){return function(){return e.inverseModel}},VIEWINVERSE:function(e,t){return function(){return e.inverseView}},PROJECTIONINVERSE:function(e,t){return function(){return e.inverseProjection}},MODELVIEWINVERSE:function(e,t){return function(){return e.inverseModelView}},MODELVIEWPROJECTIONINVERSE:function(e,t){return function(){return e.inverseModelViewProjection}},MODELINVERSETRANSPOSE:function(e,t){return function(){return e.inverseTranposeModel}},MODELVIEWINVERSETRANSPOSE:function(e,t){return function(){return e.normal}},VIEWPORT:function(e,t){return function(){return e.viewportCartesian4}}};u(Je.prototype,{value:{get:function(){if(!l(this._value)){var e=this._model._rendererResources.textures[this._textureId];if(!l(e))return this._model._defaultTexture;this._value=e}return this._value},set:function(e){this._value=e}}}),Je.prototype.clone=function(e,t){return e},Je.prototype.func=void 0;var Ft={};Ft[G.FLOAT]=qe,Ft[G.FLOAT_VEC2]=je,Ft[G.FLOAT_VEC3]=Ye,Ft[G.FLOAT_VEC4]=Xe,Ft[G.INT]=qe,Ft[G.INT_VEC2]=je,Ft[G.INT_VEC3]=Ye,Ft[G.INT_VEC4]=Xe,Ft[G.BOOL]=qe,Ft[G.BOOL_VEC2]=je,Ft[G.BOOL_VEC3]=Ye,Ft[G.BOOL_VEC4]=Xe,Ft[G.FLOAT_MAT2]=Ze,Ft[G.FLOAT_MAT3]=Ke,Ft[G.FLOAT_MAT4]=Qe,Ft[G.SAMPLER_2D]=$e;var Bt={MODEL:function(e,t,i){return function(){return i.computedMatrix}},VIEW:function(e,t,i){return function(){return e.view}},PROJECTION:function(e,t,i){return function(){return e.projection}},MODELVIEW:function(e,t,i){var r=new x;return function(){return x.multiplyTransformation(e.view,i.computedMatrix,r)}},CESIUM_RTC_MODELVIEW:function(e,t,i){var r=new x;return function(){return x.multiplyTransformation(e.view,i.computedMatrix,r),x.setTranslation(r,t._rtcCenterEye,r)}},MODELVIEWPROJECTION:function(e,t,i){var r=new x;return function(){return x.multiplyTransformation(e.view,i.computedMatrix,r),x.multiply(e._projection,r,r)}},MODELINVERSE:function(e,t,i){var r=new x;return function(){return x.inverse(i.computedMatrix,r)}},VIEWINVERSE:function(e,t){return function(){return e.inverseView}},PROJECTIONINVERSE:function(e,t,i){return function(){return e.inverseProjection}},MODELVIEWINVERSE:function(e,t,i){var r=new x,n=new x;return function(){return x.multiplyTransformation(e.view,i.computedMatrix,r),x.inverse(r,n)}},MODELVIEWPROJECTIONINVERSE:function(e,t,i){var r=new x,n=new x;return function(){return x.multiplyTransformation(e.view,i.computedMatrix,r),x.multiply(e._projection,r,r),x.inverse(r,n)}},MODELINVERSETRANSPOSE:function(e,t,i){var r=new x,n=new T;return function(){return x.inverse(i.computedMatrix,r),x.getRotation(r,n),T.transpose(n,n)}},MODELVIEWINVERSETRANSPOSE:function(e,t,i){var r=new x,n=new x,o=new T;return function(){return x.multiplyTransformation(e.view,i.computedMatrix,r),x.inverse(r,n),x.getRotation(n,o),T.transpose(o,o)}},VIEWPORT:function(e,t,i){return function(){return e.viewportCartesian4}}},Vt=[],kt=new x,zt=new e,Ut=new i;return _t.prototype.release=function(){return 0===--this.count?(l(this.cacheKey)&&delete this.context.cache.modelRendererResourceCache[this.cacheKey],Ct(this),c(this)):void 0},_t.prototype.init=function(e){this.buffers=e.buffers,Et(this.buffers),this.vertexArrays=e.vertexArrays,Et(this.vertexArrays),this.programs=e.programs,Et(this.programs),this.pickPrograms=e.pickPrograms,Et(this.pickPrograms),this.textures=e.textures,Et(this.textures),this.samplers=e.samplers,Et(this.samplers),this.renderStates=e.renderStates,Et(this.renderStates)},_t.prototype.assign=function(e){e.buffers=this.buffers,refRessource(this.buffers),e.vertexArrays=this.vertexArrays,refRessource(this.vertexArrays),e.programs=this.programs,refRessource(this.programs),e.pickPrograms=this.pickPrograms,refRessource(this.pickPrograms),e.textures=this.textures,refRessource(this.textures),e.samplers=this.samplers,refRessource(this.samplers),e.renderStates=this.renderStates,refRessource(this.renderStates)},oe.prototype.update=function(e){if(e.mode===ee.SCENE3D){var t=e.context;if(this._defaultTexture=t.defaultTexture,this._state===xt.NEEDS_LOAD&&l(this.gltf)){var r,n=this.cacheKey;if(l(n)){t.cache.modelRendererResourceCache=s(t.cache.modelRendererResourceCache,{});var o=t.cache.modelRendererResourceCache;if(r=o[this.cacheKey],l(r)){if(!r.ready)return;++r.count,this._loadRendererResourcesFromCache=!0}else r=new _t(t,n),r.count=1,o[this.cacheKey]=r;this._cachedRendererResources=r}else r=new _t(t),r.count=1,this._cachedRendererResources=r;if(this._state=xt.LOADING,this._boundingSphere=ce(this.gltf),this._initialRadius=this._boundingSphere.radius,gt(this),this._state!==xt.FAILED){var a=this.gltf.extensions;l(a)&&l(a.CESIUM_RTC)&&(this._rtcCenter=i.fromArray(a.CESIUM_RTC.center),this._rtcCenterEye=new i),this._loadResources=new te,Te(this)}}var u=this._loadResources,c=this._incrementallyLoadTextures,h=!1;if(this._state===xt.LOADING&&(at(this,e),(u.finished()||c&&u.finishedEverythingButTextureCreation())&&(this._state=xt.LOADED,h=!0)),l(u)&&this._state===xt.LOADED&&(c&&!h&&at(this,e),u.finished())){this._loadResources=void 0;var d=this._rendererResources,p=this._cachedRendererResources;p.init(d),p.ready=!0,l(this._precreatedAttributes)&&(p.vertexArrays={}),this.releaseGltfJson&&vt(this)}var m=this.show&&0!==this.scale;if(m&&this._state===xt.LOADED||h){var f=this.activeAnimations.update(e)||this._cesiumAnimationsDirty;this._cesiumAnimationsDirty=!1,this._dirty=!1;var v=!x.equals(this._modelMatrix,this.modelMatrix)||this._scale!==this.scale||this._minimumPixelSize!==this.minimumPixelSize||0!==this.minimumPixelSize||this._maximumScale!==this.maximumScale;if(v||h){x.clone(this.modelMatrix,this._modelMatrix),this._scale=this.scale,this._minimumPixelSize=this.minimumPixelSize,this._maximumScale=this.maximumScale;var g=ft(this,e),_=this._computedModelMatrix;x.multiplyByUniformScale(this.modelMatrix,g,_),x.multiplyTransformation(_,wt,_)}(f||v||h)&&(lt(this,v,h),this._dirty=!0,(f||h)&&ut(this)),this._perNodeShowDirty&&(this._perNodeShowDirty=!1,ct(this)),ht(this,t),dt(this),pt(this)}if(h){var y=this;return void e.afterRender.push(function(){y._ready=!0,y._readyPromise.resolve(y)})}if(m&&!this._ignoreCommands){var C,E,S=e.commandList,w=e.passes,T=this._nodeCommands,b=T.length;if(w.render)for(C=0;b>C;++C)E=T[C],E.show&&S.push(E.command);if(w.pick&&this.allowPicking)for(C=0;b>C;++C)E=T[C],E.show&&S.push(E.pickCommand)}}},oe.prototype.isDestroyed=function(){return!1},oe.prototype.destroy=function(){l(this._precreatedAttributes)&&yt(this._rendererResources.vertexArrays);var e=this._rendererResources;St(e.buffers),St(e.vertexArrays),St(e.programs),St(e.pickPrograms),St(e.textures),St(e.samplers),St(e.renderStates),this._rendererResources=void 0,this._cachedRendererResources=this._cachedRendererResources&&this._cachedRendererResources.release();for(var t=this._pickIds,i=t.length,r=0;i>r;++r)t[r].destroy();return vt(this),c(this)},oe}),i("DataSources/ModelVisualizer",["../Core/AssociativeArray","../Core/BoundingSphere","../Core/defined","../Core/destroyObject","../Core/DeveloperError","../Core/Matrix4","../Scene/Model","../Scene/ModelAnimationLoop","./BoundingSphereState","./Property"],function(e,t,i,r,n,o,a,s,l,u){"use strict";function c(t,i){i.collectionChanged.addEventListener(c.prototype._onCollectionChanged,this),this._scene=t,this._primitives=t.primitives,this._entityCollection=i,this._modelHash={},this._entitiesToVisualize=new e,this._onCollectionChanged(i,i.values,[],[])}function h(e,t,r,n){var o=r[t.id];i(o)&&(n.removeAndDestroy(o.modelPrimitive),delete r[t.id])}function d(e,t){var r=t[e.id];i(r)&&(r.nodeTransformationsScratch={})}function p(e){console.error(e)}var m=1,f=0,v=!0,g=new o,_=new o;return c.prototype.update=function(e){for(var t=this._entitiesToVisualize.values,r=this._modelHash,n=this._primitives,l=0,c=t.length;c>l;l++){var h,d,y=t[l],C=y._model,E=r[y.id],S=y.isShowing&&y.isAvailable(e)&&u.getValueOrDefault(C._show,e,!0);if(S&&(d=y._getModelMatrix(e,g),h=u.getValueOrUndefined(C._uri,e),S=i(d)&&i(h)),S){var w=i(E)?E.modelPrimitive:void 0;if(i(w)&&h===E.uri||(i(w)&&(n.removeAndDestroy(w),delete r[y.id]),w=a.fromGltf({url:h,incrementallyLoadTextures:u.getValueOrDefault(C._incrementallyLoadTextures,e,v)}),w.readyPromise.otherwise(p),w.id=y,n.add(w),E={modelPrimitive:w,uri:h,animationsRunning:!1,nodeTransformationsScratch:{},originalNodeMatrixHash:{}},r[y.id]=E),w.show=!0,w.scale=u.getValueOrDefault(C._scale,e,m),w.minimumPixelSize=u.getValueOrDefault(C._minimumPixelSize,e,f),w.maximumScale=u.getValueOrUndefined(C._maximumScale,e),w.modelMatrix=o.clone(d,w.modelMatrix),w.ready){var T=u.getValueOrDefault(C._runAnimations,e,!0);E.animationsRunning!==T&&(T?w.activeAnimations.addAll({loop:s.REPEAT}):w.activeAnimations.removeAll(),E.animationsRunning=T);var x=u.getValueOrUndefined(C._nodeTransformations,e,E.nodeTransformationsScratch);if(i(x))for(var b=E.originalNodeMatrixHash,A=Object.keys(x),P=0,I=A.length;I>P;++P){var M=A[P],D=x[M];if(i(D)){var R=w.getNode(M);if(i(R)){var O=b[M];i(O)||(O=R.matrix.clone(),b[M]=O);var N=o.fromTranslationRotationScale(D,_);R.matrix=o.multiply(O,N,N)}}}}}else i(E)&&(E.modelPrimitive.show=!1)}return!0},c.prototype.isDestroyed=function(){return!1},c.prototype.destroy=function(){this._entityCollection.collectionChanged.removeEventListener(c.prototype._onCollectionChanged,this);for(var e=this._entitiesToVisualize.values,t=this._modelHash,i=this._primitives,n=e.length-1;n>-1;n--)h(this,e[n],t,i);return r(this)},c.prototype.getBoundingSphere=function(e,r){var n=this._modelHash[e.id];if(!i(n))return l.FAILED;var o=n.modelPrimitive;return i(o)&&o.show?o.ready?(t.transform(o.boundingSphere,o.modelMatrix,r),l.DONE):l.PENDING:l.FAILED},c.prototype._onCollectionChanged=function(e,t,r,n){var o,a,s=this._entitiesToVisualize,l=this._modelHash,u=this._primitives;for(o=t.length-1;o>-1;o--)a=t[o],i(a._model)&&i(a._position)&&s.set(a.id,a);for(o=n.length-1;o>-1;o--)a=n[o],i(a._model)&&i(a._position)?(d(a,l),s.set(a.id,a)):(h(this,a,l,u),s.remove(a.id));for(o=r.length-1;o>-1;o--)a=r[o],h(this,a,l,u),s.remove(a.id)},c}),i("Shaders/PolylineCommon",[],function(){"use strict";return"void clipLineSegmentToNearPlane(\nvec3 p0,\nvec3 p1,\nout vec4 positionWC,\nout bool clipped,\nout bool culledByNearPlane)\n{\nculledByNearPlane = false;\nclipped = false;\nvec3 p1ToP0 = p1 - p0;\nfloat magnitude = length(p1ToP0);\nvec3 direction = normalize(p1ToP0);\nfloat endPoint0Distance = -(czm_currentFrustum.x + p0.z);\nfloat denominator = -direction.z;\nif (endPoint0Distance < 0.0 && abs(denominator) < czm_epsilon7)\n{\nculledByNearPlane = true;\n}\nelse if (endPoint0Distance < 0.0 && abs(denominator) > czm_epsilon7)\n{\nfloat t = (czm_currentFrustum.x + p0.z) / denominator;\nif (t < 0.0 || t > magnitude)\n{\nculledByNearPlane = true;\n}\nelse\n{\np0 = p0 + t * direction;\nclipped = true;\n}\n}\npositionWC = czm_eyeToWindowCoordinates(vec4(p0, 1.0));\n}\nvec4 getPolylineWindowCoordinates(vec4 position, vec4 previous, vec4 next, float expandDirection, float width, bool usePrevious) {\nvec4 endPointWC, p0, p1;\nbool culledByNearPlane, clipped;\nvec4 positionEC = czm_modelViewRelativeToEye * position;\nvec4 prevEC = czm_modelViewRelativeToEye * previous;\nvec4 nextEC = czm_modelViewRelativeToEye * next;\nclipLineSegmentToNearPlane(prevEC.xyz, positionEC.xyz, p0, clipped, culledByNearPlane);\nclipLineSegmentToNearPlane(nextEC.xyz, positionEC.xyz, p1, clipped, culledByNearPlane);\nclipLineSegmentToNearPlane(positionEC.xyz, usePrevious ? prevEC.xyz : nextEC.xyz, endPointWC, clipped, culledByNearPlane);\nif (culledByNearPlane)\n{\nreturn vec4(0.0, 0.0, 0.0, 1.0);\n}\nvec2 prevWC = normalize(p0.xy - endPointWC.xy);\nvec2 nextWC = normalize(p1.xy - endPointWC.xy);\nfloat expandWidth = width * 0.5;\nvec2 direction;\nif (czm_equalsEpsilon(normalize(previous.xyz - position.xyz), vec3(0.0), czm_epsilon1) || czm_equalsEpsilon(prevWC, -nextWC, czm_epsilon1))\n{\ndirection = vec2(-nextWC.y, nextWC.x);\n}\nelse if (czm_equalsEpsilon(normalize(next.xyz - position.xyz), vec3(0.0), czm_epsilon1) || clipped)\n{\ndirection = vec2(prevWC.y, -prevWC.x);\n}\nelse\n{\nvec2 normal = vec2(-nextWC.y, nextWC.x);\ndirection = normalize((nextWC + prevWC) * 0.5);\nif (dot(direction, normal) < 0.0)\n{\ndirection = -direction;\n}\nfloat sinAngle = abs(direction.x * nextWC.y - direction.y * nextWC.x);\nexpandWidth = clamp(expandWidth / sinAngle, 0.0, width * 2.0);\n}\nvec2 offset = direction * expandDirection * expandWidth * czm_resolutionScale;\nreturn vec4(endPointWC.xy + offset, -endPointWC.z, 1.0);\n}\n"}),i("Shaders/PolylineFS",[],function(){"use strict";return"varying vec2 v_st;\nvoid main()\n{\nczm_materialInput materialInput;\nmaterialInput.s = v_st.s;\nmaterialInput.st = v_st;\nmaterialInput.str = vec3(v_st, 0.0);\nczm_material material = czm_getMaterial(materialInput);\ngl_FragColor = vec4(material.diffuse + material.emission, material.alpha);\n}\n"}),i("Shaders/PolylineVS",[],function(){"use strict";return"attribute vec3 position3DHigh;\nattribute vec3 position3DLow;\nattribute vec3 position2DHigh;\nattribute vec3 position2DLow;\nattribute vec3 prevPosition3DHigh;\nattribute vec3 prevPosition3DLow;\nattribute vec3 prevPosition2DHigh;\nattribute vec3 prevPosition2DLow;\nattribute vec3 nextPosition3DHigh;\nattribute vec3 nextPosition3DLow;\nattribute vec3 nextPosition2DHigh;\nattribute vec3 nextPosition2DLow;\nattribute vec4 texCoordExpandWidthAndShow;\nattribute vec4 pickColor;\nvarying vec2 v_st;\nvarying float v_width;\nvarying vec4 czm_pickColor;\nvoid main()\n{\nfloat texCoord = texCoordExpandWidthAndShow.x;\nfloat expandDir = texCoordExpandWidthAndShow.y;\nfloat width = abs(texCoordExpandWidthAndShow.z) + 0.5;\nbool usePrev = texCoordExpandWidthAndShow.z < 0.0;\nfloat show = texCoordExpandWidthAndShow.w;\nvec4 p, prev, next;\nif (czm_morphTime == 1.0)\n{\np = czm_translateRelativeToEye(position3DHigh.xyz, position3DLow.xyz);\nprev = czm_translateRelativeToEye(prevPosition3DHigh.xyz, prevPosition3DLow.xyz);\nnext = czm_translateRelativeToEye(nextPosition3DHigh.xyz, nextPosition3DLow.xyz);\n}\nelse if (czm_morphTime == 0.0)\n{\np = czm_translateRelativeToEye(position2DHigh.zxy, position2DLow.zxy);\nprev = czm_translateRelativeToEye(prevPosition2DHigh.zxy, prevPosition2DLow.zxy);\nnext = czm_translateRelativeToEye(nextPosition2DHigh.zxy, nextPosition2DLow.zxy);\n}\nelse\n{\np = czm_columbusViewMorph(\nczm_translateRelativeToEye(position2DHigh.zxy, position2DLow.zxy),\nczm_translateRelativeToEye(position3DHigh.xyz, position3DLow.xyz),\nczm_morphTime);\nprev = czm_columbusViewMorph(\nczm_translateRelativeToEye(prevPosition2DHigh.zxy, prevPosition2DLow.zxy),\nczm_translateRelativeToEye(prevPosition3DHigh.xyz, prevPosition3DLow.xyz),\nczm_morphTime);\nnext = czm_columbusViewMorph(\nczm_translateRelativeToEye(nextPosition2DHigh.zxy, nextPosition2DLow.zxy),\nczm_translateRelativeToEye(nextPosition3DHigh.xyz, nextPosition3DLow.xyz),\nczm_morphTime);\n}\nvec4 positionWC = getPolylineWindowCoordinates(p, prev, next, expandDir, width, usePrev);\ngl_Position = czm_viewportOrthographic * positionWC * show;\nv_st = vec2(texCoord, clamp(expandDir, 0.0, 1.0));\nv_width = width;\nczm_pickColor = pickColor;\n}\n"}),i("Scene/Polyline",["../Core/BoundingSphere","../Core/Cartesian3","../Core/Color","../Core/defaultValue","../Core/defined","../Core/defineProperties","../Core/DeveloperError","../Core/Matrix4","../Core/PolylinePipeline","./Material"],function(e,t,i,r,n,o,a,s,l,u){"use strict";function c(o,a){o=r(o,r.EMPTY_OBJECT),this._show=r(o.show,!0),this._width=r(o.width,1),this._loop=r(o.loop,!1),this._material=o.material,n(this._material)||(this._material=u.fromType(u.ColorType,{color:new i(1,1,1,1)}));var c=o.positions;n(c)||(c=[]),this._positions=c,this._actualPositions=l.removeDuplicates(c),this._loop&&this._actualPositions.length>2&&(this._actualPositions===this._positions&&(this._actualPositions=c.slice()),this._actualPositions.push(t.clone(this._actualPositions[0]))),this._length=this._actualPositions.length,this._id=o.id;var h;n(a)&&(h=s.clone(a.modelMatrix)),this._modelMatrix=h,this._segments=l.wrapLongitude(this._actualPositions,h),this._actualLength=void 0,this._propertiesChanged=new Uint32Array(g),this._polylineCollection=a,this._dirty=!1,this._pickId=void 0,this._boundingVolume=e.fromPoints(this._actualPositions),this._boundingVolumeWC=e.transform(this._boundingVolume,this._modelMatrix),this._boundingVolume2D=new e}function h(e,t){++e._propertiesChanged[t];var i=e._polylineCollection;n(i)&&(i._updatePolyline(e,t),e._dirty=!0)}var d=c.SHOW_INDEX=0,p=c.WIDTH_INDEX=1,m=c.POSITION_INDEX=2,f=c.MATERIAL_INDEX=3,v=c.POSITION_SIZE_INDEX=4,g=c.NUMBER_OF_PROPERTIES=5;return o(c.prototype,{show:{get:function(){return this._show},set:function(e){e!==this._show&&(this._show=e,h(this,d))}},positions:{get:function(){return this._positions},set:function(i){var r=l.removeDuplicates(i);this._loop&&r.length>2&&(r===i&&(r=i.slice()),r.push(t.clone(r[0]))),(this._actualPositions.length!==r.length||this._actualPositions.length!==this._length)&&h(this,v),this._positions=i,this._actualPositions=r,this._length=r.length,this._boundingVolume=e.fromPoints(this._actualPositions,this._boundingVolume),this._boundingVolumeWC=e.transform(this._boundingVolume,this._modelMatrix,this._boundingVolumeWC),h(this,m),this.update()}},material:{get:function(){return this._material},set:function(e){this._material!==e&&(this._material=e,h(this,f))}},width:{get:function(){return this._width},set:function(e){var t=this._width;e!==t&&(this._width=e,h(this,p))}},loop:{get:function(){return this._loop},set:function(e){if(e!==this._loop){var i=this._actualPositions;e?i.length>2&&!t.equals(i[0],i[i.length-1])&&(i.length===this._positions.length&&(this._actualPositions=i=this._positions.slice()),i.push(t.clone(i[0]))):i.length>2&&t.equals(i[0],i[i.length-1])&&(i.length-1===this._positions.length?this._actualPositions=this._positions:i.pop()),this._loop=e,h(this,v)}}},id:{get:function(){return this._id},set:function(e){this._id=e,n(this._pickId)&&(this._pickId.object.id=e)}}}),c.prototype.update=function(){var t=s.IDENTITY;n(this._polylineCollection)&&(t=this._polylineCollection.modelMatrix);var i=this._segments.positions.length,r=this._segments.lengths,o=this._propertiesChanged[m]>0||this._propertiesChanged[v]>0;if((!s.equals(t,this._modelMatrix)||o)&&(this._segments=l.wrapLongitude(this._actualPositions,t),this._boundingVolumeWC=e.transform(this._boundingVolume,t,this._boundingVolumeWC)),this._modelMatrix=t,this._segments.positions.length!==i)h(this,v);else for(var a=r.length,u=0;a>u;++u)if(r[u]!==this._segments.lengths[u]){h(this,v);break}},c.prototype.getPickId=function(e){return n(this._pickId)||(this._pickId=e.createPickId({primitive:this,collection:this._polylineCollection,id:this._id})),this._pickId},c.prototype._clean=function(){this._dirty=!1;for(var e=this._propertiesChanged,t=0;g-1>t;++t)e[t]=0},c.prototype._destroy=function(){this._pickId=this._pickId&&this._pickId.destroy(),this._material=this._material&&this._material.destroy(),this._polylineCollection=void 0},c}),i("Scene/PolylineCollection",["../Core/BoundingSphere","../Core/Cartesian3","../Core/Cartesian4","../Core/Cartographic","../Core/Color","../Core/ComponentDatatype","../Core/defaultValue","../Core/defined","../Core/defineProperties","../Core/destroyObject","../Core/DeveloperError","../Core/EncodedCartesian3","../Core/IndexDatatype","../Core/Intersect","../Core/Math","../Core/Matrix4","../Core/Plane","../Renderer/Buffer","../Renderer/BufferUsage","../Renderer/DrawCommand","../Renderer/RenderState","../Renderer/ShaderProgram","../Renderer/ShaderSource","../Renderer/VertexArray","../Shaders/PolylineCommon","../Shaders/PolylineFS","../Shaders/PolylineVS","./BlendingState","./Material","./Pass","./Polyline","./SceneMode"],function(e,t,i,r,n,o,a,s,l,u,c,h,d,p,m,f,v,g,_,y,C,E,S,w,T,x,b,A,P,I,M,D){"use strict";function R(e){e=a(e,a.EMPTY_OBJECT),this.modelMatrix=f.clone(a(e.modelMatrix,f.IDENTITY)),this._modelMatrix=f.clone(f.IDENTITY),this.debugShowBoundingVolume=a(e.debugShowBoundingVolume,!1),this._opaqueRS=void 0,this._translucentRS=void 0,this._colorCommands=[],this._pickCommands=[],this._polylinesUpdated=!1,this._polylinesRemoved=!1,this._createVertexArray=!1,this._propertiesChanged=new Uint32Array(Q),this._polylines=[],this._polylineBuckets={},this._buffersUsage=[{bufferUsage:_.STATIC_DRAW,frameCount:0},{bufferUsage:_.STATIC_DRAW,frameCount:0},{bufferUsage:_.STATIC_DRAW,frameCount:0}],this._mode=void 0,this._polylinesToUpdate=[],this._vertexArrays=[],this._positionBuffer=void 0,this._pickColorBuffer=void 0,this._texCoordExpandWidthAndShowBuffer=void 0}function O(t,i,r,n,o){for(var a=i.context,l=i.commandList,u=r.length,c=0,h=!0,d=t._vertexArrays,p=t.debugShowBoundingVolume,m=d.length,f=0;m>f;++f)for(var v=d[f],g=v.buckets,_=g.length,C=0;_>C;++C){for(var E,S,w,T=g[C],x=T.offset,b=o?T.bucket.shaderProgram:T.bucket.pickShaderProgram,A=T.bucket.polylines,P=A.length,M=0,R=0;P>R;++R){var O=A[R],N=F(O._material);if(N!==E){if(s(E)&&M>0){var L=S.isTranslucent();c>=u?(w=new y({owner:t}),r.push(w)):w=r[c],++c,w.boundingVolume=e.clone($,w.boundingVolume),w.modelMatrix=n,w.shaderProgram=b,w.vertexArray=v.va,w.renderState=L?t._translucentRS:t._opaqueRS,w.pass=L?I.TRANSLUCENT:I.OPAQUE,w.debugShowBoundingVolume=o?p:!1,w.uniformMap=S._uniforms,w.count=M,w.offset=x,x+=M,M=0,h=!0,l.push(w)}S=O._material,S.update(a),E=N}for(var B=O._locatorBuckets,V=B.length,k=0;V>k;++k){var z=B[k];z.locator===T&&(M+=z.count)}var U;i.mode===D.SCENE3D?U=O._boundingVolumeWC:i.mode===D.COLUMBUS_VIEW?U=O._boundingVolume2D:i.mode===D.SCENE2D?s(O._boundingVolume2D)&&(U=e.clone(O._boundingVolume2D,ee),U.center.x=0):s(O._boundingVolumeWC)&&s(O._boundingVolume2D)&&(U=e.union(O._boundingVolumeWC,O._boundingVolume2D,ee)),h?(h=!1,e.clone(U,$)):e.union(U,$,$)}s(E)&&M>0&&(c>=u?(w=new y({owner:t}),r.push(w)):w=r[c],++c,w.boundingVolume=e.clone($,w.boundingVolume),w.modelMatrix=n,w.shaderProgram=b,w.vertexArray=v.va,w.renderState=S.isTranslucent()?t._translucentRS:t._opaqueRS,w.pass=S.isTranslucent()?I.TRANSLUCENT:I.OPAQUE,w.debugShowBoundingVolume=o?p:!1,w.uniformMap=S._uniforms,w.count=M,w.offset=x,h=!0,l.push(w)),E=void 0}r.length=c}function N(e){for(var t=e._buffersUsage,i=!1,r=e._propertiesChanged,n=0;Q-2>n;++n){var o=t[n];r[n]?o.bufferUsage!==_.STREAM_DRAW?(i=!0,o.bufferUsage=_.STREAM_DRAW,o.frameCount=100):o.frameCount=100:o.bufferUsage!==_.STATIC_DRAW&&(0===o.frameCount?(i=!0,o.bufferUsage=_.STATIC_DRAW):o.frameCount--)}return i}function L(e,t,i){e._createVertexArray=!1,z(e),U(e),B(e);var r,n,a=[[]],l=a[0],u=[0],c=0,h=[[]],p=0,f=e._polylineBuckets;for(r in f)f.hasOwnProperty(r)&&(n=f[r],n.updateShader(t),p+=n.lengthOfPositions);if(p>0){var v,y=e._mode,C=new Float32Array(6*p*3),E=new Uint8Array(4*p),S=new Float32Array(4*p),T=0,x=0,b=0;for(r in f)if(f.hasOwnProperty(r)){n=f[r],n.write(C,E,S,T,x,b,t,i),y===D.MORPHING&&(s(v)||(v=new Float32Array(6*p*3)),n.writeForMorph(v,T));var A=n.lengthOfPositions;T+=6*A*3,x+=4*A,b+=4*A,c=n.updateIndices(a,u,h,c)}var P=e._buffersUsage[X].bufferUsage,I=e._buffersUsage[j].bufferUsage,M=e._buffersUsage[Y].bufferUsage,R=I===_.STREAM_DRAW||M===_.STREAM_DRAW?_.STREAM_DRAW:_.STATIC_DRAW;e._positionBuffer=g.createVertexBuffer({context:t,typedArray:C,usage:P});var O;s(v)&&(O=g.createVertexBuffer({context:t,typedArray:v,usage:P})),e._pickColorBuffer=g.createVertexBuffer({context:t,typedArray:E,usage:_.STATIC_DRAW}),e._texCoordExpandWidthAndShowBuffer=g.createVertexBuffer({context:t,typedArray:S,usage:R});for(var N=4*Uint8Array.BYTES_PER_ELEMENT,L=3*Float32Array.BYTES_PER_ELEMENT,F=4*Float32Array.BYTES_PER_ELEMENT,V=0,k=a.length,G=0;k>G;++G)if(l=a[G],l.length>0){var W=new Uint16Array(l),H=g.createIndexBuffer({context:t,typedArray:W,usage:_.STATIC_DRAW,indexDatatype:d.UNSIGNED_SHORT});V+=u[G];var q,Z,K,Q,$=6*(G*(L*m.SIXTY_FOUR_KILOBYTES)-V*L),ee=L+$,ie=L+ee,re=L+ie,ne=L+re,oe=L+ne,ae=G*(N*m.SIXTY_FOUR_KILOBYTES)-V*N,se=G*(F*m.SIXTY_FOUR_KILOBYTES)-V*F,le=[{ -index:J.position3DHigh,componentsPerAttribute:3,componentDatatype:o.FLOAT,offsetInBytes:$,strideInBytes:6*L},{index:J.position3DLow,componentsPerAttribute:3,componentDatatype:o.FLOAT,offsetInBytes:ee,strideInBytes:6*L},{index:J.position2DHigh,componentsPerAttribute:3,componentDatatype:o.FLOAT,offsetInBytes:$,strideInBytes:6*L},{index:J.position2DLow,componentsPerAttribute:3,componentDatatype:o.FLOAT,offsetInBytes:ee,strideInBytes:6*L},{index:J.prevPosition3DHigh,componentsPerAttribute:3,componentDatatype:o.FLOAT,offsetInBytes:ie,strideInBytes:6*L},{index:J.prevPosition3DLow,componentsPerAttribute:3,componentDatatype:o.FLOAT,offsetInBytes:re,strideInBytes:6*L},{index:J.prevPosition2DHigh,componentsPerAttribute:3,componentDatatype:o.FLOAT,offsetInBytes:ie,strideInBytes:6*L},{index:J.prevPosition2DLow,componentsPerAttribute:3,componentDatatype:o.FLOAT,offsetInBytes:re,strideInBytes:6*L},{index:J.nextPosition3DHigh,componentsPerAttribute:3,componentDatatype:o.FLOAT,offsetInBytes:ne,strideInBytes:6*L},{index:J.nextPosition3DLow,componentsPerAttribute:3,componentDatatype:o.FLOAT,offsetInBytes:oe,strideInBytes:6*L},{index:J.nextPosition2DHigh,componentsPerAttribute:3,componentDatatype:o.FLOAT,offsetInBytes:ne,strideInBytes:6*L},{index:J.nextPosition2DLow,componentsPerAttribute:3,componentDatatype:o.FLOAT,offsetInBytes:oe,strideInBytes:6*L},{index:J.texCoordExpandWidthAndShow,componentsPerAttribute:4,componentDatatype:o.FLOAT,vertexBuffer:e._texCoordExpandWidthAndShowBuffer,offsetInBytes:se},{index:J.pickColor,componentsPerAttribute:4,componentDatatype:o.UNSIGNED_BYTE,vertexBuffer:e._pickColorBuffer,offsetInBytes:ae,normalize:!0}];y===D.SCENE3D?(q=e._positionBuffer,Z="vertexBuffer",K=te,Q="value"):y===D.SCENE2D||y===D.COLUMBUS_VIEW?(q=te,Z="value",K=e._positionBuffer,Q="vertexBuffer"):(q=O,Z="vertexBuffer",K=e._positionBuffer,Q="vertexBuffer"),le[0][Z]=q,le[1][Z]=q,le[2][Q]=K,le[3][Q]=K,le[4][Z]=q,le[5][Z]=q,le[6][Q]=K,le[7][Q]=K,le[8][Z]=q,le[9][Z]=q,le[10][Q]=K,le[11][Q]=K;var ue=new w({context:t,attributes:le,indexBuffer:H});e._vertexArrays.push({va:ue,buckets:h[G]})}}}function F(e){var t=P._uniformList[e.type],i=t.length;ie.length=2*i;for(var r=0,n=0;i>n;++n){var o=t[n];ie[r]=o,ie[r+1]=e._uniforms[o](),r+=2}return e.type+":"+JSON.stringify(ie)}function B(e){for(var t=e._mode,i=e._modelMatrix,r=e._polylineBuckets={},n=e._polylines,o=n.length,a=0;o>a;++a){var l=n[a];if(l._actualPositions.length>1){l.update();var u=l.material,c=r[u.type];s(c)||(c=r[u.type]=new H(u,t,i)),c.addPolyline(l)}}}function V(e,t){var i=t.mode;e._mode===i&&f.equals(e._modelMatrix,e.modelMatrix)||(e._mode=i,e._modelMatrix=f.clone(e.modelMatrix),e._createVertexArray=!0)}function k(e){if(e._polylinesRemoved){e._polylinesRemoved=!1;for(var t=[],i=e._polylines.length,r=0,n=0;i>r;++r){var o=e._polylines[r];s(o)&&(o._index=n++,t.push(o))}e._polylines=t}}function z(e){for(var t=e._polylines,i=t.length,r=0;i>r;++r)if(s(t[r])){var n=t[r]._bucket;s(n)&&(n.shaderProgram=n.shaderProgram&&n.shaderProgram.destroy())}}function U(e){for(var t=e._vertexArrays.length,i=0;t>i;++i)e._vertexArrays[i].va.destroy();e._vertexArrays.length=0}function G(e){for(var t=e._polylines,i=t.length,r=0;i>r;++r)s(t[r])&&t[r]._destroy()}function W(e,t,i){this.count=e,this.offset=t,this.bucket=i}function H(e,t,i){this.polylines=[],this.lengthOfPositions=0,this.material=e,this.shaderProgram=void 0,this.pickShaderProgram=void 0,this.mode=t,this.modelMatrix=i}function q(e){return t.dot(t.UNIT_X,e._boundingVolume.center)<0||e._boundingVolume.intersectPlane(v.ORIGIN_ZX_PLANE)===p.INTERSECTING}var j=M.SHOW_INDEX,Y=M.WIDTH_INDEX,X=M.POSITION_INDEX,Z=M.MATERIAL_INDEX,K=M.POSITION_SIZE_INDEX,Q=M.NUMBER_OF_PROPERTIES,J={texCoordExpandWidthAndShow:0,position3DHigh:1,position3DLow:2,position2DHigh:3,position2DLow:4,prevPosition3DHigh:5,prevPosition3DLow:6,prevPosition2DHigh:7,prevPosition2DLow:8,nextPosition3DHigh:9,nextPosition3DLow:10,nextPosition2DHigh:11,nextPosition2DLow:12,pickColor:13};l(R.prototype,{length:{get:function(){return k(this),this._polylines.length}}}),R.prototype.add=function(e){var t=new M(e,this);return t._index=this._polylines.length,this._polylines.push(t),this._createVertexArray=!0,t},R.prototype.remove=function(e){if(this.contains(e)){if(this._polylines[e._index]=void 0,this._polylinesRemoved=!0,this._createVertexArray=!0,s(e._bucket)){var t=e._bucket;t.shaderProgram=t.shaderProgram&&t.shaderProgram.destroy(),t.pickShaderProgram=t.pickShaderProgram&&t.pickShaderProgram.destroy()}return e._destroy(),!0}return!1},R.prototype.removeAll=function(){z(this),G(this),this._polylineBuckets={},this._polylinesRemoved=!1,this._polylines.length=0,this._polylinesToUpdate.length=0,this._createVertexArray=!0},R.prototype.contains=function(e){return s(e)&&e._polylineCollection===this},R.prototype.get=function(e){return k(this),this._polylines[e]},R.prototype.update=function(e,t){if(k(this),0!==this._polylines.length){V(this,e);var i,r=e.context,n=e.mapProjection,o=this._propertiesChanged;if(this._createVertexArray||N(this))L(this,r,n);else if(this._polylinesUpdated){var a=this._polylinesToUpdate;if(this._mode!==D.SCENE3D)for(var l=a.length,u=0;l>u;++u)i=a[u],i.update();if(o[K]||o[Z])L(this,r,n);else for(var c=a.length,h=this._polylineBuckets,d=0;c>d;++d){i=a[d],o=i._propertiesChanged;var p=i._bucket,m=0;for(var v in h)if(h.hasOwnProperty(v)){if(h[v]===p){(o[X]||o[j]||o[Y])&&p.writeUpdate(m,i,this._positionBuffer,this._texCoordExpandWidthAndShowBuffer,n);break}m+=h[v].lengthOfPositions}i._clean()}a.length=0,this._polylinesUpdated=!1}o=this._propertiesChanged;for(var g=0;Q>g;++g)o[g]=0;var _=f.IDENTITY;e.mode===D.SCENE3D&&(_=this.modelMatrix);var y=e.passes,E=0!==e.morphTime;if(s(this._opaqueRS)&&this._opaqueRS.depthTest.enabled===E||(this._opaqueRS=C.fromCache({depthMask:E,depthTest:{enabled:E}})),s(this._translucentRS)&&this._translucentRS.depthTest.enabled===E||(this._translucentRS=C.fromCache({blending:A.ALPHA_BLEND,depthMask:!E,depthTest:{enabled:E}})),y.render){var S=this._colorCommands;O(this,e,S,_,!0)}if(y.pick){var w=this._pickCommands;O(this,e,w,_,!1)}}};var $=new e,ee=new e;R.prototype.isDestroyed=function(){return!1},R.prototype.destroy=function(){return U(this),z(this),G(this),u(this)};var te=[0,0,0],ie=[];R.prototype._updatePolyline=function(e,t){this._polylinesUpdated=!0,this._polylinesToUpdate.push(e),++this._propertiesChanged[t]},H.prototype.addPolyline=function(e){var t=this.polylines;t.push(e),e._actualLength=this.getPolylinePositionsLength(e),this.lengthOfPositions+=e._actualLength,e._bucket=this},H.prototype.updateShader=function(e){if(!s(this.shaderProgram)){var t=new S({sources:[T,b]}),i=new S({sources:[this.material.shaderSource,x]}),r=new S({sources:i.sources,pickColorQualifier:"varying"});this.shaderProgram=E.fromCache({context:e,vertexShaderSource:t,fragmentShaderSource:i,attributeLocations:J}),this.pickShaderProgram=E.fromCache({context:e,vertexShaderSource:t,fragmentShaderSource:r,attributeLocations:J})}},H.prototype.getPolylinePositionsLength=function(e){var t;if(this.mode===D.SCENE3D||!q(e))return t=e._actualPositions.length,4*t-4;var i=0,r=e._segments.lengths;t=r.length;for(var n=0;t>n;++n)i+=4*r[n]-4;return i};var re=new t,ne=new t,oe=new t,ae=new t;H.prototype.write=function(e,i,r,o,a,s,l,u){for(var c=this.mode,d=this.polylines,p=d.length,m=0;p>m;++m)for(var f,v=d[m],g=v.width,_=v.show&&g>0,y=this.getSegments(v,u),C=y.positions,E=y.lengths,S=C.length,w=v.getPickId(l).color,T=0,x=0,b=0;S>b;++b){0===b?v._loop?f=C[S-2]:(f=ae,t.subtract(C[0],C[1],f),t.add(C[0],f,f)):f=C[b-1],ne.x=f.x,ne.y=f.y,ne.z=c!==D.SCENE2D?f.z:0,f=C[b],re.x=f.x,re.y=f.y,re.z=c!==D.SCENE2D?f.z:0,b===S-1?v._loop?f=C[1]:(f=ae,t.subtract(C[S-1],C[S-2],f),t.add(C[S-1],f,f)):f=C[b+1],oe.x=f.x,oe.y=f.y,oe.z=c!==D.SCENE2D?f.z:0;var A=E[T];b===x+A&&(x+=A,++T);for(var P=b-x===0,I=b===x+E[T]-1,M=P?2:0,R=I?2:4,O=M;R>O;++O){h.writeElements(re,e,o),h.writeElements(ne,e,o+6),h.writeElements(oe,e,o+12),i[a]=n.floatToByte(w.red),i[a+1]=n.floatToByte(w.green),i[a+2]=n.floatToByte(w.blue),i[a+3]=n.floatToByte(w.alpha);var N=0>O-2?-1:1;r[s]=b/(S-1),r[s+1]=2*(O%2)-1,r[s+2]=N*g,r[s+3]=_,o+=18,a+=4,s+=4}}};var se=new t,le=new t,ue=new t,ce=new t;H.prototype.writeForMorph=function(e,i){for(var r=this.modelMatrix,n=this.polylines,o=n.length,a=0;o>a;++a)for(var s=n[a],l=s._segments.positions,u=s._segments.lengths,c=l.length,d=0,p=0,m=0;c>m;++m){var v;0===m?s._loop?v=l[c-2]:(v=ce,t.subtract(l[0],l[1],v),t.add(l[0],v,v)):v=l[m-1],v=f.multiplyByPoint(r,v,le);var g,_=f.multiplyByPoint(r,l[m],se);m===c-1?s._loop?g=l[1]:(g=ce,t.subtract(l[c-1],l[c-2],g),t.add(l[c-1],g,g)):g=l[m+1],g=f.multiplyByPoint(r,g,ue);var y=u[d];m===p+y&&(p+=y,++d);for(var C=m-p===0,E=m===p+u[d]-1,S=C?2:0,w=E?2:4,T=S;w>T;++T)h.writeElements(_,e,i),h.writeElements(v,e,i+6),h.writeElements(g,e,i+12),i+=18}};var he=new Array(1);H.prototype.updateIndices=function(e,t,i,r){var n=i.length-1,o=new W(0,r,this);i[n].push(o);var a=0,s=e[e.length-1],l=0;s.length>0&&(l=s[s.length-1]+1);for(var u=this.polylines,c=u.length,h=0;c>h;++h){var d=u[h];d._locatorBuckets=[];var p;if(this.mode===D.SCENE3D){p=he;var f=d._actualPositions.length;if(!(f>0))continue;p[0]=f}else p=d._segments.lengths;var v=p.length;if(v>0){for(var g=0,_=0;v>_;++_)for(var y=p[_]-1,C=0;y>C;++C)l+4>=m.SIXTY_FOUR_KILOBYTES-2&&(d._locatorBuckets.push({locator:o,count:g}),g=0,t.push(4),s=[],e.push(s),l=0,o.count=a,a=0,r=0,o=new W(0,0,this),i[++n]=[o]),s.push(l,l+2,l+1),s.push(l+1,l+2,l+3),g+=6,a+=6,r+=6,l+=4;d._locatorBuckets.push({locator:o,count:g}),l+4>=m.SIXTY_FOUR_KILOBYTES-2&&(t.push(0),s=[],e.push(s),l=0,o.count=a,r=0,a=0,o=new W(0,0,this),i[++n]=[o])}d._clean()}return o.count=a,r},H.prototype.getPolylineStartIndex=function(e){for(var t=this.polylines,i=0,r=t.length,n=0;r>n;++n){var o=t[n];if(o===e)break;i+=o._actualLength}return i};var de={positions:void 0,lengths:void 0},pe=new Array(1),me=new t,fe=new r;H.prototype.getSegments=function(i,r){var n=i._actualPositions;if(this.mode===D.SCENE3D)return pe[0]=n.length,de.positions=n,de.lengths=pe,de;q(i)&&(n=i._segments.positions);for(var o,a=r.ellipsoid,s=[],l=this.modelMatrix,u=n.length,c=me,h=0;u>h;++h)o=n[h],c=f.multiplyByPoint(l,o,c),s.push(r.project(a.cartesianToCartographic(c,fe)));if(s.length>0){i._boundingVolume2D=e.fromPoints(s,i._boundingVolume2D);var d=i._boundingVolume2D.center;i._boundingVolume2D.center=new t(d.z,d.x,d.y)}return de.positions=s,de.lengths=i._segments.lengths,de};var ve,ge;return H.prototype.writeUpdate=function(e,i,r,n,o){var a=this.mode,l=i._actualLength;if(l){e+=this.getPolylineStartIndex(i);var u=ve,c=ge,d=6*l*3;!s(u)||u.lengthd&&(u=new Float32Array(u.buffer,0,d),c=new Float32Array(c.buffer,0,4*l));var p,m=0,f=0,v=this.getSegments(i,o),g=v.positions,_=v.lengths,y=0,C=0,E=i.width,S=i.show&&E>0;l=g.length;for(var w=0;l>w;++w){0===w?i._loop?p=g[l-2]:(p=ae,t.subtract(g[0],g[1],p),t.add(g[0],p,p)):p=g[w-1],ne.x=p.x,ne.y=p.y,ne.z=a!==D.SCENE2D?p.z:0,p=g[w],re.x=p.x,re.y=p.y,re.z=a!==D.SCENE2D?p.z:0,w===l-1?i._loop?p=g[1]:(p=ae,t.subtract(g[l-1],g[l-2],p),t.add(g[l-1],p,p)):p=g[w+1],oe.x=p.x,oe.y=p.y,oe.z=a!==D.SCENE2D?p.z:0;var T=_[y];w===C+T&&(C+=T,++y);for(var x=w-C===0,b=w===C+_[y]-1,A=x?2:0,P=b?2:4,I=A;P>I;++I){h.writeElements(re,u,m),h.writeElements(ne,u,m+6),h.writeElements(oe,u,m+12);var M=0>I-2?-1:1;c[f]=w/(l-1),c[f+1]=2*(I%2)-1,c[f+2]=M*E,c[f+3]=S,m+=18,f+=4}}r.copyFromArrayView(u,18*Float32Array.BYTES_PER_ELEMENT*e),n.copyFromArrayView(c,4*Float32Array.BYTES_PER_ELEMENT*e)}},R}),i("DataSources/ScaledPositionProperty",["../Core/defined","../Core/defineProperties","../Core/DeveloperError","../Core/Ellipsoid","../Core/Event","../Core/ReferenceFrame","./Property"],function(e,t,i,r,n,o,a){"use strict";function s(e){this._definitionChanged=new n,this._value=void 0,this._removeSubscription=void 0,this.setValue(e)}return t(s.prototype,{isConstant:{get:function(){return a.isConstant(this._value)}},definitionChanged:{get:function(){return this._definitionChanged}},referenceFrame:{get:function(){return e(this._value)?this._value.referenceFrame:o.FIXED}}}),s.prototype.getValue=function(e,t){return this.getValueInReferenceFrame(e,o.FIXED,t)},s.prototype.setValue=function(t){this._value!==t&&(this._value=t,e(this._removeSubscription)&&(this._removeSubscription(),this._removeSubscription=void 0),e(t)&&(this._removeSubscription=t.definitionChanged.addEventListener(this._raiseDefinitionChanged,this)),this._definitionChanged.raiseEvent(this))},s.prototype.getValueInReferenceFrame=function(t,i,n){return e(this._value)?(n=this._value.getValueInReferenceFrame(t,i,n),e(n)?r.WGS84.scaleToGeodeticSurface(n,n):void 0):void 0},s.prototype.equals=function(e){return this===e||e instanceof s&&this._value===e._value},s.prototype._raiseDefinitionChanged=function(){this._definitionChanged.raiseEvent(this)},s}),i("DataSources/PathVisualizer",["../Core/AssociativeArray","../Core/Cartesian3","../Core/defined","../Core/destroyObject","../Core/DeveloperError","../Core/JulianDate","../Core/Matrix3","../Core/Matrix4","../Core/ReferenceFrame","../Core/TimeInterval","../Core/Transforms","../Scene/PolylineCollection","../Scene/SceneMode","./CompositePositionProperty","./ConstantPositionProperty","./MaterialProperty","./Property","./ReferenceProperty","./SampledPositionProperty","./ScaledPositionProperty","./TimeIntervalCollectionPositionProperty"],function(e,t,i,r,n,o,a,s,l,u,c,h,d,p,m,f,v,g,_,y,C){"use strict";function E(e){this.entity=e,this.polyline=void 0,this.index=void 0,this.updater=void 0}function S(e,t,r,n,a,s,l,u,c){var h,d=u;h=e.getValueInReferenceFrame(t,s,c[d]),i(h)&&(c[d++]=h);for(var p,m,f,v=!i(a)||o.lessThanOrEquals(a,t)||o.greaterThanOrEquals(a,r),g=0,_=n.length,y=n[g],C=r,E=!1;_>g;){if(!v&&o.greaterThanOrEquals(y,a)&&(h=e.getValueInReferenceFrame(a,s,c[d]),i(h)&&(c[d++]=h),v=!0),o.greaterThan(y,t)&&o.lessThan(y,C)&&!y.equals(a)&&(h=e.getValueInReferenceFrame(y,s,c[d]),i(h)&&(c[d++]=h)),_-1>g){if(l>0&&!E){var S=n[g+1],w=o.secondsDifference(S,y);E=w>l,E&&(p=Math.ceil(w/l),m=0,f=w/Math.max(p,2),p=Math.max(p-1,1))}if(E&&p>m){y=o.addSeconds(y,f,new o),m++;continue}}E=!1,g++,y=n[g]}return h=e.getValueInReferenceFrame(r,s,c[d]),i(h)&&(c[d++]=h),d}function w(e,t,r,n,a,s,l,u){for(var c,h=0,d=l,p=t,m=Math.max(s,60),f=!i(n)||o.lessThanOrEquals(n,t)||o.greaterThanOrEquals(n,r);o.lessThan(p,r);)!f&&o.greaterThanOrEquals(p,n)&&(f=!0,c=e.getValueInReferenceFrame(n,a,u[d]),i(c)&&(u[d]=c,d++)),c=e.getValueInReferenceFrame(p,a,u[d]),i(c)&&(u[d]=c,d++),h++,p=o.addSeconds(t,m*h,new o);return c=e.getValueInReferenceFrame(r,a,u[d]),i(c)&&(u[d]=c,d++),d}function T(e,t,r,n,a,s,l,c){L.start=t,L.stop=r;for(var h=l,d=e.intervals,p=0;p0){var T=S.pop();c=this._polylineCollection.get(T),t.index=T}else t.index=this._polylineCollection.length,c=this._polylineCollection.add();c.id=a,t.polyline=c}var x=v.getValueOrDefault(s._resolution,e,D);c.show=!0,c.positions=P(l,r,n,e,this._referenceFrame,x,c.positions.slice()),c.material=f.getValue(e,s._material,c.material),c.width=v.getValueOrDefault(s._width,e,R)},I.prototype.removeObject=function(e){var t=e.polyline;i(t)&&(this._unusedIndexes.push(e.index),e.polyline=void 0,t.show=!1,e.index=void 0)},I.prototype.destroy=function(){return this._scene.primitives.remove(this._polylineCollection),r(this)},M.prototype.update=function(e){var t=this._updaters;for(var r in t)t.hasOwnProperty(r)&&t[r].update(e);for(var n=this._items.values,o=0,a=n.length;a>o;o++){var s=n[o],u=s.entity,c=u._position,h=s.updater,p=l.FIXED;this._scene.mode===d.SCENE3D&&(p=c.referenceFrame);var m=this._updaters[p];h===m&&i(m)?m.updateObject(e,s):(i(h)&&h.removeObject(s),i(m)||(m=new I(this._scene,p),m.update(e),this._updaters[p]=m),s.updater=m,i(m)&&m.updateObject(e,s))}return!0},M.prototype.isDestroyed=function(){return!1},M.prototype.destroy=function(){this._entityCollection.collectionChanged.removeEventListener(M.prototype._onCollectionChanged,this);var e=this._updaters;for(var t in e)e.hasOwnProperty(t)&&e[t].destroy();return r(this)},M.prototype._onCollectionChanged=function(e,t,r,n){var o,a,s,l=this._items;for(o=t.length-1;o>-1;o--)a=t[o],i(a._path)&&i(a._position)&&l.set(a.id,new E(a));for(o=n.length-1;o>-1;o--)a=n[o],i(a._path)&&i(a._position)?l.contains(a.id)||l.set(a.id,new E(a)):(s=l.get(a.id),i(s)&&(s.updater.removeObject(s),l.remove(a.id)));for(o=r.length-1;o>-1;o--)a=r[o],s=l.get(a.id),i(s)&&(s.updater.removeObject(s),l.remove(a.id))},M._subSample=P,M}),i("Shaders/PointPrimitiveCollectionFS",[],function(){"use strict";return"varying vec4 v_color;\nvarying vec4 v_outlineColor;\nvarying float v_innerPercent;\nvarying float v_pixelDistance;\n#ifdef RENDER_FOR_PICK\nvarying vec4 v_pickColor;\n#endif\nvoid main()\n{\nfloat distanceToCenter = length(gl_PointCoord - vec2(0.5));\nfloat maxDistance = max(0.0, 0.5 - v_pixelDistance);\nfloat wholeAlpha = 1.0 - smoothstep(maxDistance, 0.5, distanceToCenter);\nfloat innerAlpha = 1.0 - smoothstep(maxDistance * v_innerPercent, 0.5 * v_innerPercent, distanceToCenter);\nvec4 color = mix(v_outlineColor, v_color, innerAlpha);\ncolor.a *= wholeAlpha;\nif (color.a < 0.005)\n{\ndiscard;\n}\n#ifdef RENDER_FOR_PICK\ngl_FragColor = v_pickColor;\n#else\ngl_FragColor = color;\n#endif\n}\n"}),i("Shaders/PointPrimitiveCollectionVS",[],function(){"use strict";return"uniform float u_maxTotalPointSize;\nattribute vec4 positionHighAndSize;\nattribute vec4 positionLowAndOutline;\nattribute vec4 compressedAttribute0;\nattribute vec4 compressedAttribute1;\nattribute vec4 scaleByDistance;\nvarying vec4 v_color;\nvarying vec4 v_outlineColor;\nvarying float v_innerPercent;\nvarying float v_pixelDistance;\n#ifdef RENDER_FOR_PICK\nvarying vec4 v_pickColor;\n#endif\nconst float SHIFT_LEFT8 = 256.0;\nconst float SHIFT_RIGHT8 = 1.0 / 256.0;\nvoid main()\n{\nvec3 positionHigh = positionHighAndSize.xyz;\nvec3 positionLow = positionLowAndOutline.xyz;\nfloat outlineWidthBothSides = 2.0 * positionLowAndOutline.w;\nfloat totalSize = positionHighAndSize.w + outlineWidthBothSides;\nfloat outlinePercent = outlineWidthBothSides / totalSize;\ntotalSize *= czm_resolutionScale;\ntotalSize += 3.0;\nfloat temp = compressedAttribute1.x * SHIFT_RIGHT8;\nfloat show = floor(temp);\n#ifdef EYE_DISTANCE_TRANSLUCENCY\nvec4 translucencyByDistance;\ntranslucencyByDistance.x = compressedAttribute1.z;\ntranslucencyByDistance.z = compressedAttribute1.w;\ntranslucencyByDistance.y = ((temp - floor(temp)) * SHIFT_LEFT8) / 255.0;\ntemp = compressedAttribute1.y * SHIFT_RIGHT8;\ntranslucencyByDistance.w = ((temp - floor(temp)) * SHIFT_LEFT8) / 255.0;\n#endif\nvec4 color;\nvec4 outlineColor;\n#ifdef RENDER_FOR_PICK\ncolor = vec4(0.0);\noutlineColor = vec4(0.0);\nvec4 pickColor;\ntemp = compressedAttribute0.z * SHIFT_RIGHT8;\npickColor.b = (temp - floor(temp)) * SHIFT_LEFT8;\ntemp = floor(temp) * SHIFT_RIGHT8;\npickColor.g = (temp - floor(temp)) * SHIFT_LEFT8;\npickColor.r = floor(temp);\n#else\ntemp = compressedAttribute0.x * SHIFT_RIGHT8;\ncolor.b = (temp - floor(temp)) * SHIFT_LEFT8;\ntemp = floor(temp) * SHIFT_RIGHT8;\ncolor.g = (temp - floor(temp)) * SHIFT_LEFT8;\ncolor.r = floor(temp);\ntemp = compressedAttribute0.y * SHIFT_RIGHT8;\noutlineColor.b = (temp - floor(temp)) * SHIFT_LEFT8;\ntemp = floor(temp) * SHIFT_RIGHT8;\noutlineColor.g = (temp - floor(temp)) * SHIFT_LEFT8;\noutlineColor.r = floor(temp);\n#endif\ntemp = compressedAttribute0.w * SHIFT_RIGHT8;\n#ifdef RENDER_FOR_PICK\npickColor.a = (temp - floor(temp)) * SHIFT_LEFT8;\npickColor = pickColor / 255.0;\n#endif\ntemp = floor(temp) * SHIFT_RIGHT8;\noutlineColor.a = (temp - floor(temp)) * SHIFT_LEFT8;\noutlineColor /= 255.0;\ncolor.a = floor(temp);\ncolor /= 255.0;\nvec4 p = czm_translateRelativeToEye(positionHigh, positionLow);\nvec4 positionEC = czm_modelViewRelativeToEye * p;\npositionEC.xyz *= show;\n#if defined(EYE_DISTANCE_SCALING) || defined(EYE_DISTANCE_TRANSLUCENCY)\nfloat lengthSq;\nif (czm_sceneMode == czm_sceneMode2D)\n{\nlengthSq = czm_eyeHeight2D.y;\n}\nelse\n{\nlengthSq = dot(positionEC.xyz, positionEC.xyz);\n}\n#endif\n#ifdef EYE_DISTANCE_SCALING\ntotalSize *= czm_nearFarScalar(scaleByDistance, lengthSq);\n#endif\ntotalSize = min(totalSize, u_maxTotalPointSize);\nif (totalSize < 1.0)\n{\npositionEC.xyz = vec3(0.0);\ntotalSize = 1.0;\n}\nfloat translucency = 1.0;\n#ifdef EYE_DISTANCE_TRANSLUCENCY\ntranslucency = czm_nearFarScalar(translucencyByDistance, lengthSq);\nif (translucency < 0.004)\n{\npositionEC.xyz = vec3(0.0);\n}\n#endif\nvec4 positionWC = czm_eyeToWindowCoordinates(positionEC);\ngl_Position = czm_viewportOrthographic * vec4(positionWC.xy, -positionWC.z, 1.0);\nv_color = color;\nv_color.a *= translucency;\nv_outlineColor = outlineColor;\nv_outlineColor.a *= translucency;\nv_innerPercent = 1.0 - outlinePercent;\nv_pixelDistance = 2.0 / totalSize;\ngl_PointSize = totalSize;\n#ifdef RENDER_FOR_PICK\nv_pickColor = pickColor;\n#endif\n}\n"}),i("Scene/PointPrimitive",["../Core/Cartesian2","../Core/Cartesian3","../Core/Cartesian4","../Core/Color","../Core/defaultValue","../Core/defined","../Core/defineProperties","../Core/DeveloperError","../Core/Matrix4","../Core/NearFarScalar","./SceneMode","./SceneTransforms"],function(e,t,i,r,n,o,a,s,l,u,c,h){"use strict";function d(e,i){e=n(e,n.EMPTY_OBJECT),this._show=n(e.show,!0),this._position=t.clone(n(e.position,t.ZERO)),this._actualPosition=t.clone(this._position),this._color=r.clone(n(e.color,r.WHITE)),this._outlineColor=r.clone(n(e.outlineColor,r.TRANSPARENT)),this._outlineWidth=n(e.outlineWidth,0),this._pixelSize=n(e.pixelSize,10),this._scaleByDistance=e.scaleByDistance,this._translucencyByDistance=e.translucencyByDistance,this._id=e.id,this._collection=n(e.collection,i),this._pickId=void 0,this._pointPrimitiveCollection=i,this._dirty=!1,this._index=-1}function p(e,t){var i=e._pointPrimitiveCollection;o(i)&&(i._updatePointPrimitive(e,t),e._dirty=!0)}var m=d.SHOW_INDEX=0,f=d.POSITION_INDEX=1,v=d.COLOR_INDEX=2,g=d.OUTLINE_COLOR_INDEX=3,_=d.OUTLINE_WIDTH_INDEX=4,y=d.PIXEL_SIZE_INDEX=5,C=d.SCALE_BY_DISTANCE_INDEX=6,E=d.TRANSLUCENCY_BY_DISTANCE_INDEX=7;d.NUMBER_OF_PROPERTIES=8,a(d.prototype,{show:{get:function(){return this._show},set:function(e){this._show!==e&&(this._show=e,p(this,m))}},position:{get:function(){return this._position},set:function(e){var i=this._position;t.equals(i,e)||(t.clone(e,i),t.clone(e,this._actualPosition),p(this,f))}},scaleByDistance:{get:function(){return this._scaleByDistance},set:function(e){var t=this._scaleByDistance;u.equals(t,e)||(this._scaleByDistance=u.clone(e,t),p(this,C))}},translucencyByDistance:{get:function(){return this._translucencyByDistance},set:function(e){var t=this._translucencyByDistance;u.equals(t,e)||(this._translucencyByDistance=u.clone(e,t),p(this,E))}},pixelSize:{get:function(){return this._pixelSize},set:function(e){this._pixelSize!==e&&(this._pixelSize=e,p(this,y))}},color:{get:function(){return this._color},set:function(e){var t=this._color;r.equals(t,e)||(r.clone(e,t),p(this,v))}},outlineColor:{get:function(){return this._outlineColor},set:function(e){var t=this._outlineColor;r.equals(t,e)||(r.clone(e,t),p(this,g))}},outlineWidth:{get:function(){return this._outlineWidth},set:function(e){this._outlineWidth!==e&&(this._outlineWidth=e,p(this,_))}},id:{get:function(){return this._id},set:function(e){this._id=e,o(this._pickId)&&(this._pickId.object.id=e)}}}),d.prototype.getPickId=function(e){return o(this._pickId)||(this._pickId=e.createPickId({primitive:this,collection:this._collection,id:this._id})),this._pickId},d.prototype._getActualPosition=function(){return this._actualPosition},d.prototype._setActualPosition=function(e){t.clone(e,this._actualPosition),p(this,f)};var S=new i;d._computeActualPosition=function(e,t,i){return t.mode===c.SCENE3D?e:(l.multiplyByPoint(i,e,S),h.computeActualWgs84Position(t,S))};var w=new l,T=new i;return d._computeScreenSpacePosition=function(e,t,r,n){var o=r.camera,a=o.viewMatrix,s=o.frustum.projectionMatrix,u=l.multiplyTransformation(a,e,w),c=l.multiplyByVector(u,i.fromElements(t.x,t.y,t.z,1,T),T),d=l.multiplyByVector(s,c,T),p=h.clipToGLWindowCoordinates(r,d,n);return p},d.prototype.computeScreenSpacePosition=function(t,i){var r=this._pointPrimitiveCollection;o(i)||(i=new e);var n=r.modelMatrix,a=d._computeScreenSpacePosition(n,this._actualPosition,t,i);return a.y=t.canvas.clientHeight-a.y,a},d.prototype.equals=function(e){return this===e||o(e)&&this._id===e._id&&t.equals(this._position,e._position)&&r.equals(this._color,e._color)&&this._pixelSize===e._pixelSize&&this._outlineWidth===e._outlineWidth&&this._show===e._show&&r.equals(this._outlineColor,e._outlineColor)&&u.equals(this._scaleByDistance,e._scaleByDistance)&&u.equals(this._translucencyByDistance,e._translucencyByDistance)},d.prototype._destroy=function(){this._pickId=this._pickId&&this._pickId.destroy(),this._pointPrimitiveCollection=void 0},d}),i("Scene/PointPrimitiveCollection",["../Core/BoundingSphere","../Core/Cartesian2","../Core/Cartesian3","../Core/Color","../Core/ComponentDatatype","../Core/defaultValue","../Core/defined","../Core/defineProperties","../Core/destroyObject","../Core/DeveloperError","../Core/EncodedCartesian3","../Core/Math","../Core/Matrix4","../Core/PrimitiveType","../Renderer/BufferUsage","../Renderer/ContextLimits","../Renderer/DrawCommand","../Renderer/RenderState","../Renderer/ShaderProgram","../Renderer/ShaderSource","../Renderer/VertexArrayFacade","../Shaders/PointPrimitiveCollectionFS","../Shaders/PointPrimitiveCollectionVS","./BlendingState","./Pass","./PointPrimitive","./SceneMode"],function(e,t,i,r,n,o,a,s,l,u,c,h,d,p,m,f,v,g,_,y,C,E,S,w,T,x,b){"use strict";function A(t){t=o(t,o.EMPTY_OBJECT),this._sp=void 0,this._rs=void 0,this._vaf=void 0,this._spPick=void 0,this._pointPrimitives=[],this._pointPrimitivesToUpdate=[],this._pointPrimitivesToUpdateIndex=0,this._pointPrimitivesRemoved=!1,this._createVertexArray=!1,this._shaderScaleByDistance=!1,this._compiledShaderScaleByDistance=!1,this._compiledShaderScaleByDistancePick=!1,this._shaderTranslucencyByDistance=!1,this._compiledShaderTranslucencyByDistance=!1,this._compiledShaderTranslucencyByDistancePick=!1,this._propertiesChanged=new Uint32Array(Y),this._maxPixelSize=1,this._baseVolume=new e,this._baseVolumeWC=new e,this._baseVolume2D=new e,this._boundingVolume=new e,this._boundingVolumeDirty=!1,this._colorCommands=[],this._pickCommands=[],this.modelMatrix=d.clone(o(t.modelMatrix,d.IDENTITY)),this._modelMatrix=d.clone(d.IDENTITY),this.debugShowBoundingVolume=o(t.debugShowBoundingVolume,!1),this._mode=b.SCENE3D,this._maxTotalPointSize=1,this._buffersUsage=[m.STATIC_DRAW,m.STATIC_DRAW,m.STATIC_DRAW,m.STATIC_DRAW,m.STATIC_DRAW,m.STATIC_DRAW,m.STATIC_DRAW,m.STATIC_DRAW];var i=this;this._uniforms={u_maxTotalPointSize:function(){return i._maxTotalPointSize}}}function P(e){for(var t=e.length,i=0;t>i;++i)e[i]&&e[i]._destroy()}function I(e){if(e._pointPrimitivesRemoved){e._pointPrimitivesRemoved=!1;for(var t=[],i=e._pointPrimitives,r=i.length,n=0,o=0;r>n;++n){var a=i[n];a&&(a._index=o++,t.push(a))}e._pointPrimitives=t}}function M(e,t,i){return new C(e,[{index:X.positionHighAndSize,componentsPerAttribute:4,componentDatatype:n.FLOAT,usage:i[z]},{index:X.positionLowAndShow,componentsPerAttribute:4,componentDatatype:n.FLOAT,usage:i[z]},{index:X.compressedAttribute0,componentsPerAttribute:4,componentDatatype:n.FLOAT,usage:i[U]},{index:X.compressedAttribute1,componentsPerAttribute:4,componentDatatype:n.FLOAT,usage:i[j]},{index:X.scaleByDistance,componentsPerAttribute:4,componentDatatype:n.FLOAT,usage:i[q]}],t)}function D(t,i,r,n){var o=n._index,a=n._getActualPosition();t._mode===b.SCENE3D&&(e.expand(t._baseVolume,a,t._baseVolume),t._boundingVolumeDirty=!0),c.fromCartesian(a,Z);var s=n.pixelSize,l=n.outlineWidth;t._maxPixelSize=Math.max(t._maxPixelSize,s+l);var u=r[X.positionHighAndSize],h=Z.high;u(o,h.x,h.y,h.z,s);var d=r[X.positionLowAndOutline],p=Z.low;d(o,p.x,p.y,p.z,l)}function R(e,t,i,n){var o=n._index,a=n.color,s=n.getPickId(t).color,l=n.outlineColor,u=r.floatToByte(a.red),c=r.floatToByte(a.green),h=r.floatToByte(a.blue),d=u*K+c*Q+h;u=r.floatToByte(l.red),c=r.floatToByte(l.green),h=r.floatToByte(l.blue);var p=u*K+c*Q+h;u=r.floatToByte(s.red),c=r.floatToByte(s.green),h=r.floatToByte(s.blue);var m=u*K+c*Q+h,f=r.floatToByte(a.alpha)*K+r.floatToByte(l.alpha)*Q+r.floatToByte(s.alpha),v=i[X.compressedAttribute0];v(o,d,p,m,f)}function O(e,t,i,r){var n=r._index,o=0,s=1,l=1,u=1,c=r.translucencyByDistance;a(c)&&(o=c.near,s=c.nearValue,l=c.far,u=c.farValue,(1!==s||1!==u)&&(e._shaderTranslucencyByDistance=!0));var d=r.show;0===r.color.alpha&&0===r.outlineColor.alpha&&(d=!1),s=h.clamp(s,0,1),s=1===s?255:255*s|0;var p=(d?1:0)*Q+s;u=h.clamp(u,0,1),u=1===u?255:255*u|0;var m=u,f=i[X.compressedAttribute1];f(n,p,m,o,l)}function N(e,t,i,r){var n=r._index,o=i[X.scaleByDistance],s=0,l=1,u=1,c=1,h=r.scaleByDistance;a(h)&&(s=h.near,l=h.nearValue,u=h.far,c=h.farValue,(1!==l||1!==c)&&(e._shaderScaleByDistance=!0)),o(n,s,l,u,c)}function L(e,t,i,r){D(e,t,i,r),R(e,t,i,r),O(e,t,i,r),N(e,t,i,r)}function F(t,i,r,n,o,s){var l;n.mode===b.SCENE3D?(l=t._baseVolume,t._boundingVolumeDirty=!0):l=t._baseVolume2D;for(var u=[],c=0;r>c;++c){var h=i[c],d=h.position,p=x._computeActualPosition(d,n,o);a(p)&&(h._setActualPosition(p),s?u.push(p):e.expand(l,p,l))}s&&e.fromPoints(u,l)}function B(e,t){var i=t.mode,r=e._pointPrimitives,n=e._pointPrimitivesToUpdate,o=e._modelMatrix;e._createVertexArray||e._mode!==i||i!==b.SCENE3D&&!d.equals(o,e.modelMatrix)?(e._mode=i,d.clone(e.modelMatrix,o),e._createVertexArray=!0,(i===b.SCENE3D||i===b.SCENE2D||i===b.COLUMBUS_VIEW)&&F(e,r,r.length,t,o,!0)):i===b.MORPHING?F(e,r,r.length,t,o,!0):(i===b.SCENE2D||i===b.COLUMBUS_VIEW)&&F(e,n,e._pointPrimitivesToUpdateIndex,t,o,!1); -}function V(e,t,i){var r=t.camera.getPixelSize(i,t.context.drawingBufferWidth,t.context.drawingBufferHeight),n=r*e._maxPixelSize;i.radius+=n}var k=x.SHOW_INDEX,z=x.POSITION_INDEX,U=x.COLOR_INDEX,G=x.OUTLINE_COLOR_INDEX,W=x.OUTLINE_WIDTH_INDEX,H=x.PIXEL_SIZE_INDEX,q=x.SCALE_BY_DISTANCE_INDEX,j=x.TRANSLUCENCY_BY_DISTANCE_INDEX,Y=x.NUMBER_OF_PROPERTIES,X={positionHighAndSize:0,positionLowAndOutline:1,compressedAttribute0:2,compressedAttribute1:3,scaleByDistance:4};s(A.prototype,{length:{get:function(){return I(this),this._pointPrimitives.length}}}),A.prototype.add=function(e){var t=new x(e,this);return t._index=this._pointPrimitives.length,this._pointPrimitives.push(t),this._createVertexArray=!0,t},A.prototype.remove=function(e){return this.contains(e)?(this._pointPrimitives[e._index]=null,this._pointPrimitivesRemoved=!0,this._createVertexArray=!0,e._destroy(),!0):!1},A.prototype.removeAll=function(){P(this._pointPrimitives),this._pointPrimitives=[],this._pointPrimitivesToUpdate=[],this._pointPrimitivesToUpdateIndex=0,this._pointPrimitivesRemoved=!1,this._createVertexArray=!0},A.prototype._updatePointPrimitive=function(e,t){e._dirty||(this._pointPrimitivesToUpdate[this._pointPrimitivesToUpdateIndex++]=e),++this._propertiesChanged[t]},A.prototype.contains=function(e){return a(e)&&e._pointPrimitiveCollection===this},A.prototype.get=function(e){return I(this),this._pointPrimitives[e]},A.prototype.computeNewBuffersUsage=function(){for(var e=this._buffersUsage,t=!1,i=this._propertiesChanged,r=0;Y>r;++r){var n=0===i[r]?m.STATIC_DRAW:m.STREAM_DRAW;t=t||e[r]!==n,e[r]=n}return t};var Z=new c,K=65536,Q=256,J=[];return A.prototype.update=function(t){I(this),this._maxTotalPointSize=f.maximumAliasedPointSize,B(this,t);var i,r=this._pointPrimitives,n=r.length,o=this._pointPrimitivesToUpdate,s=this._pointPrimitivesToUpdateIndex,l=this._propertiesChanged,u=this._createVertexArray,c=t.context,h=t.passes,m=h.pick;if(u||!m&&this.computeNewBuffersUsage()){this._createVertexArray=!1;for(var C=0;Y>C;++C)l[C]=0;if(this._vaf=this._vaf&&this._vaf.destroy(),n>0){this._vaf=M(c,n,this._buffersUsage),i=this._vaf.writers;for(var x=0;n>x;++x){var A=this._pointPrimitives[x];A._dirty=!1,L(this,c,i,A)}this._vaf.commit()}this._pointPrimitivesToUpdateIndex=0}else if(s>0){var P=J;P.length=0,(l[z]||l[W]||l[H])&&P.push(D),(l[U]||l[G])&&P.push(R),(l[k]||l[j])&&P.push(O),l[q]&&P.push(N);var F=P.length;if(i=this._vaf.writers,s/n>.1){for(var Z=0;s>Z;++Z){var K=o[Z];K._dirty=!1;for(var Q=0;F>Q;++Q)P[Q](this,c,i,K)}this._vaf.commit()}else{for(var $=0;s>$;++$){var ee=o[$];ee._dirty=!1;for(var te=0;F>te;++te)P[te](this,c,i,ee);this._vaf.subCommit(ee._index,1)}this._vaf.endSubCommits()}this._pointPrimitivesToUpdateIndex=0}if(s>1.5*n&&(o.length=n),a(this._vaf)&&a(this._vaf.va)){this._boundingVolumeDirty&&(this._boundingVolumeDirty=!1,e.transform(this._baseVolume,this.modelMatrix,this._baseVolumeWC));var ie,re=d.IDENTITY;t.mode===b.SCENE3D?(re=this.modelMatrix,ie=e.clone(this._baseVolumeWC,this._boundingVolume)):ie=e.clone(this._baseVolume2D,this._boundingVolume),V(this,t,ie);var ne,oe,ae,se,le,ue,ce=t.commandList;if(h.render){var he=this._colorCommands;for(a(this._rs)||(this._rs=g.fromCache({depthTest:{enabled:!0},blending:w.ALPHA_BLEND})),(!a(this._sp)||this._shaderScaleByDistance&&!this._compiledShaderScaleByDistance||this._shaderTranslucencyByDistance&&!this._compiledShaderTranslucencyByDistance)&&(le=new y({sources:[S]}),this._shaderScaleByDistance&&le.defines.push("EYE_DISTANCE_SCALING"),this._shaderTranslucencyByDistance&&le.defines.push("EYE_DISTANCE_TRANSLUCENCY"),this._sp=_.replaceCache({context:c,shaderProgram:this._sp,vertexShaderSource:le,fragmentShaderSource:E,attributeLocations:X}),this._compiledShaderScaleByDistance=this._shaderScaleByDistance,this._compiledShaderTranslucencyByDistance=this._shaderTranslucencyByDistance),ne=this._vaf.va,oe=ne.length,he.length=oe,se=0;oe>se;++se)ae=he[se],a(ae)||(ae=he[se]=new v({primitiveType:p.POINTS,pass:T.OPAQUE,owner:this})),ae.boundingVolume=ie,ae.modelMatrix=re,ae.shaderProgram=this._sp,ae.uniformMap=this._uniforms,ae.vertexArray=ne[se].va,ae.renderState=this._rs,ae.debugShowBoundingVolume=this.debugShowBoundingVolume,ce.push(ae)}if(m){var de=this._pickCommands;for((!a(this._spPick)||this._shaderScaleByDistance&&!this._compiledShaderScaleByDistancePick||this._shaderTranslucencyByDistance&&!this._compiledShaderTranslucencyByDistancePick)&&(le=new y({defines:["RENDER_FOR_PICK"],sources:[S]}),this._shaderScaleByDistance&&le.defines.push("EYE_DISTANCE_SCALING"),this._shaderTranslucencyByDistance&&le.defines.push("EYE_DISTANCE_TRANSLUCENCY"),ue=new y({defines:["RENDER_FOR_PICK"],sources:[E]}),this._spPick=_.replaceCache({context:c,shaderProgram:this._spPick,vertexShaderSource:le,fragmentShaderSource:ue,attributeLocations:X}),this._compiledShaderScaleByDistancePick=this._shaderScaleByDistance,this._compiledShaderTranslucencyByDistancePick=this._shaderTranslucencyByDistance),ne=this._vaf.va,oe=ne.length,de.length=oe,se=0;oe>se;++se)ae=de[se],a(ae)||(ae=de[se]=new v({primitiveType:p.POINTS,pass:T.OPAQUE,owner:this})),ae.boundingVolume=ie,ae.modelMatrix=re,ae.shaderProgram=this._spPick,ae.uniformMap=this._uniforms,ae.vertexArray=ne[se].va,ae.renderState=this._rs,ce.push(ae)}}},A.prototype.isDestroyed=function(){return!1},A.prototype.destroy=function(){return this._sp=this._sp&&this._sp.destroy(),this._spPick=this._spPick&&this._spPick.destroy(),this._vaf=this._vaf&&this._vaf.destroy(),P(this._pointPrimitives),l(this)},A}),i("DataSources/PointVisualizer",["../Core/AssociativeArray","../Core/Cartesian3","../Core/Color","../Core/defined","../Core/destroyObject","../Core/DeveloperError","../Core/NearFarScalar","../Scene/PointPrimitiveCollection","./BoundingSphereState","./Property"],function(e,t,i,r,n,o,a,s,l,u){"use strict";function c(e){this.entity=e,this.pointPrimitive=void 0,this.color=void 0,this.outlineColor=void 0,this.pixelSize=void 0,this.outlineWidth=void 0}function h(t,i){i.collectionChanged.addEventListener(h.prototype._onCollectionChanged,this),this._scene=t,this._unusedIndexes=[],this._entityCollection=i,this._pointPrimitiveCollection=void 0,this._items=new e,this._onCollectionChanged(i,i.values,[],[])}function d(e,t){if(r(e)){var i=e.pointPrimitive;r(i)&&(e.pointPrimitive=void 0,i.show=!1,t.push(i._index))}}var p=i.WHITE,m=i.BLACK,f=0,v=1,g=new i,_=new t,y=new i,C=new a,E=new a;return h.prototype.update=function(e){for(var t=this._items.values,i=this._unusedIndexes,n=0,o=t.length;o>n;n++){var a=t[n],l=a.entity,c=l._point,h=a.pointPrimitive,S=l.isShowing&&l.isAvailable(e)&&u.getValueOrDefault(c._show,e,!0);if(S&&(_=u.getValueOrUndefined(l._position,e,_),S=r(_)),S){if(!r(h)){var w=this._pointPrimitiveCollection;r(w)||(w=new s,this._pointPrimitiveCollection=w,this._scene.primitives.add(w));var T=i.length;h=T>0?w.get(i.pop()):w.add(),h.id=l,a.pointPrimitive=h}h.show=!0,h.position=_,h.scaleByDistance=u.getValueOrUndefined(c._scaleByDistance,e,C),h.translucencyByDistance=u.getValueOrUndefined(c._translucencyByDistance,e,E),h.color=u.getValueOrDefault(c._color,e,p,g),h.outlineColor=u.getValueOrDefault(c._outlineColor,e,m,y),h.outlineWidth=u.getValueOrDefault(c._outlineWidth,e,f),h.pixelSize=u.getValueOrDefault(c._pixelSize,e,v)}else d(a,i)}return!0},h.prototype.getBoundingSphere=function(e,i){var n=this._items.get(e.id);return r(n)&&r(n.pointPrimitive)?(i.center=t.clone(n.pointPrimitive.position,i.center),i.radius=0,l.DONE):l.FAILED},h.prototype.isDestroyed=function(){return!1},h.prototype.destroy=function(){return this._entityCollection.collectionChanged.removeEventListener(h.prototype._onCollectionChanged,this),r(this._pointPrimitiveCollection)&&this._scene.primitives.remove(this._pointPrimitiveCollection),n(this)},h.prototype._onCollectionChanged=function(e,t,i,n){var o,a,s=this._unusedIndexes,l=this._items;for(o=t.length-1;o>-1;o--)a=t[o],r(a._point)&&r(a._position)&&l.set(a.id,new c(a));for(o=n.length-1;o>-1;o--)a=n[o],r(a._point)&&r(a._position)?l.contains(a.id)||l.set(a.id,new c(a)):(d(l.get(a.id),s),l.remove(a.id));for(o=i.length-1;o>-1;o--)a=i[o],d(l.get(a.id),s),l.remove(a.id)},h}),i("DataSources/PolygonGeometryUpdater",["../Core/Color","../Core/ColorGeometryInstanceAttribute","../Core/defaultValue","../Core/defined","../Core/defineProperties","../Core/destroyObject","../Core/DeveloperError","../Core/Event","../Core/GeometryInstance","../Core/isArray","../Core/Iso8601","../Core/PolygonGeometry","../Core/PolygonHierarchy","../Core/PolygonOutlineGeometry","../Core/ShowGeometryInstanceAttribute","../Scene/MaterialAppearance","../Scene/PerInstanceColorAppearance","../Scene/Primitive","./ColorMaterialProperty","./ConstantProperty","./dynamicGeometryGetBoundingSphere","./MaterialProperty","./Property"],function(e,t,i,r,n,o,a,s,l,u,c,h,d,p,m,f,v,g,_,y,C,E,S){"use strict";function w(e){this.id=e,this.vertexFormat=void 0,this.polygonHierarchy=void 0,this.perPositionHeight=void 0,this.height=void 0,this.extrudedHeight=void 0,this.granularity=void 0,this.stRotation=void 0}function T(e,t){this._entity=e,this._scene=t,this._entitySubscription=e.definitionChanged.addEventListener(T.prototype._onEntityPropertyChanged,this),this._fillEnabled=!1,this._isClosed=!1,this._dynamic=!1,this._outlineEnabled=!1,this._geometryChanged=new s,this._showProperty=void 0,this._materialProperty=void 0,this._hasConstantOutline=!0,this._showOutlineProperty=void 0,this._outlineColorProperty=void 0,this._outlineWidth=1,this._options=new w(e),this._onEntityPropertyChanged(e,"polygon",e.polygon,void 0)}function x(e,t){this._primitives=e,this._primitive=void 0,this._outlinePrimitive=void 0,this._geometryUpdater=t,this._options=new w(t._entity)}var b=new _(e.WHITE),A=new y(!0),P=new y(!0),I=new y(!1),M=new y(e.BLACK),D=new e;return n(T,{perInstanceColorAppearanceType:{value:v},materialAppearanceType:{value:f}}),n(T.prototype,{entity:{get:function(){return this._entity}},fillEnabled:{get:function(){return this._fillEnabled}},hasConstantFill:{get:function(){return!this._fillEnabled||!r(this._entity.availability)&&S.isConstant(this._showProperty)&&S.isConstant(this._fillProperty)}},fillMaterialProperty:{get:function(){return this._materialProperty}},outlineEnabled:{get:function(){return this._outlineEnabled}},hasConstantOutline:{get:function(){return!this._outlineEnabled||!r(this._entity.availability)&&S.isConstant(this._showProperty)&&S.isConstant(this._showOutlineProperty)}},outlineColorProperty:{get:function(){return this._outlineColorProperty}},outlineWidth:{get:function(){return this._outlineWidth}},isDynamic:{get:function(){return this._dynamic}},isClosed:{get:function(){return this._isClosed}},geometryChanged:{get:function(){return this._geometryChanged}}}),T.prototype.isOutlineVisible=function(e){var t=this._entity;return this._outlineEnabled&&t.isAvailable(e)&&this._showProperty.getValue(e)&&this._showOutlineProperty.getValue(e)},T.prototype.isFilled=function(e){var t=this._entity;return this._fillEnabled&&t.isAvailable(e)&&this._showProperty.getValue(e)&&this._fillProperty.getValue(e)},T.prototype.createFillGeometryInstance=function(i){var n,o,a=this._entity,s=a.isAvailable(i),u=new m(s&&a.isShowing&&this._showProperty.getValue(i)&&this._fillProperty.getValue(i));if(this._materialProperty instanceof _){var c=e.WHITE;r(this._materialProperty.color)&&(this._materialProperty.color.isConstant||s)&&(c=this._materialProperty.color.getValue(i)),o=t.fromColor(c),n={show:u,color:o}}else n={show:u};return new l({id:a,geometry:new h(this._options),attributes:n})},T.prototype.createOutlineGeometryInstance=function(i){var r=this._entity,n=r.isAvailable(i),o=S.getValueOrDefault(this._outlineColorProperty,i,e.BLACK);return new l({id:r,geometry:new p(this._options),attributes:{show:new m(n&&r.isShowing&&this._showProperty.getValue(i)&&this._showOutlineProperty.getValue(i)),color:t.fromColor(o)}})},T.prototype.isDestroyed=function(){return!1},T.prototype.destroy=function(){this._entitySubscription(),o(this)},T.prototype._onEntityPropertyChanged=function(e,t,n,o){if("availability"===t||"polygon"===t){var a=this._entity.polygon;if(!r(a))return void((this._fillEnabled||this._outlineEnabled)&&(this._fillEnabled=!1,this._outlineEnabled=!1,this._geometryChanged.raiseEvent(this)));var s=a.fill,l=r(s)&&s.isConstant?s.getValue(c.MINIMUM_VALUE):!0,h=a.outline,p=r(h);if(p&&h.isConstant&&(p=h.getValue(c.MINIMUM_VALUE)),!l&&!p)return void((this._fillEnabled||this._outlineEnabled)&&(this._fillEnabled=!1,this._outlineEnabled=!1,this._geometryChanged.raiseEvent(this)));var m=a.hierarchy,g=a.show;if(r(g)&&g.isConstant&&!g.getValue(c.MINIMUM_VALUE)||!r(m))return void((this._fillEnabled||this._outlineEnabled)&&(this._fillEnabled=!1,this._outlineEnabled=!1,this._geometryChanged.raiseEvent(this)));var y=i(a.material,b),C=y instanceof _;this._materialProperty=y,this._fillProperty=i(s,P),this._showProperty=i(g,A),this._showOutlineProperty=i(a.outline,I),this._outlineColorProperty=p?i(a.outlineColor,M):void 0;var E=a.height,w=a.extrudedHeight,T=a.granularity,x=a.stRotation,D=a.outlineWidth,R=a.perPositionHeight;if(this._fillEnabled=l,this._outlineEnabled=p,m.isConstant&&S.isConstant(E)&&S.isConstant(w)&&S.isConstant(T)&&S.isConstant(x)&&S.isConstant(D)&&S.isConstant(R)){var O=this._options;O.vertexFormat=C?v.VERTEX_FORMAT:f.MaterialSupport.TEXTURED.vertexFormat;var N=m.getValue(c.MINIMUM_VALUE);u(N)&&(N=new d(N));var L=r(E)?E.getValue(c.MINIMUM_VALUE):void 0,F=r(w)?w.getValue(c.MINIMUM_VALUE):void 0;O.polygonHierarchy=N,O.height=L,O.extrudedHeight=F,O.granularity=r(T)?T.getValue(c.MINIMUM_VALUE):void 0,O.stRotation=r(x)?x.getValue(c.MINIMUM_VALUE):void 0,O.perPositionHeight=r(R)?R.getValue(c.MINIMUM_VALUE):void 0,this._outlineWidth=r(D)?D.getValue(c.MINIMUM_VALUE):1,this._isClosed=r(F)&&F!==L,this._dynamic=!1,this._geometryChanged.raiseEvent(this)}else this._dynamic||(this._dynamic=!0,this._geometryChanged.raiseEvent(this))}},T.prototype.createDynamicUpdater=function(e){return new x(e,this)},x.prototype.update=function(i){var n=this._primitives;n.removeAndDestroy(this._primitive),n.removeAndDestroy(this._outlinePrimitive),this._primitive=void 0,this._outlinePrimitive=void 0;var o=this._geometryUpdater,a=o._entity,s=a.polygon;if(a.isShowing&&a.isAvailable(i)&&S.getValueOrDefault(s.show,i,!0)){var c=this._options,m=S.getValueOrUndefined(s.hierarchy,i);if(r(m)){if(u(m)?c.polygonHierarchy=new d(m):c.polygonHierarchy=m,c.height=S.getValueOrUndefined(s.height,i),c.extrudedHeight=S.getValueOrUndefined(s.extrudedHeight,i),c.granularity=S.getValueOrUndefined(s.granularity,i),c.stRotation=S.getValueOrUndefined(s.stRotation,i),c.perPositionHeight=S.getValueOrUndefined(s.perPositionHeight,i),S.getValueOrDefault(s.fill,i,!0)){var _=E.getValue(i,o.fillMaterialProperty,this._material);this._material=_;var y=new f({material:_,translucent:_.isTranslucent(),closed:r(c.extrudedHeight)&&c.extrudedHeight!==c.height});c.vertexFormat=y.vertexFormat,this._primitive=n.add(new g({geometryInstances:new l({id:a,geometry:new h(c)}),appearance:y,asynchronous:!1}))}if(S.getValueOrDefault(s.outline,i,!1)){c.vertexFormat=v.VERTEX_FORMAT;var C=S.getValueOrClonedDefault(s.outlineColor,i,e.BLACK,D),w=S.getValueOrDefault(s.outlineWidth,i,1),T=1!==C.alpha;this._outlinePrimitive=n.add(new g({geometryInstances:new l({id:a,geometry:new p(c),attributes:{color:t.fromColor(C)}}),appearance:new v({flat:!0,translucent:T,renderState:{lineWidth:o._scene.clampLineWidth(w)}}),asynchronous:!1}))}}}},x.prototype.getBoundingSphere=function(e,t){return C(e,this._primitive,this._outlinePrimitive,t)},x.prototype.isDestroyed=function(){return!1},x.prototype.destroy=function(){var e=this._primitives;e.removeAndDestroy(this._primitive),e.removeAndDestroy(this._outlinePrimitive),o(this)},T}),i("Shaders/Appearances/PolylineColorAppearanceVS",[],function(){"use strict";return"attribute vec3 position3DHigh;\nattribute vec3 position3DLow;\nattribute vec3 prevPosition3DHigh;\nattribute vec3 prevPosition3DLow;\nattribute vec3 nextPosition3DHigh;\nattribute vec3 nextPosition3DLow;\nattribute vec2 expandAndWidth;\nattribute vec4 color;\nvarying vec4 v_color;\nvoid main()\n{\nfloat expandDir = expandAndWidth.x;\nfloat width = abs(expandAndWidth.y) + 0.5;\nbool usePrev = expandAndWidth.y < 0.0;\nvec4 p = czm_computePosition();\nvec4 prev = czm_computePrevPosition();\nvec4 next = czm_computeNextPosition();\nv_color = color;\nvec4 positionWC = getPolylineWindowCoordinates(p, prev, next, expandDir, width, usePrev);\ngl_Position = czm_viewportOrthographic * positionWC;\n}\n"}),i("Scene/PolylineColorAppearance",["../Core/defaultValue","../Core/defineProperties","../Core/VertexFormat","../Shaders/Appearances/PerInstanceFlatColorAppearanceFS","../Shaders/Appearances/PolylineColorAppearanceVS","../Shaders/PolylineCommon","./Appearance"],function(e,t,i,r,n,o,a){"use strict";function s(t){t=e(t,e.EMPTY_OBJECT);var i=e(t.translucent,!0),r=!1,n=s.VERTEX_FORMAT;this.material=void 0,this.translucent=i,this._vertexShaderSource=e(t.vertexShaderSource,l),this._fragmentShaderSource=e(t.fragmentShaderSource,u),this._renderState=a.getDefaultRenderState(i,r,t.renderState),this._closed=r,this._vertexFormat=n}var l=o+"\n"+n,u=r;return t(s.prototype,{vertexShaderSource:{get:function(){return this._vertexShaderSource}},fragmentShaderSource:{get:function(){return this._fragmentShaderSource}},renderState:{get:function(){return this._renderState}},closed:{get:function(){return this._closed}},vertexFormat:{get:function(){return this._vertexFormat}}}),s.VERTEX_FORMAT=i.POSITION_ONLY,s.prototype.getFragmentShaderSource=a.prototype.getFragmentShaderSource,s.prototype.isTranslucent=a.prototype.isTranslucent,s.prototype.getRenderState=a.prototype.getRenderState,s}),i("Shaders/Appearances/PolylineMaterialAppearanceVS",[],function(){"use strict";return"attribute vec3 position3DHigh;\nattribute vec3 position3DLow;\nattribute vec3 prevPosition3DHigh;\nattribute vec3 prevPosition3DLow;\nattribute vec3 nextPosition3DHigh;\nattribute vec3 nextPosition3DLow;\nattribute vec2 expandAndWidth;\nattribute vec2 st;\nvarying float v_width;\nvarying vec2 v_st;\nvoid main()\n{\nfloat expandDir = expandAndWidth.x;\nfloat width = abs(expandAndWidth.y) + 0.5;\nbool usePrev = expandAndWidth.y < 0.0;\nvec4 p = czm_computePosition();\nvec4 prev = czm_computePrevPosition();\nvec4 next = czm_computeNextPosition();\nv_width = width;\nv_st = st;\nvec4 positionWC = getPolylineWindowCoordinates(p, prev, next, expandDir, width, usePrev);\ngl_Position = czm_viewportOrthographic * positionWC;\n}\n"}),i("Scene/PolylineMaterialAppearance",["../Core/defaultValue","../Core/defined","../Core/defineProperties","../Core/VertexFormat","../Shaders/Appearances/PolylineMaterialAppearanceVS","../Shaders/PolylineCommon","../Shaders/PolylineFS","./Appearance","./Material"],function(e,t,i,r,n,o,a,s,l){"use strict";function u(i){i=e(i,e.EMPTY_OBJECT);var r=e(i.translucent,!0),n=!1,o=u.VERTEX_FORMAT;this.material=t(i.material)?i.material:l.fromType(l.ColorType),this.translucent=r,this._vertexShaderSource=e(i.vertexShaderSource,c),this._fragmentShaderSource=e(i.fragmentShaderSource,h),this._renderState=s.getDefaultRenderState(r,n,i.renderState),this._closed=n,this._vertexFormat=o}var c=o+"\n"+n,h=a;return i(u.prototype,{vertexShaderSource:{get:function(){return this._vertexShaderSource}},fragmentShaderSource:{get:function(){return this._fragmentShaderSource}},renderState:{get:function(){return this._renderState}},closed:{get:function(){return this._closed}},vertexFormat:{get:function(){return this._vertexFormat}}}),u.VERTEX_FORMAT=r.POSITION_AND_ST,u.prototype.getFragmentShaderSource=s.prototype.getFragmentShaderSource,u.prototype.isTranslucent=s.prototype.isTranslucent,u.prototype.getRenderState=s.prototype.getRenderState,u}),i("DataSources/PolylineGeometryUpdater",["../Core/BoundingSphere","../Core/Color","../Core/ColorGeometryInstanceAttribute","../Core/defaultValue","../Core/defined","../Core/defineProperties","../Core/destroyObject","../Core/DeveloperError","../Core/Ellipsoid","../Core/Event","../Core/GeometryInstance","../Core/Iso8601","../Core/PolylineGeometry","../Core/PolylinePipeline","../Core/ShowGeometryInstanceAttribute","../Scene/PolylineCollection","../Scene/PolylineColorAppearance","../Scene/PolylineMaterialAppearance","./BoundingSphereState","./ColorMaterialProperty","./ConstantProperty","./MaterialProperty","./Property"],function(e,t,i,r,n,o,a,s,l,u,c,h,d,p,m,f,v,g,_,y,C,E,S){"use strict";function w(e){this.id=e,this.vertexFormat=void 0,this.positions=void 0,this.width=void 0,this.followSurface=void 0,this.granularity=void 0}function T(e,t){this._entity=e,this._scene=t,this._entitySubscription=e.definitionChanged.addEventListener(T.prototype._onEntityPropertyChanged,this),this._fillEnabled=!1,this._dynamic=!1,this._geometryChanged=new u,this._showProperty=void 0,this._materialProperty=void 0,this._options=new w(e),this._onEntityPropertyChanged(e,"polyline",e.polyline,void 0)}function x(e,t){var i=t._scene.id,r=b[i];!n(r)||r.isDestroyed()?(r=new f,b[i]=r,e.add(r)):e.contains(r)||e.add(r);var o=r.add();o.id=t._entity,this._line=o,this._primitives=e,this._geometryUpdater=t,this._positions=[],I.ellipsoid=t._scene.globe.ellipsoid}var b={},A=new y(t.WHITE),P=new C(!0);o(T,{perInstanceColorAppearanceType:{value:v},materialAppearanceType:{value:g}}),o(T.prototype,{entity:{get:function(){return this._entity}},fillEnabled:{get:function(){return this._fillEnabled}},hasConstantFill:{get:function(){return!this._fillEnabled||!n(this._entity.availability)&&S.isConstant(this._showProperty)}},fillMaterialProperty:{get:function(){return this._materialProperty}},outlineEnabled:{value:!1},hasConstantOutline:{value:!0},outlineColorProperty:{value:void 0},isDynamic:{get:function(){return this._dynamic}},isClosed:{value:!1},geometryChanged:{get:function(){return this._geometryChanged}}}),T.prototype.isOutlineVisible=function(e){return!1},T.prototype.isFilled=function(e){var t=this._entity;return this._fillEnabled&&t.isAvailable(e)&&this._showProperty.getValue(e)},T.prototype.createFillGeometryInstance=function(e){var r,o,a=this._entity,s=a.isAvailable(e),l=new m(s&&a.isShowing&&this._showProperty.getValue(e));if(this._materialProperty instanceof y){var u=t.WHITE;n(this._materialProperty.color)&&(this._materialProperty.color.isConstant||s)&&(u=this._materialProperty.color.getValue(e)),r=i.fromColor(u),o={show:l,color:r}}else o={show:l};return new c({id:a,geometry:new d(this._options),attributes:o})},T.prototype.createOutlineGeometryInstance=function(e){},T.prototype.isDestroyed=function(){return!1},T.prototype.destroy=function(){this._entitySubscription(),a(this)},T.prototype._onEntityPropertyChanged=function(e,t,i,o){if("availability"===t||"polyline"===t){var a=this._entity.polyline;if(!n(a))return void(this._fillEnabled&&(this._fillEnabled=!1,this._geometryChanged.raiseEvent(this)));var s=a.positions,l=a.show;if(n(l)&&l.isConstant&&!l.getValue(h.MINIMUM_VALUE)||!n(s))return void(this._fillEnabled&&(this._fillEnabled=!1,this._geometryChanged.raiseEvent(this)));var u=r(a.material,A),c=u instanceof y;this._materialProperty=u,this._showProperty=r(l,P),this._fillEnabled=!0;var d=a.width,p=a.followSurface,m=a.granularity;if(s.isConstant&&S.isConstant(d)&&S.isConstant(p)&&S.isConstant(m)){var f=this._options,_=s.getValue(h.MINIMUM_VALUE,f.positions);if(!n(_)||_.length<2)return void(this._fillEnabled&&(this._fillEnabled=!1,this._geometryChanged.raiseEvent(this)));f.vertexFormat=c?v.VERTEX_FORMAT:g.VERTEX_FORMAT,f.positions=_,f.width=n(d)?d.getValue(h.MINIMUM_VALUE):void 0,f.followSurface=n(p)?p.getValue(h.MINIMUM_VALUE):void 0,f.granularity=n(m)?m.getValue(h.MINIMUM_VALUE):void 0,this._dynamic=!1,this._geometryChanged.raiseEvent(this)}else this._dynamic||(this._dynamic=!0,this._geometryChanged.raiseEvent(this))}},T.prototype.createDynamicUpdater=function(e){return new x(e,this)};var I={positions:void 0,granularity:void 0,height:void 0,ellipsoid:void 0};return x.prototype.update=function(e){var t=this._geometryUpdater,i=t._entity,r=i.polyline,o=this._line;if(!i.isShowing||!i.isAvailable(e)||!S.getValueOrDefault(r._show,e,!0))return void(o.show=!1);var a=r.positions,s=S.getValueOrUndefined(a,e,this._positions);if(!n(s)||s.length<2)return void(o.show=!1);var l=S.getValueOrDefault(r._followSurface,e,!0);l&&(I.positions=s,I.granularity=S.getValueOrUndefined(r._granularity,e),I.height=p.extractHeights(s,this._geometryUpdater._scene.globe.ellipsoid),s=p.generateCartesianArc(I)),o.show=!0,o.positions=s.slice(),o.material=E.getValue(e,t.fillMaterialProperty,o.material),o.width=S.getValueOrDefault(r._width,e,1)},x.prototype.getBoundingSphere=function(t,i){var r=this._line;return r.show&&r.positions.length>0?(e.fromPoints(r.positions,i),_.DONE):_.FAILED},x.prototype.isDestroyed=function(){return!1},x.prototype.destroy=function(){var e=this._geometryUpdater,t=e._scene.id,i=b[t];i.remove(this._line),0===i.length&&(this._primitives.removeAndDestroy(i),delete b[t]),a(this)},T}),i("DataSources/PolylineVolumeGeometryUpdater",["../Core/Color","../Core/ColorGeometryInstanceAttribute","../Core/defaultValue","../Core/defined","../Core/defineProperties","../Core/destroyObject","../Core/DeveloperError","../Core/Event","../Core/GeometryInstance","../Core/Iso8601","../Core/PolylineVolumeGeometry","../Core/PolylineVolumeOutlineGeometry","../Core/ShowGeometryInstanceAttribute","../Scene/MaterialAppearance","../Scene/PerInstanceColorAppearance","../Scene/Primitive","./ColorMaterialProperty","./ConstantProperty","./dynamicGeometryGetBoundingSphere","./MaterialProperty","./Property"],function(e,t,i,r,n,o,a,s,l,u,c,h,d,p,m,f,v,g,_,y,C){"use strict";function E(e){this.id=e,this.vertexFormat=void 0,this.polylinePositions=void 0,this.shapePositions=void 0,this.cornerType=void 0,this.granularity=void 0}function S(e,t){this._entity=e,this._scene=t,this._entitySubscription=e.definitionChanged.addEventListener(S.prototype._onEntityPropertyChanged,this),this._fillEnabled=!1,this._dynamic=!1,this._outlineEnabled=!1,this._geometryChanged=new s,this._showProperty=void 0,this._materialProperty=void 0,this._hasConstantOutline=!0,this._showOutlineProperty=void 0,this._outlineColorProperty=void 0,this._outlineWidth=1,this._options=new E(e),this._onEntityPropertyChanged(e,"polylineVolume",e.polylineVolume,void 0)}function w(e,t){this._primitives=e,this._primitive=void 0,this._outlinePrimitive=void 0,this._geometryUpdater=t,this._options=new E(t._entity)}var T=new v(e.WHITE),x=new g(!0),b=new g(!0),A=new g(!1),P=new g(e.BLACK),I=new e;return n(S,{perInstanceColorAppearanceType:{value:m},materialAppearanceType:{value:p}}),n(S.prototype,{entity:{get:function(){return this._entity}},fillEnabled:{get:function(){return this._fillEnabled}},hasConstantFill:{get:function(){return!this._fillEnabled||!r(this._entity.availability)&&C.isConstant(this._showProperty)&&C.isConstant(this._fillProperty)}},fillMaterialProperty:{get:function(){return this._materialProperty}},outlineEnabled:{get:function(){return this._outlineEnabled}},hasConstantOutline:{get:function(){return!this._outlineEnabled||!r(this._entity.availability)&&C.isConstant(this._showProperty)&&C.isConstant(this._showOutlineProperty)}},outlineColorProperty:{get:function(){return this._outlineColorProperty}},outlineWidth:{get:function(){return this._outlineWidth}},isDynamic:{get:function(){return this._dynamic}},isClosed:{value:!0},geometryChanged:{get:function(){return this._geometryChanged}}}),S.prototype.isOutlineVisible=function(e){var t=this._entity;return this._outlineEnabled&&t.isAvailable(e)&&this._showProperty.getValue(e)&&this._showOutlineProperty.getValue(e)},S.prototype.isFilled=function(e){var t=this._entity;return this._fillEnabled&&t.isAvailable(e)&&this._showProperty.getValue(e)&&this._fillProperty.getValue(e)},S.prototype.createFillGeometryInstance=function(i){var n,o,a=this._entity,s=a.isAvailable(i),u=new d(s&&a.isShowing&&this._showProperty.getValue(i)&&this._fillProperty.getValue(i));if(this._materialProperty instanceof v){var h=e.WHITE;r(this._materialProperty.color)&&(this._materialProperty.color.isConstant||s)&&(h=this._materialProperty.color.getValue(i)),o=t.fromColor(h),n={show:u,color:o}}else n={show:u};return new l({id:a,geometry:new c(this._options),attributes:n})},S.prototype.createOutlineGeometryInstance=function(i){var r=this._entity,n=r.isAvailable(i),o=C.getValueOrDefault(this._outlineColorProperty,i,e.BLACK);return new l({id:r,geometry:new h(this._options),attributes:{show:new d(n&&r.isShowing&&this._showProperty.getValue(i)&&this._showOutlineProperty.getValue(i)),color:t.fromColor(o)}})},S.prototype.isDestroyed=function(){return!1},S.prototype.destroy=function(){this._entitySubscription(),o(this)},S.prototype._onEntityPropertyChanged=function(e,t,n,o){if("availability"===t||"polylineVolume"===t){var a=this._entity.polylineVolume;if(!r(a))return void((this._fillEnabled||this._outlineEnabled)&&(this._fillEnabled=!1,this._outlineEnabled=!1,this._geometryChanged.raiseEvent(this)));var s=a.fill,l=r(s)&&s.isConstant?s.getValue(u.MINIMUM_VALUE):!0,c=a.outline,h=r(c);if(h&&c.isConstant&&(h=c.getValue(u.MINIMUM_VALUE)),!l&&!h)return void((this._fillEnabled||this._outlineEnabled)&&(this._fillEnabled=!1,this._outlineEnabled=!1,this._geometryChanged.raiseEvent(this)));var d=a.positions,f=a.shape,g=a.show;if(!r(d)||!r(f)||r(g)&&g.isConstant&&!g.getValue(u.MINIMUM_VALUE))return void((this._fillEnabled||this._outlineEnabled)&&(this._fillEnabled=!1,this._outlineEnabled=!1,this._geometryChanged.raiseEvent(this)));var _=i(a.material,T),y=_ instanceof v;this._materialProperty=_,this._fillProperty=i(s,b),this._showProperty=i(g,x),this._showOutlineProperty=i(a.outline,A),this._outlineColorProperty=h?i(a.outlineColor,P):void 0;var E=a.granularity,S=a.outlineWidth,w=a.cornerType;if(this._fillEnabled=l,this._outlineEnabled=h,d.isConstant&&f.isConstant&&C.isConstant(E)&&C.isConstant(S)&&C.isConstant(w)){var I=this._options;I.vertexFormat=y?m.VERTEX_FORMAT:p.MaterialSupport.TEXTURED.vertexFormat,I.polylinePositions=d.getValue(u.MINIMUM_VALUE,I.polylinePositions),I.shapePositions=f.getValue(u.MINIMUM_VALUE,I.shape),I.granularity=r(E)?E.getValue(u.MINIMUM_VALUE):void 0,I.cornerType=r(w)?w.getValue(u.MINIMUM_VALUE):void 0,this._outlineWidth=r(S)?S.getValue(u.MINIMUM_VALUE):1,this._dynamic=!1,this._geometryChanged.raiseEvent(this)}else this._dynamic||(this._dynamic=!0,this._geometryChanged.raiseEvent(this))}},S.prototype.createDynamicUpdater=function(e){return new w(e,this)},w.prototype.update=function(i){var n=this._primitives;n.removeAndDestroy(this._primitive),n.removeAndDestroy(this._outlinePrimitive),this._primitive=void 0,this._outlinePrimitive=void 0;var o=this._geometryUpdater,a=o._entity,s=a.polylineVolume;if(a.isShowing&&a.isAvailable(i)&&C.getValueOrDefault(s.show,i,!0)){var u=this._options,d=C.getValueOrUndefined(s.positions,i,u.polylinePositions),v=C.getValueOrUndefined(s.shape,i);if(r(d)&&r(v)){if(u.polylinePositions=d,u.shapePositions=v,u.granularity=C.getValueOrUndefined(s.granularity,i),u.cornerType=C.getValueOrUndefined(s.cornerType,i),!r(s.fill)||s.fill.getValue(i)){var g=y.getValue(i,o.fillMaterialProperty,this._material);this._material=g;var _=new p({material:g,translucent:g.isTranslucent(),closed:!0});u.vertexFormat=_.vertexFormat,this._primitive=n.add(new f({geometryInstances:new l({id:a,geometry:new c(u)}),appearance:_,asynchronous:!1}))}if(r(s.outline)&&s.outline.getValue(i)){u.vertexFormat=m.VERTEX_FORMAT;var E=C.getValueOrClonedDefault(s.outlineColor,i,e.BLACK,I),S=C.getValueOrDefault(s.outlineWidth,i,1),w=1!==E.alpha;this._outlinePrimitive=n.add(new f({geometryInstances:new l({id:a,geometry:new h(u),attributes:{color:t.fromColor(E)}}),appearance:new m({flat:!0,translucent:w,renderState:{lineWidth:o._scene.clampLineWidth(S)}}),asynchronous:!1}))}}}},w.prototype.getBoundingSphere=function(e,t){return _(e,this._primitive,this._outlinePrimitive,t)},w.prototype.isDestroyed=function(){ -return!1},w.prototype.destroy=function(){var e=this._primitives;e.removeAndDestroy(this._primitive),e.removeAndDestroy(this._outlinePrimitive),o(this)},S}),i("DataSources/RectangleGeometryUpdater",["../Core/Color","../Core/ColorGeometryInstanceAttribute","../Core/defaultValue","../Core/defined","../Core/defineProperties","../Core/destroyObject","../Core/DeveloperError","../Core/Event","../Core/GeometryInstance","../Core/Iso8601","../Core/RectangleGeometry","../Core/RectangleOutlineGeometry","../Core/ShowGeometryInstanceAttribute","../Scene/MaterialAppearance","../Scene/PerInstanceColorAppearance","../Scene/Primitive","./ColorMaterialProperty","./ConstantProperty","./dynamicGeometryGetBoundingSphere","./MaterialProperty","./Property"],function(e,t,i,r,n,o,a,s,l,u,c,h,d,p,m,f,v,g,_,y,C){"use strict";function E(e){this.id=e,this.vertexFormat=void 0,this.rectangle=void 0,this.closeBottom=void 0,this.closeTop=void 0,this.height=void 0,this.extrudedHeight=void 0,this.granularity=void 0,this.stRotation=void 0,this.rotation=void 0}function S(e,t){this._entity=e,this._scene=t,this._entitySubscription=e.definitionChanged.addEventListener(S.prototype._onEntityPropertyChanged,this),this._fillEnabled=!1,this._isClosed=!1,this._dynamic=!1,this._outlineEnabled=!1,this._geometryChanged=new s,this._showProperty=void 0,this._materialProperty=void 0,this._hasConstantOutline=!0,this._showOutlineProperty=void 0,this._outlineColorProperty=void 0,this._outlineWidth=1,this._options=new E(e),this._onEntityPropertyChanged(e,"rectangle",e.rectangle,void 0)}function w(e,t){this._primitives=e,this._primitive=void 0,this._outlinePrimitive=void 0,this._geometryUpdater=t,this._options=new E(t._entity)}var T=new v(e.WHITE),x=new g(!0),b=new g(!0),A=new g(!1),P=new g(e.BLACK),I=new e;return n(S,{perInstanceColorAppearanceType:{value:m},materialAppearanceType:{value:p}}),n(S.prototype,{entity:{get:function(){return this._entity}},fillEnabled:{get:function(){return this._fillEnabled}},hasConstantFill:{get:function(){return!this._fillEnabled||!r(this._entity.availability)&&C.isConstant(this._showProperty)&&C.isConstant(this._fillProperty)}},fillMaterialProperty:{get:function(){return this._materialProperty}},outlineEnabled:{get:function(){return this._outlineEnabled}},hasConstantOutline:{get:function(){return!this._outlineEnabled||!r(this._entity.availability)&&C.isConstant(this._showProperty)&&C.isConstant(this._showOutlineProperty)}},outlineColorProperty:{get:function(){return this._outlineColorProperty}},outlineWidth:{get:function(){return this._outlineWidth}},isDynamic:{get:function(){return this._dynamic}},isClosed:{get:function(){return this._isClosed}},geometryChanged:{get:function(){return this._geometryChanged}}}),S.prototype.isOutlineVisible=function(e){var t=this._entity;return this._outlineEnabled&&t.isAvailable(e)&&this._showProperty.getValue(e)&&this._showOutlineProperty.getValue(e)},S.prototype.isFilled=function(e){var t=this._entity;return this._fillEnabled&&t.isAvailable(e)&&this._showProperty.getValue(e)&&this._fillProperty.getValue(e)},S.prototype.createFillGeometryInstance=function(i){var n,o,a=this._entity,s=a.isAvailable(i),u=new d(s&&a.isShowing&&this._showProperty.getValue(i)&&this._fillProperty.getValue(i));if(this._materialProperty instanceof v){var h=e.WHITE;r(this._materialProperty.color)&&(this._materialProperty.color.isConstant||s)&&(h=this._materialProperty.color.getValue(i)),o=t.fromColor(h),n={show:u,color:o}}else n={show:u};return new l({id:a,geometry:new c(this._options),attributes:n})},S.prototype.createOutlineGeometryInstance=function(i){var r=this._entity,n=r.isAvailable(i),o=C.getValueOrDefault(this._outlineColorProperty,i,e.BLACK);return new l({id:r,geometry:new h(this._options),attributes:{show:new d(n&&r.isShowing&&this._showProperty.getValue(i)&&this._showOutlineProperty.getValue(i)),color:t.fromColor(o)}})},S.prototype.isDestroyed=function(){return!1},S.prototype.destroy=function(){this._entitySubscription(),o(this)},S.prototype._onEntityPropertyChanged=function(e,t,n,o){if("availability"===t||"rectangle"===t){var a=this._entity.rectangle;if(!r(a))return void((this._fillEnabled||this._outlineEnabled)&&(this._fillEnabled=!1,this._outlineEnabled=!1,this._geometryChanged.raiseEvent(this)));var s=a.fill,l=r(s)&&s.isConstant?s.getValue(u.MINIMUM_VALUE):!0,c=a.outline,h=r(c);if(h&&c.isConstant&&(h=c.getValue(u.MINIMUM_VALUE)),!l&&!h)return void((this._fillEnabled||this._outlineEnabled)&&(this._fillEnabled=!1,this._outlineEnabled=!1,this._geometryChanged.raiseEvent(this)));var d=a.coordinates,f=a.show;if(r(f)&&f.isConstant&&!f.getValue(u.MINIMUM_VALUE)||!r(d))return void((this._fillEnabled||this._outlineEnabled)&&(this._fillEnabled=!1,this._outlineEnabled=!1,this._geometryChanged.raiseEvent(this)));var g=i(a.material,T),_=g instanceof v;this._materialProperty=g,this._fillProperty=i(s,b),this._showProperty=i(f,x),this._showOutlineProperty=i(a.outline,A),this._outlineColorProperty=h?i(a.outlineColor,P):void 0;var y=a.height,E=a.extrudedHeight,S=a.granularity,w=a.stRotation,I=a.rotation,M=a.outlineWidth,D=a.closeBottom,R=a.closeTop;if(this._fillEnabled=l,this._outlineEnabled=h,d.isConstant&&C.isConstant(y)&&C.isConstant(E)&&C.isConstant(S)&&C.isConstant(w)&&C.isConstant(I)&&C.isConstant(M)&&C.isConstant(D)&&C.isConstant(R)){var O=this._options;O.vertexFormat=_?m.VERTEX_FORMAT:p.MaterialSupport.TEXTURED.vertexFormat,O.rectangle=d.getValue(u.MINIMUM_VALUE,O.rectangle),O.height=r(y)?y.getValue(u.MINIMUM_VALUE):void 0,O.extrudedHeight=r(E)?E.getValue(u.MINIMUM_VALUE):void 0,O.granularity=r(S)?S.getValue(u.MINIMUM_VALUE):void 0,O.stRotation=r(w)?w.getValue(u.MINIMUM_VALUE):void 0,O.rotation=r(I)?I.getValue(u.MINIMUM_VALUE):void 0,O.closeBottom=r(D)?D.getValue(u.MINIMUM_VALUE):void 0,O.closeTop=r(R)?R.getValue(u.MINIMUM_VALUE):void 0,this._isClosed=r(E)&&r(O.closeTop)&&r(O.closeBottom)&&O.closeTop&&O.closeBottom,this._outlineWidth=r(M)?M.getValue(u.MINIMUM_VALUE):1,this._dynamic=!1,this._geometryChanged.raiseEvent(this)}else this._dynamic||(this._dynamic=!0,this._geometryChanged.raiseEvent(this))}},S.prototype.createDynamicUpdater=function(e){return new w(e,this)},w.prototype.update=function(i){var n=this._primitives;n.removeAndDestroy(this._primitive),n.removeAndDestroy(this._outlinePrimitive),this._primitive=void 0,this._outlinePrimitive=void 0;var o=this._geometryUpdater,a=o._entity,s=a.rectangle;if(a.isShowing&&a.isAvailable(i)&&C.getValueOrDefault(s.show,i,!0)){var u=this._options,d=C.getValueOrUndefined(s.coordinates,i,u.rectangle);if(r(d)){if(u.rectangle=d,u.height=C.getValueOrUndefined(s.height,i),u.extrudedHeight=C.getValueOrUndefined(s.extrudedHeight,i),u.granularity=C.getValueOrUndefined(s.granularity,i),u.stRotation=C.getValueOrUndefined(s.stRotation,i),u.rotation=C.getValueOrUndefined(s.rotation,i),u.closeBottom=C.getValueOrUndefined(s.closeBottom,i),u.closeTop=C.getValueOrUndefined(s.closeTop,i),C.getValueOrDefault(s.fill,i,!0)){var v=y.getValue(i,o.fillMaterialProperty,this._material);this._material=v;var g=new p({material:v,translucent:v.isTranslucent(),closed:r(u.extrudedHeight)});u.vertexFormat=g.vertexFormat,this._primitive=n.add(new f({geometryInstances:new l({id:a,geometry:new c(u)}),appearance:g,asynchronous:!1}))}if(C.getValueOrDefault(s.outline,i,!1)){u.vertexFormat=m.VERTEX_FORMAT;var _=C.getValueOrClonedDefault(s.outlineColor,i,e.BLACK,I),E=C.getValueOrDefault(s.outlineWidth,i,1),S=1!==_.alpha;this._outlinePrimitive=n.add(new f({geometryInstances:new l({id:a,geometry:new h(u),attributes:{color:t.fromColor(_)}}),appearance:new m({flat:!0,translucent:S,renderState:{lineWidth:o._scene.clampLineWidth(E)}}),asynchronous:!1}))}}}},w.prototype.getBoundingSphere=function(e,t){return _(e,this._primitive,this._outlinePrimitive,t)},w.prototype.isDestroyed=function(){return!1},w.prototype.destroy=function(){var e=this._primitives;e.removeAndDestroy(this._primitive),e.removeAndDestroy(this._outlinePrimitive),o(this)},S}),i("DataSources/WallGeometryUpdater",["../Core/Color","../Core/ColorGeometryInstanceAttribute","../Core/defaultValue","../Core/defined","../Core/defineProperties","../Core/destroyObject","../Core/DeveloperError","../Core/Event","../Core/GeometryInstance","../Core/Iso8601","../Core/ShowGeometryInstanceAttribute","../Core/WallGeometry","../Core/WallOutlineGeometry","../Scene/MaterialAppearance","../Scene/PerInstanceColorAppearance","../Scene/Primitive","./ColorMaterialProperty","./ConstantProperty","./dynamicGeometryGetBoundingSphere","./MaterialProperty","./Property"],function(e,t,i,r,n,o,a,s,l,u,c,h,d,p,m,f,v,g,_,y,C){"use strict";function E(e){this.id=e,this.vertexFormat=void 0,this.positions=void 0,this.minimumHeights=void 0,this.maximumHeights=void 0,this.granularity=void 0}function S(e,t){this._entity=e,this._scene=t,this._entitySubscription=e.definitionChanged.addEventListener(S.prototype._onEntityPropertyChanged,this),this._fillEnabled=!1,this._dynamic=!1,this._outlineEnabled=!1,this._geometryChanged=new s,this._showProperty=void 0,this._materialProperty=void 0,this._hasConstantOutline=!0,this._showOutlineProperty=void 0,this._outlineColorProperty=void 0,this._outlineWidth=1,this._options=new E(e),this._onEntityPropertyChanged(e,"wall",e.wall,void 0)}function w(e,t){this._primitives=e,this._primitive=void 0,this._outlinePrimitive=void 0,this._geometryUpdater=t,this._options=new E(t._entity)}var T=new v(e.WHITE),x=new g(!0),b=new g(!0),A=new g(!1),P=new g(e.BLACK),I=new e;return n(S,{perInstanceColorAppearanceType:{value:m},materialAppearanceType:{value:p}}),n(S.prototype,{entity:{get:function(){return this._entity}},fillEnabled:{get:function(){return this._fillEnabled}},hasConstantFill:{get:function(){return!this._fillEnabled||!r(this._entity.availability)&&C.isConstant(this._showProperty)&&C.isConstant(this._fillProperty)}},fillMaterialProperty:{get:function(){return this._materialProperty}},outlineEnabled:{get:function(){return this._outlineEnabled}},hasConstantOutline:{get:function(){return!this._outlineEnabled||!r(this._entity.availability)&&C.isConstant(this._showProperty)&&C.isConstant(this._showOutlineProperty)}},outlineColorProperty:{get:function(){return this._outlineColorProperty}},outlineWidth:{get:function(){return this._outlineWidth}},isDynamic:{get:function(){return this._dynamic}},isClosed:{get:function(){return!1}},geometryChanged:{get:function(){return this._geometryChanged}}}),S.prototype.isOutlineVisible=function(e){var t=this._entity;return this._outlineEnabled&&t.isAvailable(e)&&this._showProperty.getValue(e)&&this._showOutlineProperty.getValue(e)},S.prototype.isFilled=function(e){var t=this._entity;return this._fillEnabled&&t.isAvailable(e)&&this._showProperty.getValue(e)&&this._fillProperty.getValue(e)},S.prototype.createFillGeometryInstance=function(i){var n,o,a=this._entity,s=a.isAvailable(i),u=new c(s&&a.isShowing&&this._showProperty.getValue(i)&&this._fillProperty.getValue(i));if(this._materialProperty instanceof v){var d=e.WHITE;r(this._materialProperty.color)&&(this._materialProperty.color.isConstant||s)&&(d=this._materialProperty.color.getValue(i)),o=t.fromColor(d),n={show:u,color:o}}else n={show:u};return new l({id:a,geometry:new h(this._options),attributes:n})},S.prototype.createOutlineGeometryInstance=function(i){var r=this._entity,n=r.isAvailable(i),o=C.getValueOrDefault(this._outlineColorProperty,i,e.BLACK);return new l({id:r,geometry:new d(this._options),attributes:{show:new c(n&&r.isShowing&&this._showProperty.getValue(i)&&this._showOutlineProperty.getValue(i)),color:t.fromColor(o)}})},S.prototype.isDestroyed=function(){return!1},S.prototype.destroy=function(){this._entitySubscription(),o(this)},S.prototype._onEntityPropertyChanged=function(e,t,n,o){if("availability"===t||"wall"===t){var a=this._entity.wall;if(!r(a))return void((this._fillEnabled||this._outlineEnabled)&&(this._fillEnabled=!1,this._outlineEnabled=!1,this._geometryChanged.raiseEvent(this)));var s=a.fill,l=r(s)&&s.isConstant?s.getValue(u.MINIMUM_VALUE):!0,c=a.outline,h=r(c);if(h&&c.isConstant&&(h=c.getValue(u.MINIMUM_VALUE)),!l&&!h)return void((this._fillEnabled||this._outlineEnabled)&&(this._fillEnabled=!1,this._outlineEnabled=!1,this._geometryChanged.raiseEvent(this)));var d=a.positions,f=a.show;if(r(f)&&f.isConstant&&!f.getValue(u.MINIMUM_VALUE)||!r(d))return void((this._fillEnabled||this._outlineEnabled)&&(this._fillEnabled=!1,this._outlineEnabled=!1,this._geometryChanged.raiseEvent(this)));var g=i(a.material,T),_=g instanceof v;this._materialProperty=g,this._fillProperty=i(s,b),this._showProperty=i(f,x),this._showOutlineProperty=i(a.outline,A),this._outlineColorProperty=h?i(a.outlineColor,P):void 0;var y=a.minimumHeights,E=a.maximumHeights,S=a.outlineWidth,w=a.granularity;if(this._fillEnabled=l,this._outlineEnabled=h,d.isConstant&&C.isConstant(y)&&C.isConstant(E)&&C.isConstant(S)&&C.isConstant(w)){var I=this._options;I.vertexFormat=_?m.VERTEX_FORMAT:p.MaterialSupport.TEXTURED.vertexFormat,I.positions=d.getValue(u.MINIMUM_VALUE,I.positions),I.minimumHeights=r(y)?y.getValue(u.MINIMUM_VALUE,I.minimumHeights):void 0,I.maximumHeights=r(E)?E.getValue(u.MINIMUM_VALUE,I.maximumHeights):void 0,I.granularity=r(w)?w.getValue(u.MINIMUM_VALUE):void 0,this._outlineWidth=r(S)?S.getValue(u.MINIMUM_VALUE):1,this._dynamic=!1,this._geometryChanged.raiseEvent(this)}else this._dynamic||(this._dynamic=!0,this._geometryChanged.raiseEvent(this))}},S.prototype.createDynamicUpdater=function(e){return new w(e,this)},w.prototype.update=function(i){var n=this._primitives;n.removeAndDestroy(this._primitive),n.removeAndDestroy(this._outlinePrimitive),this._primitive=void 0,this._outlinePrimitive=void 0;var o=this._geometryUpdater,a=o._entity,s=a.wall;if(a.isShowing&&a.isAvailable(i)&&C.getValueOrDefault(s.show,i,!0)){var u=this._options,c=C.getValueOrUndefined(s.positions,i,u.positions);if(r(c)){if(u.positions=c,u.minimumHeights=C.getValueOrUndefined(s.minimumHeights,i,u.minimumHeights),u.maximumHeights=C.getValueOrUndefined(s.maximumHeights,i,u.maximumHeights),u.granularity=C.getValueOrUndefined(s.granularity,i),C.getValueOrDefault(s.fill,i,!0)){var v=y.getValue(i,o.fillMaterialProperty,this._material);this._material=v;var g=new p({material:v,translucent:v.isTranslucent(),closed:r(u.extrudedHeight)});u.vertexFormat=g.vertexFormat,this._primitive=n.add(new f({geometryInstances:new l({id:a,geometry:new h(u)}),appearance:g,asynchronous:!1}))}if(C.getValueOrDefault(s.outline,i,!1)){u.vertexFormat=m.VERTEX_FORMAT;var _=C.getValueOrClonedDefault(s.outlineColor,i,e.BLACK,I),E=C.getValueOrDefault(s.outlineWidth,i,1),S=1!==_.alpha;this._outlinePrimitive=n.add(new f({geometryInstances:new l({id:a,geometry:new d(u),attributes:{color:t.fromColor(_)}}),appearance:new m({flat:!0,translucent:S,renderState:{lineWidth:o._scene.clampLineWidth(E)}}),asynchronous:!1}))}}}},w.prototype.getBoundingSphere=function(e,t){return _(e,this._primitive,this._outlinePrimitive,t)},w.prototype.isDestroyed=function(){return!1},w.prototype.destroy=function(){var e=this._primitives;e.removeAndDestroy(this._primitive),e.removeAndDestroy(this._outlinePrimitive),o(this)},S}),i("DataSources/DataSourceDisplay",["../Core/BoundingSphere","../Core/defaultValue","../Core/defined","../Core/defineProperties","../Core/destroyObject","../Core/DeveloperError","../Core/EventHelper","./BillboardVisualizer","./BoundingSphereState","./BoxGeometryUpdater","./CorridorGeometryUpdater","./CustomDataSource","./CylinderGeometryUpdater","./EllipseGeometryUpdater","./EllipsoidGeometryUpdater","./GeometryVisualizer","./LabelVisualizer","./ModelVisualizer","./PathVisualizer","./PointVisualizer","./PolygonGeometryUpdater","./PolylineGeometryUpdater","./PolylineVolumeGeometryUpdater","./RectangleGeometryUpdater","./WallGeometryUpdater"],function(e,t,i,r,n,o,a,s,l,u,c,h,d,p,m,f,v,g,_,y,C,E,S,w,T){"use strict";function x(e){var i=e.scene,r=e.dataSourceCollection;this._eventHelper=new a,this._eventHelper.add(r.dataSourceAdded,this._onDataSourceAdded,this),this._eventHelper.add(r.dataSourceRemoved,this._onDataSourceRemoved,this),this._dataSourceCollection=r,this._scene=i,this._visualizersCallback=t(e.visualizersCallback,x.defaultVisualizersCallback);for(var n=0,o=r.length;o>n;n++)this._onDataSourceAdded(r,r.get(n));var s=new h;this._onDataSourceAdded(void 0,s),this._defaultDataSource=s}x.defaultVisualizersCallback=function(e,t){var i=t.entities;return[new s(e,i),new f(u,e,i),new f(d,e,i),new f(c,e,i),new f(p,e,i),new f(m,e,i),new f(C,e,i),new f(E,e,i),new f(S,e,i),new f(w,e,i),new f(T,e,i),new v(e,i),new g(e,i),new y(e,i),new _(e,i)]},r(x.prototype,{scene:{get:function(){return this._scene}},dataSources:{get:function(){return this._dataSourceCollection}},defaultDataSource:{get:function(){return this._defaultDataSource}}}),x.prototype.isDestroyed=function(){return!1},x.prototype.destroy=function(){this._eventHelper.removeAll();for(var e=this._dataSourceCollection,t=0,i=e.length;i>t;++t)this._onDataSourceRemoved(this._dataSourceCollection,e.get(t));return this._onDataSourceRemoved(void 0,this._defaultDataSource),n(this)},x.prototype.update=function(e){var t,r,n,o,a=!0,s=this._dataSourceCollection,l=s.length;for(t=0;l>t;t++){var u=s.get(t);for(i(u.update)&&(a=u.update(e)&&a),n=u._visualizers,o=n.length,r=0;o>r;r++)a=n[r].update(e)&&a}for(n=this._defaultDataSource._visualizers,o=n.length,r=0;o>r;r++)a=n[r].update(e)&&a;return a};var b=[],A=new e;return x.prototype.getBoundingSphere=function(t,r,n){var o,a,s=this._defaultDataSource;if(!s.entities.contains(t)){s=void 0;var u=this._dataSourceCollection;for(a=u.length,o=0;a>o;o++){var c=u.get(o);if(c.entities.contains(t)){s=c;break}}}if(!i(s))return l.FAILED;var h=b,d=A,p=0,m=l.DONE,f=s._visualizers,v=f.length;for(o=0;v>o;o++){var g=f[o];if(i(g.getBoundingSphere)){if(m=f[o].getBoundingSphere(t,d),!r&&m===l.PENDING)return l.PENDING;m===l.DONE&&(h[p]=e.clone(d,h[p]),p++)}}return 0===p?l.FAILED:(h.length=p,e.fromBoundingSpheres(h,n),l.DONE)},x.prototype._onDataSourceAdded=function(e,t){var i=this._visualizersCallback(this._scene,t);t._visualizers=i},x.prototype._onDataSourceRemoved=function(e,t){for(var i=t._visualizers,r=i.length,n=0;r>n;n++)i[n].destroy(),t._visualizers=void 0},x}),i("DataSources/DynamicGeometryUpdater",["../Core/DeveloperError"],function(e){"use strict";function t(){e.throwInstantiationError()}return t.prototype.update=e.throwInstantiationError,t.prototype.getBoundingSphere=e.throwInstantiationError,t.prototype.isDestroyed=e.throwInstantiationError,t.prototype.destroy=e.throwInstantiationError,t}),i("DataSources/EntityView",["../Core/BoundingSphere","../Core/Cartesian3","../Core/Cartesian4","../Core/defaultValue","../Core/defined","../Core/defineProperties","../Core/DeveloperError","../Core/Ellipsoid","../Core/HeadingPitchRange","../Core/JulianDate","../Core/Math","../Core/Matrix3","../Core/Matrix4","../Core/Transforms","../Scene/SceneMode"],function(e,t,i,r,n,o,a,s,l,u,c,h,d,p,m){"use strict";function f(e,i,r,o,a,s,l){var d=e.scene.mode,f=a.getValue(s,e._lastCartesian);if(n(f)){var v,I,M,D=!1;if(d===m.SCENE3D){A=u.addSeconds(s,.001,A);var R=a.getValue(A,E);if(n(R)){var O,N=p.computeFixedToIcrfMatrix(s,g),L=p.computeFixedToIcrfMatrix(A,_);n(N)&&n(L)?O=h.transpose(N,y):(O=p.computeTemeToPseudoFixedMatrix(s,y),N=h.transpose(O,g),L=p.computeTemeToPseudoFixedMatrix(A,_),h.transpose(L,L));var F=h.multiplyByVector(N,f,x),B=h.multiplyByVector(L,R,b);t.subtract(F,B,T);var V=1e3*t.magnitude(T),k=3986004418e5,z=-k/(V*V-2*k/t.magnitude(F));0>z||z>P*l.maximumRadius?(v=S,t.normalize(f,v),t.negate(v,v),M=t.clone(t.UNIT_Z,w),I=t.cross(M,v,E),t.magnitude(I)>c.EPSILON7&&(t.normalize(v,v),t.normalize(I,I),M=t.cross(v,I,w),t.normalize(M,M),D=!0)):t.equalsEpsilon(f,R,c.EPSILON7)||(M=S,t.normalize(F,M),t.normalize(B,B),I=t.cross(M,B,w),t.equalsEpsilon(I,t.ZERO,c.EPSILON7)||(v=t.cross(I,M,E),h.multiplyByVector(O,v,v),h.multiplyByVector(O,I,I),h.multiplyByVector(O,M,M),t.normalize(v,v),t.normalize(I,I),t.normalize(M,M),D=!0))}}n(e._boundingSphereOffset)&&t.add(e._boundingSphereOffset,f,f);var U,G,W;o&&(U=t.clone(i.position,T),G=t.clone(i.direction,x),W=t.clone(i.up,b));var H=C;D?(H[0]=v.x,H[1]=v.y,H[2]=v.z,H[3]=0,H[4]=I.x,H[5]=I.y,H[6]=I.z,H[7]=0,H[8]=M.x,H[9]=M.y,H[10]=M.z,H[11]=0,H[12]=f.x,H[13]=f.y,H[14]=f.z,H[15]=0):p.eastNorthUpToFixedFrame(f,l,H),i._setTransform(H),o&&(t.clone(U,i.position),t.clone(G,i.direction),t.clone(W,i.up),t.cross(G,W,i.right))}if(r){var q=d===m.SCENE2D||t.equals(e._offset3D,t.ZERO)?void 0:e._offset3D;i.lookAtTransform(i.transform,q)}}function v(i,n,o,a){this.entity=i,this.scene=n,this.ellipsoid=r(o,s.WGS84),this.boundingSphere=e.clone(a),this._boundingSphereOffset=void 0,this._lastEntity=void 0,this._mode=void 0,this._lastCartesian=new t,this._defaultOffset3D=void 0,this._offset3D=new t}var g=new h,_=new h,y=new h,C=new d,E=new t,S=new t,w=new t,T=new t,x=new t,b=new t,A=new u,P=1.25;o(v,{defaultOffset3D:{get:function(){return this._defaultOffset3D},set:function(e){this._defaultOffset3D=t.clone(e,new t)}}}),v.defaultOffset3D=new t(-14e3,3500,3500);var I=new l,M=new t;return v.prototype.update=function(e){var i=this.scene,r=this.entity,o=this.ellipsoid,a=i.mode;if(a!==m.MORPHING){var s=r.position,l=r!==this._lastEntity,u=a!==this._mode,h=this._offset3D,d=i.camera,p=l||u,g=!0;if(l){var _=r.viewFrom,y=n(_),C=this.boundingSphere;if(this._boundingSphereOffset=void 0,!y&&n(C)){var E=i.screenSpaceCameraController;E.minimumZoomDistance=Math.min(E.minimumZoomDistance,.5*C.radius),I.pitch=-c.PI_OVER_FOUR,I.range=0;var S=s.getValue(e,M);if(n(S)){var w=2-1/Math.max(1,t.magnitude(S)/o.maximumRadius);I.pitch*=w}d.viewBoundingSphere(C,I),this._boundingSphereOffset=t.subtract(C.center,r.position.getValue(e),new t),p=!1,g=!1}else y&&n(_.getValue(e,h))||t.clone(v._defaultOffset3D,h)}else u||i.mode===m.MORPHING||this._mode===m.SCENE2D||t.clone(d.position,h);this._lastEntity=r,this._mode=i.mode!==m.MORPHING?i.mode:this._mode,i.mode!==m.MORPHING&&f(this,d,p,g,s,e,o)}},v}),!function(){function e(e,t){function i(t){var i,r=e.arcs[0>t?~t:t],n=r[0];return e.transform?(i=[0,0],r.forEach(function(e){i[0]+=e[0],i[1]+=e[1]})):i=r[r.length-1],0>t?[i,n]:[n,i]}function r(e,t){for(var i in e){var r=e[i];delete t[r.start],delete r.start,delete r.end,r.forEach(function(e){n[0>e?~e:e]=1}),s.push(r)}}var n={},o={},a={},s=[],l=-1;return t.forEach(function(i,r){var n,o=e.arcs[0>i?~i:i];o.length<3&&!o[1][0]&&!o[1][1]&&(n=t[++l],t[l]=i,t[r]=n)}),t.forEach(function(e){var t,r,n=i(e),s=n[0],l=n[1];if(t=a[s])if(delete a[t.end],t.push(e),t.end=l,r=o[l]){delete o[r.start];var u=r===t?t:t.concat(r);o[u.start=t.start]=a[u.end=r.end]=u}else o[t.start]=a[t.end]=t;else if(t=o[l])if(delete o[t.start],t.unshift(e),t.start=s,r=a[s]){delete a[r.end];var c=r===t?t:r.concat(t);o[c.start=r.start]=a[c.end=t.end]=c}else o[t.start]=a[t.end]=t;else t=[e],o[t.start=s]=a[t.end=l]=t}),r(a,o),r(o,a),t.forEach(function(e){n[0>e?~e:e]||s.push([e])}),s}function t(t,i,r){function n(e){var t=0>e?~e:e;(c[t]||(c[t]=[])).push({i:e,g:u})}function o(e){e.forEach(n)}function a(e){e.forEach(o)}function s(e){"GeometryCollection"===e.type?e.geometries.forEach(s):e.type in h&&(u=e,h[e.type](e.arcs))}var l=[];if(arguments.length>1){var u,c=[],h={LineString:o,MultiLineString:a,Polygon:a,MultiPolygon:function(e){e.forEach(a)}};s(i),c.forEach(arguments.length<3?function(e){l.push(e[0].i)}:function(e){r(e[0].g,e[e.length-1].g)&&l.push(e[0].i)})}else for(var d=0,p=t.arcs.length;p>d;++d)l.push(d);return{type:"MultiLineString",arcs:e(t,l)}}function r(t,i){function r(e){e.forEach(function(t){t.forEach(function(t){(a[t=0>t?~t:t]||(a[t]=[])).push(e)})}),l.push(e)}function o(e){return d(s(t,{type:"Polygon",arcs:[e]}).coordinates[0])>0}var a={},l=[],u=[];return i.forEach(function(e){"Polygon"===e.type?r(e.arcs):"MultiPolygon"===e.type&&e.arcs.forEach(r)}),l.forEach(function(e){if(!e._){var t=[],i=[e];for(e._=1,u.push(t);e=i.pop();)t.push(e),e.forEach(function(e){e.forEach(function(e){a[0>e?~e:e].forEach(function(e){e._||(e._=1,i.push(e))})})})}}),l.forEach(function(e){delete e._}),{type:"MultiPolygon",arcs:u.map(function(i){var r=[];if(i.forEach(function(e){e.forEach(function(e){e.forEach(function(e){a[0>e?~e:e].length<2&&r.push(e)})})}),r=e(t,r),(n=r.length)>1)for(var s,l=o(i[0][0]),u=0;ue?~e:e],n=0,o=r.length;o>n;++n)t.push(i=r[n].slice()),u(i,n);0>e&&l(t,o)}function r(e){return e=e.slice(),u(e,0),e}function n(e){for(var t=[],r=0,n=e.length;n>r;++r)i(e[r],t);return t.length<2&&t.push(t[0].slice()),t}function o(e){for(var t=n(e);t.length<4;)t.push(t[0].slice());return t}function a(e){return e.map(o)}function s(e){var t=e.type;return"GeometryCollection"===t?{type:t,geometries:e.geometries.map(s)}:t in h?{type:t,coordinates:h[t](e)}:null}var u=v(e.transform),c=e.arcs,h={Point:function(e){return r(e.coordinates)},MultiPoint:function(e){return e.coordinates.map(r)},LineString:function(e){return n(e.arcs)},MultiLineString:function(e){return e.arcs.map(n)},Polygon:function(e){return a(e.arcs)},MultiPolygon:function(e){return e.arcs.map(a)}};return s(t)}function l(e,t){for(var i,r=e.length,n=r-t;n<--r;)i=e[n],e[n++]=e[r],e[r]=i}function u(e,t){for(var i=0,r=e.length;r>i;){var n=i+r>>>1;e[n]e&&(e=~e);var i=n[e];i?i.push(t):n[e]=[t]})}function i(e,i){e.forEach(function(e){t(e,i)})}function r(e,t){"GeometryCollection"===e.type?e.geometries.forEach(function(e){r(e,t)}):e.type in a&&a[e.type](e.arcs,t)}var n={},o=e.map(function(){return[]}),a={LineString:t,MultiLineString:i,Polygon:i,MultiPolygon:function(e,t){e.forEach(function(e){i(e,t)})}};e.forEach(r);for(var s in n)for(var l=n[s],c=l.length,h=0;c>h;++h)for(var d=h+1;c>d;++d){var p,m=l[h],f=l[d];(p=o[m])[s=u(p,f)]!==f&&p.splice(s,0,f),(p=o[f])[s=u(p,m)]!==m&&p.splice(s,0,m)}return o}function h(e,t){function i(e){o.remove(e),e[1][2]=t(e),o.push(e)}var r=v(e.transform),n=g(e.transform),o=f();return t||(t=p),e.arcs.forEach(function(e){for(var a,s,l=[],u=0,c=0,h=e.length;h>c;++c)s=e[c],r(e[c]=[s[0],s[1],1/0],c);for(var c=1,h=e.length-1;h>c;++c)a=e.slice(c-1,c+2),a[1][2]=t(a),l.push(a),o.push(a);for(var c=0,h=l.length;h>c;++c)a=l[c],a.previous=l[c-1],a.next=l[c+1];for(;a=o.pop();){var d=a.previous,p=a.next;a[1][2]0;){var i=(t+1>>1)-1,n=r[i];if(m(e,n)>=0)break;r[n._=t]=n,r[e._=t=i]=e}}function t(e,t){for(;;){var i=t+1<<1,o=i-1,a=t,s=r[a];if(n>o&&m(r[o],s)<0&&(s=r[a=o]),n>i&&m(r[i],s)<0&&(s=r[a=i]),a===t)break;r[s._=t]=s,r[e._=t=a]=e}}var i={},r=[],n=0;return i.push=function(t){return e(r[t._=n]=t,n++),n},i.pop=function(){if(!(0>=n)){var e,i=r[0];return--n>0&&(e=r[n],t(r[e._=0]=e,0)),i}},i.remove=function(i){var o,a=i._;if(r[a]===i)return a!==--n&&(o=r[n],(m(o,i)<0?e:t)(r[o._=a]=o,a)),a},i}function v(e){if(!e)return _;var t,i,r=e.scale[0],n=e.scale[1],o=e.translate[0],a=e.translate[1];return function(e,s){s||(t=i=0),e[0]=(t+=e[0])*r+o,e[1]=(i+=e[1])*n+a}}function g(e){if(!e)return _;var t,i,r=e.scale[0],n=e.scale[1],o=e.translate[0],a=e.translate[1];return function(e,s){s||(t=i=0);var l=(e[0]-o)/r|0,u=(e[1]-a)/n|0;e[0]=l-t,e[1]=u-i,t=l,i=u}}function _(){}var y={version:"1.6.18",mesh:function(e){return s(e,t.apply(this,arguments))},meshArcs:t,merge:function(e){return s(e,r.apply(this,arguments))},mergeArcs:r,feature:o,neighbors:c,presimplify:h};"function"==typeof i&&i.amd?i("ThirdParty/topojson",y):"object"==typeof module&&module.exports?module.exports=y:this.topojson=y}(),i("DataSources/GeoJsonDataSource",["../Core/Cartesian3","../Core/Color","../Core/createGuid","../Core/defaultValue","../Core/defined","../Core/definedNotNull","../Core/defineProperties","../Core/DeveloperError","../Core/Event","../Core/getFilenameFromUri","../Core/loadJson","../Core/PinBuilder","../Core/PolygonHierarchy","../Core/RuntimeError","../Scene/VerticalOrigin","../ThirdParty/topojson","../ThirdParty/when","./BillboardGraphics","./CallbackProperty","./ColorMaterialProperty","./ConstantPositionProperty","./ConstantProperty","./DataSource","./EntityCollection","./PolygonGraphics","./PolylineGraphics"],function(e,t,i,r,n,o,a,s,l,u,c,h,d,p,m,f,v,g,_,y,C,E,S,w,T,x){"use strict";function b(t){return e.fromDegrees(t[0],t[1],t[2])}function A(e,t){var i="";for(var r in e)if(e.hasOwnProperty(r)){if(r===t||-1!==ae.indexOf(r))continue;var n=e[r];o(n)&&(i+="object"==typeof n?""+r+""+A(n)+"":""+r+""+n+"")}return i.length>0&&(i=''+i+"
"),i}function P(e,t,i){var r;return function(o,a){return n(r)||(r=e(t,i)),r}}function I(e,t){return new _(P(A,e,t),!0)}function M(e,t,r){var a=e.id;if(o(a)&&"Feature"===e.type){for(var s=2,l=a;n(t.getById(l));)l=a+"_"+s,s++;a=l}else a=i();var u=t.getOrCreateEntity(a),c=e.properties;if(o(c)){u.addProperty("properties"),u.properties=c;var h,d=c.title;if(o(d))u.name=d,h="title";else{var p=Number.MAX_VALUE;for(var m in c)if(c.hasOwnProperty(m)&&c[m]){var f=m.toLowerCase();if(p>1&&"title"===f){p=1,h=m;break}p>2&&"name"===f?(p=2,h=m):p>3&&/title/i.test(m)?(p=3,h=m):p>4&&/name/i.test(m)&&(p=4,h=m)}o(h)&&(u.name=c[h])}var v=c.description;n(v)?null!==v&&(u.description=new E(v)):u.description=r(c,h)}return u}function D(e,t){for(var i=new Array(e.length),r=0;ra;a++)R(e,o[a],void 0,r,n)}function N(e,t,i,r,n){for(var a=i.geometries,s=0,l=a.length;l>s;s++){var u=a[s],c=u.type,h=le[c];if(!o(h))throw new p("Unknown geometry type: "+c);h(e,t,u,r,n)}}function L(e,i,a,s,l){var u=l.markerSymbol,c=l.markerColor,h=l.markerSize,d=i.properties;if(o(d)){var p=d["marker-color"];o(p)&&(c=t.fromCssColorString(p)),h=r(oe[d["marker-size"]],h);var f=d["marker-symbol"];o(f)&&(u=f)}var _;_=n(u)?1===u.length?e._pinBuilder.fromText(u.toUpperCase(),c,h):e._pinBuilder.fromMakiIconId(u,c,h):e._pinBuilder.fromColor(c,h),e._promises.push(v(_,function(t){var r=new g;r.verticalOrigin=new E(m.BOTTOM),r.image=new E(t);var n=M(i,e._entityCollection,l.describe);n.billboard=r,n.position=new C(a(s))}))}function F(e,t,i,r,n){L(e,t,r,i.coordinates,n)}function B(e,t,i,r,n){for(var o=i.coordinates,a=0;aw;w++)S.push(new d(D(a[w],r)));var b=a[0];C.hierarchy=new E(new d(D(b,r),S)),b[0].length>2&&(C.perPositionHeight=new E(!0));var A=M(i,e._entityCollection,s.describe);A.polygon=C}}function G(e,t,i,r,n){U(e,t,r,i.coordinates,n)}function W(e,t,i,r,n){for(var o=i.coordinates,a=0;ao;o++){var s=i[o],l=s.getType(),u=s.getText();if("element"===l)"a"===s.getTagName()&&(s.isClosing()?r=Math.max(r-1,0):r++),n.push(u);else if("entity"===l||"comment"===l)n.push(u);else if(0===r){var c=this.linkifyStr(u);n.push(c)}else n.push(u)}return n.join("")},linkifyStr:function(e){return this.getMatchParser().replace(e,this.createMatchReturnVal,this)},createMatchReturnVal:function(t){var i;if(this.replaceFn&&(i=this.replaceFn.call(this,this,t)),"string"==typeof i)return i;if(i===!1)return t.getMatchedText();if(i instanceof e.HtmlTag)return i.toAnchorString();var r=this.getTagBuilder(),n=r.build(t);return n.toAnchorString()},getHtmlParser:function(){var t=this.htmlParser;return t||(t=this.htmlParser=new e.htmlParser.HtmlParser),t},getMatchParser:function(){var t=this.matchParser;return t||(t=this.matchParser=new e.matchParser.MatchParser({urls:this.urls,email:this.email,twitter:this.twitter,phone:this.phone,hashtag:this.hashtag,stripPrefix:this.stripPrefix})),t},getTagBuilder:function(){var t=this.tagBuilder;return t||(t=this.tagBuilder=new e.AnchorTagBuilder({newWindow:this.newWindow,truncate:this.truncate,className:this.className})),t}},e.link=function(t,i){var r=new e(i);return r.link(t)},e.match={},e.htmlParser={},e.matchParser={},e.Util={abstractMethod:function(){throw"abstract"},trimRegex:/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,assign:function(e,t){for(var i in t)t.hasOwnProperty(i)&&(e[i]=t[i]);return e},extend:function(t,i){var r=t.prototype,n=function(){};n.prototype=r;var o;o=i.hasOwnProperty("constructor")?i.constructor:function(){r.constructor.apply(this,arguments)};var a=o.prototype=new n;return a.constructor=o,a.superclass=r,delete i.constructor,e.Util.assign(a,i),o},ellipsis:function(e,t,i){return e.length>t&&(i=null==i?"..":i,e=e.substring(0,t-i.length)+i),e},indexOf:function(e,t){if(Array.prototype.indexOf)return e.indexOf(t);for(var i=0,r=e.length;r>i;i++)if(e[i]===t)return i;return-1},splitAndCapture:function(e,t){if(!t.global)throw new Error("`splitRegex` must have the 'g' flag set");for(var i,r=[],n=0;i=t.exec(e);)r.push(e.substring(n,i.index)),r.push(i[0]),n=i.index+i[0].length;return r.push(e.substring(n)),r},trim:function(e){return e.replace(this.trimRegex,"")}},e.HtmlTag=e.Util.extend(Object,{whitespaceRegex:/\s+/,constructor:function(t){e.Util.assign(this,t),this.innerHtml=this.innerHtml||this.innerHTML},setTagName:function(e){return this.tagName=e,this},getTagName:function(){return this.tagName||""},setAttr:function(e,t){var i=this.getAttrs();return i[e]=t,this},getAttr:function(e){return this.getAttrs()[e]},setAttrs:function(t){var i=this.getAttrs();return e.Util.assign(i,t),this},getAttrs:function(){return this.attrs||(this.attrs={})},setClass:function(e){return this.setAttr("class",e)},addClass:function(t){for(var i,r=this.getClass(),n=this.whitespaceRegex,o=e.Util.indexOf,a=r?r.split(n):[],s=t.split(n);i=s.shift();)-1===o(a,i)&&a.push(i);return this.getAttrs()["class"]=a.join(" "),this},removeClass:function(t){for(var i,r=this.getClass(),n=this.whitespaceRegex,o=e.Util.indexOf,a=r?r.split(n):[],s=t.split(n);a.length&&(i=s.shift());){var l=o(a,i);-1!==l&&a.splice(l,1)}return this.getAttrs()["class"]=a.join(" "),this},getClass:function(){return this.getAttrs()["class"]||""},hasClass:function(e){return-1!==(" "+this.getClass()+" ").indexOf(" "+e+" ")},setInnerHtml:function(e){return this.innerHtml=e,this},getInnerHtml:function(){return this.innerHtml||""},toAnchorString:function(){var e=this.getTagName(),t=this.buildAttrsStr();return t=t?" "+t:"",["<",e,t,">",this.getInnerHtml(),""].join("")},buildAttrsStr:function(){if(!this.attrs)return"";var e=this.getAttrs(),t=[];for(var i in e)e.hasOwnProperty(i)&&t.push(i+'="'+e[i]+'"');return t.join(" ")}}),e.AnchorTagBuilder=e.Util.extend(Object,{constructor:function(t){e.Util.assign(this,t)},build:function(t){var i=new e.HtmlTag({tagName:"a",attrs:this.createAttrs(t.getType(),t.getAnchorHref()),innerHtml:this.processAnchorText(t.getAnchorText())});return i},createAttrs:function(e,t){var i={href:t},r=this.createCssClass(e);return r&&(i["class"]=r),this.newWindow&&(i.target="_blank"),i},createCssClass:function(e){var t=this.className;return t?t+" "+t+"-"+e:""},processAnchorText:function(e){return e=this.doTruncate(e)},doTruncate:function(t){return e.Util.ellipsis(t,this.truncate||Number.POSITIVE_INFINITY)}}),e.htmlParser.HtmlParser=e.Util.extend(Object,{htmlRegex:function(){var e=/!--([\s\S]+?)--/,t=/[0-9a-zA-Z][0-9a-zA-Z:]*/,i=/[^\s\0"'>\/=\x01-\x1F\x7F]+/,r=/(?:"[^"]*?"|'[^']*?'|[^'"=<>`\s]+)/,n=i.source+"(?:\\s*=\\s*"+r.source+")?";return new RegExp(["(?:","<(!DOCTYPE)","(?:","\\s+","(?:",n,"|",r.source+")",")*",">",")","|","(?:","<(/)?","(?:",e.source,"|","(?:","("+t.source+")","(?:","\\s+",n,")*","\\s*/?",")",")",">",")"].join(""),"gi")}(),htmlCharacterEntitiesRegex:/( | |<|<|>|>|"|"|')/gi,parse:function(e){for(var t,i,r=this.htmlRegex,n=0,o=[];null!==(t=r.exec(e));){var a=t[0],s=t[3],l=t[1]||t[4],u=!!t[2],c=e.substring(n,t.index);c&&(i=this.parseTextAndEntityNodes(c),o.push.apply(o,i)),s?o.push(this.createCommentNode(a,s)):o.push(this.createElementNode(a,l,u)),n=t.index+a.length}if(nn;n+=2){var a=r[n],s=r[n+1];a&&i.push(this.createTextNode(a)),s&&i.push(this.createEntityNode(s))}return i},createCommentNode:function(t,i){return new e.htmlParser.CommentNode({text:t,comment:e.Util.trim(i)})},createElementNode:function(t,i,r){return new e.htmlParser.ElementNode({text:t,tagName:i.toLowerCase(),closing:r})},createEntityNode:function(t){return new e.htmlParser.EntityNode({text:t})},createTextNode:function(t){return new e.htmlParser.TextNode({text:t})}}),e.htmlParser.HtmlNode=e.Util.extend(Object,{text:"",constructor:function(t){e.Util.assign(this,t)},getType:e.Util.abstractMethod,getText:function(){return this.text}}),e.htmlParser.CommentNode=e.Util.extend(e.htmlParser.HtmlNode,{comment:"",getType:function(){return"comment"},getComment:function(){return this.comment}}),e.htmlParser.ElementNode=e.Util.extend(e.htmlParser.HtmlNode,{tagName:"",closing:!1,getType:function(){return"element"},getTagName:function(){return this.tagName},isClosing:function(){return this.closing}}),e.htmlParser.EntityNode=e.Util.extend(e.htmlParser.HtmlNode,{getType:function(){return"entity"}}),e.htmlParser.TextNode=e.Util.extend(e.htmlParser.HtmlNode,{getType:function(){return"text"}}),e.matchParser.MatchParser=e.Util.extend(Object,{urls:!0,email:!0,twitter:!0,phone:!0,hashtag:!1,stripPrefix:!0,matcherRegex:function(){var e=/(^|[^\w])@(\w{1,15})/,t=/(^|[^\w])#(\w{1,15})/,i=/(?:[\-;:&=\+\$,\w\.]+@)/,r=/(?:\+?\d{1,3}[-\s.])?\(?\d{3}\)?[-\s.]?\d{3}[-\s.]\d{4}/,n=/(?:[A-Za-z][-.+A-Za-z0-9]+:(?![A-Za-z][-.+A-Za-z0-9]+:\/\/)(?!\d+\/?)(?:\/\/)?)/,o=/(?:www\.)/,a=/[A-Za-z0-9\.\-]*[A-Za-z0-9\-]/,s=/\.(?:international|construction|contractors|enterprises|photography|productions|foundation|immobilien|industries|management|properties|technology|christmas|community|directory|education|equipment|institute|marketing|solutions|vacations|bargains|boutique|builders|catering|cleaning|clothing|computer|democrat|diamonds|graphics|holdings|lighting|partners|plumbing|supplies|training|ventures|academy|careers|company|cruises|domains|exposed|flights|florist|gallery|guitars|holiday|kitchen|neustar|okinawa|recipes|rentals|reviews|shiksha|singles|support|systems|agency|berlin|camera|center|coffee|condos|dating|estate|events|expert|futbol|kaufen|luxury|maison|monash|museum|nagoya|photos|repair|report|social|supply|tattoo|tienda|travel|viajes|villas|vision|voting|voyage|actor|build|cards|cheap|codes|dance|email|glass|house|mango|ninja|parts|photo|shoes|solar|today|tokyo|tools|watch|works|aero|arpa|asia|best|bike|blue|buzz|camp|club|cool|coop|farm|fish|gift|guru|info|jobs|kiwi|kred|land|limo|link|menu|mobi|moda|name|pics|pink|post|qpon|rich|ruhr|sexy|tips|vote|voto|wang|wien|wiki|zone|bar|bid|biz|cab|cat|ceo|com|edu|gov|int|kim|mil|net|onl|org|pro|pub|red|tel|uno|wed|xxx|xyz|ac|ad|ae|af|ag|ai|al|am|an|ao|aq|ar|as|at|au|aw|ax|az|ba|bb|bd|be|bf|bg|bh|bi|bj|bm|bn|bo|br|bs|bt|bv|bw|by|bz|ca|cc|cd|cf|cg|ch|ci|ck|cl|cm|cn|co|cr|cu|cv|cw|cx|cy|cz|de|dj|dk|dm|do|dz|ec|ee|eg|er|es|et|eu|fi|fj|fk|fm|fo|fr|ga|gb|gd|ge|gf|gg|gh|gi|gl|gm|gn|gp|gq|gr|gs|gt|gu|gw|gy|hk|hm|hn|hr|ht|hu|id|ie|il|im|in|io|iq|ir|is|it|je|jm|jo|jp|ke|kg|kh|ki|km|kn|kp|kr|kw|ky|kz|la|lb|lc|li|lk|lr|ls|lt|lu|lv|ly|ma|mc|md|me|mg|mh|mk|ml|mm|mn|mo|mp|mq|mr|ms|mt|mu|mv|mw|mx|my|mz|na|nc|ne|nf|ng|ni|nl|no|np|nr|nu|nz|om|pa|pe|pf|pg|ph|pk|pl|pm|pn|pr|ps|pt|pw|py|qa|re|ro|rs|ru|rw|sa|sb|sc|sd|se|sg|sh|si|sj|sk|sl|sm|sn|so|sr|st|su|sv|sx|sy|sz|tc|td|tf|tg|th|tj|tk|tl|tm|tn|to|tp|tr|tt|tv|tw|tz|ua|ug|uk|us|uy|uz|va|vc|ve|vg|vi|vn|vu|wf|ws|ye|yt|za|zm|zw)\b/,l=/[\-A-Za-z0-9+&@#\/%=~_()|'$*\[\]?!:,.;]*[\-A-Za-z0-9+&@#\/%=~_()|'$*\[\]]/;return new RegExp(["(",e.source,")","|","(",i.source,a.source,s.source,")","|","(","(?:","(",n.source,a.source,")","|","(?:","(.?//)?",o.source,a.source,")","|","(?:","(.?//)?",a.source,s.source,")",")","(?:"+l.source+")?",")","|","(",r.source,")","|","(",t.source,")"].join(""),"gi")}(),charBeforeProtocolRelMatchRegex:/^(.)?\/\//,constructor:function(t){e.Util.assign(this,t),this.matchValidator=new e.MatchValidator},replace:function(e,t,i){var r=this;return e.replace(this.matcherRegex,function(e,n,o,a,s,l,u,c,h,d,p,m,f){var v=r.processCandidateMatch(e,n,o,a,s,l,u,c,h,d,p,m,f);if(v){var g=t.call(i,v.match);return v.prefixStr+g+v.suffixStr}return e})},processCandidateMatch:function(t,i,r,n,o,a,s,l,u,c,h,d,p){var m,f=l||u,v="",g="";if(a&&!this.urls||o&&!this.email||c&&!this.phone||i&&!this.twitter||h&&!this.hashtag||!this.matchValidator.isValidMatch(a,s,f))return null;if(this.matchHasUnbalancedClosingParen(t)&&(t=t.substr(0,t.length-1),g=")"),o)m=new e.match.Email({matchedText:t,email:o});else if(i)r&&(v=r,t=t.slice(1)),m=new e.match.Twitter({matchedText:t,twitterHandle:n});else if(c){var _=t.replace(/\D/g,"");m=new e.match.Phone({matchedText:t,number:_})}else if(h)d&&(v=d,t=t.slice(1)),m=new e.match.Hashtag({matchedText:t,serviceName:this.hashtag,hashtag:p});else{if(f){var y=f.match(this.charBeforeProtocolRelMatchRegex)[1]||"";y&&(v=y,t=t.slice(1))}m=new e.match.Url({matchedText:t,url:t,protocolUrlMatch:!!s,protocolRelativeMatch:!!f,stripPrefix:this.stripPrefix})}return{prefixStr:v,suffixStr:g,match:m}},matchHasUnbalancedClosingParen:function(e){var t=e.charAt(e.length-1);if(")"===t){var i=e.match(/\(/g),r=e.match(/\)/g),n=i&&i.length||0,o=r&&r.length||0;if(o>n)return!0}return!1}}),e.MatchValidator=e.Util.extend(Object,{invalidProtocolRelMatchRegex:/^[\w]\/\//,hasFullProtocolRegex:/^[A-Za-z][-.+A-Za-z0-9]+:\/\//,uriSchemeRegex:/^[A-Za-z][-.+A-Za-z0-9]+:/,hasWordCharAfterProtocolRegex:/:[^\s]*?[A-Za-z]/,isValidMatch:function(e,t,i){return t&&!this.isValidUriScheme(t)||this.urlMatchDoesNotHaveProtocolOrDot(e,t)||this.urlMatchDoesNotHaveAtLeastOneWordChar(e,t)||this.isInvalidProtocolRelativeMatch(i)?!1:!0},isValidUriScheme:function(e){var t=e.match(this.uriSchemeRegex)[0].toLowerCase();return"javascript:"!==t&&"vbscript:"!==t},urlMatchDoesNotHaveProtocolOrDot:function(e,t){return!(!e||t&&this.hasFullProtocolRegex.test(t)||-1!==e.indexOf("."))},urlMatchDoesNotHaveAtLeastOneWordChar:function(e,t){return e&&t?!this.hasWordCharAfterProtocolRegex.test(e):!1},isInvalidProtocolRelativeMatch:function(e){return!!e&&this.invalidProtocolRelMatchRegex.test(e)}}),e.match.Match=e.Util.extend(Object,{constructor:function(t){e.Util.assign(this,t)},getType:e.Util.abstractMethod,getMatchedText:function(){return this.matchedText},getAnchorHref:e.Util.abstractMethod,getAnchorText:e.Util.abstractMethod}),e.match.Email=e.Util.extend(e.match.Match,{getType:function(){return"email"},getEmail:function(){return this.email},getAnchorHref:function(){return"mailto:"+this.email},getAnchorText:function(){return this.email}}),e.match.Hashtag=e.Util.extend(e.match.Match,{getType:function(){return"hashtag"},getHashtag:function(){return this.hashtag},getAnchorHref:function(){var e=this.serviceName,t=this.hashtag;switch(e){case"twitter":return"https://twitter.com/hashtag/"+t;case"facebook":return"https://www.facebook.com/hashtag/"+t;default:throw new Error("Unknown service name to point hashtag to: ",e)}},getAnchorText:function(){return"#"+this.hashtag}}),e.match.Phone=e.Util.extend(e.match.Match,{getType:function(){return"phone"},getNumber:function(){return this.number},getAnchorHref:function(){return"tel:"+this.number},getAnchorText:function(){return this.matchedText}}),e.match.Twitter=e.Util.extend(e.match.Match,{getType:function(){return"twitter"},getTwitterHandle:function(){return this.twitterHandle},getAnchorHref:function(){return"https://twitter.com/"+this.twitterHandle},getAnchorText:function(){return"@"+this.twitterHandle}}),e.match.Url=e.Util.extend(e.match.Match,{urlPrefixRegex:/^(https?:\/\/)?(www\.)?/i,protocolRelativeRegex:/^\/\//,protocolPrepended:!1,getType:function(){return"url"},getUrl:function(){var e=this.url;return this.protocolRelativeMatch||this.protocolUrlMatch||this.protocolPrepended||(e=this.url="http://"+e,this.protocolPrepended=!0),e},getAnchorHref:function(){var e=this.getUrl();return e.replace(/&/g,"&")},getAnchorText:function(){var e=this.getUrl();return this.protocolRelativeMatch&&(e=this.stripProtocolRelativePrefix(e)),this.stripPrefix&&(e=this.stripUrlPrefix(e)),e=this.removeTrailingSlash(e)},stripUrlPrefix:function(e){return e.replace(this.urlPrefixRegex,"")},stripProtocolRelativePrefix:function(e){return e.replace(this.protocolRelativeRegex,"")},removeTrailingSlash:function(e){return"/"===e.charAt(e.length-1)&&(e=e.slice(0,-1)),e}}),e}),i("ThirdParty/zip",["../Core/buildModuleUrl","../Core/defineProperties"],function(e,t){var i={};return function(i){function r(){var e=-1,t=this;t.append=function(i){var r,n=t.table;for(r=0;r>>8^n[255&(e^i[r])]},t.get=function(){return~e}}function n(e,t,i){return e.slice?e.slice(t,t+i):e.webkitSlice?e.webkitSlice(t,t+i):e.mozSlice?e.mozSlice(t,t+i):e.msSlice?e.msSlice(t,t+i):void 0}function o(e,t){var i,r;return i=new ArrayBuffer(e),r=new Uint8Array(i),t&&r.set(t,0),{buffer:i,array:r,view:new DataView(i)}}function a(){}function s(e){function t(t,i){var o=new Blob([e],{type:z});r=new u(o),r.init(function(){n.size=r.size,t()},i)}function i(e,t,i,n){r.readUint8Array(e,t,i,n)}var r,n=this;n.size=0,n.init=t,n.readUint8Array=i}function l(e){function t(t){for(var i=e.length;"="==e.charAt(i-1);)i--;r=e.indexOf(",")+1,n.size=Math.floor(.75*(i-r)),t()}function i(t,i,n){var a,s=o(i),l=4*Math.floor(t/3),u=4*Math.ceil((t+i)/3),c=window.atob(e.substring(l+r,u+r)),h=t-3*Math.floor(l/4);for(a=h;h+i>a;a++)s.array[a-h]=c.charCodeAt(a);n(s.array)}var r,n=this;n.size=0,n.init=t,n.readUint8Array=i}function u(e){function t(t){this.size=e.size,t()}function i(t,i,r,o){var a=new FileReader;a.onload=function(e){r(new Uint8Array(e.target.result))},a.onerror=o,a.readAsArrayBuffer(n(e,t,i))}var r=this;r.size=0,r.init=t,r.readUint8Array=i}function c(){}function h(e){function t(e){n=new Blob([],{type:z}),e()}function i(e,t){n=new Blob([n,P?e:e.buffer],{type:z}),t()}function r(t,i){var r=new FileReader;r.onload=function(e){t(e.target.result)},r.onerror=i,r.readAsText(n,e)}var n,o=this;o.init=t,o.writeUint8Array=i,o.getData=r}function d(e){function t(t){o+="data:"+(e||"")+";base64,",t()}function i(e,t){var i,r=a.length,n=a;for(a="",i=0;i<3*Math.floor((r+e.length)/3)-r;i++)n+=String.fromCharCode(e[i]);for(;i2?o+=window.btoa(n):a=n,t()}function r(e){e(o+window.btoa(a))}var n=this,o="",a="";n.init=t,n.writeUint8Array=i,n.getData=r}function p(e){function t(t){n=new Blob([],{type:e}),t()}function i(t,i){n=new Blob([n,P?t:t.buffer],{type:e}),i()}function r(e){e(n)}var n,o=this;o.init=t,o.writeUint8Array=i,o.getData=r}function m(e,t,i,r,n,o,a,s,l,u){function c(){e.removeEventListener(U,h,!1),s(m)}function h(e){var t=e.data,r=t.data;t.onappend&&(m+=r.length,i.writeUint8Array(r,function(){o(!1,r),d()},u)),t.onflush&&(r?(m+=r.length,i.writeUint8Array(r,function(){o(!1,r),c()},u)):c()),t.progress&&a&&a(p+t.current,n)}function d(){p=f*B,n>p?t.readUint8Array(r+p,Math.min(B,n-p),function(t){e.postMessage({append:!0,data:t}),f++,a&&a(p,n),o(!0,t)},l):e.postMessage({flush:!0})}var p,m,f=0;m=0,e.addEventListener(U,h,!1),d()}function f(e,t,i,r,n,o,a,s,l,u){function c(){var m;h=d*B,n>h?t.readUint8Array(r+h,Math.min(B,n-h),function(t){var s=e.append(t,function(){a&&a(r+h,n)});p+=s.length,o(!0,t),i.writeUint8Array(s,function(){o(!1,s),d++,setTimeout(c,1)},u),a&&a(h,n)},l):(m=e.flush(),m?(p+=m.length,i.writeUint8Array(m,function(){o(!1,m),s(p)},u)):s(p))}var h,d=0,p=0;c()}function v(e,t,n,o,a,s,l,u,c){function h(e,t){a&&!e&&v.append(t)}function d(e){s(e,v.get())}var p,v=new r;return i.zip.useWebWorkers?(p=new Worker(i.zip.workerScriptsPath+V),m(p,e,t,n,o,h,l,d,u,c)):f(new i.zip.Inflater,e,t,n,o,h,l,d,u,c),p}function g(e,t,n,o,a,s,l){function u(e,t){e&&p.append(t)}function c(e){o(e,p.get())}function h(){d.removeEventListener(U,h,!1),m(d,e,t,0,e.size,u,a,c,s,l)}var d,p=new r;return i.zip.useWebWorkers?(d=new Worker(i.zip.workerScriptsPath+k),d.addEventListener(U,h,!1),d.postMessage({init:!0,level:n})):f(new i.zip.Deflater,e,t,0,e.size,u,a,c,s,l),d}function _(e,t,i,n,o,a,s,l,u){function c(){var r=h*B;n>r?e.readUint8Array(i+r,Math.min(B,n-r),function(e){o&&d.append(e),s&&s(r,n,e),t.writeUint8Array(e,function(){h++,c()},u)},l):a(n,d.get())}var h=0,d=new r;c()}function y(e){var t,i,r="",n=["Ç","ü","é","â","ä","à","å","ç","ê","ë","è","ï","î","ì","Ä","Å","É","æ","Æ","ô","ö","ò","û","ù","ÿ","Ö","Ü","ø","£","Ø","×","ƒ","á","í","ó","ú","ñ","Ñ","ª","º","¿","®","¬","½","¼","¡","«","»","_","_","_","¦","¦","Á","Â","À","©","¦","¦","+","+","¢","¥","+","+","-","-","+","-","+","ã","Ã","+","+","-","-","¦","-","+","¤","ð","Ð","Ê","Ë","È","i","Í","Î","Ï","+","+","_","_","¦","Ì","_","Ó","ß","Ô","Ò","õ","Õ","µ","þ","Þ","Ú","Û","Ù","ý","Ý","¯","´","­","±","_","¾","¶","§","÷","¸","°","¨","·","¹","³","²","_"," "];for(t=0;t127?n[i-128]:String.fromCharCode(i);return r}function C(e){return decodeURIComponent(escape(e))}function E(e){var t,i="";for(t=0;t>16,i=65535&e;try{return new Date(1980+((65024&t)>>9),((480&t)>>5)-1,31&t,(63488&i)>>11,(2016&i)>>5,2*(31&i),0)}catch(r){}}function w(e,t,i,r,n){return e.version=t.view.getUint16(i,!0),e.bitFlag=t.view.getUint16(i+2,!0),e.compressionMethod=t.view.getUint16(i+4,!0),e.lastModDateRaw=t.view.getUint32(i+6,!0),e.lastModDate=S(e.lastModDateRaw),1===(1&e.bitFlag)?void n(M):((r||8!=(8&e.bitFlag))&&(e.crc32=t.view.getUint32(i+10,!0),e.compressedSize=t.view.getUint32(i+14,!0),e.uncompressedSize=t.view.getUint32(i+18,!0)),4294967295===e.compressedSize||4294967295===e.uncompressedSize?void n(D):(e.filenameLength=t.view.getUint16(i+22,!0),void(e.extraFieldLength=t.view.getUint16(i+24,!0))))}function T(e,t){function i(){}function r(i,n){e.readUint8Array(e.size-i,i,function(e){var t=o(e.length,e).view;1347093766!=t.getUint32(0)?r(i+1,n):n(t)},function(){t(R)})}return i.prototype.getData=function(i,r,n,a){function s(e,t){d&&d.terminate(),d=null,e&&e(t)}function l(e){var t=o(4);return t.view.setUint32(0,e),p.crc32==t.view.getUint32(0)}function u(e,t){a&&!l(t)?c():i.getData(function(e){s(r,e)})}function c(){s(t,L)}function h(){s(t,N)}var d,p=this;e.readUint8Array(p.offset,30,function(r){var s,l=o(r.length,r);return 1347093252!=l.view.getUint32(0)?void t(I):(w(p,l,4,!1,t),s=p.offset+30+p.filenameLength+p.extraFieldLength,void i.init(function(){0===p.compressionMethod?_(e,i,s,p.compressedSize,a,u,n,c,h):d=v(e,i,s,p.compressedSize,a,u,n,c,h)},h))},c)},{getEntries:function(n){return e.size<22?void t(I):void r(22,function(r){var a,s;a=r.getUint32(16,!0),s=r.getUint16(8,!0),e.readUint8Array(a,e.size-a,function(e){var r,a,l,u,c=0,h=[],d=o(e.length,e);for(r=0;s>r;r++){if(a=new i,1347092738!=d.view.getUint32(c))return void t(I);w(a,d,c+6,!0,t),a.commentLength=d.view.getUint16(c+32,!0),a.directory=16==(16&d.view.getUint8(c+38)),a.offset=d.view.getUint32(c+42,!0),l=E(d.array.subarray(c+46,c+46+a.filenameLength)),a.filename=2048===(2048&a.bitFlag)?C(l):y(l),a.directory||"/"!=a.filename.charAt(a.filename.length-1)||(a.directory=!0),u=E(d.array.subarray(c+46+a.filenameLength+a.extraFieldLength,c+46+a.filenameLength+a.extraFieldLength+a.commentLength)),a.comment=2048===(2048&a.bitFlag)?C(u):y(u),h.push(a),c+=46+a.filenameLength+a.extraFieldLength+a.commentLength}n(h)},function(){t(R)})})},close:function(e){e&&e()}}}function x(e){return unescape(encodeURIComponent(e))}function b(e){var t,i=[];for(t=0;te;e++){for(i=e,t=0;8>t;t++)1&i?i=i>>>1^3988292384:i>>>=1;r[e]=i}return r}(),s.prototype=new a,s.prototype.constructor=s,l.prototype=new a,l.prototype.constructor=l,u.prototype=new a,u.prototype.constructor=u,c.prototype.getData=function(e){e(this.data)},h.prototype=new c,h.prototype.constructor=h,d.prototype=new c,d.prototype.constructor=d,p.prototype=new c,p.prototype.constructor=p,i.zip={Reader:a,Writer:c,BlobReader:u,Data64URIReader:l,TextReader:s,BlobWriter:p,Data64URIWriter:d,TextWriter:h,createReader:function(e,t,i){e.init(function(){t(T(e,i))},i)},createWriter:function(e,t,i,r){e.init(function(){t(A(e,i,r))},i)},useWebWorkers:!0};var W;t(i.zip,{workerScriptsPath:{get:function(){return"undefined"==typeof W&&(W=e("ThirdParty/Workers/")),W}}})}(i),i.zip}),i("DataSources/KmlDataSource",["../Core/BoundingRectangle","../Core/Cartesian2","../Core/Cartesian3","../Core/ClockRange","../Core/ClockStep","../Core/Color","../Core/createGuid","../Core/defaultValue","../Core/defined","../Core/definedNotNull","../Core/defineProperties","../Core/DeveloperError","../Core/Ellipsoid","../Core/Event","../Core/getAbsoluteUri","../Core/getExtensionFromUri","../Core/getFilenameFromUri","../Core/Iso8601","../Core/JulianDate","../Core/loadBlob","../Core/loadXML","../Core/Math","../Core/NearFarScalar","../Core/PinBuilder","../Core/PolygonHierarchy","../Core/Rectangle","../Core/RuntimeError","../Core/TimeInterval","../Core/TimeIntervalCollection","../Scene/HorizontalOrigin","../Scene/LabelStyle","../ThirdParty/Autolinker","../ThirdParty/Uri","../ThirdParty/when","../ThirdParty/zip","./BillboardGraphics","./CompositePositionProperty","./ConstantPositionProperty","./DataSource","./DataSourceClock","./Entity","./EntityCollection","./LabelGraphics","./PathGraphics","./PolygonGraphics","./PolylineGraphics","./PositionPropertyArray","./RectangleGraphics","./ReferenceProperty","./SampledPositionProperty","./ScaledPositionProperty","./TimeIntervalCollectionProperty","./WallGraphics"],function(e,t,i,r,n,o,a,s,l,u,c,h,d,p,m,f,v,g,_,y,C,E,S,w,T,x,b,A,P,I,M,D,R,O,N,L,F,B,V,k,z,U,G,W,H,q,j,Y,X,Z,K,Q,J){"use strict";function $(e){var t=e.slice(0,Math.min(4,e.size)),i=O.defer(),r=new FileReader;return r.addEventListener("load",function(){i.resolve(1347093252===new DataView(r.result).getUint32(0,!1))}),r.addEventListener("error",function(){i.reject(r.error)}),r.readAsArrayBuffer(t),i.promise}function ee(e){var t=O.defer(),i=new FileReader;return i.addEventListener("load",function(){t.resolve(i.result)}),i.addEventListener("error",function(){t.reject(i.error)}),i.readAsText(e),t.promise}function te(e,t,i,r){t.getData(new N.TextWriter,function(e){i.kml=rt.parseFromString(e,"application/xml"),r.resolve()})}function ie(e,t,i,r){var n=s(it.detectFromFilename(t.filename),"application/octet-stream"); -t.getData(new N.Data64URIWriter(n),function(e){i[t.filename]=e,r.resolve()})}function re(e,t,i,r){for(var n=r.keys,o=new R("."),a=e.querySelectorAll(t),s=0;so;o++)r[n++]=se(t[o]);return r}}}function ue(e,t){if(l(e)){var i=e.getAttribute(t);if(null!==i){var r=parseFloat(i);return isNaN(r)?void 0:r}}}function ce(e,t){if(l(e)){var i=e.getAttribute(t);return null!==i?i:void 0}}function he(e,t,i){if(l(e))for(var r=e.childNodes,n=r.length,o=0;n>o;o++){var a=r[o];if(a.localName===t&&-1!==i.indexOf(a.namespaceURI))return a}}function de(e,t,i){if(l(e)){for(var r=[],n=e.getElementsByTagName(t),o=n.length,a=0;o>a;a++){var s=n[a];s.localName===t&&-1!==i.indexOf(s.namespaceURI)&&r.push(s)}return r}}function pe(e,t,i){if(!l(e))return[];for(var r=[],n=e.childNodes,o=n.length,a=0;o>a;a++){var s=n[a];s.localName===t&&-1!==i.indexOf(s.namespaceURI)&&r.push(s)}return r}function me(e,t,i){var r=he(e,t,i);if(l(r)){var n=parseFloat(r.textContent);return isNaN(n)?void 0:n}}function fe(e,t,i){var r=he(e,t,i);return l(r)?r.textContent.trim():void 0}function ve(e,t,i){var r=he(e,t,i);if(l(r)){var n=r.textContent.trim();return"1"===n||/^true$/i.test(n)}}function ge(e,t,i,r){if(l(e)){var n=!1;if(l(r)){var o=r[e];l(o)&&(n=!0,e=o)}return!n&&l(i)&&(e=m(e,m(i)),e=ne(e,t)),e}}function _e(e,t){if(l(e)){"#"===e[0]&&(e=e.substring(1));var i=parseInt(e.substring(0,2),16)/255,r=parseInt(e.substring(2,4),16)/255,n=parseInt(e.substring(4,6),16)/255,a=parseInt(e.substring(6,8),16)/255;return t?(a>0?ct.maximumRed=a:ct.red=0,n>0?ct.maximumGreen=n:ct.green=0,r>0?ct.maximumBlue=r:ct.blue=0,ct.alpha=i,o.fromRandom(ct)):new o(a,n,r,i)}}function ye(e,t,i){var r=fe(e,t,i);if(l(r))return _e(r,"random"===fe(e,"colorMode",i))}function Ce(e){var t=he(e,"TimeStamp",ut.kmlgx),i=fe(t,"when",ut.kmlgx);if(l(t)&&l(i)&&0!==i.length){var r=_.fromIso8601(i),n=new P;return n.addInterval(new A({start:r,stop:g.MAXIMUM_VALUE})),n}}function Ee(e){var t=he(e,"TimeSpan",ut.kmlgx);if(l(t)){var i,r=he(t,"begin",ut.kmlgx),n=l(r)?_.fromIso8601(r.textContent):void 0,o=he(t,"end",ut.kmlgx),a=l(o)?_.fromIso8601(o.textContent):void 0;if(l(n)&&l(a)){if(_.lessThan(a,n)){var s=n;n=a,a=s}i=new P,i.addInterval(new A({start:n,stop:a}))}else l(n)?(i=new P,i.addInterval(new A({start:n,stop:g.MAXIMUM_VALUE}))):l(a)&&(i=new P,i.addInterval(new A({start:g.MINIMUM_VALUE,stop:a})));return i}}function Se(){var e=new L;return e.width=ot,e.height=ot,e.scaleByDistance=new S(2414016,1,16093e3,.1),e}function we(){var e=new H;return e.outline=!0,e.outlineColor=o.WHITE,e}function Te(){var e=new G;return e.translucencyByDistance=new S(3e6,1,5e6,0),e.pixelOffset=new t(17,0),e.horizontalOrigin=I.LEFT,e.font="16px sans-serif",e.style=M.FILL_AND_OUTLINE,e}function xe(r,n,o,a,u){var c=me(n,"scale",ut.kml),h=me(n,"heading",ut.kml),d=ye(n,"color",ut.kml),p=he(n,"Icon",ut.kml),m=fe(p,"href",ut.kml),f=ge(m,r._proxy,a,u),v=me(p,"x",ut.gx),g=me(p,"y",ut.gx),_=me(p,"w",ut.gx),y=me(p,"h",ut.gx),C=he(n,"hotSpot",ut.kml),S=ue(C,"x"),w=ue(C,"y"),T=ce(C,"xunits"),x=ce(C,"yunits"),b=o.billboard;l(b)||(b=Se(r),o.billboard=b),b.image=f,b.scale=c,b.color=d,(l(v)||l(g)||l(_)||l(y))&&(b.imageSubRegion=new e(v,g,_,y)),l(h)&&0!==h&&(b.rotation=E.toRadians(-h),b.alignedAxis=i.UNIT_Z),c=s(c,1);var A,P;l(S)&&("pixels"===T?A=-S*c:"insetPixels"===T?A=(S-ot)*c:"fraction"===T&&(A=-ot*c*S),A+=.5*ot*c),l(w)&&("pixels"===x?P=w:"insetPixels"===x?P=-w:"fraction"===x&&(P=w*ot),P-=.5*ot*c),(l(A)||l(P))&&(b.pixelOffset=new t(A,P))}function be(e,t,i,r,n){for(var a=0,u=t.childNodes.length;u>a;a++){var c=t.childNodes.item(a);if("IconStyle"===c.localName)xe(e,c,i,r,n);else if("LabelStyle"===c.localName){var h=i.label;l(h)||(h=Te(),i.label=h),h.scale=s(me(c,"scale",ut.kml),h.scale),h.fillColor=s(ye(c,"color",ut.kml),h.fillColor),h.text=i.name}else if("LineStyle"===c.localName){var d=i.polyline;l(d)||(d=new q,i.polyline=d),d.width=me(c,"width",ut.kml),d.material=ye(c,"color",ut.kml)}else if("PolyStyle"===c.localName){var p=i.polygon;l(p)||(p=we(),i.polygon=p),p.material=s(ye(c,"color",ut.kml),p.material),p.fill=s(ve(c,"fill",ut.kml),p.fill),p.outline=s(ve(c,"outline",ut.kml),p.outline)}else if("BalloonStyle"===c.localName){var m=s(_e(fe(c,"bgColor",ut.kml)),o.WHITE),f=s(_e(fe(c,"textColor",ut.kml)),o.BLACK),v=fe(c,"text",ut.kml);i.addProperty("balloonStyle"),i.balloonStyle={bgColor:m,textColor:f,text:v}}}}function Ae(e,t,i,r,n,o){var a=new z,s=pe(i,"Style",ut.kml),u=s.length;u>0&&be(t,s[u-1],a,n,o);var c=fe(i,"styleUrl",ut.kml);if(l(c)){var h=c,d=r.getById(h);l(d)||(d=r.getById("#"+h)),l(d)&&a.merge(d)}return a}function Pe(e,t,i){return O(C(ne(t,e._proxy)),function(r){return Ie(e,r,i,t,!0)})}function Ie(e,t,i,r,n,o){var a,s,u,c,h=de(t,"Style",ut.kml);if(l(h)){var d=h.length;for(a=0;d>a;a++)c=h[a],s=ce(c,"id"),l(s)&&(s="#"+s,n&&l(r)&&(s=r+s),l(i.getById(s))||(u=new z({id:s}),i.add(u),be(e,c,u,r,o)))}var p=de(t,"StyleMap",ut.kml);if(l(p)){var f=p.length;for(a=0;f>a;a++){var v=p[a];if(s=ce(v,"id"),l(s))for(var g=pe(v,"Pair",ut.kml),_=0;_a;a++){var b=T[a].textContent;if("#"!==b[0]){var A=b.split("#");if(2===A.length){var P=A[0];l(S[P])||(l(r)&&(P=m(P,m(r))),w.push(Pe(e,P,i,r)))}}}return w}function Me(e,t,i){var r=new X(e._entityCollection,t.id,["position"]),n=new K(t.position);t.polyline=l(i.polyline)?i.polyline.clone():new q,t.polyline.positions=new j([r,n])}function De(e,t,i){return"relativeToSeaFloor"===i||"absolute"===t||"relativeToGround"===t?e:((l(t)&&"clampToGround"!==t||l(i)&&"clampToSeaFloor"!==i)&&console.log("KML - Unknown altitudeMode: "+s(t,i)),new K(e))}function Re(e,t,i){if(l(e)){if("relativeToSeaFloor"===i||"absolute"===t||"relativeToGround"===t)return e;(l(t)&&"clampToGround"!==t||l(i)&&"clampToSeaFloor"!==i)&&console.log("KML - Unknown altitudeMode: "+s(t,i));for(var r=e.length,n=0;r>n;n++){var o=e[n];d.WGS84.scaleToGeodeticSurface(o,o)}return e}}function Oe(e,i,r){var n=i.label;l(n)||(n=l(r.label)?r.label.clone():Te(),i.label=n),n.text=i.name;var a=i.billboard;if(l(a)||(a=l(r.billboard)?r.billboard.clone():Se(),i.billboard=a),l(a.image)||(a.image=e._pinBuilder.fromColor(o.YELLOW,64)),l(a.scale)){var s=a.scale.getValue();0!==s?n.pixelOffset=new t(16*s+1,0):(n.pixelOffset=void 0,n.horizontalOrigin=void 0)}}function Ne(e,t,i){var r=t.path;l(r)||(r=new W,r.leadTime=0,t.path=r);var n=i.polyline;l(n)&&(r.material=n.material,r.width=n.width)}function Le(e,t,i,r){var n=fe(t,"coordinates",ut.kml),o=fe(t,"altitudeMode",ut.kml),a=fe(t,"altitudeMode",ut.gx),s=ve(t,"extrude",ut.kml),l=se(n);i.position=De(new B(l),o,a),Oe(e,i,r),s&&ae(o,a)&&Me(e,i,r)}function Fe(e,t,i,r){var n=he(t,"coordinates",ut.kml),a=fe(t,"altitudeMode",ut.kml),s=fe(t,"altitudeMode",ut.gx),u=ve(t,"extrude",ut.kml),c=ve(t,"tessellate",ut.kml),h=ae(a,s),d=le(n),p=r.polyline;if(h&&u){var m=new J;i.wall=m,m.positions=d;var f=r.polygon;l(f)&&(m.fill=f.fill,m.outline=f.outline,m.material=f.material),l(p)&&(m.outlineColor=l(p.material)?p.material.color:o.WHITE,m.outlineWidth=p.width)}else p=l(p)?p.clone():new q,i.polyline=p,p.positions=Re(d,a,s),(!c||h)&&(p.followSurface=!1)}function Be(e,t,i,r){var n=he(t,"outerBoundaryIs",ut.kml),a=he(n,"LinearRing",ut.kml),s=he(a,"coordinates",ut.kml),u=le(s),c=ve(t,"extrude",ut.kml),h=fe(t,"altitudeMode",ut.kml),d=fe(t,"altitudeMode",ut.gx),p=ae(h,d),m=l(r.polygon)?r.polygon.clone():we(),f=r.polyline;if(l(f)&&(m.outlineColor=l(f.material)?f.material.color:o.WHITE,m.outlineWidth=f.width),i.polygon=m,p&&(m.perPositionHeight=!0,m.extrudedHeight=c?0:void 0),l(u)){for(var v=new T(u),g=pe(t,"innerBoundaryIs",ut.kml),_=0;_p;p++){var m=se(a[p].textContent);h.push(m),d.push(_.fromIso8601(s[p].textContent))}var f=new Z;f.addSamples(d,h),i.position=De(f,n,o),Oe(e,i,r),Ne(e,i,r),i.availability=new P,s.length>0&&i.availability.addInterval(new A({start:d[0],stop:d[d.length-1]})),u&&l&&Me(e,i,r)}function ke(e,t,i,r,n,o,a,s,l){var u=e[0],c=e[e.length-1],h=new Z;h.addSamples(e,t),i.intervals.addInterval(new A({start:u,stop:c,isStartIncluded:l,isStopIncluded:l,data:De(h,a,s)})),r.addInterval(new A({start:u,stop:c,isStartIncluded:l,isStopIncluded:l})),n.intervals.addInterval(new A({start:u,stop:c,isStartIncluded:l,isStopIncluded:l,data:o}))}function ze(e,t,i,r){for(var n,o,a,s=ve(t,"interpolate",ut.gx),u=pe(t,"Track",ut.gx),c=!1,h=new Q,d=new P,p=new F,m=0,f=u.length;f>m;m++){var v=u[m],g=pe(v,"when",ut.kml),y=pe(v,"coord",ut.gx),C=fe(v,"altitudeMode",ut.kml),E=fe(v,"altitudeMode",ut.gx),S=ae(C,E),w=ve(v,"extrude",ut.kml),T=Math.min(y.length,g.length),x=[];n=[];for(var b=0;T>b;b++){var A=se(y[b].textContent);x.push(A),n.push(_.fromIso8601(g[b].textContent))}s&&(l(o)&&ke([o,n[0]],[a,x[0]],p,d,h,!1,"absolute",void 0,!1),o=n[T-1],a=x[x.length-1]),ke(n,x,p,d,h,S&&w,C,E,!0),c=c||S&&w}i.availability=d,i.position=p,Oe(e,i,r),Ne(e,i,r),c&&(Me(e,i,r),i.polyline.show=h)}function Ue(e,t,i,r){for(var n=t.childNodes,o=0,a=n.length;a>o;o++){var s=n.item(o),u=dt[s.localName];if(l(u)){var c=oe(s,e._entityCollection);c.parent=i,c.name=i.name,c.availability=i.availability,c.description=i.description,c.kml=i.kml,u(e,s,c,r)}}}function Ge(e,t){var i=he(e,"ExtendedData",ut.kml);if(l(i)){var r={},n=pe(i,"Data",ut.kml);if(l(n))for(var o=n.length,a=0;o>a;a++){var s=n[a],u=ce(s,"name");l(u)&&(r[u]={displayName:fe(s,"displayName",ut.kml),value:fe(s,"value",ut.kml)})}t.kml.extendedData=r}}function We(e,t,i,r){var n,a,u,c=t.kml,h=c.extendedData,d=fe(e,"description",ut.kml),p=s(t.balloonStyle,i.balloonStyle),m=o.WHITE,f=o.BLACK,v=d;l(p)&&(m=s(p.bgColor,o.WHITE),f=s(p.textColor,o.BLACK),v=s(p.text,d));var g;if(l(v)){if(v=v.replace("$[name]",s(t.name,"")),v=v.replace("$[description]",s(d,"")),v=v.replace("$[address]",s(c.address,"")),v=v.replace("$[Snippet]",s(c.snippet,"")),v=v.replace("$[id]",t.id),v=v.replace("$[geDirections]",""),l(h)){var _=v.match(/\$\[.+?\]/g);if(null!==_)for(n=0;n<_.length;n++){var y=_[n],C=y.substr(2,y.length-3),E=/\/displayName$/.test(C);C=C.replace(/\/displayName$/,""),g=h[C],l(g)&&(g=E?g.displayName:g.value),l(g)&&(v=v.replace(y,s(g,"")))}}}else if(l(h)&&(u=Object.keys(h),u.length>0)){for(v='',n=0;n";v+="
"+s(g.displayName,a)+""+s(g.value,"")+"
"}if(l(v)){v=nt.link(v),ht.innerHTML=v;var S=ht.querySelectorAll("a");for(n=0;n1&&(re(ht,"a","href",r),re(ht,"img","src",r));var w='
",ht.innerHTML="",t.description=w}}function He(e,t,i,r,n,o,a){var u=oe(i,r),c=u.kml,h=Ae(u,e,i,n,o,a),d=fe(i,"name",ut.kml);u.name=d,u.parent=t;var p=Ee(i);l(p)||(p=Ce(i)),u.availability=p;var m=ve(i,"visibility",ut.kml);u.show=s(m,!0);var f=he(i,"author",ut.atom),v=c.author;v.name=fe(f,"name",ut.atom),v.uri=fe(f,"uri",ut.atom),v.email=fe(f,"email",ut.atom);var g=he(i,"link",ut.atom),_=c.link;return _.href=ce(g,"href"),_.hreflang=ce(g,"hreflang"),_.rel=ce(g,"rel"),_.type=ce(g,"type"),_.title=ce(g,"title"),_.length=ce(g,"length"),c.address=fe(i,"address",ut.kml),c.phoneNumber=fe(i,"phoneNumber",ut.kml),c.snippet=fe(i,"Snippet",ut.kml),Ge(i,u),We(i,u,h,a),{entity:u,styleEntity:h}}function qe(e,t,i,r,n,o,a){for(var s=Object.keys(pt),l=s.length,u=0;l>u;u++)for(var c=s[u],h=pt[c],d=i.childNodes,p=d.length,m=0;p>m;m++){var f=d[m];f.localName===c&&-1!==ut.kml.indexOf(f.namespaceURI)&&h(e,t,f,r,n,o,a)}}function je(e,t,i,r,n,o,a){var s=He(e,t,i,r,n,o,a);qe(e,s.entity,i,r,n,o,a)}function Ye(e,t,i,r,n,o,a){for(var s=He(e,t,i,r,n,o,a),u=s.entity,c=s.styleEntity,h=!1,d=i.childNodes,p=0,m=d.length;m>p&&!h;p++){var f=d.item(p),v=dt[f.localName];l(v)&&(v(e,f,u,c),h=!0)}h||(u.merge(c),Oe(e,u,c))}function Xe(e,t,i,r,n,o,a){var s,u=He(e,t,i,r,n,o,a),c=u.entity,h=!1,d=le(he(i,"LatLonQuad",ut.gx));if(l(d))s=we(),s.hierarchy=new T(d),c.polygon=s,h=!0;else{s=new Y,c.rectangle=s;var p=he(i,"LatLonBox",ut.kml);if(l(p)){var m=me(p,"west",ut.kml),f=me(p,"south",ut.kml),v=me(p,"east",ut.kml),g=me(p,"north",ut.kml);l(m)&&(m=E.negativePiToPi(E.toRadians(m))),l(f)&&(f=E.negativePiToPi(E.toRadians(f))),l(v)&&(v=E.negativePiToPi(E.toRadians(v))),l(g)&&(g=E.negativePiToPi(E.toRadians(g))),s.coordinates=new x(m,f,v,g);var _=me(p,"rotation",ut.kml);l(_)&&(s.rotation=E.toRadians(_))}}var y=he(i,"Icon",ut.kml),C=fe(y,"href",ut.kml);l(C)?(h&&console.log("KML - gx:LatLonQuad Icon does not support texture projection."),s.material=ge(C,e._proxy,o,a)):s.material=ye(i,"color",ut.kml);var S=fe(i,"altitudeMode",ut.kml);l(S)?"absolute"===S?s.height=me(i,"altitude",ut.kml):"clampToGround"!==S&&console.log("KML - Unknown altitudeMode: "+S):(S=fe(i,"altitudeMode",ut.gx),"relativeToSeaFloor"===S?(console.log("KML - altitudeMode relativeToSeaFloor is currently not supported, treating as absolute."),s.height=me(i,"altitude",ut.kml)):"clampToSeaFloor"===S?console.log("KML - altitudeMode clampToSeaFloor is currently not supported, treating as clampToGround."):l(S)&&console.log("KML - Unknown altitudeMode: "+S))}function Ze(e,t,i,r,n,o,a){console.log("KML - Unsupported feature: "+i.localName)}function Ke(e,t,i,r,n,o,a){var s=He(e,t,i,r,n,o,a),u=s.entity,c=he(i,"Link",ut.kml);if(l(c)){var h=fe(c,"href",ut.kml);if(l(h)){h=ge(h,void 0,o,a);var d=new et(e._proxy),p=O(d.load(h),function(){for(var t=d.entities.values,i=0;ir;r++)if(!o.isConstant(t[r]))return!1;return!0}},definitionChanged:{get:function(){return this._definitionChanged}}}),a.prototype.getValue=function(t,i){var r=this._value;if(e(r)){var n=r.length;e(i)||(i=new Array(n));for(var o=0,a=0;n>o;){var s=this._value[o],l=s.getValue(t,i[o]);e(l)&&(i[a]=l,a++),o++}return i.length=a,i}},a.prototype.setValue=function(t){var i=this._eventHelper;if(i.removeAll(),e(t)){this._value=t.slice();for(var r=t.length,n=0;r>n;n++){var o=t[n];e(o)&&i.add(o.definitionChanged,a.prototype._raiseDefinitionChanged,this)}}else this._value=void 0;this._definitionChanged.raiseEvent(this)},a.prototype.equals=function(e){return this===e||e instanceof a&&o.arrayEquals(this._value,e._value)},a.prototype._raiseDefinitionChanged=function(){this._definitionChanged.raiseEvent(this)},a}),i("DataSources/VelocityOrientationProperty",["../Core/Cartesian3","../Core/defaultValue","../Core/defined","../Core/defineProperties","../Core/DeveloperError","../Core/Ellipsoid","../Core/Event","../Core/JulianDate","../Core/Matrix3","../Core/Quaternion","../Core/Transforms","./Property"],function(e,t,i,r,n,o,a,s,l,u,c,h){"use strict";function d(e,i){this._position=void 0,this._subscription=void 0,this._ellipsoid=void 0,this._definitionChanged=new a,this.position=e,this.ellipsoid=t(i,o.WGS84)}r(d.prototype,{isConstant:{get:function(){return h.isConstant(this._position)}},definitionChanged:{get:function(){return this._definitionChanged}},position:{get:function(){return this._position},set:function(e){var t=this._position;t!==e&&(i(t)&&this._subscription(),this._position=e,i(e)&&(this._subscription=e._definitionChanged.addEventListener(function(){this._definitionChanged.raiseEvent(this)},this)),this._definitionChanged.raiseEvent(this))}},ellipsoid:{get:function(){return this._ellipsoid},set:function(e){var t=this._ellipsoid;t!==e&&(this._ellipsoid=e,this._definitionChanged.raiseEvent(this))}}});var p=new e,m=new e,f=new e,v=new s,g=new l,_=1/60;return d.prototype.getValue=function(t,r){var n=this._position;if(!h.isConstant(n)){var o=n.getValue(t,p),a=n.getValue(s.addSeconds(t,_,v),m);if(i(o)&&(i(a)||(a=o,o=n.getValue(s.addSeconds(t,-_,v),m),i(o)))&&!e.equals(o,a)){var l=e.subtract(a,o,f);return e.normalize(l,l),c.rotationMatrixFromPositionVelocity(o,l,this._ellipsoid,g),u.fromRotationMatrix(g,r)}}},d.prototype.equals=function(e){return this===e||e instanceof d&&h.equals(this._position,e._position)&&(this._ellipsoid===e._ellipsoid||this._ellipsoid.equals(e._ellipsoid))},d}),i("DataSources/Visualizer",["../Core/DeveloperError"],function(e){"use strict";function t(){e.throwInstantiationError()}return t.prototype.update=e.throwInstantiationError,t.prototype.getBoundingSphere=e.throwInstantiationError,t.prototype.isDestroyed=e.throwInstantiationError,t.prototype.destroy=e.throwInstantiationError,t}),i("Renderer/ClearCommand",["../Core/Color","../Core/defaultValue","../Core/freezeObject"],function(e,t,i){"use strict";function r(e){e=t(e,t.EMPTY_OBJECT),this.color=e.color,this.depth=e.depth,this.stencil=e.stencil,this.renderState=e.renderState,this.framebuffer=e.framebuffer,this.owner=e.owner}return r.ALL=i(new r({color:new e(0,0,0,0),depth:1,stencil:0})),r.prototype.execute=function(e,t){e.clear(this,t)},r}),i("Renderer/ComputeCommand",["../Core/defaultValue","../Core/PrimitiveType","../Scene/Pass"],function(e,t,i){"use strict";function r(t){t=e(t,e.EMPTY_OBJECT),this.vertexArray=t.vertexArray,this.fragmentShaderSource=t.fragmentShaderSource,this.shaderProgram=t.shaderProgram,this.uniformMap=t.uniformMap,this.outputTexture=t.outputTexture,this.preExecute=t.preExecute,this.postExecute=t.postExecute,this.persists=e(t.persists,!1),this.pass=i.COMPUTE,this.owner=t.owner}return r.prototype.execute=function(e){e.execute(this)},r}),i("Shaders/ViewportQuadVS",[],function(){"use strict";return"attribute vec4 position;\nattribute vec2 textureCoordinates;\nvarying vec2 v_textureCoordinates;\nvoid main()\n{\ngl_Position = position;\nv_textureCoordinates = textureCoordinates;\n}\n"}),i("Renderer/ComputeEngine",["../Core/BoundingRectangle","../Core/Color","../Core/ComponentDatatype","../Core/defaultValue","../Core/defined","../Core/defineProperties","../Core/destroyObject","../Core/DeveloperError","../Core/Geometry","../Core/GeometryAttribute","../Core/PrimitiveType","../Shaders/ViewportQuadVS","./BufferUsage","./ClearCommand","./DrawCommand","./Framebuffer","./RenderState","./ShaderProgram"],function(e,t,i,r,n,o,a,s,l,u,c,h,d,p,m,f,v,g){"use strict";function _(e){this._context=e}function y(e,t){return new f({context:e,colorTextures:[t],destroyAttachments:!1})}function C(e,t){return g.fromCache({context:e,vertexShaderSource:h,fragmentShaderSource:t,attributeLocations:{position:0,textureCoordinates:1}})}function E(t,i){return n(S)&&S.viewport.width===t&&S.viewport.height===i||(S=v.fromCache({viewport:new e(0,0,t,i)})),S}var S,w=new m({primitiveType:c.TRIANGLES}),T=new p({color:new t(0,0,0,0)});return _.prototype.execute=function(e){n(e.preExecute)&&e.preExecute(e);var t=e.outputTexture,i=t.width,r=t.height,o=this._context,a=n(e.vertexArray)?e.vertexArray:o.getViewportQuadVertexArray(),s=n(e.shaderProgram)?e.shaderProgram:C(o,e.fragmentShaderSource),l=y(o,t),u=E(i,r),c=e.uniformMap,h=T;h.framebuffer=l,h.renderState=u,h.execute(o);var d=w;d.vertexArray=a,d.renderState=u,d.shaderProgram=s,d.uniformMap=c,d.framebuffer=l,d.execute(o),l.destroy(),e.persists||(s.destroy(),n(e.vertexArray)&&a.destroy()),n(e.postExecute)&&e.postExecute(t)},_.prototype.isDestroyed=function(){return!1},_.prototype.destroy=function(){return a(this)},_}),i("Renderer/PassState",["../Core/BoundingRectangle"],function(e){"use strict";function t(e){this.context=e,this.framebuffer=void 0,this.blendingEnabled=void 0,this.scissorTest=void 0,this.viewport=void 0}return t}),i("Renderer/RenderbufferFormat",["../Core/freezeObject","./WebGLConstants"],function(e,t){"use strict";var i={RGBA4:t.RGBA4,RGB5_A1:t.RGB5_A1,RGB565:t.RGB565,DEPTH_COMPONENT16:t.DEPTH_COMPONENT16,STENCIL_INDEX8:t.STENCIL_INDEX8,DEPTH_STENCIL:t.DEPTH_STENCIL,validate:function(e){return e===i.RGBA4||e===i.RGB5_A1||e===i.RGB565||e===i.DEPTH_COMPONENT16||e===i.STENCIL_INDEX8||e===i.DEPTH_STENCIL}};return e(i)}),i("Renderer/Renderbuffer",["../Core/defaultValue","../Core/defined","../Core/defineProperties","../Core/destroyObject","../Core/DeveloperError","./ContextLimits","./RenderbufferFormat"],function(e,t,i,r,n,o,a){"use strict";function s(i){i=e(i,e.EMPTY_OBJECT);var r=i.context,n=r._gl,s=(o.maximumRenderbufferSize,e(i.format,a.RGBA4)),l=t(i.width)?i.width:n.drawingBufferWidth,u=t(i.height)?i.height:n.drawingBufferHeight;this._gl=n,this._format=s,this._width=l,this._height=u,this._renderbuffer=this._gl.createRenderbuffer(),n.bindRenderbuffer(n.RENDERBUFFER,this._renderbuffer),n.renderbufferStorage(n.RENDERBUFFER,s,l,u),n.bindRenderbuffer(n.RENDERBUFFER,null)}return i(s.prototype,{format:{get:function(){return this._format}},width:{get:function(){return this._width}},height:{get:function(){return this._height}}}),s.prototype._getRenderbuffer=function(){return this._renderbuffer},s.prototype.isDestroyed=function(){return!1},s.prototype.destroy=function(){return this._gl.deleteRenderbuffer(this._renderbuffer),r(this)},s}),i("Renderer/PickFramebuffer",["../Core/BoundingRectangle","../Core/Color","../Core/defaultValue","../Core/defined","../Core/destroyObject","./Framebuffer","./PassState","./Renderbuffer","./RenderbufferFormat","./Texture"],function(e,t,i,r,n,o,a,s,l,u){"use strict";function c(t){var i=new a(t);i.blendingEnabled=!1,i.scissorTest={enabled:!0,rectangle:new e},i.viewport=new e,this._context=t,this._fb=void 0,this._passState=i,this._width=0,this._height=0}c.prototype.begin=function(t){var i=this._context,n=i.drawingBufferWidth,a=i.drawingBufferHeight;return e.clone(t,this._passState.scissorTest.rectangle),r(this._fb)&&this._width===n&&this._height===a||(this._width=n,this._height=a,this._fb=this._fb&&this._fb.destroy(),this._fb=new o({context:i,colorTextures:[new u({context:i,width:n,height:a})],depthStencilRenderbuffer:new s({context:i,format:l.DEPTH_STENCIL})}),this._passState.framebuffer=this._fb),this._passState.viewport.width=n,this._passState.viewport.height=a,this._passState};var h=new t;return c.prototype.end=function(e){for(var n=i(e.width,1),o=i(e.height,1),a=this._context,s=a.readPixels({x:e.x,y:e.y,width:n,height:o,framebuffer:this._fb}),l=Math.max(n,o),u=l*l,c=Math.floor(.5*n),d=Math.floor(.5*o),p=0,m=0,f=0,v=-1,g=0;u>g;++g){if(p>=-c&&c>=p&&m>=-d&&d>=m){var _=4*((d-m)*n+p+c);h.red=t.byteToFloat(s[_]),h.green=t.byteToFloat(s[_+1]),h.blue=t.byteToFloat(s[_+2]),h.alpha=t.byteToFloat(s[_+3]);var y=a.getObjectByPickColor(h);if(r(y))return y}if(p===m||0>p&&-p===m||p>0&&p===1-m){var C=f;f=-v,v=C}p+=f,m+=v}},c.prototype.isDestroyed=function(){return!1},c.prototype.destroy=function(){return this._fb=this._fb&&this._fb.destroy(),n(this)},c}),i("Renderer/ShaderCache",["../Core/defined","../Core/defineProperties","../Core/destroyObject","./ShaderProgram","./ShaderSource"],function(e,t,i,r,n){"use strict";function o(e){this._context=e,this._shaders={},this._numberOfShaders=0,this._shadersToRelease={}}return t(o.prototype,{numberOfShaders:{get:function(){return this._numberOfShaders}}}),o.prototype.replaceShaderProgram=function(t){return e(t.shaderProgram)&&t.shaderProgram.destroy(),this.getShaderProgram(t)},o.prototype.getShaderProgram=function(e){var t=e.vertexShaderSource,i=e.fragmentShaderSource,o=e.attributeLocations;"string"==typeof t&&(t=new n({sources:[t]})),"string"==typeof i&&(i=new n({sources:[i]}));var a,s=t.createCombinedVertexShader(),l=i.createCombinedFragmentShader(),u=s+l+JSON.stringify(o);if(this._shaders[u])a=this._shaders[u],delete this._shadersToRelease[u];else{var c=this._context,h=new r({gl:c._gl,logShaderCompilation:c.logShaderCompilation,debugShaders:c.debugShaders,vertexShaderSource:t,vertexShaderText:s,fragmentShaderSource:i,fragmentShaderText:l,attributeLocations:o});a={cache:this,shaderProgram:h,keyword:u,count:0},h._cachedShader=a,this._shaders[u]=a,++this._numberOfShaders}return++a.count,a.shaderProgram},o.prototype.destroyReleasedShaderPrograms=function(){var e=this._shadersToRelease;for(var t in e)if(e.hasOwnProperty(t)){var i=e[t];delete this._shaders[i.keyword],i.shaderProgram.finalDestroy(), ---this._numberOfShaders}this._shadersToRelease={}},o.prototype.releaseShaderProgram=function(t){if(e(t)){var i=t._cachedShader;i&&0===--i.count&&(this._shadersToRelease[i.keyword]=i)}},o.prototype.isDestroyed=function(){return!1},o.prototype.destroy=function(){var e=this._shaders;for(var t in e)e.hasOwnProperty(t)&&e[t].shaderProgram.finalDestroy();return i(this)},o}),i("Renderer/UniformState",["../Core/BoundingRectangle","../Core/Cartesian2","../Core/Cartesian3","../Core/Cartesian4","../Core/Cartographic","../Core/defined","../Core/defineProperties","../Core/EncodedCartesian3","../Core/Math","../Core/Matrix3","../Core/Matrix4","../Core/Simon1994PlanetaryPositions","../Core/Transforms","../Scene/SceneMode"],function(e,t,i,r,n,o,a,s,l,u,c,h,d,p){"use strict";function m(){this.globeDepthTexture=void 0,this._viewport=new e,this._viewportCartesian4=new r,this._viewportDirty=!1,this._viewportOrthographicMatrix=c.clone(c.IDENTITY),this._viewportTransformation=c.clone(c.IDENTITY),this._model=c.clone(c.IDENTITY),this._view=c.clone(c.IDENTITY),this._inverseView=c.clone(c.IDENTITY),this._projection=c.clone(c.IDENTITY),this._infiniteProjection=c.clone(c.IDENTITY),this._entireFrustum=new t,this._currentFrustum=new t,this._frustumPlanes=new r,this._frameState=void 0,this._temeToPseudoFixed=u.clone(c.IDENTITY),this._view3DDirty=!0,this._view3D=new c,this._inverseView3DDirty=!0,this._inverseView3D=new c,this._inverseModelDirty=!0,this._inverseModel=new c,this._inverseTransposeModelDirty=!0,this._inverseTransposeModel=new u,this._viewRotation=new u,this._inverseViewRotation=new u,this._viewRotation3D=new u,this._inverseViewRotation3D=new u,this._inverseProjectionDirty=!0,this._inverseProjection=new c,this._inverseProjectionOITDirty=!0,this._inverseProjectionOIT=new c,this._modelViewDirty=!0,this._modelView=new c,this._modelView3DDirty=!0,this._modelView3D=new c,this._modelViewRelativeToEyeDirty=!0,this._modelViewRelativeToEye=new c,this._inverseModelViewDirty=!0,this._inverseModelView=new c,this._inverseModelView3DDirty=!0,this._inverseModelView3D=new c,this._viewProjectionDirty=!0,this._viewProjection=new c,this._inverseViewProjectionDirty=!0,this._inverseViewProjection=new c,this._modelViewProjectionDirty=!0,this._modelViewProjection=new c,this._inverseModelViewProjectionDirty=!0,this._inverseModelViewProjection=new c,this._modelViewProjectionRelativeToEyeDirty=!0,this._modelViewProjectionRelativeToEye=new c,this._modelViewInfiniteProjectionDirty=!0,this._modelViewInfiniteProjection=new c,this._normalDirty=!0,this._normal=new u,this._normal3DDirty=!0,this._normal3D=new u,this._inverseNormalDirty=!0,this._inverseNormal=new u,this._inverseNormal3DDirty=!0,this._inverseNormal3D=new u,this._encodedCameraPositionMCDirty=!0,this._encodedCameraPositionMC=new s,this._cameraPosition=new i,this._sunPositionWC=new i,this._sunPositionColumbusView=new i,this._sunDirectionWC=new i,this._sunDirectionEC=new i,this._moonDirectionEC=new i,this._mode=void 0,this._mapProjection=void 0,this._cameraDirection=new i,this._cameraRight=new i,this._cameraUp=new i,this._frustum2DWidth=0,this._eyeHeight2D=new t,this._resolutionScale=1,this._fogDensity=void 0}function f(e,t){c.clone(t,e._view),c.getRotation(t,e._viewRotation),e._view3DDirty=!0,e._inverseView3DDirty=!0,e._modelViewDirty=!0,e._modelView3DDirty=!0,e._modelViewRelativeToEyeDirty=!0,e._inverseModelViewDirty=!0,e._inverseModelView3DDirty=!0,e._viewProjectionDirty=!0,e._modelViewProjectionDirty=!0,e._modelViewProjectionRelativeToEyeDirty=!0,e._modelViewInfiniteProjectionDirty=!0,e._normalDirty=!0,e._inverseNormalDirty=!0,e._normal3DDirty=!0,e._inverseNormal3DDirty=!0}function v(e,t){c.clone(t,e._inverseView),c.getRotation(t,e._inverseViewRotation)}function g(e,t){c.clone(t,e._projection),e._inverseProjectionDirty=!0,e._inverseProjectionOITDirty=!0,e._viewProjectionDirty=!0,e._modelViewProjectionDirty=!0,e._modelViewProjectionRelativeToEyeDirty=!0}function _(e,t){c.clone(t,e._infiniteProjection),e._modelViewInfiniteProjectionDirty=!0}function y(e,t){i.clone(t.positionWC,e._cameraPosition),i.clone(t.directionWC,e._cameraDirection),i.clone(t.rightWC,e._cameraRight),i.clone(t.upWC,e._cameraUp),e._encodedCameraPositionMCDirty=!0}function C(e,t){o(d.computeIcrfToFixedMatrix(t.time,W))||(W=d.computeTemeToPseudoFixedMatrix(t.time,W));var r=h.computeSunPositionInEarthInertialFrame(t.time,e._sunPositionWC);u.multiplyByVector(W,r,r),i.normalize(r,e._sunDirectionWC),r=u.multiplyByVector(e.viewRotation3D,r,e._sunDirectionEC),i.normalize(r,r),r=h.computeMoonPositionInEarthInertialFrame(t.time,e._moonDirectionEC),u.multiplyByVector(W,r,r),u.multiplyByVector(e.viewRotation3D,r,r),i.normalize(r,r);var n=t.mapProjection,a=n.ellipsoid,s=a.cartesianToCartographic(e._sunPositionWC,H);n.project(s,e._sunPositionColumbusView)}function E(e){if(e._viewportDirty){var t=e._viewport;c.computeOrthographicOffCenter(t.x,t.x+t.width,t.y,t.y+t.height,0,1,e._viewportOrthographicMatrix),c.computeViewportTransformation(t,0,1,e._viewportTransformation),e._viewportDirty=!1}}function S(e){e._inverseProjectionDirty&&(e._inverseProjectionDirty=!1,c.inverse(e._projection,e._inverseProjection))}function w(e){e._inverseProjectionOITDirty&&(e._inverseProjectionOITDirty=!1,e._mode!==p.SCENE2D&&e._mode!==p.MORPHING?c.inverse(e._projection,e._inverseProjectionOIT):c.clone(c.IDENTITY,e._inverseProjectionOIT))}function T(e){e._modelViewDirty&&(e._modelViewDirty=!1,c.multiplyTransformation(e._view,e._model,e._modelView))}function x(e){e._modelView3DDirty&&(e._modelView3DDirty=!1,c.multiplyTransformation(e.view3D,e._model,e._modelView3D))}function b(e){e._inverseModelViewDirty&&(e._inverseModelViewDirty=!1,c.inverse(e.modelView,e._inverseModelView))}function A(e){e._inverseModelView3DDirty&&(e._inverseModelView3DDirty=!1,c.inverse(e.modelView3D,e._inverseModelView3D))}function P(e){e._viewProjectionDirty&&(e._viewProjectionDirty=!1,c.multiply(e._projection,e._view,e._viewProjection))}function I(e){e._inverseViewProjectionDirty&&(e._inverseViewProjectionDirty=!1,c.inverse(e.viewProjection,e._inverseViewProjection))}function M(e){e._modelViewProjectionDirty&&(e._modelViewProjectionDirty=!1,c.multiply(e._projection,e.modelView,e._modelViewProjection))}function D(e){if(e._modelViewRelativeToEyeDirty){e._modelViewRelativeToEyeDirty=!1;var t=e.modelView,i=e._modelViewRelativeToEye;i[0]=t[0],i[1]=t[1],i[2]=t[2],i[3]=t[3],i[4]=t[4],i[5]=t[5],i[6]=t[6],i[7]=t[7],i[8]=t[8],i[9]=t[9],i[10]=t[10],i[11]=t[11],i[12]=0,i[13]=0,i[14]=0,i[15]=t[15]}}function R(e){e._inverseModelViewProjectionDirty&&(e._inverseModelViewProjectionDirty=!1,c.inverse(e.modelViewProjection,e._inverseModelViewProjection))}function O(e){e._modelViewProjectionRelativeToEyeDirty&&(e._modelViewProjectionRelativeToEyeDirty=!1,c.multiply(e._projection,e.modelViewRelativeToEye,e._modelViewProjectionRelativeToEye))}function N(e){e._modelViewInfiniteProjectionDirty&&(e._modelViewInfiniteProjectionDirty=!1,c.multiply(e._infiniteProjection,e.modelView,e._modelViewInfiniteProjection))}function L(e){if(e._normalDirty){e._normalDirty=!1;var t=e._normal;c.getRotation(e.inverseModelView,t),u.transpose(t,t)}}function F(e){if(e._normal3DDirty){e._normal3DDirty=!1;var t=e._normal3D;c.getRotation(e.inverseModelView3D,t),u.transpose(t,t)}}function B(e){e._inverseNormalDirty&&(e._inverseNormalDirty=!1,c.getRotation(e.inverseModelView,e._inverseNormal))}function V(e){e._inverseNormal3DDirty&&(e._inverseNormal3DDirty=!1,c.getRotation(e.inverseModelView3D,e._inverseNormal3D))}function k(e){e._encodedCameraPositionMCDirty&&(e._encodedCameraPositionMCDirty=!1,c.multiplyByPoint(e.inverseModel,e._cameraPosition,q),s.fromCartesian(q,e._encodedCameraPositionMC))}function z(e,t,r,n,a,s,u,h){var m=j;m.x=e.y,m.y=e.z,m.z=e.x;var f=Y;f.x=r.y,f.y=r.z,f.z=r.x;var v=X;v.x=n.y,v.y=n.z,v.z=n.x;var g=Z;g.x=t.y,g.y=t.z,g.z=t.x,s===p.SCENE2D&&(m.z=.5*a);var _=u.unproject(m,K);_.longitude=l.clamp(_.longitude,-Math.PI,Math.PI),_.latitude=l.clamp(_.latitude,-l.PI_OVER_TWO,l.PI_OVER_TWO);var y=u.ellipsoid,C=y.cartographicToCartesian(_,Q),E=d.eastNorthUpToFixedFrame(C,y,J);return c.multiplyByPointAsVector(E,f,f),c.multiplyByPointAsVector(E,v,v),c.multiplyByPointAsVector(E,g,g),o(h)||(h=new c),h[0]=f.x,h[1]=v.x,h[2]=-g.x,h[3]=0,h[4]=f.y,h[5]=v.y,h[6]=-g.y,h[7]=0,h[8]=f.z,h[9]=v.z,h[10]=-g.z,h[11]=0,h[12]=-i.dot(f,C),h[13]=-i.dot(v,C),h[14]=i.dot(g,C),h[15]=1,h}function U(e){e._view3DDirty&&(e._mode===p.SCENE3D?c.clone(e._view,e._view3D):z(e._cameraPosition,e._cameraDirection,e._cameraRight,e._cameraUp,e._frustum2DWidth,e._mode,e._mapProjection,e._view3D),c.getRotation(e._view3D,e._viewRotation3D),e._view3DDirty=!1)}function G(e){e._inverseView3DDirty&&(c.inverseTransformation(e.view3D,e._inverseView3D),c.getRotation(e._inverseView3D,e._inverseViewRotation3D),e._inverseView3DDirty=!1)}a(m.prototype,{frameState:{get:function(){return this._frameState}},viewport:{get:function(){return this._viewport},set:function(t){if(!e.equals(t,this._viewport)){e.clone(t,this._viewport);var i=this._viewport,r=this._viewportCartesian4;r.x=i.x,r.y=i.y,r.z=i.width,r.w=i.height,this._viewportDirty=!0}}},viewportCartesian4:{get:function(){return this._viewportCartesian4}},viewportOrthographic:{get:function(){return E(this),this._viewportOrthographicMatrix}},viewportTransformation:{get:function(){return E(this),this._viewportTransformation}},model:{get:function(){return this._model},set:function(e){c.clone(e,this._model),this._modelView3DDirty=!0,this._inverseModelView3DDirty=!0,this._inverseModelDirty=!0,this._inverseTransposeModelDirty=!0,this._modelViewDirty=!0,this._inverseModelViewDirty=!0,this._viewProjectionDirty=!0,this._inverseViewProjectionDirty=!0,this._modelViewRelativeToEyeDirty=!0,this._inverseModelViewDirty=!0,this._modelViewProjectionDirty=!0,this._inverseModelViewProjectionDirty=!0,this._modelViewProjectionRelativeToEyeDirty=!0,this._modelViewInfiniteProjectionDirty=!0,this._normalDirty=!0,this._inverseNormalDirty=!0,this._normal3DDirty=!0,this._inverseNormal3DDirty=!0,this._encodedCameraPositionMCDirty=!0}},inverseModel:{get:function(){return this._inverseModelDirty&&(this._inverseModelDirty=!1,c.inverse(this._model,this._inverseModel)),this._inverseModel}},inverseTranposeModel:{get:function(){var e=this._inverseTransposeModel;return this._inverseTransposeModelDirty&&(this._inverseTransposeModelDirty=!1,c.getRotation(this.inverseModel,e),u.transpose(e,e)),e}},view:{get:function(){return this._view}},view3D:{get:function(){return U(this),this._view3D}},viewRotation:{get:function(){return U(this),this._viewRotation}},viewRotation3D:{get:function(){return U(this),this._viewRotation3D}},inverseView:{get:function(){return this._inverseView}},inverseView3D:{get:function(){return G(this),this._inverseView3D}},inverseViewRotation:{get:function(){return this._inverseViewRotation}},inverseViewRotation3D:{get:function(){return G(this),this._inverseViewRotation3D}},projection:{get:function(){return this._projection}},inverseProjection:{get:function(){return S(this),this._inverseProjection}},inverseProjectionOIT:{get:function(){return w(this),this._inverseProjectionOIT}},infiniteProjection:{get:function(){return this._infiniteProjection}},modelView:{get:function(){return T(this),this._modelView}},modelView3D:{get:function(){return x(this),this._modelView3D}},modelViewRelativeToEye:{get:function(){return D(this),this._modelViewRelativeToEye}},inverseModelView:{get:function(){return b(this),this._inverseModelView}},inverseModelView3D:{get:function(){return A(this),this._inverseModelView3D}},viewProjection:{get:function(){return P(this),this._viewProjection}},inverseViewProjection:{get:function(){return I(this),this._inverseViewProjection}},modelViewProjection:{get:function(){return M(this),this._modelViewProjection}},inverseModelViewProjection:{get:function(){return R(this),this._inverseModelViewProjection}},modelViewProjectionRelativeToEye:{get:function(){return O(this),this._modelViewProjectionRelativeToEye}},modelViewInfiniteProjection:{get:function(){return N(this),this._modelViewInfiniteProjection}},normal:{get:function(){return L(this),this._normal}},normal3D:{get:function(){return F(this),this._normal3D}},inverseNormal:{get:function(){return B(this),this._inverseNormal}},inverseNormal3D:{get:function(){return V(this),this._inverseNormal3D}},entireFrustum:{get:function(){return this._entireFrustum}},currentFrustum:{get:function(){return this._currentFrustum}},frustumPlanes:{get:function(){return this._frustumPlanes}},eyeHeight2D:{get:function(){return this._eyeHeight2D}},sunPositionWC:{get:function(){return this._sunPositionWC}},sunPositionColumbusView:{get:function(){return this._sunPositionColumbusView}},sunDirectionWC:{get:function(){return this._sunDirectionWC}},sunDirectionEC:{get:function(){return this._sunDirectionEC}},moonDirectionEC:{get:function(){return this._moonDirectionEC}},encodedCameraPositionMCHigh:{get:function(){return k(this),this._encodedCameraPositionMC.high}},encodedCameraPositionMCLow:{get:function(){return k(this),this._encodedCameraPositionMC.low}},temeToPseudoFixedMatrix:{get:function(){return this._temeToPseudoFixed}},resolutionScale:{get:function(){return this._resolutionScale}},fogDensity:{get:function(){return this._fogDensity}}});var W=new u,H=new n;m.prototype.updateFrustum=function(e){g(this,e.projectionMatrix),o(e.infiniteProjectionMatrix)&&_(this,e.infiniteProjectionMatrix),this._currentFrustum.x=e.near,this._currentFrustum.y=e.far,o(e.top)||(e=e._offCenterFrustum),this._frustumPlanes.x=e.top,this._frustumPlanes.y=e.bottom,this._frustumPlanes.z=e.left,this._frustumPlanes.w=e.right},m.prototype.update=function(e){this._mode=e.mode,this._mapProjection=e.mapProjection;var t=e.context._canvas;this._resolutionScale=t.width/t.clientWidth;var i=e.camera;f(this,i.viewMatrix),v(this,i.inverseViewMatrix),y(this,i),e.mode===p.SCENE2D?(this._frustum2DWidth=i.frustum.right-i.frustum.left,this._eyeHeight2D.x=.5*this._frustum2DWidth,this._eyeHeight2D.y=this._eyeHeight2D.x*this._eyeHeight2D.x):(this._frustum2DWidth=0,this._eyeHeight2D.x=0,this._eyeHeight2D.y=0),C(this,e),this._entireFrustum.x=i.frustum.near,this._entireFrustum.y=i.frustum.far,this.updateFrustum(i.frustum),this._fogDensity=e.fog.density,this._frameState=e,this._temeToPseudoFixed=d.computeTemeToPseudoFixedMatrix(e.time,this._temeToPseudoFixed)};var q=new i,j=new i,Y=new i,X=new i,Z=new i,K=new n,Q=new i,J=new c;return m}),i("Renderer/Context",["../Core/clone","../Core/Color","../Core/ComponentDatatype","../Core/createGuid","../Core/defaultValue","../Core/defined","../Core/defineProperties","../Core/destroyObject","../Core/DeveloperError","../Core/FeatureDetection","../Core/Geometry","../Core/GeometryAttribute","../Core/Math","../Core/Matrix4","../Core/PrimitiveType","../Core/RuntimeError","../Shaders/ViewportQuadVS","./BufferUsage","./ClearCommand","./ContextLimits","./CubeMap","./DrawCommand","./PassState","./PickFramebuffer","./PixelDatatype","./RenderbufferFormat","./RenderState","./ShaderCache","./ShaderProgram","./Texture","./UniformState","./VertexArray","./WebGLConstants"],function(e,t,i,r,n,o,a,s,l,u,c,h,d,p,m,f,v,g,_,y,C,E,S,w,T,x,b,A,P,I,M,D,R){"use strict";function O(e,t){var i="WebGL Error: ";switch(t){case e.INVALID_ENUM:i+="INVALID_ENUM";break;case e.INVALID_VALUE:i+="INVALID_VALUE";break;case e.INVALID_OPERATION:i+="INVALID_OPERATION";break;case e.OUT_OF_MEMORY:i+="OUT_OF_MEMORY";break;case e.CONTEXT_LOST_WEBGL:i+="CONTEXT_LOST_WEBGL lost";break;default:i+="Unknown ("+t+")"}return i}function N(e,t,i,r){for(var n=O(e,r)+": "+t.name+"(",o=0;or;++r){var n=e.getExtension(t[r]);if(n)return n}}function k(i,a){if("undefined"==typeof WebGLRenderingContext)throw new f("The browser does not support WebGL. Visit http://get.webgl.org.");this._canvas=i,a=e(a,!0),a=n(a,{}),a.allowTextureFilterAnisotropic=n(a.allowTextureFilterAnisotropic,!0);var s=n(a.webgl,{});s.alpha=n(s.alpha,!1);var l,u=!1,c="undefined"!=typeof WebGL2RenderingContext,h=!1;if(u&&c&&(l=i.getContext("webgl2",s)||i.getContext("experimental-webgl2",s)||void 0,o(l)&&(h=!0)),o(l)||(l=i.getContext("webgl",s)||i.getContext("experimental-webgl",s)||void 0),!o(l))throw new f("The browser supports WebGL, but initialization failed.");this._originalGLContext=l,this._webgl2=h,this._id=r(),this.validateFramebuffer=!1,this.validateShaderProgram=!1,this.logShaderCompilation=!1,this._throwOnWebGLError=!1,this._shaderCache=new A(this);var d=this._gl=this._originalGLContext;this._redBits=d.getParameter(d.RED_BITS),this._greenBits=d.getParameter(d.GREEN_BITS),this._blueBits=d.getParameter(d.BLUE_BITS),this._alphaBits=d.getParameter(d.ALPHA_BITS),this._depthBits=d.getParameter(d.DEPTH_BITS),this._stencilBits=d.getParameter(d.STENCIL_BITS),y._maximumCombinedTextureImageUnits=d.getParameter(d.MAX_COMBINED_TEXTURE_IMAGE_UNITS),y._maximumCubeMapSize=d.getParameter(d.MAX_CUBE_MAP_TEXTURE_SIZE),y._maximumFragmentUniformVectors=d.getParameter(d.MAX_FRAGMENT_UNIFORM_VECTORS),y._maximumTextureImageUnits=d.getParameter(d.MAX_TEXTURE_IMAGE_UNITS),y._maximumRenderbufferSize=d.getParameter(d.MAX_RENDERBUFFER_SIZE),y._maximumTextureSize=d.getParameter(d.MAX_TEXTURE_SIZE),y._maximumVaryingVectors=d.getParameter(d.MAX_VARYING_VECTORS),y._maximumVertexAttributes=d.getParameter(d.MAX_VERTEX_ATTRIBS),y._maximumVertexTextureImageUnits=d.getParameter(d.MAX_VERTEX_TEXTURE_IMAGE_UNITS),y._maximumVertexUniformVectors=d.getParameter(d.MAX_VERTEX_UNIFORM_VECTORS);var p=d.getParameter(d.ALIASED_LINE_WIDTH_RANGE);y._minimumAliasedLineWidth=p[0],y._maximumAliasedLineWidth=p[1];var m=d.getParameter(d.ALIASED_POINT_SIZE_RANGE);y._minimumAliasedPointSize=m[0],y._maximumAliasedPointSize=m[1];var v=d.getParameter(d.MAX_VIEWPORT_DIMS);y._maximumViewportWidth=v[0],y._maximumViewportHeight=v[1];var g=d.getShaderPrecisionFormat(d.FRAGMENT_SHADER,d.HIGH_FLOAT);y._highpFloatSupported=0!==g.precision;var _=d.getShaderPrecisionFormat(d.FRAGMENT_SHADER,d.HIGH_INT);y._highpIntSupported=0!==_.rangeMax,this._antialias=d.getContextAttributes().antialias,this._standardDerivatives=!!V(d,["OES_standard_derivatives"]),this._elementIndexUint=!!V(d,["OES_element_index_uint"]),this._depthTexture=!!V(d,["WEBGL_depth_texture","WEBKIT_WEBGL_depth_texture"]),this._textureFloat=!!V(d,["OES_texture_float"]),this._fragDepth=!!V(d,["EXT_frag_depth"]),this._debugShaders=V(d,["WEBGL_debug_shaders"]);var C=a.allowTextureFilterAnisotropic?V(d,["EXT_texture_filter_anisotropic","WEBKIT_EXT_texture_filter_anisotropic"]):void 0;this._textureFilterAnisotropic=C,y._maximumTextureFilterAnisotropy=o(C)?d.getParameter(C.MAX_TEXTURE_MAX_ANISOTROPY_EXT):1;var E,w,T,x,P,I,D,O,N,L;if(h){var F=this;E=function(){return F._gl.createVertexArray()},w=function(e){F._gl.bindVertexArray(e)},T=function(e){F._gl.deleteVertexArray(e)},x=function(e,t,i,r,n){d.drawElementsInstanced(e,t,i,r,n)},P=function(e,t,i,r){d.drawArraysInstanced(e,t,i,r)},I=function(e,t){d.vertexAttribDivisor(e,t)},D=function(e){d.drawBuffers(e)}}else O=V(d,["OES_vertex_array_object"]),o(O)&&(E=function(){return O.createVertexArrayOES()},w=function(e){O.bindVertexArrayOES(e)},T=function(e){O.deleteVertexArrayOES(e)}),N=V(d,["ANGLE_instanced_arrays"]),o(N)&&(x=function(e,t,i,r,n){N.drawElementsInstancedANGLE(e,t,i,r,n)},P=function(e,t,i,r){N.drawArraysInstancedANGLE(e,t,i,r)},I=function(e,t){N.vertexAttribDivisorANGLE(e,t)}),L=V(d,["WEBGL_draw_buffers"]),o(L)&&(D=function(e){L.drawBuffersWEBGL(e)});this.glCreateVertexArray=E,this.glBindVertexArray=w,this.glDeleteVertexArray=T,this.glDrawElementsInstanced=x,this.glDrawArraysInstanced=P,this.glVertexAttribDivisor=I,this.glDrawBuffers=D,this._vertexArrayObject=!!O,this._instancedArrays=!!N,this._drawBuffers=!!L,y._maximumDrawBuffers=this.drawBuffers?d.getParameter(R.MAX_DRAW_BUFFERS):1,y._maximumColorAttachments=this.drawBuffers?d.getParameter(R.MAX_COLOR_ATTACHMENTS):1;var B=d.getParameter(d.COLOR_CLEAR_VALUE);this._clearColor=new t(B[0],B[1],B[2],B[3]),this._clearDepth=d.getParameter(d.DEPTH_CLEAR_VALUE),this._clearStencil=d.getParameter(d.STENCIL_CLEAR_VALUE);var k=new M,z=new S(this),U=b.fromCache();this._defaultPassState=z,this._defaultRenderState=U,this._defaultTexture=void 0,this._defaultCubeMap=void 0,this._us=k,this._currentRenderState=U,this._currentPassState=z,this._currentFramebuffer=void 0,this._maxFrameTextureUnitIndex=0,this._vertexAttribDivisors=[],this._previousDrawInstanced=!1;for(var G=0;Gr;++r)e.activeTexture(e.TEXTURE0+r),e.bindTexture(e.TEXTURE_2D,null),e.bindTexture(e.TEXTURE_CUBE_MAP,null)},k.prototype.readPixels=function(e){var t=this._gl;e=e||{};var i=Math.max(e.x||0,0),r=Math.max(e.y||0,0),n=e.width||t.drawingBufferWidth,o=e.height||t.drawingBufferHeight,a=e.framebuffer,s=new Uint8Array(4*n*o);return G(this,a),t.readPixels(i,r,n,o,t.RGBA,t.UNSIGNED_BYTE,s),s};var Z={position:0,textureCoordinates:1};return k.prototype.getViewportQuadVertexArray=function(){var e=this.cache.viewportQuad_vertexArray;if(!o(e)){var t=new c({attributes:{position:new h({componentDatatype:i.FLOAT,componentsPerAttribute:2,values:[-1,-1,1,-1,1,1,-1,1]}),textureCoordinates:new h({componentDatatype:i.FLOAT,componentsPerAttribute:2,values:[0,0,1,0,1,1,0,1]})},indices:new Uint16Array([0,1,2,0,2,3]),primitiveType:m.TRIANGLES});e=D.fromGeometry({context:this,geometry:t,attributeLocations:Z,bufferUsage:g.STATIC_DRAW,interleave:!0}),this.cache.viewportQuad_vertexArray=e}return e},k.prototype.createViewportQuadCommand=function(e,t){return t=n(t,n.EMPTY_OBJECT),new E({vertexArray:this.getViewportQuadVertexArray(),primitiveType:m.TRIANGLES,renderState:t.renderState,shaderProgram:P.fromCache({context:this,vertexShaderSource:v,fragmentShaderSource:e,attributeLocations:Z}),uniformMap:t.uniformMap,owner:t.owner,framebuffer:t.framebuffer})},k.prototype.createPickFramebuffer=function(){return new w(this)},k.prototype.getObjectByPickColor=function(e){return this._pickObjects[e.toRgba()]},a(q.prototype,{object:{get:function(){return this._pickObjects[this.key]},set:function(e){this._pickObjects[this.key]=e}}}),q.prototype.destroy=function(){delete this._pickObjects[this.key]},k.prototype.createPickId=function(e){++this._nextPickColor[0];var i=this._nextPickColor[0];if(0===i)throw new f("Out of unique Pick IDs.");return this._pickObjects[i]=e,new q(this._pickObjects,i,t.fromRgba(i))},k.prototype.isDestroyed=function(){return!1},k.prototype.destroy=function(){var e=this.cache;for(var t in e)if(e.hasOwnProperty(t)){var i=e[t];o(i.destroy)&&i.destroy()}return this._shaderCache=this._shaderCache.destroy(),this._defaultTexture=this._defaultTexture&&this._defaultTexture.destroy(),this._defaultCubeMap=this._defaultCubeMap&&this._defaultCubeMap.destroy(),s(this)},k}),i("Renderer/loadCubeMap",["../Core/defined","../Core/DeveloperError","../Core/loadImage","../ThirdParty/when","./CubeMap"],function(e,t,i,r,n){"use strict";function o(e,t,o){var a=[i(t.positiveX,o),i(t.negativeX,o),i(t.positiveY,o),i(t.negativeY,o),i(t.positiveZ,o),i(t.negativeZ,o)];return r.all(a,function(t){return new n({context:e,source:{positiveX:t[0],negativeX:t[1],positiveY:t[2],negativeY:t[3],positiveZ:t[4],negativeZ:t[5]}})})}return o}),i("Scene/DiscardMissingTileImagePolicy",["../Core/defaultValue","../Core/defined","../Core/DeveloperError","../Core/getImagePixels","../Core/loadImageViaBlob","../ThirdParty/when"],function(e,t,i,r,n,o){"use strict";function a(a){function s(e){t(e.blob)&&(u._missingImageByteLength=e.blob.size);var i=r(e);if(a.disableCheckIfAllPixelsAreTransparent){for(var n=!0,o=e.width,s=a.pixelsToCheck,l=0,c=s.length;n&&c>l;++l){var h=s[l],d=4*h.x+h.y*o,p=i[d+3];p>0&&(n=!1)}n&&(i=void 0)}u._missingImagePixels=i,u._isReady=!0}function l(){u._missingImagePixels=void 0,u._isReady=!0}if(a=e(a,e.EMPTY_OBJECT),!t(a.missingImageUrl))throw new i("options.missingImageUrl is required.");if(!t(a.pixelsToCheck))throw new i("options.pixelsToCheck is required.");this._pixelsToCheck=a.pixelsToCheck,this._missingImagePixels=void 0,this._missingImageByteLength=void 0,this._isReady=!1;var u=this;o(n(a.missingImageUrl),s,l)}return a.prototype.isReady=function(){return this._isReady},a.prototype.shouldDiscardImage=function(e){if(!this._isReady)throw new i("shouldDiscardImage must not be called before the discard policy is ready.");var n=this._pixelsToCheck,o=this._missingImagePixels;if(!t(o))return!1;if(t(e.blob)&&e.blob.size!==this._missingImageByteLength)return!1;for(var a=r(e),s=e.width,l=0,u=n.length;u>l;++l)for(var c=n[l],h=4*c.x+c.y*s,d=0;4>d;++d){var p=h+d;if(a[p]!==o[p])return!1}return!0},a}),i("Scene/ImageryLayerFeatureInfo",["../Core/defined"],function(e){"use strict";function t(){this.name=void 0,this.description=void 0,this.position=void 0,this.data=void 0,this.imageryLayer=void 0}return t.prototype.configureNameFromProperties=function(t){var i,r=10;for(var n in t)if(t.hasOwnProperty(n)&&t[n]){var o=n.toLowerCase();r>1&&"name"===o?(r=1,i=n):r>2&&"title"===o?(r=2,i=n):r>3&&/name/i.test(n)?(r=3,i=n):r>4&&/title/i.test(n)&&(r=4,i=n)}e(i)&&(this.name=t[i])},t.prototype.configureDescriptionFromProperties=function(t){function i(t){var r='';for(var n in t)if(t.hasOwnProperty(n)){var o=t[n];e(o)&&(r+="object"==typeof o?"":"")}return r+="
"+n+""+i(o)+"
"+n+""+o+"
"}this.description=i(t)},t}),i("Scene/ImageryProvider",["../Core/defined","../Core/defineProperties","../Core/DeveloperError","../Core/loadImage","../Core/loadImageViaBlob","../Core/throttleRequestByServer"],function(e,t,i,r,n,o){"use strict";function a(){this.defaultAlpha=void 0, -this.defaultBrightness=void 0,this.defaultContrast=void 0,this.defaultHue=void 0,this.defaultSaturation=void 0,this.defaultGamma=void 0,i.throwInstantiationError()}return t(a.prototype,{ready:{get:i.throwInstantiationError},readyPromise:{get:i.throwInstantiationError},rectangle:{get:i.throwInstantiationError},tileWidth:{get:i.throwInstantiationError},tileHeight:{get:i.throwInstantiationError},maximumLevel:{get:i.throwInstantiationError},minimumLevel:{get:i.throwInstantiationError},tilingScheme:{get:i.throwInstantiationError},tileDiscardPolicy:{get:i.throwInstantiationError},errorEvent:{get:i.throwInstantiationError},credit:{get:i.throwInstantiationError},proxy:{get:i.throwInstantiationError},hasAlphaChannel:{get:i.throwInstantiationError}}),a.prototype.getTileCredits=i.throwInstantiationError,a.prototype.requestImage=i.throwInstantiationError,a.prototype.pickFeatures=i.throwInstantiationError,a.loadImage=function(t,i){return e(t.tileDiscardPolicy)?o(i,n,{headers:t.headers,withCredentials:t.withCredentials}):o(i,r,{headers:t.headers,withCredentials:t.withCredentials})},a}),i("Scene/ArcGisMapServerImageryProvider",["../Core/Cartesian2","../Core/Cartesian3","../Core/Cartographic","../Core/Credit","../Core/defaultValue","../Core/defined","../Core/defineProperties","../Core/DeveloperError","../Core/Event","../Core/GeographicProjection","../Core/GeographicTilingScheme","../Core/loadJson","../Core/loadJsonp","../Core/Math","../Core/Rectangle","../Core/RuntimeError","../Core/TileProviderError","../Core/WebMercatorProjection","../Core/WebMercatorTilingScheme","../ThirdParty/when","./DiscardMissingTileImagePolicy","./ImageryLayerFeatureInfo","./ImageryProvider"],function(e,t,i,r,n,o,a,s,l,u,c,h,d,p,m,f,v,g,_,y,C,E,S){"use strict";function w(t){function i(i){var n=i.tileInfo;if(o(n)){if(h._tileWidth=n.rows,h._tileHeight=n.cols,102100===n.spatialReference.wkid||102113===n.spatialReference.wkid)h._tilingScheme=new _({ellipsoid:t.ellipsoid});else{if(4326!==i.tileInfo.spatialReference.wkid){var a="Tile spatial reference WKID "+i.tileInfo.spatialReference.wkid+" is not supported.";return void(u=v.handleError(u,h,h._errorEvent,a,void 0,void 0,void 0,s))}h._tilingScheme=new c({ellipsoid:t.ellipsoid})}if(h._maximumLevel=i.tileInfo.lods.length-1,o(i.fullExtent)){if(o(i.fullExtent.spatialReference)&&o(i.fullExtent.spatialReference.wkid))if(102100===i.fullExtent.spatialReference.wkid||102113===i.fullExtent.spatialReference.wkid){var l=new g,d=l.unproject(new e(i.fullExtent.xmin,i.fullExtent.ymin)),p=l.unproject(new e(i.fullExtent.xmax,i.fullExtent.ymax));h._rectangle=new m(d.longitude,d.latitude,p.longitude,p.latitude)}else{if(4326!==i.fullExtent.spatialReference.wkid){var f="fullExtent.spatialReference WKID "+i.fullExtent.spatialReference.wkid+" is not supported.";return void(u=v.handleError(u,h,h._errorEvent,f,void 0,void 0,void 0,s))}h._rectangle=m.fromDegrees(i.fullExtent.xmin,i.fullExtent.ymin,i.fullExtent.xmax,i.fullExtent.ymax)}}else h._rectangle=h._tilingScheme.rectangle;o(h._tileDiscardPolicy)||(h._tileDiscardPolicy=new C({missingImageUrl:T(h,0,0,h._maximumLevel),pixelsToCheck:[new e(0,0),new e(200,20),new e(20,200),new e(80,110),new e(160,130)],disableCheckIfAllPixelsAreTransparent:!0})),h._useTiles=!0}else h._useTiles=!1;o(i.copyrightText)&&i.copyrightText.length>0&&(h._credit=new r(i.copyrightText)),h._ready=!0,h._readyPromise.resolve(!0),v.handleSuccess(u)}function a(e){var t="An error occurred while accessing "+h._url+".";u=v.handleError(u,h,h._errorEvent,t,void 0,void 0,void 0,s),h._readyPromise.reject(new f(t))}function s(){var e={f:"json"};o(h._token)&&(e.token=h._token);var t=d(h._url,{parameters:e,proxy:h._proxy});y(t,i,a)}t=n(t,{}),this._url=t.url,this._token=t.token,this._tileDiscardPolicy=t.tileDiscardPolicy,this._proxy=t.proxy,this._tileWidth=n(t.tileWidth,256),this._tileHeight=n(t.tileHeight,256),this._maximumLevel=t.maximumLevel,this._tilingScheme=n(t.tilingScheme,new c({ellipsoid:t.ellipsoid})),this._credit=void 0,this._useTiles=n(t.usePreCachedTilesIfAvailable,!0),this._rectangle=n(t.rectangle,this._tilingScheme.rectangle),this._layers=t.layers,this.enablePickFeatures=n(t.enablePickFeatures,!0),this._errorEvent=new l,this._ready=!1,this._readyPromise=y.defer();var u,h=this;this._useTiles?s():(this._ready=!0,this._readyPromise.resolve(!0))}function T(e,t,i,r){var n;if(e._useTiles)n=e._url+"/tile/"+r+"/"+i+"/"+t;else{var a=e._tilingScheme.tileXYToNativeRectangle(t,i,r),s=a.west+"%2C"+a.south+"%2C"+a.east+"%2C"+a.north;n=e._url+"/export?",n+="bbox="+s,n+=e._tilingScheme instanceof c?"&bboxSR=4326&imageSR=4326":"&bboxSR=3857&imageSR=3857",n+="&size="+e._tileWidth+"%2C"+e._tileHeight,n+="&format=png&transparent=true&f=image",e.layers&&(n+="&layers=show:"+e.layers)}var l=e._token;o(l)&&(-1===n.indexOf("?")&&(n+="?"),"?"!==n[n.length-1]&&(n+="&"),n+="token="+l);var u=e._proxy;return o(u)&&(n=u.getURL(n)),n}return a(w.prototype,{url:{get:function(){return this._url}},token:{get:function(){return this._token}},proxy:{get:function(){return this._proxy}},tileWidth:{get:function(){return this._tileWidth}},tileHeight:{get:function(){return this._tileHeight}},maximumLevel:{get:function(){return this._maximumLevel}},minimumLevel:{get:function(){return 0}},tilingScheme:{get:function(){return this._tilingScheme}},rectangle:{get:function(){return this._rectangle}},tileDiscardPolicy:{get:function(){return this._tileDiscardPolicy}},errorEvent:{get:function(){return this._errorEvent}},ready:{get:function(){return this._ready}},readyPromise:{get:function(){return this._readyPromise.promise}},credit:{get:function(){return this._credit}},usingPrecachedTiles:{get:function(){return this._useTiles}},hasAlphaChannel:{get:function(){return!0}},layers:{get:function(){return this._layers}}}),w.prototype.getTileCredits=function(e,t,i){},w.prototype.requestImage=function(e,t,i){var r=T(this,e,t,i);return S.loadImage(this,r)},w.prototype.pickFeatures=function(e,r,n,a,s){if(this.enablePickFeatures){var l,u,d,m=this._tilingScheme.tileXYToNativeRectangle(e,r,n);if(this._tilingScheme instanceof c)l=p.toDegrees(a),u=p.toDegrees(s),d="4326";else{var f=this._tilingScheme.projection.project(new i(a,s,0));l=f.x,u=f.y,d="3857"}var v=this._url+"/identify?f=json&tolerance=2&geometryType=esriGeometryPoint";return v+="&geometry="+l+","+u,v+="&mapExtent="+m.west+","+m.south+","+m.east+","+m.north,v+="&imageDisplay="+this._tileWidth+","+this._tileHeight+",96",v+="&sr="+d,v+="&layers=visible",o(this._layers)&&(v+=":"+this._layers),o(this._token)&&(v+="&token="+this._token),o(this._proxy)&&(v=this._proxy.getURL(v)),h(v).then(function(e){var r=[],n=e.results;if(!o(n))return r;for(var a=0;al;++l){var p=s[l];p.credit=new i(p.attribution);for(var m=p.coverageAreas,f=0,g=p.coverageAreas.length;g>f;++f){var _=m[f],C=_.bbox;_.bbox=new c(u.toRadians(C[1]),u.toRadians(C[0]),u.toRadians(C[3]),u.toRadians(C[2]))}}w._ready=!0,w._readyPromise.resolve(!0),d.handleSuccess(E)}function g(e){var t="An error occurred while accessing "+S+".";E=d.handleError(E,w,w._errorEvent,t,void 0,void 0,void 0,C),w._readyPromise.reject(new h(t))}function C(){var e=l(S,{callbackParameterName:"jsonp",proxy:w._proxy});m(e,a,g)}o=r(o,{}),this._key=e.getKey(o.key),this._url=o.url,this._tileProtocol=o.tileProtocol,this._mapStyle=r(o.mapStyle,f.AERIAL),this._culture=r(o.culture,""),this._tileDiscardPolicy=o.tileDiscardPolicy,this._proxy=o.proxy,this._credit=new i("Bing Imagery",_._logoData,"http://www.bing.com"),this.defaultGamma=1,(this._mapStyle===f.AERIAL||this._mapStyle===f.AERIAL_WITH_LABELS)&&(this.defaultGamma=1.3),this._tilingScheme=new p({numberOfLevelZeroTilesX:2,numberOfLevelZeroTilesY:2,ellipsoid:o.ellipsoid}),this._tileWidth=void 0,this._tileHeight=void 0,this._maximumLevel=void 0,this._imageUrlTemplate=void 0,this._imageUrlSubdomains=void 0,this._errorEvent=new s,this._ready=!1,this._readyPromise=m.defer();var E,S=this._url+"/REST/v1/Imagery/Metadata/"+this._mapStyle+"?incl=ImageryProviders&key="+this._key,w=this;C()}function y(e,t,i,r){var o=e._imageUrlTemplate,a=_.tileXYToQuadKey(t,i,r);o=o.replace("{quadkey}",a);var s=e._imageUrlSubdomains,l=(t+i+r)%s.length;o=o.replace("{subdomain}",s[l]);var u=e._proxy;return n(u)&&(o=u.getURL(o)),o}function C(e,t,i){++t;for(var r=[],o=0,a=e.length;a>o;++o){for(var s=e[o],l=s.coverageAreas,u=!1,h=0,d=s.coverageAreas.length;!u&&d>h;++h){var p=l[h];if(t>=p.zoomMin&&t<=p.zoomMax){var m=c.intersection(i,p.bbox,S);n(m)&&(u=!0)}}u&&r.push(s.credit)}return r}o(_.prototype,{url:{get:function(){return this._url}},proxy:{get:function(){return this._proxy}},key:{get:function(){return this._key}},mapStyle:{get:function(){return this._mapStyle}},culture:{get:function(){return this._culture}},tileWidth:{get:function(){return this._tileWidth}},tileHeight:{get:function(){return this._tileHeight}},maximumLevel:{get:function(){return this._maximumLevel}},minimumLevel:{get:function(){return 0}},tilingScheme:{get:function(){return this._tilingScheme}},rectangle:{get:function(){return this._tilingScheme.rectangle}},tileDiscardPolicy:{get:function(){return this._tileDiscardPolicy}},errorEvent:{get:function(){return this._errorEvent}},ready:{get:function(){return this._ready}},readyPromise:{get:function(){return this._readyPromise.promise}},credit:{get:function(){return this._credit}},hasAlphaChannel:{get:function(){return!1}}});var E=new c;_.prototype.getTileCredits=function(e,t,i){if(!this._ready)throw new a("getTileCredits must not be called before the imagery provider is ready.");var r=this._tilingScheme.tileXYToRectangle(e,t,i,E);return C(this._attributionList,i,r)},_.prototype.requestImage=function(e,t,i){var r=y(this,e,t,i);return g.loadImage(this,r)},_.prototype.pickFeatures=function(){},_._logoData="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAD0AAAAaCAYAAAAEy1RnAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAAB3RJTUUH3gIDEgcPTMnXOQAAClZJREFUWMPdWGtsFNcV/u689uH1+sXaONhlWQzBENtxiUFBpBSLd60IpXHSNig4URtSYQUkRJNSi0igViVVVBJBaBsiAgKRQJSG8AgEHCCWU4iBCprY2MSgXfOI16y9D3s9Mzsztz9yB12WNU2i9Ecy0tHOzN4793zn3POdcy7BnRfJ8I7iB3SRDPeEExswLz8Y0DZIAYDIRGAgLQAm+7Xle31J3L3Anp1MZPY+BUBjorN332vgYhpgV1FRUd6TTz45ubq6OtDV1SXpuu5g//Oept9wNwlMyAi8IXDjyF245TsDTdivDMATCATGNDU1/WbhwoWPTZs2bWx1dXWhx+Oxrl+/PqTrus5t9W8KWEzjinTAYhro/xuBStwiIgBnJBLxKIoy1u/3V/r9/krDMMz3339/Z3t7e38ikUgCMDLEt8W+Q0cAI3McYTDDmZxh7DESG5Ni43jg9Gsa+X+OsxWxPSJTSj3JZFK5ZRVJErOzs8e6XC4fgGwALhbzDgAKU1hK28KEA6PMmTMn56233qpevnz5PQDcbJ7EzVUAuMrLy3MBeABkcWOEDELSyFe4y7iMoHkriZZlKYZh8ASHZDKpJJPJHAC5APIA5APIAeBlCjo5TwlpXnbOmTPHP3fu3KZVq1atZKBcDJQ9x7V48WJfc3Pzhp6enj+tXLnyR8w4MjdG4gyVDk7KICMClzKlLUrpbQMNw5AkScppbGz8cWdn57WjR4/2caw+DEBlYjO8wX1foZQWuN3uKZIklQD4G+fhlG0Yl8uVm5WVVW6app6dne0D0G8vnxbjJntHubCUOK/badZICyWanrJuAaeUknTQpmlKkUhEWbx48U8LCwtHhUKha+fPn+85fPhwV0tLyzUACSZx9jvMFhIByNFoVDEMw/qKB5HPvJfkUqBr9+7deklJyZ/j8bi5ffv2OAslieMLsG+m2DybT2QuzEQOsF5SUqJfvXo1yc2l6Xn6rgSRSCSEc+fOhVeuXLmwoqJixvTp0wcWLFgQ7unpudHR0dF97ty5z/fu3XseQJh5adjeerquy5ZlCalUivh8Pt8HH3ywzOPxyD09PZ81NjZ+2NnZaQEQx40b54vFYqaqquEVK1b4a2tr/WvWrDn18ssv144fP36SqqoD69ev371nz57rDLwAwHHkyJGfjRs3rtowDOv06dOnu7q6rs6bN2/s7Nmz9zIjDKenWoFZKg/AlMLCwl82Nzf/m3LX22+/fXb06NF/ALC8u7u7m6ZdkUhksL29/UpLS0vzunXrVgAoBzAaQBGAiY2NjUui0ei1RCLRFwwG/9PX19cVi8WCqqoOdHd3HysrK6sDMCccDl8IBoOtiqIsOnbs2D+i0eiV3t7ez8Ph8GeRSKRT07TB/v7+i1OnTp0HYBqABzs7O/+paVo0Fot1RyKRi/F4/Gp/f39XIpHoZnoUMn6wU+ZtRDaymwmxZFk2AWjvvvvuJ/F4PMn/n5+fn1VeXu6fOXNmbU1NzUOM4Bz8QqIoyg6HwxuLxfq3bdu2a+vWrW/09/dfKy0tffDVV199BEC20+n0ud3uQgBup9Pp83g8JYqieE+ePPnxxo0bt33xxRen8/Ly7n3hhRcWASh47bXX5pWVldWFw+GuXbt27XjzzTd3BoPBDq/XG1AUZRRHmAKPVfqaoKkgCCkA+oYNG84Eg0FHTU1N5ezZs8eWlJQ4CSF8/LvZYhJPQoQQpFKpwcrKyo1su9HBwUF99erVv588eXINgOOmacIwDEopdaZSKUIpxYkTJz6sr68/BMBav379RcMwZk2aNOl+AP+qq6t7xDTNVEVFxR+j0WgSAJk4ceKlTz/9tNzpdHpZvIvpjVW6pykhhBJCbkvwgiAQQogEQL558ybdtGlTsLm5OWJZdxZmlmWll5OUEEJN0zSGhob6GcOrALSzZ8/2apqWcLlc2axGACNRkRAimqaph0Kh68xIwwB0y7IMSZKcABz5+fkl8Xj8y2g0apOb5na7rYGBgS/JV54Q0qpAAoBKaS0jBWClg1ZVFeFw2AlgVF1dXeDpp5+eWVFRUVpcXOzgvQwAbrcbDJhdudlGpKZpGtx6JCcnRxIEQbQsS2PjbjM+AMvlchnMSBaXkr7ymCCIhmEYfMoVRVESBEHI0CaTTNubssUsQRBuubCtra33pZdeCk6YMCGwZs2aipqaGn9paWmuJEl3JP0bN258eeTIkRMABrm0YomiaImiKGVlZeWxLecAgBkzZvgdDkfWjRs3ggA0bpfpoiiahBCqKEqKAy2yULMA6MlkMp6Xl3cP1x2SWCwmFhQU+CmlFhfHNFOevpX4LcvSJUkyAeDQoUOh119//fpTTz01Zf78+UWBQCBHUZQ7yE/TNGPfvn0n33vvvSP79+//BECMeZsCMGRZNgRBgNPpHHXx4sVVDQ0Nf1+wYMGYJ554YikAevDgwUMA4oIgQJZlSggZdDqdBiGEZGdn6ww0tQlJURTT4/EMHz9+/MCjjz7622AwuHbZsmVbiouLvWvXrm1wOp3ZqVRqaKQTIInf1gAMl8ulU0q1CxcuBGOxmL5u3bryQCDgycrKEjORXGtra8eOHTsOHz169OyVK1cuA+hlRYrGlNRkWR7UNO2mYRiaz+cb3dLS8gYhhOi6Hj116tSOVatWHQNALcsaME0zLghClBDSZ9+zQsZ2SoJS2udwOKLPPffcvsrKyrJAIPDQ/v37txiGofX19V3r7e29UlBQMHqEVpjwnrYA6PF4PK6q6s2qqqqpZWVlitvtljOB7enpiWzbtu3wgQMHTre1tV0E0MeKkkGuIhMAqHv37u30er3Px+NxlyiKygMPPOAnhFiXLl0Kbd68uYPNsXbu3Lk6mUwaqqr2btmyZUdtbe3hd955pwvAEFNcO3jw4K/b2tqiqqpGIpGI4/HHH/9rQ0PDCa/XOyoSidDLly8PNTU1PcZ4QuNK1ju6NYHFRAGASXPnzv1Fa2vrxzTDpapqateuXR/Nnz+/SVGUhwFMBzCBFSLZLF75DsrJGpXRAH4EIABgPIBxAEoBFAPwARjFif1sNzZ25+VlOhaxufcCqAFQC+BhAPVLliz5XSqVUkOhUAuAKWnFyR3dlsw+fg+A+8eMGfPzTZs2bY9GozEb8JkzZ9qXLl36l+Li4l8B+AmAyQDGsGrOzfXNPGPawG2l85jksmcPm+vihH+2W1iF3bvZPN+sWbPuGx4eDrW3t+85fvz41o6OjmZN04Y0TYvV19cvYIbN5QqUjG2mwj5YAqDK4XDMe+aZZ55vbW09+sorr2yuqqpqYFatAuBn3uB7XzJCY297XeaUd2RoGzOJmHb6IjFj5D777LP3DQwMfDw8PBxSVbUvkUj0hEKhj1588cXH2O7zMSPdplumoxveMx5Zlj3jx4/39vb26gMDA4MsvgYZo+p8Pr7LqQX5Ds/U7d0jFxUVZS1atKg4Nzc317Isp67rZldXV6y5ufkmI78hFtcmrx8ZweMit6XsUs4+6kmlgbW+peLf9gyMZNCR374G0y/FxEzX8b/8+bkXEBxKFwAAAABJRU5ErkJggg==",_.tileXYToQuadKey=function(e,t,i){for(var r="",n=i;n>=0;--n){var o=1<=0;--n){var o=1<r;++r){var l=e.intersectPlane(o.fromCartesian4(t[r],s));if(l===n.OUTSIDE)return n.OUTSIDE;l===n.INTERSECTING&&(i=!0)}return i?n.INTERSECTING:n.INSIDE},a.prototype.computeVisibilityWithPlaneMask=function(e,t){if(t===a.MASK_OUTSIDE||t===a.MASK_INSIDE)return t;for(var i=a.MASK_INSIDE,r=this.planes,l=0,u=r.length;u>l;++l){var c=31>l?1<l&&0===(t&c))){var h=e.intersectPlane(o.fromCartesian4(r[l],s));if(h===n.OUTSIDE)return a.MASK_OUTSIDE;h===n.INTERSECTING&&(i|=c)}}return i},a.MASK_OUTSIDE=4294967295,a.MASK_INSIDE=0,a.MASK_INDETERMINATE=2147483647,a}),i("Scene/PerspectiveOffCenterFrustum",["../Core/Cartesian2","../Core/Cartesian3","../Core/Cartesian4","../Core/defaultValue","../Core/defined","../Core/defineProperties","../Core/DeveloperError","../Core/Matrix4","./CullingVolume"],function(e,t,i,r,n,o,a,s,l){"use strict";function u(){this.left=void 0,this._left=void 0,this.right=void 0,this._right=void 0,this.top=void 0,this._top=void 0,this.bottom=void 0,this._bottom=void 0,this.near=1,this._near=this.near,this.far=5e8,this._far=this.far,this._cullingVolume=new l,this._perspectiveMatrix=new s,this._infinitePerspective=new s}function c(e){var t=e.top,i=e.bottom,r=e.right,n=e.left,o=e.near,a=e.far;(t!==e._top||i!==e._bottom||n!==e._left||r!==e._right||o!==e._near||a!==e._far)&&(e._left=n,e._right=r,e._top=t,e._bottom=i,e._near=o,e._far=a,e._perspectiveMatrix=s.computePerspectiveOffCenter(n,r,i,t,o,a,e._perspectiveMatrix),e._infinitePerspective=s.computeInfinitePerspectiveOffCenter(n,r,i,t,o,e._infinitePerspective))}o(u.prototype,{projectionMatrix:{get:function(){return c(this),this._perspectiveMatrix}},infiniteProjectionMatrix:{get:function(){return c(this),this._infinitePerspective}}});var h=new t,d=new t,p=new t,m=new t;return u.prototype.computeCullingVolume=function(e,r,o){var a=this._cullingVolume.planes,s=this.top,l=this.bottom,u=this.right,c=this.left,f=this.near,v=this.far,g=t.cross(r,o,h),_=d;t.multiplyByScalar(r,f,_),t.add(e,_,_);var y=p;t.multiplyByScalar(r,v,y),t.add(e,y,y);var C=m;t.multiplyByScalar(g,c,C),t.add(_,C,C),t.subtract(C,e,C),t.normalize(C,C),t.cross(C,o,C);var E=a[0];return n(E)||(E=a[0]=new i),E.x=C.x,E.y=C.y,E.z=C.z,E.w=-t.dot(C,e),t.multiplyByScalar(g,u,C),t.add(_,C,C),t.subtract(C,e,C),t.normalize(C,C),t.cross(o,C,C),E=a[1],n(E)||(E=a[1]=new i),E.x=C.x,E.y=C.y,E.z=C.z,E.w=-t.dot(C,e),t.multiplyByScalar(o,l,C),t.add(_,C,C),t.subtract(C,e,C),t.normalize(C,C),t.cross(g,C,C),E=a[2],n(E)||(E=a[2]=new i),E.x=C.x,E.y=C.y,E.z=C.z,E.w=-t.dot(C,e),t.multiplyByScalar(o,s,C),t.add(_,C,C),t.subtract(C,e,C),t.normalize(C,C),t.cross(C,g,C),E=a[3],n(E)||(E=a[3]=new i),E.x=C.x,E.y=C.y,E.z=C.z,E.w=-t.dot(C,e),E=a[4],n(E)||(E=a[4]=new i),E.x=r.x,E.y=r.y,E.z=r.z,E.w=-t.dot(r,_),t.negate(r,C),E=a[5],n(E)||(E=a[5]=new i),E.x=C.x,E.y=C.y,E.z=C.z,E.w=-t.dot(C,y),this._cullingVolume},u.prototype.getPixelDimensions=function(e,t,i,r){c(this);var n=1/this.near,o=this.top*n,a=2*i*o/t;o=this.right*n;var s=2*i*o/e;return r.x=s,r.y=a,r},u.prototype.clone=function(e){return n(e)||(e=new u),e.right=this.right,e.left=this.left,e.top=this.top,e.bottom=this.bottom,e.near=this.near,e.far=this.far,e._left=void 0,e._right=void 0,e._top=void 0,e._bottom=void 0,e._near=void 0,e._far=void 0,e},u.prototype.equals=function(e){return n(e)&&this.right===e.right&&this.left===e.left&&this.top===e.top&&this.bottom===e.bottom&&this.near===e.near&&this.far===e.far},u}),i("Scene/PerspectiveFrustum",["../Core/defined","../Core/defineProperties","../Core/DeveloperError","./PerspectiveOffCenterFrustum"],function(e,t,i,r){"use strict";function n(){this._offCenterFrustum=new r,this.fov=void 0,this._fov=void 0,this._fovy=void 0,this._sseDenominator=void 0,this.aspectRatio=void 0,this._aspectRatio=void 0,this.near=1,this._near=this.near,this.far=5e8,this._far=this.far,this.xOffset=0,this._xOffset=this.xOffset,this.yOffset=0,this._yOffset=this.yOffset}function o(e){var t=e._offCenterFrustum;(e.fov!==e._fov||e.aspectRatio!==e._aspectRatio||e.near!==e._near||e.far!==e._far||e.xOffset!==e._xOffset||e.yOffset!==e._yOffset)&&(e._aspectRatio=e.aspectRatio,e._fov=e.fov,e._fovy=e.aspectRatio<=1?e.fov:2*Math.atan(Math.tan(.5*e.fov)/e.aspectRatio),e._near=e.near,e._far=e.far,e._sseDenominator=2*Math.tan(.5*e._fovy),e._xOffset=e.xOffset,e._yOffset=e.yOffset,t.top=e.near*Math.tan(.5*e._fovy),t.bottom=-t.top,t.right=e.aspectRatio*t.top,t.left=-t.right,t.near=e.near,t.far=e.far,t.right+=e.xOffset,t.left+=e.xOffset,t.top+=e.yOffset,t.bottom+=e.yOffset)}return t(n.prototype,{projectionMatrix:{get:function(){return o(this),this._offCenterFrustum.projectionMatrix}},infiniteProjectionMatrix:{get:function(){return o(this),this._offCenterFrustum.infiniteProjectionMatrix}},fovy:{get:function(){return o(this),this._fovy}},sseDenominator:{get:function(){return o(this),this._sseDenominator}}}),n.prototype.computeCullingVolume=function(e,t,i){return o(this),this._offCenterFrustum.computeCullingVolume(e,t,i)},n.prototype.getPixelDimensions=function(e,t,i,r){return o(this),this._offCenterFrustum.getPixelDimensions(e,t,i,r)},n.prototype.clone=function(t){return e(t)||(t=new n),t.aspectRatio=this.aspectRatio,t.fov=this.fov,t.near=this.near,t.far=this.far,t._aspectRatio=void 0,t._fov=void 0,t._near=void 0,t._far=void 0,this._offCenterFrustum.clone(t._offCenterFrustum),t},n.prototype.equals=function(t){return e(t)?(o(this),o(t),this.fov===t.fov&&this.aspectRatio===t.aspectRatio&&this.near===t.near&&this.far===t.far&&this._offCenterFrustum.equals(t._offCenterFrustum)):!1},n}),i("Scene/CameraFlightPath",["../Core/Cartesian2","../Core/Cartesian3","../Core/Cartographic","../Core/defaultValue","../Core/defined","../Core/DeveloperError","../Core/EasingFunction","../Core/Math","./PerspectiveFrustum","./PerspectiveOffCenterFrustum","./SceneMode"],function(e,t,i,r,n,o,a,s,l,u,c){"use strict";function h(e,t,i){var r,n,o;if(e instanceof l){var a=Math.tan(.5*e.fovy);return r=e.near,n=e.near*a,o=e.aspectRatio*n,Math.max(t*r/o,i*r/n)}return e instanceof u?(r=e.near,n=e.top,o=e.right,Math.max(t*r/o,i*r/n)):Math.max(t,i)}function d(e,i,r,o,a){var l,u=a;if(!n(a)){var c=e.position,d=i,p=e.up,m=e.right,f=e.frustum,v=t.subtract(c,d,C),g=t.magnitude(t.multiplyByScalar(p,t.dot(v,p),E)),_=t.magnitude(t.multiplyByScalar(m,t.dot(v,m),E));l=Math.max(r,o),u=Math.min(.2*h(f,g,_),1e9)}if(n(a)&&u>a||u>l){var y=8,S=1e6,w=-Math.pow((u-r)*S,1/y),T=Math.pow((u-o)*S,1/y);return function(e){var t=e*(T-w)+w;return-Math.pow(t,y)/S+u}}return function(e){return s.lerp(r,o,e)}}function p(e,t){return s.equalsEpsilon(e,s.TWO_PI,s.EPSILON11)&&(e=0),t>e+Math.PI?e+=s.TWO_PI:ts.PI&&(C.longitude+=s.TWO_PI);var S=d(h,n,v.height,C.height,u);return c}function v(i,r,n,o,a,l,u){function c(t){var i=t.time/r;h.setView({orientation:{heading:s.lerp(f,o,i)}}),e.lerp(m,n,i,h.position);var a=g(i),l=h.frustum,u=l.top/l.right,c=.5*(a-(l.right-l.left));l.right+=c,l.left-=c,l.top=u*l.right,l.bottom=-l.top}var h=i.camera,m=t.clone(h.position,S),f=p(h.heading,o),v=h.frustum.right-h.frustum.left,g=d(h,n,v,n.z,u);return c}function g(e,t){return{startObject:{},stopObject:{},duration:0,complete:e,cancel:t}}function _(e,t){function i(){"function"==typeof t&&t(),e.enableInputs=!0}return i}var y={},C=new t,E=new t,S=new t,w=new i,T=new i,x=new i,b=new t;return y.createTween=function(i,o){o=r(o,r.EMPTY_OBJECT);var l=o.destination,u=i.mode;if(u===c.MORPHING)return g();var h=r(o.convert,!0),d=i.mapProjection,p=d.ellipsoid,y=o.maximumHeight,C=o.easingFunction;h&&u!==c.SCENE3D&&(p.cartesianToCartographic(l,x),l=d.project(x,b));var E=i.camera,S=o.endTransform;n(S)&&E._setTransform(S);var w=o.duration;n(w)||(w=Math.ceil(t.distance(E.position,l)/1e6)+2,w=Math.min(w,3));var T=r(o.heading,0),A=r(o.pitch,-s.PI_OVER_TWO),P=r(o.roll,0),I=i.screenSpaceCameraController;I.enableInputs=!1;var M=_(I,o.complete),D=_(I,o.cancel),R=E.frustum,O=i.mode===c.SCENE2D;if(O=O&&e.equalsEpsilon(E.position,l,s.EPSILON6),O=O&&s.equalsEpsilon(Math.max(R.right-R.left,R.top-R.bottom),l.z,s.EPSILON6),O=O||i.mode!==c.SCENE2D&&t.equalsEpsilon(l,E.position,s.EPSILON10),O=O&&s.equalsEpsilon(s.negativePiToPi(T),s.negativePiToPi(E.heading),s.EPSILON10)&&s.equalsEpsilon(s.negativePiToPi(A),s.negativePiToPi(E.pitch),s.EPSILON10)&&s.equalsEpsilon(s.negativePiToPi(P),s.negativePiToPi(E.roll),s.EPSILON10))return g(M,D);var N=new Array(4);if(N[c.SCENE2D]=v,N[c.SCENE3D]=f,N[c.COLUMBUS_VIEW]=m,0>=w){var L=function(){var e=N[u](i,1,l,T,A,P,y);e({time:1}),"function"==typeof M&&M()};return g(L,D)}var F=N[u](i,w,l,T,A,P,y);if(!n(C)){var B=E.positionCartographic.height,V=u===c.SCENE3D?p.cartesianToCartographic(l).height:l.z;C=B>V&&B>11500?a.CUBIC_OUT:a.QUINTIC_IN_OUT}return{duration:w,easingFunction:C,startObject:{time:0},stopObject:{time:w},update:F,complete:M,cancel:D}},y}),i("Scene/Camera",["../Core/Cartesian2","../Core/Cartesian3","../Core/Cartesian4","../Core/Cartographic","../Core/defaultValue","../Core/defined","../Core/defineProperties","../Core/DeveloperError","../Core/EasingFunction","../Core/Ellipsoid","../Core/EllipsoidGeodesic","../Core/Event","../Core/HeadingPitchRange","../Core/IntersectionTests","../Core/Math","../Core/Matrix3","../Core/Matrix4","../Core/Quaternion","../Core/Ray","../Core/Rectangle","../Core/Transforms","./CameraFlightPath","./PerspectiveFrustum","./SceneMode"],function(e,t,i,r,n,o,a,s,l,u,c,h,d,p,m,f,v,g,_,y,C,E,S,w){"use strict";function T(e){this._scene=e,this._transform=v.clone(v.IDENTITY),this._invTransform=v.clone(v.IDENTITY),this._actualTransform=v.clone(v.IDENTITY),this._actualInvTransform=v.clone(v.IDENTITY),this._transformChanged=!1,this.position=new t,this._position=new t,this._positionWC=new t,this._positionCartographic=new r,this.direction=new t,this._direction=new t,this._directionWC=new t,this.up=new t,this._up=new t,this._upWC=new t,this.right=new t,this._right=new t,this._rightWC=new t,this.frustum=new S,this.frustum.aspectRatio=e.drawingBufferWidth/e.drawingBufferHeight,this.frustum.fov=m.toRadians(60),this.defaultMoveAmount=1e5,this.defaultLookAmount=Math.PI/60,this.defaultRotateAmount=Math.PI/3600,this.defaultZoomAmount=1e5,this.constrainedAxis=void 0,this.maximumTranslateFactor=1.5,this.maximumZoomFactor=2.5,this._moveStart=new h,this._moveEnd=new h,this._viewMatrix=new v,this._invViewMatrix=new v,x(this),this._mode=w.SCENE3D,this._modeChanged=!0;var i=e.mapProjection;this._projection=i,this._maxCoord=i.project(new r(Math.PI,m.PI_OVER_TWO)),this._max2Dfrustum=void 0,W(this,T.DEFAULT_VIEW_RECTANGLE,this.position,!0);var n=t.magnitude(this.position);n+=n*T.DEFAULT_VIEW_FACTOR,t.normalize(this.position,this.position),t.multiplyByScalar(this.position,n,this.position)}function x(e){var i=e._right,r=e._up,n=e._direction,o=e._position,a=e._viewMatrix;a[0]=i.x,a[1]=r.x,a[2]=-n.x,a[3]=0,a[4]=i.y,a[5]=r.y,a[6]=-n.y,a[7]=0,a[8]=i.z,a[9]=r.z,a[10]=-n.z,a[11]=0,a[12]=-t.dot(i,o),a[13]=-t.dot(r,o),a[14]=t.dot(n,o),a[15]=1,v.multiply(a,e._actualInvTransform,e._viewMatrix),v.inverseTransformation(e._viewMatrix,e._invViewMatrix)}function b(e){var r=e._projection,n=r.ellipsoid,o=v.getColumn(e._transform,3,ae),a=n.cartesianToCartographic(o,re),s=r.project(a,ne),l=se;l.x=s.z,l.y=s.x,l.z=s.y,l.w=1;var u=i.add(v.getColumn(e._transform,0,oe),o,oe);n.cartesianToCartographic(u,a),r.project(a,s);var c=le;c.x=s.z,c.y=s.x,c.z=s.y,c.w=0,t.subtract(c,l,c);var h=i.add(v.getColumn(e._transform,1,oe),o,oe);n.cartesianToCartographic(h,a),r.project(a,s);var d=ue;d.x=s.z,d.y=s.x,d.z=s.y,d.w=0,t.subtract(d,l,d);var p=ce;t.cross(c,d,p),t.normalize(p,p),t.cross(d,p,c),t.normalize(c,c),t.cross(p,c,d),t.normalize(d,d),v.setColumn(e._actualTransform,0,c,e._actualTransform),v.setColumn(e._actualTransform,1,d,e._actualTransform),v.setColumn(e._actualTransform,2,p,e._actualTransform),v.setColumn(e._actualTransform,3,l,e._actualTransform)}function A(e){var r=e._projection,n=r.ellipsoid,o=v.getColumn(e._transform,3,ae),a=n.cartesianToCartographic(o,re),s=r.project(a,ne),l=se;l.x=s.z,l.y=s.x,l.z=s.y,l.w=1;var u=i.clone(i.UNIT_X,ce),c=i.add(v.getColumn(e._transform,0,oe),o,oe);n.cartesianToCartographic(c,a),r.project(a,s);var h=le;h.x=s.z,h.y=s.x,h.z=s.y,h.w=0,t.subtract(h,l,h),h.x=0;var d=ue;if(t.magnitudeSquared(h)>m.EPSILON10)t.cross(u,h,d);else{var p=i.add(v.getColumn(e._transform,1,oe),o,oe);n.cartesianToCartographic(p,a),r.project(a,s),d.x=s.z,d.y=s.x,d.z=s.y,d.w=0,t.subtract(d,l,d),d.x=0,t.magnitudeSquared(d)m.EPSILON2){s=t.normalize(s,e._direction),t.clone(s,e.direction);var y=1/t.magnitudeSquared(u),C=t.dot(u,s)*y,E=t.multiplyByScalar(s,C,he);u=t.normalize(t.subtract(u,E,e._up),e._up),t.clone(u,e.up),h=t.cross(s,u,e._right),t.clone(h,e.right)}}(l||p)&&(e._directionWC=v.multiplyByPointAsVector(f,s,e._directionWC)),(c||p)&&(e._upWC=v.multiplyByPointAsVector(f,u,e._upWC)),(d||p)&&(e._rightWC=v.multiplyByPointAsVector(f,h,e._rightWC)),(a||l||c||d||p)&&x(e)}function I(e,t){var i;return i=m.equalsEpsilon(Math.abs(e.z),1,m.EPSILON3)?Math.atan2(t.y,t.x)-m.PI_OVER_TWO:Math.atan2(e.y,e.x)-m.PI_OVER_TWO,m.TWO_PI-m.zeroToTwoPi(i)}function M(e){return m.PI_OVER_TWO-m.acosClamped(e.z)}function D(e,t,i){var r=0;return m.equalsEpsilon(Math.abs(e.z),1,m.EPSILON3)||(r=Math.atan2(-i.z,t.z),r=m.zeroToTwoPi(r+m.TWO_PI)),r}function R(e,i,r,n,o){var a=v.clone(e.transform,_e),s=C.eastNorthUpToFixedFrame(i,e._projection.ellipsoid,ye);e._setTransform(s),t.clone(t.ZERO,e.position);var l=g.fromHeadingPitchRoll(r-m.PI_OVER_TWO,n,o,Ce),u=f.fromQuaternion(l,Ee);f.getColumn(u,0,e.direction),f.getColumn(u,2,e.up), -t.cross(e.direction,e.up,e.right),e._setTransform(a)}function O(e,i,r,n,o,a){var s=v.clone(e.transform,_e);if(e._setTransform(v.IDENTITY),!t.equals(i,e.positionWC)){if(a){var l=e._projection,u=l.ellipsoid.cartesianToCartographic(i,Se);i=l.project(u,ge)}t.clone(i,e.position)}var c=g.fromHeadingPitchRoll(r-m.PI_OVER_TWO,n,o,Ce),h=f.fromQuaternion(c,Ee);f.getColumn(h,0,e.direction),f.getColumn(h,2,e.up),t.cross(e.direction,e.up,e.right),e._setTransform(s)}function N(i,r,n,o){var a=-m.PI_OVER_TWO,s=0,l=v.clone(i.transform,_e);if(i._setTransform(v.IDENTITY),!t.equals(r,i.positionWC)){if(o){var u=i._projection,c=u.ellipsoid.cartesianToCartographic(r,Se);r=u.project(c,ge)}e.clone(r,i.position);var h=.5*-r.z,d=-h,p=i.frustum;if(d>h){var _=p.top/p.right;p.right=d,p.left=h,p.top=p.right*_,p.bottom=-p.top}}var y=g.fromHeadingPitchRoll(n-m.PI_OVER_TWO,a,s,Ce),C=f.fromQuaternion(y,Ee);f.getColumn(C,2,i.up),t.cross(i.direction,i.up,i.right),i._setTransform(l)}function L(e,i,r,n){var o=t.clone(r.direction,we),a=t.clone(r.up,Te);if(e._scene.mode===w.SCENE3D){var s=e._projection.ellipsoid,l=C.eastNorthUpToFixedFrame(i,s,de),u=v.inverseTransformation(l,pe);v.multiplyByPointAsVector(u,o,o),v.multiplyByPointAsVector(u,a,a)}var c=t.cross(o,a,xe);return n.heading=I(o,a),n.pitch=M(o),n.roll=D(o,a,c),n}function F(e,t){var i=e._maxCoord.x*e.maximumTranslateFactor;t.x>i&&(t.x=i),t.x<-i&&(t.x=-i);var r=e._maxCoord.y*e.maximumTranslateFactor;t.y>r&&(t.y=r),t.y<-r&&(t.y=-r)}function B(e,i){var r=e.position,n=t.normalize(r,Re);if(o(e.constrainedAxis)){var a=t.equalsEpsilon(n,e.constrainedAxis,m.EPSILON2),s=t.equalsEpsilon(n,t.negate(e.constrainedAxis,Le),m.EPSILON2);if(a||s)(a&&0>i||s&&i>0)&&e.rotate(e.right,i);else{var l=t.normalize(e.constrainedAxis,Oe),u=t.dot(n,l),c=m.acosClamped(u);i>0&&i>c&&(i=c-m.EPSILON4),u=t.dot(n,t.negate(l,Le)),c=m.acosClamped(u),0>i&&-i>c&&(i=-c+m.EPSILON4);var h=t.cross(l,n,Ne);e.rotate(h,i)}}else e.rotate(e.right,i)}function V(e,t){o(e.constrainedAxis)?e.rotate(e.constrainedAxis,t):e.rotate(e.up,t)}function k(e,t){var i=e.frustum;t=.5*t;var r=i.right-t,n=i.left+t,o=e._maxCoord.x*e.maximumZoomFactor;r>o&&(r=o,n=-o),n>=r&&(r=1,n=-1);var a=i.top/i.right;i.right=r,i.left=n,i.top=i.right*a,i.bottom=-i.top}function z(e,t){e.move(e.direction,t)}function U(e,i,r){i=m.clamp(i,-m.PI_OVER_TWO,m.PI_OVER_TWO),e=m.zeroToTwoPi(e)-m.PI_OVER_TWO;var n=g.fromAxisAngle(t.UNIT_Y,-i,Ve),o=g.fromAxisAngle(t.UNIT_Z,-e,ke),a=g.multiply(o,n,o),s=f.fromQuaternion(a,ze),l=t.clone(t.UNIT_X,Be);return f.multiplyByVector(s,l,l),t.negate(l,l),t.multiplyByScalar(l,r,l),l}function G(e,i,r,n){var o=Math.abs(t.dot(i,r));return o/n-t.dot(e,r)}function W(e,i,r,n){var a=e._projection.ellipsoid,s=n?e:Je,l=i.north,u=i.south,h=i.east,d=i.west;d>h&&(h+=m.TWO_PI);var p,f=.5*(d+h);if(u<-m.PI_OVER_TWO+m.RADIANS_PER_DEGREE&&l>m.PI_OVER_TWO-m.RADIANS_PER_DEGREE)p=0;else{var v=Ge;v.longitude=f,v.latitude=l,v.height=0;var g=We;g.longitude=f,g.latitude=u,g.height=0;var _=Ue;o(_)&&_.ellipsoid===a||(Ue=_=new c(void 0,void 0,a)),_.setEndPoints(v,g),p=_.interpolateUsingFraction(.5,Ge).latitude}var y=Ge;y.longitude=f,y.latitude=p,y.height=0;var C=a.cartographicToCartesian(y,Ke),E=Ge;E.longitude=h,E.latitude=l;var S=a.cartographicToCartesian(E,He);E.longitude=d;var w=a.cartographicToCartesian(E,je);E.longitude=f;var T=a.cartographicToCartesian(E,Xe);E.latitude=u;var x=a.cartographicToCartesian(E,Ze);E.longitude=h;var b=a.cartographicToCartesian(E,Ye);E.longitude=d;var A=a.cartographicToCartesian(E,qe);t.subtract(w,C,w),t.subtract(b,C,b),t.subtract(S,C,S),t.subtract(A,C,A),t.subtract(T,C,T),t.subtract(x,C,x);var P=a.geodeticSurfaceNormal(C,s.direction);t.negate(P,P);var I=t.cross(P,t.UNIT_Z,s.right);t.normalize(I,I);var M=t.cross(I,P,s.up),D=Math.tan(.5*e.frustum.fovy),R=e.frustum.aspectRatio*D,O=Math.max(G(P,M,w,D),G(P,M,b,D),G(P,M,S,D),G(P,M,A,D),G(P,M,T,D),G(P,M,x,D),G(P,I,w,R),G(P,I,b,R),G(P,I,S,R),G(P,I,A,R),G(P,I,T,R),G(P,I,x,R));if(0>u&&l>0){var N=Ge;N.longitude=d,N.latitude=0,N.height=0;var L=a.cartographicToCartesian(N,Qe);t.subtract(L,C,L),O=Math.max(O,G(P,M,L,D),G(P,I,L,R)),N.longitude=h,L=a.cartographicToCartesian(N,Qe),t.subtract(L,C,L),O=Math.max(O,G(P,M,L,D),G(P,I,L,R))}return t.add(C,t.multiplyByScalar(P,-O,Qe),r)}function H(e,t,i){var r=e._projection;t.west>t.east&&(t=y.MAX_VALUE);var n=e._actualTransform,o=e._actualInvTransform,a=$e;a.longitude=t.east,a.latitude=t.north;var s=r.project(a,et);v.multiplyByPoint(n,s,s),v.multiplyByPoint(o,s,s),a.longitude=t.west,a.latitude=t.south;var l=r.project(a,tt);v.multiplyByPoint(n,l,l),v.multiplyByPoint(o,l,l);var u=Math.tan(.5*e.frustum.fovy),c=e.frustum.aspectRatio*u;return i.x=.5*(s.x-l.x)+l.x,i.y=.5*(s.y-l.y)+l.y,i.z=.5*Math.max((s.x-l.x)/c,(s.y-l.y)/u),i}function q(e,t,i){var r=e._projection;t.west>t.east&&(t=y.MAX_VALUE);var n=it;n.longitude=t.east,n.latitude=t.north;var o=r.project(n,rt);n.longitude=t.west,n.latitude=t.south;var a,s,l=r.project(n,nt),u=.5*Math.abs(o.x-l.x),c=.5*Math.abs(o.y-l.y),h=e.frustum.right/e.frustum.top,d=c*h;return u>d?(a=u,s=a/h):(s=c,a=d),c=Math.max(2*a,2*s),i.x=.5*(o.x-l.x)+l.x,i.y=.5*(o.y-l.y)+l.y,n=r.unproject(i,n),n.height=c,i=r.project(n,i)}function j(e,t,i,r){i=n(i,u.WGS84);var o=e.getPickRay(t,ot),a=p.rayEllipsoid(o,i);if(a){var s=a.start>0?a.start:a.stop;return _.getPoint(o,s,r)}}function Y(e,t,i,r){var n=e.getPickRay(t,at),o=n.origin;o.z=0;var a=i.unproject(o);return a.latitude<-m.PI_OVER_TWO||a.latitude>m.PI_OVER_TWO||a.longitude<-Math.PI||a.longitude>Math.PI?void 0:i.ellipsoid.cartographicToCartesian(a,r)}function X(e,i,r,n){var o=e.getPickRay(i,st),a=-o.origin.x/o.direction.x;_.getPoint(o,a,n);var s=r.unproject(new t(n.y,n.z,0));return s.latitude<-m.PI_OVER_TWO||s.latitude>m.PI_OVER_TWO||s.longitude<-Math.PI||s.longitude>Math.PI?void 0:r.ellipsoid.cartographicToCartesian(s,n)}function Z(e,i,r){var n=e._scene.canvas,o=n.clientWidth,a=n.clientHeight,s=Math.tan(.5*e.frustum.fovy),l=e.frustum.aspectRatio*s,u=e.frustum.near,c=2/o*i.x-1,h=2/a*(a-i.y)-1,d=e.positionWC;t.clone(d,r.origin);var p=t.multiplyByScalar(e.directionWC,u,lt);t.add(d,p,p);var m=t.multiplyByScalar(e.rightWC,c*u*l,ut),f=t.multiplyByScalar(e.upWC,h*u*s,ct),v=t.add(p,m,r.direction);return t.add(v,f,v),t.subtract(v,d,v),t.normalize(v,v),r}function K(e,i,r){var n=e._scene.canvas,o=n.clientWidth,a=n.clientHeight,s=2/o*i.x-1;s*=.5*(e.frustum.right-e.frustum.left);var l=2/a*(a-i.y)-1;l*=.5*(e.frustum.top-e.frustum.bottom);var u=r.origin;return t.clone(e.position,u),t.multiplyByScalar(e.right,s,ht),t.add(ht,u,u),t.multiplyByScalar(e.up,l,ht),t.add(ht,u,u),t.clone(e.directionWC,r.direction),r}function Q(e,i){var r=e.position,n=r.x<-e._maxCoord.x||r.x>e._maxCoord.x,o=r.y<-e._maxCoord.y||r.y>e._maxCoord.y,a=n||o,s=e.frustum,u=s.top,c=s.bottom,h=s.right,d=s.left,p=e._max2Dfrustum,f=h>e._max2Dfrustum.right;if(a||f){var v=t.clone(r);v.x>e._maxCoord.x?v.x=e._maxCoord.x:v.x<-e._maxCoord.x&&(v.x=-e._maxCoord.x),v.y>e._maxCoord.y?v.y=e._maxCoord.y:v.y<-e._maxCoord.y&&(v.y=-e._maxCoord.y);var g=function(i){a&&(e.position=t.lerp(r,v,i.time,e.position)),f&&(e.frustum.top=m.lerp(u,p.top,i.time),e.frustum.bottom=m.lerp(c,p.bottom,i.time),e.frustum.right=m.lerp(h,p.right,i.time),e.frustum.left=m.lerp(d,p.left,i.time))};return{easingFunction:l.EXPONENTIAL_OUT,startObject:{time:0},stopObject:{time:1},duration:i,update:g}}}function J(e,i,r,n,o,a){function s(r){var n=t.lerp(i,u,r.time,new t);e.worldToCameraCoordinatesPoint(n,e.position)}var u=t.clone(i);return r.y>n?u.y-=r.y-n:r.y<-n&&(u.y+=-n-r.y),r.z>o?u.z-=r.z-o:r.z<-o&&(u.z+=-o-r.z),{easingFunction:l.EXPONENTIAL_OUT,startObject:{time:0},stopObject:{time:1},duration:a,update:s}}function $(e,i){var r=e.position,n=e.direction,o=e.worldToCameraCoordinatesVector(t.UNIT_X,ft),a=-t.dot(o,r)/t.dot(o,n),s=t.add(r,t.multiplyByScalar(n,a,vt),vt);e.cameraToWorldCoordinatesPoint(s,s),r=e.cameraToWorldCoordinatesPoint(e.position,gt);var l=Math.tan(.5*e.frustum.fovy),u=e.frustum.aspectRatio*l,c=t.magnitude(t.subtract(r,s,_t)),h=u*c,d=l*c,p=e._maxCoord.x,m=e._maxCoord.y,f=Math.max(h-p,p),v=Math.max(d-m,m);if(r.z<-f||r.z>f||r.y<-v||r.y>v){var g=s.y<-f||s.y>f,_=s.z<-v||s.z>v;if(g||_)return J(e,r,s,f,v,i)}}function ee(e,t){var i=e.frustum,r=Math.tan(.5*i.fovy),n=i.aspectRatio*r;return Math.max(t/n,t/r)}function te(e,t){var i,r,n=e.frustum,o=n.right/n.top,a=t*o;return t>a?(i=t,r=i/o):(r=t,i=a),1.5*Math.max(i,r)}function ie(e,t,i){o(i)||(i=d.clone(Et));var r=i.range;if(!o(r)||0===r){var n=t.radius;0===n?i.range=St:i.range=e._mode===w.SCENE2D?te(e,n):ee(e,n)}return i}T.TRANSFORM_2D=new v(0,0,1,0,1,0,0,0,0,1,0,0,0,0,0,1),T.TRANSFORM_2D_INVERSE=v.inverseTransformation(T.TRANSFORM_2D,new v),T.DEFAULT_VIEW_RECTANGLE=y.fromDegrees(-95,-20,-70,90),T.DEFAULT_VIEW_FACTOR=.5;var re=new r,ne=new t,oe=new t,ae=new i,se=new i,le=new i,ue=new i,ce=new i,he=new t,de=new v,pe=new v;a(T.prototype,{transform:{get:function(){return this._transform}},inverseTransform:{get:function(){return P(this),this._invTransform}},viewMatrix:{get:function(){return P(this),this._viewMatrix}},inverseViewMatrix:{get:function(){return P(this),this._invViewMatrix}},positionCartographic:{get:function(){return P(this),this._positionCartographic}},positionWC:{get:function(){return P(this),this._positionWC}},directionWC:{get:function(){return P(this),this._directionWC}},upWC:{get:function(){return P(this),this._upWC}},rightWC:{get:function(){return P(this),this._rightWC}},heading:{get:function(){if(this._mode!==w.MORPHING){var e=this._projection.ellipsoid,t=v.clone(this._transform,de),i=C.eastNorthUpToFixedFrame(this.positionWC,e,pe);this._setTransform(i);var r=I(this.direction,this.up);return this._setTransform(t),r}}},pitch:{get:function(){if(this._mode!==w.MORPHING){var e=this._projection.ellipsoid,t=v.clone(this._transform,de),i=C.eastNorthUpToFixedFrame(this.positionWC,e,pe);this._setTransform(i);var r=M(this.direction);return this._setTransform(t),r}}},roll:{get:function(){if(this._mode!==w.MORPHING){var e=this._projection.ellipsoid,t=v.clone(this._transform,de),i=C.eastNorthUpToFixedFrame(this.positionWC,e,pe);this._setTransform(i);var r=D(this.direction,this.up,this.right);return this._setTransform(t),r}}},moveStart:{get:function(){return this._moveStart}},moveEnd:{get:function(){return this._moveEnd}}}),T.prototype.update=function(e){var t=!1;if(e!==this._mode&&(this._mode=e,this._modeChanged=e!==w.MORPHING,t=this._mode===w.SCENE2D),t){var i=this._max2Dfrustum=this.frustum.clone(),r=2,n=i.top/i.right;i.right=this._maxCoord.x*r,i.left=-i.right,i.top=n*i.right,i.bottom=-i.top}};var me=new t,fe=new t,ve=new t;T.prototype._setTransform=function(e){var i=t.clone(this.positionWC,me),r=t.clone(this.upWC,fe),n=t.clone(this.directionWC,ve);v.clone(e,this._transform),this._transformChanged=!0,P(this);var o=this._actualInvTransform;v.multiplyByPoint(o,i,this.position),v.multiplyByPointAsVector(o,n,this.direction),v.multiplyByPointAsVector(o,r,this.up),t.cross(this.direction,this.up,this.right),P(this)};var ge=new t,_e=new v,ye=new v,Ce=new g,Ee=new f,Se=new r,we=new t,Te=new t,xe=new t,be={destination:void 0,orientation:{direction:void 0,up:void 0,heading:void 0,pitch:void 0,roll:void 0},endTransform:void 0};T.prototype.setView=function(e){e=n(e,n.EMPTY_OBJECT);var i=n(e.orientation,n.EMPTY_OBJECT),r=this._mode;if(r!==w.MORPHING){o(e.endTransform)&&this._setTransform(e.endTransform);var a=!0,s=n(e.destination,t.clone(this.positionWC,ge));o(s)&&o(s.west)&&(s=this.getRectangleCameraCoordinates(s,ge),a=!1),o(i.direction)&&(i=L(this,s,i,be.orientation));var l=n(i.heading,0),u=n(i.pitch,-m.PI_OVER_TWO),c=n(i.roll,0);r===w.SCENE3D?R(this,s,l,u,c):r===w.SCENE2D?N(this,s,l,a):O(this,s,l,u,c,a)}},T.prototype.worldToCameraCoordinates=function(e,t){return o(t)||(t=new i),P(this),v.multiplyByVector(this._actualInvTransform,e,t)},T.prototype.worldToCameraCoordinatesPoint=function(e,i){return o(i)||(i=new t),P(this),v.multiplyByPoint(this._actualInvTransform,e,i)},T.prototype.worldToCameraCoordinatesVector=function(e,i){return o(i)||(i=new t),P(this),v.multiplyByPointAsVector(this._actualInvTransform,e,i)},T.prototype.cameraToWorldCoordinates=function(e,t){return o(t)||(t=new i),P(this),v.multiplyByVector(this._actualTransform,e,t)},T.prototype.cameraToWorldCoordinatesPoint=function(e,i){return o(i)||(i=new t),P(this),v.multiplyByPoint(this._actualTransform,e,i)},T.prototype.cameraToWorldCoordinatesVector=function(e,i){return o(i)||(i=new t),P(this),v.multiplyByPointAsVector(this._actualTransform,e,i)};var Ae=new t;T.prototype.move=function(e,i){var r=this.position;t.multiplyByScalar(e,i,Ae),t.add(r,Ae,r),this._mode===w.SCENE2D&&F(this,r)},T.prototype.moveForward=function(e){e=n(e,this.defaultMoveAmount),this.move(this.direction,e)},T.prototype.moveBackward=function(e){e=n(e,this.defaultMoveAmount),this.move(this.direction,-e)},T.prototype.moveUp=function(e){e=n(e,this.defaultMoveAmount),this.move(this.up,e)},T.prototype.moveDown=function(e){e=n(e,this.defaultMoveAmount),this.move(this.up,-e)},T.prototype.moveRight=function(e){e=n(e,this.defaultMoveAmount),this.move(this.right,e)},T.prototype.moveLeft=function(e){e=n(e,this.defaultMoveAmount),this.move(this.right,-e)},T.prototype.lookLeft=function(e){e=n(e,this.defaultLookAmount),this.look(this.up,-e)},T.prototype.lookRight=function(e){e=n(e,this.defaultLookAmount),this.look(this.up,e)},T.prototype.lookUp=function(e){e=n(e,this.defaultLookAmount),this.look(this.right,-e)},T.prototype.lookDown=function(e){e=n(e,this.defaultLookAmount),this.look(this.right,e)};var Pe=new g,Ie=new f;T.prototype.look=function(e,t){var i=n(t,this.defaultLookAmount),r=g.fromAxisAngle(e,-i,Pe),o=f.fromQuaternion(r,Ie),a=this.direction,s=this.up,l=this.right;f.multiplyByVector(o,a,a),f.multiplyByVector(o,s,s),f.multiplyByVector(o,l,l)},T.prototype.twistLeft=function(e){e=n(e,this.defaultLookAmount),this.look(this.direction,e)},T.prototype.twistRight=function(e){e=n(e,this.defaultLookAmount),this.look(this.direction,-e)};var Me=new g,De=new f;T.prototype.rotate=function(e,i){var r=n(i,this.defaultRotateAmount),o=g.fromAxisAngle(e,-r,Me),a=f.fromQuaternion(o,De);f.multiplyByVector(a,this.position,this.position),f.multiplyByVector(a,this.direction,this.direction),f.multiplyByVector(a,this.up,this.up),t.cross(this.direction,this.up,this.right),t.cross(this.right,this.direction,this.up)},T.prototype.rotateDown=function(e){e=n(e,this.defaultRotateAmount),B(this,e)},T.prototype.rotateUp=function(e){e=n(e,this.defaultRotateAmount),B(this,-e)};var Re=new t,Oe=new t,Ne=new t,Le=new t;T.prototype.rotateRight=function(e){e=n(e,this.defaultRotateAmount),V(this,-e)},T.prototype.rotateLeft=function(e){e=n(e,this.defaultRotateAmount),V(this,e)},T.prototype.zoomIn=function(e){e=n(e,this.defaultZoomAmount),this._mode===w.SCENE2D?k(this,e):z(this,e)},T.prototype.zoomOut=function(e){e=n(e,this.defaultZoomAmount),this._mode===w.SCENE2D?k(this,-e):z(this,-e)},T.prototype.getMagnitude=function(){return this._mode===w.SCENE3D?t.magnitude(this.position):this._mode===w.COLUMBUS_VIEW?Math.abs(this.position.z):this._mode===w.SCENE2D?Math.max(this.frustum.right-this.frustum.left,this.frustum.top-this.frustum.bottom):void 0};var Fe=new v;T.prototype.lookAt=function(e,t){var i=C.eastNorthUpToFixedFrame(e,u.WGS84,Fe);this.lookAtTransform(i,t)};var Be=new t,Ve=new g,ke=new g,ze=new f;T.prototype.lookAtTransform=function(i,r){if(this._setTransform(i),o(r)){var n;if(n=o(r.heading)?U(r.heading,r.pitch,r.range):r,this._mode===w.SCENE2D){e.clone(e.ZERO,this.position),t.negate(n,this.up),this.up.z=0,t.magnitudeSquared(this.up)0&&n.clientHeight>0){a[o]?(h(t,f),a[o]=!1,f.prevAngle=f.angleAndHeight.startPosition.x):(e.clone(t.distance.endPosition,f.distance.endPosition),e.clone(t.angleAndHeight.endPosition,f.angleAndHeight.endPosition));for(var i=f.angleAndHeight.endPosition.x,r=f.prevAngle,l=2*Math.PI;i>=r+Math.PI;)i-=l;for(;i0||e}}}),g.prototype.isMoving=function(e,t){var i=c(e,t);return!this._update[i]},g.prototype.getMovement=function(e,t){var i=c(e,t),r=this._movement[i];return r},g.prototype.getLastMovement=function(e,t){var i=c(e,t),r=this._lastMovement[i];return r.valid?r:void 0},g.prototype.isButtonDown=function(e,t){var i=c(e,t);return this._isDown[i]},g.prototype.getStartMousePosition=function(e,t){if(e===u.WHEEL||e===u.PINCH)return this._currentMousePosition;var i=c(e,t);return this._eventStartPosition[i]},g.prototype.getButtonPressTime=function(e,t){var i=c(e,t);return this._pressTime[i]},g.prototype.getButtonReleaseTime=function(e,t){var i=c(e,t);return this._releaseTime[i]},g.prototype.reset=function(){for(var e in this._update)this._update.hasOwnProperty(e)&&(this._update[e]=!0)},g.prototype.isDestroyed=function(){return!1},g.prototype.destroy=function(){return this._eventHandler=this._eventHandler&&this._eventHandler.destroy(),r(this)},g}),i("Scene/UrlTemplateImageryProvider",["../Core/Cartesian2","../Core/Cartesian3","../Core/Cartographic","../Core/combine","../Core/Credit","../Core/defaultValue","../Core/defined","../Core/defineProperties","../Core/DeveloperError","../Core/Event","../Core/freezeObject","../Core/GeographicTilingScheme","../Core/loadJson","../Core/loadText","../Core/loadWithXhr","../Core/loadXML","../Core/Math","../Core/Rectangle","../Core/TileProviderError","../Core/WebMercatorTilingScheme","../ThirdParty/when","./ImageryProvider"],function(e,t,i,r,n,o,a,s,l,u,c,h,d,p,m,f,v,g,_,y,C,E){"use strict";function S(e){this._errorEvent=new u,this._url=void 0,this._pickFeaturesUrl=void 0,this._proxy=void 0,this._tileWidth=void 0,this._tileHeight=void 0,this._maximumLevel=void 0,this._minimumLevel=void 0,this._tilingScheme=void 0,this._rectangle=void 0,this._tileDiscardPolicy=void 0,this._credit=void 0,this._hasAlphaChannel=void 0,this._readyPromise=void 0,this._withCredentials=o(e.withCredentials,void 0),this._headers=o(e.headers,void 0),this.enablePickFeatures=!0,this.reinitialize(e)}function w(e,t,i,r){return re=!1,oe=!1,x(e,e._urlParts,function(n){return n(e,t,i,r)})}function T(e,t,i,r,n,o,a){return re=!1,oe=!1,se=!1,ce=!1,x(e,e._pickFeaturesUrlParts,function(s){return s(e,t,i,r,n,o,a)})}function x(e,t,i){for(var r="",n=0;n=0&&i>u&&(i=u,r=s[l])}a(r)?(i>o&&n.push(e.substring(o,i)),n.push(t[r]),o=i+r.length):(n.push(e.substring(o)),o=e.length)}return n}}function A(e,t,i,r){return t}function P(e,t,i,r){return e.tilingScheme.getNumberOfXTilesAtLevel(r)-t-1}function I(e,t,i,r){return i}function M(e,t,i,r){return e.tilingScheme.getNumberOfYTilesAtLevel(r)-i-1}function D(e,t,i,r){var n=e.maximumLevel;return a(n)&&n>r?n-r-1:r}function R(e,t,i,r){return r}function O(e,t,i,r){var n=(t+i+r)%e._subdomains.length;return e._subdomains[n]}function N(e,t,i,r){re||(e.tilingScheme.tileXYToRectangle(t,i,r,ne),ne.west=v.toDegrees(ne.west),ne.south=v.toDegrees(ne.south),ne.east=v.toDegrees(ne.east),ne.north=v.toDegrees(ne.north),re=!0)}function L(e,t,i,r){return N(e,t,i,r),ne.west}function F(e,t,i,r){return N(e,t,i,r),ne.south}function B(e,t,i,r){return N(e,t,i,r),ne.east}function V(e,t,i,r){return N(e,t,i,r),ne.north}function k(e,t,i,r){oe||(e.tilingScheme.tileXYToNativeRectangle(t,i,r,ae),oe=!0)}function z(e,t,i,r){return k(e,t,i,r),ae.west}function U(e,t,i,r){return k(e,t,i,r),ae.south}function G(e,t,i,r){return k(e,t,i,r),ae.east}function W(e,t,i,r){return k(e,t,i,r),ae.north}function H(e,t,i,r){return e.tileWidth}function q(e,t,i,r){return e.tileHeight}function j(e,t,i,r,n,o,a){return K(e,t,i,r,n,o),le.x}function Y(e,t,i,r,n,o,a){return K(e,t,i,r,n,o),le.y}function X(e,t,i,r,n,o,a){return K(e,t,i,r,n,o),e.tileWidth-le.x-1}function Z(e,t,i,r,n,o,a){return K(e,t,i,r,n,o),e.tileHeight-le.y-1}function K(e,t,i,r,n,o,a){if(!se){te(e,t,i,r,n,o);var s=he,l=e.tilingScheme.tileXYToNativeRectangle(t,i,r,ue);le.x=e.tileWidth*(s.x-l.west)/l.width|0,le.y=e.tileHeight*(l.north-s.y)/l.height|0,se=!0}}function Q(e,t,i,r,n,o,a){return v.toDegrees(n)}function J(e,t,i,r,n,o,a){return v.toDegrees(o)}function $(e,t,i,r,n,o,a){return te(e,t,i,r,n,o),he.x}function ee(e,t,i,r,n,o,a){return te(e,t,i,r,n,o),he.y}function te(e,t,i,r,n,o,a){if(!ce){var s;if(e.tilingScheme instanceof h)he.x=v.toDegrees(n),he.y=v.toDegrees(o);else{var l=de;l.longitude=n,l.latitude=o,s=e.tilingScheme.projection.project(l,he)}ce=!0}}function ie(e,t,i,r,n,o,a){return a}s(S.prototype,{url:{get:function(){return this._url}},pickFeaturesUrl:{get:function(){return this._pickFeaturesUrl}},proxy:{get:function(){return this._proxy}},tileWidth:{get:function(){return this._tileWidth}},tileHeight:{get:function(){return this._tileHeight}},maximumLevel:{get:function(){return this._maximumLevel}},minimumLevel:{get:function(){return this._minimumLevel}},tilingScheme:{get:function(){return this._tilingScheme}},rectangle:{get:function(){return this._rectangle}},tileDiscardPolicy:{get:function(){return this._tileDiscardPolicy}},errorEvent:{get:function(){return this._errorEvent}},ready:{get:function(){return a(this._urlParts)}},readyPromise:{get:function(){return this._readyPromise}},credit:{get:function(){return this._credit}},hasAlphaChannel:{get:function(){return this._hasAlphaChannel}},headers:{get:function(){return this._headers}},withCredentials:{get:function(){return this._withCredentials}}}),S.prototype.reinitialize=function(e){var t=this;t._readyPromise=C(e).then(function(e){t.enablePickFeatures=o(e.enablePickFeatures,t.enablePickFeatures),t._url=e.url,t._pickFeaturesUrl=e.pickFeaturesUrl,t._proxy=e.proxy,t._tileDiscardPolicy=e.tileDiscardPolicy,t._getFeatureInfoFormats=e.getFeatureInfoFormats,t._subdomains=e.subdomains,Array.isArray(t._subdomains)?t._subdomains=t._subdomains.slice():a(t._subdomains)&&t._subdomains.length>0?t._subdomains=t._subdomains.split(""):t._subdomains=["a","b","c"],t._tileWidth=o(e.tileWidth,256),t._tileHeight=o(e.tileHeight,256),t._minimumLevel=o(e.minimumLevel,0),t._maximumLevel=e.maximumLevel,t._tilingScheme=o(e.tilingScheme,new y({ellipsoid:e.ellipsoid})),t._rectangle=o(e.rectangle,t._tilingScheme.rectangle),t._rectangle=g.intersection(t._rectangle,t._tilingScheme.rectangle),t._hasAlphaChannel=o(e.hasAlphaChannel,!0),t._withCredentials=o(e.withCredentials,void 0),t._headers=o(e.headers,void 0);var i=e.credit;return"string"==typeof i&&(i=new n(i)),t._credit=i,t._urlParts=b(t._url,pe),t._pickFeaturesUrlParts=b(t._pickFeaturesUrl,me),!0})},S.prototype.getTileCredits=function(e,t,i){},S.prototype.requestImage=function(e,t,i){var r=w(this,e,t,i);return E.loadImage(this,r)},S.prototype.pickFeatures=function(e,t,i,r,n){function o(e,t){return e.callback(t)}function s(){if(l>=u._getFeatureInfoFormats.length)return C([]);var a=u._getFeatureInfoFormats[l],c=T(u,e,t,i,r,n,a.format),h={headers:u.headers,withCredentials:u.withCredentials};return++l,"json"===a.type?d(c,h).then(a.callback).otherwise(s):"xml"===a.type?f(c,h).then(a.callback).otherwise(s):"text"===a.type||"html"===a.type?p(c,h).then(a.callback).otherwise(s):m({url:c,headers:u.headers,withCredentials:u.withCredentials,responseType:a.format}).then(o.bind(void 0,a)).otherwise(s)}if(this.enablePickFeatures&&a(this._pickFeaturesUrl)&&0!==this._getFeatureInfoFormats.length){var l=0,u=this;return s()}};var re=!1,ne=new g,oe=!1,ae=new g,se=!1,le=new e,ue=new g,ce=!1,he=new t,de=new i,pe={"{x}":A,"{y}":I, -"{z}":R,"{s}":O,"{reverseX}":P,"{-x}":P,"{reverseY}":M,"{-y}":M,"{reverseZ}":D,"{-z}":D,"{westDegrees}":L,"{southDegrees}":F,"{eastDegrees}":B,"{northDegrees}":V,"{westProjected}":z,"{southProjected}":U,"{eastProjected}":G,"{northProjected}":W,"{width}":H,"{height}":q},me=r(pe,{"{i}":j,"{j}":Y,"{reverseI}":X,"{reverseJ}":Z,"{-i}":X,"{-j}":Z,"{longitudeDegrees}":Q,"{latitudeDegrees}":J,"{longitudeProjected}":$,"{latitudeProjected}":ee,"{format}":ie});return S}),i("Scene/createOpenStreetMapImageryProvider",["../Core/Credit","../Core/defaultValue","../Core/DeveloperError","../Core/Rectangle","../Core/WebMercatorTilingScheme","./UrlTemplateImageryProvider"],function(e,t,i,r,n,o){"use strict";function a(a){a=t(a,{});var u=t(a.url,"//a.tile.openstreetmap.org/");s.test(u)||(u+="/");var c=t(a.fileExtension,"png"),h=new n({ellipsoid:a.ellipsoid}),d=256,p=256,m=t(a.minimumLevel,0),f=a.maximumLevel,v=t(a.rectangle,h.rectangle),g=h.positionToTileXY(r.southwest(v),m),_=h.positionToTileXY(r.northeast(v),m),y=(Math.abs(_.x-g.x)+1)*(Math.abs(_.y-g.y)+1);if(y>4)throw new i("The rectangle and minimumLevel indicate that there are "+y+" tiles at the minimum level. Imagery providers with more than four tiles at the minimum level are not supported.");var C=t(a.credit,l);"string"==typeof C&&(C=new e(C));var E=u+"{z}/{x}/{y}."+c;return new o({url:E,proxy:a.proxy,credit:C,tilingScheme:h,tileWidth:d,tileHeight:p,minimumLevel:m,maximumLevel:f,rectangle:v})}var s=/\/$/,l=new e("MapQuest, Open Street Map and contributors, CC-BY-SA");return a}),i("Scene/createTangentSpaceDebugPrimitive",["../Core/ColorGeometryInstanceAttribute","../Core/defaultValue","../Core/defined","../Core/DeveloperError","../Core/GeometryInstance","../Core/GeometryPipeline","../Core/Matrix4","./PerInstanceColorAppearance","./Primitive"],function(e,t,i,r,n,o,a,s,l){"use strict";function u(r){r=t(r,t.EMPTY_OBJECT);var u=[],c=r.geometry;i(c.attributes)&&i(c.primitiveType)||(c=c.constructor.createGeometry(c));var h=c.attributes,d=a.clone(t(r.modelMatrix,a.IDENTITY)),p=t(r.length,1e4);return i(h.normal)&&u.push(new n({geometry:o.createLineSegmentsForVectors(c,"normal",p),attributes:{color:new e(1,0,0,1)},modelMatrix:d})),i(h.binormal)&&u.push(new n({geometry:o.createLineSegmentsForVectors(c,"binormal",p),attributes:{color:new e(0,1,0,1)},modelMatrix:d})),i(h.tangent)&&u.push(new n({geometry:o.createLineSegmentsForVectors(c,"tangent",p),attributes:{color:new e(0,0,1,1)},modelMatrix:d})),u.length>0?new l({asynchronous:!1,geometryInstances:u,appearance:new s({flat:!0,translucent:!1})}):void 0}return u}),i("Scene/createTileMapServiceImageryProvider",["../Core/Cartesian2","../Core/Cartographic","../Core/Credit","../Core/defaultValue","../Core/defined","../Core/defineProperties","../Core/DeveloperError","../Core/Event","../Core/GeographicTilingScheme","../Core/joinUrls","../Core/loadXML","../Core/Rectangle","../Core/RuntimeError","../Core/TileProviderError","../Core/WebMercatorTilingScheme","../ThirdParty/when","./UrlTemplateImageryProvider"],function(e,t,i,r,n,o,a,s,l,u,c,h,d,p,m,f,v){"use strict";function g(i){function o(o){for(var a,c,f,v,E=/tileformat/i,S=/tileset/i,w=/tilesets/i,T=/boundingbox/i,x=/srs/i,b=[],A=o.childNodes[0].childNodes,P=0;Pk.rectangle.east&&(U.east=k.rectangle.east),U.southk.rectangle.north&&(U.north=k.rectangle.north);var Y=k.positionToTileXY(h.southwest(U),L),X=k.positionToTileXY(h.northeast(U),L),Z=(Math.abs(X.x-Y.x)+1)*(Math.abs(X.y-Y.y)+1);Z>4&&(L=0);var K=u(_,R);D.length&&(K=u(K,"."+D)),y.resolve({url:K,tilingScheme:k,rectangle:U,tileWidth:O,tileHeight:N,minimumLevel:L,maximumLevel:F,proxy:i.proxy,tileDiscardPolicy:i.tileDiscardPolicy,credit:i.credit,pickFeaturesUrl:i.pickFeaturesUrl,withCredentials:i.withCredentials,getFeatureInfoFormats:i.getFeatureInfoFormats})}function a(e){var t=r(i.fileExtension,"png"),o=r(i.tileSchema,"{z}/{x}/{reverseY}"),a=r(i.tileWidth,256),s=r(i.tileHeight,256),l=r(i.minimumLevel,0),c=i.maximumLevel,h=n(i.tilingScheme)?i.tilingScheme:new m({ellipsoid:i.ellipsoid}),d=r(i.rectangle,h.rectangle),p=u(_,o);t.length&&(p=u(p,"."+t)),y.resolve({url:p,tilingScheme:h,rectangle:d,tileWidth:a,tileHeight:s,minimumLevel:l,maximumLevel:c,proxy:i.proxy,tileDiscardPolicy:i.tileDiscardPolicy,credit:i.credit,withCredentials:i.withCredentials,pickFeaturesUrl:i.pickFeaturesUrl,getFeatureInfoFormats:i.getFeatureInfoFormats})}function s(){var e=u(_,"tilemapresource.xml"),t=i.proxy;n(t)&&(e=t.getURL(e)),f(c(e),o,a)}i=r(i,{});var g,_=i.url,y=f.defer(),C=new v(y.promise);return s(),C}return g}),i("Scene/CreditDisplay",["../Core/Credit","../Core/defaultValue","../Core/defined","../Core/destroyObject","../Core/DeveloperError"],function(e,t,i,r,n){"use strict";function o(e,t,r){if(!i(e.element)){var n=e.text,o=e.link,a=document.createElement("span");if(e.hasLink()){var s=document.createElement("a");s.textContent=n,s.href=o,s.target="_blank",a.appendChild(s)}else a.textContent=n;a.className="cesium-credit-text",e.element=a}if(t.hasChildNodes()){var l=document.createElement("span");l.textContent=r,l.className="cesium-credit-delimiter",t.appendChild(l)}t.appendChild(e.element)}function a(e,t){if(!i(e.element)){var r=e.text,n=e.link,o=document.createElement("span"),a=document.createElement("img");if(a.src=e.imageUrl,a.style["vertical-align"]="bottom",i(r)&&(a.alt=r,a.title=r),e.hasLink()){var s=document.createElement("a");s.appendChild(a),s.href=n,s.target="_blank",o.appendChild(s)}else o.appendChild(a);o.className="cesium-credit-image",e.element=o}t.appendChild(e.element)}function s(t,i){for(var r=t.length,n=0;r>n;n++){var o=t[n];if(e.equals(o,i))return!0}return!1}function l(e){var t=e.element;if(i(t)){var r=t.parentNode;if(!e.hasImage()){var n=t.previousSibling;null===n&&(n=t.nextSibling),null!==n&&r.removeChild(n)}r.removeChild(t)}}function u(e,t){var r,n,a,s=e._displayedCredits.textCredits;for(r=0;r= 0.0) {\nt1 = (-b - sqrt(discriminant)) * 0.5;\nt2 = (-b + sqrt(discriminant)) * 0.5;\n}\nif (t1 < 0.0 && t2 < 0.0) {\ndiscard;\n}\nfloat t = min(t1, t2);\nif (t < 0.0) {\nt = 0.0;\n}\nczm_ellipsoid ellipsoid = czm_ellipsoidNew(ellipsoidCenter, u_radii);\nczm_ray ray = czm_ray(t * direction, direction);\nczm_raySegment intersection = czm_rayEllipsoidIntersectionInterval(ray, ellipsoid);\nif (czm_isEmpty(intersection))\n{\ndiscard;\n}\nvec4 outsideFaceColor = (intersection.start != 0.0) ? computeEllipsoidColor(ray, intersection.start, 1.0) : vec4(0.0);\nvec4 insideFaceColor = (outsideFaceColor.a < 1.0) ? computeEllipsoidColor(ray, intersection.stop, -1.0) : vec4(0.0);\ngl_FragColor = mix(insideFaceColor, outsideFaceColor, outsideFaceColor.a);\ngl_FragColor.a = 1.0 - (1.0 - insideFaceColor.a) * (1.0 - outsideFaceColor.a);\n#ifdef WRITE_DEPTH\n#ifdef GL_EXT_frag_depth\nt = (intersection.start != 0.0) ? intersection.start : intersection.stop;\nvec3 positionEC = czm_pointAlongRay(ray, t);\nvec4 positionCC = czm_projection * vec4(positionEC, 1.0);\nfloat z = positionCC.z / positionCC.w;\nfloat n = czm_depthRange.near;\nfloat f = czm_depthRange.far;\ngl_FragDepthEXT = (z * (f - n) + f + n) * 0.5;\n#endif\n#endif\n}\n"}),i("Shaders/EllipsoidVS",[],function(){"use strict";return"attribute vec3 position;\nuniform vec3 u_radii;\nvarying vec3 v_positionEC;\nvoid main()\n{\nvec4 p = vec4(u_radii * position, 1.0);\nv_positionEC = (czm_modelView * p).xyz;\ngl_Position = czm_modelViewProjection * p;\ngl_Position.z = clamp(gl_Position.z, czm_depthRange.near, czm_depthRange.far);\n}\n"}),i("Scene/EllipsoidPrimitive",["../Core/BoundingSphere","../Core/BoxGeometry","../Core/Cartesian3","../Core/combine","../Core/defaultValue","../Core/defined","../Core/destroyObject","../Core/DeveloperError","../Core/Matrix4","../Core/VertexFormat","../Renderer/BufferUsage","../Renderer/DrawCommand","../Renderer/RenderState","../Renderer/ShaderProgram","../Renderer/ShaderSource","../Renderer/VertexArray","../Shaders/EllipsoidFS","../Shaders/EllipsoidVS","./BlendingState","./CullFace","./Material","./Pass","./SceneMode"],function(e,t,i,r,n,o,a,s,l,u,c,h,d,p,m,f,v,g,_,y,C,E,S){"use strict";function w(t){t=n(t,n.EMPTY_OBJECT),this.center=i.clone(n(t.center,i.ZERO)),this._center=new i,this.radii=i.clone(t.radii),this._radii=new i,this._oneOverEllipsoidRadiiSquared=new i,this._boundingSphere=new e,this.modelMatrix=l.clone(n(t.modelMatrix,l.IDENTITY)),this._modelMatrix=new l,this._computedModelMatrix=new l,this.show=n(t.show,!0),this.material=n(t.material,C.fromType(C.ColorType)),this._material=void 0,this._translucent=void 0,this.id=t.id,this._id=void 0,this.debugShowBoundingVolume=n(t.debugShowBoundingVolume,!1),this.onlySunLighting=n(t.onlySunLighting,!1),this._onlySunLighting=!1,this._depthTestEnabled=n(t.depthTestEnabled,!0),this._sp=void 0,this._rs=void 0,this._va=void 0,this._pickSP=void 0,this._pickId=void 0,this._colorCommand=new h({owner:n(t._owner,this)}),this._pickCommand=new h({owner:n(t._owner,this)});var r=this;this._uniforms={u_radii:function(){return r.radii},u_oneOverEllipsoidRadiiSquared:function(){return r._oneOverEllipsoidRadiiSquared}},this._pickUniforms={czm_pickColor:function(){return r._pickId.color}}}function T(e){var r=e.cache.ellipsoidPrimitive_vertexArray;if(o(r))return r;var n=t.createGeometry(t.fromDimensions({dimensions:new i(2,2,2),vertexFormat:u.POSITION_ONLY}));return r=f.fromGeometry({context:e,geometry:n,attributeLocations:x,bufferUsage:c.STATIC_DRAW,interleave:!0}),e.cache.ellipsoidPrimitive_vertexArray=r,r}var x={position:0};return w.prototype.update=function(t){if(this.show&&t.mode===S.SCENE3D&&o(this.center)&&o(this.radii)){var n=t.context,a=this.material.isTranslucent(),s=this._translucent!==a;(!o(this._rs)||s)&&(this._translucent=a,this._rs=d.fromCache({cull:{enabled:!0,face:y.FRONT},depthTest:{enabled:this._depthTestEnabled},depthMask:!a&&n.fragmentDepth,blending:a?_.ALPHA_BLEND:void 0})),o(this._va)||(this._va=T(n));var u=!1,c=this.radii;if(!i.equals(this._radii,c)){i.clone(c,this._radii);var h=this._oneOverEllipsoidRadiiSquared;h.x=1/(c.x*c.x),h.y=1/(c.y*c.y),h.z=1/(c.z*c.z),u=!0}l.equals(this.modelMatrix,this._modelMatrix)&&i.equals(this.center,this._center)||(l.clone(this.modelMatrix,this._modelMatrix),i.clone(this.center,this._center),l.multiplyByTranslation(this.modelMatrix,this.center,this._computedModelMatrix),u=!0),u&&(i.clone(i.ZERO,this._boundingSphere.center),this._boundingSphere.radius=i.maximumComponent(c),e.transform(this._boundingSphere,this._computedModelMatrix,this._boundingSphere));var f=this._material!==this.material;this._material=this.material,this._material.update(n);var C=this.onlySunLighting!==this._onlySunLighting;this._onlySunLighting=this.onlySunLighting;var w,b=this._colorCommand;(f||C||s)&&(w=new m({sources:[this.material.shaderSource,v]}),this.onlySunLighting&&w.defines.push("ONLY_SUN_LIGHTING"),!a&&n.fragmentDepth&&w.defines.push("WRITE_DEPTH"),this._sp=p.replaceCache({context:n,shaderProgram:this._sp,vertexShaderSource:g,fragmentShaderSource:w,attributeLocations:x}),b.vertexArray=this._va,b.renderState=this._rs,b.shaderProgram=this._sp,b.uniformMap=r(this._uniforms,this.material._uniforms),b.executeInClosestFrustum=a);var A=t.commandList,P=t.passes;if(P.render&&(b.boundingVolume=this._boundingSphere,b.debugShowBoundingVolume=this.debugShowBoundingVolume,b.modelMatrix=this._computedModelMatrix,b.pass=a?E.TRANSLUCENT:E.OPAQUE,A.push(b)),P.pick){var I=this._pickCommand;o(this._pickId)&&this._id===this.id||(this._id=this.id,this._pickId=this._pickId&&this._pickId.destroy(),this._pickId=n.createPickId({primitive:this,id:this.id})),(f||C||!o(this._pickSP))&&(w=new m({sources:[this.material.shaderSource,v],pickColorQualifier:"uniform"}),this.onlySunLighting&&w.defines.push("ONLY_SUN_LIGHTING"),!a&&n.fragmentDepth&&w.defines.push("WRITE_DEPTH"),this._pickSP=p.replaceCache({context:n,shaderProgram:this._pickSP,vertexShaderSource:g,fragmentShaderSource:w,attributeLocations:x}),I.vertexArray=this._va,I.renderState=this._rs,I.shaderProgram=this._pickSP,I.uniformMap=r(r(this._uniforms,this._pickUniforms),this.material._uniforms),I.executeInClosestFrustum=a),I.boundingVolume=this._boundingSphere,I.modelMatrix=this._computedModelMatrix,I.pass=a?E.TRANSLUCENT:E.OPAQUE,A.push(I)}}},w.prototype.isDestroyed=function(){return!1},w.prototype.destroy=function(){return this._sp=this._sp&&this._sp.destroy(),this._pickSP=this._pickSP&&this._pickSP.destroy(),this._pickId=this._pickId&&this._pickId.destroy(),a(this)},w}),i("Shaders/Appearances/EllipsoidSurfaceAppearanceFS",[],function(){"use strict";return"varying vec3 v_positionMC;\nvarying vec3 v_positionEC;\nvarying vec2 v_st;\nvoid main()\n{\nczm_materialInput materialInput;\nvec3 normalEC = normalize(czm_normal3D * czm_geodeticSurfaceNormal(v_positionMC, vec3(0.0), vec3(1.0)));\n#ifdef FACE_FORWARD\nnormalEC = faceforward(normalEC, vec3(0.0, 0.0, 1.0), -normalEC);\n#endif\nmaterialInput.s = v_st.s;\nmaterialInput.st = v_st;\nmaterialInput.str = vec3(v_st, 0.0);\nmaterialInput.normalEC = normalEC;\nmaterialInput.tangentToEyeMatrix = czm_eastNorthUpToEyeCoordinates(v_positionMC, materialInput.normalEC);\nvec3 positionToEyeEC = -v_positionEC;\nmaterialInput.positionToEyeEC = positionToEyeEC;\nczm_material material = czm_getMaterial(materialInput);\n#ifdef FLAT\ngl_FragColor = vec4(material.diffuse + material.emission, material.alpha);\n#else\ngl_FragColor = czm_phong(normalize(positionToEyeEC), material);\n#endif\n}\n"}),i("Shaders/Appearances/EllipsoidSurfaceAppearanceVS",[],function(){"use strict";return"attribute vec3 position3DHigh;\nattribute vec3 position3DLow;\nattribute vec2 st;\nvarying vec3 v_positionMC;\nvarying vec3 v_positionEC;\nvarying vec2 v_st;\nvoid main()\n{\nvec4 p = czm_computePosition();\nv_positionMC = position3DHigh + position3DLow;\nv_positionEC = (czm_modelViewRelativeToEye * p).xyz;\nv_st = st;\ngl_Position = czm_modelViewProjectionRelativeToEye * p;\n}\n"}),i("Scene/EllipsoidSurfaceAppearance",["../Core/defaultValue","../Core/defined","../Core/defineProperties","../Core/VertexFormat","../Shaders/Appearances/EllipsoidSurfaceAppearanceFS","../Shaders/Appearances/EllipsoidSurfaceAppearanceVS","./Appearance","./Material"],function(e,t,i,r,n,o,a,s){"use strict";function l(i){i=e(i,e.EMPTY_OBJECT);var r=e(i.translucent,!0),l=e(i.aboveGround,!1);this.material=t(i.material)?i.material:s.fromType(s.ColorType),this.translucent=e(i.translucent,!0),this._vertexShaderSource=e(i.vertexShaderSource,o),this._fragmentShaderSource=e(i.fragmentShaderSource,n),this._renderState=a.getDefaultRenderState(r,!l,i.renderState),this._closed=!1,this._flat=e(i.flat,!1),this._faceForward=e(i.faceForward,l),this._aboveGround=l}return i(l.prototype,{vertexShaderSource:{get:function(){return this._vertexShaderSource}},fragmentShaderSource:{get:function(){return this._fragmentShaderSource}},renderState:{get:function(){return this._renderState}},closed:{get:function(){return this._closed}},vertexFormat:{get:function(){return l.VERTEX_FORMAT}},flat:{get:function(){return this._flat}},faceForward:{get:function(){return this._faceForward}},aboveGround:{get:function(){return this._aboveGround}}}),l.VERTEX_FORMAT=r.POSITION_AND_ST,l.prototype.getFragmentShaderSource=a.prototype.getFragmentShaderSource,l.prototype.isTranslucent=a.prototype.isTranslucent,l.prototype.getRenderState=a.prototype.getRenderState,l}),i("Scene/Fog",["../Core/Cartesian3","../Core/defined","../Core/Math","./SceneMode"],function(e,t,i,r){"use strict";function n(){this.enabled=!0,this.density=2e-4,this.screenSpaceErrorFactor=2}function o(e){var t=a,i=t.length;if(et[i-1])return d=i-2;if(e>=t[d]){if(i>d+1&&ed+2&&e=0&&e>=t[d-1])return--d,d;var r;for(r=0;i-2>r&&!(e>=t[r]&&e8e5||n.mode!==r.SCENE3D)return void(n.fog.enabled=!1);var m=d.height,f=o(m),v=i.clamp((m-a[f])/(a[f+1]-a[f]),0,1),g=i.lerp(s[f],s[f+1],v),_=1e6*this.density,y=_/u*c;g=g*(_-y)*1e-6;var C=e.normalize(h.positionWC,p),E=i.clamp(e.dot(h.directionWC,C),0,1);g*=1-E,n.fog.density=g,n.fog.sse=this.screenSpaceErrorFactor}},n}),i("Scene/FrameRateMonitor",["../Core/defaultValue","../Core/defined","../Core/defineProperties","../Core/destroyObject","../Core/DeveloperError","../Core/Event","../Core/getTimestamp","../Core/TimeConstants"],function(e,t,i,r,n,o,a,s){"use strict";function l(i){function r(){c(n)}this._scene=i.scene,this.samplingWindow=e(i.samplingWindow,l.defaultSettings.samplingWindow),this.quietPeriod=e(i.quietPeriod,l.defaultSettings.quietPeriod),this.warmupPeriod=e(i.warmupPeriod,l.defaultSettings.warmupPeriod),this.minimumFrameRateDuringWarmup=e(i.minimumFrameRateDuringWarmup,l.defaultSettings.minimumFrameRateDuringWarmup),this.minimumFrameRateAfterWarmup=e(i.minimumFrameRateAfterWarmup,l.defaultSettings.minimumFrameRateAfterWarmup),this._lowFrameRate=new o,this._nominalFrameRate=new o,this._frameTimes=[],this._needsQuietPeriod=!0,this._quietPeriodEndTime=0, -this._warmupPeriodEndTime=0,this._frameRateIsLow=!1,this._lastFramesPerSecond=void 0,this._pauseCount=0;var n=this;this._preRenderRemoveListener=this._scene.preRender.addEventListener(function(e,t){u(n,t)}),this._hiddenPropertyName=t(document.hidden)?"hidden":t(document.mozHidden)?"mozHidden":t(document.msHidden)?"msHidden":t(document.webkitHidden)?"webkitHidden":void 0;var a=t(document.hidden)?"visibilitychange":t(document.mozHidden)?"mozvisibilitychange":t(document.msHidden)?"msvisibilitychange":t(document.webkitHidden)?"webkitvisibilitychange":void 0;this._visibilityChangeRemoveListener=void 0,t(a)&&(document.addEventListener(a,r,!1),this._visibilityChangeRemoveListener=function(){document.removeEventListener(a,r,!1)})}function u(e,t){if(!(e._pauseCount>0)){var i=a();if(e._needsQuietPeriod)e._needsQuietPeriod=!1,e._frameTimes.length=0,e._quietPeriodEndTime=i+e.quietPeriod/s.SECONDS_PER_MILLISECOND,e._warmupPeriodEndTime=e._quietPeriodEndTime+(e.warmupPeriod+e.samplingWindow)/s.SECONDS_PER_MILLISECOND;else if(i>=e._quietPeriodEndTime){e._frameTimes.push(i);var r=i-e.samplingWindow/s.SECONDS_PER_MILLISECOND;if(e._frameTimes.length>=2&&e._frameTimes[0]<=r){for(;e._frameTimes.length>=2&&e._frameTimes[1]e._warmupPeriodEndTime?e.minimumFrameRateAfterWarmup:e.minimumFrameRateDuringWarmup);n>o?e._frameRateIsLow||(e._frameRateIsLow=!0,e._needsQuietPeriod=!0,e.lowFrameRate.raiseEvent(e.scene,e._lastFramesPerSecond)):e._frameRateIsLow&&(e._frameRateIsLow=!1,e._needsQuietPeriod=!0,e.nominalFrameRate.raiseEvent(e.scene,e._lastFramesPerSecond))}}}}function c(e){document[e._hiddenPropertyName]?e.pause():e.unpause()}return l.defaultSettings={samplingWindow:5,quietPeriod:2,warmupPeriod:5,minimumFrameRateDuringWarmup:4,minimumFrameRateAfterWarmup:8},l.fromScene=function(e){return(!t(e._frameRateMonitor)||e._frameRateMonitor.isDestroyed())&&(e._frameRateMonitor=new l({scene:e})),e._frameRateMonitor},i(l.prototype,{scene:{get:function(){return this._scene}},lowFrameRate:{get:function(){return this._lowFrameRate}},nominalFrameRate:{get:function(){return this._nominalFrameRate}},lastFramesPerSecond:{get:function(){return this._lastFramesPerSecond}}}),l.prototype.pause=function(){++this._pauseCount,1===this._pauseCount&&(this._frameTimes.length=0,this._lastFramesPerSecond=void 0)},l.prototype.unpause=function(){--this._pauseCount,this._pauseCount<=0&&(this._pauseCount=0,this._needsQuietPeriod=!0)},l.prototype.isDestroyed=function(){return!1},l.prototype.destroy=function(){return this._preRenderRemoveListener(),t(this._visibilityChangeRemoveListener)&&this._visibilityChangeRemoveListener(),r(this)},l}),i("Scene/FrameState",["./SceneMode"],function(e){"use strict";function t(t,i){this.context=t,this.commandList=[],this.mode=e.SCENE3D,this.morphTime=e.getMorphTime(e.SCENE3D),this.frameNumber=0,this.time=void 0,this.mapProjection=void 0,this.camera=void 0,this.cullingVolume=void 0,this.occluder=void 0,this.passes={render:!1,pick:!1},this.creditDisplay=i,this.afterRender=[],this.scene3DOnly=!1,this.fog={enabled:!1,density:void 0,sse:void 0},this.terrainExaggeration=1}return t}),i("Scene/FrustumCommands",["../Core/defaultValue","./Pass"],function(e,t){"use strict";function i(i,r){this.near=e(i,0),this.far=e(r,0);for(var n=t.NUMBER_OF_PASSES,o=new Array(n),a=new Array(n),s=0;n>s;++s)o[s]=[],a[s]=0;this.commands=o,this.indices=a}return i}),i("Shaders/PostProcessFilters/FXAA",[],function(){"use strict";return"#ifndef FXAA_PRESET\n#define FXAA_PRESET 3\n#endif\n#if (FXAA_PRESET == 3)\n#define FXAA_EDGE_THRESHOLD (1.0/8.0)\n#define FXAA_EDGE_THRESHOLD_MIN (1.0/24.0)\n#define FXAA_SEARCH_STEPS 16\n#define FXAA_SEARCH_THRESHOLD (1.0/4.0)\n#define FXAA_SUBPIX_CAP (3.0/4.0)\n#define FXAA_SUBPIX_TRIM (1.0/4.0)\n#endif\n#if (FXAA_PRESET == 4)\n#define FXAA_EDGE_THRESHOLD (1.0/8.0)\n#define FXAA_EDGE_THRESHOLD_MIN (1.0/24.0)\n#define FXAA_SEARCH_STEPS 24\n#define FXAA_SEARCH_THRESHOLD (1.0/4.0)\n#define FXAA_SUBPIX_CAP (3.0/4.0)\n#define FXAA_SUBPIX_TRIM (1.0/4.0)\n#endif\n#if (FXAA_PRESET == 5)\n#define FXAA_EDGE_THRESHOLD (1.0/8.0)\n#define FXAA_EDGE_THRESHOLD_MIN (1.0/24.0)\n#define FXAA_SEARCH_STEPS 32\n#define FXAA_SEARCH_THRESHOLD (1.0/4.0)\n#define FXAA_SUBPIX_CAP (3.0/4.0)\n#define FXAA_SUBPIX_TRIM (1.0/4.0)\n#endif\n#define FXAA_SUBPIX_TRIM_SCALE (1.0/(1.0 - FXAA_SUBPIX_TRIM))\nfloat FxaaLuma(vec3 rgb) {\nreturn rgb.y * (0.587/0.299) + rgb.x;\n}\nvec3 FxaaLerp3(vec3 a, vec3 b, float amountOfA) {\nreturn (vec3(-amountOfA) * b) + ((a * vec3(amountOfA)) + b);\n}\nvec4 FxaaTexOff(sampler2D tex, vec2 pos, ivec2 off, vec2 rcpFrame) {\nfloat x = pos.x + float(off.x) * rcpFrame.x;\nfloat y = pos.y + float(off.y) * rcpFrame.y;\nreturn texture2D(tex, vec2(x, y));\n}\nvec3 FxaaPixelShader(vec2 pos, sampler2D tex, vec2 rcpFrame)\n{\nvec3 rgbN = FxaaTexOff(tex, pos.xy, ivec2( 0,-1), rcpFrame).xyz;\nvec3 rgbW = FxaaTexOff(tex, pos.xy, ivec2(-1, 0), rcpFrame).xyz;\nvec3 rgbM = FxaaTexOff(tex, pos.xy, ivec2( 0, 0), rcpFrame).xyz;\nvec3 rgbE = FxaaTexOff(tex, pos.xy, ivec2( 1, 0), rcpFrame).xyz;\nvec3 rgbS = FxaaTexOff(tex, pos.xy, ivec2( 0, 1), rcpFrame).xyz;\nfloat lumaN = FxaaLuma(rgbN);\nfloat lumaW = FxaaLuma(rgbW);\nfloat lumaM = FxaaLuma(rgbM);\nfloat lumaE = FxaaLuma(rgbE);\nfloat lumaS = FxaaLuma(rgbS);\nfloat rangeMin = min(lumaM, min(min(lumaN, lumaW), min(lumaS, lumaE)));\nfloat rangeMax = max(lumaM, max(max(lumaN, lumaW), max(lumaS, lumaE)));\nfloat range = rangeMax - rangeMin;\nif(range < max(FXAA_EDGE_THRESHOLD_MIN, rangeMax * FXAA_EDGE_THRESHOLD))\n{\nreturn rgbM;\n}\nvec3 rgbL = rgbN + rgbW + rgbM + rgbE + rgbS;\nfloat lumaL = (lumaN + lumaW + lumaE + lumaS) * 0.25;\nfloat rangeL = abs(lumaL - lumaM);\nfloat blendL = max(0.0, (rangeL / range) - FXAA_SUBPIX_TRIM) * FXAA_SUBPIX_TRIM_SCALE;\nblendL = min(FXAA_SUBPIX_CAP, blendL);\nvec3 rgbNW = FxaaTexOff(tex, pos.xy, ivec2(-1,-1), rcpFrame).xyz;\nvec3 rgbNE = FxaaTexOff(tex, pos.xy, ivec2( 1,-1), rcpFrame).xyz;\nvec3 rgbSW = FxaaTexOff(tex, pos.xy, ivec2(-1, 1), rcpFrame).xyz;\nvec3 rgbSE = FxaaTexOff(tex, pos.xy, ivec2( 1, 1), rcpFrame).xyz;\nrgbL += (rgbNW + rgbNE + rgbSW + rgbSE);\nrgbL *= vec3(1.0/9.0);\nfloat lumaNW = FxaaLuma(rgbNW);\nfloat lumaNE = FxaaLuma(rgbNE);\nfloat lumaSW = FxaaLuma(rgbSW);\nfloat lumaSE = FxaaLuma(rgbSE);\nfloat edgeVert =\nabs((0.25 * lumaNW) + (-0.5 * lumaN) + (0.25 * lumaNE)) +\nabs((0.50 * lumaW ) + (-1.0 * lumaM) + (0.50 * lumaE )) +\nabs((0.25 * lumaSW) + (-0.5 * lumaS) + (0.25 * lumaSE));\nfloat edgeHorz =\nabs((0.25 * lumaNW) + (-0.5 * lumaW) + (0.25 * lumaSW)) +\nabs((0.50 * lumaN ) + (-1.0 * lumaM) + (0.50 * lumaS )) +\nabs((0.25 * lumaNE) + (-0.5 * lumaE) + (0.25 * lumaSE));\nbool horzSpan = edgeHorz >= edgeVert;\nfloat lengthSign = horzSpan ? -rcpFrame.y : -rcpFrame.x;\nif(!horzSpan)\n{\nlumaN = lumaW;\nlumaS = lumaE;\n}\nfloat gradientN = abs(lumaN - lumaM);\nfloat gradientS = abs(lumaS - lumaM);\nlumaN = (lumaN + lumaM) * 0.5;\nlumaS = (lumaS + lumaM) * 0.5;\nif (gradientN < gradientS)\n{\nlumaN = lumaS;\nlumaN = lumaS;\ngradientN = gradientS;\nlengthSign *= -1.0;\n}\nvec2 posN;\nposN.x = pos.x + (horzSpan ? 0.0 : lengthSign * 0.5);\nposN.y = pos.y + (horzSpan ? lengthSign * 0.5 : 0.0);\ngradientN *= FXAA_SEARCH_THRESHOLD;\nvec2 posP = posN;\nvec2 offNP = horzSpan ? vec2(rcpFrame.x, 0.0) : vec2(0.0, rcpFrame.y);\nfloat lumaEndN = lumaN;\nfloat lumaEndP = lumaN;\nbool doneN = false;\nbool doneP = false;\nposN += offNP * vec2(-1.0, -1.0);\nposP += offNP * vec2( 1.0, 1.0);\nfor(int i = 0; i < FXAA_SEARCH_STEPS; i++) {\nif(!doneN)\n{\nlumaEndN = FxaaLuma(texture2D(tex, posN.xy).xyz);\n}\nif(!doneP)\n{\nlumaEndP = FxaaLuma(texture2D(tex, posP.xy).xyz);\n}\ndoneN = doneN || (abs(lumaEndN - lumaN) >= gradientN);\ndoneP = doneP || (abs(lumaEndP - lumaN) >= gradientN);\nif(doneN && doneP)\n{\nbreak;\n}\nif(!doneN)\n{\nposN -= offNP;\n}\nif(!doneP)\n{\nposP += offNP;\n}\n}\nfloat dstN = horzSpan ? pos.x - posN.x : pos.y - posN.y;\nfloat dstP = horzSpan ? posP.x - pos.x : posP.y - pos.y;\nbool directionN = dstN < dstP;\nlumaEndN = directionN ? lumaEndN : lumaEndP;\nif(((lumaM - lumaN) < 0.0) == ((lumaEndN - lumaN) < 0.0))\n{\nlengthSign = 0.0;\n}\nfloat spanLength = (dstP + dstN);\ndstN = directionN ? dstN : dstP;\nfloat subPixelOffset = (0.5 + (dstN * (-1.0/spanLength))) * lengthSign;\nvec3 rgbF = texture2D(tex, vec2(\npos.x + (horzSpan ? 0.0 : subPixelOffset),\npos.y + (horzSpan ? subPixelOffset : 0.0))).xyz;\nreturn FxaaLerp3(rgbL, rgbF, blendL);\n}\nuniform sampler2D u_texture;\nuniform vec2 u_step;\nvarying vec2 v_textureCoordinates;\nvoid main()\n{\ngl_FragColor = vec4(FxaaPixelShader(v_textureCoordinates, u_texture, u_step), 1.0);\n}\n"}),i("Scene/FXAA",["../Core/BoundingRectangle","../Core/Cartesian2","../Core/Color","../Core/defined","../Core/destroyObject","../Core/PixelFormat","../Renderer/ClearCommand","../Renderer/Framebuffer","../Renderer/PixelDatatype","../Renderer/Renderbuffer","../Renderer/RenderbufferFormat","../Renderer/RenderState","../Renderer/Texture","../Shaders/PostProcessFilters/FXAA"],function(e,t,i,r,n,o,a,s,l,u,c,h,d,p){"use strict";function m(t){this._texture=void 0,this._depthTexture=void 0,this._depthRenderbuffer=void 0,this._fbo=void 0,this._command=void 0,this._viewport=new e,this._rs=void 0;var r=new a({color:new i(0,0,0,0),depth:1,owner:this});this._clearCommand=r}function f(e){e._fbo=e._fbo&&e._fbo.destroy(),e._texture=e._texture&&e._texture.destroy(),e._depthTexture=e._depthTexture&&e._depthTexture.destroy(),e._depthRenderbuffer=e._depthRenderbuffer&&e._depthRenderbuffer.destroy(),e._fbo=void 0,e._texture=void 0,e._depthTexture=void 0,e._depthRenderbuffer=void 0,r(e._command)&&(e._command.shaderProgram=e._command.shaderProgram&&e._command.shaderProgram.destroy(),e._command=void 0)}return m.prototype.update=function(i){var n=i.drawingBufferWidth,a=i.drawingBufferHeight,m=this._texture,f=!r(m)||m.width!==n||m.height!==a;if(f&&(this._texture=this._texture&&this._texture.destroy(),this._depthTexture=this._depthTexture&&this._depthTexture.destroy(),this._depthRenderbuffer=this._depthRenderbuffer&&this._depthRenderbuffer.destroy(),this._texture=new d({context:i,width:n,height:a,pixelFormat:o.RGBA,pixelDatatype:l.UNSIGNED_BYTE}),i.depthTexture?this._depthTexture=new d({context:i,width:n,height:a,pixelFormat:o.DEPTH_COMPONENT,pixelDatatype:l.UNSIGNED_SHORT}):this._depthRenderbuffer=new u({context:i,width:n,height:a,format:c.DEPTH_COMPONENT16})),(!r(this._fbo)||f)&&(this._fbo=this._fbo&&this._fbo.destroy(),this._fbo=new s({context:i,colorTextures:[this._texture],depthTexture:this._depthTexture,depthRenderbuffer:this._depthRenderbuffer,destroyAttachments:!1})),r(this._command)||(this._command=i.createViewportQuadCommand(p,{owner:this})),this._viewport.width=n,this._viewport.height=a,r(this._rs)&&e.equals(this._rs.viewport,this._viewport)||(this._rs=h.fromCache({viewport:this._viewport})),this._command.renderState=this._rs,f){var v=this,g=new t(1/this._texture.width,1/this._texture.height);this._command.uniformMap={u_texture:function(){return v._texture},u_step:function(){return g}}}},m.prototype.execute=function(e,t){this._command.execute(e,t)},m.prototype.clear=function(e,t,r){var n=t.framebuffer;t.framebuffer=this._fbo,i.clone(r,this._clearCommand.color),this._clearCommand.execute(e,t),t.framebuffer=n},m.prototype.getColorFramebuffer=function(){return this._fbo},m.prototype.isDestroyed=function(){return!1},m.prototype.destroy=function(){return f(this),n(this)},m}),i("Scene/GetFeatureInfoFormat",["../Core/Cartographic","../Core/defaultValue","../Core/defined","../Core/definedNotNull","../Core/DeveloperError","../Core/RuntimeError","./ImageryLayerFeatureInfo"],function(e,t,i,r,n,o,a){"use strict";function s(e,t,r){this.type=e,i(t)||("json"===e?t="application/json":"xml"===e?t="text/xml":"html"===e?t="text/html":"text"===e&&(t="text/plain")),this.format=t,i(r)||("json"===e?r=l:"xml"===e?r=u:"html"===e?r=g:"text"===e&&(r=g)),this.callback=r}function l(t){for(var i=[],n=t.features,o=0;o0)for(var o=0;o1&&(t=i[1]);var r=new a;return r.name=t,r.description=e,r.data=e,[r]}}var _="http://www.mapinfo.com/mxp",y="http://www.esri.com/wms",C="http://www.opengis.net/wfs",E="http://www.opengis.net/gml",S=/\s*<\/body>/im,w=//im,T=/([\s\S]*)<\/title>/im;return s}),i("Shaders/GlobeFS",[],function(){"use strict";return"uniform vec4 u_initialColor;\n#if TEXTURE_UNITS > 0\nuniform sampler2D u_dayTextures[TEXTURE_UNITS];\nuniform vec4 u_dayTextureTranslationAndScale[TEXTURE_UNITS];\n#ifdef APPLY_ALPHA\nuniform float u_dayTextureAlpha[TEXTURE_UNITS];\n#endif\n#ifdef APPLY_BRIGHTNESS\nuniform float u_dayTextureBrightness[TEXTURE_UNITS];\n#endif\n#ifdef APPLY_CONTRAST\nuniform float u_dayTextureContrast[TEXTURE_UNITS];\n#endif\n#ifdef APPLY_HUE\nuniform float u_dayTextureHue[TEXTURE_UNITS];\n#endif\n#ifdef APPLY_SATURATION\nuniform float u_dayTextureSaturation[TEXTURE_UNITS];\n#endif\n#ifdef APPLY_GAMMA\nuniform float u_dayTextureOneOverGamma[TEXTURE_UNITS];\n#endif\nuniform vec4 u_dayTextureTexCoordsRectangle[TEXTURE_UNITS];\n#endif\n#ifdef SHOW_REFLECTIVE_OCEAN\nuniform sampler2D u_waterMask;\nuniform vec4 u_waterMaskTranslationAndScale;\nuniform float u_zoomedOutOceanSpecularIntensity;\n#endif\n#ifdef SHOW_OCEAN_WAVES\nuniform sampler2D u_oceanNormalMap;\n#endif\n#ifdef ENABLE_DAYNIGHT_SHADING\nuniform vec2 u_lightingFadeDistance;\n#endif\nvarying vec3 v_positionMC;\nvarying vec3 v_positionEC;\nvarying vec2 v_textureCoordinates;\nvarying vec3 v_normalMC;\nvarying vec3 v_normalEC;\n#ifdef FOG\nvarying float v_distance;\nvarying vec3 v_rayleighColor;\nvarying vec3 v_mieColor;\n#endif\nvec4 sampleAndBlend(\nvec4 previousColor,\nsampler2D texture,\nvec2 tileTextureCoordinates,\nvec4 textureCoordinateRectangle,\nvec4 textureCoordinateTranslationAndScale,\nfloat textureAlpha,\nfloat textureBrightness,\nfloat textureContrast,\nfloat textureHue,\nfloat textureSaturation,\nfloat textureOneOverGamma)\n{\nvec2 alphaMultiplier = step(textureCoordinateRectangle.st, tileTextureCoordinates);\ntextureAlpha = textureAlpha * alphaMultiplier.x * alphaMultiplier.y;\nalphaMultiplier = step(vec2(0.0), textureCoordinateRectangle.pq - tileTextureCoordinates);\ntextureAlpha = textureAlpha * alphaMultiplier.x * alphaMultiplier.y;\nvec2 translation = textureCoordinateTranslationAndScale.xy;\nvec2 scale = textureCoordinateTranslationAndScale.zw;\nvec2 textureCoordinates = tileTextureCoordinates * scale + translation;\nvec4 value = texture2D(texture, textureCoordinates);\nvec3 color = value.rgb;\nfloat alpha = value.a;\n#ifdef APPLY_BRIGHTNESS\ncolor = mix(vec3(0.0), color, textureBrightness);\n#endif\n#ifdef APPLY_CONTRAST\ncolor = mix(vec3(0.5), color, textureContrast);\n#endif\n#ifdef APPLY_HUE\ncolor = czm_hue(color, textureHue);\n#endif\n#ifdef APPLY_SATURATION\ncolor = czm_saturation(color, textureSaturation);\n#endif\n#ifdef APPLY_GAMMA\ncolor = pow(color, vec3(textureOneOverGamma));\n#endif\nfloat sourceAlpha = alpha * textureAlpha;\nfloat outAlpha = mix(previousColor.a, 1.0, sourceAlpha);\nvec3 outColor = mix(previousColor.rgb * previousColor.a, color, sourceAlpha) / outAlpha;\nreturn vec4(outColor, outAlpha);\n}\nvec4 computeDayColor(vec4 initialColor, vec2 textureCoordinates);\nvec4 computeWaterColor(vec3 positionEyeCoordinates, vec2 textureCoordinates, mat3 enuToEye, vec4 imageryColor, float specularMapValue);\nvoid main()\n{\nvec4 color = computeDayColor(u_initialColor, clamp(v_textureCoordinates, 0.0, 1.0));\n#ifdef SHOW_TILE_BOUNDARIES\nif (v_textureCoordinates.x < (1.0/256.0) || v_textureCoordinates.x > (255.0/256.0) ||\nv_textureCoordinates.y < (1.0/256.0) || v_textureCoordinates.y > (255.0/256.0))\n{\ncolor = vec4(1.0, 0.0, 0.0, 1.0);\n}\n#endif\n#if defined(SHOW_REFLECTIVE_OCEAN) || defined(ENABLE_DAYNIGHT_SHADING)\nvec3 normalMC = normalize(czm_geodeticSurfaceNormal(v_positionMC, vec3(0.0), vec3(1.0)));\nvec3 normalEC = normalize(czm_normal3D * normalMC);\n#endif\n#ifdef SHOW_REFLECTIVE_OCEAN\nvec2 waterMaskTranslation = u_waterMaskTranslationAndScale.xy;\nvec2 waterMaskScale = u_waterMaskTranslationAndScale.zw;\nvec2 waterMaskTextureCoordinates = v_textureCoordinates * waterMaskScale + waterMaskTranslation;\nfloat mask = texture2D(u_waterMask, waterMaskTextureCoordinates).r;\nif (mask > 0.0)\n{\nmat3 enuToEye = czm_eastNorthUpToEyeCoordinates(v_positionMC, normalEC);\nvec2 ellipsoidTextureCoordinates = czm_ellipsoidWgs84TextureCoordinates(normalMC);\nvec2 ellipsoidFlippedTextureCoordinates = czm_ellipsoidWgs84TextureCoordinates(normalMC.zyx);\nvec2 textureCoordinates = mix(ellipsoidTextureCoordinates, ellipsoidFlippedTextureCoordinates, czm_morphTime * smoothstep(0.9, 0.95, normalMC.z));\ncolor = computeWaterColor(v_positionEC, textureCoordinates, enuToEye, color, mask);\n}\n#endif\n#ifdef ENABLE_VERTEX_LIGHTING\nfloat diffuseIntensity = clamp(czm_getLambertDiffuse(czm_sunDirectionEC, normalize(v_normalEC)) * 0.9 + 0.3, 0.0, 1.0);\nvec4 finalColor = vec4(color.rgb * diffuseIntensity, color.a);\n#elif defined(ENABLE_DAYNIGHT_SHADING)\nfloat diffuseIntensity = clamp(czm_getLambertDiffuse(czm_sunDirectionEC, normalEC) * 5.0 + 0.3, 0.0, 1.0);\nfloat cameraDist = length(czm_view[3]);\nfloat fadeOutDist = u_lightingFadeDistance.x;\nfloat fadeInDist = u_lightingFadeDistance.y;\nfloat t = clamp((cameraDist - fadeOutDist) / (fadeInDist - fadeOutDist), 0.0, 1.0);\ndiffuseIntensity = mix(1.0, diffuseIntensity, t);\nvec4 finalColor = vec4(color.rgb * diffuseIntensity, color.a);\n#else\nvec4 finalColor = color;\n#endif\n#ifdef FOG\nconst float fExposure = 2.0;\nvec3 fogColor = v_mieColor + finalColor.rgb * v_rayleighColor;\nfogColor = vec3(1.0) - exp(-fExposure * fogColor);\ngl_FragColor = vec4(czm_fog(v_distance, finalColor.rgb, fogColor), finalColor.a);\n#else\ngl_FragColor = finalColor;\n#endif\n}\n#ifdef SHOW_REFLECTIVE_OCEAN\nfloat waveFade(float edge0, float edge1, float x)\n{\nfloat y = clamp((x - edge0) / (edge1 - edge0), 0.0, 1.0);\nreturn pow(1.0 - y, 5.0);\n}\nfloat linearFade(float edge0, float edge1, float x)\n{\nreturn clamp((x - edge0) / (edge1 - edge0), 0.0, 1.0);\n}\nconst float oceanFrequencyLowAltitude = 825000.0;\nconst float oceanAnimationSpeedLowAltitude = 0.004;\nconst float oceanOneOverAmplitudeLowAltitude = 1.0 / 2.0;\nconst float oceanSpecularIntensity = 0.5;\nconst float oceanFrequencyHighAltitude = 125000.0;\nconst float oceanAnimationSpeedHighAltitude = 0.008;\nconst float oceanOneOverAmplitudeHighAltitude = 1.0 / 2.0;\nvec4 computeWaterColor(vec3 positionEyeCoordinates, vec2 textureCoordinates, mat3 enuToEye, vec4 imageryColor, float maskValue)\n{\nvec3 positionToEyeEC = -positionEyeCoordinates;\nfloat positionToEyeECLength = length(positionToEyeEC);\nvec3 normalizedpositionToEyeEC = normalize(normalize(positionToEyeEC));\nfloat waveIntensity = waveFade(70000.0, 1000000.0, positionToEyeECLength);\n#ifdef SHOW_OCEAN_WAVES\nfloat time = czm_frameNumber * oceanAnimationSpeedHighAltitude;\nvec4 noise = czm_getWaterNoise(u_oceanNormalMap, textureCoordinates * oceanFrequencyHighAltitude, time, 0.0);\nvec3 normalTangentSpaceHighAltitude = vec3(noise.xy, noise.z * oceanOneOverAmplitudeHighAltitude);\ntime = czm_frameNumber * oceanAnimationSpeedLowAltitude;\nnoise = czm_getWaterNoise(u_oceanNormalMap, textureCoordinates * oceanFrequencyLowAltitude, time, 0.0);\nvec3 normalTangentSpaceLowAltitude = vec3(noise.xy, noise.z * oceanOneOverAmplitudeLowAltitude);\nfloat highAltitudeFade = linearFade(0.0, 60000.0, positionToEyeECLength);\nfloat lowAltitudeFade = 1.0 - linearFade(20000.0, 60000.0, positionToEyeECLength);\nvec3 normalTangentSpace =\n(highAltitudeFade * normalTangentSpaceHighAltitude) +\n(lowAltitudeFade * normalTangentSpaceLowAltitude);\nnormalTangentSpace = normalize(normalTangentSpace);\nnormalTangentSpace.xy *= waveIntensity;\nnormalTangentSpace = normalize(normalTangentSpace);\n#else\nvec3 normalTangentSpace = vec3(0.0, 0.0, 1.0);\n#endif\nvec3 normalEC = enuToEye * normalTangentSpace;\nconst vec3 waveHighlightColor = vec3(0.3, 0.45, 0.6);\nfloat diffuseIntensity = czm_getLambertDiffuse(czm_sunDirectionEC, normalEC) * maskValue;\nvec3 diffuseHighlight = waveHighlightColor * diffuseIntensity;\n#ifdef SHOW_OCEAN_WAVES\nfloat tsPerturbationRatio = normalTangentSpace.z;\nvec3 nonDiffuseHighlight = mix(waveHighlightColor * 5.0 * (1.0 - tsPerturbationRatio), vec3(0.0), diffuseIntensity);\n#else\nvec3 nonDiffuseHighlight = vec3(0.0);\n#endif\nfloat specularIntensity = czm_getSpecular(czm_sunDirectionEC, normalizedpositionToEyeEC, normalEC, 10.0) + 0.25 * czm_getSpecular(czm_moonDirectionEC, normalizedpositionToEyeEC, normalEC, 10.0);\nfloat surfaceReflectance = mix(0.0, mix(u_zoomedOutOceanSpecularIntensity, oceanSpecularIntensity, waveIntensity), maskValue);\nfloat specular = specularIntensity * surfaceReflectance;\nreturn vec4(imageryColor.rgb + diffuseHighlight + nonDiffuseHighlight + specular, imageryColor.a);\n}\n#endif\n"}),i("Shaders/GlobeVS",[],function(){"use strict";return"#ifdef QUANTIZATION_BITS12\nattribute vec4 compressed;\n#else\nattribute vec4 position3DAndHeight;\nattribute vec3 textureCoordAndEncodedNormals;\n#endif\nuniform vec3 u_center3D;\nuniform mat4 u_modifiedModelView;\nuniform vec4 u_tileRectangle;\nuniform vec2 u_southAndNorthLatitude;\nuniform vec2 u_southMercatorYAndOneOverHeight;\nvarying vec3 v_positionMC;\nvarying vec3 v_positionEC;\nvarying vec2 v_textureCoordinates;\nvarying vec3 v_normalMC;\nvarying vec3 v_normalEC;\n#ifdef FOG\nvarying float v_distance;\nvarying vec3 v_mieColor;\nvarying vec3 v_rayleighColor;\n#endif\nvec4 getPosition(vec3 position, float height, vec2 textureCoordinates);\nfloat get2DYPositionFraction(vec2 textureCoordinates);\nvec4 getPosition3DMode(vec3 position, float height, vec2 textureCoordinates)\n{\nreturn czm_projection * (u_modifiedModelView * vec4(position, 1.0));\n}\nfloat get2DMercatorYPositionFraction(vec2 textureCoordinates)\n{\nconst float maxTileWidth = 0.003068;\nfloat positionFraction = textureCoordinates.y;\nfloat southLatitude = u_southAndNorthLatitude.x;\nfloat northLatitude = u_southAndNorthLatitude.y;\nif (northLatitude - southLatitude > maxTileWidth)\n{\nfloat southMercatorY = u_southMercatorYAndOneOverHeight.x;\nfloat oneOverMercatorHeight = u_southMercatorYAndOneOverHeight.y;\nfloat currentLatitude = mix(southLatitude, northLatitude, textureCoordinates.y);\ncurrentLatitude = clamp(currentLatitude, -czm_webMercatorMaxLatitude, czm_webMercatorMaxLatitude);\npositionFraction = czm_latitudeToWebMercatorFraction(currentLatitude, southMercatorY, oneOverMercatorHeight);\n}\nreturn positionFraction;\n}\nfloat get2DGeographicYPositionFraction(vec2 textureCoordinates)\n{\nreturn textureCoordinates.y;\n}\nvec4 getPositionPlanarEarth(vec3 position, float height, vec2 textureCoordinates)\n{\nfloat yPositionFraction = get2DYPositionFraction(textureCoordinates);\nvec4 rtcPosition2D = vec4(height, mix(u_tileRectangle.st, u_tileRectangle.pq, vec2(textureCoordinates.x, yPositionFraction)), 1.0);\nreturn czm_projection * (u_modifiedModelView * rtcPosition2D);\n}\nvec4 getPosition2DMode(vec3 position, float height, vec2 textureCoordinates)\n{\nreturn getPositionPlanarEarth(position, 0.0, textureCoordinates);\n}\nvec4 getPositionColumbusViewMode(vec3 position, float height, vec2 textureCoordinates)\n{\nreturn getPositionPlanarEarth(position, height, textureCoordinates);\n}\nvec4 getPositionMorphingMode(vec3 position, float height, vec2 textureCoordinates)\n{\nvec3 position3DWC = position + u_center3D;\nfloat yPositionFraction = get2DYPositionFraction(textureCoordinates);\nvec4 position2DWC = vec4(0.0, mix(u_tileRectangle.st, u_tileRectangle.pq, vec2(textureCoordinates.x, yPositionFraction)), 1.0);\nvec4 morphPosition = czm_columbusViewMorph(position2DWC, vec4(position3DWC, 1.0), czm_morphTime);\nreturn czm_modelViewProjection * morphPosition;\n}\n#ifdef QUANTIZATION_BITS12\nuniform vec2 u_minMaxHeight;\nuniform mat4 u_scaleAndBias;\n#endif\nvoid main()\n{\n#ifdef QUANTIZATION_BITS12\nvec2 xy = czm_decompressTextureCoordinates(compressed.x);\nvec2 zh = czm_decompressTextureCoordinates(compressed.y);\nvec3 position = vec3(xy, zh.x);\nfloat height = zh.y;\nvec2 textureCoordinates = czm_decompressTextureCoordinates(compressed.z);\nfloat encodedNormal = compressed.w;\nheight = height * (u_minMaxHeight.y - u_minMaxHeight.x) + u_minMaxHeight.x;\nposition = (u_scaleAndBias * vec4(position, 1.0)).xyz;\n#else\nvec3 position = position3DAndHeight.xyz;\nfloat height = position3DAndHeight.w;\nvec2 textureCoordinates = textureCoordAndEncodedNormals.xy;\nfloat encodedNormal = textureCoordAndEncodedNormals.z;\n#endif\nvec3 position3DWC = position + u_center3D;\ngl_Position = getPosition(position, height, textureCoordinates);\nv_textureCoordinates = textureCoordinates;\n#if defined(ENABLE_VERTEX_LIGHTING)\nv_positionEC = (czm_modelView3D * vec4(position3DWC, 1.0)).xyz;\nv_positionMC = position3DWC;\nv_normalMC = czm_octDecode(encodedNormal);\nv_normalEC = czm_normal3D * v_normalMC;\n#elif defined(SHOW_REFLECTIVE_OCEAN) || defined(ENABLE_DAYNIGHT_SHADING)\nv_positionEC = (czm_modelView3D * vec4(position3DWC, 1.0)).xyz;\nv_positionMC = position3DWC;\n#endif\n#ifdef FOG\nAtmosphereColor atmosColor = computeGroundAtmosphereFromSpace(position3DWC);\nv_mieColor = atmosColor.mie;\nv_rayleighColor = atmosColor.rayleigh;\nv_distance = length((czm_modelView3D * vec4(position3DWC, 1.0)).xyz);\n#endif\n}\n"}),i("Shaders/GroundAtmosphere",[],function(){"use strict";return"const float fInnerRadius = 6378137.0;\nconst float fOuterRadius = 6378137.0 * 1.025;\nconst float fOuterRadius2 = fOuterRadius * fOuterRadius;\nconst float Kr = 0.0025;\nconst float Km = 0.0015;\nconst float ESun = 15.0;\nconst float fKrESun = Kr * ESun;\nconst float fKmESun = Km * ESun;\nconst float fKr4PI = Kr * 4.0 * czm_pi;\nconst float fKm4PI = Km * 4.0 * czm_pi;\nconst float fScale = 1.0 / (fOuterRadius - fInnerRadius);\nconst float fScaleDepth = 0.25;\nconst float fScaleOverScaleDepth = fScale / fScaleDepth;\nstruct AtmosphereColor\n{\nvec3 mie;\nvec3 rayleigh;\n};\nconst int nSamples = 2;\nconst float fSamples = 2.0;\nfloat scale(float fCos)\n{\nfloat x = 1.0 - fCos;\nreturn fScaleDepth * exp(-0.00287 + x*(0.459 + x*(3.83 + x*(-6.80 + x*5.25))));\n}\nAtmosphereColor computeGroundAtmosphereFromSpace(vec3 v3Pos)\n{\nvec3 v3InvWavelength = vec3(1.0 / pow(0.650, 4.0), 1.0 / pow(0.570, 4.0), 1.0 / pow(0.475, 4.0));\nvec3 v3Ray = v3Pos - czm_viewerPositionWC;\nfloat fFar = length(v3Ray);\nv3Ray /= fFar;\nfloat fCameraHeight = length(czm_viewerPositionWC);\nfloat fCameraHeight2 = fCameraHeight * fCameraHeight;\nfloat B = 2.0 * length(czm_viewerPositionWC) * dot(normalize(czm_viewerPositionWC), v3Ray);\nfloat C = fCameraHeight2 - fOuterRadius2;\nfloat fDet = max(0.0, B*B - 4.0 * C);\nfloat fNear = 0.5 * (-B - sqrt(fDet));\nvec3 v3Start = czm_viewerPositionWC + v3Ray * fNear;\nfFar -= fNear;\nfloat fDepth = exp((fInnerRadius - fOuterRadius) / fScaleDepth);\nfloat fLightAngle = 1.0;\nfloat fCameraAngle = dot(-v3Ray, v3Pos) / length(v3Pos);\nfloat fCameraScale = scale(fCameraAngle);\nfloat fLightScale = scale(fLightAngle);\nfloat fCameraOffset = fDepth*fCameraScale;\nfloat fTemp = (fLightScale + fCameraScale);\nfloat fSampleLength = fFar / fSamples;\nfloat fScaledLength = fSampleLength * fScale;\nvec3 v3SampleRay = v3Ray * fSampleLength;\nvec3 v3SamplePoint = v3Start + v3SampleRay * 0.5;\nvec3 v3FrontColor = vec3(0.0);\nvec3 v3Attenuate = vec3(0.0);\nfor(int i=0; i<nSamples; i++)\n{\nfloat fHeight = length(v3SamplePoint);\nfloat fDepth = exp(fScaleOverScaleDepth * (fInnerRadius - fHeight));\nfloat fScatter = fDepth*fTemp - fCameraOffset;\nv3Attenuate = exp(-fScatter * (v3InvWavelength * fKr4PI + fKm4PI));\nv3FrontColor += v3Attenuate * (fDepth * fScaledLength);\nv3SamplePoint += v3SampleRay;\n}\nAtmosphereColor color;\ncolor.mie = v3FrontColor * (v3InvWavelength * fKrESun + fKmESun);\ncolor.rayleigh = v3Attenuate;\nreturn color;\n}\n"}),i("Scene/GlobeSurfaceShaderSet",["../Core/defined","../Core/destroyObject","../Core/TerrainQuantization","../Renderer/ShaderProgram","../Scene/SceneMode"],function(e,t,i,r,n){"use strict";function o(e,t,i){this.numberOfDayTextures=e,this.flags=t,this.shaderProgram=i}function a(){this.baseVertexShaderSource=void 0,this.baseFragmentShaderSource=void 0,this._shadersByTexturesFlags=[],this._pickShaderPrograms=[]}function s(e){var t,i="vec4 getPosition(vec3 position, float height, vec2 textureCoordinates) { return getPosition3DMode(position, height, textureCoordinates); }",r="vec4 getPosition(vec3 position, float height, vec2 textureCoordinates) { return getPosition2DMode(position, height, textureCoordinates); }",o="vec4 getPosition(vec3 position, float height, vec2 textureCoordinates) { return getPositionColumbusViewMode(position, height, textureCoordinates); }",a="vec4 getPosition(vec3 position, float height, vec2 textureCoordinates) { return getPositionMorphingMode(position, height, textureCoordinates); }";switch(e){case n.SCENE3D:t=i;break;case n.SCENE2D:t=r; -break;case n.COLUMBUS_VIEW:t=o;break;case n.MORPHING:t=a}return t}function l(e){var t="float get2DYPositionFraction(vec2 textureCoordinates) { return get2DGeographicYPositionFraction(textureCoordinates); }",i="float get2DYPositionFraction(vec2 textureCoordinates) { return get2DMercatorYPositionFraction(textureCoordinates); }";return e?i:t}return a.prototype.getShaderProgram=function(t,n,a,u,c,h,d,p,m,f,v,g,_,y,C){var E=0,S="",w=n.pickTerrain.mesh.encoding,T=w.quantization;T===i.BITS12&&(E=1,S="QUANTIZATION_BITS12");var x=t.mode,b=x|u<<2|c<<3|h<<4|d<<5|p<<6|m<<7|f<<8|v<<9|g<<10|_<<11|y<<12|C<<13|E<<14,A=n.surfaceShader;if(e(A)&&A.numberOfDayTextures===a&&A.flags===b)return A.shaderProgram;var P=this._shadersByTexturesFlags[a];if(e(P)||(P=this._shadersByTexturesFlags[a]=[]),A=P[b],!e(A)){var I=this.baseVertexShaderSource.clone(),M=this.baseFragmentShaderSource.clone();I.defines.push(S),M.defines.push("TEXTURE_UNITS "+a),u&&M.defines.push("APPLY_BRIGHTNESS"),c&&M.defines.push("APPLY_CONTRAST"),h&&M.defines.push("APPLY_HUE"),d&&M.defines.push("APPLY_SATURATION"),p&&M.defines.push("APPLY_GAMMA"),m&&M.defines.push("APPLY_ALPHA"),f&&(M.defines.push("SHOW_REFLECTIVE_OCEAN"),I.defines.push("SHOW_REFLECTIVE_OCEAN")),v&&M.defines.push("SHOW_OCEAN_WAVES"),g&&(_?(I.defines.push("ENABLE_VERTEX_LIGHTING"),M.defines.push("ENABLE_VERTEX_LIGHTING")):(I.defines.push("ENABLE_DAYNIGHT_SHADING"),M.defines.push("ENABLE_DAYNIGHT_SHADING"))),C&&(I.defines.push("FOG"),M.defines.push("FOG"));for(var D=" vec4 computeDayColor(vec4 initialColor, vec2 textureCoordinates)\n {\n vec4 color = initialColor;\n",R=0;a>R;++R)D+=" color = sampleAndBlend(\n color,\n u_dayTextures["+R+"],\n textureCoordinates,\n u_dayTextureTexCoordsRectangle["+R+"],\n u_dayTextureTranslationAndScale["+R+"],\n "+(m?"u_dayTextureAlpha["+R+"]":"1.0")+",\n "+(u?"u_dayTextureBrightness["+R+"]":"0.0")+",\n "+(c?"u_dayTextureContrast["+R+"]":"0.0")+",\n "+(h?"u_dayTextureHue["+R+"]":"0.0")+",\n "+(d?"u_dayTextureSaturation["+R+"]":"0.0")+",\n "+(p?"u_dayTextureOneOverGamma["+R+"]":"0.0")+"\n );\n";D+=" return color;\n }",M.sources.push(D),I.sources.push(s(x)),I.sources.push(l(y));var O=r.fromCache({context:t.context,vertexShaderSource:I,fragmentShaderSource:M,attributeLocations:w.getAttributeLocations()});A=P[b]=new o(a,b,O)}return n.surfaceShader=A,A.shaderProgram},a.prototype.getPickShaderProgram=function(t,n,o){var a=0,u="",c=n.pickTerrain.mesh.encoding,h=c.quantization;h===i.BITS12&&(a=1,u="QUANTIZATION_BITS12");var d=t.mode,p=d|o<<2|a<<3,m=this._pickShaderPrograms[p];if(!e(m)){var f=this.baseVertexShaderSource.clone();f.defines.push(u),f.sources.push(s(d)),f.sources.push(l(o));var v="void main()\n{\n gl_FragColor = vec4(1.0, 1.0, 0.0, 1.0);\n}\n";m=this._pickShaderPrograms[p]=r.fromCache({context:t.context,vertexShaderSource:f,fragmentShaderSource:v,attributeLocations:c.getAttributeLocations()})}return m},a.prototype.destroy=function(){var i=this._shadersByTexturesFlags;for(var r in i)if(i.hasOwnProperty(r)){var n=i[r];if(!e(n))continue;for(var o in n)if(n.hasOwnProperty(o)){var a=n[o];e(a)&&a.shaderProgram.destroy()}}return t(this)},a}),i("Scene/ImageryState",["../Core/freezeObject"],function(e){"use strict";var t={UNLOADED:0,TRANSITIONING:1,RECEIVED:2,TEXTURE_LOADED:3,READY:4,FAILED:5,INVALID:6,PLACEHOLDER:7};return e(t)}),i("Scene/QuadtreeTileLoadState",["../Core/freezeObject"],function(e){"use strict";var t={START:0,LOADING:1,DONE:2,FAILED:3};return e(t)}),i("Scene/TerrainState",["../Core/freezeObject"],function(e){"use strict";var t={FAILED:0,UNLOADED:1,RECEIVING:2,RECEIVED:3,TRANSFORMING:4,TRANSFORMED:5,READY:6};return e(t)}),i("Scene/TileBoundingBox",["../Core/Cartesian3","../Core/Cartographic","../Core/defaultValue","../Core/defined","../Core/DeveloperError","../Core/Ellipsoid","../Core/Rectangle","./SceneMode"],function(e,t,i,r,n,o,a,s){"use strict";function l(t,i,r){r.cartographicToCartesian(a.southwest(i),t.southwestCornerCartesian),r.cartographicToCartesian(a.northeast(i),t.northeastCornerCartesian),m.longitude=i.west,m.latitude=.5*(i.south+i.north),m.height=0;var n=r.cartographicToCartesian(m,d),o=e.cross(n,e.UNIT_Z,c);e.normalize(o,t.westNormal),m.longitude=i.east;var s=r.cartographicToCartesian(m,p),l=e.cross(e.UNIT_Z,s,c);e.normalize(l,t.eastNormal);var u=r.geodeticSurfaceNormalCartographic(a.southeast(i),h),f=e.subtract(n,s,c),v=e.cross(u,f,h);e.normalize(v,t.southNormal);var g=r.geodeticSurfaceNormalCartographic(a.northwest(i),h),_=e.cross(f,g,h);e.normalize(_,t.northNormal)}var u=function(t){t=i(t,i.EMPTY_OBJECT),this.rectangle=a.clone(t.rectangle),this.minimumHeight=i(t.minimumHeight,0),this.maximumHeight=i(t.maximumHeight,0),this.southwestCornerCartesian=new e,this.northeastCornerCartesian=new e,this.westNormal=new e,this.southNormal=new e,this.eastNormal=new e,this.northNormal=new e;var r=i(t.ellipsoid,o.WGS84);l(this,t.rectangle,r)},c=new e,h=new e,d=new e,p=new e,m=new t,f=new e,v=new e,g=new e(0,-1,0),_=new e(0,0,-1),y=new e;return u.prototype.distanceToCamera=function(t){var i=t.camera,r=i.positionWC,n=i.positionCartographic,o=0;if(!a.contains(this.rectangle,n)){var l=this.southwestCornerCartesian,u=this.northeastCornerCartesian,c=this.westNormal,h=this.southNormal,d=this.eastNormal,p=this.northNormal;t.mode!==s.SCENE3D&&(l=t.mapProjection.project(a.southwest(this.rectangle),f),l.z=l.y,l.y=l.x,l.x=0,u=t.mapProjection.project(a.northeast(this.rectangle),v),u.z=u.y,u.y=u.x,u.x=0,c=g,d=e.UNIT_Y,h=_,p=e.UNIT_Z);var m=e.subtract(r,l,y),C=e.dot(m,c),E=e.dot(m,h),S=e.subtract(r,u,y),w=e.dot(S,d),T=e.dot(S,p);C>0?o+=C*C:w>0&&(o+=w*w),E>0?o+=E*E:T>0&&(o+=T*T)}var x;x=t.mode===s.SCENE3D?n.height:r.x;var b=t.mode===s.SCENE3D?this.maximumHeight:0,A=x-b;return A>0&&(o+=A*A),Math.sqrt(o)},u}),i("Scene/TileTerrain",["../Core/BoundingSphere","../Core/Cartesian3","../Core/ComponentDatatype","../Core/defined","../Core/DeveloperError","../Core/IndexDatatype","../Core/OrientedBoundingBox","../Core/TileProviderError","../Renderer/Buffer","../Renderer/BufferUsage","../Renderer/VertexArray","../ThirdParty/when","./TerrainState","./TileBoundingBox"],function(e,t,i,r,n,o,a,s,l,u,c,h,d,p){"use strict";function m(e){this.state=d.UNLOADED,this.data=void 0,this.mesh=void 0,this.vertexArray=void 0,this.upsampleDetails=e}function f(e,t,i,n,o){function a(t){e.data=t,e.state=d.RECEIVED}function l(){e.state=d.FAILED;var r="Failed to obtain terrain tile X: "+i+" Y: "+n+" Level: "+o+".";t._requestError=s.handleError(t._requestError,t,t.errorEvent,r,i,n,o,u)}function u(){e.data=t.requestTileGeometry(i,n,o),r(e.data)?(e.state=d.RECEIVING,h(e.data,a,l)):e.state=d.UNLOADED}u()}function v(e,t,i,n,o,a){var s=i.tilingScheme,l=e.data,u=l.createMesh(s,n,o,a,t.terrainExaggeration);r(u)&&(e.state=d.TRANSFORMING,h(u,function(t){e.mesh=t,e.state=d.TRANSFORMED},function(){e.state=d.FAILED}))}function g(e,t,i,n,a,s){var h=e.mesh.vertices,p=l.createVertexBuffer({context:t,typedArray:h,usage:u.STATIC_DRAW}),m=e.mesh.encoding.getAttributes(p),f=e.mesh.indices.indexBuffers||{},v=f[t.id];if(!r(v)||v.isDestroyed()){var g=e.mesh.indices,_=2===g.BYTES_PER_ELEMENT?o.UNSIGNED_SHORT:o.UNSIGNED_INT;v=l.createIndexBuffer({context:t,typedArray:g,usage:u.STATIC_DRAW,indexDatatype:_}),v.vertexArrayDestroyable=!1,v.referenceCount=1,f[t.id]=v,e.mesh.indices.indexBuffers=f}else++v.referenceCount;e.vertexArray=new c({context:t,attributes:m,indexBuffer:v}),e.state=d.READY}return m.prototype.freeResources=function(){if(this.state=d.UNLOADED,this.data=void 0,this.mesh=void 0,r(this.vertexArray)){var e=this.vertexArray.indexBuffer;this.vertexArray.destroy(),this.vertexArray=void 0,!e.isDestroyed()&&r(e.referenceCount)&&(--e.referenceCount,0===e.referenceCount&&e.destroy())}},m.prototype.publishToTile=function(i){var r=i.data,n=this.mesh;t.clone(n.center,r.center),r.minimumHeight=n.minimumHeight,r.maximumHeight=n.maximumHeight,r.boundingSphere3D=e.clone(n.boundingSphere3D,r.boundingSphere3D),r.orientedBoundingBox=a.clone(n.orientedBoundingBox,r.orientedBoundingBox),r.tileBoundingBox=new p({rectangle:i.rectangle,minimumHeight:n.minimumHeight,maximumHeight:n.maximumHeight,ellipsoid:i.tilingScheme.ellipsoid}),i.data.occludeePointInScaledSpace=t.clone(n.occludeePointInScaledSpace,r.occludeePointInScaledSpace),r.freeVertexArray(),r.vertexArray=this.vertexArray,this.vertexArray=void 0},m.prototype.processLoadStateMachine=function(e,t,i,r,n){this.state===d.UNLOADED&&f(this,t,i,r,n),this.state===d.RECEIVED&&v(this,e,t,i,r,n),this.state===d.TRANSFORMED&&g(this,e.context,t,i,r,n)},m.prototype.processUpsampleStateMachine=function(e,t,i,n,o){if(this.state===d.UNLOADED){var a=this.upsampleDetails,s=a.data,l=a.x,u=a.y,c=a.level;if(this.data=s.upsample(t.tilingScheme,l,u,c,i,n,o),!r(this.data))return;this.state=d.RECEIVING;var p=this;h(this.data,function(e){p.data=e,p.state=d.RECEIVED},function(){p.state=d.FAILED})}this.state===d.RECEIVED&&v(this,e,t,i,n,o),this.state===d.TRANSFORMED&&g(this,e.context,t,i,n,o)},m}),i("Scene/GlobeSurfaceTile",["../Core/BoundingSphere","../Core/Cartesian3","../Core/Cartesian4","../Core/Cartographic","../Core/defaultValue","../Core/defined","../Core/defineProperties","../Core/IntersectionTests","../Core/PixelFormat","../Core/Rectangle","../Renderer/PixelDatatype","../Renderer/Sampler","../Renderer/Texture","../Renderer/TextureMagnificationFilter","../Renderer/TextureMinificationFilter","../Renderer/TextureWrap","./ImageryState","./QuadtreeTileLoadState","./SceneMode","./TerrainState","./TileBoundingBox","./TileTerrain"],function(e,t,i,r,n,o,a,s,l,u,c,h,d,p,m,f,v,g,_,y,C,E){"use strict";function S(){this.imagery=[],this.waterMaskTexture=void 0,this.waterMaskTranslationAndScale=new i(0,0,1,1),this.terrainData=void 0,this.center=new t,this.vertexArray=void 0,this.minimumHeight=0,this.maximumHeight=0,this.boundingSphere3D=new e,this.boundingSphere2D=new e,this.orientedBoundingBox=void 0,this.tileBoundingBox=void 0,this.occludeePointInScaledSpace=new t,this.loadedTerrain=void 0,this.upsampledTerrain=void 0,this.pickBoundingSphere=new e,this.pickTerrain=void 0,this.surfaceShader=void 0}function w(e,i,r,n,a,s){if(e.decodePosition(n,a,s),o(i)&&i!==_.SCENE3D){var l=r.ellipsoid,u=l.cartesianToCartographic(s);r.project(u,s),t.fromElements(s.z,s.x,s.y,s)}return s}function T(e,t,i){var r=e.data,n=b(e);o(n)&&(r.upsampledTerrain=new E(n)),I(e,t)&&(r.loadedTerrain=new E);for(var a=0,s=i.length;s>a;++a){var l=i.get(a);l.show&&l._createTileImagerySkeletons(e,t)}}function x(e,t,i){var r=e.data,a=r.loadedTerrain,s=r.upsampledTerrain,l=!1;o(a)&&(a.processLoadStateMachine(t,i,e.x,e.y,e.level),a.state>=y.RECEIVED&&(r.terrainData!==a.data&&(r.terrainData=a.data,D(t.context,r),P(e)),l=!0),a.state===y.READY?(a.publishToTile(e),r.pickTerrain=n(r.loadedTerrain,r.upsampledTerrain),r.loadedTerrain=void 0,r.upsampledTerrain=void 0):a.state===y.FAILED&&(r.loadedTerrain=void 0)),!l&&o(s)&&(s.processUpsampleStateMachine(t,i,e.x,e.y,e.level),s.state>=y.RECEIVED&&r.terrainData!==s.data&&(r.terrainData=s.data,i.hasWaterMask&&R(e),A(e)),s.state===y.READY?(s.publishToTile(e),r.pickTerrain=r.upsampledTerrain,r.upsampledTerrain=void 0):s.state===y.FAILED&&(r.upsampledTerrain=void 0))}function b(e){for(var t=e.parent;o(t)&&o(t.data)&&!o(t.data.terrainData);)t=t.parent;return o(t)&&o(t.data)?{data:t.data.terrainData,x:t.x,y:t.y,level:t.level}:void 0}function A(e){var t=e.data;if(o(e._children))for(var i=0;4>i;++i){var r=e._children[i];if(r.state!==g.START){var n=r.data;if(o(n.terrainData)&&!n.terrainData.wasCreatedByUpsampling())continue;o(n.upsampledTerrain)&&n.upsampledTerrain.freeResources(),n.upsampledTerrain=new E({data:t.terrainData,x:e.x,y:e.y,level:e.level}),r.state=g.LOADING}}}function P(e){var t=e.data;if(o(e.children))for(var i=0;4>i;++i){var r=e.children[i];if(r.state!==g.START){var n=r.data;if(o(n.terrainData)&&!n.terrainData.wasCreatedByUpsampling())continue;o(n.upsampledTerrain)&&n.upsampledTerrain.freeResources(),n.upsampledTerrain=new E({data:t.terrainData,x:e.x,y:e.y,level:e.level}),t.terrainData.isChildAvailable(e.x,e.y,r.x,r.y)&&(o(n.loadedTerrain)||(n.loadedTerrain=new E)),r.state=g.LOADING}}}function I(e,t){var i=t.getTileDataAvailable(e.x,e.y,e.level);if(o(i))return i;var r=e.parent;return o(r)?o(r.data)&&o(r.data.terrainData)?r.data.terrainData.isChildAvailable(r.x,r.y,e.x,e.y):!1:!0}function M(e){var t=e.cache.tile_waterMaskData;if(!o(t)){var i=new d({context:e,pixelFormat:l.LUMINANCE,pixelDatatype:c.UNSIGNED_BYTE,source:{arrayBufferView:new Uint8Array([255]),width:1,height:1}});i.referenceCount=1;var r=new h({wrapS:f.CLAMP_TO_EDGE,wrapT:f.CLAMP_TO_EDGE,minificationFilter:m.LINEAR,magnificationFilter:p.LINEAR});t={allWaterTexture:i,sampler:r,destroy:function(){this.allWaterTexture.destroy()}},e.cache.tile_waterMaskData=t}return t}function D(e,t){var r=t.waterMaskTexture;o(r)&&(--r.referenceCount,0===r.referenceCount&&r.destroy(),t.waterMaskTexture=void 0);var n=t.terrainData.waterMask;if(o(n)){var a,s=M(e),u=n.length;if(1===u){if(0===n[0])return;a=s.allWaterTexture}else{var h=Math.sqrt(u);a=new d({context:e,pixelFormat:l.LUMINANCE,pixelDatatype:c.UNSIGNED_BYTE,source:{width:h,height:h,arrayBufferView:n},sampler:s.sampler}),a.referenceCount=0}++a.referenceCount,t.waterMaskTexture=a,i.fromElements(0,0,1,1,t.waterMaskTranslationAndScale)}}function R(e){for(var t=e.data,i=e.parent;o(i)&&!o(i.data.terrainData)||i.data.terrainData.wasCreatedByUpsampling();)i=i.parent;if(o(i)&&o(i.data.waterMaskTexture)){t.waterMaskTexture=i.data.waterMaskTexture,++t.waterMaskTexture.referenceCount;var r=i.rectangle,n=e.rectangle,a=n.width,s=n.height,l=a/r.width,u=s/r.height;t.waterMaskTranslationAndScale.x=l*(n.west-r.west)/a,t.waterMaskTranslationAndScale.y=u*(n.south-r.south)/s,t.waterMaskTranslationAndScale.z=l,t.waterMaskTranslationAndScale.w=u}}a(S.prototype,{eligibleForUnloading:{get:function(){for(var e=this.loadedTerrain,t=o(e)&&(e.state===y.RECEIVING||e.state===y.TRANSFORMING),i=this.upsampledTerrain,r=o(i)&&(i.state===y.RECEIVING||i.state===y.TRANSFORMING),n=!t&&!r,a=this.imagery,s=0,l=a.length;n&&l>s;++s){var u=a[s];n=!o(u.loadingImagery)||u.loadingImagery.state!==v.TRANSITIONING}return n}}});var O=new t,N=new t,L=new t,F=new t;return S.prototype.pick=function(e,i,r,n,a){var l=this.pickTerrain;if(o(l)){var u=l.mesh;if(o(u))for(var c=u.vertices,h=u.indices,d=u.encoding,p=h.length,m=0;p>m;m+=3){var f=h[m],v=h[m+1],g=h[m+2],_=w(d,i,r,c,f,O),y=w(d,i,r,c,v,N),C=w(d,i,r,c,g,L),E=s.rayTriangle(e,_,y,C,n,F);if(o(E))return t.clone(E,a)}}},S.prototype.freeResources=function(){o(this.waterMaskTexture)&&(--this.waterMaskTexture.referenceCount,0===this.waterMaskTexture.referenceCount&&this.waterMaskTexture.destroy(),this.waterMaskTexture=void 0),this.terrainData=void 0,o(this.loadedTerrain)&&(this.loadedTerrain.freeResources(),this.loadedTerrain=void 0),o(this.upsampledTerrain)&&(this.upsampledTerrain.freeResources(),this.upsampledTerrain=void 0),o(this.pickTerrain)&&(this.pickTerrain.freeResources(),this.pickTerrain=void 0);var e,t,i=this.imagery;for(e=0,t=i.length;t>e;++e)i[e].freeResources();this.imagery.length=0,this.freeVertexArray()},S.prototype.freeVertexArray=function(){var e;o(this.vertexArray)&&(e=this.vertexArray.indexBuffer,this.vertexArray=this.vertexArray.destroy(),!e.isDestroyed()&&o(e.referenceCount)&&(--e.referenceCount,0===e.referenceCount&&e.destroy())),o(this.wireframeVertexArray)&&(e=this.wireframeVertexArray.indexBuffer,this.wireframeVertexArray=this.wireframeVertexArray.destroy(),!e.isDestroyed()&&o(e.referenceCount)&&(--e.referenceCount,0===e.referenceCount&&e.destroy()))},S.processStateMachine=function(e,t,i,r){var n=e.data;o(n)||(n=e.data=new S),e.state===g.START&&(T(e,i,r),e.state=g.LOADING),e.state===g.LOADING&&x(e,t,i);for(var a=o(n.vertexArray),s=!o(n.loadedTerrain)&&!o(n.upsampledTerrain),l=o(n.terrainData)&&n.terrainData.wasCreatedByUpsampling(),u=n.imagery,c=0,h=u.length;h>c;++c){var d=u[c];if(o(d.loadingImagery)){if(d.loadingImagery.state===v.PLACEHOLDER){var p=d.loadingImagery.imageryLayer;if(p.imageryProvider.ready){d.freeResources(),u.splice(c,1),p._createTileImagerySkeletons(e,i,c),--c,h=u.length;continue}l=!1}var m=d.processStateMachine(e,t);s=s&&m,a=a&&(m||o(d.readyImagery)),l=l&&o(d.loadingImagery)&&(d.loadingImagery.state===v.FAILED||d.loadingImagery.state===v.INVALID)}else l=!1}e.upsampledFromParent=l,c===h&&(a&&(e.renderable=!0),s&&(e.state=g.DONE))},S}),i("Shaders/ReprojectWebMercatorFS",[],function(){"use strict";return"uniform sampler2D u_texture;\nvarying vec2 v_textureCoordinates;\nvoid main()\n{\ngl_FragColor = texture2D(u_texture, v_textureCoordinates);\n}\n"}),i("Shaders/ReprojectWebMercatorVS",[],function(){"use strict";return"attribute vec4 position;\nattribute float webMercatorT;\nuniform vec2 u_textureDimensions;\nvarying vec2 v_textureCoordinates;\nvoid main()\n{\nv_textureCoordinates = vec2(position.x, webMercatorT);\ngl_Position = czm_viewportOrthographic * (position * vec4(u_textureDimensions, 1.0, 1.0));\n}\n"}),i("Scene/Imagery",["../Core/defined","../Core/destroyObject","./ImageryState"],function(e,t,i){"use strict";function r(t,r,n,o,a){if(this.imageryLayer=t,this.x=r,this.y=n,this.level=o,0!==o){var s=r/2|0,l=n/2|0,u=o-1;this.parent=t.getImageryFromCache(s,l,u)}if(this.state=i.UNLOADED,this.imageUrl=void 0,this.image=void 0,this.texture=void 0,this.credits=void 0,this.referenceCount=0,!e(a)&&t.imageryProvider.ready){var c=t.imageryProvider.tilingScheme;a=c.tileXYToRectangle(r,n,o)}this.rectangle=a}return r.createPlaceholder=function(e){var t=new r(e,0,0,0);return t.addReference(),t.state=i.PLACEHOLDER,t},r.prototype.addReference=function(){++this.referenceCount},r.prototype.releaseReference=function(){return--this.referenceCount,0===this.referenceCount?(this.imageryLayer.removeImageryFromCache(this),e(this.parent)&&this.parent.releaseReference(),e(this.image)&&e(this.image.destroy)&&this.image.destroy(),e(this.texture)&&this.texture.destroy(),t(this),0):this.referenceCount},r.prototype.processStateMachine=function(e){this.state===i.UNLOADED&&(this.state=i.TRANSITIONING,this.imageryLayer._requestImagery(this)),this.state===i.RECEIVED&&(this.state=i.TRANSITIONING,this.imageryLayer._createTexture(e.context,this)),this.state===i.TEXTURE_LOADED&&(this.state=i.TRANSITIONING,this.imageryLayer._reprojectTexture(e,this))},r}),i("Scene/TileImagery",["../Core/defined","./ImageryState"],function(e,t){"use strict";function i(e,t){this.readyImagery=void 0,this.loadingImagery=e,this.textureCoordinateRectangle=t,this.textureTranslationAndScale=void 0}return i.prototype.freeResources=function(){e(this.readyImagery)&&this.readyImagery.releaseReference(),e(this.loadingImagery)&&this.loadingImagery.releaseReference()},i.prototype.processStateMachine=function(i,r){var n=this.loadingImagery,o=n.imageryLayer;if(n.processStateMachine(r),n.state===t.READY)return e(this.readyImagery)&&this.readyImagery.releaseReference(),this.readyImagery=this.loadingImagery,this.loadingImagery=void 0,this.textureTranslationAndScale=o._calculateTextureTranslationAndScale(i,this),!0;for(var a,s=n.parent;e(s)&&s.state!==t.READY;)s.state!==t.FAILED&&s.state!==t.INVALID&&(a=a||s),s=s.parent;return this.readyImagery!==s&&(e(this.readyImagery)&&this.readyImagery.releaseReference(),this.readyImagery=s,e(s)&&(s.addReference(),this.textureTranslationAndScale=o._calculateTextureTranslationAndScale(i,this))),n.state===t.FAILED||n.state===t.INVALID?e(a)?(a.processStateMachine(r),!1):!0:!1},i}),i("Scene/ImageryLayer",["../Core/BoundingRectangle","../Core/Cartesian2","../Core/Cartesian4","../Core/Color","../Core/ComponentDatatype","../Core/defaultValue","../Core/defined","../Core/defineProperties","../Core/destroyObject","../Core/FeatureDetection","../Core/GeographicTilingScheme","../Core/IndexDatatype","../Core/Math","../Core/PixelFormat","../Core/PrimitiveType","../Core/Rectangle","../Core/TerrainProvider","../Core/TileProviderError","../Renderer/Buffer","../Renderer/BufferUsage","../Renderer/ClearCommand","../Renderer/ComputeCommand","../Renderer/ContextLimits","../Renderer/DrawCommand","../Renderer/Framebuffer","../Renderer/MipmapHint","../Renderer/RenderState","../Renderer/Sampler","../Renderer/ShaderProgram","../Renderer/ShaderSource","../Renderer/Texture","../Renderer/TextureMagnificationFilter","../Renderer/TextureMinificationFilter","../Renderer/TextureWrap","../Renderer/VertexArray","../Shaders/ReprojectWebMercatorFS","../Shaders/ReprojectWebMercatorVS","../ThirdParty/when","./Imagery","./ImageryState","./TileImagery"],function(e,t,i,r,n,o,a,s,l,u,c,h,d,p,m,f,v,g,_,y,C,E,S,w,T,x,b,A,P,I,M,D,R,O,N,L,F,B,V,k,z){"use strict";function U(e,t){this._imageryProvider=e,t=o(t,{}),this.alpha=o(t.alpha,o(e.defaultAlpha,1)),this.brightness=o(t.brightness,o(e.defaultBrightness,U.DEFAULT_BRIGHTNESS)),this.contrast=o(t.contrast,o(e.defaultContrast,U.DEFAULT_CONTRAST)),this.hue=o(t.hue,o(e.defaultHue,U.DEFAULT_HUE)),this.saturation=o(t.saturation,o(e.defaultSaturation,U.DEFAULT_SATURATION)),this.gamma=o(t.gamma,o(e.defaultGamma,U.DEFAULT_GAMMA)),this.show=o(t.show,!0),this._minimumTerrainLevel=t.minimumTerrainLevel,this._maximumTerrainLevel=t.maximumTerrainLevel,this._rectangle=o(t.rectangle,f.MAX_VALUE),this._maximumAnisotropy=t.maximumAnisotropy,this._imageryCache={},this._skeletonPlaceholder=new z(V.createPlaceholder(this)),this._show=!0,this._layerIndex=-1,this._isBaseLayer=!1,this._requestImageError=void 0}function G(e,t,i,r){if(d.isPowerOfTwo(r.width)&&d.isPowerOfTwo(r.height)){var n=t.cache.imageryLayer_mipmapSampler;if(!a(n)){var s=S.maximumTextureFilterAnisotropy;n=t.cache.imageryLayer_mipmapSampler=new A({wrapS:O.CLAMP_TO_EDGE,wrapT:O.CLAMP_TO_EDGE,minificationFilter:R.LINEAR_MIPMAP_LINEAR,magnificationFilter:D.LINEAR,maximumAnisotropy:Math.min(s,o(e._maximumAnisotropy,s))})}r.generateMipmap(x.NICEST),r.sampler=n}else{var l=t.cache.imageryLayer_nonMipmapSampler;a(l)||(l=t.cache.imageryLayer_nonMipmapSampler=new A({wrapS:O.CLAMP_TO_EDGE,wrapT:O.CLAMP_TO_EDGE,minificationFilter:R.LINEAR,magnificationFilter:D.LINEAR})),r.sampler=l}i.state=k.READY}function W(e,t,i){return JSON.stringify([e,t,i])}function H(e,t,i,r){var n=t.cache.imageryLayer_reproject;if(!a(n)){n=t.cache.imageryLayer_reproject={vertexArray:void 0,shaderProgram:void 0,sampler:void 0,destroy:function(){a(this.framebuffer)&&this.framebuffer.destroy(),a(this.vertexArray)&&this.vertexArray.destroy(),a(this.shaderProgram)&&this.shaderProgram.destroy()}};for(var o=new Float32Array(256),s=0,l=0;64>l;++l){var u=l/63;o[s++]=0,o[s++]=u,o[s++]=1,o[s++]=u}var c={position:0,webMercatorT:1},p=v.getRegularGridIndices(2,64),m=_.createIndexBuffer({context:t,typedArray:p,usage:y.STATIC_DRAW,indexDatatype:h.UNSIGNED_SHORT});n.vertexArray=new N({context:t,attributes:[{index:c.position,vertexBuffer:_.createVertexBuffer({context:t,typedArray:o,usage:y.STATIC_DRAW}),componentsPerAttribute:2},{index:c.webMercatorT,vertexBuffer:_.createVertexBuffer({context:t,sizeInBytes:512,usage:y.STREAM_DRAW}),componentsPerAttribute:1}],indexBuffer:m});var f=new I({sources:[F]});n.shaderProgram=P.fromCache({context:t,vertexShaderSource:f,fragmentShaderSource:L,attributeLocations:c}),n.sampler=new A({wrapS:O.CLAMP_TO_EDGE,wrapT:O.CLAMP_TO_EDGE,minificationFilter:R.LINEAR,magnificationFilter:D.LINEAR})}i.sampler=n.sampler;var g=i.width,C=i.height;Z.textureDimensions.x=g,Z.textureDimensions.y=C,Z.texture=i;var E=Math.sin(r.south),S=.5*Math.log((1+E)/(1-E));E=Math.sin(r.north);var w=.5*Math.log((1+E)/(1-E)),T=1/(w-S),b=new M({context:t,width:g,height:C,pixelFormat:i.pixelFormat,pixelDatatype:i.pixelDatatype,preMultiplyAlpha:i.preMultiplyAlpha});d.isPowerOfTwo(g)&&d.isPowerOfTwo(C)&&b.generateMipmap(x.NICEST);for(var B=r.south,V=r.north,k=K,z=0,U=0;64>U;++U){var G=U/63,W=d.lerp(B,V,G);E=Math.sin(W);var H=.5*Math.log((1+E)/(1-E)),q=(H-S)*T;k[z++]=q,k[z++]=q}n.vertexArray.getAttribute(1).vertexBuffer.copyFromArrayView(k),e.shaderProgram=n.shaderProgram,e.outputTexture=b,e.uniformMap=Z,e.vertexArray=n.vertexArray}function q(e,t,i){var r=e._imageryProvider,n=r.tilingScheme,o=n.ellipsoid,a=e._imageryProvider.tilingScheme instanceof c?1:Math.cos(i),s=n.rectangle,l=o.maximumRadius*s.width*a/(r.tileWidth*n.getNumberOfXTilesAtLevel(0)),u=l/t,h=Math.log(u)/Math.log(2),d=Math.round(h);return 0|d}s(U.prototype,{imageryProvider:{get:function(){return this._imageryProvider}},rectangle:{get:function(){return this._rectangle}}}),U.DEFAULT_BRIGHTNESS=1,U.DEFAULT_CONTRAST=1,U.DEFAULT_HUE=0,U.DEFAULT_SATURATION=1,U.DEFAULT_GAMMA=1,U.prototype.isBaseLayer=function(){return this._isBaseLayer},U.prototype.isDestroyed=function(){return!1},U.prototype.destroy=function(){return l(this)};var j=new f,Y=new f,X=new f;U.prototype.getViewableRectangle=function(){var e=this._imageryProvider,t=this._rectangle;return e.readyPromise.then(function(){return f.intersection(e.rectangle,t)})},U.prototype._createTileImagerySkeletons=function(e,t,r){var n=e.data;if(a(this._minimumTerrainLevel)&&e.level<this._minimumTerrainLevel)return!1;if(a(this._maximumTerrainLevel)&&e.level>this._maximumTerrainLevel)return!1;var o=this._imageryProvider;if(a(r)||(r=n.imagery.length),!o.ready)return this._skeletonPlaceholder.loadingImagery.addReference(),n.imagery.splice(r,0,this._skeletonPlaceholder),!0;var s=f.intersection(o.rectangle,this._rectangle,j),l=f.intersection(e.rectangle,s,Y);if(!a(l)){if(!this.isBaseLayer())return!1;var u=s,c=e.rectangle;l=Y,c.south>=u.north?l.north=l.south=u.north:c.north<=u.south?l.north=l.south=u.south:(l.south=Math.max(c.south,u.south),l.north=Math.min(c.north,u.north)),c.west>=u.east?l.west=l.east=u.east:c.east<=u.west?l.west=l.east=u.west:(l.west=Math.max(c.west,u.west),l.east=Math.min(c.east,u.east))}var h=0;l.south>0?h=l.south:l.north<0&&(h=l.north);var d=1,p=d*t.getLevelMaximumGeometricError(e.level),m=q(this,p,h);m=Math.max(0,m);var v=o.maximumLevel;if(m>v&&(m=v),a(o.minimumLevel)){var g=o.minimumLevel;g>m&&(m=g)}var _=o.tilingScheme,y=_.positionToTileXY(f.northwest(l),m),C=_.positionToTileXY(f.southeast(l),m),E=e.rectangle.height/512,S=e.rectangle.width/512,w=_.tileXYToRectangle(y.x,y.y,m);Math.abs(w.south-e.rectangle.north)<S&&y.y<C.y&&++y.y,Math.abs(w.east-e.rectangle.west)<E&&y.x<C.x&&++y.x;var T=_.tileXYToRectangle(C.x,C.y,m);Math.abs(T.north-e.rectangle.south)<S&&C.y>y.y&&--C.y,Math.abs(T.west-e.rectangle.east)<E&&C.x>y.x&&--C.x;var x,b,A=e.rectangle,P=_.tileXYToRectangle(y.x,y.y,m),I=f.intersection(P,s,X),M=0,D=1;!this.isBaseLayer()&&Math.abs(I.west-e.rectangle.west)>=E&&(M=Math.min(1,(I.west-A.west)/A.width)),!this.isBaseLayer()&&Math.abs(I.north-e.rectangle.north)>=S&&(D=Math.max(0,(I.north-A.south)/A.height));for(var R=D,O=y.x;O<=C.x;O++){x=M,P=_.tileXYToRectangle(O,y.y,m),I=f.intersection(P,s,X),M=Math.min(1,(I.east-A.west)/A.width),O===C.x&&(this.isBaseLayer()||Math.abs(I.east-e.rectangle.east)<E)&&(M=1),D=R;for(var N=y.y;N<=C.y;N++){b=D,P=_.tileXYToRectangle(O,N,m),I=f.intersection(P,s,X),D=Math.max(0,(I.south-A.south)/A.height),N===C.y&&(this.isBaseLayer()||Math.abs(I.south-e.rectangle.south)<S)&&(D=0);var L=new i(x,D,M,b),F=this.getImageryFromCache(O,N,m,P);n.imagery.splice(r,0,new z(F,L)),++r}}return!0},U.prototype._calculateTextureTranslationAndScale=function(e,t){var r=t.readyImagery.rectangle,n=e.rectangle,o=n.width,a=n.height,s=o/r.width,l=a/r.height;return new i(s*(n.west-r.west)/o,l*(n.south-r.south)/a,s,l)},U.prototype._requestImagery=function(e){function t(t){return a(t)?(e.image=t,e.state=k.RECEIVED,void g.handleSuccess(o._requestImageError)):i()}function i(t){e.state=k.FAILED;var i="Failed to obtain image tile X: "+e.x+" Y: "+e.y+" Level: "+e.level+".";o._requestImageError=g.handleError(o._requestImageError,n,n.errorEvent,i,e.x,e.y,e.level,r,t)}function r(){e.state=k.TRANSITIONING;var r=n.requestImage(e.x,e.y,e.level);return a(r)?(a(n.getTileCredits)&&(e.credits=n.getTileCredits(e.x,e.y,e.level)),void B(r,t,i)):void(e.state=k.UNLOADED)}var n=this._imageryProvider,o=this;r()},U.prototype._createTexture=function(e,t){var i=this._imageryProvider;if(a(i.tileDiscardPolicy)){var r=i.tileDiscardPolicy;if(a(r)){if(!r.isReady())return void(t.state=k.RECEIVED);if(r.shouldDiscardImage(t.image))return void(t.state=k.INVALID)}}var n=new M({context:e,source:t.image,pixelFormat:i.hasAlphaChannel?p.RGBA:p.RGB});t.texture=n,t.image=void 0,t.state=k.TEXTURE_LOADED},U.prototype._reprojectTexture=function(e,t){var i=t.texture,r=t.rectangle,n=e.context;if(!(this._imageryProvider.tilingScheme instanceof c)&&r.width/i.width>1e-5){var o=this,a=new E({persists:!0,owner:this,preExecute:function(e){H(e,n,i,t.rectangle)},postExecute:function(e){i.destroy(),t.texture=e,G(o,n,t,e)}});e.commandList.push(a)}else G(this,n,t,i)},U.prototype.getImageryFromCache=function(e,t,i,r){var n=W(e,t,i),o=this._imageryCache[n];return a(o)||(o=new V(this,e,t,i,r),this._imageryCache[n]=o),o.addReference(),o},U.prototype.removeImageryFromCache=function(e){var t=W(e.x,e.y,e.level);delete this._imageryCache[t]};var Z={u_textureDimensions:function(){return this.textureDimensions},u_texture:function(){return this.texture},textureDimensions:new t,texture:void 0},K=u.supportsTypedArrays()?new Float32Array(128):void 0;return U}),i("Scene/GlobeSurfaceTileProvider",["../Core/BoundingSphere","../Core/BoxOutlineGeometry","../Core/Cartesian2","../Core/Cartesian3","../Core/Cartesian4","../Core/Color","../Core/ColorGeometryInstanceAttribute","../Core/defaultValue","../Core/defined","../Core/defineProperties","../Core/destroyObject","../Core/DeveloperError","../Core/Event","../Core/FeatureDetection","../Core/GeometryInstance","../Core/GeometryPipeline","../Core/IndexDatatype","../Core/Intersect","../Core/Math","../Core/Matrix4","../Core/OrientedBoundingBox","../Core/PrimitiveType","../Core/Rectangle","../Core/SphereOutlineGeometry","../Core/TerrainQuantization","../Core/Visibility","../Core/WebMercatorProjection","../Renderer/Buffer","../Renderer/BufferUsage","../Renderer/ContextLimits","../Renderer/DrawCommand","../Renderer/RenderState","../Renderer/VertexArray","../Scene/BlendingState","../Scene/DepthFunction","../Scene/Pass","../Scene/PerInstanceColorAppearance","../Scene/Primitive","../ThirdParty/when","./GlobeSurfaceTile","./ImageryLayer","./ImageryState","./QuadtreeTileLoadState","./SceneMode"],function(e,t,i,r,n,o,a,s,l,u,c,h,d,p,m,f,v,g,_,y,C,E,S,w,T,x,b,A,P,I,M,D,R,O,N,L,F,B,V,k,z,U,G,W){"use strict";function H(e){this.lightingFadeOutDistance=65e5,this.lightingFadeInDistance=9e6,this.hasWaterMask=!1,this.oceanNormalMap=void 0,this.zoomedOutOceanSpecularIntensity=.5,this.enableLighting=!1,this._quadtree=void 0,this._terrainProvider=e.terrainProvider,this._imageryLayers=e.imageryLayers,this._surfaceShaderSet=e.surfaceShaderSet,this._renderState=void 0,this._blendRenderState=void 0,this._pickRenderState=void 0,this._errorEvent=new d,this._imageryLayers.layerAdded.addEventListener(H.prototype._onLayerAdded,this),this._imageryLayers.layerRemoved.addEventListener(H.prototype._onLayerRemoved,this),this._imageryLayers.layerMoved.addEventListener(H.prototype._onLayerMoved,this),this._imageryLayers.layerShownOrHidden.addEventListener(H.prototype._onLayerShownOrHidden,this),this._layerOrderChanged=!1,this._tilesToRenderByTextureCount=[],this._drawCommands=[],this._uniformMaps=[],this._pickCommands=[],this._usedDrawCommands=0,this._usedPickCommands=0,this._debug={wireframe:!1,boundingSphereTile:void 0},this._baseColor=void 0,this._firstPassInitialColor=void 0,this.baseColor=new o(0,0,.5,1)}function q(e,t){var i=e.loadingImagery;l(i)||(i=e.readyImagery);var r=t.loadingImagery;return l(r)||(r=t.readyImagery),i.imageryLayer._layerIndex-r.imageryLayer._layerIndex}function j(){var e={u_initialColor:function(){return this.initialColor},u_zoomedOutOceanSpecularIntensity:function(){return this.zoomedOutOceanSpecularIntensity},u_oceanNormalMap:function(){return this.oceanNormalMap},u_lightingFadeDistance:function(){return this.lightingFadeDistance; -},u_center3D:function(){return this.center3D},u_tileRectangle:function(){return this.tileRectangle},u_modifiedModelView:function(){return this.modifiedModelView},u_dayTextures:function(){return this.dayTextures},u_dayTextureTranslationAndScale:function(){return this.dayTextureTranslationAndScale},u_dayTextureTexCoordsRectangle:function(){return this.dayTextureTexCoordsRectangle},u_dayTextureAlpha:function(){return this.dayTextureAlpha},u_dayTextureBrightness:function(){return this.dayTextureBrightness},u_dayTextureContrast:function(){return this.dayTextureContrast},u_dayTextureHue:function(){return this.dayTextureHue},u_dayTextureSaturation:function(){return this.dayTextureSaturation},u_dayTextureOneOverGamma:function(){return this.dayTextureOneOverGamma},u_dayIntensity:function(){return this.dayIntensity},u_southAndNorthLatitude:function(){return this.southAndNorthLatitude},u_southMercatorYAndOneOverHeight:function(){return this.southMercatorYAndOneOverHeight},u_waterMask:function(){return this.waterMask},u_waterMaskTranslationAndScale:function(){return this.waterMaskTranslationAndScale},u_minMaxHeight:function(){return this.minMaxHeight},u_scaleAndBias:function(){return this.scaleAndBias},initialColor:new n(0,0,.5,1),zoomedOutOceanSpecularIntensity:.5,oceanNormalMap:void 0,lightingFadeDistance:new i(65e5,9e6),center3D:void 0,modifiedModelView:new y,tileRectangle:new n,dayTextures:[],dayTextureTranslationAndScale:[],dayTextureTexCoordsRectangle:[],dayTextureAlpha:[],dayTextureBrightness:[],dayTextureContrast:[],dayTextureHue:[],dayTextureSaturation:[],dayTextureOneOverGamma:[],dayIntensity:0,southAndNorthLatitude:new i,southMercatorYAndOneOverHeight:new i,waterMask:void 0,waterMaskTranslationAndScale:new n,minMaxHeight:new i,scaleAndBias:new y};return e}function Y(e,t,i){var r=i.data;l(r.wireframeVertexArray)||l(r.terrainData)&&l(r.terrainData._mesh)&&(r.wireframeVertexArray=X(e,r.vertexArray,r.terrainData._mesh))}function X(e,t,i){var r={indices:i.indices,primitiveType:E.TRIANGLES};f.toWireframe(r);var n=r.indices,o=A.createIndexBuffer({context:e,typedArray:n,usage:P.STATIC_DRAW,indexDatatype:v.UNSIGNED_SHORT});return new R({context:e,attributes:t._attributes,indexBuffer:o})}function Z(t,i,a){var s=i.data,u=a.camera.viewMatrix,c=I.maximumTextureImageUnits,h=s.waterMaskTexture,d=t.hasWaterMask&&l(h),p=t.oceanNormalMap,m=d&&l(p),f=t.terrainProvider.ready&&t.terrainProvider.hasVertexNormals,v=a.fog.enabled;d&&--c,m&&--c;var g=s.center,w=s.pickTerrain.mesh.encoding,x=$,A=0,P=0,D=0,R=0,O=!1;if(a.mode!==W.SCENE3D){var N=a.mapProjection,F=N.project(S.southwest(i.rectangle),ie),B=N.project(S.northeast(i.rectangle),re);if(x.x=F.x,x.y=F.y,x.z=B.x,x.w=B.y,a.mode!==W.MORPHING&&(g=ee,g.x=0,g.y=.5*(x.z+x.x),g.z=.5*(x.w+x.y),x.x-=g.y,x.y-=g.z,x.z-=g.y,x.w-=g.z),a.mode===W.SCENE2D&&w.quantization===T.BITS12){var V=1/(Math.pow(2,12)-1)*.5,k=(x.z-x.x)*V,G=(x.w-x.y)*V;x.x-=k,x.y-=G,x.z+=k,x.w+=G}N instanceof b&&(A=i.rectangle.south,P=i.rectangle.north,D=b.geodeticLatitudeToMercatorAngle(A),R=1/(b.geodeticLatitudeToMercatorAngle(P)-D),O=!0)}var H=y.multiplyByPoint(u,g,te);y.setTranslation(u,H,J);var q=s.imagery,X=0,Z=q.length,K=t._renderState,Q=t._blendRenderState,le=K,ue=t._firstPassInitialColor,ce=a.context;l(t._debug.boundingSphereTile)||ae();do{var he,de,pe=0;t._drawCommands.length<=t._usedDrawCommands?(he=new M,he.owner=i,he.cull=!1,he.boundingVolume=new e,he.orientedBoundingBox=void 0,de=j(),t._drawCommands.push(he),t._uniformMaps.push(de)):(he=t._drawCommands[t._usedDrawCommands],de=t._uniformMaps[t._usedDrawCommands]),he.owner=i,++t._usedDrawCommands,i===t._debug.boundingSphereTile&&(l(s.orientedBoundingBox)?ne(s.orientedBoundingBox,o.RED).update(a):l(s.boundingSphere3D)&&oe(s.boundingSphere3D,o.RED).update(a)),n.clone(ue,de.initialColor),de.oceanNormalMap=p,de.lightingFadeDistance.x=t.lightingFadeOutDistance,de.lightingFadeDistance.y=t.lightingFadeInDistance,de.zoomedOutOceanSpecularIntensity=t.zoomedOutOceanSpecularIntensity,de.center3D=s.center,n.clone(x,de.tileRectangle),de.southAndNorthLatitude.x=A,de.southAndNorthLatitude.y=P,de.southMercatorYAndOneOverHeight.x=D,de.southMercatorYAndOneOverHeight.y=R,y.clone(J,de.modifiedModelView);for(var me=v&&_.fog(i._distance,a.fog.density)>_.EPSILON3,fe=!1,ve=!1,ge=!1,_e=!1,ye=!1,Ce=!1;c>pe&&Z>X;){var Ee=q[X],Se=Ee.readyImagery;if(++X,l(Se)&&Se.state===U.READY&&0!==Se.imageryLayer.alpha){var we=Se.imageryLayer;if(l(Ee.textureTranslationAndScale)||(Ee.textureTranslationAndScale=we._calculateTextureTranslationAndScale(i,Ee)),de.dayTextures[pe]=Se.texture,de.dayTextureTranslationAndScale[pe]=Ee.textureTranslationAndScale,de.dayTextureTexCoordsRectangle[pe]=Ee.textureCoordinateRectangle,de.dayTextureAlpha[pe]=we.alpha,Ce=Ce||1!==de.dayTextureAlpha[pe],de.dayTextureBrightness[pe]=we.brightness,fe=fe||de.dayTextureBrightness[pe]!==z.DEFAULT_BRIGHTNESS,de.dayTextureContrast[pe]=we.contrast,ve=ve||de.dayTextureContrast[pe]!==z.DEFAULT_CONTRAST,de.dayTextureHue[pe]=we.hue,ge=ge||de.dayTextureHue[pe]!==z.DEFAULT_HUE,de.dayTextureSaturation[pe]=we.saturation,_e=_e||de.dayTextureSaturation[pe]!==z.DEFAULT_SATURATION,de.dayTextureOneOverGamma[pe]=1/we.gamma,ye=ye||de.dayTextureOneOverGamma[pe]!==1/z.DEFAULT_GAMMA,l(Se.credits))for(var Te=a.creditDisplay,xe=Se.credits,be=0,Ae=xe.length;Ae>be;++be)Te.addCredit(xe[be]);++pe}}de.dayTextures.length=pe,de.waterMask=h,n.clone(s.waterMaskTranslationAndScale,de.waterMaskTranslationAndScale),de.minMaxHeight.x=w.minimumHeight,de.minMaxHeight.y=w.maximumHeight,y.clone(w.matrix,de.scaleAndBias),he.shaderProgram=t._surfaceShaderSet.getShaderProgram(a,s,pe,fe,ve,ge,_e,ye,Ce,d,m,t.enableLighting,f,O,me),he.renderState=le,he.primitiveType=E.TRIANGLES,he.vertexArray=s.vertexArray,he.uniformMap=de,he.pass=L.GLOBE,t._debug.wireframe&&(Y(ce,t,i),l(s.wireframeVertexArray)&&(he.vertexArray=s.wireframeVertexArray,he.primitiveType=E.LINES));var Pe=he.boundingVolume,Ie=he.orientedBoundingBox;a.mode!==W.SCENE3D?(e.fromRectangleWithHeights2D(i.rectangle,a.mapProjection,s.minimumHeight,s.maximumHeight,Pe),r.fromElements(Pe.center.z,Pe.center.x,Pe.center.y,Pe.center),a.mode===W.MORPHING&&(Pe=e.union(s.boundingSphere3D,Pe,Pe))):(he.boundingVolume=e.clone(s.boundingSphere3D,Pe),he.orientedBoundingBox=C.clone(s.orientedBoundingBox,Ie)),a.commandList.push(he),le=Q,ue=se}while(Z>X)}function K(e,t,i){var r;e._pickCommands.length<=e._usedPickCommands?(r=new M,r.cull=!1,e._pickCommands.push(r)):r=e._pickCommands[e._usedPickCommands],++e._usedPickCommands;var n=t.owner.data,o=i.projection instanceof b;r.shaderProgram=e._surfaceShaderSet.getPickShaderProgram(i,n,o),r.renderState=e._pickRenderState,r.owner=t.owner,r.primitiveType=t.primitiveType,r.vertexArray=t.vertexArray,r.uniformMap=t.uniformMap,r.boundingVolume=t.boundingVolume,r.orientedBoundingBox=r.orientedBoundingBox,r.pass=t.pass,i.commandList.push(r)}u(H.prototype,{baseColor:{get:function(){return this._baseColor},set:function(e){this._baseColor=e,this._firstPassInitialColor=n.fromColor(e,this._firstPassInitialColor)}},quadtree:{get:function(){return this._quadtree},set:function(e){this._quadtree=e}},ready:{get:function(){return this._terrainProvider.ready&&(0===this._imageryLayers.length||this._imageryLayers.get(0).imageryProvider.ready)}},tilingScheme:{get:function(){return this._terrainProvider.tilingScheme}},errorEvent:{get:function(){return this._errorEvent}},terrainProvider:{get:function(){return this._terrainProvider},set:function(e){this._terrainProvider!==e&&(this._terrainProvider=e,l(this._quadtree)&&this._quadtree.invalidateAllTiles())}}}),H.prototype.beginUpdate=function(e){this._imageryLayers._update(),this._layerOrderChanged&&(this._layerOrderChanged=!1,this._quadtree.forEachLoadedTile(function(e){e.data.imagery.sort(q)}));var t,i,r=this._tilesToRenderByTextureCount;for(t=0,i=r.length;i>t;++t){var n=r[t];l(n)&&(n.length=0)}this._usedDrawCommands=0;var o=e.creditDisplay;this._terrainProvider.ready&&l(this._terrainProvider.credit)&&o.addCredit(this._terrainProvider.credit);var a=this._imageryLayers;for(t=0,i=a.length;i>t;++t){var s=a.get(t).imageryProvider;s.ready&&l(s.credit)&&o.addCredit(s.credit)}},H.prototype.endUpdate=function(e){l(this._renderState)||(this._renderState=D.fromCache({cull:{enabled:!0},depthTest:{enabled:!0,func:N.LESS}}),this._blendRenderState=D.fromCache({cull:{enabled:!0},depthTest:{enabled:!0,func:N.LESS_OR_EQUAL},blending:O.ALPHA_BLEND}));for(var t=this._tilesToRenderByTextureCount,i=0,r=t.length;r>i;++i){var n=t[i];if(l(n))for(var o=0,a=n.length;a>o;++o)Z(this,n[o],e)}},H.prototype.updateForPick=function(e){l(this._pickRenderState)||(this._pickRenderState=D.fromCache({colorMask:{red:!1,green:!1,blue:!1,alpha:!1},depthTest:{enabled:!0}})),this._usedPickCommands=0;for(var t=this._drawCommands,i=0,r=this._usedDrawCommands;r>i;++i)K(this,t[i],e)},H.prototype.getLevelMaximumGeometricError=function(e){return this._terrainProvider.getLevelMaximumGeometricError(e)},H.prototype.loadTile=function(e,t){k.processStateMachine(t,e,this._terrainProvider,this._imageryLayers)};var Q=new e;H.prototype.computeTileVisibility=function(t,i,n){var o=this.computeDistanceToTile(t,i);if(t._distance=o,i.fog.enabled&&_.fog(o,i.fog.density)>=1)return x.NONE;var a=t.data,u=i.cullingVolume,c=s(a.orientedBoundingBox,a.boundingSphere3D);i.mode!==W.SCENE3D&&(c=Q,e.fromRectangleWithHeights2D(t.rectangle,i.mapProjection,a.minimumHeight,a.maximumHeight,c),r.fromElements(c.center.z,c.center.x,c.center.y,c.center),i.mode===W.MORPHING&&(c=e.union(a.boundingSphere3D,c,c)));var h=u.computeVisibility(c);if(h===g.OUTSIDE)return x.NONE;if(i.mode===W.SCENE3D){var d=a.occludeePointInScaledSpace;return l(d)?n.ellipsoid.isScaledSpacePointVisible(d)?h:x.NONE:h}return h};var J=new y,$=new n,ee=new r,te=new r,ie=new r,re=new r;H.prototype.showTileThisFrame=function(e,t){for(var i=0,r=e.data.imagery,n=0,o=r.length;o>n;++n){var a=r[n];l(a.readyImagery)&&0!==a.readyImagery.imageryLayer.alpha&&++i}var s=this._tilesToRenderByTextureCount[i];l(s)||(s=[],this._tilesToRenderByTextureCount[i]=s),s.push(e);var u=this._debug;++u.tilesRendered,u.texturesRendered+=i},H.prototype.computeDistanceToTile=function(e,t){var i=e.data,r=i.tileBoundingBox;return r.distanceToCamera(t)},H.prototype.isDestroyed=function(){return!1},H.prototype.destroy=function(){return this._tileProvider=this._tileProvider&&this._tileProvider.destroy(),c(this)},H.prototype._onLayerAdded=function(e,t){if(e.show){var i=this._terrainProvider;this._quadtree.forEachLoadedTile(function(t){e._createTileImagerySkeletons(t,i)&&(t.state=G.LOADING)}),this._layerOrderChanged=!0}},H.prototype._onLayerRemoved=function(e,t){this._quadtree.forEachLoadedTile(function(t){for(var i=t.data.imagery,r=-1,n=0,o=0,a=i.length;a>o;++o){var s=i[o],u=s.loadingImagery;if(l(u)||(u=s.readyImagery),u.imageryLayer===e)-1===r&&(r=o),s.freeResources(),++n;else if(-1!==r)break}-1!==r&&i.splice(r,n)})},H.prototype._onLayerMoved=function(e,t,i){this._layerOrderChanged=!0},H.prototype._onLayerShownOrHidden=function(e,t,i){i?this._onLayerAdded(e,t):this._onLayerRemoved(e,t)};var ne,oe,ae;!function(){function e(e){return new B({geometryInstances:e,appearance:new F({translucent:!1,flat:!0}),asynchronous:!1})}var i,n,o=new m({geometry:t.fromDimensions({dimensions:new r(2,2,2)})}),s=new m({geometry:new w({radius:1})}),u=new y;ne=function(t,r){return t===i?n:(ae(),i=t,u=y.fromRotationTranslation(t.halfAxes,t.center,u),o.modelMatrix=u,o.attributes.color=a.fromColor(r),n=e(o))},oe=function(t,r){return t===i?n:(ae(),i=t,u=y.fromTranslation(t.center,u),u=y.multiplyByUniformScale(u,t.radius,u),s.modelMatrix=u,s.attributes.color=a.fromColor(r),n=e(s))},ae=function(){l(n)&&(n.destroy(),n=void 0,i=void 0)}}();var se=new n(0,0,0,0);return H}),i("Scene/ImageryLayerCollection",["../Core/defaultValue","../Core/defined","../Core/defineProperties","../Core/destroyObject","../Core/DeveloperError","../Core/Event","../Core/Math","../Core/Rectangle","../ThirdParty/when","./ImageryLayer"],function(e,t,i,r,n,o,a,s,l,u){"use strict";function c(){this._layers=[],this.layerAdded=new o,this.layerRemoved=new o,this.layerMoved=new o,this.layerShownOrHidden=new o}function h(e,t){var i=e.indexOf(t);return i}function d(e,t,i){var r=e._layers;if(t=a.clamp(t,0,r.length-1),i=a.clamp(i,0,r.length-1),t!==i){var n=r[t];r[t]=r[i],r[i]=n,e._update(),e.layerMoved.raiseEvent(n,i,t)}}i(c.prototype,{length:{get:function(){return this._layers.length}}}),c.prototype.add=function(e,i){var r=t(i);r?this._layers.splice(i,0,e):(i=this._layers.length,this._layers.push(e)),this._update(),this.layerAdded.raiseEvent(e,i)},c.prototype.addImageryProvider=function(e,t){var i=new u(e);return this.add(i,t),i},c.prototype.remove=function(t,i){i=e(i,!0);var r=this._layers.indexOf(t);return-1!==r?(this._layers.splice(r,1),this._update(),this.layerRemoved.raiseEvent(t,r),i&&t.destroy(),!0):!1},c.prototype.removeAll=function(t){t=e(t,!0);for(var i=this._layers,r=0,n=i.length;n>r;r++){var o=i[r];this.layerRemoved.raiseEvent(o,r),t&&o.destroy()}this._layers=[]},c.prototype.contains=function(e){return-1!==this.indexOf(e)},c.prototype.indexOf=function(e){return this._layers.indexOf(e)},c.prototype.get=function(e){return this._layers[e]},c.prototype.raise=function(e){var t=h(this._layers,e);d(this,t,t+1)},c.prototype.lower=function(e){var t=h(this._layers,e);d(this,t,t-1)},c.prototype.raiseToTop=function(e){var t=h(this._layers,e);t!==this._layers.length-1&&(this._layers.splice(t,1),this._layers.push(e),this._update(),this.layerMoved.raiseEvent(e,this._layers.length-1,t))},c.prototype.lowerToBottom=function(e){var t=h(this._layers,e);0!==t&&(this._layers.splice(t,1),this._layers.splice(0,0,e),this._update(),this.layerMoved.raiseEvent(e,0,t))};var p=new s;return c.prototype.pickImageryLayerFeatures=function(e,i){var r=i.globe.pick(e,i);if(t(r)){for(var n,o=i.globe.ellipsoid.cartesianToCartographic(r),u=i.globe._surface._tilesToRender,c=0;!t(n)&&c<u.length;++c){var h=u[c];s.contains(h.rectangle,o)&&(n=h)}if(t(n)){for(var d=n.data.imagery,m=[],f=[],v=d.length-1;v>=0;--v){var g=d[v],_=g.readyImagery;if(t(_)){var y=_.imageryLayer.imageryProvider;if(t(y.pickFeatures)&&s.contains(_.rectangle,o)){var C=p,E=1/1024;if(C.west=a.lerp(n.rectangle.west,n.rectangle.east,g.textureCoordinateRectangle.x-E),C.east=a.lerp(n.rectangle.west,n.rectangle.east,g.textureCoordinateRectangle.z+E),C.south=a.lerp(n.rectangle.south,n.rectangle.north,g.textureCoordinateRectangle.y-E),C.north=a.lerp(n.rectangle.south,n.rectangle.north,g.textureCoordinateRectangle.w+E),s.contains(C,o)){var S=y.pickFeatures(_.x,_.y,_.level,o.longitude,o.latitude);t(S)&&(m.push(S),f.push(_.imageryLayer))}}}}if(0!==m.length)return l.all(m,function(e){for(var i=[],r=0;r<e.length;++r){var n=e[r],a=f[r];if(t(n)&&n.length>0)for(var s=0;s<n.length;++s){var l=n[s];l.imageryLayer=a,t(l.position)||(l.position=o),i.push(l)}}return i})}}},c.prototype.isDestroyed=function(){return!1},c.prototype.destroy=function(){return this.removeAll(!0),r(this)},c.prototype._update=function(){for(var e,i,r=!0,n=this._layers,o=0,a=n.length;a>o;++o)i=n[o],i._layerIndex=o,i.show?(i._isBaseLayer=r,r=!1):i._isBaseLayer=!1,i.show!==i._show&&(t(i._show)&&(t(e)||(e=[]),e.push(i)),i._show=i.show);if(t(e))for(o=0,a=e.length;a>o;++o)i=e[o],this.layerShownOrHidden.raiseEvent(i,i._layerIndex,i.show)},c}),i("Scene/QuadtreeOccluders",["../Core/Cartesian3","../Core/defineProperties","../Core/EllipsoidalOccluder"],function(e,t,i){"use strict";function r(t){this._ellipsoid=new i(t.ellipsoid,e.ZERO)}return t(r.prototype,{ellipsoid:{get:function(){return this._ellipsoid}}}),r}),i("Scene/QuadtreeTile",["../Core/defined","../Core/defineProperties","../Core/DeveloperError","../Core/Rectangle","./QuadtreeTileLoadState"],function(e,t,i,r,n){"use strict";function o(e){this._tilingScheme=e.tilingScheme,this._x=e.x,this._y=e.y,this._level=e.level,this._parent=e.parent,this._rectangle=this._tilingScheme.tileXYToRectangle(this._x,this._y,this._level),this._children=void 0,this._replacementPrevious=void 0,this._replacementNext=void 0,this._distance=0,this._customData=[],this._frameUpdated=void 0,this._frameRendered=void 0,this.state=n.START,this.renderable=!1,this.upsampledFromParent=!1,this.data=void 0}return o.createLevelZeroTiles=function(t){if(!e(t))throw new i("tilingScheme is required.");for(var r=t.getNumberOfXTilesAtLevel(0),n=t.getNumberOfYTilesAtLevel(0),a=new Array(r*n),s=0,l=0;n>l;++l)for(var u=0;r>u;++u)a[s++]=new o({tilingScheme:t,x:u,y:l,level:0});return a},o.prototype._updateCustomData=function(t,i,n){var o,a,s,l=this.customData;if(e(i)&&e(n)){for(o=0;o<n.length;++o){a=n[o];for(var u=0;u<l.length;++u)if(l[u]===a){l.splice(u,1);break}}for(s=this._rectangle,o=0;o<i.length;++o)a=i[o],r.contains(s,a.positionCartographic)&&l.push(a);this._frameUpdated=t}else{var c=this._parent;if(e(c)&&this._frameUpdated!==c._frameUpdated){l.length=0,s=this._rectangle;var h=c.customData;for(o=0;o<h.length;++o)a=h[o],r.contains(s,a.positionCartographic)&&l.push(a);this._frameUpdated=c._frameUpdated}}},t(o.prototype,{tilingScheme:{get:function(){return this._tilingScheme}},x:{get:function(){return this._x}},y:{get:function(){return this._y}},level:{get:function(){return this._level}},parent:{get:function(){return this._parent}},rectangle:{get:function(){return this._rectangle}},children:{get:function(){if(!e(this._children)){var t=this.tilingScheme,i=this.level+1,r=2*this.x,n=2*this.y;this._children=[new o({tilingScheme:t,x:r,y:n,level:i,parent:this}),new o({tilingScheme:t,x:r+1,y:n,level:i,parent:this}),new o({tilingScheme:t,x:r,y:n+1,level:i,parent:this}),new o({tilingScheme:t,x:r+1,y:n+1,level:i,parent:this})]}return this._children}},customData:{get:function(){return this._customData}},needsLoading:{get:function(){return this.state<n.DONE}},eligibleForUnloading:{get:function(){var t=!0;return e(this.data)&&(t=this.data.eligibleForUnloading,e(t)||(t=!0)),t}}}),o.prototype.freeResources=function(){if(this.state=n.START,this.renderable=!1,this.upsampledFromParent=!1,e(this.data)&&e(this.data.freeResources)&&(this.data.freeResources(),this.data=void 0),e(this._children)){for(var t=0,i=this._children.length;i>t;++t)this._children[t].freeResources();this._children=void 0}},o}),i("Scene/TileReplacementQueue",["../Core/defined"],function(e){"use strict";function t(){this.head=void 0,this.tail=void 0,this.count=0,this._lastBeforeStartOfFrame=void 0}function i(e,t){var i=t.replacementPrevious,r=t.replacementNext;t===e._lastBeforeStartOfFrame&&(e._lastBeforeStartOfFrame=r),t===e.head?e.head=r:i.replacementNext=r,t===e.tail?e.tail=i:r.replacementPrevious=i,t.replacementPrevious=void 0,t.replacementNext=void 0,--e.count}return t.prototype.markStartOfRenderFrame=function(){this._lastBeforeStartOfFrame=this.head},t.prototype.trimTiles=function(t){for(var r=this.tail,n=!0;n&&e(this._lastBeforeStartOfFrame)&&this.count>t&&e(r);){n=r!==this._lastBeforeStartOfFrame;var o=r.replacementPrevious;r.eligibleForUnloading&&(r.freeResources(),i(this,r)),r=o}},t.prototype.markTileRendered=function(t){var r=this.head;return r===t?void(t===this._lastBeforeStartOfFrame&&(this._lastBeforeStartOfFrame=t.replacementNext)):(++this.count,e(r)?((e(t.replacementPrevious)||e(t.replacementNext))&&i(this,t),t.replacementPrevious=void 0,t.replacementNext=r,r.replacementPrevious=t,void(this.head=t)):(t.replacementPrevious=void 0,t.replacementNext=void 0,this.head=t,void(this.tail=t)))},t}),i("Scene/QuadtreePrimitive",["../Core/Cartesian3","../Core/Cartographic","../Core/defaultValue","../Core/defined","../Core/defineProperties","../Core/DeveloperError","../Core/Event","../Core/getTimestamp","../Core/Math","../Core/Queue","../Core/Ray","../Core/Rectangle","../Core/Visibility","./QuadtreeOccluders","./QuadtreeTile","./QuadtreeTileLoadState","./SceneMode","./TileReplacementQueue"],function(e,t,i,r,n,o,a,s,l,u,c,h,d,p,m,f,v,g){"use strict";function _(e){this._tileProvider=e.tileProvider,this._tileProvider.quadtree=this,this._debug={enableDebugOutput:!1,maxDepth:0,tilesVisited:0,tilesCulled:0,tilesRendered:0,tilesWaitingForChildren:0,lastMaxDepth:-1,lastTilesVisited:-1,lastTilesCulled:-1,lastTilesRendered:-1,lastTilesWaitingForChildren:-1,suspendLodUpdate:!1};var t=this._tileProvider.tilingScheme,r=t.ellipsoid;this._tilesToRender=[],this._tileTraversalQueue=new u,this._tileLoadQueue=[],this._tileReplacementQueue=new g,this._levelZeroTiles=void 0,this._levelZeroTilesReady=!1,this._loadQueueTimeSlice=5,this._addHeightCallbacks=[],this._removeHeightCallbacks=[],this._tileToUpdateHeights=[],this._lastTileIndex=0,this._updateHeightsTimeSlice=2,this.maximumScreenSpaceError=i(e.maximumScreenSpaceError,2),this.tileCacheSize=i(e.tileCacheSize,100),this._occluders=new p({ellipsoid:r}),this._tileLoadProgressEvent=new a,this._lastTileLoadQueueLength=0}function y(e,t){var i=e._debug;if(!i.suspendLodUpdate){var n,o,a=e._tilesToRender;a.length=0;var s=e._tileTraversalQueue;if(s.clear(),i.maxDepth=0,i.tilesVisited=0,i.tilesCulled=0,i.tilesRendered=0,i.tilesWaitingForChildren=0,e._tileLoadQueue.length=0,e._tileReplacementQueue.markStartOfRenderFrame(),!r(e._levelZeroTiles)){if(!e._tileProvider.ready)return;var l=e._tileProvider.tilingScheme;e._levelZeroTiles=m.createLevelZeroTiles(l)}e._occluders.ellipsoid.cameraPosition=t.camera.positionWC;var u,c=e._tileProvider,h=e._occluders,p=e._levelZeroTiles,f=e._addHeightCallbacks,v=e._removeHeightCallbacks,g=t.frameNumber;if(f.length>0||v.length>0){for(n=0,o=p.length;o>n;++n)u=p[n],u._updateCustomData(g,f,v);f.length=0,v.length=0}for(n=0,o=p.length;o>n;++n)u=p[n],e._tileReplacementQueue.markTileRendered(u),u.needsLoading&&x(e,u),u.renderable&&c.computeTileVisibility(u,t,h)!==d.NONE?s.enqueue(u):(++i.tilesCulled,u.renderable||++i.tilesWaitingForChildren);for(;r(u=s.dequeue());)if(++i.tilesVisited,e._tileReplacementQueue.markTileRendered(u),u._updateCustomData(g),u.level>i.maxDepth&&(i.maxDepth=u.level),E(e,t,u)<e.maximumScreenSpaceError)w(e,u);else if(T(e,u)){var _=u.children;for(n=0,o=_.length;o>n;++n)c.computeTileVisibility(_[n],t,h)!==d.NONE?s.enqueue(_[n]):++i.tilesCulled}else w(e,u);C(e),i.enableDebugOutput&&(i.tilesVisited!==i.lastTilesVisited||i.tilesRendered!==i.lastTilesRendered||i.tilesCulled!==i.lastTilesCulled||i.maxDepth!==i.lastMaxDepth||i.tilesWaitingForChildren!==i.lastTilesWaitingForChildren)&&(console.log("Visited "+i.tilesVisited+", Rendered: "+i.tilesRendered+", Culled: "+i.tilesCulled+", Max Depth: "+i.maxDepth+", Waiting for children: "+i.tilesWaitingForChildren),i.lastTilesVisited=i.tilesVisited,i.lastTilesRendered=i.tilesRendered,i.lastTilesCulled=i.tilesCulled,i.lastMaxDepth=i.maxDepth,i.lastTilesWaitingForChildren=i.tilesWaitingForChildren)}}function C(e){var t=e._tileLoadQueue.length;t!==e._lastTileLoadQueueLength&&(e._tileLoadProgressEvent.raiseEvent(t),e._lastTileLoadQueueLength=t)}function E(e,t,i){if(t.mode===v.SCENE2D)return S(e,t,i);var r=e._tileProvider.getLevelMaximumGeometricError(i.level),n=i._distance,o=t.context.drawingBufferHeight,a=t.camera.frustum.sseDenominator,s=r*o/(n*a);return t.fog.enabled&&(s-=l.fog(n,t.fog.density)*t.fog.sse),s}function S(e,t,i){var r=t.camera,n=r.frustum,o=t.context,a=o.drawingBufferWidth,s=o.drawingBufferHeight,l=e._tileProvider.getLevelMaximumGeometricError(i.level),u=Math.max(n.top-n.bottom,n.right-n.left)/Math.max(a,s);return l/u}function w(e,t){e._tilesToRender.push(t),++e._debug.tilesRendered}function T(e,t){for(var i=!0,r=!0,n=t.children,o=0,a=n.length;a>o;++o){var s=n[o];e._tileReplacementQueue.markTileRendered(s),r=r&&s.upsampledFromParent,i=i&&s.renderable,s.needsLoading&&x(e,s)}return i||++e._debug.tilesWaitingForChildren,i&&!r}function x(e,t){e._tileLoadQueue.push(t)}function b(e,t){var i=e._tileLoadQueue,r=e._tileProvider;if(0!==i.length){e._tileReplacementQueue.trimTiles(e.tileCacheSize);for(var n=s(),o=e._loadQueueTimeSlice,a=n+o,l=i.length-1;l>=0;--l){var u=i[l];if(e._tileReplacementQueue.markTileRendered(u),r.loadTile(t,u),s()>=a)break}}}function A(i,n){for(var o=i._tileToUpdateHeights,a=i._tileProvider.terrainProvider,l=s(),u=i._updateHeightsTimeSlice,c=l+u,d=n.mode,p=n.mapProjection,m=p.ellipsoid;o.length>0;){var f=o[o.length-1];f!==i._lastTileUpdated&&(i._lastTileIndex=0);for(var g=f.customData,_=g.length,y=!1,C=i._lastTileIndex;_>C;++C){var E=g[C];if(f.level>E.level){r(E.position)||(E.position=m.cartographicToCartesian(E.positionCartographic)),d===v.SCENE3D?(e.clone(e.ZERO,M.origin),e.normalize(E.position,M.direction)):(t.clone(E.positionCartographic,D),D.height=-11500,p.project(D,R),e.fromElements(R.z,R.x,R.y,R),e.clone(R,M.origin),e.clone(e.UNIT_X,M.direction));var S=f.data.pick(M,d,p,!1,R);r(S)&&E.callback(S),E.level=f.level}else if(f.level===E.level){for(var w,T=f.children,x=T.length,b=0;x>b&&(w=T[b],!h.contains(w.rectangle,E.positionCartographic));++b);var A=a.getTileDataAvailable(w.x,w.y,w.level);(r(A)&&!A||r(parent)&&r(parent.data)&&r(parent.data.terrainData)&&!parent.data.terrainData.isChildAvailable(parent.x,parent.y,w.x,w.y))&&E.removeFunc()}if(s()>=c){y=!0;break}}if(y){i._lastTileUpdated=f,i._lastTileIndex=C;break}o.pop()}}function P(e,t){return e._distance-t._distance}function I(e,t){var i=e._tileProvider,r=e._tilesToRender,n=e._tileToUpdateHeights;r.sort(P);for(var o=0,a=r.length;a>o;++o){var s=r[o];i.showTileThisFrame(s,t),s._frameRendered!==t.frameNumber-1&&n.push(s),s._frameRendered=t.frameNumber}A(e,t)}n(_.prototype,{tileProvider:{get:function(){return this._tileProvider}},tileLoadProgressEvent:{get:function(){return this._tileLoadProgressEvent}}}),_.prototype.invalidateAllTiles=function(){var e=this._tileReplacementQueue;e.head=void 0,e.tail=void 0,e.count=0;var t=this._levelZeroTiles;if(r(t))for(var i=0;i<t.length;++i){for(var n=t[i],o=n.customData,a=o.length,s=0;a>s;++s){var l=o[s];l.level=0,this._addHeightCallbacks.push(l)}t[i].freeResources()}this._levelZeroTiles=void 0},_.prototype.forEachLoadedTile=function(e){for(var t=this._tileReplacementQueue.head;r(t);)t.state!==f.START&&e(t),t=t.replacementNext},_.prototype.forEachRenderedTile=function(e){for(var t=this._tilesToRender,i=0,r=t.length;r>i;++i)e(t[i])},_.prototype.updateHeight=function(e,t){var i=this,r={position:void 0,positionCartographic:e,level:-1,callback:t};return r.removeFunc=function(){i._removeHeightCallbacks.push(r)},i._addHeightCallbacks.push(r),r.removeFunc},_.prototype.update=function(e){var t=e.passes;t.render&&(this._tileProvider.beginUpdate(e),y(this,e),b(this,e),I(this,e),this._tileProvider.endUpdate(e)),t.pick&&this._tilesToRender.length>0&&this._tileProvider.updateForPick(e)},_.prototype.isDestroyed=function(){return!1},_.prototype.destroy=function(){this._tileProvider=this._tileProvider&&this._tileProvider.destroy()};var M=new c,D=new t,R=new e;return _}),i("Scene/Globe",["../Core/BoundingSphere","../Core/buildModuleUrl","../Core/Cartesian3","../Core/Cartographic","../Core/defaultValue","../Core/defined","../Core/defineProperties","../Core/destroyObject","../Core/DeveloperError","../Core/Ellipsoid","../Core/EllipsoidTerrainProvider","../Core/GeographicProjection","../Core/IntersectionTests","../Core/loadImage","../Core/Ray","../Core/Rectangle","../Renderer/ShaderSource","../Renderer/Texture","../Shaders/GlobeFS","../Shaders/GlobeVS","../Shaders/GroundAtmosphere","../ThirdParty/when","./GlobeSurfaceShaderSet","./GlobeSurfaceTileProvider","./ImageryLayerCollection","./QuadtreePrimitive","./SceneMode"],function(e,t,i,r,n,o,a,s,l,u,c,h,d,p,m,f,v,g,_,y,C,E,S,w,T,x,b){"use strict";function A(e){e=n(e,u.WGS84);var i=new c({ellipsoid:e}),r=new T;this._ellipsoid=e,this._imageryLayerCollection=r,this._surfaceShaderSet=new S,this._surfaceShaderSet.baseVertexShaderSource=new v({sources:[C,y]}),this._surfaceShaderSet.baseFragmentShaderSource=new v({sources:[_]}),this._surface=new x({tileProvider:new w({terrainProvider:i,imageryLayers:r,surfaceShaderSet:this._surfaceShaderSet})}),this.terrainProvider=i,this.show=!0,this.oceanNormalMapUrl=t("Assets/Textures/waterNormalsSmall.jpg"),this._oceanNormalMapUrl=void 0,this.maximumScreenSpaceError=2,this.tileCacheSize=100,this.enableLighting=!1,this.lightingFadeOutDistance=65e5,this.lightingFadeInDistance=9e6,this.showWaterEffect=!0,this.depthTestAgainstTerrain=!1,this._oceanNormalMap=void 0,this._zoomedOutOceanSpecularIntensity=.5}function P(t){return function(i,r){var n=e.distanceSquaredTo(i.pickBoundingSphere,t),o=e.distanceSquaredTo(r.pickBoundingSphere,t);return n-o}}a(A.prototype,{ellipsoid:{get:function(){return this._ellipsoid}},imageryLayers:{get:function(){return this._imageryLayerCollection}},baseColor:{get:function(){return this._surface.tileProvider.baseColor},set:function(e){this._surface.tileProvider.baseColor=e}},tileLoadProgressEvent:{get:function(){return this._surface.tileLoadProgressEvent}}});var I=[],M={start:0,stop:0};A.prototype.pick=function(t,r,n){var a=r.mode,s=r.mapProjection,l=I;l.length=0;var u,c,h=this._surface._tilesToRender,p=h.length;for(c=0;p>c;++c){u=h[c];var m=u.data;if(o(m)){var f=m.pickBoundingSphere;a!==b.SCENE3D?(e.fromRectangleWithHeights2D(u.rectangle,s,m.minimumHeight,m.maximumHeight,f),i.fromElements(f.center.z,f.center.x,f.center.y,f.center)):e.clone(m.boundingSphere3D,f);var v=d.raySphere(t,f,M);o(v)&&l.push(m)}}l.sort(P(t.origin));var g;for(p=l.length,c=0;p>c&&(g=l[c].pick(t,r.mode,r.mapProjection,!0,n),!o(g));++c);return g};var D=new i,R=new i,O=new r,N=new m;return A.prototype.getHeight=function(e){var t=this._surface._levelZeroTiles;if(o(t)){var r,n,a=t.length;for(n=0;a>n&&(r=t[n],!f.contains(r.rectangle,e));++n);if(o(r)&&f.contains(r.rectangle,e)){for(;r.renderable;){var s=r.children;for(a=s.length,n=0;a>n&&(r=s[n],!f.contains(r.rectangle,e));++n);}for(;o(r)&&(!o(r.data)||!o(r.data.pickTerrain));)r=r.parent;if(o(r)){var l=this._surface._tileProvider.tilingScheme.ellipsoid,u=l.cartographicToCartesian(e,D),c=N;i.normalize(u,c.direction);var h=r.data.pick(c,void 0,void 0,!1,R);if(o(h))return l.cartesianToCartographic(h,O).height}}}},A.prototype.update=function(e){if(this.show){var t=e.context,i=t.drawingBufferWidth,r=t.drawingBufferHeight;if(0!==i&&0!==r){var n=this._surface,a=n.tileProvider,s=this.terrainProvider,l=this.showWaterEffect&&s.ready&&s.hasWaterMask;if(l&&this.oceanNormalMapUrl!==this._oceanNormalMapUrl){var u=this.oceanNormalMapUrl;if(this._oceanNormalMapUrl=u,o(u)){var c=this;E(p(u),function(e){u===c.oceanNormalMapUrl&&(c._oceanNormalMap=c._oceanNormalMap&&c._oceanNormalMap.destroy(),c._oceanNormalMap=new g({context:t,source:e}))})}else this._oceanNormalMap=this._oceanNormalMap&&this._oceanNormalMap.destroy()}var h=e.mode,d=e.passes;d.render&&(h===b.SCENE3D?this._zoomedOutOceanSpecularIntensity=.5:this._zoomedOutOceanSpecularIntensity=0,n.maximumScreenSpaceError=this.maximumScreenSpaceError,n.tileCacheSize=this.tileCacheSize,a.terrainProvider=this.terrainProvider,a.lightingFadeOutDistance=this.lightingFadeOutDistance,a.lightingFadeInDistance=this.lightingFadeInDistance,a.zoomedOutOceanSpecularIntensity=this._zoomedOutOceanSpecularIntensity,a.hasWaterMask=l,a.oceanNormalMap=this._oceanNormalMap,a.enableLighting=this.enableLighting,n.update(e)),d.pick&&n.update(e)}}},A.prototype.isDestroyed=function(){return!1},A.prototype.destroy=function(){return this._surfaceShaderSet=this._surfaceShaderSet&&this._surfaceShaderSet.destroy(),this._surface=this._surface&&this._surface.destroy(),this._oceanNormalMap=this._oceanNormalMap&&this._oceanNormalMap.destroy(),s(this)},A}),i("Shaders/PostProcessFilters/PassThrough",[],function(){"use strict";return"uniform sampler2D u_texture;\nvarying vec2 v_textureCoordinates;\nvoid main()\n{\ngl_FragColor = texture2D(u_texture, v_textureCoordinates);\n}\n"}),i("Scene/GlobeDepth",["../Core/BoundingRectangle","../Core/Color","../Core/defined","../Core/defineProperties","../Core/destroyObject","../Core/PixelFormat","../Renderer/ClearCommand","../Renderer/Framebuffer","../Renderer/PixelDatatype","../Renderer/RenderState","../Renderer/Texture","../Shaders/PostProcessFilters/PassThrough"],function(e,t,i,r,n,o,a,s,l,u,c,h){ +var R=s(D,C[D]);I=D.toLowerCase(),M||R!==i.SAMPLER_2D||(M=!0),P[I]={type:R}}if(t(l))for(var O in l)l.hasOwnProperty(O)&&(P[O]=l[O]);var N={};for(var L in P)if(P.hasOwnProperty(L)){var F=P[L];N["u_"+L]=L;var B=t(F.count)?"["+F.count+"]":"";F.type!==i.FLOAT_MAT3&&F.type!==i.FLOAT_MAT4||F.useInFragment?(S+="uniform "+r(F.type)+" u_"+L+B+";\n",delete F.useInFragment):E+="uniform "+r(F.type)+" u_"+L+B+";\n"}var V="";y&&(V+=" mat4 skinMat = a_weight.x * u_jointMatrix[int(a_joint.x)];\n",V+=" skinMat += a_weight.y * u_jointMatrix[int(a_joint.y)];\n",V+=" skinMat += a_weight.z * u_jointMatrix[int(a_joint.z)];\n",V+=" skinMat += a_weight.w * u_jointMatrix[int(a_joint.w)];\n");var k={a_position:"position"};P.position={semantic:"POSITION",type:i.FLOAT_VEC3},E+="attribute vec3 a_position;\n",E+="varying vec3 v_positionEC;\n",V+=y?" vec4 pos = u_modelViewMatrix * skinMat * vec4(a_position,1.0);\n":" vec4 pos = u_modelViewMatrix * vec4(a_position,1.0);\n",V+=" v_positionEC = pos.xyz;\n",V+=" gl_Position = u_projectionMatrix * pos;\n",S+="varying vec3 v_positionEC;\n",A&&(k.a_normal="normal",P.normal={semantic:"NORMAL",type:i.FLOAT_VEC3},E+="attribute vec3 a_normal;\n",E+="varying vec3 v_normal;\n",V+=y?" v_normal = u_normalMatrix * mat3(skinMat) * a_normal;\n":" v_normal = u_normalMatrix * a_normal;\n",S+="varying vec3 v_normal;\n");var z;M&&(k.a_texcoord_0="texcoord_0",P.texcoord_0={semantic:"TEXCOORD_0",type:i.FLOAT_VEC2},z="v_texcoord_0",E+="attribute vec2 a_texcoord_0;\n",E+="varying vec2 "+z+";\n",V+=" "+z+" = a_texcoord_0;\n",S+="varying vec2 "+z+";\n"),y&&(k.a_joint="joint",P.joint={semantic:"JOINT",type:i.FLOAT_VEC4},k.a_weight="weight",P.weight={semantic:"WEIGHT",type:i.FLOAT_VEC4},E+="attribute vec4 a_joint;\n",E+="attribute vec4 a_weight;\n");var U=A&&("BLINN"===g||"PHONG"===g)&&t(P.specular)&&t(P.shininess),G=!1,W=!1,H="";for(var q in u)if(u.hasOwnProperty(q)){var j=u[q],Y=j.type.toLowerCase(),X=j.baseName;H+=" {\n";var Z,K,Q="u_"+X+"Color";"ambient"===Y?(W=!0,H+=" ambientLight += "+Q+";\n"):A&&(G=!0,Z="v_"+X+"Direction",K="v_"+X+"Position","point"!==Y&&(E+="varying vec3 "+Z+";\n",S+="varying vec3 "+Z+";\n",V+=" "+Z+" = mat3(u_"+X+"Transform) * vec3(0.,0.,1.);\n","directional"===Y&&(H+=" vec3 l = normalize("+Z+");\n")),"directional"!==Y?(E+="varying vec3 "+K+";\n",S+="varying vec3 "+K+";\n",V+=" "+K+" = u_"+X+"Transform[3].xyz;\n",H+=" vec3 VP = "+K+" - v_positionEC;\n",H+=" vec3 l = normalize(VP);\n",H+=" float range = length(VP);\n",H+=" float attenuation = 1.0 / (u_"+X+"Attenuation.x + ",H+="(u_"+X+"Attenuation.y * range) + ",H+="(u_"+X+"Attenuation.z * range * range));\n"):H+=" float attenuation = 1.0;\n","spot"===Y&&(H+=" float spotDot = dot(l, normalize("+Z+"));\n",H+=" if (spotDot < cos(u_"+X+"FallOff.x * 0.5))\n",H+=" {\n",H+=" attenuation = 0.0;\n",H+=" }\n",H+=" else\n",H+=" {\n",H+=" attenuation *= max(0.0, pow(spotDot, u_"+X+"FallOff.y));\n",H+=" }\n"),H+=" diffuseLight += "+Q+"* max(dot(normal,l), 0.) * attenuation;\n",U&&("BLINN"===g?(H+=" vec3 h = normalize(l + viewDir);\n",H+=" float specularIntensity = max(0., pow(max(dot(normal, h), 0.), u_shininess)) * attenuation;\n"):(H+=" vec3 reflectDir = reflect(-l, normal);\n",H+=" float specularIntensity = max(0., pow(max(dot(reflectDir, viewDir), 0.), u_shininess)) * attenuation;\n"),H+=" specularLight += "+Q+" * specularIntensity;\n")),H+=" }\n"}W||(H+=" ambientLight += vec3(0.2, 0.2, 0.2);\n"),G||"CONSTANT"===g||(H+=" vec3 l = normalize(czm_sunDirectionEC);\n",H+=" diffuseLight += vec3(1.0, 1.0, 1.0) * max(dot(normal,l), 0.);\n",U&&("BLINN"===g?(H+=" vec3 h = normalize(l + viewDir);\n",H+=" float specularIntensity = max(0., pow(max(dot(normal, h), 0.), u_shininess));\n"):(H+=" vec3 reflectDir = reflect(-l, normal);\n",H+=" float specularIntensity = max(0., pow(max(dot(reflectDir, viewDir), 0.), u_shininess));\n"),H+=" specularLight += vec3(1.0, 1.0, 1.0) * specularIntensity;\n")),E+="void main(void) {\n",E+=V,E+="}\n",S+="void main(void) {\n";var J=" vec3 color = vec3(0.0, 0.0, 0.0);\n";A&&(S+=" vec3 normal = normalize(v_normal);\n",a.doubleSided&&(S+=" if (gl_FrontFacing == false)\n",S+=" {\n",S+=" normal = -normal;\n",S+=" }\n"));var $;"CONSTANT"!==g?(t(P.diffuse)&&(S+=P.diffuse.type===i.SAMPLER_2D?" vec4 diffuse = texture2D(u_diffuse, "+z+");\n":" vec4 diffuse = u_diffuse;\n",S+=" vec3 diffuseLight = vec3(0.0, 0.0, 0.0);\n",J+=" color += diffuse.rgb * diffuseLight;\n"),U&&(S+=P.specular.type===i.SAMPLER_2D?" vec3 specular = texture2D(u_specular, "+z+").rgb;\n":" vec3 specular = u_specular.rgb;\n",S+=" vec3 specularLight = vec3(0.0, 0.0, 0.0);\n",J+=" color += specular * specularLight;\n"),$=t(P.transparency)?" gl_FragColor = vec4(color * diffuse.a, diffuse.a * u_transparency);\n":" gl_FragColor = vec4(color * diffuse.a, diffuse.a);\n"):$=t(P.transparency)?" gl_FragColor = vec4(color, u_transparency);\n":" gl_FragColor = vec4(color, 1.0);\n",t(P.emission)&&(S+=P.emission.type===i.SAMPLER_2D?" vec3 emission = texture2D(u_emission, "+z+").rgb;\n":" vec3 emission = u_emission.rgb;\n",J+=" color += emission;\n"),(t(P.ambient)||"CONSTANT"!==g)&&(S+=t(P.ambient)?P.ambient.type===i.SAMPLER_2D?" vec3 ambient = texture2D(u_ambient, "+z+").rgb;\n":" vec3 ambient = u_ambient.rgb;\n":" vec3 ambient = diffuse.rgb;\n",J+=" color += ambient * ambientLight;\n"),S+=" vec3 viewDir = -normalize(v_positionEC);\n",S+=" vec3 ambientLight = vec3(0.0, 0.0, 0.0);\n",S+=H,S+=J,S+=$,S+="}\n";var ee;ee=a.transparent?{enable:[i.DEPTH_TEST,i.BLEND],depthMask:!1,functions:{blendEquationSeparate:[i.FUNC_ADD,i.FUNC_ADD],blendFuncSeparate:[i.ONE,i.ONE_MINUS_SRC_ALPHA,i.ONE,i.ONE_MINUS_SRC_ALPHA]}}:a.doubleSided?{enable:[i.DEPTH_TEST]}:{enable:[i.CULL_FACE,i.DEPTH_TEST]},m[w]={attributes:k,parameters:P,program:b,states:ee,uniforms:N},f[T]={type:i.VERTEX_SHADER,uri:"",extras:{source:E}},f[x]={type:i.FRAGMENT_SHADER,uri:"",extras:{source:S}};var te=Object.keys(k);return v[b]={attributes:te,fragmentShader:x,vertexShader:T},w}function s(e,r){var n;switch(n=t(r.value)?r.value:r,e){case"ambient":return n instanceof String||"string"==typeof n?i.SAMPLER_2D:i.FLOAT_VEC4;case"diffuse":return n instanceof String||"string"==typeof n?i.SAMPLER_2D:i.FLOAT_VEC4;case"emission":return n instanceof String||"string"==typeof n?i.SAMPLER_2D:i.FLOAT_VEC4;case"specular":return n instanceof String||"string"==typeof n?i.SAMPLER_2D:i.FLOAT_VEC4;case"shininess":return i.FLOAT;case"transparency":return i.FLOAT;case"transparent":return i.BOOL;case"doubleSided":return i.BOOL}}function l(t){var i="";i+="technique:"+t.technique+";";for(var r=t.values,n=Object.keys(r).sort(),o=n.length,a=0;o>a;++a){var l=n[a];r.hasOwnProperty(l)&&"transparent"!==l&&"doubleSided"!==l&&(i+=l+":"+s(l,r[l]),i+=";")}var u=e(t.doubleSided,!1);i+=u.toString()+";";var c=e(t.transparent,!1);i+=c.toString()+";";var h=e(t.jointCount,0);return i+=h.toString()+";"}function u(e){if(t(e)){var i=!1,r=e.extensionsUsed;if(t(r))for(var o=r.length,s=0;o>s;++s)if("KHR_materials_common"===r[s]){i=!0,r.splice(s,1);break}if(i){t(e.programs)||(e.programs={}),t(e.shaders)||(e.shaders={}),t(e.techniques)||(e.techniques={});var u=n(e),c={},h=e.materials;for(var d in h)if(h.hasOwnProperty(d)){var p=h[d];if(t(p.extensions)&&t(p.extensions.KHR_materials_common)){var m=p.extensions.KHR_materials_common,f=l(m),v=c[f];t(v)||(v=a(e,m,u),c[f]=v),p.values={};var g=m.values;for(var _ in g)if(g.hasOwnProperty(_)){var y=g[_];t(y.value)?p.values[_]=y.value:p.values[_]=y}p.technique=v,delete p.extensions.KHR_materials_common}}t(e.extensions)&&delete e.extensions.KHR_materials_common}return e}}var c=0,h=0,d=0,p=0;return u}),i("Scene/ModelMesh",["../Core/defineProperties"],function(e){"use strict";function t(e,t,i){for(var r=[],n=e.primitives,o=n.length,a=0;o>a;++a){var s=n[a];r[a]=t[s.material]}this._name=e.name,this._materials=r,this._id=i}return e(t.prototype,{name:{get:function(){return this._name}},id:{get:function(){return this._id}},materials:{get:function(){return this._materials}}}),t}),i("Scene/ModelNode",["../Core/defaultValue","../Core/defineProperties","../Core/Matrix4"],function(e,t,i){"use strict";function r(e,t,r,n,o){this._model=e,this._runtimeNode=r,this._name=t.name,this._id=n,this.useMatrix=!1,this._show=!0,this._matrix=i.clone(o)}return t(r.prototype,{name:{get:function(){return this._name}},id:{get:function(){return this._id}},show:{get:function(){return this._show},set:function(e){this._show!==e&&(this._show=e,this._model._perNodeShowDirty=!0)}},matrix:{get:function(){return this._matrix},set:function(e){this._matrix=i.clone(e,this._matrix),this.useMatrix=!0;var t=this._model;t._cesiumAnimationsDirty=!0,this._runtimeNode.dirtyNumber=t._maxDirtyNumber}}}),r.prototype.setMatrix=function(e){i.clone(e,this._matrix)},r}),i("Scene/Model",["../Core/BoundingSphere","../Core/Cartesian2","../Core/Cartesian3","../Core/Cartesian4","../Core/clone","../Core/combine","../Core/ComponentDatatype","../Core/defaultValue","../Core/defined","../Core/defineProperties","../Core/destroyObject","../Core/DeveloperError","../Core/FeatureDetection","../Core/getAbsoluteUri","../Core/getBaseUri","../Core/getMagic","../Core/getStringFromTypedArray","../Core/IndexDatatype","../Core/loadArrayBuffer","../Core/loadImage","../Core/loadImageFromTypedArray","../Core/loadText","../Core/Math","../Core/Matrix2","../Core/Matrix3","../Core/Matrix4","../Core/PrimitiveType","../Core/Quaternion","../Core/Queue","../Core/RuntimeError","../Core/throttleRequestByServer","../Renderer/Buffer","../Renderer/BufferUsage","../Renderer/DrawCommand","../Renderer/RenderState","../Renderer/Sampler","../Renderer/ShaderProgram","../Renderer/ShaderSource","../Renderer/Texture","../Renderer/TextureMinificationFilter","../Renderer/TextureWrap","../Renderer/VertexArray","../Renderer/WebGLConstants","../ThirdParty/gltfDefaults","../ThirdParty/Uri","../ThirdParty/when","./getModelAccessor","./ModelAnimationCache","./ModelAnimationCollection","./ModelMaterial","./modelMaterialsCommon","./ModelMesh","./ModelNode","./Pass","./SceneMode"],function(e,t,i,r,n,o,a,s,l,u,c,h,d,p,m,f,v,g,_,y,C,E,S,w,T,x,b,A,P,I,M,D,R,O,N,L,F,B,V,k,z,U,G,W,H,q,j,Y,X,Z,K,Q,J,$,ee){"use strict";function te(){this.buffersToCreate=new P,this.buffers={},this.pendingBufferLoads=0,this.programsToCreate=new P,this.shaders={},this.pendingShaderLoads=0,this.texturesToCreate=new P,this.pendingTextureLoads=0,this.texturesToCreateFromBufferView=new P,this.pendingBufferViewToImage=0,this.createSamplers=!0,this.createSkins=!0,this.createRuntimeAnimations=!0,this.createVertexArrays=!0,this.createRenderStates=!0,this.createUniformMaps=!0,this.createRuntimeNodes=!0,this.createElementBuffers=!0,this.skinnedNodesIds=[]}function ie(e,t){e._cachedGltf=t,e._animationIds=ne(t)}function re(e){this._gltf=K(W(e.gltf)),this._bgltf=e.bgltf,this.ready=e.ready,this.modelsToLoad=[],this.count=0}function ne(e){var t=[];if(l(e)&&l(e.gltf)){var i=e.gltf.animations;for(var r in i)i.hasOwnProperty(r)&&t.push(r)}return t}function oe(t){t=s(t,s.EMPTY_OBJECT);var i=t.cacheKey;this._cacheKey=i,this._cachedGltf=void 0,this._releaseGltfJson=s(t.releaseGltfJson,!1),this._animationIds=void 0;var r;if(l(i)&&l(It[i])&&It[i].ready)r=It[i],++r.count;else{var n=t.gltf;if(l(n)){if(n instanceof ArrayBuffer&&(n=new Uint8Array(n)),n instanceof Uint8Array){var o=le(n);0!==o.binaryOffset&&(n=n.subarray(o.binaryOffset)),r=new re({gltf:o.glTF,bgltf:n,ready:!0})}else r=new re({gltf:t.gltf,ready:!0});r.count=1,l(i)&&(It[i]=r)}}ie(this,r),this._shaderOverride=t.shaderOverride,this._basePath=s(t.basePath,"");var a=new H(document.location.href),u=new H(this._basePath);this._baseUri=u.resolve(a),this.show=s(t.show,!0),this.modelMatrix=x.clone(s(t.modelMatrix,x.IDENTITY)),this._modelMatrix=x.clone(this.modelMatrix),this.scale=s(t.scale,1),this._scale=this.scale,this.minimumPixelSize=s(t.minimumPixelSize,0),this._minimumPixelSize=this.minimumPixelSize,this.maximumScale=t.maximumScale,this._maximumScale=this.maximumScale,this.id=t.id,this._id=t.id,this.pickPrimitive=t.pickPrimitive,this._allowPicking=s(t.allowPicking,!0),this._ready=!1,this._readyPromise=q.defer(),this.activeAnimations=new X(this),this._defaultTexture=void 0,this._incrementallyLoadTextures=s(t.incrementallyLoadTextures,!0),this._asynchronous=s(t.asynchronous,!0),this.debugShowBoundingVolume=s(t.debugShowBoundingVolume,!1),this._debugShowBoundingVolume=!1,this.debugWireframe=s(t.debugWireframe,!1),this._debugWireframe=!1,this._precreatedAttributes=t.precreatedAttributes,this._vertexShaderLoaded=t.vertexShaderLoaded,this._fragmentShaderLoaded=t.fragmentShaderLoaded,this._uniformMapLoaded=t.uniformMapLoaded,this._pickVertexShaderLoaded=t.pickVertexShaderLoaded,this._pickFragmentShaderLoaded=t.pickFragmentShaderLoaded,this._pickUniformMapLoaded=t.pickUniformMapLoaded,this._ignoreCommands=s(t.ignoreCommands,!1),this.cull=s(t.cull,!0),this._computedModelMatrix=new x,this._initialRadius=void 0,this._boundingSphere=void 0,this._scaledBoundingSphere=new e,this._state=xt.NEEDS_LOAD,this._loadResources=void 0,this._perNodeShowDirty=!1,this._cesiumAnimationsDirty=!1,this._dirty=!1,this._maxDirtyNumber=0,this._runtime={animations:void 0,rootNodes:void 0,nodes:void 0,nodesByName:void 0,skinnedNodes:void 0,meshesByName:void 0,materialsByName:void 0,materialsById:void 0},this._uniformMaps={},this._rendererResources={buffers:{},vertexArrays:{},programs:{},pickPrograms:{},textures:{},samplers:{},renderStates:{}},this._cachedRendererResources=void 0,this._loadRendererResourcesFromCache=!1,this._nodeCommands=[],this._pickIds=[],this._rtcCenter=void 0,this._rtcCenterEye=void 0,this._loadOptions=t.loadOptions}function ae(e,t,i){return e.subarray(t,t+i)}function se(e){var t=f(e);return"glTF"===t}function le(e){if(!se(e))throw new h("bgltf is not a valid Binary glTF file.");var t=new DataView(e.buffer,e.byteOffset,e.byteLength),i=0;i+=Mt,i+=Mt,i+=Mt;var r=t.getUint32(i,!0);i+=Mt+Mt;var n=i,o=n+r,a=v(e,n,r);return{glTF:JSON.parse(a),binaryOffset:o}}function ue(e,t,i){return e._runtime[t][i]}function ce(t){for(var r=t.nodes,n=t.meshes,o=t.accessors,a=t.scenes[t.scene].nodes,s=a.length,u=[],c=new i(Number.MAX_VALUE,Number.MAX_VALUE,Number.MAX_VALUE),h=new i(-Number.MAX_VALUE,-Number.MAX_VALUE,-Number.MAX_VALUE),d=0;s>d;++d){var p=r[a[d]];for(p._transformToRoot=Ce(p),u.push(p);u.length>0;){p=u.pop();var m=p._transformToRoot,f=p.meshes;if(l(f))for(var v=f.length,g=0;v>g;++g)for(var _=n[f[g]].primitives,y=_.length,C=0;y>C;++C){var E=_[C].attributes.POSITION;if(l(E)){var S=o[E],w=i.fromArray(S.min,0,Dt),T=i.fromArray(S.max,0,Rt);l(c)&&l(h)&&(x.multiplyByPoint(m,w,w),x.multiplyByPoint(m,T,T),i.minimumByComponent(c,w,c),i.maximumByComponent(h,T,h))}}for(var b=p.children,A=b.length,P=0;A>P;++P){var I=r[b[P]];I._transformToRoot=Ce(I),x.multiplyTransformation(m,I._transformToRoot,I._transformToRoot),u.push(I)}delete p._transformToRoot}}var M=e.fromCornerPoints(c,h);return e.transformWithoutScale(M,wt,M)}function he(e,t,i){return function(){e._state=xt.FAILED,e._readyPromise.reject(new I("Failed to load "+t+": "+i))}}function de(e,t){return function(i){var r=e._loadResources;r.buffers[t]=new Uint8Array(i),--r.pendingBufferLoads}}function pe(e){var t=e.gltf.buffers;for(var i in t)if(t.hasOwnProperty(i)){var r=t[i];if("binary_glTF"===i||"KHR_binary_glTF"===i){var n=e._loadResources;n.buffers[i]=e._cachedGltf.bgltf}else if("arraybuffer"===r.type){++e._loadResources.pendingBufferLoads;var o=new H(r.uri),a=o.resolve(e._baseUri).toString();_(a).then(de(e,i)).otherwise(he(e,"buffer",a))}}}function me(e){var t=e.gltf.bufferViews;for(var i in t)t.hasOwnProperty(i)&&t[i].target===G.ARRAY_BUFFER&&e._loadResources.buffersToCreate.enqueue(i)}function fe(e,t){return function(i){var r=e._loadResources;r.shaders[t]={source:i,bufferView:void 0},--r.pendingShaderLoads}}function ve(e){var t=e.gltf.shaders;if(!l(e._shaderParser)||!e._shaderParser(t))for(var i in t)if(t.hasOwnProperty(i)){var r=t[i];if(l(r.extras)&&l(r.extras.source))e._loadResources.shaders[i]={source:r.extras.source,bufferView:void 0};else if(l(r.extensions)&&l(r.extensions.KHR_binary_glTF)){var n=r.extensions.KHR_binary_glTF;e._loadResources.shaders[i]={source:void 0,bufferView:n.bufferView}}else{var o;if(e._shaderOverride&&(o=e._shaderOverride(r,i,e.gltf)))++e._loadResources.pendingShaderLoads,fe(e,i)(o);else{++e._loadResources.pendingShaderLoads;var a=new H(r.uri),s=a.resolve(e._baseUri).toString();E(s,e._loadOptions).then(fe(e,i)).otherwise(he(e,"shader",s))}}}}function ge(e){var t=e.gltf.programs;for(var i in t)t.hasOwnProperty(i)&&e._loadResources.programsToCreate.enqueue(i)}function _e(e,t){return function(i){var r=e._loadResources;--r.pendingTextureLoads,r.texturesToCreate.enqueue({id:t,image:i,bufferView:void 0})}}function ye(e){var t=e.gltf.images,i=e.gltf.textures;for(var r in i)if(i.hasOwnProperty(r)){var n=t[i[r].source];if(l(n.extensions)&&l(n.extensions.KHR_binary_glTF)){var o=n.extensions.KHR_binary_glTF;e._loadResources.texturesToCreateFromBufferView.enqueue({id:r,image:void 0,bufferView:o.bufferView,mimeType:o.mimeType})}else{var a=new H(n.uri),s=a.resolve(e._baseUri).toString(),u=At.textures.get(s);if(u)u.ref(),e._rendererResources.textures[r]=u;else{var c=At.images.get(s);++e._loadResources.pendingTextureLoads,l(c)?(c.ref(),c.then(function(e,t){_e(this,e)(t),c=void 0}.bind(e,r))):c=At.images.set(s,y(s).then(function(e,t){return _e(this,e)(t),c=void 0,t}.bind(e,r)).otherwise(he(e,"image",s)))}}}}function Ce(e){return l(e.matrix)?x.fromArray(e.matrix):x.fromTranslationQuaternionRotationScale(i.fromArray(e.translation,0,Ot),A.unpack(e.rotation,0,Nt),i.fromArray(e.scale,0,Lt))}function Ee(e){var t={},i={},r=[],n=e._loadResources.skinnedNodesIds,o=e.gltf.nodes;for(var a in o)if(o.hasOwnProperty(a)){var s=o[a],u={matrix:void 0,translation:void 0,rotation:void 0,scale:void 0,computedShow:!0,transformToRoot:new x,computedMatrix:new x,dirtyNumber:0,commands:[],inverseBindMatrices:void 0,bindShapeMatrix:void 0,joints:[],computedJointMatrices:[],jointName:s.jointName,children:[],parents:[],publicNode:void 0};u.publicNode=new J(e,s,u,a,Ce(s)),t[a]=u,i[s.name]=u,l(s.skin)&&(n.push(a),r.push(u))}e._runtime.nodes=t,e._runtime.nodesByName=i,e._runtime.skinnedNodes=r}function Se(e){var t={},i={},r=e.gltf.materials,n=e._uniformMaps;for(var o in r)if(r.hasOwnProperty(o)){n[o]={uniformMap:void 0,values:void 0,jointMatrixUniformName:void 0};var a=r[o],s=new Z(e,a,o);t[a.name]=s,i[o]=s}e._runtime.materialsByName=t,e._runtime.materialsById=i}function we(e){var t={},i=e._runtime.materialsById,r=e.gltf.meshes;for(var n in r)if(r.hasOwnProperty(n)){var o=r[n];t[o.name]=new Q(o,i,n)}e._runtime.meshesByName=t}function Te(e){e._loadRendererResourcesFromCache||(pe(e),me(e),ve(e),ge(e),ye(e)),Se(e),we(e),Ee(e)}function xe(e,t){var i=e._loadResources;if(0===i.pendingBufferLoads){for(var r,n=e.gltf.bufferViews,o=e._rendererResources.buffers;i.buffersToCreate.length>0;){var a=i.buffersToCreate.dequeue();r=n[a];var s=D.createVertexBuffer({context:t,typedArray:i.getBuffer(r),usage:R.STATIC_DRAW});s.vertexArrayDestroyable=!1,o[a]=s}if(i.createElementBuffers){var u=e.gltf.accessors;for(var c in u)if(u.hasOwnProperty(c)){var h=u[c];if(r=n[h.bufferView],r.target===G.ELEMENT_ARRAY_BUFFER&&!l(o[h.bufferView])){var d=D.createIndexBuffer({context:t,typedArray:i.getBuffer(r),usage:R.STATIC_DRAW,indexDatatype:h.componentType});d.vertexArrayDestroyable=!1,o[h.bufferView]=d}}i.createElementBuffers=!1}}}function be(e){for(var t={},i=e.length,r=0;i>r;++r)t[e[r]]=r;return t}function Ae(e,t){if(l(t.source))return t.source;var i=e._loadResources,r=e.gltf,n=r.bufferViews[t.bufferView];return v(i.getBuffer(n))}function Pe(e,t,i){return l(i)&&(e=i(e,t)),e}function Ie(e,t,i){var r=t.gltf.programs,n=t._loadResources.shaders,o=r[e],a=be(o.attributes),s=Ae(t,n[o.vertexShader]),u=Ae(t,n[o.fragmentShader]),c=Pe(s,e,t._vertexShaderLoaded),h=Pe(u,e,t._fragmentShaderLoaded),d=o.attributes.length,p=t._precreatedAttributes;if(l(p))for(var m in p)p.hasOwnProperty(m)&&(a[m]=d++);if(t._rendererResources.programs[e]=F.fromCache({context:i,vertexShaderSource:c,fragmentShaderSource:h,attributeLocations:a}),t.allowPicking){var f=Pe(s,e,t._pickVertexShaderLoaded),v=Pe(u,e,t._pickFragmentShaderLoaded);t._pickFragmentShaderLoaded||(v=B.createPickFragmentShaderSource(u,"uniform")),t._rendererResources.pickPrograms[e]=F.fromCache({context:i,vertexShaderSource:f,fragmentShaderSource:v,attributeLocations:a})}}function Me(e,t){var i,r=e._loadResources;if(0===r.pendingShaderLoads&&0===r.pendingBufferLoads)if(e.asynchronous)r.programsToCreate.length>0&&(i=r.programsToCreate.dequeue(),Ie(i,e,t));else for(;r.programsToCreate.length>0;)i=r.programsToCreate.dequeue(),Ie(i,e,t)}function De(e,t){return function(i){e.texturesToCreate.enqueue({id:t.id,image:i,bufferView:void 0}),--e.pendingBufferViewToImage}}function Re(e){var t=e._loadResources;if(0===t.pendingBufferLoads)for(;t.texturesToCreateFromBufferView.length>0;){var i=t.texturesToCreateFromBufferView.dequeue(),r=e.gltf,n=r.bufferViews[i.bufferView],o=De(t,i),a=he(e,"image","id: "+i.id+", bufferView: "+i.bufferView);C(t.getBuffer(n),i.mimeType).then(o).otherwise(a),++t.pendingBufferViewToImage}}function Oe(e,t){var i=e._loadResources;if(i.createSamplers){i.createSamplers=!1;var r=e._rendererResources.samplers,n=e.gltf.samplers;for(var o in n)if(n.hasOwnProperty(o)){var a=n[o];r[o]=new L({wrapS:a.wrapS,wrapT:a.wrapT,minificationFilter:a.minFilter,magnificationFilter:a.magFilter})}}}function Ne(e,t,i){var r=e.image.src,n=At.textures.get(r);if(n)return t._rendererResources.textures[e.id]=n,n.ref(),void At.images.get(r).unref();var o=t.gltf.textures,n=o[e.id],a=t._rendererResources.samplers,s=a[n.sampler],l=s.minificationFilter===k.NEAREST_MIPMAP_NEAREST||s.minificationFilter===k.NEAREST_MIPMAP_LINEAR||s.minificationFilter===k.LINEAR_MIPMAP_NEAREST||s.minificationFilter===k.LINEAR_MIPMAP_LINEAR,u=l||s.wrapS===z.REPEAT||s.wrapS===z.MIRRORED_REPEAT||s.wrapT===z.REPEAT||s.wrapT===z.MIRRORED_REPEAT,c=e.image,h=!S.isPowerOfTwo(c.width)||!S.isPowerOfTwo(c.height);if(u&&h){var d=document.createElement("canvas");d.width=S.nextPowerOfTwo(c.width),d.height=S.nextPowerOfTwo(c.height);var p=d.getContext("2d");p.drawImage(c,0,0,c.width,c.height,0,0,d.width,d.height),c=d}var m;n.target===G.TEXTURE_2D&&(m=new V({context:i,source:c,pixelFormat:n.internalFormat,pixelDatatype:n.type,sampler:s,flipY:!1})),l&&m.generateMipmap(),t._rendererResources.textures[e.id]=m,At.textures.set(r,m),At.images.get(r).unref()}function Le(e,t){var i,r=e._loadResources;if(e.asynchronous)r.texturesToCreate.length>0&&(i=r.texturesToCreate.dequeue(),Ne(i,e,t));else for(;r.texturesToCreate.length>0;)i=r.texturesToCreate.dequeue(),Ne(i,e,t)}function Fe(e,t){var i=e.gltf,r=i.techniques,n=i.materials,o={},a=r[n[t.material].technique],s=a.parameters,u=a.attributes,c=e._rendererResources.programs[a.program].vertexAttributes;for(var h in c)if(c.hasOwnProperty(h)){var d=u[h],p=c[h].index;if(l(d)){var m=s[d];o[m.semantic]=p}else o[h]=p}return o}function Be(e,t,i){for(var r=e.length,n=0;r>n;++n)for(var o=[e[n]];o.length>0;){var a=o.pop(),s=i[a];if(s.jointName===t)return a;for(var l=s.children,u=l.length,c=0;u>c;++c)o.push(l[c])}}function Ve(e,t){for(var i=e.gltf,r=i.skins,n=i.nodes,o=e._runtime.nodes,a=e._loadResources.skinnedNodesIds,s=a.length,l=0;s>l;++l){var u=a[l],c=o[u],h=n[u],d=t[h.skin];c.inverseBindMatrices=d.inverseBindMatrices,c.bindShapeMatrix=d.bindShapeMatrix;for(var p=[],m=h.skeletons,f=m.length,v=0;f>v;++v)p.push(m[v]);for(var g=r[h.skin].jointNames,_=g.length,y=0;_>y;++y){var C=g[y],E=o[Be(p,C,n)];c.joints.push(E)}}}function ke(e){var t=e._loadResources;if(0===t.pendingBufferLoads&&t.createSkins){t.createSkins=!1;var i=e.gltf,r=i.accessors,n=i.skins,o={};for(var a in n)if(n.hasOwnProperty(a)){var s,l=n[a],u=r[l.inverseBindMatrices];x.equals(l.bindShapeMatrix,x.IDENTITY)||(s=x.clone(l.bindShapeMatrix)),o[a]={inverseBindMatrices:Y.getSkinInverseBindMatrices(e,u),bindShapeMatrix:s}}Ve(e,o)}}function ze(e,t,i,r){return function(n){t[i]=r.evaluate(n,t[i]),t.dirtyNumber=e._maxDirtyNumber}}function Ue(e){var t=e._loadResources;if(t.finishedPendingBufferLoads()&&t.createRuntimeAnimations){t.createRuntimeAnimations=!1,e._runtime.animations={};var i=e._runtime.nodes,r=e.gltf.animations,n=e.gltf.accessors;for(var o in r)if(r.hasOwnProperty(o)){var a=r[o],s=a.channels,l=a.parameters,u=a.samplers,c={};for(var h in l)l.hasOwnProperty(h)&&(c[h]=Y.getAnimationParameterValues(e,n[l[h]]));for(var d=Number.MAX_VALUE,p=-Number.MAX_VALUE,m=s.length,f=new Array(m),v=0;m>v;++v){var g=s[v],_=g.target,y=u[g.sampler],C=c[y.input];d=Math.min(d,C[0]),p=Math.max(p,C[C.length-1]);var E=Y.getAnimationSpline(e,o,a,g.sampler,y,c);f[v]=ze(e,i[_.id],_.path,E)}e._runtime.animations[o]={startTime:d,stopTime:p,channelEvaluators:f}}}}function Ge(e,t){var i=e._loadResources;if(i.finishedBuffersCreation()&&i.finishedProgramCreation()&&i.createVertexArrays){i.createVertexArrays=!1;var r=e._rendererResources.buffers,n=e._rendererResources.vertexArrays,o=e.gltf,a=o.accessors,s=o.meshes;for(var u in s)if(s.hasOwnProperty(u))for(var c=s[u].primitives,h=c.length,d=0;h>d;++d){var p,m,f,v=c[d],g=Fe(e,v),_=[],y=v.attributes;for(p in y)if(y.hasOwnProperty(p)&&(m=g[p],l(m))){var C=a[y[p]];_.push({index:m,vertexBuffer:r[C.bufferView],componentsPerAttribute:j(C).componentsPerAttribute,componentDatatype:C.componentType,normalize:!1,offsetInBytes:C.byteOffset,strideInBytes:C.byteStride})}var E=e._precreatedAttributes;if(l(E))for(p in E)E.hasOwnProperty(p)&&(m=g[p],l(m)&&(f=E[p],f.index=m,_.push(f)));var S;if(l(v.indices)){var w=a[v.indices];S=r[w.bufferView]}n[u+".primitive."+d]=new U({context:t,attributes:_,indexBuffer:S})}}}function We(e){var t={};t[G.BLEND]=!1,t[G.CULL_FACE]=!1,t[G.DEPTH_TEST]=!1,t[G.POLYGON_OFFSET_FILL]=!1,t[G.SCISSOR_TEST]=!1;var i,r=e.enable,n=r.length;for(i=0;n>i;++i)t[r[i]]=!0;return t}function He(e,t){var i=e._loadResources;if(i.createRenderStates){i.createRenderStates=!1;var r=e._rendererResources.renderStates,n=e.gltf.techniques;for(var o in n)if(n.hasOwnProperty(o)){var a=n[o],u=a.states,c=We(u),h=s(u.functions,s.EMPTY_OBJECT),d=s(h.blendColor,[0,0,0,0]),p=s(h.blendEquationSeparate,[G.FUNC_ADD,G.FUNC_ADD]),m=s(h.blendFuncSeparate,[G.ONE,G.ONE,G.ZERO,G.ZERO]),f=s(h.colorMask,[!0,!0,!0,!0]),v=s(h.depthRange,[0,1]),g=s(h.polygonOffset,[0,0]),_=s(h.scissor,[0,0,0,0]);r[o]=N.fromCache({frontFace:l(h.frontFace)?h.frontFace[0]:G.CCW,cull:{enabled:c[G.CULL_FACE],face:l(h.cullFace)?h.cullFace[0]:G.BACK},lineWidth:l(h.lineWidth)?h.lineWidth[0]:1,polygonOffset:{enabled:c[G.POLYGON_OFFSET_FILL],factor:g[0],units:g[1]},scissorTest:{enabled:c[G.SCISSOR_TEST],rectangle:{x:_[0],y:_[1],width:_[2],height:_[3]}},depthRange:{near:v[0],far:v[1]},depthTest:{enabled:c[G.DEPTH_TEST],func:l(h.depthFunc)?h.depthFunc[0]:G.LESS},colorMask:{red:f[0],green:f[1],blue:f[2],alpha:f[3]},depthMask:l(h.depthMask)?h.depthMask[0]:!0,blending:{enabled:c[G.BLEND],color:{red:d[0],green:d[1],blue:d[2],alpha:d[3]},equationRgb:p[0],equationAlpha:p[1],functionSourceRgb:m[0],functionSourceAlpha:m[1],functionDestinationRgb:m[2],functionDestinationAlpha:m[3]}})}}}function qe(e,t){var i={value:e,clone:function(e,t){return e},func:function(){return i.value}};return i}function je(e,i){var r={value:t.fromArray(e),clone:t.clone,func:function(){return r.value}};return r}function Ye(e,t){var r={value:i.fromArray(e),clone:i.clone,func:function(){return r.value}};return r}function Xe(e,t){var i={value:r.fromArray(e),clone:r.clone,func:function(){return i.value}};return i}function Ze(e,t){var i={value:w.fromColumnMajorArray(e),clone:w.clone,func:function(){return i.value}};return i}function Ke(e,t){var i={value:T.fromColumnMajorArray(e),clone:T.clone,func:function(){return i.value}};return i}function Qe(e,t){var i={value:x.fromColumnMajorArray(e),clone:x.clone,func:function(){return i.value}};return i}function Je(e,t){this._value=void 0,this._textureId=e,this._model=t}function $e(e,t){var i=new Je(e,t);return i.func=function(){return i.value},i}function et(e,t,i,r){var n=t._runtime.nodes[e];return kt[i](r,t,n)}function tt(e,t){var i=e._loadResources;if(i.finishedProgramCreation()&&i.createUniformMaps){i.createUniformMaps=!1;var r=e.gltf,n=r.materials,o=r.techniques,a=e._uniformMaps;for(var s in n)if(n.hasOwnProperty(s)){var u,c=n[s],h=c.values,d=o[c.technique],p=d.parameters,m=d.uniforms,f={},v={};for(var g in m)if(m.hasOwnProperty(g)){var _=m[g],y=p[_];if(l(h[_])){var C=Vt[y.type](h[_],e);f[g]=C.func,v[_]=C}else if(l(y.node))f[g]=et(y.node,e,y.semantic,t.uniformState);else if(l(y.semantic))"JOINTMATRIX"!==y.semantic?f[g]=Bt[y.semantic](t.uniformState,e):u=g;else if(l(y.value)){var E=Vt[y.type](y.value,e);f[g]=E.func,v[_]=E}}var S=a[s];S.uniformMap=f,S.values=v,S.jointMatrixUniformName=u}}}function it(e){return function(){return e}}function rt(e){return function(){return e.computedJointMatrices}}function nt(t,r,n,u){for(var c=t._nodeCommands,h=t._pickIds,d=t.allowPicking,p=t._runtime.meshesByName,m=t._rendererResources,f=m.vertexArrays,v=m.programs,_=m.pickPrograms,y=m.renderStates,C=t._uniformMaps,E=t.gltf,S=E.accessors,w=E.meshes,T=E.techniques,b=E.materials,A=r.meshes,P=A.length,I=0;P>I;++I)for(var M=A[I],D=w[M],R=D.primitives,N=R.length,L=0;N>L;++L){var F,B=R[L],V=S[B.indices],k=b[B.material],z=T[k.technique],U=z.program,G=B.attributes.POSITION;if(l(G)){var W=S[G];F=e.fromCornerPoints(i.fromArray(W.min),i.fromArray(W.max))}var H,q,Y=f[M+".primitive."+L];if(l(V))q=V.count,H=V.byteOffset/g.getSizeInBytes(V.componentType);else{var X=S[B.attributes.POSITION];q=X.count;var Z=j(X);H=X.byteOffset/(Z.componentsPerAttribute*a.getSizeInBytes(X.componentType))}var K=C[B.material],Q=K.uniformMap;if(l(K.jointMatrixUniformName)){var J={};J[K.jointMatrixUniformName]=rt(n),Q=o(Q,J)}l(t._uniformMapLoaded)&&(Q=t._uniformMapLoaded(Q,U,n));var ee,te=y[k.technique],ie=te.blending.enabled,re={primitive:s(t.pickPrimitive,t),id:t.id,node:n.publicNode,mesh:p[D.name]},ne=new O({boundingVolume:new e,cull:t.cull,modelMatrix:new x,primitiveType:B.mode,vertexArray:Y,count:q,offset:H,shaderProgram:v[z.program],uniformMap:Q,renderState:te,owner:re,pass:ie?$.TRANSLUCENT:$.OPAQUE});if(d){var oe;if(l(t._pickFragmentShaderLoaded))oe=l(t._pickUniformMapLoaded)?t._pickUniformMapLoaded(Q):o(Q);else{var ae=u.createPickId(re);h.push(ae);var se={czm_pickColor:it(ae.color)};oe=o(Q,se)}ee=new O({boundingVolume:new e,cull:t.cull,modelMatrix:new x,primitiveType:B.mode,vertexArray:Y,count:q,offset:H,shaderProgram:_[z.program],uniformMap:oe,renderState:te,owner:re,pass:ie?$.TRANSLUCENT:$.OPAQUE})}var le={show:!0,boundingSphere:F,command:ne,pickCommand:ee};n.commands.push(le),c.push(le)}}function ot(e,t){var r=e._loadResources;if(r.finishedEverythingButTextureCreation()&&r.createRuntimeNodes){r.createRuntimeNodes=!1;for(var n=[],o=e._runtime.nodes,a=e.gltf,s=a.nodes,u=a.scenes[a.scene],c=u.nodes,h=c.length,d=[],p=0;h>p;++p)for(d.push({parentRuntimeNode:void 0,gltfNode:s[c[p]],id:c[p]});d.length>0;){var m=d.pop(),f=m.parentRuntimeNode,v=m.gltfNode,g=o[m.id];if(0===g.parents.length)if(l(v.matrix))g.matrix=x.fromColumnMajorArray(v.matrix);else{var _=v.rotation;g.translation=i.fromArray(v.translation),g.rotation=A.unpack(_),g.scale=i.fromArray(v.scale)}l(f)?(f.children.push(g),g.parents.push(f)):n.push(g),l(v.meshes)&&nt(e,v,g,t);for(var y=v.children,C=y.length,E=0;C>E;++E)d.push({parentRuntimeNode:g,gltfNode:s[y[E]],id:y[E]})}e._runtime.rootNodes=n,e._runtime.nodes=o}}function at(e,t){var i=t.context;if(e._loadRendererResourcesFromCache){var r=e._rendererResources,n=e._cachedRendererResources;n.assign(r),l(e._precreatedAttributes)&&Ge(e,i)}else xe(e,i),Me(e,i),Oe(e,i),Re(e),Le(e,i);ke(e),Ue(e),e._loadRendererResourcesFromCache||(Ge(e,i),He(e,i)),tt(e,i),ot(e,i)}function st(e,t){var i=e.publicNode,r=i.matrix;i.useMatrix&&l(r)?x.clone(r,t):l(e.matrix)?x.clone(e.matrix,t):(x.fromTranslationQuaternionRotationScale(e.translation,e.rotation,e.scale,t), +i.setMatrix(t))}function lt(t,r,n){for(var o=t._maxDirtyNumber,a=t.allowPicking,s=t._runtime.rootNodes,u=s.length,c=zt,h=t._computedModelMatrix,d=0;u>d;++d){var p=s[d];for(st(p,p.transformToRoot),c.push(p);c.length>0;){p=c.pop();var m=p.transformToRoot,f=p.commands;if(p.dirtyNumber===o||r||n){var v=x.multiplyTransformation(h,m,p.computedMatrix),g=f.length;if(g>0)for(var _=0;g>_;++_){var y=f[_],C=y.command;if(x.clone(v,C.modelMatrix),e.transform(y.boundingSphere,C.modelMatrix,C.boundingVolume),l(t._rtcCenter)&&i.add(t._rtcCenter,C.boundingVolume.center,C.boundingVolume.center),a){var E=y.pickCommand;x.clone(C.modelMatrix,E.modelMatrix),e.clone(C.boundingVolume,E.boundingVolume)}}}for(var S=p.children,w=S.length,T=0;w>T;++T){var b=S[T];b.dirtyNumber=Math.max(b.dirtyNumber,p.dirtyNumber),(b.dirtyNumber===o||n)&&(st(b,b.transformToRoot),x.multiplyTransformation(m,b.transformToRoot,b.transformToRoot)),c.push(b)}}}++t._maxDirtyNumber}function ut(e){for(var t=e._runtime.skinnedNodes,i=t.length,r=0;i>r;++r){var n=t[r];Ut=x.inverseTransformation(n.transformToRoot,Ut);for(var o=n.computedJointMatrices,a=n.joints,s=n.bindShapeMatrix,u=n.inverseBindMatrices,c=u.length,h=0;c>h;++h)l(o[h])||(o[h]=new x),o[h]=x.multiplyTransformation(Ut,a[h].transformToRoot,o[h]),o[h]=x.multiplyTransformation(o[h],u[h],o[h]),l(s)&&(o[h]=x.multiplyTransformation(o[h],s,o[h]))}}function ct(e){for(var t=e._runtime.rootNodes,i=t.length,r=zt,n=0;i>n;++n){var o=t[n];for(o.computedShow=o.publicNode.show,r.push(o);r.length>0;){o=r.pop();for(var a=o.computedShow,s=o.commands,l=s.length,u=0;l>u;++u)s[u].show=a;for(var c=o.children,h=c.length,d=0;h>d;++d){var p=c[d];p.computedShow=a&&p.publicNode.show,r.push(p)}}}}function ht(e,t){var i=e.id;if(e._id!==i){e._id=i;for(var r=e._pickIds,n=r.length,o=0;n>o;++o)r[o].object.id=i}}function dt(e){if(e._debugWireframe!==e.debugWireframe){e._debugWireframe=e.debugWireframe;for(var t=e.debugWireframe?b.LINES:b.TRIANGLES,i=e._nodeCommands,r=i.length,n=0;r>n;++n)i[n].command.primitiveType=t}}function pt(e){if(e.debugShowBoundingVolume!==e._debugShowBoundingVolume){e._debugShowBoundingVolume=e.debugShowBoundingVolume;for(var t=e.debugShowBoundingVolume,i=e._nodeCommands,r=i.length,n=0;r>n;n++)i[n].command.debugShowBoundingVolume=t}}function mt(e,t,i){return Gt.center=e,Gt.radius=t,i.camera.getPixelSize(Gt,i.context.drawingBufferWidth,i.context.drawingBufferHeight)}function ft(e,t){var r=e.scale;if(0!==e.minimumPixelSize){var n=t.context,o=Math.max(n.drawingBufferWidth,n.drawingBufferHeight),a=e.modelMatrix;Wt.x=a[12],Wt.y=a[13],Wt.z=a[14],l(e._rtcCenter)&&i.add(e._rtcCenter,Wt,Wt);var s=e.boundingSphere.radius,u=mt(Wt,s,t),c=1/u,h=Math.min(c*(2*s),o);h<e.minimumPixelSize&&(r=e.minimumPixelSize*u/(2*e._initialRadius))}return l(e.maximumScale)?Math.min(e.maximumScale,r):r}function vt(e){l(e._cacheKey)&&l(e._cachedGltf)&&0===--e._cachedGltf.count&&delete It[e._cacheKey],e._cachedGltf=void 0}function gt(e){var t=e.gltf.extensionsUsed;if(l(t))for(var i=t.length,r=0;i>r;++r){var n=t[r];if("CESIUM_RTC"!==n&&"KHR_binary_glTF"!==n&&"KHR_materials_common"!==n)throw new I("Unsupported glTF Extension: "+n)}}function _t(e,t){this.buffers=void 0,this.vertexArrays=void 0,this.programs=void 0,this.pickPrograms=void 0,this.textures=void 0,this.samplers=void 0,this.renderStates=void 0,this.ready=!1,this.context=e,this.cacheKey=t,this.count=0}function yt(e){for(var t in e)e.hasOwnProperty(t)&&(l(e[t].unref)?e[t].unref():e[t].destroy())}function Ct(e){yt(e.buffers),yt(e.vertexArrays),yt(e.programs),yt(e.pickPrograms),yt(e.textures)}function Et(e){for(var t in e)e.hasOwnProperty(t)&&e[t].ref&&e[t].ref()}function St(e){for(var t in e)e.hasOwnProperty(t)&&e[t].unref&&e[t].unref()}if(!d.supportsTypedArrays())return{};var wt=x.fromRotationTranslation(T.fromRotationX(S.PI_OVER_TWO)),Tt=new i,xt={NEEDS_LOAD:0,LOADING:1,LOADED:2,FAILED:3},bt=function(e){this.map={},this.name=e};bt.prototype.get=function(e){return this.map[e]},bt.prototype.clear=function(){return this.map={},this},bt.prototype.size=function(){var e=0;for(var t in this.map)this.map.hasOwnProperty(t)&&e++;return e},bt.prototype.set=function(e,t){this.map[e]=t;var i=this;return t._cacheRefCount=1,t.ref=function(){t._cacheRefCount++},t.unref=function(){t._cacheRefCount--,0===t._cacheRefCount&&(delete i.map[e],t.destroy&&t.destroy())},t};var At={textures:new bt("texture"),images:new bt("image")},Pt="model/vnd.gltf.binary,model/vnd.gltf+json,model/gltf.binary,model/gltf+json;q=0.8,application/json;q=0.2,*/*;q=0.01";te.prototype.getBuffer=function(e){return ae(this.buffers[e.buffer],e.byteOffset,e.byteLength)},te.prototype.finishedPendingBufferLoads=function(){return 0===this.pendingBufferLoads},te.prototype.finishedBuffersCreation=function(){return 0===this.pendingBufferLoads&&0===this.buffersToCreate.length},te.prototype.finishedProgramCreation=function(){return 0===this.pendingShaderLoads&&0===this.programsToCreate.length},te.prototype.finishedTextureCreation=function(){var e=0===this.pendingTextureLoads,t=0===this.texturesToCreate.length&&0===this.texturesToCreateFromBufferView.length;return e&&t},te.prototype.finishedEverythingButTextureCreation=function(){var e=0===this.pendingBufferLoads&&0===this.pendingShaderLoads,t=0===this.buffersToCreate.length&&0===this.programsToCreate.length&&0===this.pendingBufferViewToImage;return e&&t},te.prototype.finished=function(){return this.finishedTextureCreation()&&this.finishedEverythingButTextureCreation()},u(re.prototype,{gltf:{set:function(e){this._gltf=K(W(e))},get:function(){return this._gltf}},bgltf:{get:function(){return this._bgltf}}}),re.prototype.makeReady=function(e,t){this.gltf=e,this._bgltf=t;for(var i=this.modelsToLoad,r=i.length,n=0;r>n;++n){var o=i[n];o.isDestroyed()||ie(o,this)}this.modelsToLoad=void 0,this.ready=!0};var It={};u(oe.prototype,{gltf:{get:function(){return l(this._cachedGltf)?this._cachedGltf.gltf:void 0}},releaseGltfJson:{get:function(){return this._releaseGltfJson}},cacheKey:{get:function(){return this._cacheKey}},basePath:{get:function(){return this._basePath}},boundingSphere:{get:function(){var e=x.getScale(this.modelMatrix,Tt),t=l(this.maximumScale)?Math.min(this.maximumScale,this.scale):this.scale;i.multiplyByScalar(e,t,e);var r=this._scaledBoundingSphere;return r.center=i.multiplyComponents(this._boundingSphere.center,e,r.center),r.radius=i.maximumComponent(e)*this._initialRadius,l(this._rtcCenter)&&i.add(this._rtcCenter,r.center,r.center),r}},ready:{get:function(){return this._ready}},readyPromise:{get:function(){return this._readyPromise.promise}},asynchronous:{get:function(){return this._asynchronous}},allowPicking:{get:function(){return this._allowPicking}},incrementallyLoadTextures:{get:function(){return this._incrementallyLoadTextures}},pendingTextureLoads:{get:function(){return l(this._loadResources)?this._loadResources.pendingTextureLoads:0}},dirty:{get:function(){return this._dirty}}});var Mt=Uint32Array.BYTES_PER_ELEMENT;oe.fromGltf=function(e){var t=e.url,i=new oe(e);return i.loadGltf(t,e),i},oe.prototype.loadGltf=function(e){var t=e.url,i=s(e.cacheKey,p(t));e=n(e),e.basePath=m(t),e.cacheKey=i,this._basePath=e.basePath,this._cacheKey=e.cacheKey;var r=new H(document.location.href),o=new H(this._basePath);this._baseUri=o.resolve(r),e.headers=l(e.headers)?n(e.headers):{},l(e.headers.Accept)||(e.headers.Accept=Pt);var a=It[i];return l(a)?a.ready||(++a.count,a.modelsToLoad.push(this)):(a=new re({ready:!1}),a.count=1,a.modelsToLoad.push(this),ie(this,a),It[i]=a,_(t,e.headers).then(function(t){var i=new Uint8Array(t);if(se(i)){var r=le(i);0!==r.binaryOffset&&(i=i.subarray(r.binaryOffset)),a.makeReady(r.glTF,i)}else{var n=v(i),o=JSON.parse(n);e.gltfModifier&&(o=e.gltfModifier(o)),a.makeReady(o)}}).otherwise(he(this,"model",t))),this._readyPromise},oe._gltfCache=It,oe.prototype.getNode=function(e){var t=ue(this,"nodesByName",e);return l(t)?t.publicNode:void 0},oe.prototype.getMesh=function(e){return ue(this,"meshesByName",e)},oe.prototype.getMaterial=function(e){return ue(this,"materialsByName",e)},oe.cacheSize=function(){return{textures:At.textures.size(),images:At.images.size()}};var Dt=new i,Rt=new i,Ot=new i,Nt=new A,Lt=new i,Ft=new i,Bt={MODEL:function(e,t){return function(){return e.model}},VIEW:function(e,t){return function(){return e.view}},PROJECTION:function(e,t){return function(){return e.projection}},MODELVIEW:function(e,t){return function(){return e.modelView}},CESIUM_RTC_MODELVIEW:function(e,t){var r=new x;return function(){return x.getTranslation(e.model,Ft),i.add(Ft,t._rtcCenter,Ft),x.multiplyByPoint(e.view,Ft,Ft),x.setTranslation(e.modelView,Ft,r)}},MODELVIEWPROJECTION:function(e,t){return function(){return e.modelViewProjection}},MODELINVERSE:function(e,t){return function(){return e.inverseModel}},VIEWINVERSE:function(e,t){return function(){return e.inverseView}},PROJECTIONINVERSE:function(e,t){return function(){return e.inverseProjection}},MODELVIEWINVERSE:function(e,t){return function(){return e.inverseModelView}},MODELVIEWPROJECTIONINVERSE:function(e,t){return function(){return e.inverseModelViewProjection}},MODELINVERSETRANSPOSE:function(e,t){return function(){return e.inverseTranposeModel}},MODELVIEWINVERSETRANSPOSE:function(e,t){return function(){return e.normal}},VIEWPORT:function(e,t){return function(){return e.viewportCartesian4}}};u(Je.prototype,{value:{get:function(){if(!l(this._value)){var e=this._model._rendererResources.textures[this._textureId];if(!l(e))return this._model._defaultTexture;this._value=e}return this._value},set:function(e){this._value=e}}}),Je.prototype.clone=function(e,t){return e},Je.prototype.func=void 0;var Vt={};Vt[G.FLOAT]=qe,Vt[G.FLOAT_VEC2]=je,Vt[G.FLOAT_VEC3]=Ye,Vt[G.FLOAT_VEC4]=Xe,Vt[G.INT]=qe,Vt[G.INT_VEC2]=je,Vt[G.INT_VEC3]=Ye,Vt[G.INT_VEC4]=Xe,Vt[G.BOOL]=qe,Vt[G.BOOL_VEC2]=je,Vt[G.BOOL_VEC3]=Ye,Vt[G.BOOL_VEC4]=Xe,Vt[G.FLOAT_MAT2]=Ze,Vt[G.FLOAT_MAT3]=Ke,Vt[G.FLOAT_MAT4]=Qe,Vt[G.SAMPLER_2D]=$e;var kt={MODEL:function(e,t,i){return function(){return i.computedMatrix}},VIEW:function(e,t,i){return function(){return e.view}},PROJECTION:function(e,t,i){return function(){return e.projection}},MODELVIEW:function(e,t,i){var r=new x;return function(){return x.multiplyTransformation(e.view,i.computedMatrix,r)}},CESIUM_RTC_MODELVIEW:function(e,t,i){var r=new x;return function(){return x.multiplyTransformation(e.view,i.computedMatrix,r),x.setTranslation(r,t._rtcCenterEye,r)}},MODELVIEWPROJECTION:function(e,t,i){var r=new x;return function(){return x.multiplyTransformation(e.view,i.computedMatrix,r),x.multiply(e._projection,r,r)}},MODELINVERSE:function(e,t,i){var r=new x;return function(){return x.inverse(i.computedMatrix,r)}},VIEWINVERSE:function(e,t){return function(){return e.inverseView}},PROJECTIONINVERSE:function(e,t,i){return function(){return e.inverseProjection}},MODELVIEWINVERSE:function(e,t,i){var r=new x,n=new x;return function(){return x.multiplyTransformation(e.view,i.computedMatrix,r),x.inverse(r,n)}},MODELVIEWPROJECTIONINVERSE:function(e,t,i){var r=new x,n=new x;return function(){return x.multiplyTransformation(e.view,i.computedMatrix,r),x.multiply(e._projection,r,r),x.inverse(r,n)}},MODELINVERSETRANSPOSE:function(e,t,i){var r=new x,n=new T;return function(){return x.inverse(i.computedMatrix,r),x.getRotation(r,n),T.transpose(n,n)}},MODELVIEWINVERSETRANSPOSE:function(e,t,i){var r=new x,n=new x,o=new T;return function(){return x.multiplyTransformation(e.view,i.computedMatrix,r),x.inverse(r,n),x.getRotation(n,o),T.transpose(o,o)}},VIEWPORT:function(e,t,i){return function(){return e.viewportCartesian4}}},zt=[],Ut=new x,Gt=new e,Wt=new i;return _t.prototype.release=function(){return 0===--this.count?(l(this.cacheKey)&&delete this.context.cache.modelRendererResourceCache[this.cacheKey],Ct(this),c(this)):void 0},_t.prototype.init=function(e){this.buffers=e.buffers,Et(this.buffers),this.vertexArrays=e.vertexArrays,Et(this.vertexArrays),this.programs=e.programs,Et(this.programs),this.pickPrograms=e.pickPrograms,Et(this.pickPrograms),this.textures=e.textures,Et(this.textures),this.samplers=e.samplers,Et(this.samplers),this.renderStates=e.renderStates,Et(this.renderStates)},_t.prototype.assign=function(e){e.buffers=this.buffers,refRessource(this.buffers),e.vertexArrays=this.vertexArrays,refRessource(this.vertexArrays),e.programs=this.programs,refRessource(this.programs),e.pickPrograms=this.pickPrograms,refRessource(this.pickPrograms),e.textures=this.textures,refRessource(this.textures),e.samplers=this.samplers,refRessource(this.samplers),e.renderStates=this.renderStates,refRessource(this.renderStates)},oe.prototype.update=function(e){if(e.mode===ee.SCENE3D){var t=e.context;if(this._defaultTexture=t.defaultTexture,this._state===xt.NEEDS_LOAD&&l(this.gltf)){var r,n=this.cacheKey;if(l(n)){t.cache.modelRendererResourceCache=s(t.cache.modelRendererResourceCache,{});var o=t.cache.modelRendererResourceCache;if(r=o[this.cacheKey],l(r)){if(!r.ready)return;++r.count,this._loadRendererResourcesFromCache=!0}else r=new _t(t,n),r.count=1,o[this.cacheKey]=r;this._cachedRendererResources=r}else r=new _t(t),r.count=1,this._cachedRendererResources=r;if(this._state=xt.LOADING,this._boundingSphere=ce(this.gltf),this._initialRadius=this._boundingSphere.radius,gt(this),this._state!==xt.FAILED){var a=this.gltf.extensions;l(a)&&l(a.CESIUM_RTC)&&(this._rtcCenter=i.fromArray(a.CESIUM_RTC.center),this._rtcCenterEye=new i),this._loadResources=new te,Te(this)}}var u=this._loadResources,c=this._incrementallyLoadTextures,h=!1;if(this._state===xt.LOADING&&(at(this,e),(u.finished()||c&&u.finishedEverythingButTextureCreation())&&(this._state=xt.LOADED,h=!0)),l(u)&&this._state===xt.LOADED&&(c&&!h&&at(this,e),u.finished())){this._loadResources=void 0;var d=this._rendererResources,p=this._cachedRendererResources;p.init(d),p.ready=!0,l(this._precreatedAttributes)&&(p.vertexArrays={}),this.releaseGltfJson&&vt(this)}var m=this.show&&0!==this.scale;if(m&&this._state===xt.LOADED||h){var f=this.activeAnimations.update(e)||this._cesiumAnimationsDirty;this._cesiumAnimationsDirty=!1,this._dirty=!1;var v=!x.equals(this._modelMatrix,this.modelMatrix)||this._scale!==this.scale||this._minimumPixelSize!==this.minimumPixelSize||0!==this.minimumPixelSize||this._maximumScale!==this.maximumScale;if(v||h){x.clone(this.modelMatrix,this._modelMatrix),this._scale=this.scale,this._minimumPixelSize=this.minimumPixelSize,this._maximumScale=this.maximumScale;var g=ft(this,e),_=this._computedModelMatrix;x.multiplyByUniformScale(this.modelMatrix,g,_),x.multiplyTransformation(_,wt,_)}(f||v||h)&&(lt(this,v,h),this._dirty=!0,(f||h)&&ut(this)),this._perNodeShowDirty&&(this._perNodeShowDirty=!1,ct(this)),ht(this,t),dt(this),pt(this)}if(h){var y=this;return void e.afterRender.push(function(){y._ready=!0,y._readyPromise.resolve(y)})}if(m&&!this._ignoreCommands){var C,E,S=e.commandList,w=e.passes,T=this._nodeCommands,b=T.length;if(w.render)for(C=0;b>C;++C)E=T[C],E.show&&S.push(E.command);if(w.pick&&this.allowPicking)for(C=0;b>C;++C)E=T[C],E.show&&S.push(E.pickCommand)}}},oe.prototype.isDestroyed=function(){return!1},oe.prototype.destroy=function(){l(this._precreatedAttributes)&&yt(this._rendererResources.vertexArrays);var e=this._rendererResources;St(e.buffers),St(e.vertexArrays),St(e.programs),St(e.pickPrograms),St(e.textures),St(e.samplers),St(e.renderStates);var t;if(this._loadResources)for(var i=this._loadResources.texturesToCreate;i.length;){t=i.dequeue();var r=t.image.src;At.images.get(r).unref()}this._rendererResources=void 0,this._cachedRendererResources=this._cachedRendererResources&&this._cachedRendererResources.release();for(var n=this._pickIds,o=n.length,a=0;o>a;++a)n[a].destroy();return vt(this),c(this)},oe}),i("DataSources/ModelVisualizer",["../Core/AssociativeArray","../Core/BoundingSphere","../Core/defined","../Core/destroyObject","../Core/DeveloperError","../Core/Matrix4","../Scene/Model","../Scene/ModelAnimationLoop","./BoundingSphereState","./Property"],function(e,t,i,r,n,o,a,s,l,u){"use strict";function c(t,i){i.collectionChanged.addEventListener(c.prototype._onCollectionChanged,this),this._scene=t,this._primitives=t.primitives,this._entityCollection=i,this._modelHash={},this._entitiesToVisualize=new e,this._onCollectionChanged(i,i.values,[],[])}function h(e,t,r,n){var o=r[t.id];i(o)&&(n.removeAndDestroy(o.modelPrimitive),delete r[t.id])}function d(e,t){var r=t[e.id];i(r)&&(r.nodeTransformationsScratch={})}function p(e){console.error(e)}var m=1,f=0,v=!0,g=new o,_=new o;return c.prototype.update=function(e){for(var t=this._entitiesToVisualize.values,r=this._modelHash,n=this._primitives,l=0,c=t.length;c>l;l++){var h,d,y=t[l],C=y._model,E=r[y.id],S=y.isShowing&&y.isAvailable(e)&&u.getValueOrDefault(C._show,e,!0);if(S&&(d=y._getModelMatrix(e,g),h=u.getValueOrUndefined(C._uri,e),S=i(d)&&i(h)),S){var w=i(E)?E.modelPrimitive:void 0;if(i(w)&&h===E.uri||(i(w)&&(n.removeAndDestroy(w),delete r[y.id]),w=a.fromGltf({url:h,incrementallyLoadTextures:u.getValueOrDefault(C._incrementallyLoadTextures,e,v)}),w.readyPromise.otherwise(p),w.id=y,n.add(w),E={modelPrimitive:w,uri:h,animationsRunning:!1,nodeTransformationsScratch:{},originalNodeMatrixHash:{}},r[y.id]=E),w.show=!0,w.scale=u.getValueOrDefault(C._scale,e,m),w.minimumPixelSize=u.getValueOrDefault(C._minimumPixelSize,e,f),w.maximumScale=u.getValueOrUndefined(C._maximumScale,e),w.modelMatrix=o.clone(d,w.modelMatrix),w.ready){var T=u.getValueOrDefault(C._runAnimations,e,!0);E.animationsRunning!==T&&(T?w.activeAnimations.addAll({loop:s.REPEAT}):w.activeAnimations.removeAll(),E.animationsRunning=T);var x=u.getValueOrUndefined(C._nodeTransformations,e,E.nodeTransformationsScratch);if(i(x))for(var b=E.originalNodeMatrixHash,A=Object.keys(x),P=0,I=A.length;I>P;++P){var M=A[P],D=x[M];if(i(D)){var R=w.getNode(M);if(i(R)){var O=b[M];i(O)||(O=R.matrix.clone(),b[M]=O);var N=o.fromTranslationRotationScale(D,_);R.matrix=o.multiply(O,N,N)}}}}}else i(E)&&(E.modelPrimitive.show=!1)}return!0},c.prototype.isDestroyed=function(){return!1},c.prototype.destroy=function(){this._entityCollection.collectionChanged.removeEventListener(c.prototype._onCollectionChanged,this);for(var e=this._entitiesToVisualize.values,t=this._modelHash,i=this._primitives,n=e.length-1;n>-1;n--)h(this,e[n],t,i);return r(this)},c.prototype.getBoundingSphere=function(e,r){var n=this._modelHash[e.id];if(!i(n))return l.FAILED;var o=n.modelPrimitive;return i(o)&&o.show?o.ready?(t.transform(o.boundingSphere,o.modelMatrix,r),l.DONE):l.PENDING:l.FAILED},c.prototype._onCollectionChanged=function(e,t,r,n){var o,a,s=this._entitiesToVisualize,l=this._modelHash,u=this._primitives;for(o=t.length-1;o>-1;o--)a=t[o],i(a._model)&&i(a._position)&&s.set(a.id,a);for(o=n.length-1;o>-1;o--)a=n[o],i(a._model)&&i(a._position)?(d(a,l),s.set(a.id,a)):(h(this,a,l,u),s.remove(a.id));for(o=r.length-1;o>-1;o--)a=r[o],h(this,a,l,u),s.remove(a.id)},c}),i("Shaders/PolylineCommon",[],function(){"use strict";return"void clipLineSegmentToNearPlane(\nvec3 p0,\nvec3 p1,\nout vec4 positionWC,\nout bool clipped,\nout bool culledByNearPlane)\n{\nculledByNearPlane = false;\nclipped = false;\nvec3 p1ToP0 = p1 - p0;\nfloat magnitude = length(p1ToP0);\nvec3 direction = normalize(p1ToP0);\nfloat endPoint0Distance = -(czm_currentFrustum.x + p0.z);\nfloat denominator = -direction.z;\nif (endPoint0Distance < 0.0 && abs(denominator) < czm_epsilon7)\n{\nculledByNearPlane = true;\n}\nelse if (endPoint0Distance < 0.0 && abs(denominator) > czm_epsilon7)\n{\nfloat t = (czm_currentFrustum.x + p0.z) / denominator;\nif (t < 0.0 || t > magnitude)\n{\nculledByNearPlane = true;\n}\nelse\n{\np0 = p0 + t * direction;\nclipped = true;\n}\n}\npositionWC = czm_eyeToWindowCoordinates(vec4(p0, 1.0));\n}\nvec4 getPolylineWindowCoordinates(vec4 position, vec4 previous, vec4 next, float expandDirection, float width, bool usePrevious) {\nvec4 endPointWC, p0, p1;\nbool culledByNearPlane, clipped;\nvec4 positionEC = czm_modelViewRelativeToEye * position;\nvec4 prevEC = czm_modelViewRelativeToEye * previous;\nvec4 nextEC = czm_modelViewRelativeToEye * next;\nclipLineSegmentToNearPlane(prevEC.xyz, positionEC.xyz, p0, clipped, culledByNearPlane);\nclipLineSegmentToNearPlane(nextEC.xyz, positionEC.xyz, p1, clipped, culledByNearPlane);\nclipLineSegmentToNearPlane(positionEC.xyz, usePrevious ? prevEC.xyz : nextEC.xyz, endPointWC, clipped, culledByNearPlane);\nif (culledByNearPlane)\n{\nreturn vec4(0.0, 0.0, 0.0, 1.0);\n}\nvec2 prevWC = normalize(p0.xy - endPointWC.xy);\nvec2 nextWC = normalize(p1.xy - endPointWC.xy);\nfloat expandWidth = width * 0.5;\nvec2 direction;\nif (czm_equalsEpsilon(normalize(previous.xyz - position.xyz), vec3(0.0), czm_epsilon1) || czm_equalsEpsilon(prevWC, -nextWC, czm_epsilon1))\n{\ndirection = vec2(-nextWC.y, nextWC.x);\n}\nelse if (czm_equalsEpsilon(normalize(next.xyz - position.xyz), vec3(0.0), czm_epsilon1) || clipped)\n{\ndirection = vec2(prevWC.y, -prevWC.x);\n}\nelse\n{\nvec2 normal = vec2(-nextWC.y, nextWC.x);\ndirection = normalize((nextWC + prevWC) * 0.5);\nif (dot(direction, normal) < 0.0)\n{\ndirection = -direction;\n}\nfloat sinAngle = abs(direction.x * nextWC.y - direction.y * nextWC.x);\nexpandWidth = clamp(expandWidth / sinAngle, 0.0, width * 2.0);\n}\nvec2 offset = direction * expandDirection * expandWidth * czm_resolutionScale;\nreturn vec4(endPointWC.xy + offset, -endPointWC.z, 1.0);\n}\n"}),i("Shaders/PolylineFS",[],function(){"use strict";return"varying vec2 v_st;\nvoid main()\n{\nczm_materialInput materialInput;\nmaterialInput.s = v_st.s;\nmaterialInput.st = v_st;\nmaterialInput.str = vec3(v_st, 0.0);\nczm_material material = czm_getMaterial(materialInput);\ngl_FragColor = vec4(material.diffuse + material.emission, material.alpha);\n}\n"}),i("Shaders/PolylineVS",[],function(){"use strict";return"attribute vec3 position3DHigh;\nattribute vec3 position3DLow;\nattribute vec3 position2DHigh;\nattribute vec3 position2DLow;\nattribute vec3 prevPosition3DHigh;\nattribute vec3 prevPosition3DLow;\nattribute vec3 prevPosition2DHigh;\nattribute vec3 prevPosition2DLow;\nattribute vec3 nextPosition3DHigh;\nattribute vec3 nextPosition3DLow;\nattribute vec3 nextPosition2DHigh;\nattribute vec3 nextPosition2DLow;\nattribute vec4 texCoordExpandWidthAndShow;\nattribute vec4 pickColor;\nvarying vec2 v_st;\nvarying float v_width;\nvarying vec4 czm_pickColor;\nvoid main()\n{\nfloat texCoord = texCoordExpandWidthAndShow.x;\nfloat expandDir = texCoordExpandWidthAndShow.y;\nfloat width = abs(texCoordExpandWidthAndShow.z) + 0.5;\nbool usePrev = texCoordExpandWidthAndShow.z < 0.0;\nfloat show = texCoordExpandWidthAndShow.w;\nvec4 p, prev, next;\nif (czm_morphTime == 1.0)\n{\np = czm_translateRelativeToEye(position3DHigh.xyz, position3DLow.xyz);\nprev = czm_translateRelativeToEye(prevPosition3DHigh.xyz, prevPosition3DLow.xyz);\nnext = czm_translateRelativeToEye(nextPosition3DHigh.xyz, nextPosition3DLow.xyz);\n}\nelse if (czm_morphTime == 0.0)\n{\np = czm_translateRelativeToEye(position2DHigh.zxy, position2DLow.zxy);\nprev = czm_translateRelativeToEye(prevPosition2DHigh.zxy, prevPosition2DLow.zxy);\nnext = czm_translateRelativeToEye(nextPosition2DHigh.zxy, nextPosition2DLow.zxy);\n}\nelse\n{\np = czm_columbusViewMorph(\nczm_translateRelativeToEye(position2DHigh.zxy, position2DLow.zxy),\nczm_translateRelativeToEye(position3DHigh.xyz, position3DLow.xyz),\nczm_morphTime);\nprev = czm_columbusViewMorph(\nczm_translateRelativeToEye(prevPosition2DHigh.zxy, prevPosition2DLow.zxy),\nczm_translateRelativeToEye(prevPosition3DHigh.xyz, prevPosition3DLow.xyz),\nczm_morphTime);\nnext = czm_columbusViewMorph(\nczm_translateRelativeToEye(nextPosition2DHigh.zxy, nextPosition2DLow.zxy),\nczm_translateRelativeToEye(nextPosition3DHigh.xyz, nextPosition3DLow.xyz),\nczm_morphTime);\n}\nvec4 positionWC = getPolylineWindowCoordinates(p, prev, next, expandDir, width, usePrev);\ngl_Position = czm_viewportOrthographic * positionWC * show;\nv_st = vec2(texCoord, clamp(expandDir, 0.0, 1.0));\nv_width = width;\nczm_pickColor = pickColor;\n}\n"}),i("Scene/Polyline",["../Core/BoundingSphere","../Core/Cartesian3","../Core/Color","../Core/defaultValue","../Core/defined","../Core/defineProperties","../Core/DeveloperError","../Core/Matrix4","../Core/PolylinePipeline","./Material"],function(e,t,i,r,n,o,a,s,l,u){"use strict";function c(o,a){o=r(o,r.EMPTY_OBJECT),this._show=r(o.show,!0),this._width=r(o.width,1),this._loop=r(o.loop,!1),this._material=o.material,n(this._material)||(this._material=u.fromType(u.ColorType,{color:new i(1,1,1,1)}));var c=o.positions;n(c)||(c=[]),this._positions=c,this._actualPositions=l.removeDuplicates(c),this._loop&&this._actualPositions.length>2&&(this._actualPositions===this._positions&&(this._actualPositions=c.slice()),this._actualPositions.push(t.clone(this._actualPositions[0]))),this._length=this._actualPositions.length,this._id=o.id;var h;n(a)&&(h=s.clone(a.modelMatrix)),this._modelMatrix=h,this._segments=l.wrapLongitude(this._actualPositions,h),this._actualLength=void 0,this._propertiesChanged=new Uint32Array(g),this._polylineCollection=a,this._dirty=!1,this._pickId=void 0,this._boundingVolume=e.fromPoints(this._actualPositions),this._boundingVolumeWC=e.transform(this._boundingVolume,this._modelMatrix),this._boundingVolume2D=new e}function h(e,t){++e._propertiesChanged[t];var i=e._polylineCollection;n(i)&&(i._updatePolyline(e,t),e._dirty=!0)}var d=c.SHOW_INDEX=0,p=c.WIDTH_INDEX=1,m=c.POSITION_INDEX=2,f=c.MATERIAL_INDEX=3,v=c.POSITION_SIZE_INDEX=4,g=c.NUMBER_OF_PROPERTIES=5;return o(c.prototype,{show:{get:function(){return this._show},set:function(e){e!==this._show&&(this._show=e,h(this,d))}},positions:{get:function(){return this._positions},set:function(i){var r=l.removeDuplicates(i);this._loop&&r.length>2&&(r===i&&(r=i.slice()),r.push(t.clone(r[0]))),(this._actualPositions.length!==r.length||this._actualPositions.length!==this._length)&&h(this,v),this._positions=i,this._actualPositions=r,this._length=r.length,this._boundingVolume=e.fromPoints(this._actualPositions,this._boundingVolume),this._boundingVolumeWC=e.transform(this._boundingVolume,this._modelMatrix,this._boundingVolumeWC),h(this,m),this.update()}},material:{get:function(){return this._material},set:function(e){this._material!==e&&(this._material=e,h(this,f))}},width:{get:function(){return this._width},set:function(e){var t=this._width;e!==t&&(this._width=e,h(this,p))}},loop:{get:function(){return this._loop},set:function(e){if(e!==this._loop){var i=this._actualPositions;e?i.length>2&&!t.equals(i[0],i[i.length-1])&&(i.length===this._positions.length&&(this._actualPositions=i=this._positions.slice()),i.push(t.clone(i[0]))):i.length>2&&t.equals(i[0],i[i.length-1])&&(i.length-1===this._positions.length?this._actualPositions=this._positions:i.pop()),this._loop=e,h(this,v)}}},id:{get:function(){return this._id},set:function(e){this._id=e,n(this._pickId)&&(this._pickId.object.id=e)}}}),c.prototype.update=function(){var t=s.IDENTITY;n(this._polylineCollection)&&(t=this._polylineCollection.modelMatrix);var i=this._segments.positions.length,r=this._segments.lengths,o=this._propertiesChanged[m]>0||this._propertiesChanged[v]>0;if((!s.equals(t,this._modelMatrix)||o)&&(this._segments=l.wrapLongitude(this._actualPositions,t),this._boundingVolumeWC=e.transform(this._boundingVolume,t,this._boundingVolumeWC)),this._modelMatrix=t,this._segments.positions.length!==i)h(this,v);else for(var a=r.length,u=0;a>u;++u)if(r[u]!==this._segments.lengths[u]){h(this,v);break}},c.prototype.getPickId=function(e){return n(this._pickId)||(this._pickId=e.createPickId({primitive:this,collection:this._polylineCollection,id:this._id})),this._pickId},c.prototype._clean=function(){this._dirty=!1;for(var e=this._propertiesChanged,t=0;g-1>t;++t)e[t]=0},c.prototype._destroy=function(){this._pickId=this._pickId&&this._pickId.destroy(),this._material=this._material&&this._material.destroy(),this._polylineCollection=void 0},c}),i("Scene/PolylineCollection",["../Core/BoundingSphere","../Core/Cartesian3","../Core/Cartesian4","../Core/Cartographic","../Core/Color","../Core/ComponentDatatype","../Core/defaultValue","../Core/defined","../Core/defineProperties","../Core/destroyObject","../Core/DeveloperError","../Core/EncodedCartesian3","../Core/IndexDatatype","../Core/Intersect","../Core/Math","../Core/Matrix4","../Core/Plane","../Renderer/Buffer","../Renderer/BufferUsage","../Renderer/DrawCommand","../Renderer/RenderState","../Renderer/ShaderProgram","../Renderer/ShaderSource","../Renderer/VertexArray","../Shaders/PolylineCommon","../Shaders/PolylineFS","../Shaders/PolylineVS","./BlendingState","./Material","./Pass","./Polyline","./SceneMode"],function(e,t,i,r,n,o,a,s,l,u,c,h,d,p,m,f,v,g,_,y,C,E,S,w,T,x,b,A,P,I,M,D){"use strict";function R(e){e=a(e,a.EMPTY_OBJECT),this.modelMatrix=f.clone(a(e.modelMatrix,f.IDENTITY)),this._modelMatrix=f.clone(f.IDENTITY),this.debugShowBoundingVolume=a(e.debugShowBoundingVolume,!1),this._opaqueRS=void 0,this._translucentRS=void 0,this._colorCommands=[],this._pickCommands=[],this._polylinesUpdated=!1,this._polylinesRemoved=!1,this._createVertexArray=!1,this._propertiesChanged=new Uint32Array(Q),this._polylines=[],this._polylineBuckets={},this._buffersUsage=[{bufferUsage:_.STATIC_DRAW,frameCount:0},{bufferUsage:_.STATIC_DRAW,frameCount:0},{bufferUsage:_.STATIC_DRAW,frameCount:0}],this._mode=void 0,this._polylinesToUpdate=[],this._vertexArrays=[],this._positionBuffer=void 0,this._pickColorBuffer=void 0,this._texCoordExpandWidthAndShowBuffer=void 0}function O(t,i,r,n,o){for(var a=i.context,l=i.commandList,u=r.length,c=0,h=!0,d=t._vertexArrays,p=t.debugShowBoundingVolume,m=d.length,f=0;m>f;++f)for(var v=d[f],g=v.buckets,_=g.length,C=0;_>C;++C){for(var E,S,w,T=g[C],x=T.offset,b=o?T.bucket.shaderProgram:T.bucket.pickShaderProgram,A=T.bucket.polylines,P=A.length,M=0,R=0;P>R;++R){var O=A[R],N=F(O._material);if(N!==E){if(s(E)&&M>0){var L=S.isTranslucent();c>=u?(w=new y({owner:t}),r.push(w)):w=r[c],++c,w.boundingVolume=e.clone($,w.boundingVolume),w.modelMatrix=n,w.shaderProgram=b,w.vertexArray=v.va,w.renderState=L?t._translucentRS:t._opaqueRS,w.pass=L?I.TRANSLUCENT:I.OPAQUE,w.debugShowBoundingVolume=o?p:!1,w.uniformMap=S._uniforms,w.count=M,w.offset=x,x+=M,M=0,h=!0,l.push(w)}S=O._material,S.update(a),E=N}for(var B=O._locatorBuckets,V=B.length,k=0;V>k;++k){var z=B[k];z.locator===T&&(M+=z.count)}var U;i.mode===D.SCENE3D?U=O._boundingVolumeWC:i.mode===D.COLUMBUS_VIEW?U=O._boundingVolume2D:i.mode===D.SCENE2D?s(O._boundingVolume2D)&&(U=e.clone(O._boundingVolume2D,ee),U.center.x=0):s(O._boundingVolumeWC)&&s(O._boundingVolume2D)&&(U=e.union(O._boundingVolumeWC,O._boundingVolume2D,ee)),h?(h=!1,e.clone(U,$)):e.union(U,$,$)}s(E)&&M>0&&(c>=u?(w=new y({owner:t}),r.push(w)):w=r[c],++c,w.boundingVolume=e.clone($,w.boundingVolume),w.modelMatrix=n,w.shaderProgram=b,w.vertexArray=v.va,w.renderState=S.isTranslucent()?t._translucentRS:t._opaqueRS,w.pass=S.isTranslucent()?I.TRANSLUCENT:I.OPAQUE,w.debugShowBoundingVolume=o?p:!1,w.uniformMap=S._uniforms,w.count=M,w.offset=x,h=!0,l.push(w)),E=void 0}r.length=c}function N(e){for(var t=e._buffersUsage,i=!1,r=e._propertiesChanged,n=0;Q-2>n;++n){var o=t[n];r[n]?o.bufferUsage!==_.STREAM_DRAW?(i=!0,o.bufferUsage=_.STREAM_DRAW,o.frameCount=100):o.frameCount=100:o.bufferUsage!==_.STATIC_DRAW&&(0===o.frameCount?(i=!0,o.bufferUsage=_.STATIC_DRAW):o.frameCount--)}return i}function L(e,t,i){e._createVertexArray=!1,z(e),U(e),B(e);var r,n,a=[[]],l=a[0],u=[0],c=0,h=[[]],p=0,f=e._polylineBuckets;for(r in f)f.hasOwnProperty(r)&&(n=f[r],n.updateShader(t),p+=n.lengthOfPositions);if(p>0){var v,y=e._mode,C=new Float32Array(6*p*3),E=new Uint8Array(4*p),S=new Float32Array(4*p),T=0,x=0,b=0;for(r in f)if(f.hasOwnProperty(r)){n=f[r],n.write(C,E,S,T,x,b,t,i),y===D.MORPHING&&(s(v)||(v=new Float32Array(6*p*3)),n.writeForMorph(v,T));var A=n.lengthOfPositions;T+=6*A*3,x+=4*A,b+=4*A,c=n.updateIndices(a,u,h,c)}var P=e._buffersUsage[X].bufferUsage,I=e._buffersUsage[j].bufferUsage,M=e._buffersUsage[Y].bufferUsage,R=I===_.STREAM_DRAW||M===_.STREAM_DRAW?_.STREAM_DRAW:_.STATIC_DRAW; +e._positionBuffer=g.createVertexBuffer({context:t,typedArray:C,usage:P});var O;s(v)&&(O=g.createVertexBuffer({context:t,typedArray:v,usage:P})),e._pickColorBuffer=g.createVertexBuffer({context:t,typedArray:E,usage:_.STATIC_DRAW}),e._texCoordExpandWidthAndShowBuffer=g.createVertexBuffer({context:t,typedArray:S,usage:R});for(var N=4*Uint8Array.BYTES_PER_ELEMENT,L=3*Float32Array.BYTES_PER_ELEMENT,F=4*Float32Array.BYTES_PER_ELEMENT,V=0,k=a.length,G=0;k>G;++G)if(l=a[G],l.length>0){var W=new Uint16Array(l),H=g.createIndexBuffer({context:t,typedArray:W,usage:_.STATIC_DRAW,indexDatatype:d.UNSIGNED_SHORT});V+=u[G];var q,Z,K,Q,$=6*(G*(L*m.SIXTY_FOUR_KILOBYTES)-V*L),ee=L+$,ie=L+ee,re=L+ie,ne=L+re,oe=L+ne,ae=G*(N*m.SIXTY_FOUR_KILOBYTES)-V*N,se=G*(F*m.SIXTY_FOUR_KILOBYTES)-V*F,le=[{index:J.position3DHigh,componentsPerAttribute:3,componentDatatype:o.FLOAT,offsetInBytes:$,strideInBytes:6*L},{index:J.position3DLow,componentsPerAttribute:3,componentDatatype:o.FLOAT,offsetInBytes:ee,strideInBytes:6*L},{index:J.position2DHigh,componentsPerAttribute:3,componentDatatype:o.FLOAT,offsetInBytes:$,strideInBytes:6*L},{index:J.position2DLow,componentsPerAttribute:3,componentDatatype:o.FLOAT,offsetInBytes:ee,strideInBytes:6*L},{index:J.prevPosition3DHigh,componentsPerAttribute:3,componentDatatype:o.FLOAT,offsetInBytes:ie,strideInBytes:6*L},{index:J.prevPosition3DLow,componentsPerAttribute:3,componentDatatype:o.FLOAT,offsetInBytes:re,strideInBytes:6*L},{index:J.prevPosition2DHigh,componentsPerAttribute:3,componentDatatype:o.FLOAT,offsetInBytes:ie,strideInBytes:6*L},{index:J.prevPosition2DLow,componentsPerAttribute:3,componentDatatype:o.FLOAT,offsetInBytes:re,strideInBytes:6*L},{index:J.nextPosition3DHigh,componentsPerAttribute:3,componentDatatype:o.FLOAT,offsetInBytes:ne,strideInBytes:6*L},{index:J.nextPosition3DLow,componentsPerAttribute:3,componentDatatype:o.FLOAT,offsetInBytes:oe,strideInBytes:6*L},{index:J.nextPosition2DHigh,componentsPerAttribute:3,componentDatatype:o.FLOAT,offsetInBytes:ne,strideInBytes:6*L},{index:J.nextPosition2DLow,componentsPerAttribute:3,componentDatatype:o.FLOAT,offsetInBytes:oe,strideInBytes:6*L},{index:J.texCoordExpandWidthAndShow,componentsPerAttribute:4,componentDatatype:o.FLOAT,vertexBuffer:e._texCoordExpandWidthAndShowBuffer,offsetInBytes:se},{index:J.pickColor,componentsPerAttribute:4,componentDatatype:o.UNSIGNED_BYTE,vertexBuffer:e._pickColorBuffer,offsetInBytes:ae,normalize:!0}];y===D.SCENE3D?(q=e._positionBuffer,Z="vertexBuffer",K=te,Q="value"):y===D.SCENE2D||y===D.COLUMBUS_VIEW?(q=te,Z="value",K=e._positionBuffer,Q="vertexBuffer"):(q=O,Z="vertexBuffer",K=e._positionBuffer,Q="vertexBuffer"),le[0][Z]=q,le[1][Z]=q,le[2][Q]=K,le[3][Q]=K,le[4][Z]=q,le[5][Z]=q,le[6][Q]=K,le[7][Q]=K,le[8][Z]=q,le[9][Z]=q,le[10][Q]=K,le[11][Q]=K;var ue=new w({context:t,attributes:le,indexBuffer:H});e._vertexArrays.push({va:ue,buckets:h[G]})}}}function F(e){var t=P._uniformList[e.type],i=t.length;ie.length=2*i;for(var r=0,n=0;i>n;++n){var o=t[n];ie[r]=o,ie[r+1]=e._uniforms[o](),r+=2}return e.type+":"+JSON.stringify(ie)}function B(e){for(var t=e._mode,i=e._modelMatrix,r=e._polylineBuckets={},n=e._polylines,o=n.length,a=0;o>a;++a){var l=n[a];if(l._actualPositions.length>1){l.update();var u=l.material,c=r[u.type];s(c)||(c=r[u.type]=new H(u,t,i)),c.addPolyline(l)}}}function V(e,t){var i=t.mode;e._mode===i&&f.equals(e._modelMatrix,e.modelMatrix)||(e._mode=i,e._modelMatrix=f.clone(e.modelMatrix),e._createVertexArray=!0)}function k(e){if(e._polylinesRemoved){e._polylinesRemoved=!1;for(var t=[],i=e._polylines.length,r=0,n=0;i>r;++r){var o=e._polylines[r];s(o)&&(o._index=n++,t.push(o))}e._polylines=t}}function z(e){for(var t=e._polylines,i=t.length,r=0;i>r;++r)if(s(t[r])){var n=t[r]._bucket;s(n)&&(n.shaderProgram=n.shaderProgram&&n.shaderProgram.destroy())}}function U(e){for(var t=e._vertexArrays.length,i=0;t>i;++i)e._vertexArrays[i].va.destroy();e._vertexArrays.length=0}function G(e){for(var t=e._polylines,i=t.length,r=0;i>r;++r)s(t[r])&&t[r]._destroy()}function W(e,t,i){this.count=e,this.offset=t,this.bucket=i}function H(e,t,i){this.polylines=[],this.lengthOfPositions=0,this.material=e,this.shaderProgram=void 0,this.pickShaderProgram=void 0,this.mode=t,this.modelMatrix=i}function q(e){return t.dot(t.UNIT_X,e._boundingVolume.center)<0||e._boundingVolume.intersectPlane(v.ORIGIN_ZX_PLANE)===p.INTERSECTING}var j=M.SHOW_INDEX,Y=M.WIDTH_INDEX,X=M.POSITION_INDEX,Z=M.MATERIAL_INDEX,K=M.POSITION_SIZE_INDEX,Q=M.NUMBER_OF_PROPERTIES,J={texCoordExpandWidthAndShow:0,position3DHigh:1,position3DLow:2,position2DHigh:3,position2DLow:4,prevPosition3DHigh:5,prevPosition3DLow:6,prevPosition2DHigh:7,prevPosition2DLow:8,nextPosition3DHigh:9,nextPosition3DLow:10,nextPosition2DHigh:11,nextPosition2DLow:12,pickColor:13};l(R.prototype,{length:{get:function(){return k(this),this._polylines.length}}}),R.prototype.add=function(e){var t=new M(e,this);return t._index=this._polylines.length,this._polylines.push(t),this._createVertexArray=!0,t},R.prototype.remove=function(e){if(this.contains(e)){if(this._polylines[e._index]=void 0,this._polylinesRemoved=!0,this._createVertexArray=!0,s(e._bucket)){var t=e._bucket;t.shaderProgram=t.shaderProgram&&t.shaderProgram.destroy(),t.pickShaderProgram=t.pickShaderProgram&&t.pickShaderProgram.destroy()}return e._destroy(),!0}return!1},R.prototype.removeAll=function(){z(this),G(this),this._polylineBuckets={},this._polylinesRemoved=!1,this._polylines.length=0,this._polylinesToUpdate.length=0,this._createVertexArray=!0},R.prototype.contains=function(e){return s(e)&&e._polylineCollection===this},R.prototype.get=function(e){return k(this),this._polylines[e]},R.prototype.update=function(e,t){if(k(this),0!==this._polylines.length){V(this,e);var i,r=e.context,n=e.mapProjection,o=this._propertiesChanged;if(this._createVertexArray||N(this))L(this,r,n);else if(this._polylinesUpdated){var a=this._polylinesToUpdate;if(this._mode!==D.SCENE3D)for(var l=a.length,u=0;l>u;++u)i=a[u],i.update();if(o[K]||o[Z])L(this,r,n);else for(var c=a.length,h=this._polylineBuckets,d=0;c>d;++d){i=a[d],o=i._propertiesChanged;var p=i._bucket,m=0;for(var v in h)if(h.hasOwnProperty(v)){if(h[v]===p){(o[X]||o[j]||o[Y])&&p.writeUpdate(m,i,this._positionBuffer,this._texCoordExpandWidthAndShowBuffer,n);break}m+=h[v].lengthOfPositions}i._clean()}a.length=0,this._polylinesUpdated=!1}o=this._propertiesChanged;for(var g=0;Q>g;++g)o[g]=0;var _=f.IDENTITY;e.mode===D.SCENE3D&&(_=this.modelMatrix);var y=e.passes,E=0!==e.morphTime;if(s(this._opaqueRS)&&this._opaqueRS.depthTest.enabled===E||(this._opaqueRS=C.fromCache({depthMask:E,depthTest:{enabled:E}})),s(this._translucentRS)&&this._translucentRS.depthTest.enabled===E||(this._translucentRS=C.fromCache({blending:A.ALPHA_BLEND,depthMask:!E,depthTest:{enabled:E}})),y.render){var S=this._colorCommands;O(this,e,S,_,!0)}if(y.pick){var w=this._pickCommands;O(this,e,w,_,!1)}}};var $=new e,ee=new e;R.prototype.isDestroyed=function(){return!1},R.prototype.destroy=function(){return U(this),z(this),G(this),u(this)};var te=[0,0,0],ie=[];R.prototype._updatePolyline=function(e,t){this._polylinesUpdated=!0,this._polylinesToUpdate.push(e),++this._propertiesChanged[t]},H.prototype.addPolyline=function(e){var t=this.polylines;t.push(e),e._actualLength=this.getPolylinePositionsLength(e),this.lengthOfPositions+=e._actualLength,e._bucket=this},H.prototype.updateShader=function(e){if(!s(this.shaderProgram)){var t=new S({sources:[T,b]}),i=new S({sources:[this.material.shaderSource,x]}),r=new S({sources:i.sources,pickColorQualifier:"varying"});this.shaderProgram=E.fromCache({context:e,vertexShaderSource:t,fragmentShaderSource:i,attributeLocations:J}),this.pickShaderProgram=E.fromCache({context:e,vertexShaderSource:t,fragmentShaderSource:r,attributeLocations:J})}},H.prototype.getPolylinePositionsLength=function(e){var t;if(this.mode===D.SCENE3D||!q(e))return t=e._actualPositions.length,4*t-4;var i=0,r=e._segments.lengths;t=r.length;for(var n=0;t>n;++n)i+=4*r[n]-4;return i};var re=new t,ne=new t,oe=new t,ae=new t;H.prototype.write=function(e,i,r,o,a,s,l,u){for(var c=this.mode,d=this.polylines,p=d.length,m=0;p>m;++m)for(var f,v=d[m],g=v.width,_=v.show&&g>0,y=this.getSegments(v,u),C=y.positions,E=y.lengths,S=C.length,w=v.getPickId(l).color,T=0,x=0,b=0;S>b;++b){0===b?v._loop?f=C[S-2]:(f=ae,t.subtract(C[0],C[1],f),t.add(C[0],f,f)):f=C[b-1],ne.x=f.x,ne.y=f.y,ne.z=c!==D.SCENE2D?f.z:0,f=C[b],re.x=f.x,re.y=f.y,re.z=c!==D.SCENE2D?f.z:0,b===S-1?v._loop?f=C[1]:(f=ae,t.subtract(C[S-1],C[S-2],f),t.add(C[S-1],f,f)):f=C[b+1],oe.x=f.x,oe.y=f.y,oe.z=c!==D.SCENE2D?f.z:0;var A=E[T];b===x+A&&(x+=A,++T);for(var P=b-x===0,I=b===x+E[T]-1,M=P?2:0,R=I?2:4,O=M;R>O;++O){h.writeElements(re,e,o),h.writeElements(ne,e,o+6),h.writeElements(oe,e,o+12),i[a]=n.floatToByte(w.red),i[a+1]=n.floatToByte(w.green),i[a+2]=n.floatToByte(w.blue),i[a+3]=n.floatToByte(w.alpha);var N=0>O-2?-1:1;r[s]=b/(S-1),r[s+1]=2*(O%2)-1,r[s+2]=N*g,r[s+3]=_,o+=18,a+=4,s+=4}}};var se=new t,le=new t,ue=new t,ce=new t;H.prototype.writeForMorph=function(e,i){for(var r=this.modelMatrix,n=this.polylines,o=n.length,a=0;o>a;++a)for(var s=n[a],l=s._segments.positions,u=s._segments.lengths,c=l.length,d=0,p=0,m=0;c>m;++m){var v;0===m?s._loop?v=l[c-2]:(v=ce,t.subtract(l[0],l[1],v),t.add(l[0],v,v)):v=l[m-1],v=f.multiplyByPoint(r,v,le);var g,_=f.multiplyByPoint(r,l[m],se);m===c-1?s._loop?g=l[1]:(g=ce,t.subtract(l[c-1],l[c-2],g),t.add(l[c-1],g,g)):g=l[m+1],g=f.multiplyByPoint(r,g,ue);var y=u[d];m===p+y&&(p+=y,++d);for(var C=m-p===0,E=m===p+u[d]-1,S=C?2:0,w=E?2:4,T=S;w>T;++T)h.writeElements(_,e,i),h.writeElements(v,e,i+6),h.writeElements(g,e,i+12),i+=18}};var he=new Array(1);H.prototype.updateIndices=function(e,t,i,r){var n=i.length-1,o=new W(0,r,this);i[n].push(o);var a=0,s=e[e.length-1],l=0;s.length>0&&(l=s[s.length-1]+1);for(var u=this.polylines,c=u.length,h=0;c>h;++h){var d=u[h];d._locatorBuckets=[];var p;if(this.mode===D.SCENE3D){p=he;var f=d._actualPositions.length;if(!(f>0))continue;p[0]=f}else p=d._segments.lengths;var v=p.length;if(v>0){for(var g=0,_=0;v>_;++_)for(var y=p[_]-1,C=0;y>C;++C)l+4>=m.SIXTY_FOUR_KILOBYTES-2&&(d._locatorBuckets.push({locator:o,count:g}),g=0,t.push(4),s=[],e.push(s),l=0,o.count=a,a=0,r=0,o=new W(0,0,this),i[++n]=[o]),s.push(l,l+2,l+1),s.push(l+1,l+2,l+3),g+=6,a+=6,r+=6,l+=4;d._locatorBuckets.push({locator:o,count:g}),l+4>=m.SIXTY_FOUR_KILOBYTES-2&&(t.push(0),s=[],e.push(s),l=0,o.count=a,r=0,a=0,o=new W(0,0,this),i[++n]=[o])}d._clean()}return o.count=a,r},H.prototype.getPolylineStartIndex=function(e){for(var t=this.polylines,i=0,r=t.length,n=0;r>n;++n){var o=t[n];if(o===e)break;i+=o._actualLength}return i};var de={positions:void 0,lengths:void 0},pe=new Array(1),me=new t,fe=new r;H.prototype.getSegments=function(i,r){var n=i._actualPositions;if(this.mode===D.SCENE3D)return pe[0]=n.length,de.positions=n,de.lengths=pe,de;q(i)&&(n=i._segments.positions);for(var o,a=r.ellipsoid,s=[],l=this.modelMatrix,u=n.length,c=me,h=0;u>h;++h)o=n[h],c=f.multiplyByPoint(l,o,c),s.push(r.project(a.cartesianToCartographic(c,fe)));if(s.length>0){i._boundingVolume2D=e.fromPoints(s,i._boundingVolume2D);var d=i._boundingVolume2D.center;i._boundingVolume2D.center=new t(d.z,d.x,d.y)}return de.positions=s,de.lengths=i._segments.lengths,de};var ve,ge;return H.prototype.writeUpdate=function(e,i,r,n,o){var a=this.mode,l=i._actualLength;if(l){e+=this.getPolylineStartIndex(i);var u=ve,c=ge,d=6*l*3;!s(u)||u.length<d?(u=ve=new Float32Array(d),c=ge=new Float32Array(4*l)):u.length>d&&(u=new Float32Array(u.buffer,0,d),c=new Float32Array(c.buffer,0,4*l));var p,m=0,f=0,v=this.getSegments(i,o),g=v.positions,_=v.lengths,y=0,C=0,E=i.width,S=i.show&&E>0;l=g.length;for(var w=0;l>w;++w){0===w?i._loop?p=g[l-2]:(p=ae,t.subtract(g[0],g[1],p),t.add(g[0],p,p)):p=g[w-1],ne.x=p.x,ne.y=p.y,ne.z=a!==D.SCENE2D?p.z:0,p=g[w],re.x=p.x,re.y=p.y,re.z=a!==D.SCENE2D?p.z:0,w===l-1?i._loop?p=g[1]:(p=ae,t.subtract(g[l-1],g[l-2],p),t.add(g[l-1],p,p)):p=g[w+1],oe.x=p.x,oe.y=p.y,oe.z=a!==D.SCENE2D?p.z:0;var T=_[y];w===C+T&&(C+=T,++y);for(var x=w-C===0,b=w===C+_[y]-1,A=x?2:0,P=b?2:4,I=A;P>I;++I){h.writeElements(re,u,m),h.writeElements(ne,u,m+6),h.writeElements(oe,u,m+12);var M=0>I-2?-1:1;c[f]=w/(l-1),c[f+1]=2*(I%2)-1,c[f+2]=M*E,c[f+3]=S,m+=18,f+=4}}r.copyFromArrayView(u,18*Float32Array.BYTES_PER_ELEMENT*e),n.copyFromArrayView(c,4*Float32Array.BYTES_PER_ELEMENT*e)}},R}),i("DataSources/ScaledPositionProperty",["../Core/defined","../Core/defineProperties","../Core/DeveloperError","../Core/Ellipsoid","../Core/Event","../Core/ReferenceFrame","./Property"],function(e,t,i,r,n,o,a){"use strict";function s(e){this._definitionChanged=new n,this._value=void 0,this._removeSubscription=void 0,this.setValue(e)}return t(s.prototype,{isConstant:{get:function(){return a.isConstant(this._value)}},definitionChanged:{get:function(){return this._definitionChanged}},referenceFrame:{get:function(){return e(this._value)?this._value.referenceFrame:o.FIXED}}}),s.prototype.getValue=function(e,t){return this.getValueInReferenceFrame(e,o.FIXED,t)},s.prototype.setValue=function(t){this._value!==t&&(this._value=t,e(this._removeSubscription)&&(this._removeSubscription(),this._removeSubscription=void 0),e(t)&&(this._removeSubscription=t.definitionChanged.addEventListener(this._raiseDefinitionChanged,this)),this._definitionChanged.raiseEvent(this))},s.prototype.getValueInReferenceFrame=function(t,i,n){return e(this._value)?(n=this._value.getValueInReferenceFrame(t,i,n),e(n)?r.WGS84.scaleToGeodeticSurface(n,n):void 0):void 0},s.prototype.equals=function(e){return this===e||e instanceof s&&this._value===e._value},s.prototype._raiseDefinitionChanged=function(){this._definitionChanged.raiseEvent(this)},s}),i("DataSources/PathVisualizer",["../Core/AssociativeArray","../Core/Cartesian3","../Core/defined","../Core/destroyObject","../Core/DeveloperError","../Core/JulianDate","../Core/Matrix3","../Core/Matrix4","../Core/ReferenceFrame","../Core/TimeInterval","../Core/Transforms","../Scene/PolylineCollection","../Scene/SceneMode","./CompositePositionProperty","./ConstantPositionProperty","./MaterialProperty","./Property","./ReferenceProperty","./SampledPositionProperty","./ScaledPositionProperty","./TimeIntervalCollectionPositionProperty"],function(e,t,i,r,n,o,a,s,l,u,c,h,d,p,m,f,v,g,_,y,C){"use strict";function E(e){this.entity=e,this.polyline=void 0,this.index=void 0,this.updater=void 0}function S(e,t,r,n,a,s,l,u,c){var h,d=u;h=e.getValueInReferenceFrame(t,s,c[d]),i(h)&&(c[d++]=h);for(var p,m,f,v=!i(a)||o.lessThanOrEquals(a,t)||o.greaterThanOrEquals(a,r),g=0,_=n.length,y=n[g],C=r,E=!1;_>g;){if(!v&&o.greaterThanOrEquals(y,a)&&(h=e.getValueInReferenceFrame(a,s,c[d]),i(h)&&(c[d++]=h),v=!0),o.greaterThan(y,t)&&o.lessThan(y,C)&&!y.equals(a)&&(h=e.getValueInReferenceFrame(y,s,c[d]),i(h)&&(c[d++]=h)),_-1>g){if(l>0&&!E){var S=n[g+1],w=o.secondsDifference(S,y);E=w>l,E&&(p=Math.ceil(w/l),m=0,f=w/Math.max(p,2),p=Math.max(p-1,1))}if(E&&p>m){y=o.addSeconds(y,f,new o),m++;continue}}E=!1,g++,y=n[g]}return h=e.getValueInReferenceFrame(r,s,c[d]),i(h)&&(c[d++]=h),d}function w(e,t,r,n,a,s,l,u){for(var c,h=0,d=l,p=t,m=Math.max(s,60),f=!i(n)||o.lessThanOrEquals(n,t)||o.greaterThanOrEquals(n,r);o.lessThan(p,r);)!f&&o.greaterThanOrEquals(p,n)&&(f=!0,c=e.getValueInReferenceFrame(n,a,u[d]),i(c)&&(u[d]=c,d++)),c=e.getValueInReferenceFrame(p,a,u[d]),i(c)&&(u[d]=c,d++),h++,p=o.addSeconds(t,m*h,new o);return c=e.getValueInReferenceFrame(r,a,u[d]),i(c)&&(u[d]=c,d++),d}function T(e,t,r,n,a,s,l,c){L.start=t,L.stop=r;for(var h=l,d=e.intervals,p=0;p<d.length;p++){var m=d.get(p);if(!u.intersect(m,L,O).isEmpty){var f=m.start;m.isStartIncluded||(f=m.isStopIncluded?m.stop:o.addSeconds(m.start,o.secondsDifference(m.stop,m.start)/2,new o));var v=e.getValueInReferenceFrame(f,a,c[h]);i(v)&&(c[h]=v,h++)}}return h}function x(e,t,r,n,o,a,s,l){var u=e.getValueInReferenceFrame(t,o,l[s]);return i(u)&&(l[s++]=u),s}function b(e,t,i,r,n,a,s,l){N.start=t,N.stop=i;for(var c=s,h=e.intervals,d=0;d<h.length;d++){var p=h.get(d);if(!u.intersect(p,N,O).isEmpty){var m=p.start,f=p.stop,v=t;o.greaterThan(m,v)&&(v=m);var g=i;o.lessThan(f,g)&&(g=f),c=A(p.data,v,g,r,n,a,c,l)}}return c}function A(e,t,i,r,n,o,a,s){for(var l=e;l instanceof g||l instanceof y;)l instanceof g&&(l=l.resolvedProperty),l instanceof y&&(l=l._value);if(l instanceof _){var u=l._property._times;a=S(e,t,i,u,r,n,o,a,s)}else a=l instanceof p?b(e,t,i,r,n,o,a,s):l instanceof C?T(e,t,i,r,n,o,a,s):l instanceof m?x(e,t,i,r,n,o,a,s):w(e,t,i,r,n,o,a,s);return a}function P(e,t,r,n,o,a,s){i(s)||(s=[]);var l=A(e,t,r,n,o,a,0,s);return s.length=l,s}function I(e,t){this._unusedIndexes=[],this._polylineCollection=new h,this._scene=e,this._referenceFrame=t,e.primitives.add(this._polylineCollection)}function M(t,i){i.collectionChanged.addEventListener(M.prototype._onCollectionChanged,this),this._scene=t,this._updaters={},this._entityCollection=i,this._items=new e,this._onCollectionChanged(i,i.values,[],[])}var D=60,R=1,O=new u,N=new u,L=new u,F=new a;return I.prototype.update=function(e){if(this._referenceFrame===l.INERTIAL){var r=c.computeIcrfToFixedMatrix(e,F);i(r)||(r=c.computeTemeToPseudoFixedMatrix(e,F)),s.fromRotationTranslation(r,t.ZERO,this._polylineCollection.modelMatrix)}},I.prototype.updateObject=function(e,t){var r,n,a=t.entity,s=a._path,l=a._position,u=s._show,c=t.polyline,h=a.isShowing&&(!i(u)||u.getValue(e));if(h){var d=v.getValueOrUndefined(s._leadTime,e),p=v.getValueOrUndefined(s._trailTime,e),m=a._availability,g=i(m),_=i(d),y=i(p);if(h=g||_&&y){if(y&&(r=o.addSeconds(e,-p,new o)),_&&(n=o.addSeconds(e,d,new o)),g){var C=m.start,E=m.stop;(!y||o.greaterThan(C,r))&&(r=C),(!_||o.lessThan(E,n))&&(n=E)}h=o.lessThan(r,n)}}if(!h)return void(i(c)&&(this._unusedIndexes.push(t.index),t.polyline=void 0,c.show=!1,t.index=void 0));if(!i(c)){var S=this._unusedIndexes,w=S.length;if(w>0){var T=S.pop();c=this._polylineCollection.get(T),t.index=T}else t.index=this._polylineCollection.length,c=this._polylineCollection.add();c.id=a,t.polyline=c}var x=v.getValueOrDefault(s._resolution,e,D);c.show=!0,c.positions=P(l,r,n,e,this._referenceFrame,x,c.positions.slice()),c.material=f.getValue(e,s._material,c.material),c.width=v.getValueOrDefault(s._width,e,R)},I.prototype.removeObject=function(e){var t=e.polyline;i(t)&&(this._unusedIndexes.push(e.index),e.polyline=void 0,t.show=!1,e.index=void 0)},I.prototype.destroy=function(){return this._scene.primitives.remove(this._polylineCollection),r(this)},M.prototype.update=function(e){var t=this._updaters;for(var r in t)t.hasOwnProperty(r)&&t[r].update(e);for(var n=this._items.values,o=0,a=n.length;a>o;o++){var s=n[o],u=s.entity,c=u._position,h=s.updater,p=l.FIXED;this._scene.mode===d.SCENE3D&&(p=c.referenceFrame);var m=this._updaters[p];h===m&&i(m)?m.updateObject(e,s):(i(h)&&h.removeObject(s),i(m)||(m=new I(this._scene,p),m.update(e),this._updaters[p]=m),s.updater=m,i(m)&&m.updateObject(e,s))}return!0},M.prototype.isDestroyed=function(){return!1},M.prototype.destroy=function(){this._entityCollection.collectionChanged.removeEventListener(M.prototype._onCollectionChanged,this);var e=this._updaters;for(var t in e)e.hasOwnProperty(t)&&e[t].destroy();return r(this)},M.prototype._onCollectionChanged=function(e,t,r,n){var o,a,s,l=this._items;for(o=t.length-1;o>-1;o--)a=t[o],i(a._path)&&i(a._position)&&l.set(a.id,new E(a));for(o=n.length-1;o>-1;o--)a=n[o],i(a._path)&&i(a._position)?l.contains(a.id)||l.set(a.id,new E(a)):(s=l.get(a.id),i(s)&&(s.updater.removeObject(s),l.remove(a.id)));for(o=r.length-1;o>-1;o--)a=r[o],s=l.get(a.id),i(s)&&(s.updater.removeObject(s),l.remove(a.id))},M._subSample=P,M}),i("Shaders/PointPrimitiveCollectionFS",[],function(){"use strict";return"varying vec4 v_color;\nvarying vec4 v_outlineColor;\nvarying float v_innerPercent;\nvarying float v_pixelDistance;\n#ifdef RENDER_FOR_PICK\nvarying vec4 v_pickColor;\n#endif\nvoid main()\n{\nfloat distanceToCenter = length(gl_PointCoord - vec2(0.5));\nfloat maxDistance = max(0.0, 0.5 - v_pixelDistance);\nfloat wholeAlpha = 1.0 - smoothstep(maxDistance, 0.5, distanceToCenter);\nfloat innerAlpha = 1.0 - smoothstep(maxDistance * v_innerPercent, 0.5 * v_innerPercent, distanceToCenter);\nvec4 color = mix(v_outlineColor, v_color, innerAlpha);\ncolor.a *= wholeAlpha;\nif (color.a < 0.005)\n{\ndiscard;\n}\n#ifdef RENDER_FOR_PICK\ngl_FragColor = v_pickColor;\n#else\ngl_FragColor = color;\n#endif\n}\n"}),i("Shaders/PointPrimitiveCollectionVS",[],function(){"use strict";return"uniform float u_maxTotalPointSize;\nattribute vec4 positionHighAndSize;\nattribute vec4 positionLowAndOutline;\nattribute vec4 compressedAttribute0;\nattribute vec4 compressedAttribute1;\nattribute vec4 scaleByDistance;\nvarying vec4 v_color;\nvarying vec4 v_outlineColor;\nvarying float v_innerPercent;\nvarying float v_pixelDistance;\n#ifdef RENDER_FOR_PICK\nvarying vec4 v_pickColor;\n#endif\nconst float SHIFT_LEFT8 = 256.0;\nconst float SHIFT_RIGHT8 = 1.0 / 256.0;\nvoid main()\n{\nvec3 positionHigh = positionHighAndSize.xyz;\nvec3 positionLow = positionLowAndOutline.xyz;\nfloat outlineWidthBothSides = 2.0 * positionLowAndOutline.w;\nfloat totalSize = positionHighAndSize.w + outlineWidthBothSides;\nfloat outlinePercent = outlineWidthBothSides / totalSize;\ntotalSize *= czm_resolutionScale;\ntotalSize += 3.0;\nfloat temp = compressedAttribute1.x * SHIFT_RIGHT8;\nfloat show = floor(temp);\n#ifdef EYE_DISTANCE_TRANSLUCENCY\nvec4 translucencyByDistance;\ntranslucencyByDistance.x = compressedAttribute1.z;\ntranslucencyByDistance.z = compressedAttribute1.w;\ntranslucencyByDistance.y = ((temp - floor(temp)) * SHIFT_LEFT8) / 255.0;\ntemp = compressedAttribute1.y * SHIFT_RIGHT8;\ntranslucencyByDistance.w = ((temp - floor(temp)) * SHIFT_LEFT8) / 255.0;\n#endif\nvec4 color;\nvec4 outlineColor;\n#ifdef RENDER_FOR_PICK\ncolor = vec4(0.0);\noutlineColor = vec4(0.0);\nvec4 pickColor;\ntemp = compressedAttribute0.z * SHIFT_RIGHT8;\npickColor.b = (temp - floor(temp)) * SHIFT_LEFT8;\ntemp = floor(temp) * SHIFT_RIGHT8;\npickColor.g = (temp - floor(temp)) * SHIFT_LEFT8;\npickColor.r = floor(temp);\n#else\ntemp = compressedAttribute0.x * SHIFT_RIGHT8;\ncolor.b = (temp - floor(temp)) * SHIFT_LEFT8;\ntemp = floor(temp) * SHIFT_RIGHT8;\ncolor.g = (temp - floor(temp)) * SHIFT_LEFT8;\ncolor.r = floor(temp);\ntemp = compressedAttribute0.y * SHIFT_RIGHT8;\noutlineColor.b = (temp - floor(temp)) * SHIFT_LEFT8;\ntemp = floor(temp) * SHIFT_RIGHT8;\noutlineColor.g = (temp - floor(temp)) * SHIFT_LEFT8;\noutlineColor.r = floor(temp);\n#endif\ntemp = compressedAttribute0.w * SHIFT_RIGHT8;\n#ifdef RENDER_FOR_PICK\npickColor.a = (temp - floor(temp)) * SHIFT_LEFT8;\npickColor = pickColor / 255.0;\n#endif\ntemp = floor(temp) * SHIFT_RIGHT8;\noutlineColor.a = (temp - floor(temp)) * SHIFT_LEFT8;\noutlineColor /= 255.0;\ncolor.a = floor(temp);\ncolor /= 255.0;\nvec4 p = czm_translateRelativeToEye(positionHigh, positionLow);\nvec4 positionEC = czm_modelViewRelativeToEye * p;\npositionEC.xyz *= show;\n#if defined(EYE_DISTANCE_SCALING) || defined(EYE_DISTANCE_TRANSLUCENCY)\nfloat lengthSq;\nif (czm_sceneMode == czm_sceneMode2D)\n{\nlengthSq = czm_eyeHeight2D.y;\n}\nelse\n{\nlengthSq = dot(positionEC.xyz, positionEC.xyz);\n}\n#endif\n#ifdef EYE_DISTANCE_SCALING\ntotalSize *= czm_nearFarScalar(scaleByDistance, lengthSq);\n#endif\ntotalSize = min(totalSize, u_maxTotalPointSize);\nif (totalSize < 1.0)\n{\npositionEC.xyz = vec3(0.0);\ntotalSize = 1.0;\n}\nfloat translucency = 1.0;\n#ifdef EYE_DISTANCE_TRANSLUCENCY\ntranslucency = czm_nearFarScalar(translucencyByDistance, lengthSq);\nif (translucency < 0.004)\n{\npositionEC.xyz = vec3(0.0);\n}\n#endif\nvec4 positionWC = czm_eyeToWindowCoordinates(positionEC);\ngl_Position = czm_viewportOrthographic * vec4(positionWC.xy, -positionWC.z, 1.0);\nv_color = color;\nv_color.a *= translucency;\nv_outlineColor = outlineColor;\nv_outlineColor.a *= translucency;\nv_innerPercent = 1.0 - outlinePercent;\nv_pixelDistance = 2.0 / totalSize;\ngl_PointSize = totalSize;\n#ifdef RENDER_FOR_PICK\nv_pickColor = pickColor;\n#endif\n}\n"}),i("Scene/PointPrimitive",["../Core/Cartesian2","../Core/Cartesian3","../Core/Cartesian4","../Core/Color","../Core/defaultValue","../Core/defined","../Core/defineProperties","../Core/DeveloperError","../Core/Matrix4","../Core/NearFarScalar","./SceneMode","./SceneTransforms"],function(e,t,i,r,n,o,a,s,l,u,c,h){"use strict";function d(e,i){e=n(e,n.EMPTY_OBJECT),this._show=n(e.show,!0),this._position=t.clone(n(e.position,t.ZERO)),this._actualPosition=t.clone(this._position),this._color=r.clone(n(e.color,r.WHITE)),this._outlineColor=r.clone(n(e.outlineColor,r.TRANSPARENT)),this._outlineWidth=n(e.outlineWidth,0),this._pixelSize=n(e.pixelSize,10),this._scaleByDistance=e.scaleByDistance,this._translucencyByDistance=e.translucencyByDistance,this._id=e.id,this._collection=n(e.collection,i),this._pickId=void 0,this._pointPrimitiveCollection=i,this._dirty=!1,this._index=-1}function p(e,t){var i=e._pointPrimitiveCollection;o(i)&&(i._updatePointPrimitive(e,t),e._dirty=!0)}var m=d.SHOW_INDEX=0,f=d.POSITION_INDEX=1,v=d.COLOR_INDEX=2,g=d.OUTLINE_COLOR_INDEX=3,_=d.OUTLINE_WIDTH_INDEX=4,y=d.PIXEL_SIZE_INDEX=5,C=d.SCALE_BY_DISTANCE_INDEX=6,E=d.TRANSLUCENCY_BY_DISTANCE_INDEX=7;d.NUMBER_OF_PROPERTIES=8,a(d.prototype,{show:{get:function(){return this._show},set:function(e){this._show!==e&&(this._show=e,p(this,m))}},position:{get:function(){return this._position},set:function(e){var i=this._position;t.equals(i,e)||(t.clone(e,i),t.clone(e,this._actualPosition),p(this,f))}},scaleByDistance:{get:function(){return this._scaleByDistance},set:function(e){var t=this._scaleByDistance;u.equals(t,e)||(this._scaleByDistance=u.clone(e,t),p(this,C))}},translucencyByDistance:{get:function(){return this._translucencyByDistance},set:function(e){var t=this._translucencyByDistance;u.equals(t,e)||(this._translucencyByDistance=u.clone(e,t),p(this,E))}},pixelSize:{get:function(){return this._pixelSize},set:function(e){this._pixelSize!==e&&(this._pixelSize=e,p(this,y))}},color:{get:function(){return this._color},set:function(e){var t=this._color;r.equals(t,e)||(r.clone(e,t),p(this,v))}},outlineColor:{get:function(){return this._outlineColor},set:function(e){var t=this._outlineColor;r.equals(t,e)||(r.clone(e,t),p(this,g))}},outlineWidth:{get:function(){return this._outlineWidth},set:function(e){this._outlineWidth!==e&&(this._outlineWidth=e,p(this,_))}},id:{get:function(){return this._id},set:function(e){this._id=e,o(this._pickId)&&(this._pickId.object.id=e)}}}),d.prototype.getPickId=function(e){return o(this._pickId)||(this._pickId=e.createPickId({primitive:this,collection:this._collection,id:this._id})),this._pickId},d.prototype._getActualPosition=function(){return this._actualPosition},d.prototype._setActualPosition=function(e){t.clone(e,this._actualPosition),p(this,f)};var S=new i;d._computeActualPosition=function(e,t,i){return t.mode===c.SCENE3D?e:(l.multiplyByPoint(i,e,S),h.computeActualWgs84Position(t,S))};var w=new l,T=new i;return d._computeScreenSpacePosition=function(e,t,r,n){var o=r.camera,a=o.viewMatrix,s=o.frustum.projectionMatrix,u=l.multiplyTransformation(a,e,w),c=l.multiplyByVector(u,i.fromElements(t.x,t.y,t.z,1,T),T),d=l.multiplyByVector(s,c,T),p=h.clipToGLWindowCoordinates(r,d,n);return p},d.prototype.computeScreenSpacePosition=function(t,i){var r=this._pointPrimitiveCollection;o(i)||(i=new e);var n=r.modelMatrix,a=d._computeScreenSpacePosition(n,this._actualPosition,t,i);return a.y=t.canvas.clientHeight-a.y,a},d.prototype.equals=function(e){return this===e||o(e)&&this._id===e._id&&t.equals(this._position,e._position)&&r.equals(this._color,e._color)&&this._pixelSize===e._pixelSize&&this._outlineWidth===e._outlineWidth&&this._show===e._show&&r.equals(this._outlineColor,e._outlineColor)&&u.equals(this._scaleByDistance,e._scaleByDistance)&&u.equals(this._translucencyByDistance,e._translucencyByDistance)},d.prototype._destroy=function(){this._pickId=this._pickId&&this._pickId.destroy(),this._pointPrimitiveCollection=void 0},d}),i("Scene/PointPrimitiveCollection",["../Core/BoundingSphere","../Core/Cartesian2","../Core/Cartesian3","../Core/Color","../Core/ComponentDatatype","../Core/defaultValue","../Core/defined","../Core/defineProperties","../Core/destroyObject","../Core/DeveloperError","../Core/EncodedCartesian3","../Core/Math","../Core/Matrix4","../Core/PrimitiveType","../Renderer/BufferUsage","../Renderer/ContextLimits","../Renderer/DrawCommand","../Renderer/RenderState","../Renderer/ShaderProgram","../Renderer/ShaderSource","../Renderer/VertexArrayFacade","../Shaders/PointPrimitiveCollectionFS","../Shaders/PointPrimitiveCollectionVS","./BlendingState","./Pass","./PointPrimitive","./SceneMode"],function(e,t,i,r,n,o,a,s,l,u,c,h,d,p,m,f,v,g,_,y,C,E,S,w,T,x,b){"use strict";function A(t){t=o(t,o.EMPTY_OBJECT),this._sp=void 0,this._rs=void 0,this._vaf=void 0,this._spPick=void 0,this._pointPrimitives=[],this._pointPrimitivesToUpdate=[],this._pointPrimitivesToUpdateIndex=0,this._pointPrimitivesRemoved=!1,this._createVertexArray=!1,this._shaderScaleByDistance=!1,this._compiledShaderScaleByDistance=!1,this._compiledShaderScaleByDistancePick=!1,this._shaderTranslucencyByDistance=!1,this._compiledShaderTranslucencyByDistance=!1,this._compiledShaderTranslucencyByDistancePick=!1,this._propertiesChanged=new Uint32Array(Y),this._maxPixelSize=1,this._baseVolume=new e,this._baseVolumeWC=new e,this._baseVolume2D=new e,this._boundingVolume=new e,this._boundingVolumeDirty=!1,this._colorCommands=[],this._pickCommands=[],this.modelMatrix=d.clone(o(t.modelMatrix,d.IDENTITY)),this._modelMatrix=d.clone(d.IDENTITY),this.debugShowBoundingVolume=o(t.debugShowBoundingVolume,!1),this._mode=b.SCENE3D,this._maxTotalPointSize=1,this._buffersUsage=[m.STATIC_DRAW,m.STATIC_DRAW,m.STATIC_DRAW,m.STATIC_DRAW,m.STATIC_DRAW,m.STATIC_DRAW,m.STATIC_DRAW,m.STATIC_DRAW];var i=this;this._uniforms={u_maxTotalPointSize:function(){return i._maxTotalPointSize}}}function P(e){for(var t=e.length,i=0;t>i;++i)e[i]&&e[i]._destroy()}function I(e){if(e._pointPrimitivesRemoved){e._pointPrimitivesRemoved=!1;for(var t=[],i=e._pointPrimitives,r=i.length,n=0,o=0;r>n;++n){var a=i[n];a&&(a._index=o++,t.push(a))}e._pointPrimitives=t}}function M(e,t,i){return new C(e,[{index:X.positionHighAndSize,componentsPerAttribute:4,componentDatatype:n.FLOAT,usage:i[z]},{index:X.positionLowAndShow,componentsPerAttribute:4,componentDatatype:n.FLOAT,usage:i[z]},{index:X.compressedAttribute0,componentsPerAttribute:4,componentDatatype:n.FLOAT,usage:i[U]},{index:X.compressedAttribute1,componentsPerAttribute:4,componentDatatype:n.FLOAT,usage:i[j]},{index:X.scaleByDistance,componentsPerAttribute:4,componentDatatype:n.FLOAT,usage:i[q]}],t)}function D(t,i,r,n){var o=n._index,a=n._getActualPosition();t._mode===b.SCENE3D&&(e.expand(t._baseVolume,a,t._baseVolume),t._boundingVolumeDirty=!0),c.fromCartesian(a,Z);var s=n.pixelSize,l=n.outlineWidth;t._maxPixelSize=Math.max(t._maxPixelSize,s+l);var u=r[X.positionHighAndSize],h=Z.high;u(o,h.x,h.y,h.z,s);var d=r[X.positionLowAndOutline],p=Z.low;d(o,p.x,p.y,p.z,l)}function R(e,t,i,n){var o=n._index,a=n.color,s=n.getPickId(t).color,l=n.outlineColor,u=r.floatToByte(a.red),c=r.floatToByte(a.green),h=r.floatToByte(a.blue),d=u*K+c*Q+h;u=r.floatToByte(l.red),c=r.floatToByte(l.green),h=r.floatToByte(l.blue);var p=u*K+c*Q+h;u=r.floatToByte(s.red),c=r.floatToByte(s.green),h=r.floatToByte(s.blue);var m=u*K+c*Q+h,f=r.floatToByte(a.alpha)*K+r.floatToByte(l.alpha)*Q+r.floatToByte(s.alpha),v=i[X.compressedAttribute0];v(o,d,p,m,f)}function O(e,t,i,r){var n=r._index,o=0,s=1,l=1,u=1,c=r.translucencyByDistance;a(c)&&(o=c.near,s=c.nearValue,l=c.far,u=c.farValue,(1!==s||1!==u)&&(e._shaderTranslucencyByDistance=!0));var d=r.show;0===r.color.alpha&&0===r.outlineColor.alpha&&(d=!1),s=h.clamp(s,0,1),s=1===s?255:255*s|0;var p=(d?1:0)*Q+s;u=h.clamp(u,0,1),u=1===u?255:255*u|0;var m=u,f=i[X.compressedAttribute1];f(n,p,m,o,l)}function N(e,t,i,r){var n=r._index,o=i[X.scaleByDistance],s=0,l=1,u=1,c=1,h=r.scaleByDistance;a(h)&&(s=h.near, +l=h.nearValue,u=h.far,c=h.farValue,(1!==l||1!==c)&&(e._shaderScaleByDistance=!0)),o(n,s,l,u,c)}function L(e,t,i,r){D(e,t,i,r),R(e,t,i,r),O(e,t,i,r),N(e,t,i,r)}function F(t,i,r,n,o,s){var l;n.mode===b.SCENE3D?(l=t._baseVolume,t._boundingVolumeDirty=!0):l=t._baseVolume2D;for(var u=[],c=0;r>c;++c){var h=i[c],d=h.position,p=x._computeActualPosition(d,n,o);a(p)&&(h._setActualPosition(p),s?u.push(p):e.expand(l,p,l))}s&&e.fromPoints(u,l)}function B(e,t){var i=t.mode,r=e._pointPrimitives,n=e._pointPrimitivesToUpdate,o=e._modelMatrix;e._createVertexArray||e._mode!==i||i!==b.SCENE3D&&!d.equals(o,e.modelMatrix)?(e._mode=i,d.clone(e.modelMatrix,o),e._createVertexArray=!0,(i===b.SCENE3D||i===b.SCENE2D||i===b.COLUMBUS_VIEW)&&F(e,r,r.length,t,o,!0)):i===b.MORPHING?F(e,r,r.length,t,o,!0):(i===b.SCENE2D||i===b.COLUMBUS_VIEW)&&F(e,n,e._pointPrimitivesToUpdateIndex,t,o,!1)}function V(e,t,i){var r=t.camera.getPixelSize(i,t.context.drawingBufferWidth,t.context.drawingBufferHeight),n=r*e._maxPixelSize;i.radius+=n}var k=x.SHOW_INDEX,z=x.POSITION_INDEX,U=x.COLOR_INDEX,G=x.OUTLINE_COLOR_INDEX,W=x.OUTLINE_WIDTH_INDEX,H=x.PIXEL_SIZE_INDEX,q=x.SCALE_BY_DISTANCE_INDEX,j=x.TRANSLUCENCY_BY_DISTANCE_INDEX,Y=x.NUMBER_OF_PROPERTIES,X={positionHighAndSize:0,positionLowAndOutline:1,compressedAttribute0:2,compressedAttribute1:3,scaleByDistance:4};s(A.prototype,{length:{get:function(){return I(this),this._pointPrimitives.length}}}),A.prototype.add=function(e){var t=new x(e,this);return t._index=this._pointPrimitives.length,this._pointPrimitives.push(t),this._createVertexArray=!0,t},A.prototype.remove=function(e){return this.contains(e)?(this._pointPrimitives[e._index]=null,this._pointPrimitivesRemoved=!0,this._createVertexArray=!0,e._destroy(),!0):!1},A.prototype.removeAll=function(){P(this._pointPrimitives),this._pointPrimitives=[],this._pointPrimitivesToUpdate=[],this._pointPrimitivesToUpdateIndex=0,this._pointPrimitivesRemoved=!1,this._createVertexArray=!0},A.prototype._updatePointPrimitive=function(e,t){e._dirty||(this._pointPrimitivesToUpdate[this._pointPrimitivesToUpdateIndex++]=e),++this._propertiesChanged[t]},A.prototype.contains=function(e){return a(e)&&e._pointPrimitiveCollection===this},A.prototype.get=function(e){return I(this),this._pointPrimitives[e]},A.prototype.computeNewBuffersUsage=function(){for(var e=this._buffersUsage,t=!1,i=this._propertiesChanged,r=0;Y>r;++r){var n=0===i[r]?m.STATIC_DRAW:m.STREAM_DRAW;t=t||e[r]!==n,e[r]=n}return t};var Z=new c,K=65536,Q=256,J=[];return A.prototype.update=function(t){I(this),this._maxTotalPointSize=f.maximumAliasedPointSize,B(this,t);var i,r=this._pointPrimitives,n=r.length,o=this._pointPrimitivesToUpdate,s=this._pointPrimitivesToUpdateIndex,l=this._propertiesChanged,u=this._createVertexArray,c=t.context,h=t.passes,m=h.pick;if(u||!m&&this.computeNewBuffersUsage()){this._createVertexArray=!1;for(var C=0;Y>C;++C)l[C]=0;if(this._vaf=this._vaf&&this._vaf.destroy(),n>0){this._vaf=M(c,n,this._buffersUsage),i=this._vaf.writers;for(var x=0;n>x;++x){var A=this._pointPrimitives[x];A._dirty=!1,L(this,c,i,A)}this._vaf.commit()}this._pointPrimitivesToUpdateIndex=0}else if(s>0){var P=J;P.length=0,(l[z]||l[W]||l[H])&&P.push(D),(l[U]||l[G])&&P.push(R),(l[k]||l[j])&&P.push(O),l[q]&&P.push(N);var F=P.length;if(i=this._vaf.writers,s/n>.1){for(var Z=0;s>Z;++Z){var K=o[Z];K._dirty=!1;for(var Q=0;F>Q;++Q)P[Q](this,c,i,K)}this._vaf.commit()}else{for(var $=0;s>$;++$){var ee=o[$];ee._dirty=!1;for(var te=0;F>te;++te)P[te](this,c,i,ee);this._vaf.subCommit(ee._index,1)}this._vaf.endSubCommits()}this._pointPrimitivesToUpdateIndex=0}if(s>1.5*n&&(o.length=n),a(this._vaf)&&a(this._vaf.va)){this._boundingVolumeDirty&&(this._boundingVolumeDirty=!1,e.transform(this._baseVolume,this.modelMatrix,this._baseVolumeWC));var ie,re=d.IDENTITY;t.mode===b.SCENE3D?(re=this.modelMatrix,ie=e.clone(this._baseVolumeWC,this._boundingVolume)):ie=e.clone(this._baseVolume2D,this._boundingVolume),V(this,t,ie);var ne,oe,ae,se,le,ue,ce=t.commandList;if(h.render){var he=this._colorCommands;for(a(this._rs)||(this._rs=g.fromCache({depthTest:{enabled:!0},blending:w.ALPHA_BLEND})),(!a(this._sp)||this._shaderScaleByDistance&&!this._compiledShaderScaleByDistance||this._shaderTranslucencyByDistance&&!this._compiledShaderTranslucencyByDistance)&&(le=new y({sources:[S]}),this._shaderScaleByDistance&&le.defines.push("EYE_DISTANCE_SCALING"),this._shaderTranslucencyByDistance&&le.defines.push("EYE_DISTANCE_TRANSLUCENCY"),this._sp=_.replaceCache({context:c,shaderProgram:this._sp,vertexShaderSource:le,fragmentShaderSource:E,attributeLocations:X}),this._compiledShaderScaleByDistance=this._shaderScaleByDistance,this._compiledShaderTranslucencyByDistance=this._shaderTranslucencyByDistance),ne=this._vaf.va,oe=ne.length,he.length=oe,se=0;oe>se;++se)ae=he[se],a(ae)||(ae=he[se]=new v({primitiveType:p.POINTS,pass:T.OPAQUE,owner:this})),ae.boundingVolume=ie,ae.modelMatrix=re,ae.shaderProgram=this._sp,ae.uniformMap=this._uniforms,ae.vertexArray=ne[se].va,ae.renderState=this._rs,ae.debugShowBoundingVolume=this.debugShowBoundingVolume,ce.push(ae)}if(m){var de=this._pickCommands;for((!a(this._spPick)||this._shaderScaleByDistance&&!this._compiledShaderScaleByDistancePick||this._shaderTranslucencyByDistance&&!this._compiledShaderTranslucencyByDistancePick)&&(le=new y({defines:["RENDER_FOR_PICK"],sources:[S]}),this._shaderScaleByDistance&&le.defines.push("EYE_DISTANCE_SCALING"),this._shaderTranslucencyByDistance&&le.defines.push("EYE_DISTANCE_TRANSLUCENCY"),ue=new y({defines:["RENDER_FOR_PICK"],sources:[E]}),this._spPick=_.replaceCache({context:c,shaderProgram:this._spPick,vertexShaderSource:le,fragmentShaderSource:ue,attributeLocations:X}),this._compiledShaderScaleByDistancePick=this._shaderScaleByDistance,this._compiledShaderTranslucencyByDistancePick=this._shaderTranslucencyByDistance),ne=this._vaf.va,oe=ne.length,de.length=oe,se=0;oe>se;++se)ae=de[se],a(ae)||(ae=de[se]=new v({primitiveType:p.POINTS,pass:T.OPAQUE,owner:this})),ae.boundingVolume=ie,ae.modelMatrix=re,ae.shaderProgram=this._spPick,ae.uniformMap=this._uniforms,ae.vertexArray=ne[se].va,ae.renderState=this._rs,ce.push(ae)}}},A.prototype.isDestroyed=function(){return!1},A.prototype.destroy=function(){return this._sp=this._sp&&this._sp.destroy(),this._spPick=this._spPick&&this._spPick.destroy(),this._vaf=this._vaf&&this._vaf.destroy(),P(this._pointPrimitives),l(this)},A}),i("DataSources/PointVisualizer",["../Core/AssociativeArray","../Core/Cartesian3","../Core/Color","../Core/defined","../Core/destroyObject","../Core/DeveloperError","../Core/NearFarScalar","../Scene/PointPrimitiveCollection","./BoundingSphereState","./Property"],function(e,t,i,r,n,o,a,s,l,u){"use strict";function c(e){this.entity=e,this.pointPrimitive=void 0,this.color=void 0,this.outlineColor=void 0,this.pixelSize=void 0,this.outlineWidth=void 0}function h(t,i){i.collectionChanged.addEventListener(h.prototype._onCollectionChanged,this),this._scene=t,this._unusedIndexes=[],this._entityCollection=i,this._pointPrimitiveCollection=void 0,this._items=new e,this._onCollectionChanged(i,i.values,[],[])}function d(e,t){if(r(e)){var i=e.pointPrimitive;r(i)&&(e.pointPrimitive=void 0,i.show=!1,t.push(i._index))}}var p=i.WHITE,m=i.BLACK,f=0,v=1,g=new i,_=new t,y=new i,C=new a,E=new a;return h.prototype.update=function(e){for(var t=this._items.values,i=this._unusedIndexes,n=0,o=t.length;o>n;n++){var a=t[n],l=a.entity,c=l._point,h=a.pointPrimitive,S=l.isShowing&&l.isAvailable(e)&&u.getValueOrDefault(c._show,e,!0);if(S&&(_=u.getValueOrUndefined(l._position,e,_),S=r(_)),S){if(!r(h)){var w=this._pointPrimitiveCollection;r(w)||(w=new s,this._pointPrimitiveCollection=w,this._scene.primitives.add(w));var T=i.length;h=T>0?w.get(i.pop()):w.add(),h.id=l,a.pointPrimitive=h}h.show=!0,h.position=_,h.scaleByDistance=u.getValueOrUndefined(c._scaleByDistance,e,C),h.translucencyByDistance=u.getValueOrUndefined(c._translucencyByDistance,e,E),h.color=u.getValueOrDefault(c._color,e,p,g),h.outlineColor=u.getValueOrDefault(c._outlineColor,e,m,y),h.outlineWidth=u.getValueOrDefault(c._outlineWidth,e,f),h.pixelSize=u.getValueOrDefault(c._pixelSize,e,v)}else d(a,i)}return!0},h.prototype.getBoundingSphere=function(e,i){var n=this._items.get(e.id);return r(n)&&r(n.pointPrimitive)?(i.center=t.clone(n.pointPrimitive.position,i.center),i.radius=0,l.DONE):l.FAILED},h.prototype.isDestroyed=function(){return!1},h.prototype.destroy=function(){return this._entityCollection.collectionChanged.removeEventListener(h.prototype._onCollectionChanged,this),r(this._pointPrimitiveCollection)&&this._scene.primitives.remove(this._pointPrimitiveCollection),n(this)},h.prototype._onCollectionChanged=function(e,t,i,n){var o,a,s=this._unusedIndexes,l=this._items;for(o=t.length-1;o>-1;o--)a=t[o],r(a._point)&&r(a._position)&&l.set(a.id,new c(a));for(o=n.length-1;o>-1;o--)a=n[o],r(a._point)&&r(a._position)?l.contains(a.id)||l.set(a.id,new c(a)):(d(l.get(a.id),s),l.remove(a.id));for(o=i.length-1;o>-1;o--)a=i[o],d(l.get(a.id),s),l.remove(a.id)},h}),i("DataSources/PolygonGeometryUpdater",["../Core/Color","../Core/ColorGeometryInstanceAttribute","../Core/defaultValue","../Core/defined","../Core/defineProperties","../Core/destroyObject","../Core/DeveloperError","../Core/Event","../Core/GeometryInstance","../Core/isArray","../Core/Iso8601","../Core/PolygonGeometry","../Core/PolygonHierarchy","../Core/PolygonOutlineGeometry","../Core/ShowGeometryInstanceAttribute","../Scene/MaterialAppearance","../Scene/PerInstanceColorAppearance","../Scene/Primitive","./ColorMaterialProperty","./ConstantProperty","./dynamicGeometryGetBoundingSphere","./MaterialProperty","./Property"],function(e,t,i,r,n,o,a,s,l,u,c,h,d,p,m,f,v,g,_,y,C,E,S){"use strict";function w(e){this.id=e,this.vertexFormat=void 0,this.polygonHierarchy=void 0,this.perPositionHeight=void 0,this.height=void 0,this.extrudedHeight=void 0,this.granularity=void 0,this.stRotation=void 0}function T(e,t){this._entity=e,this._scene=t,this._entitySubscription=e.definitionChanged.addEventListener(T.prototype._onEntityPropertyChanged,this),this._fillEnabled=!1,this._isClosed=!1,this._dynamic=!1,this._outlineEnabled=!1,this._geometryChanged=new s,this._showProperty=void 0,this._materialProperty=void 0,this._hasConstantOutline=!0,this._showOutlineProperty=void 0,this._outlineColorProperty=void 0,this._outlineWidth=1,this._options=new w(e),this._onEntityPropertyChanged(e,"polygon",e.polygon,void 0)}function x(e,t){this._primitives=e,this._primitive=void 0,this._outlinePrimitive=void 0,this._geometryUpdater=t,this._options=new w(t._entity)}var b=new _(e.WHITE),A=new y(!0),P=new y(!0),I=new y(!1),M=new y(e.BLACK),D=new e;return n(T,{perInstanceColorAppearanceType:{value:v},materialAppearanceType:{value:f}}),n(T.prototype,{entity:{get:function(){return this._entity}},fillEnabled:{get:function(){return this._fillEnabled}},hasConstantFill:{get:function(){return!this._fillEnabled||!r(this._entity.availability)&&S.isConstant(this._showProperty)&&S.isConstant(this._fillProperty)}},fillMaterialProperty:{get:function(){return this._materialProperty}},outlineEnabled:{get:function(){return this._outlineEnabled}},hasConstantOutline:{get:function(){return!this._outlineEnabled||!r(this._entity.availability)&&S.isConstant(this._showProperty)&&S.isConstant(this._showOutlineProperty)}},outlineColorProperty:{get:function(){return this._outlineColorProperty}},outlineWidth:{get:function(){return this._outlineWidth}},isDynamic:{get:function(){return this._dynamic}},isClosed:{get:function(){return this._isClosed}},geometryChanged:{get:function(){return this._geometryChanged}}}),T.prototype.isOutlineVisible=function(e){var t=this._entity;return this._outlineEnabled&&t.isAvailable(e)&&this._showProperty.getValue(e)&&this._showOutlineProperty.getValue(e)},T.prototype.isFilled=function(e){var t=this._entity;return this._fillEnabled&&t.isAvailable(e)&&this._showProperty.getValue(e)&&this._fillProperty.getValue(e)},T.prototype.createFillGeometryInstance=function(i){var n,o,a=this._entity,s=a.isAvailable(i),u=new m(s&&a.isShowing&&this._showProperty.getValue(i)&&this._fillProperty.getValue(i));if(this._materialProperty instanceof _){var c=e.WHITE;r(this._materialProperty.color)&&(this._materialProperty.color.isConstant||s)&&(c=this._materialProperty.color.getValue(i)),o=t.fromColor(c),n={show:u,color:o}}else n={show:u};return new l({id:a,geometry:new h(this._options),attributes:n})},T.prototype.createOutlineGeometryInstance=function(i){var r=this._entity,n=r.isAvailable(i),o=S.getValueOrDefault(this._outlineColorProperty,i,e.BLACK);return new l({id:r,geometry:new p(this._options),attributes:{show:new m(n&&r.isShowing&&this._showProperty.getValue(i)&&this._showOutlineProperty.getValue(i)),color:t.fromColor(o)}})},T.prototype.isDestroyed=function(){return!1},T.prototype.destroy=function(){this._entitySubscription(),o(this)},T.prototype._onEntityPropertyChanged=function(e,t,n,o){if("availability"===t||"polygon"===t){var a=this._entity.polygon;if(!r(a))return void((this._fillEnabled||this._outlineEnabled)&&(this._fillEnabled=!1,this._outlineEnabled=!1,this._geometryChanged.raiseEvent(this)));var s=a.fill,l=r(s)&&s.isConstant?s.getValue(c.MINIMUM_VALUE):!0,h=a.outline,p=r(h);if(p&&h.isConstant&&(p=h.getValue(c.MINIMUM_VALUE)),!l&&!p)return void((this._fillEnabled||this._outlineEnabled)&&(this._fillEnabled=!1,this._outlineEnabled=!1,this._geometryChanged.raiseEvent(this)));var m=a.hierarchy,g=a.show;if(r(g)&&g.isConstant&&!g.getValue(c.MINIMUM_VALUE)||!r(m))return void((this._fillEnabled||this._outlineEnabled)&&(this._fillEnabled=!1,this._outlineEnabled=!1,this._geometryChanged.raiseEvent(this)));var y=i(a.material,b),C=y instanceof _;this._materialProperty=y,this._fillProperty=i(s,P),this._showProperty=i(g,A),this._showOutlineProperty=i(a.outline,I),this._outlineColorProperty=p?i(a.outlineColor,M):void 0;var E=a.height,w=a.extrudedHeight,T=a.granularity,x=a.stRotation,D=a.outlineWidth,R=a.perPositionHeight;if(this._fillEnabled=l,this._outlineEnabled=p,m.isConstant&&S.isConstant(E)&&S.isConstant(w)&&S.isConstant(T)&&S.isConstant(x)&&S.isConstant(D)&&S.isConstant(R)){var O=this._options;O.vertexFormat=C?v.VERTEX_FORMAT:f.MaterialSupport.TEXTURED.vertexFormat;var N=m.getValue(c.MINIMUM_VALUE);u(N)&&(N=new d(N));var L=r(E)?E.getValue(c.MINIMUM_VALUE):void 0,F=r(w)?w.getValue(c.MINIMUM_VALUE):void 0;O.polygonHierarchy=N,O.height=L,O.extrudedHeight=F,O.granularity=r(T)?T.getValue(c.MINIMUM_VALUE):void 0,O.stRotation=r(x)?x.getValue(c.MINIMUM_VALUE):void 0,O.perPositionHeight=r(R)?R.getValue(c.MINIMUM_VALUE):void 0,this._outlineWidth=r(D)?D.getValue(c.MINIMUM_VALUE):1,this._isClosed=r(F)&&F!==L,this._dynamic=!1,this._geometryChanged.raiseEvent(this)}else this._dynamic||(this._dynamic=!0,this._geometryChanged.raiseEvent(this))}},T.prototype.createDynamicUpdater=function(e){return new x(e,this)},x.prototype.update=function(i){var n=this._primitives;n.removeAndDestroy(this._primitive),n.removeAndDestroy(this._outlinePrimitive),this._primitive=void 0,this._outlinePrimitive=void 0;var o=this._geometryUpdater,a=o._entity,s=a.polygon;if(a.isShowing&&a.isAvailable(i)&&S.getValueOrDefault(s.show,i,!0)){var c=this._options,m=S.getValueOrUndefined(s.hierarchy,i);if(r(m)){if(u(m)?c.polygonHierarchy=new d(m):c.polygonHierarchy=m,c.height=S.getValueOrUndefined(s.height,i),c.extrudedHeight=S.getValueOrUndefined(s.extrudedHeight,i),c.granularity=S.getValueOrUndefined(s.granularity,i),c.stRotation=S.getValueOrUndefined(s.stRotation,i),c.perPositionHeight=S.getValueOrUndefined(s.perPositionHeight,i),S.getValueOrDefault(s.fill,i,!0)){var _=E.getValue(i,o.fillMaterialProperty,this._material);this._material=_;var y=new f({material:_,translucent:_.isTranslucent(),closed:r(c.extrudedHeight)&&c.extrudedHeight!==c.height});c.vertexFormat=y.vertexFormat,this._primitive=n.add(new g({geometryInstances:new l({id:a,geometry:new h(c)}),appearance:y,asynchronous:!1}))}if(S.getValueOrDefault(s.outline,i,!1)){c.vertexFormat=v.VERTEX_FORMAT;var C=S.getValueOrClonedDefault(s.outlineColor,i,e.BLACK,D),w=S.getValueOrDefault(s.outlineWidth,i,1),T=1!==C.alpha;this._outlinePrimitive=n.add(new g({geometryInstances:new l({id:a,geometry:new p(c),attributes:{color:t.fromColor(C)}}),appearance:new v({flat:!0,translucent:T,renderState:{lineWidth:o._scene.clampLineWidth(w)}}),asynchronous:!1}))}}}},x.prototype.getBoundingSphere=function(e,t){return C(e,this._primitive,this._outlinePrimitive,t)},x.prototype.isDestroyed=function(){return!1},x.prototype.destroy=function(){var e=this._primitives;e.removeAndDestroy(this._primitive),e.removeAndDestroy(this._outlinePrimitive),o(this)},T}),i("Shaders/Appearances/PolylineColorAppearanceVS",[],function(){"use strict";return"attribute vec3 position3DHigh;\nattribute vec3 position3DLow;\nattribute vec3 prevPosition3DHigh;\nattribute vec3 prevPosition3DLow;\nattribute vec3 nextPosition3DHigh;\nattribute vec3 nextPosition3DLow;\nattribute vec2 expandAndWidth;\nattribute vec4 color;\nvarying vec4 v_color;\nvoid main()\n{\nfloat expandDir = expandAndWidth.x;\nfloat width = abs(expandAndWidth.y) + 0.5;\nbool usePrev = expandAndWidth.y < 0.0;\nvec4 p = czm_computePosition();\nvec4 prev = czm_computePrevPosition();\nvec4 next = czm_computeNextPosition();\nv_color = color;\nvec4 positionWC = getPolylineWindowCoordinates(p, prev, next, expandDir, width, usePrev);\ngl_Position = czm_viewportOrthographic * positionWC;\n}\n"}),i("Scene/PolylineColorAppearance",["../Core/defaultValue","../Core/defineProperties","../Core/VertexFormat","../Shaders/Appearances/PerInstanceFlatColorAppearanceFS","../Shaders/Appearances/PolylineColorAppearanceVS","../Shaders/PolylineCommon","./Appearance"],function(e,t,i,r,n,o,a){"use strict";function s(t){t=e(t,e.EMPTY_OBJECT);var i=e(t.translucent,!0),r=!1,n=s.VERTEX_FORMAT;this.material=void 0,this.translucent=i,this._vertexShaderSource=e(t.vertexShaderSource,l),this._fragmentShaderSource=e(t.fragmentShaderSource,u),this._renderState=a.getDefaultRenderState(i,r,t.renderState),this._closed=r,this._vertexFormat=n}var l=o+"\n"+n,u=r;return t(s.prototype,{vertexShaderSource:{get:function(){return this._vertexShaderSource}},fragmentShaderSource:{get:function(){return this._fragmentShaderSource}},renderState:{get:function(){return this._renderState}},closed:{get:function(){return this._closed}},vertexFormat:{get:function(){return this._vertexFormat}}}),s.VERTEX_FORMAT=i.POSITION_ONLY,s.prototype.getFragmentShaderSource=a.prototype.getFragmentShaderSource,s.prototype.isTranslucent=a.prototype.isTranslucent,s.prototype.getRenderState=a.prototype.getRenderState,s}),i("Shaders/Appearances/PolylineMaterialAppearanceVS",[],function(){"use strict";return"attribute vec3 position3DHigh;\nattribute vec3 position3DLow;\nattribute vec3 prevPosition3DHigh;\nattribute vec3 prevPosition3DLow;\nattribute vec3 nextPosition3DHigh;\nattribute vec3 nextPosition3DLow;\nattribute vec2 expandAndWidth;\nattribute vec2 st;\nvarying float v_width;\nvarying vec2 v_st;\nvoid main()\n{\nfloat expandDir = expandAndWidth.x;\nfloat width = abs(expandAndWidth.y) + 0.5;\nbool usePrev = expandAndWidth.y < 0.0;\nvec4 p = czm_computePosition();\nvec4 prev = czm_computePrevPosition();\nvec4 next = czm_computeNextPosition();\nv_width = width;\nv_st = st;\nvec4 positionWC = getPolylineWindowCoordinates(p, prev, next, expandDir, width, usePrev);\ngl_Position = czm_viewportOrthographic * positionWC;\n}\n"}),i("Scene/PolylineMaterialAppearance",["../Core/defaultValue","../Core/defined","../Core/defineProperties","../Core/VertexFormat","../Shaders/Appearances/PolylineMaterialAppearanceVS","../Shaders/PolylineCommon","../Shaders/PolylineFS","./Appearance","./Material"],function(e,t,i,r,n,o,a,s,l){"use strict";function u(i){i=e(i,e.EMPTY_OBJECT);var r=e(i.translucent,!0),n=!1,o=u.VERTEX_FORMAT;this.material=t(i.material)?i.material:l.fromType(l.ColorType),this.translucent=r,this._vertexShaderSource=e(i.vertexShaderSource,c),this._fragmentShaderSource=e(i.fragmentShaderSource,h),this._renderState=s.getDefaultRenderState(r,n,i.renderState),this._closed=n,this._vertexFormat=o}var c=o+"\n"+n,h=a;return i(u.prototype,{vertexShaderSource:{get:function(){return this._vertexShaderSource}},fragmentShaderSource:{get:function(){return this._fragmentShaderSource}},renderState:{get:function(){return this._renderState}},closed:{get:function(){return this._closed}},vertexFormat:{get:function(){return this._vertexFormat}}}),u.VERTEX_FORMAT=r.POSITION_AND_ST,u.prototype.getFragmentShaderSource=s.prototype.getFragmentShaderSource,u.prototype.isTranslucent=s.prototype.isTranslucent,u.prototype.getRenderState=s.prototype.getRenderState,u}),i("DataSources/PolylineGeometryUpdater",["../Core/BoundingSphere","../Core/Color","../Core/ColorGeometryInstanceAttribute","../Core/defaultValue","../Core/defined","../Core/defineProperties","../Core/destroyObject","../Core/DeveloperError","../Core/Ellipsoid","../Core/Event","../Core/GeometryInstance","../Core/Iso8601","../Core/PolylineGeometry","../Core/PolylinePipeline","../Core/ShowGeometryInstanceAttribute","../Scene/PolylineCollection","../Scene/PolylineColorAppearance","../Scene/PolylineMaterialAppearance","./BoundingSphereState","./ColorMaterialProperty","./ConstantProperty","./MaterialProperty","./Property"],function(e,t,i,r,n,o,a,s,l,u,c,h,d,p,m,f,v,g,_,y,C,E,S){"use strict";function w(e){this.id=e,this.vertexFormat=void 0,this.positions=void 0,this.width=void 0,this.followSurface=void 0,this.granularity=void 0}function T(e,t){this._entity=e,this._scene=t,this._entitySubscription=e.definitionChanged.addEventListener(T.prototype._onEntityPropertyChanged,this),this._fillEnabled=!1,this._dynamic=!1,this._geometryChanged=new u,this._showProperty=void 0,this._materialProperty=void 0,this._options=new w(e),this._onEntityPropertyChanged(e,"polyline",e.polyline,void 0)}function x(e,t){var i=t._scene.id,r=b[i];!n(r)||r.isDestroyed()?(r=new f,b[i]=r,e.add(r)):e.contains(r)||e.add(r);var o=r.add();o.id=t._entity,this._line=o,this._primitives=e,this._geometryUpdater=t,this._positions=[],I.ellipsoid=t._scene.globe.ellipsoid}var b={},A=new y(t.WHITE),P=new C(!0);o(T,{perInstanceColorAppearanceType:{value:v},materialAppearanceType:{value:g}}),o(T.prototype,{entity:{get:function(){return this._entity}},fillEnabled:{get:function(){return this._fillEnabled}},hasConstantFill:{get:function(){return!this._fillEnabled||!n(this._entity.availability)&&S.isConstant(this._showProperty)}},fillMaterialProperty:{get:function(){return this._materialProperty}},outlineEnabled:{value:!1},hasConstantOutline:{value:!0},outlineColorProperty:{value:void 0},isDynamic:{get:function(){return this._dynamic}},isClosed:{value:!1},geometryChanged:{get:function(){return this._geometryChanged}}}),T.prototype.isOutlineVisible=function(e){return!1},T.prototype.isFilled=function(e){var t=this._entity;return this._fillEnabled&&t.isAvailable(e)&&this._showProperty.getValue(e)},T.prototype.createFillGeometryInstance=function(e){var r,o,a=this._entity,s=a.isAvailable(e),l=new m(s&&a.isShowing&&this._showProperty.getValue(e));if(this._materialProperty instanceof y){var u=t.WHITE;n(this._materialProperty.color)&&(this._materialProperty.color.isConstant||s)&&(u=this._materialProperty.color.getValue(e)),r=i.fromColor(u),o={show:l,color:r}}else o={show:l};return new c({id:a,geometry:new d(this._options),attributes:o})},T.prototype.createOutlineGeometryInstance=function(e){},T.prototype.isDestroyed=function(){return!1},T.prototype.destroy=function(){this._entitySubscription(),a(this)},T.prototype._onEntityPropertyChanged=function(e,t,i,o){if("availability"===t||"polyline"===t){var a=this._entity.polyline;if(!n(a))return void(this._fillEnabled&&(this._fillEnabled=!1,this._geometryChanged.raiseEvent(this)));var s=a.positions,l=a.show;if(n(l)&&l.isConstant&&!l.getValue(h.MINIMUM_VALUE)||!n(s))return void(this._fillEnabled&&(this._fillEnabled=!1,this._geometryChanged.raiseEvent(this)));var u=r(a.material,A),c=u instanceof y;this._materialProperty=u,this._showProperty=r(l,P),this._fillEnabled=!0;var d=a.width,p=a.followSurface,m=a.granularity;if(s.isConstant&&S.isConstant(d)&&S.isConstant(p)&&S.isConstant(m)){var f=this._options,_=s.getValue(h.MINIMUM_VALUE,f.positions);if(!n(_)||_.length<2)return void(this._fillEnabled&&(this._fillEnabled=!1,this._geometryChanged.raiseEvent(this)));f.vertexFormat=c?v.VERTEX_FORMAT:g.VERTEX_FORMAT,f.positions=_,f.width=n(d)?d.getValue(h.MINIMUM_VALUE):void 0,f.followSurface=n(p)?p.getValue(h.MINIMUM_VALUE):void 0,f.granularity=n(m)?m.getValue(h.MINIMUM_VALUE):void 0,this._dynamic=!1,this._geometryChanged.raiseEvent(this)}else this._dynamic||(this._dynamic=!0,this._geometryChanged.raiseEvent(this))}},T.prototype.createDynamicUpdater=function(e){return new x(e,this)};var I={positions:void 0,granularity:void 0,height:void 0,ellipsoid:void 0};return x.prototype.update=function(e){var t=this._geometryUpdater,i=t._entity,r=i.polyline,o=this._line;if(!i.isShowing||!i.isAvailable(e)||!S.getValueOrDefault(r._show,e,!0))return void(o.show=!1);var a=r.positions,s=S.getValueOrUndefined(a,e,this._positions);if(!n(s)||s.length<2)return void(o.show=!1);var l=S.getValueOrDefault(r._followSurface,e,!0);l&&(I.positions=s,I.granularity=S.getValueOrUndefined(r._granularity,e),I.height=p.extractHeights(s,this._geometryUpdater._scene.globe.ellipsoid),s=p.generateCartesianArc(I)),o.show=!0,o.positions=s.slice(),o.material=E.getValue(e,t.fillMaterialProperty,o.material),o.width=S.getValueOrDefault(r._width,e,1)},x.prototype.getBoundingSphere=function(t,i){var r=this._line;return r.show&&r.positions.length>0?(e.fromPoints(r.positions,i),_.DONE):_.FAILED},x.prototype.isDestroyed=function(){return!1},x.prototype.destroy=function(){var e=this._geometryUpdater,t=e._scene.id,i=b[t];i.remove(this._line),0===i.length&&(this._primitives.removeAndDestroy(i),delete b[t]),a(this)},T}),i("DataSources/PolylineVolumeGeometryUpdater",["../Core/Color","../Core/ColorGeometryInstanceAttribute","../Core/defaultValue","../Core/defined","../Core/defineProperties","../Core/destroyObject","../Core/DeveloperError","../Core/Event","../Core/GeometryInstance","../Core/Iso8601","../Core/PolylineVolumeGeometry","../Core/PolylineVolumeOutlineGeometry","../Core/ShowGeometryInstanceAttribute","../Scene/MaterialAppearance","../Scene/PerInstanceColorAppearance","../Scene/Primitive","./ColorMaterialProperty","./ConstantProperty","./dynamicGeometryGetBoundingSphere","./MaterialProperty","./Property"],function(e,t,i,r,n,o,a,s,l,u,c,h,d,p,m,f,v,g,_,y,C){"use strict";function E(e){this.id=e,this.vertexFormat=void 0,this.polylinePositions=void 0,this.shapePositions=void 0,this.cornerType=void 0,this.granularity=void 0}function S(e,t){this._entity=e,this._scene=t,this._entitySubscription=e.definitionChanged.addEventListener(S.prototype._onEntityPropertyChanged,this),this._fillEnabled=!1,this._dynamic=!1,this._outlineEnabled=!1,this._geometryChanged=new s,this._showProperty=void 0,this._materialProperty=void 0,this._hasConstantOutline=!0,this._showOutlineProperty=void 0,this._outlineColorProperty=void 0,this._outlineWidth=1,this._options=new E(e),this._onEntityPropertyChanged(e,"polylineVolume",e.polylineVolume,void 0)}function w(e,t){this._primitives=e,this._primitive=void 0,this._outlinePrimitive=void 0,this._geometryUpdater=t,this._options=new E(t._entity)}var T=new v(e.WHITE),x=new g(!0),b=new g(!0),A=new g(!1),P=new g(e.BLACK),I=new e;return n(S,{perInstanceColorAppearanceType:{value:m},materialAppearanceType:{value:p}}),n(S.prototype,{entity:{get:function(){return this._entity}},fillEnabled:{get:function(){return this._fillEnabled}},hasConstantFill:{get:function(){return!this._fillEnabled||!r(this._entity.availability)&&C.isConstant(this._showProperty)&&C.isConstant(this._fillProperty)}},fillMaterialProperty:{get:function(){return this._materialProperty}},outlineEnabled:{get:function(){return this._outlineEnabled}},hasConstantOutline:{get:function(){return!this._outlineEnabled||!r(this._entity.availability)&&C.isConstant(this._showProperty)&&C.isConstant(this._showOutlineProperty)}},outlineColorProperty:{get:function(){return this._outlineColorProperty}},outlineWidth:{get:function(){return this._outlineWidth}},isDynamic:{get:function(){return this._dynamic}},isClosed:{value:!0},geometryChanged:{get:function(){return this._geometryChanged}}}),S.prototype.isOutlineVisible=function(e){var t=this._entity;return this._outlineEnabled&&t.isAvailable(e)&&this._showProperty.getValue(e)&&this._showOutlineProperty.getValue(e)},S.prototype.isFilled=function(e){var t=this._entity;return this._fillEnabled&&t.isAvailable(e)&&this._showProperty.getValue(e)&&this._fillProperty.getValue(e)},S.prototype.createFillGeometryInstance=function(i){var n,o,a=this._entity,s=a.isAvailable(i),u=new d(s&&a.isShowing&&this._showProperty.getValue(i)&&this._fillProperty.getValue(i));if(this._materialProperty instanceof v){var h=e.WHITE;r(this._materialProperty.color)&&(this._materialProperty.color.isConstant||s)&&(h=this._materialProperty.color.getValue(i)),o=t.fromColor(h),n={show:u,color:o}}else n={show:u};return new l({id:a,geometry:new c(this._options),attributes:n})},S.prototype.createOutlineGeometryInstance=function(i){var r=this._entity,n=r.isAvailable(i),o=C.getValueOrDefault(this._outlineColorProperty,i,e.BLACK);return new l({id:r,geometry:new h(this._options),attributes:{show:new d(n&&r.isShowing&&this._showProperty.getValue(i)&&this._showOutlineProperty.getValue(i)),color:t.fromColor(o)}})},S.prototype.isDestroyed=function(){return!1},S.prototype.destroy=function(){this._entitySubscription(),o(this)},S.prototype._onEntityPropertyChanged=function(e,t,n,o){if("availability"===t||"polylineVolume"===t){var a=this._entity.polylineVolume;if(!r(a))return void((this._fillEnabled||this._outlineEnabled)&&(this._fillEnabled=!1,this._outlineEnabled=!1,this._geometryChanged.raiseEvent(this)));var s=a.fill,l=r(s)&&s.isConstant?s.getValue(u.MINIMUM_VALUE):!0,c=a.outline,h=r(c);if(h&&c.isConstant&&(h=c.getValue(u.MINIMUM_VALUE)),!l&&!h)return void((this._fillEnabled||this._outlineEnabled)&&(this._fillEnabled=!1,this._outlineEnabled=!1,this._geometryChanged.raiseEvent(this)));var d=a.positions,f=a.shape,g=a.show;if(!r(d)||!r(f)||r(g)&&g.isConstant&&!g.getValue(u.MINIMUM_VALUE))return void((this._fillEnabled||this._outlineEnabled)&&(this._fillEnabled=!1,this._outlineEnabled=!1,this._geometryChanged.raiseEvent(this)));var _=i(a.material,T),y=_ instanceof v;this._materialProperty=_,this._fillProperty=i(s,b),this._showProperty=i(g,x),this._showOutlineProperty=i(a.outline,A),this._outlineColorProperty=h?i(a.outlineColor,P):void 0;var E=a.granularity,S=a.outlineWidth,w=a.cornerType;if(this._fillEnabled=l,this._outlineEnabled=h,d.isConstant&&f.isConstant&&C.isConstant(E)&&C.isConstant(S)&&C.isConstant(w)){var I=this._options;I.vertexFormat=y?m.VERTEX_FORMAT:p.MaterialSupport.TEXTURED.vertexFormat,I.polylinePositions=d.getValue(u.MINIMUM_VALUE,I.polylinePositions),I.shapePositions=f.getValue(u.MINIMUM_VALUE,I.shape),I.granularity=r(E)?E.getValue(u.MINIMUM_VALUE):void 0,I.cornerType=r(w)?w.getValue(u.MINIMUM_VALUE):void 0,this._outlineWidth=r(S)?S.getValue(u.MINIMUM_VALUE):1,this._dynamic=!1,this._geometryChanged.raiseEvent(this)}else this._dynamic||(this._dynamic=!0,this._geometryChanged.raiseEvent(this))}},S.prototype.createDynamicUpdater=function(e){return new w(e,this)},w.prototype.update=function(i){var n=this._primitives;n.removeAndDestroy(this._primitive),n.removeAndDestroy(this._outlinePrimitive),this._primitive=void 0,this._outlinePrimitive=void 0;var o=this._geometryUpdater,a=o._entity,s=a.polylineVolume;if(a.isShowing&&a.isAvailable(i)&&C.getValueOrDefault(s.show,i,!0)){var u=this._options,d=C.getValueOrUndefined(s.positions,i,u.polylinePositions),v=C.getValueOrUndefined(s.shape,i);if(r(d)&&r(v)){if(u.polylinePositions=d,u.shapePositions=v,u.granularity=C.getValueOrUndefined(s.granularity,i),u.cornerType=C.getValueOrUndefined(s.cornerType,i), +!r(s.fill)||s.fill.getValue(i)){var g=y.getValue(i,o.fillMaterialProperty,this._material);this._material=g;var _=new p({material:g,translucent:g.isTranslucent(),closed:!0});u.vertexFormat=_.vertexFormat,this._primitive=n.add(new f({geometryInstances:new l({id:a,geometry:new c(u)}),appearance:_,asynchronous:!1}))}if(r(s.outline)&&s.outline.getValue(i)){u.vertexFormat=m.VERTEX_FORMAT;var E=C.getValueOrClonedDefault(s.outlineColor,i,e.BLACK,I),S=C.getValueOrDefault(s.outlineWidth,i,1),w=1!==E.alpha;this._outlinePrimitive=n.add(new f({geometryInstances:new l({id:a,geometry:new h(u),attributes:{color:t.fromColor(E)}}),appearance:new m({flat:!0,translucent:w,renderState:{lineWidth:o._scene.clampLineWidth(S)}}),asynchronous:!1}))}}}},w.prototype.getBoundingSphere=function(e,t){return _(e,this._primitive,this._outlinePrimitive,t)},w.prototype.isDestroyed=function(){return!1},w.prototype.destroy=function(){var e=this._primitives;e.removeAndDestroy(this._primitive),e.removeAndDestroy(this._outlinePrimitive),o(this)},S}),i("DataSources/RectangleGeometryUpdater",["../Core/Color","../Core/ColorGeometryInstanceAttribute","../Core/defaultValue","../Core/defined","../Core/defineProperties","../Core/destroyObject","../Core/DeveloperError","../Core/Event","../Core/GeometryInstance","../Core/Iso8601","../Core/RectangleGeometry","../Core/RectangleOutlineGeometry","../Core/ShowGeometryInstanceAttribute","../Scene/MaterialAppearance","../Scene/PerInstanceColorAppearance","../Scene/Primitive","./ColorMaterialProperty","./ConstantProperty","./dynamicGeometryGetBoundingSphere","./MaterialProperty","./Property"],function(e,t,i,r,n,o,a,s,l,u,c,h,d,p,m,f,v,g,_,y,C){"use strict";function E(e){this.id=e,this.vertexFormat=void 0,this.rectangle=void 0,this.closeBottom=void 0,this.closeTop=void 0,this.height=void 0,this.extrudedHeight=void 0,this.granularity=void 0,this.stRotation=void 0,this.rotation=void 0}function S(e,t){this._entity=e,this._scene=t,this._entitySubscription=e.definitionChanged.addEventListener(S.prototype._onEntityPropertyChanged,this),this._fillEnabled=!1,this._isClosed=!1,this._dynamic=!1,this._outlineEnabled=!1,this._geometryChanged=new s,this._showProperty=void 0,this._materialProperty=void 0,this._hasConstantOutline=!0,this._showOutlineProperty=void 0,this._outlineColorProperty=void 0,this._outlineWidth=1,this._options=new E(e),this._onEntityPropertyChanged(e,"rectangle",e.rectangle,void 0)}function w(e,t){this._primitives=e,this._primitive=void 0,this._outlinePrimitive=void 0,this._geometryUpdater=t,this._options=new E(t._entity)}var T=new v(e.WHITE),x=new g(!0),b=new g(!0),A=new g(!1),P=new g(e.BLACK),I=new e;return n(S,{perInstanceColorAppearanceType:{value:m},materialAppearanceType:{value:p}}),n(S.prototype,{entity:{get:function(){return this._entity}},fillEnabled:{get:function(){return this._fillEnabled}},hasConstantFill:{get:function(){return!this._fillEnabled||!r(this._entity.availability)&&C.isConstant(this._showProperty)&&C.isConstant(this._fillProperty)}},fillMaterialProperty:{get:function(){return this._materialProperty}},outlineEnabled:{get:function(){return this._outlineEnabled}},hasConstantOutline:{get:function(){return!this._outlineEnabled||!r(this._entity.availability)&&C.isConstant(this._showProperty)&&C.isConstant(this._showOutlineProperty)}},outlineColorProperty:{get:function(){return this._outlineColorProperty}},outlineWidth:{get:function(){return this._outlineWidth}},isDynamic:{get:function(){return this._dynamic}},isClosed:{get:function(){return this._isClosed}},geometryChanged:{get:function(){return this._geometryChanged}}}),S.prototype.isOutlineVisible=function(e){var t=this._entity;return this._outlineEnabled&&t.isAvailable(e)&&this._showProperty.getValue(e)&&this._showOutlineProperty.getValue(e)},S.prototype.isFilled=function(e){var t=this._entity;return this._fillEnabled&&t.isAvailable(e)&&this._showProperty.getValue(e)&&this._fillProperty.getValue(e)},S.prototype.createFillGeometryInstance=function(i){var n,o,a=this._entity,s=a.isAvailable(i),u=new d(s&&a.isShowing&&this._showProperty.getValue(i)&&this._fillProperty.getValue(i));if(this._materialProperty instanceof v){var h=e.WHITE;r(this._materialProperty.color)&&(this._materialProperty.color.isConstant||s)&&(h=this._materialProperty.color.getValue(i)),o=t.fromColor(h),n={show:u,color:o}}else n={show:u};return new l({id:a,geometry:new c(this._options),attributes:n})},S.prototype.createOutlineGeometryInstance=function(i){var r=this._entity,n=r.isAvailable(i),o=C.getValueOrDefault(this._outlineColorProperty,i,e.BLACK);return new l({id:r,geometry:new h(this._options),attributes:{show:new d(n&&r.isShowing&&this._showProperty.getValue(i)&&this._showOutlineProperty.getValue(i)),color:t.fromColor(o)}})},S.prototype.isDestroyed=function(){return!1},S.prototype.destroy=function(){this._entitySubscription(),o(this)},S.prototype._onEntityPropertyChanged=function(e,t,n,o){if("availability"===t||"rectangle"===t){var a=this._entity.rectangle;if(!r(a))return void((this._fillEnabled||this._outlineEnabled)&&(this._fillEnabled=!1,this._outlineEnabled=!1,this._geometryChanged.raiseEvent(this)));var s=a.fill,l=r(s)&&s.isConstant?s.getValue(u.MINIMUM_VALUE):!0,c=a.outline,h=r(c);if(h&&c.isConstant&&(h=c.getValue(u.MINIMUM_VALUE)),!l&&!h)return void((this._fillEnabled||this._outlineEnabled)&&(this._fillEnabled=!1,this._outlineEnabled=!1,this._geometryChanged.raiseEvent(this)));var d=a.coordinates,f=a.show;if(r(f)&&f.isConstant&&!f.getValue(u.MINIMUM_VALUE)||!r(d))return void((this._fillEnabled||this._outlineEnabled)&&(this._fillEnabled=!1,this._outlineEnabled=!1,this._geometryChanged.raiseEvent(this)));var g=i(a.material,T),_=g instanceof v;this._materialProperty=g,this._fillProperty=i(s,b),this._showProperty=i(f,x),this._showOutlineProperty=i(a.outline,A),this._outlineColorProperty=h?i(a.outlineColor,P):void 0;var y=a.height,E=a.extrudedHeight,S=a.granularity,w=a.stRotation,I=a.rotation,M=a.outlineWidth,D=a.closeBottom,R=a.closeTop;if(this._fillEnabled=l,this._outlineEnabled=h,d.isConstant&&C.isConstant(y)&&C.isConstant(E)&&C.isConstant(S)&&C.isConstant(w)&&C.isConstant(I)&&C.isConstant(M)&&C.isConstant(D)&&C.isConstant(R)){var O=this._options;O.vertexFormat=_?m.VERTEX_FORMAT:p.MaterialSupport.TEXTURED.vertexFormat,O.rectangle=d.getValue(u.MINIMUM_VALUE,O.rectangle),O.height=r(y)?y.getValue(u.MINIMUM_VALUE):void 0,O.extrudedHeight=r(E)?E.getValue(u.MINIMUM_VALUE):void 0,O.granularity=r(S)?S.getValue(u.MINIMUM_VALUE):void 0,O.stRotation=r(w)?w.getValue(u.MINIMUM_VALUE):void 0,O.rotation=r(I)?I.getValue(u.MINIMUM_VALUE):void 0,O.closeBottom=r(D)?D.getValue(u.MINIMUM_VALUE):void 0,O.closeTop=r(R)?R.getValue(u.MINIMUM_VALUE):void 0,this._isClosed=r(E)&&r(O.closeTop)&&r(O.closeBottom)&&O.closeTop&&O.closeBottom,this._outlineWidth=r(M)?M.getValue(u.MINIMUM_VALUE):1,this._dynamic=!1,this._geometryChanged.raiseEvent(this)}else this._dynamic||(this._dynamic=!0,this._geometryChanged.raiseEvent(this))}},S.prototype.createDynamicUpdater=function(e){return new w(e,this)},w.prototype.update=function(i){var n=this._primitives;n.removeAndDestroy(this._primitive),n.removeAndDestroy(this._outlinePrimitive),this._primitive=void 0,this._outlinePrimitive=void 0;var o=this._geometryUpdater,a=o._entity,s=a.rectangle;if(a.isShowing&&a.isAvailable(i)&&C.getValueOrDefault(s.show,i,!0)){var u=this._options,d=C.getValueOrUndefined(s.coordinates,i,u.rectangle);if(r(d)){if(u.rectangle=d,u.height=C.getValueOrUndefined(s.height,i),u.extrudedHeight=C.getValueOrUndefined(s.extrudedHeight,i),u.granularity=C.getValueOrUndefined(s.granularity,i),u.stRotation=C.getValueOrUndefined(s.stRotation,i),u.rotation=C.getValueOrUndefined(s.rotation,i),u.closeBottom=C.getValueOrUndefined(s.closeBottom,i),u.closeTop=C.getValueOrUndefined(s.closeTop,i),C.getValueOrDefault(s.fill,i,!0)){var v=y.getValue(i,o.fillMaterialProperty,this._material);this._material=v;var g=new p({material:v,translucent:v.isTranslucent(),closed:r(u.extrudedHeight)});u.vertexFormat=g.vertexFormat,this._primitive=n.add(new f({geometryInstances:new l({id:a,geometry:new c(u)}),appearance:g,asynchronous:!1}))}if(C.getValueOrDefault(s.outline,i,!1)){u.vertexFormat=m.VERTEX_FORMAT;var _=C.getValueOrClonedDefault(s.outlineColor,i,e.BLACK,I),E=C.getValueOrDefault(s.outlineWidth,i,1),S=1!==_.alpha;this._outlinePrimitive=n.add(new f({geometryInstances:new l({id:a,geometry:new h(u),attributes:{color:t.fromColor(_)}}),appearance:new m({flat:!0,translucent:S,renderState:{lineWidth:o._scene.clampLineWidth(E)}}),asynchronous:!1}))}}}},w.prototype.getBoundingSphere=function(e,t){return _(e,this._primitive,this._outlinePrimitive,t)},w.prototype.isDestroyed=function(){return!1},w.prototype.destroy=function(){var e=this._primitives;e.removeAndDestroy(this._primitive),e.removeAndDestroy(this._outlinePrimitive),o(this)},S}),i("DataSources/WallGeometryUpdater",["../Core/Color","../Core/ColorGeometryInstanceAttribute","../Core/defaultValue","../Core/defined","../Core/defineProperties","../Core/destroyObject","../Core/DeveloperError","../Core/Event","../Core/GeometryInstance","../Core/Iso8601","../Core/ShowGeometryInstanceAttribute","../Core/WallGeometry","../Core/WallOutlineGeometry","../Scene/MaterialAppearance","../Scene/PerInstanceColorAppearance","../Scene/Primitive","./ColorMaterialProperty","./ConstantProperty","./dynamicGeometryGetBoundingSphere","./MaterialProperty","./Property"],function(e,t,i,r,n,o,a,s,l,u,c,h,d,p,m,f,v,g,_,y,C){"use strict";function E(e){this.id=e,this.vertexFormat=void 0,this.positions=void 0,this.minimumHeights=void 0,this.maximumHeights=void 0,this.granularity=void 0}function S(e,t){this._entity=e,this._scene=t,this._entitySubscription=e.definitionChanged.addEventListener(S.prototype._onEntityPropertyChanged,this),this._fillEnabled=!1,this._dynamic=!1,this._outlineEnabled=!1,this._geometryChanged=new s,this._showProperty=void 0,this._materialProperty=void 0,this._hasConstantOutline=!0,this._showOutlineProperty=void 0,this._outlineColorProperty=void 0,this._outlineWidth=1,this._options=new E(e),this._onEntityPropertyChanged(e,"wall",e.wall,void 0)}function w(e,t){this._primitives=e,this._primitive=void 0,this._outlinePrimitive=void 0,this._geometryUpdater=t,this._options=new E(t._entity)}var T=new v(e.WHITE),x=new g(!0),b=new g(!0),A=new g(!1),P=new g(e.BLACK),I=new e;return n(S,{perInstanceColorAppearanceType:{value:m},materialAppearanceType:{value:p}}),n(S.prototype,{entity:{get:function(){return this._entity}},fillEnabled:{get:function(){return this._fillEnabled}},hasConstantFill:{get:function(){return!this._fillEnabled||!r(this._entity.availability)&&C.isConstant(this._showProperty)&&C.isConstant(this._fillProperty)}},fillMaterialProperty:{get:function(){return this._materialProperty}},outlineEnabled:{get:function(){return this._outlineEnabled}},hasConstantOutline:{get:function(){return!this._outlineEnabled||!r(this._entity.availability)&&C.isConstant(this._showProperty)&&C.isConstant(this._showOutlineProperty)}},outlineColorProperty:{get:function(){return this._outlineColorProperty}},outlineWidth:{get:function(){return this._outlineWidth}},isDynamic:{get:function(){return this._dynamic}},isClosed:{get:function(){return!1}},geometryChanged:{get:function(){return this._geometryChanged}}}),S.prototype.isOutlineVisible=function(e){var t=this._entity;return this._outlineEnabled&&t.isAvailable(e)&&this._showProperty.getValue(e)&&this._showOutlineProperty.getValue(e)},S.prototype.isFilled=function(e){var t=this._entity;return this._fillEnabled&&t.isAvailable(e)&&this._showProperty.getValue(e)&&this._fillProperty.getValue(e)},S.prototype.createFillGeometryInstance=function(i){var n,o,a=this._entity,s=a.isAvailable(i),u=new c(s&&a.isShowing&&this._showProperty.getValue(i)&&this._fillProperty.getValue(i));if(this._materialProperty instanceof v){var d=e.WHITE;r(this._materialProperty.color)&&(this._materialProperty.color.isConstant||s)&&(d=this._materialProperty.color.getValue(i)),o=t.fromColor(d),n={show:u,color:o}}else n={show:u};return new l({id:a,geometry:new h(this._options),attributes:n})},S.prototype.createOutlineGeometryInstance=function(i){var r=this._entity,n=r.isAvailable(i),o=C.getValueOrDefault(this._outlineColorProperty,i,e.BLACK);return new l({id:r,geometry:new d(this._options),attributes:{show:new c(n&&r.isShowing&&this._showProperty.getValue(i)&&this._showOutlineProperty.getValue(i)),color:t.fromColor(o)}})},S.prototype.isDestroyed=function(){return!1},S.prototype.destroy=function(){this._entitySubscription(),o(this)},S.prototype._onEntityPropertyChanged=function(e,t,n,o){if("availability"===t||"wall"===t){var a=this._entity.wall;if(!r(a))return void((this._fillEnabled||this._outlineEnabled)&&(this._fillEnabled=!1,this._outlineEnabled=!1,this._geometryChanged.raiseEvent(this)));var s=a.fill,l=r(s)&&s.isConstant?s.getValue(u.MINIMUM_VALUE):!0,c=a.outline,h=r(c);if(h&&c.isConstant&&(h=c.getValue(u.MINIMUM_VALUE)),!l&&!h)return void((this._fillEnabled||this._outlineEnabled)&&(this._fillEnabled=!1,this._outlineEnabled=!1,this._geometryChanged.raiseEvent(this)));var d=a.positions,f=a.show;if(r(f)&&f.isConstant&&!f.getValue(u.MINIMUM_VALUE)||!r(d))return void((this._fillEnabled||this._outlineEnabled)&&(this._fillEnabled=!1,this._outlineEnabled=!1,this._geometryChanged.raiseEvent(this)));var g=i(a.material,T),_=g instanceof v;this._materialProperty=g,this._fillProperty=i(s,b),this._showProperty=i(f,x),this._showOutlineProperty=i(a.outline,A),this._outlineColorProperty=h?i(a.outlineColor,P):void 0;var y=a.minimumHeights,E=a.maximumHeights,S=a.outlineWidth,w=a.granularity;if(this._fillEnabled=l,this._outlineEnabled=h,d.isConstant&&C.isConstant(y)&&C.isConstant(E)&&C.isConstant(S)&&C.isConstant(w)){var I=this._options;I.vertexFormat=_?m.VERTEX_FORMAT:p.MaterialSupport.TEXTURED.vertexFormat,I.positions=d.getValue(u.MINIMUM_VALUE,I.positions),I.minimumHeights=r(y)?y.getValue(u.MINIMUM_VALUE,I.minimumHeights):void 0,I.maximumHeights=r(E)?E.getValue(u.MINIMUM_VALUE,I.maximumHeights):void 0,I.granularity=r(w)?w.getValue(u.MINIMUM_VALUE):void 0,this._outlineWidth=r(S)?S.getValue(u.MINIMUM_VALUE):1,this._dynamic=!1,this._geometryChanged.raiseEvent(this)}else this._dynamic||(this._dynamic=!0,this._geometryChanged.raiseEvent(this))}},S.prototype.createDynamicUpdater=function(e){return new w(e,this)},w.prototype.update=function(i){var n=this._primitives;n.removeAndDestroy(this._primitive),n.removeAndDestroy(this._outlinePrimitive),this._primitive=void 0,this._outlinePrimitive=void 0;var o=this._geometryUpdater,a=o._entity,s=a.wall;if(a.isShowing&&a.isAvailable(i)&&C.getValueOrDefault(s.show,i,!0)){var u=this._options,c=C.getValueOrUndefined(s.positions,i,u.positions);if(r(c)){if(u.positions=c,u.minimumHeights=C.getValueOrUndefined(s.minimumHeights,i,u.minimumHeights),u.maximumHeights=C.getValueOrUndefined(s.maximumHeights,i,u.maximumHeights),u.granularity=C.getValueOrUndefined(s.granularity,i),C.getValueOrDefault(s.fill,i,!0)){var v=y.getValue(i,o.fillMaterialProperty,this._material);this._material=v;var g=new p({material:v,translucent:v.isTranslucent(),closed:r(u.extrudedHeight)});u.vertexFormat=g.vertexFormat,this._primitive=n.add(new f({geometryInstances:new l({id:a,geometry:new h(u)}),appearance:g,asynchronous:!1}))}if(C.getValueOrDefault(s.outline,i,!1)){u.vertexFormat=m.VERTEX_FORMAT;var _=C.getValueOrClonedDefault(s.outlineColor,i,e.BLACK,I),E=C.getValueOrDefault(s.outlineWidth,i,1),S=1!==_.alpha;this._outlinePrimitive=n.add(new f({geometryInstances:new l({id:a,geometry:new d(u),attributes:{color:t.fromColor(_)}}),appearance:new m({flat:!0,translucent:S,renderState:{lineWidth:o._scene.clampLineWidth(E)}}),asynchronous:!1}))}}}},w.prototype.getBoundingSphere=function(e,t){return _(e,this._primitive,this._outlinePrimitive,t)},w.prototype.isDestroyed=function(){return!1},w.prototype.destroy=function(){var e=this._primitives;e.removeAndDestroy(this._primitive),e.removeAndDestroy(this._outlinePrimitive),o(this)},S}),i("DataSources/DataSourceDisplay",["../Core/BoundingSphere","../Core/defaultValue","../Core/defined","../Core/defineProperties","../Core/destroyObject","../Core/DeveloperError","../Core/EventHelper","./BillboardVisualizer","./BoundingSphereState","./BoxGeometryUpdater","./CorridorGeometryUpdater","./CustomDataSource","./CylinderGeometryUpdater","./EllipseGeometryUpdater","./EllipsoidGeometryUpdater","./GeometryVisualizer","./LabelVisualizer","./ModelVisualizer","./PathVisualizer","./PointVisualizer","./PolygonGeometryUpdater","./PolylineGeometryUpdater","./PolylineVolumeGeometryUpdater","./RectangleGeometryUpdater","./WallGeometryUpdater"],function(e,t,i,r,n,o,a,s,l,u,c,h,d,p,m,f,v,g,_,y,C,E,S,w,T){"use strict";function x(e){var i=e.scene,r=e.dataSourceCollection;this._eventHelper=new a,this._eventHelper.add(r.dataSourceAdded,this._onDataSourceAdded,this),this._eventHelper.add(r.dataSourceRemoved,this._onDataSourceRemoved,this),this._dataSourceCollection=r,this._scene=i,this._visualizersCallback=t(e.visualizersCallback,x.defaultVisualizersCallback);for(var n=0,o=r.length;o>n;n++)this._onDataSourceAdded(r,r.get(n));var s=new h;this._onDataSourceAdded(void 0,s),this._defaultDataSource=s}x.defaultVisualizersCallback=function(e,t){var i=t.entities;return[new s(e,i),new f(u,e,i),new f(d,e,i),new f(c,e,i),new f(p,e,i),new f(m,e,i),new f(C,e,i),new f(E,e,i),new f(S,e,i),new f(w,e,i),new f(T,e,i),new v(e,i),new g(e,i),new y(e,i),new _(e,i)]},r(x.prototype,{scene:{get:function(){return this._scene}},dataSources:{get:function(){return this._dataSourceCollection}},defaultDataSource:{get:function(){return this._defaultDataSource}}}),x.prototype.isDestroyed=function(){return!1},x.prototype.destroy=function(){this._eventHelper.removeAll();for(var e=this._dataSourceCollection,t=0,i=e.length;i>t;++t)this._onDataSourceRemoved(this._dataSourceCollection,e.get(t));return this._onDataSourceRemoved(void 0,this._defaultDataSource),n(this)},x.prototype.update=function(e){var t,r,n,o,a=!0,s=this._dataSourceCollection,l=s.length;for(t=0;l>t;t++){var u=s.get(t);for(i(u.update)&&(a=u.update(e)&&a),n=u._visualizers,o=n.length,r=0;o>r;r++)a=n[r].update(e)&&a}for(n=this._defaultDataSource._visualizers,o=n.length,r=0;o>r;r++)a=n[r].update(e)&&a;return a};var b=[],A=new e;return x.prototype.getBoundingSphere=function(t,r,n){var o,a,s=this._defaultDataSource;if(!s.entities.contains(t)){s=void 0;var u=this._dataSourceCollection;for(a=u.length,o=0;a>o;o++){var c=u.get(o);if(c.entities.contains(t)){s=c;break}}}if(!i(s))return l.FAILED;var h=b,d=A,p=0,m=l.DONE,f=s._visualizers,v=f.length;for(o=0;v>o;o++){var g=f[o];if(i(g.getBoundingSphere)){if(m=f[o].getBoundingSphere(t,d),!r&&m===l.PENDING)return l.PENDING;m===l.DONE&&(h[p]=e.clone(d,h[p]),p++)}}return 0===p?l.FAILED:(h.length=p,e.fromBoundingSpheres(h,n),l.DONE)},x.prototype._onDataSourceAdded=function(e,t){var i=this._visualizersCallback(this._scene,t);t._visualizers=i},x.prototype._onDataSourceRemoved=function(e,t){for(var i=t._visualizers,r=i.length,n=0;r>n;n++)i[n].destroy(),t._visualizers=void 0},x}),i("DataSources/DynamicGeometryUpdater",["../Core/DeveloperError"],function(e){"use strict";function t(){e.throwInstantiationError()}return t.prototype.update=e.throwInstantiationError,t.prototype.getBoundingSphere=e.throwInstantiationError,t.prototype.isDestroyed=e.throwInstantiationError,t.prototype.destroy=e.throwInstantiationError,t}),i("DataSources/EntityView",["../Core/BoundingSphere","../Core/Cartesian3","../Core/Cartesian4","../Core/defaultValue","../Core/defined","../Core/defineProperties","../Core/DeveloperError","../Core/Ellipsoid","../Core/HeadingPitchRange","../Core/JulianDate","../Core/Math","../Core/Matrix3","../Core/Matrix4","../Core/Transforms","../Scene/SceneMode"],function(e,t,i,r,n,o,a,s,l,u,c,h,d,p,m){"use strict";function f(e,i,r,o,a,s,l){var d=e.scene.mode,f=a.getValue(s,e._lastCartesian);if(n(f)){var v,I,M,D=!1;if(d===m.SCENE3D){A=u.addSeconds(s,.001,A);var R=a.getValue(A,E);if(n(R)){var O,N=p.computeFixedToIcrfMatrix(s,g),L=p.computeFixedToIcrfMatrix(A,_);n(N)&&n(L)?O=h.transpose(N,y):(O=p.computeTemeToPseudoFixedMatrix(s,y),N=h.transpose(O,g),L=p.computeTemeToPseudoFixedMatrix(A,_),h.transpose(L,L));var F=h.multiplyByVector(N,f,x),B=h.multiplyByVector(L,R,b);t.subtract(F,B,T);var V=1e3*t.magnitude(T),k=3986004418e5,z=-k/(V*V-2*k/t.magnitude(F));0>z||z>P*l.maximumRadius?(v=S,t.normalize(f,v),t.negate(v,v),M=t.clone(t.UNIT_Z,w),I=t.cross(M,v,E),t.magnitude(I)>c.EPSILON7&&(t.normalize(v,v),t.normalize(I,I),M=t.cross(v,I,w),t.normalize(M,M),D=!0)):t.equalsEpsilon(f,R,c.EPSILON7)||(M=S,t.normalize(F,M),t.normalize(B,B),I=t.cross(M,B,w),t.equalsEpsilon(I,t.ZERO,c.EPSILON7)||(v=t.cross(I,M,E),h.multiplyByVector(O,v,v),h.multiplyByVector(O,I,I),h.multiplyByVector(O,M,M),t.normalize(v,v),t.normalize(I,I),t.normalize(M,M),D=!0))}}n(e._boundingSphereOffset)&&t.add(e._boundingSphereOffset,f,f);var U,G,W;o&&(U=t.clone(i.position,T),G=t.clone(i.direction,x),W=t.clone(i.up,b));var H=C;D?(H[0]=v.x,H[1]=v.y,H[2]=v.z,H[3]=0,H[4]=I.x,H[5]=I.y,H[6]=I.z,H[7]=0,H[8]=M.x,H[9]=M.y,H[10]=M.z,H[11]=0,H[12]=f.x,H[13]=f.y,H[14]=f.z,H[15]=0):p.eastNorthUpToFixedFrame(f,l,H),i._setTransform(H),o&&(t.clone(U,i.position),t.clone(G,i.direction),t.clone(W,i.up),t.cross(G,W,i.right))}if(r){var q=d===m.SCENE2D||t.equals(e._offset3D,t.ZERO)?void 0:e._offset3D;i.lookAtTransform(i.transform,q)}}function v(i,n,o,a){this.entity=i,this.scene=n,this.ellipsoid=r(o,s.WGS84),this.boundingSphere=e.clone(a),this._boundingSphereOffset=void 0,this._lastEntity=void 0,this._mode=void 0,this._lastCartesian=new t,this._defaultOffset3D=void 0,this._offset3D=new t}var g=new h,_=new h,y=new h,C=new d,E=new t,S=new t,w=new t,T=new t,x=new t,b=new t,A=new u,P=1.25;o(v,{defaultOffset3D:{get:function(){return this._defaultOffset3D},set:function(e){this._defaultOffset3D=t.clone(e,new t)}}}),v.defaultOffset3D=new t(-14e3,3500,3500);var I=new l,M=new t;return v.prototype.update=function(e){var i=this.scene,r=this.entity,o=this.ellipsoid,a=i.mode;if(a!==m.MORPHING){var s=r.position,l=r!==this._lastEntity,u=a!==this._mode,h=this._offset3D,d=i.camera,p=l||u,g=!0;if(l){var _=r.viewFrom,y=n(_),C=this.boundingSphere;if(this._boundingSphereOffset=void 0,!y&&n(C)){var E=i.screenSpaceCameraController;E.minimumZoomDistance=Math.min(E.minimumZoomDistance,.5*C.radius),I.pitch=-c.PI_OVER_FOUR,I.range=0;var S=s.getValue(e,M);if(n(S)){var w=2-1/Math.max(1,t.magnitude(S)/o.maximumRadius);I.pitch*=w}d.viewBoundingSphere(C,I),this._boundingSphereOffset=t.subtract(C.center,r.position.getValue(e),new t),p=!1,g=!1}else y&&n(_.getValue(e,h))||t.clone(v._defaultOffset3D,h)}else u||i.mode===m.MORPHING||this._mode===m.SCENE2D||t.clone(d.position,h);this._lastEntity=r,this._mode=i.mode!==m.MORPHING?i.mode:this._mode,i.mode!==m.MORPHING&&f(this,d,p,g,s,e,o)}},v}),!function(){function e(e,t){function i(t){var i,r=e.arcs[0>t?~t:t],n=r[0];return e.transform?(i=[0,0],r.forEach(function(e){i[0]+=e[0],i[1]+=e[1]})):i=r[r.length-1],0>t?[i,n]:[n,i]}function r(e,t){for(var i in e){var r=e[i];delete t[r.start],delete r.start,delete r.end,r.forEach(function(e){n[0>e?~e:e]=1}),s.push(r)}}var n={},o={},a={},s=[],l=-1;return t.forEach(function(i,r){var n,o=e.arcs[0>i?~i:i];o.length<3&&!o[1][0]&&!o[1][1]&&(n=t[++l],t[l]=i,t[r]=n)}),t.forEach(function(e){var t,r,n=i(e),s=n[0],l=n[1];if(t=a[s])if(delete a[t.end],t.push(e),t.end=l,r=o[l]){delete o[r.start];var u=r===t?t:t.concat(r);o[u.start=t.start]=a[u.end=r.end]=u}else o[t.start]=a[t.end]=t;else if(t=o[l])if(delete o[t.start],t.unshift(e),t.start=s,r=a[s]){delete a[r.end];var c=r===t?t:r.concat(t);o[c.start=r.start]=a[c.end=t.end]=c}else o[t.start]=a[t.end]=t;else t=[e],o[t.start=s]=a[t.end=l]=t}),r(a,o),r(o,a),t.forEach(function(e){n[0>e?~e:e]||s.push([e])}),s}function t(t,i,r){function n(e){var t=0>e?~e:e;(c[t]||(c[t]=[])).push({i:e,g:u})}function o(e){e.forEach(n)}function a(e){e.forEach(o)}function s(e){"GeometryCollection"===e.type?e.geometries.forEach(s):e.type in h&&(u=e,h[e.type](e.arcs))}var l=[];if(arguments.length>1){var u,c=[],h={LineString:o,MultiLineString:a,Polygon:a,MultiPolygon:function(e){e.forEach(a)}};s(i),c.forEach(arguments.length<3?function(e){l.push(e[0].i)}:function(e){r(e[0].g,e[e.length-1].g)&&l.push(e[0].i)})}else for(var d=0,p=t.arcs.length;p>d;++d)l.push(d);return{type:"MultiLineString",arcs:e(t,l)}}function r(t,i){function r(e){e.forEach(function(t){t.forEach(function(t){(a[t=0>t?~t:t]||(a[t]=[])).push(e)})}),l.push(e)}function o(e){return d(s(t,{type:"Polygon",arcs:[e]}).coordinates[0])>0}var a={},l=[],u=[];return i.forEach(function(e){"Polygon"===e.type?r(e.arcs):"MultiPolygon"===e.type&&e.arcs.forEach(r)}),l.forEach(function(e){if(!e._){var t=[],i=[e];for(e._=1,u.push(t);e=i.pop();)t.push(e),e.forEach(function(e){e.forEach(function(e){a[0>e?~e:e].forEach(function(e){e._||(e._=1,i.push(e))})})})}}),l.forEach(function(e){delete e._}),{type:"MultiPolygon",arcs:u.map(function(i){var r=[];if(i.forEach(function(e){e.forEach(function(e){e.forEach(function(e){a[0>e?~e:e].length<2&&r.push(e)})})}),r=e(t,r),(n=r.length)>1)for(var s,l=o(i[0][0]),u=0;u<n;++u)if(l===o(r[u])){s=r[0],r[0]=r[u],r[u]=s;break}return r})}}function o(e,t){return"GeometryCollection"===t.type?{type:"FeatureCollection",features:t.geometries.map(function(t){return a(e,t)})}:a(e,t)}function a(e,t){var i={type:"Feature",id:t.id,properties:t.properties||{},geometry:s(e,t)};return null==t.id&&delete i.id,i}function s(e,t){function i(e,t){t.length&&t.pop();for(var i,r=c[0>e?~e:e],n=0,o=r.length;o>n;++n)t.push(i=r[n].slice()),u(i,n);0>e&&l(t,o)}function r(e){return e=e.slice(),u(e,0),e}function n(e){for(var t=[],r=0,n=e.length;n>r;++r)i(e[r],t);return t.length<2&&t.push(t[0].slice()),t}function o(e){for(var t=n(e);t.length<4;)t.push(t[0].slice());return t}function a(e){return e.map(o)}function s(e){var t=e.type;return"GeometryCollection"===t?{type:t,geometries:e.geometries.map(s)}:t in h?{type:t,coordinates:h[t](e)}:null}var u=v(e.transform),c=e.arcs,h={Point:function(e){return r(e.coordinates)},MultiPoint:function(e){return e.coordinates.map(r)},LineString:function(e){return n(e.arcs)},MultiLineString:function(e){return e.arcs.map(n)},Polygon:function(e){return a(e.arcs)},MultiPolygon:function(e){return e.arcs.map(a)}};return s(t)}function l(e,t){for(var i,r=e.length,n=r-t;n<--r;)i=e[n],e[n++]=e[r],e[r]=i}function u(e,t){for(var i=0,r=e.length;r>i;){var n=i+r>>>1;e[n]<t?i=n+1:r=n}return i}function c(e){function t(e,t){e.forEach(function(e){0>e&&(e=~e);var i=n[e];i?i.push(t):n[e]=[t]})}function i(e,i){e.forEach(function(e){t(e,i)})}function r(e,t){"GeometryCollection"===e.type?e.geometries.forEach(function(e){r(e,t)}):e.type in a&&a[e.type](e.arcs,t)}var n={},o=e.map(function(){return[]}),a={LineString:t,MultiLineString:i,Polygon:i,MultiPolygon:function(e,t){e.forEach(function(e){i(e,t)})}};e.forEach(r);for(var s in n)for(var l=n[s],c=l.length,h=0;c>h;++h)for(var d=h+1;c>d;++d){var p,m=l[h],f=l[d];(p=o[m])[s=u(p,f)]!==f&&p.splice(s,0,f),(p=o[f])[s=u(p,m)]!==m&&p.splice(s,0,m)}return o}function h(e,t){function i(e){o.remove(e),e[1][2]=t(e),o.push(e)}var r=v(e.transform),n=g(e.transform),o=f();return t||(t=p),e.arcs.forEach(function(e){for(var a,s,l=[],u=0,c=0,h=e.length;h>c;++c)s=e[c],r(e[c]=[s[0],s[1],1/0],c);for(var c=1,h=e.length-1;h>c;++c)a=e.slice(c-1,c+2),a[1][2]=t(a),l.push(a),o.push(a);for(var c=0,h=l.length;h>c;++c)a=l[c],a.previous=l[c-1],a.next=l[c+1];for(;a=o.pop();){var d=a.previous,p=a.next;a[1][2]<u?a[1][2]=u:u=a[1][2],d&&(d.next=p,d[2]=a[2],i(d)),p&&(p.previous=d,p[0]=a[0],i(p))}e.forEach(n)}),e}function d(e){for(var t,i=-1,r=e.length,n=e[r-1],o=0;++i<r;)t=n,n=e[i],o+=t[0]*n[1]-t[1]*n[0];return.5*o}function p(e){var t=e[0],i=e[1],r=e[2];return Math.abs((t[0]-r[0])*(i[1]-t[1])-(t[0]-i[0])*(r[1]-t[1]))}function m(e,t){return e[1][2]-t[1][2]}function f(){function e(e,t){for(;t>0;){var i=(t+1>>1)-1,n=r[i];if(m(e,n)>=0)break;r[n._=t]=n,r[e._=t=i]=e}}function t(e,t){for(;;){var i=t+1<<1,o=i-1,a=t,s=r[a];if(n>o&&m(r[o],s)<0&&(s=r[a=o]),n>i&&m(r[i],s)<0&&(s=r[a=i]),a===t)break;r[s._=t]=s,r[e._=t=a]=e}}var i={},r=[],n=0;return i.push=function(t){return e(r[t._=n]=t,n++),n},i.pop=function(){if(!(0>=n)){var e,i=r[0];return--n>0&&(e=r[n],t(r[e._=0]=e,0)),i}},i.remove=function(i){var o,a=i._;if(r[a]===i)return a!==--n&&(o=r[n],(m(o,i)<0?e:t)(r[o._=a]=o,a)),a},i}function v(e){if(!e)return _;var t,i,r=e.scale[0],n=e.scale[1],o=e.translate[0],a=e.translate[1];return function(e,s){s||(t=i=0),e[0]=(t+=e[0])*r+o,e[1]=(i+=e[1])*n+a}}function g(e){if(!e)return _;var t,i,r=e.scale[0],n=e.scale[1],o=e.translate[0],a=e.translate[1];return function(e,s){s||(t=i=0);var l=(e[0]-o)/r|0,u=(e[1]-a)/n|0;e[0]=l-t,e[1]=u-i,t=l,i=u}}function _(){}var y={version:"1.6.18",mesh:function(e){return s(e,t.apply(this,arguments))},meshArcs:t,merge:function(e){return s(e,r.apply(this,arguments))},mergeArcs:r,feature:o,neighbors:c,presimplify:h};"function"==typeof i&&i.amd?i("ThirdParty/topojson",y):"object"==typeof module&&module.exports?module.exports=y:this.topojson=y}(),i("DataSources/GeoJsonDataSource",["../Core/Cartesian3","../Core/Color","../Core/createGuid","../Core/defaultValue","../Core/defined","../Core/definedNotNull","../Core/defineProperties","../Core/DeveloperError","../Core/Event","../Core/getFilenameFromUri","../Core/loadJson","../Core/PinBuilder","../Core/PolygonHierarchy","../Core/RuntimeError","../Scene/VerticalOrigin","../ThirdParty/topojson","../ThirdParty/when","./BillboardGraphics","./CallbackProperty","./ColorMaterialProperty","./ConstantPositionProperty","./ConstantProperty","./DataSource","./EntityCollection","./PolygonGraphics","./PolylineGraphics"],function(e,t,i,r,n,o,a,s,l,u,c,h,d,p,m,f,v,g,_,y,C,E,S,w,T,x){"use strict";function b(t){return e.fromDegrees(t[0],t[1],t[2])}function A(e,t){var i="";for(var r in e)if(e.hasOwnProperty(r)){if(r===t||-1!==ae.indexOf(r))continue;var n=e[r];o(n)&&(i+="object"==typeof n?"<tr><th>"+r+"</th><td>"+A(n)+"</td></tr>":"<tr><th>"+r+"</th><td>"+n+"</td></tr>")}return i.length>0&&(i='<table class="cesium-infoBox-defaultTable"><tbody>'+i+"</tbody></table>"),i}function P(e,t,i){var r;return function(o,a){return n(r)||(r=e(t,i)),r}}function I(e,t){return new _(P(A,e,t),!0)}function M(e,t,r){var a=e.id;if(o(a)&&"Feature"===e.type){for(var s=2,l=a;n(t.getById(l));)l=a+"_"+s,s++;a=l}else a=i();var u=t.getOrCreateEntity(a),c=e.properties;if(o(c)){u.addProperty("properties"),u.properties=c;var h,d=c.title;if(o(d))u.name=d,h="title";else{var p=Number.MAX_VALUE;for(var m in c)if(c.hasOwnProperty(m)&&c[m]){var f=m.toLowerCase();if(p>1&&"title"===f){p=1,h=m;break}p>2&&"name"===f?(p=2,h=m):p>3&&/title/i.test(m)?(p=3,h=m):p>4&&/name/i.test(m)&&(p=4,h=m)}o(h)&&(u.name=c[h])}var v=c.description;n(v)?null!==v&&(u.description=new E(v)):u.description=r(c,h)}return u}function D(e,t){for(var i=new Array(e.length),r=0;r<e.length;r++)i[r]=t(e[r]);return i}function R(e,t,i,r,a){if(!n(t.geometry))throw new p("feature.geometry is required.");if(null===t.geometry)M(t,e._entityCollection,a.describe);else{var s=t.geometry.type,l=le[s];if(!o(l))throw new p("Unknown geometry type: "+s);l(e,t,t.geometry,r,a)}}function O(e,t,i,r,n){for(var o=t.features,a=0,s=o.length;s>a;a++)R(e,o[a],void 0,r,n)}function N(e,t,i,r,n){for(var a=i.geometries,s=0,l=a.length;l>s;s++){var u=a[s],c=u.type,h=le[c];if(!o(h))throw new p("Unknown geometry type: "+c);h(e,t,u,r,n)}}function L(e,i,a,s,l){var u=l.markerSymbol,c=l.markerColor,h=l.markerSize,d=i.properties;if(o(d)){var p=d["marker-color"];o(p)&&(c=t.fromCssColorString(p)),h=r(oe[d["marker-size"]],h);var f=d["marker-symbol"];o(f)&&(u=f)}var _;_=n(u)?1===u.length?e._pinBuilder.fromText(u.toUpperCase(),c,h):e._pinBuilder.fromMakiIconId(u,c,h):e._pinBuilder.fromColor(c,h),e._promises.push(v(_,function(t){var r=new g;r.verticalOrigin=new E(m.BOTTOM),r.image=new E(t);var n=M(i,e._entityCollection,l.describe);n.billboard=r,n.position=new C(a(s))}))}function F(e,t,i,r,n){L(e,t,r,i.coordinates,n); +}function B(e,t,i,r,n){for(var o=i.coordinates,a=0;a<o.length;a++)L(e,t,r,o[a],n)}function V(e,i,r,a,s){var l=s.strokeMaterialProperty,u=s.strokeWidthProperty,c=i.properties;if(o(c)){var h=c["stroke-width"];o(h)&&(u=new E(h));var d,p=c.stroke;o(p)&&(d=t.fromCssColorString(p));var m=c["stroke-opacity"];o(m)&&1!==m&&(n(d)||(d=l.color.clone()),d.alpha=m),n(d)&&(l=new y(d))}var f=new x;f.material=l,f.width=u,f.positions=new E(D(a,r));var v=M(i,e._entityCollection,s.describe);v.polyline=f}function k(e,t,i,r,n){V(e,t,r,i.coordinates,n)}function z(e,t,i,r,n){for(var o=i.coordinates,a=0;a<o.length;a++)V(e,t,r,o[a],n)}function U(e,i,r,a,s){if(0!==a.length&&0!==a[0].length){var l=s.strokeMaterialProperty.color,u=s.fillMaterialProperty,c=s.strokeWidthProperty,h=i.properties;if(o(h)){var p=h["stroke-width"];o(p)&&(c=new E(p));var m,f=h.stroke;o(f)&&(m=t.fromCssColorString(f));var v=h["stroke-opacity"];o(v)&&1!==v&&(n(m)||(m=s.strokeMaterialProperty.color.clone()),m.alpha=v),n(m)&&(l=new E(m));var g,_=h.fill;o(_)&&(g=t.fromCssColorString(_),g.alpha=u.color.alpha),v=h["fill-opacity"],o(v)&&v!==u.color.alpha&&(n(g)||(g=u.color.clone()),g.alpha=v),n(g)&&(u=new y(g))}var C=new T;C.outline=new E(!0),C.outlineColor=l,C.outlineWidth=c,C.material=u;for(var S=[],w=1,x=a.length;x>w;w++)S.push(new d(D(a[w],r)));var b=a[0];C.hierarchy=new E(new d(D(b,r),S)),b[0].length>2&&(C.perPositionHeight=new E(!0));var A=M(i,e._entityCollection,s.describe);A.polygon=C}}function G(e,t,i,r,n){U(e,t,r,i.coordinates,n)}function W(e,t,i,r,n){for(var o=i.coordinates,a=0;a<o.length;a++)U(e,t,r,o[a],n)}function H(e,t,i,r,n){for(var o in i.objects)if(i.objects.hasOwnProperty(o)){var a=f.feature(i,i.objects[o]),s=se[a.type];s(e,a,a,r,n)}}function q(e){this._name=e,this._changed=new l,this._error=new l,this._isLoading=!1,this._loading=new l,this._entityCollection=new w(this),this._promises=[],this._pinBuilder=new h}function j(e,t,i,r){var o;n(r)&&(o=u(r)),n(o)&&e._name!==o&&(e._name=o,e._changed.raiseEvent(e));var a=se[t.type];if(!n(a))throw new p("Unsupported GeoJSON object type: "+t.type);var s=b,l=t.crs;if(n(l)){if(null===l)throw new p("crs is null.");if(!n(l.properties))throw new p("crs.properties is undefined.");var c=l.properties;if("name"===l.type){if(s=X[c.name],!n(s))throw new p("Unknown crs name: "+c.name)}else if("link"===l.type){var h=Z[c.href];if(n(h)||(h=K[c.type]),!n(h))throw new p("Unable to resolve crs link: "+JSON.stringify(c));s=h(c)}else{if("EPSG"!==l.type)throw new p("Unknown crs type: "+l.type);if(s=X["EPSG:"+c.code],!n(s))throw new p("Unknown crs EPSG code: "+c.code)}}return v(s,function(r){return e._entityCollection.removeAll(),a(e,t,t,r,i),v.all(e._promises,function(){return e._promises.length=0,S.setLoading(e,!1),e})})}var Y,X={"urn:ogc:def:crs:OGC:1.3:CRS84":b,"EPSG:4326":b},Z={},K={},Q=48,J=t.ROYALBLUE,$=t.YELLOW,ee=2,te=t.fromBytes(255,255,0,100),ie=new E(ee),re=new y($),ne=new y(te),oe={small:24,medium:48,large:64},ae=["title","description","marker-size","marker-symbol","marker-color","stroke","stroke-opacity","stroke-width","fill","fill-opacity"],se={Feature:R,FeatureCollection:O,GeometryCollection:N,LineString:k,MultiLineString:z,MultiPoint:B,MultiPolygon:W,Point:F,Polygon:G,Topology:H},le={GeometryCollection:N,LineString:k,MultiLineString:z,MultiPoint:B,MultiPolygon:W,Point:F,Polygon:G,Topology:H};return q.load=function(e,t){return(new q).load(e,t)},a(q,{markerSize:{get:function(){return Q},set:function(e){Q=e}},markerSymbol:{get:function(){return Y},set:function(e){Y=e}},markerColor:{get:function(){return J},set:function(e){J=e}},stroke:{get:function(){return $},set:function(e){$=e,re.color.setValue(e)}},strokeWidth:{get:function(){return ee},set:function(e){ee=e,ie.setValue(e)}},fill:{get:function(){return te},set:function(e){te=e,ne=new y(te)}},crsNames:{get:function(){return X}},crsLinkHrefs:{get:function(){return Z}},crsLinkTypes:{get:function(){return K}}}),a(q.prototype,{name:{get:function(){return this._name}},clock:{value:void 0,writable:!1},entities:{get:function(){return this._entityCollection}},isLoading:{get:function(){return this._isLoading}},changedEvent:{get:function(){return this._changed}},errorEvent:{get:function(){return this._error}},loadingEvent:{get:function(){return this._loading}}}),q.prototype.load=function(e,t){S.setLoading(this,!0);var i=e;t=r(t,r.EMPTY_OBJECT);var o=t.sourceUri;"string"==typeof e&&(n(o)||(o=e),i=c(e)),t={describe:r(t.describe,I),markerSize:r(t.markerSize,Q),markerSymbol:r(t.markerSymbol,Y),markerColor:r(t.markerColor,J),strokeWidthProperty:new E(r(t.strokeWidth,ee)),strokeMaterialProperty:new y(r(t.stroke,$)),fillMaterialProperty:new y(r(t.fill,te))};var a=this;return v(i,function(e){return j(a,e,t,o)}).otherwise(function(e){return S.setLoading(a,!1),a._error.raiseEvent(a,e),console.log(e),v.reject(e)})},q}),i("DataSources/GeometryUpdater",["../Core/defineProperties","../Core/DeveloperError"],function(e,t){"use strict";function i(e,i){t.throwInstantiationError()}return e(i,{perInstanceColorAppearanceType:{get:t.throwInstantiationError},materialAppearanceType:{get:t.throwInstantiationError}}),e(i.prototype,{entity:{get:t.throwInstantiationError},fillEnabled:{get:t.throwInstantiationError},hasConstantFill:{get:t.throwInstantiationError},fillMaterialProperty:{get:t.throwInstantiationError},outlineEnabled:{get:t.throwInstantiationError},hasConstantOutline:{get:t.throwInstantiationError},outlineColorProperty:{get:t.throwInstantiationError},outlineWidth:{get:t.throwInstantiationError},isDynamic:{get:t.throwInstantiationError},isClosed:{get:t.throwInstantiationError},geometryChanged:{get:t.throwInstantiationError}}),i.prototype.isOutlineVisible=t.throwInstantiationError,i.prototype.isFilled=t.throwInstantiationError,i.prototype.createFillGeometryInstance=t.throwInstantiationError,i.prototype.createOutlineGeometryInstance=t.throwInstantiationError,i.prototype.isDestroyed=t.throwInstantiationError,i.prototype.destroy=t.throwInstantiationError,i.prototype.createDynamicUpdater=t.throwInstantiationError,i}),function(e,t){"function"==typeof i&&i.amd?i("ThirdParty/Autolinker",[],function(){return e.Autolinker=t()}):"object"==typeof exports?module.exports=t():e.Autolinker=t()}(this,function(){var e=function(t){e.Util.assign(this,t);var i=this.hashtag;if(i!==!1&&"twitter"!==i&&"facebook"!==i)throw new Error("invalid `hashtag` cfg - see docs")};return e.prototype={constructor:e,urls:!0,email:!0,twitter:!0,phone:!0,hashtag:!1,newWindow:!0,stripPrefix:!0,truncate:void 0,className:"",htmlParser:void 0,matchParser:void 0,tagBuilder:void 0,link:function(e){for(var t=this.getHtmlParser(),i=t.parse(e),r=0,n=[],o=0,a=i.length;a>o;o++){var s=i[o],l=s.getType(),u=s.getText();if("element"===l)"a"===s.getTagName()&&(s.isClosing()?r=Math.max(r-1,0):r++),n.push(u);else if("entity"===l||"comment"===l)n.push(u);else if(0===r){var c=this.linkifyStr(u);n.push(c)}else n.push(u)}return n.join("")},linkifyStr:function(e){return this.getMatchParser().replace(e,this.createMatchReturnVal,this)},createMatchReturnVal:function(t){var i;if(this.replaceFn&&(i=this.replaceFn.call(this,this,t)),"string"==typeof i)return i;if(i===!1)return t.getMatchedText();if(i instanceof e.HtmlTag)return i.toAnchorString();var r=this.getTagBuilder(),n=r.build(t);return n.toAnchorString()},getHtmlParser:function(){var t=this.htmlParser;return t||(t=this.htmlParser=new e.htmlParser.HtmlParser),t},getMatchParser:function(){var t=this.matchParser;return t||(t=this.matchParser=new e.matchParser.MatchParser({urls:this.urls,email:this.email,twitter:this.twitter,phone:this.phone,hashtag:this.hashtag,stripPrefix:this.stripPrefix})),t},getTagBuilder:function(){var t=this.tagBuilder;return t||(t=this.tagBuilder=new e.AnchorTagBuilder({newWindow:this.newWindow,truncate:this.truncate,className:this.className})),t}},e.link=function(t,i){var r=new e(i);return r.link(t)},e.match={},e.htmlParser={},e.matchParser={},e.Util={abstractMethod:function(){throw"abstract"},trimRegex:/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,assign:function(e,t){for(var i in t)t.hasOwnProperty(i)&&(e[i]=t[i]);return e},extend:function(t,i){var r=t.prototype,n=function(){};n.prototype=r;var o;o=i.hasOwnProperty("constructor")?i.constructor:function(){r.constructor.apply(this,arguments)};var a=o.prototype=new n;return a.constructor=o,a.superclass=r,delete i.constructor,e.Util.assign(a,i),o},ellipsis:function(e,t,i){return e.length>t&&(i=null==i?"..":i,e=e.substring(0,t-i.length)+i),e},indexOf:function(e,t){if(Array.prototype.indexOf)return e.indexOf(t);for(var i=0,r=e.length;r>i;i++)if(e[i]===t)return i;return-1},splitAndCapture:function(e,t){if(!t.global)throw new Error("`splitRegex` must have the 'g' flag set");for(var i,r=[],n=0;i=t.exec(e);)r.push(e.substring(n,i.index)),r.push(i[0]),n=i.index+i[0].length;return r.push(e.substring(n)),r},trim:function(e){return e.replace(this.trimRegex,"")}},e.HtmlTag=e.Util.extend(Object,{whitespaceRegex:/\s+/,constructor:function(t){e.Util.assign(this,t),this.innerHtml=this.innerHtml||this.innerHTML},setTagName:function(e){return this.tagName=e,this},getTagName:function(){return this.tagName||""},setAttr:function(e,t){var i=this.getAttrs();return i[e]=t,this},getAttr:function(e){return this.getAttrs()[e]},setAttrs:function(t){var i=this.getAttrs();return e.Util.assign(i,t),this},getAttrs:function(){return this.attrs||(this.attrs={})},setClass:function(e){return this.setAttr("class",e)},addClass:function(t){for(var i,r=this.getClass(),n=this.whitespaceRegex,o=e.Util.indexOf,a=r?r.split(n):[],s=t.split(n);i=s.shift();)-1===o(a,i)&&a.push(i);return this.getAttrs()["class"]=a.join(" "),this},removeClass:function(t){for(var i,r=this.getClass(),n=this.whitespaceRegex,o=e.Util.indexOf,a=r?r.split(n):[],s=t.split(n);a.length&&(i=s.shift());){var l=o(a,i);-1!==l&&a.splice(l,1)}return this.getAttrs()["class"]=a.join(" "),this},getClass:function(){return this.getAttrs()["class"]||""},hasClass:function(e){return-1!==(" "+this.getClass()+" ").indexOf(" "+e+" ")},setInnerHtml:function(e){return this.innerHtml=e,this},getInnerHtml:function(){return this.innerHtml||""},toAnchorString:function(){var e=this.getTagName(),t=this.buildAttrsStr();return t=t?" "+t:"",["<",e,t,">",this.getInnerHtml(),"</",e,">"].join("")},buildAttrsStr:function(){if(!this.attrs)return"";var e=this.getAttrs(),t=[];for(var i in e)e.hasOwnProperty(i)&&t.push(i+'="'+e[i]+'"');return t.join(" ")}}),e.AnchorTagBuilder=e.Util.extend(Object,{constructor:function(t){e.Util.assign(this,t)},build:function(t){var i=new e.HtmlTag({tagName:"a",attrs:this.createAttrs(t.getType(),t.getAnchorHref()),innerHtml:this.processAnchorText(t.getAnchorText())});return i},createAttrs:function(e,t){var i={href:t},r=this.createCssClass(e);return r&&(i["class"]=r),this.newWindow&&(i.target="_blank"),i},createCssClass:function(e){var t=this.className;return t?t+" "+t+"-"+e:""},processAnchorText:function(e){return e=this.doTruncate(e)},doTruncate:function(t){return e.Util.ellipsis(t,this.truncate||Number.POSITIVE_INFINITY)}}),e.htmlParser.HtmlParser=e.Util.extend(Object,{htmlRegex:function(){var e=/!--([\s\S]+?)--/,t=/[0-9a-zA-Z][0-9a-zA-Z:]*/,i=/[^\s\0"'>\/=\x01-\x1F\x7F]+/,r=/(?:"[^"]*?"|'[^']*?'|[^'"=<>`\s]+)/,n=i.source+"(?:\\s*=\\s*"+r.source+")?";return new RegExp(["(?:","<(!DOCTYPE)","(?:","\\s+","(?:",n,"|",r.source+")",")*",">",")","|","(?:","<(/)?","(?:",e.source,"|","(?:","("+t.source+")","(?:","\\s+",n,")*","\\s*/?",")",")",">",")"].join(""),"gi")}(),htmlCharacterEntitiesRegex:/( | |<|<|>|>|"|"|')/gi,parse:function(e){for(var t,i,r=this.htmlRegex,n=0,o=[];null!==(t=r.exec(e));){var a=t[0],s=t[3],l=t[1]||t[4],u=!!t[2],c=e.substring(n,t.index);c&&(i=this.parseTextAndEntityNodes(c),o.push.apply(o,i)),s?o.push(this.createCommentNode(a,s)):o.push(this.createElementNode(a,l,u)),n=t.index+a.length}if(n<e.length){var h=e.substring(n);h&&(i=this.parseTextAndEntityNodes(h),o.push.apply(o,i))}return o},parseTextAndEntityNodes:function(t){for(var i=[],r=e.Util.splitAndCapture(t,this.htmlCharacterEntitiesRegex),n=0,o=r.length;o>n;n+=2){var a=r[n],s=r[n+1];a&&i.push(this.createTextNode(a)),s&&i.push(this.createEntityNode(s))}return i},createCommentNode:function(t,i){return new e.htmlParser.CommentNode({text:t,comment:e.Util.trim(i)})},createElementNode:function(t,i,r){return new e.htmlParser.ElementNode({text:t,tagName:i.toLowerCase(),closing:r})},createEntityNode:function(t){return new e.htmlParser.EntityNode({text:t})},createTextNode:function(t){return new e.htmlParser.TextNode({text:t})}}),e.htmlParser.HtmlNode=e.Util.extend(Object,{text:"",constructor:function(t){e.Util.assign(this,t)},getType:e.Util.abstractMethod,getText:function(){return this.text}}),e.htmlParser.CommentNode=e.Util.extend(e.htmlParser.HtmlNode,{comment:"",getType:function(){return"comment"},getComment:function(){return this.comment}}),e.htmlParser.ElementNode=e.Util.extend(e.htmlParser.HtmlNode,{tagName:"",closing:!1,getType:function(){return"element"},getTagName:function(){return this.tagName},isClosing:function(){return this.closing}}),e.htmlParser.EntityNode=e.Util.extend(e.htmlParser.HtmlNode,{getType:function(){return"entity"}}),e.htmlParser.TextNode=e.Util.extend(e.htmlParser.HtmlNode,{getType:function(){return"text"}}),e.matchParser.MatchParser=e.Util.extend(Object,{urls:!0,email:!0,twitter:!0,phone:!0,hashtag:!1,stripPrefix:!0,matcherRegex:function(){var e=/(^|[^\w])@(\w{1,15})/,t=/(^|[^\w])#(\w{1,15})/,i=/(?:[\-;:&=\+\$,\w\.]+@)/,r=/(?:\+?\d{1,3}[-\s.])?\(?\d{3}\)?[-\s.]?\d{3}[-\s.]\d{4}/,n=/(?:[A-Za-z][-.+A-Za-z0-9]+:(?![A-Za-z][-.+A-Za-z0-9]+:\/\/)(?!\d+\/?)(?:\/\/)?)/,o=/(?:www\.)/,a=/[A-Za-z0-9\.\-]*[A-Za-z0-9\-]/,s=/\.(?:international|construction|contractors|enterprises|photography|productions|foundation|immobilien|industries|management|properties|technology|christmas|community|directory|education|equipment|institute|marketing|solutions|vacations|bargains|boutique|builders|catering|cleaning|clothing|computer|democrat|diamonds|graphics|holdings|lighting|partners|plumbing|supplies|training|ventures|academy|careers|company|cruises|domains|exposed|flights|florist|gallery|guitars|holiday|kitchen|neustar|okinawa|recipes|rentals|reviews|shiksha|singles|support|systems|agency|berlin|camera|center|coffee|condos|dating|estate|events|expert|futbol|kaufen|luxury|maison|monash|museum|nagoya|photos|repair|report|social|supply|tattoo|tienda|travel|viajes|villas|vision|voting|voyage|actor|build|cards|cheap|codes|dance|email|glass|house|mango|ninja|parts|photo|shoes|solar|today|tokyo|tools|watch|works|aero|arpa|asia|best|bike|blue|buzz|camp|club|cool|coop|farm|fish|gift|guru|info|jobs|kiwi|kred|land|limo|link|menu|mobi|moda|name|pics|pink|post|qpon|rich|ruhr|sexy|tips|vote|voto|wang|wien|wiki|zone|bar|bid|biz|cab|cat|ceo|com|edu|gov|int|kim|mil|net|onl|org|pro|pub|red|tel|uno|wed|xxx|xyz|ac|ad|ae|af|ag|ai|al|am|an|ao|aq|ar|as|at|au|aw|ax|az|ba|bb|bd|be|bf|bg|bh|bi|bj|bm|bn|bo|br|bs|bt|bv|bw|by|bz|ca|cc|cd|cf|cg|ch|ci|ck|cl|cm|cn|co|cr|cu|cv|cw|cx|cy|cz|de|dj|dk|dm|do|dz|ec|ee|eg|er|es|et|eu|fi|fj|fk|fm|fo|fr|ga|gb|gd|ge|gf|gg|gh|gi|gl|gm|gn|gp|gq|gr|gs|gt|gu|gw|gy|hk|hm|hn|hr|ht|hu|id|ie|il|im|in|io|iq|ir|is|it|je|jm|jo|jp|ke|kg|kh|ki|km|kn|kp|kr|kw|ky|kz|la|lb|lc|li|lk|lr|ls|lt|lu|lv|ly|ma|mc|md|me|mg|mh|mk|ml|mm|mn|mo|mp|mq|mr|ms|mt|mu|mv|mw|mx|my|mz|na|nc|ne|nf|ng|ni|nl|no|np|nr|nu|nz|om|pa|pe|pf|pg|ph|pk|pl|pm|pn|pr|ps|pt|pw|py|qa|re|ro|rs|ru|rw|sa|sb|sc|sd|se|sg|sh|si|sj|sk|sl|sm|sn|so|sr|st|su|sv|sx|sy|sz|tc|td|tf|tg|th|tj|tk|tl|tm|tn|to|tp|tr|tt|tv|tw|tz|ua|ug|uk|us|uy|uz|va|vc|ve|vg|vi|vn|vu|wf|ws|ye|yt|za|zm|zw)\b/,l=/[\-A-Za-z0-9+&@#\/%=~_()|'$*\[\]?!:,.;]*[\-A-Za-z0-9+&@#\/%=~_()|'$*\[\]]/;return new RegExp(["(",e.source,")","|","(",i.source,a.source,s.source,")","|","(","(?:","(",n.source,a.source,")","|","(?:","(.?//)?",o.source,a.source,")","|","(?:","(.?//)?",a.source,s.source,")",")","(?:"+l.source+")?",")","|","(",r.source,")","|","(",t.source,")"].join(""),"gi")}(),charBeforeProtocolRelMatchRegex:/^(.)?\/\//,constructor:function(t){e.Util.assign(this,t),this.matchValidator=new e.MatchValidator},replace:function(e,t,i){var r=this;return e.replace(this.matcherRegex,function(e,n,o,a,s,l,u,c,h,d,p,m,f){var v=r.processCandidateMatch(e,n,o,a,s,l,u,c,h,d,p,m,f);if(v){var g=t.call(i,v.match);return v.prefixStr+g+v.suffixStr}return e})},processCandidateMatch:function(t,i,r,n,o,a,s,l,u,c,h,d,p){var m,f=l||u,v="",g="";if(a&&!this.urls||o&&!this.email||c&&!this.phone||i&&!this.twitter||h&&!this.hashtag||!this.matchValidator.isValidMatch(a,s,f))return null;if(this.matchHasUnbalancedClosingParen(t)&&(t=t.substr(0,t.length-1),g=")"),o)m=new e.match.Email({matchedText:t,email:o});else if(i)r&&(v=r,t=t.slice(1)),m=new e.match.Twitter({matchedText:t,twitterHandle:n});else if(c){var _=t.replace(/\D/g,"");m=new e.match.Phone({matchedText:t,number:_})}else if(h)d&&(v=d,t=t.slice(1)),m=new e.match.Hashtag({matchedText:t,serviceName:this.hashtag,hashtag:p});else{if(f){var y=f.match(this.charBeforeProtocolRelMatchRegex)[1]||"";y&&(v=y,t=t.slice(1))}m=new e.match.Url({matchedText:t,url:t,protocolUrlMatch:!!s,protocolRelativeMatch:!!f,stripPrefix:this.stripPrefix})}return{prefixStr:v,suffixStr:g,match:m}},matchHasUnbalancedClosingParen:function(e){var t=e.charAt(e.length-1);if(")"===t){var i=e.match(/\(/g),r=e.match(/\)/g),n=i&&i.length||0,o=r&&r.length||0;if(o>n)return!0}return!1}}),e.MatchValidator=e.Util.extend(Object,{invalidProtocolRelMatchRegex:/^[\w]\/\//,hasFullProtocolRegex:/^[A-Za-z][-.+A-Za-z0-9]+:\/\//,uriSchemeRegex:/^[A-Za-z][-.+A-Za-z0-9]+:/,hasWordCharAfterProtocolRegex:/:[^\s]*?[A-Za-z]/,isValidMatch:function(e,t,i){return t&&!this.isValidUriScheme(t)||this.urlMatchDoesNotHaveProtocolOrDot(e,t)||this.urlMatchDoesNotHaveAtLeastOneWordChar(e,t)||this.isInvalidProtocolRelativeMatch(i)?!1:!0},isValidUriScheme:function(e){var t=e.match(this.uriSchemeRegex)[0].toLowerCase();return"javascript:"!==t&&"vbscript:"!==t},urlMatchDoesNotHaveProtocolOrDot:function(e,t){return!(!e||t&&this.hasFullProtocolRegex.test(t)||-1!==e.indexOf("."))},urlMatchDoesNotHaveAtLeastOneWordChar:function(e,t){return e&&t?!this.hasWordCharAfterProtocolRegex.test(e):!1},isInvalidProtocolRelativeMatch:function(e){return!!e&&this.invalidProtocolRelMatchRegex.test(e)}}),e.match.Match=e.Util.extend(Object,{constructor:function(t){e.Util.assign(this,t)},getType:e.Util.abstractMethod,getMatchedText:function(){return this.matchedText},getAnchorHref:e.Util.abstractMethod,getAnchorText:e.Util.abstractMethod}),e.match.Email=e.Util.extend(e.match.Match,{getType:function(){return"email"},getEmail:function(){return this.email},getAnchorHref:function(){return"mailto:"+this.email},getAnchorText:function(){return this.email}}),e.match.Hashtag=e.Util.extend(e.match.Match,{getType:function(){return"hashtag"},getHashtag:function(){return this.hashtag},getAnchorHref:function(){var e=this.serviceName,t=this.hashtag;switch(e){case"twitter":return"https://twitter.com/hashtag/"+t;case"facebook":return"https://www.facebook.com/hashtag/"+t;default:throw new Error("Unknown service name to point hashtag to: ",e)}},getAnchorText:function(){return"#"+this.hashtag}}),e.match.Phone=e.Util.extend(e.match.Match,{getType:function(){return"phone"},getNumber:function(){return this.number},getAnchorHref:function(){return"tel:"+this.number},getAnchorText:function(){return this.matchedText}}),e.match.Twitter=e.Util.extend(e.match.Match,{getType:function(){return"twitter"},getTwitterHandle:function(){return this.twitterHandle},getAnchorHref:function(){return"https://twitter.com/"+this.twitterHandle},getAnchorText:function(){return"@"+this.twitterHandle}}),e.match.Url=e.Util.extend(e.match.Match,{urlPrefixRegex:/^(https?:\/\/)?(www\.)?/i,protocolRelativeRegex:/^\/\//,protocolPrepended:!1,getType:function(){return"url"},getUrl:function(){var e=this.url;return this.protocolRelativeMatch||this.protocolUrlMatch||this.protocolPrepended||(e=this.url="http://"+e,this.protocolPrepended=!0),e},getAnchorHref:function(){var e=this.getUrl();return e.replace(/&/g,"&")},getAnchorText:function(){var e=this.getUrl();return this.protocolRelativeMatch&&(e=this.stripProtocolRelativePrefix(e)),this.stripPrefix&&(e=this.stripUrlPrefix(e)),e=this.removeTrailingSlash(e)},stripUrlPrefix:function(e){return e.replace(this.urlPrefixRegex,"")},stripProtocolRelativePrefix:function(e){return e.replace(this.protocolRelativeRegex,"")},removeTrailingSlash:function(e){return"/"===e.charAt(e.length-1)&&(e=e.slice(0,-1)),e}}),e}),i("ThirdParty/zip",["../Core/buildModuleUrl","../Core/defineProperties"],function(e,t){var i={};return function(i){function r(){var e=-1,t=this;t.append=function(i){var r,n=t.table;for(r=0;r<i.length;r++)e=e>>>8^n[255&(e^i[r])]},t.get=function(){return~e}}function n(e,t,i){return e.slice?e.slice(t,t+i):e.webkitSlice?e.webkitSlice(t,t+i):e.mozSlice?e.mozSlice(t,t+i):e.msSlice?e.msSlice(t,t+i):void 0}function o(e,t){var i,r;return i=new ArrayBuffer(e),r=new Uint8Array(i),t&&r.set(t,0),{buffer:i,array:r,view:new DataView(i)}}function a(){}function s(e){function t(t,i){var o=new Blob([e],{type:z});r=new u(o),r.init(function(){n.size=r.size,t()},i)}function i(e,t,i,n){r.readUint8Array(e,t,i,n)}var r,n=this;n.size=0,n.init=t,n.readUint8Array=i}function l(e){function t(t){for(var i=e.length;"="==e.charAt(i-1);)i--;r=e.indexOf(",")+1,n.size=Math.floor(.75*(i-r)),t()}function i(t,i,n){var a,s=o(i),l=4*Math.floor(t/3),u=4*Math.ceil((t+i)/3),c=window.atob(e.substring(l+r,u+r)),h=t-3*Math.floor(l/4);for(a=h;h+i>a;a++)s.array[a-h]=c.charCodeAt(a);n(s.array)}var r,n=this;n.size=0,n.init=t,n.readUint8Array=i}function u(e){function t(t){this.size=e.size,t()}function i(t,i,r,o){var a=new FileReader;a.onload=function(e){r(new Uint8Array(e.target.result))},a.onerror=o,a.readAsArrayBuffer(n(e,t,i))}var r=this;r.size=0,r.init=t,r.readUint8Array=i}function c(){}function h(e){function t(e){n=new Blob([],{type:z}),e()}function i(e,t){n=new Blob([n,P?e:e.buffer],{type:z}),t()}function r(t,i){var r=new FileReader;r.onload=function(e){t(e.target.result)},r.onerror=i,r.readAsText(n,e)}var n,o=this;o.init=t,o.writeUint8Array=i,o.getData=r}function d(e){function t(t){o+="data:"+(e||"")+";base64,",t()}function i(e,t){var i,r=a.length,n=a;for(a="",i=0;i<3*Math.floor((r+e.length)/3)-r;i++)n+=String.fromCharCode(e[i]);for(;i<e.length;i++)a+=String.fromCharCode(e[i]);n.length>2?o+=window.btoa(n):a=n,t()}function r(e){e(o+window.btoa(a))}var n=this,o="",a="";n.init=t,n.writeUint8Array=i,n.getData=r}function p(e){function t(t){n=new Blob([],{type:e}),t()}function i(t,i){n=new Blob([n,P?t:t.buffer],{type:e}),i()}function r(e){e(n)}var n,o=this;o.init=t,o.writeUint8Array=i,o.getData=r}function m(e,t,i,r,n,o,a,s,l,u){function c(){e.removeEventListener(U,h,!1),s(m)}function h(e){var t=e.data,r=t.data;t.onappend&&(m+=r.length,i.writeUint8Array(r,function(){o(!1,r),d()},u)),t.onflush&&(r?(m+=r.length,i.writeUint8Array(r,function(){o(!1,r),c()},u)):c()),t.progress&&a&&a(p+t.current,n)}function d(){p=f*B,n>p?t.readUint8Array(r+p,Math.min(B,n-p),function(t){e.postMessage({append:!0,data:t}),f++,a&&a(p,n),o(!0,t)},l):e.postMessage({flush:!0})}var p,m,f=0;m=0,e.addEventListener(U,h,!1),d()}function f(e,t,i,r,n,o,a,s,l,u){function c(){var m;h=d*B,n>h?t.readUint8Array(r+h,Math.min(B,n-h),function(t){var s=e.append(t,function(){a&&a(r+h,n)});p+=s.length,o(!0,t),i.writeUint8Array(s,function(){o(!1,s),d++,setTimeout(c,1)},u),a&&a(h,n)},l):(m=e.flush(),m?(p+=m.length,i.writeUint8Array(m,function(){o(!1,m),s(p)},u)):s(p))}var h,d=0,p=0;c()}function v(e,t,n,o,a,s,l,u,c){function h(e,t){a&&!e&&v.append(t)}function d(e){s(e,v.get())}var p,v=new r;return i.zip.useWebWorkers?(p=new Worker(i.zip.workerScriptsPath+V),m(p,e,t,n,o,h,l,d,u,c)):f(new i.zip.Inflater,e,t,n,o,h,l,d,u,c),p}function g(e,t,n,o,a,s,l){function u(e,t){e&&p.append(t)}function c(e){o(e,p.get())}function h(){d.removeEventListener(U,h,!1),m(d,e,t,0,e.size,u,a,c,s,l)}var d,p=new r;return i.zip.useWebWorkers?(d=new Worker(i.zip.workerScriptsPath+k),d.addEventListener(U,h,!1),d.postMessage({init:!0,level:n})):f(new i.zip.Deflater,e,t,0,e.size,u,a,c,s,l),d}function _(e,t,i,n,o,a,s,l,u){function c(){var r=h*B;n>r?e.readUint8Array(i+r,Math.min(B,n-r),function(e){o&&d.append(e),s&&s(r,n,e),t.writeUint8Array(e,function(){h++,c()},u)},l):a(n,d.get())}var h=0,d=new r;c()}function y(e){var t,i,r="",n=["Ç","ü","é","â","ä","à","å","ç","ê","ë","è","ï","î","ì","Ä","Å","É","æ","Æ","ô","ö","ò","û","ù","ÿ","Ö","Ü","ø","£","Ø","×","ƒ","á","í","ó","ú","ñ","Ñ","ª","º","¿","®","¬","½","¼","¡","«","»","_","_","_","¦","¦","Á","Â","À","©","¦","¦","+","+","¢","¥","+","+","-","-","+","-","+","ã","Ã","+","+","-","-","¦","-","+","¤","ð","Ð","Ê","Ë","È","i","Í","Î","Ï","+","+","_","_","¦","Ì","_","Ó","ß","Ô","Ò","õ","Õ","µ","þ","Þ","Ú","Û","Ù","ý","Ý","¯","´","­","±","_","¾","¶","§","÷","¸","°","¨","·","¹","³","²","_"," "];for(t=0;t<e.length;t++)i=255&e.charCodeAt(t),r+=i>127?n[i-128]:String.fromCharCode(i);return r}function C(e){return decodeURIComponent(escape(e))}function E(e){var t,i="";for(t=0;t<e.length;t++)i+=String.fromCharCode(e[t]);return i}function S(e){var t=(4294901760&e)>>16,i=65535&e;try{return new Date(1980+((65024&t)>>9),((480&t)>>5)-1,31&t,(63488&i)>>11,(2016&i)>>5,2*(31&i),0)}catch(r){}}function w(e,t,i,r,n){return e.version=t.view.getUint16(i,!0),e.bitFlag=t.view.getUint16(i+2,!0),e.compressionMethod=t.view.getUint16(i+4,!0),e.lastModDateRaw=t.view.getUint32(i+6,!0),e.lastModDate=S(e.lastModDateRaw),1===(1&e.bitFlag)?void n(M):((r||8!=(8&e.bitFlag))&&(e.crc32=t.view.getUint32(i+10,!0),e.compressedSize=t.view.getUint32(i+14,!0),e.uncompressedSize=t.view.getUint32(i+18,!0)),4294967295===e.compressedSize||4294967295===e.uncompressedSize?void n(D):(e.filenameLength=t.view.getUint16(i+22,!0),void(e.extraFieldLength=t.view.getUint16(i+24,!0))))}function T(e,t){function i(){}function r(i,n){e.readUint8Array(e.size-i,i,function(e){var t=o(e.length,e).view;1347093766!=t.getUint32(0)?r(i+1,n):n(t)},function(){t(R)})}return i.prototype.getData=function(i,r,n,a){function s(e,t){d&&d.terminate(),d=null,e&&e(t)}function l(e){var t=o(4);return t.view.setUint32(0,e),p.crc32==t.view.getUint32(0)}function u(e,t){a&&!l(t)?c():i.getData(function(e){s(r,e)})}function c(){s(t,L)}function h(){s(t,N)}var d,p=this;e.readUint8Array(p.offset,30,function(r){var s,l=o(r.length,r);return 1347093252!=l.view.getUint32(0)?void t(I):(w(p,l,4,!1,t),s=p.offset+30+p.filenameLength+p.extraFieldLength,void i.init(function(){0===p.compressionMethod?_(e,i,s,p.compressedSize,a,u,n,c,h):d=v(e,i,s,p.compressedSize,a,u,n,c,h)},h))},c)},{getEntries:function(n){return e.size<22?void t(I):void r(22,function(r){var a,s;a=r.getUint32(16,!0),s=r.getUint16(8,!0),e.readUint8Array(a,e.size-a,function(e){var r,a,l,u,c=0,h=[],d=o(e.length,e);for(r=0;s>r;r++){if(a=new i,1347092738!=d.view.getUint32(c))return void t(I);w(a,d,c+6,!0,t),a.commentLength=d.view.getUint16(c+32,!0),a.directory=16==(16&d.view.getUint8(c+38)),a.offset=d.view.getUint32(c+42,!0),l=E(d.array.subarray(c+46,c+46+a.filenameLength)),a.filename=2048===(2048&a.bitFlag)?C(l):y(l),a.directory||"/"!=a.filename.charAt(a.filename.length-1)||(a.directory=!0),u=E(d.array.subarray(c+46+a.filenameLength+a.extraFieldLength,c+46+a.filenameLength+a.extraFieldLength+a.commentLength)),a.comment=2048===(2048&a.bitFlag)?C(u):y(u),h.push(a),c+=46+a.filenameLength+a.extraFieldLength+a.commentLength}n(h)},function(){t(R)})})},close:function(e){e&&e()}}}function x(e){return unescape(encodeURIComponent(e))}function b(e){var t,i=[];for(t=0;t<e.length;t++)i.push(e.charCodeAt(t));return i}function A(e,t,i){function r(e,t){s&&s.terminate(),s=null,e&&e(t)}function n(){r(t,O)}function a(){r(t,L)}var s,l={},u=[],c=0;return{add:function(h,d,p,m,f){function v(t){var r;w=f.lastModDate||new Date,E=o(26),l[h]={headerArray:E.array,directory:f.directory,filename:S,offset:c,comment:b(x(f.comment||""))},E.view.setUint32(0,335546376),f.version&&E.view.setUint8(0,f.version),i||0===f.level||f.directory||E.view.setUint16(4,2048),E.view.setUint16(6,(w.getHours()<<6|w.getMinutes())<<5|w.getSeconds()/2,!0),E.view.setUint16(8,(w.getFullYear()-1980<<4|w.getMonth()+1)<<5|w.getDate(),!0),E.view.setUint16(22,S.length,!0),r=o(30+S.length),r.view.setUint32(0,1347093252),r.array.set(E.array,4),r.array.set(S,30),c+=r.array.length,e.writeUint8Array(r.array,t,n)}function y(t,i){var a=o(16);c+=t||0,a.view.setUint32(0,1347094280),"undefined"!=typeof i&&(E.view.setUint32(10,i,!0),a.view.setUint32(4,i,!0)),d&&(a.view.setUint32(8,t,!0),E.view.setUint32(14,t,!0),a.view.setUint32(12,d.size,!0),E.view.setUint32(18,d.size,!0)),e.writeUint8Array(a.array,function(){c+=16,r(p)},n)}function C(){return f=f||{},h=h.trim(),f.directory&&"/"!=h.charAt(h.length-1)&&(h+="/"),l.hasOwnProperty(h)?void t(F):(S=b(x(h)),u.push(h),void v(function(){d?i||0===f.level?_(d,e,0,d.size,!0,y,m,a,n):s=g(d,e,f.level,y,m,a,n):y()},n))}var E,S,w;d?d.init(C,a):C()},close:function(t){var i,a,s,h=0,d=0;for(a=0;a<u.length;a++)s=l[u[a]],h+=46+s.filename.length+s.comment.length;for(i=o(h+22),a=0;a<u.length;a++)s=l[u[a]],i.view.setUint32(d,1347092738),i.view.setUint16(d+4,5120),i.array.set(s.headerArray,d+6),i.view.setUint16(d+32,s.comment.length,!0),s.directory&&i.view.setUint8(d+38,16),i.view.setUint32(d+42,s.offset,!0),i.array.set(s.filename,d+46),i.array.set(s.comment,d+46+s.filename.length),d+=46+s.filename.length+s.comment.length;i.view.setUint32(d,1347093766),i.view.setUint16(d+8,u.length,!0),i.view.setUint16(d+10,u.length,!0),i.view.setUint32(d+12,h,!0),i.view.setUint32(d+16,c,!0),e.writeUint8Array(i.array,function(){r(function(){e.getData(t)})},n)}}}var P,I="File format is not recognized.",M="File contains encrypted entry.",D="File is using Zip64 (4gb+ file size).",R="Error while reading zip file.",O="Error while writing zip file.",N="Error while writing file data.",L="Error while reading file data.",F="File already exists.",B=524288,V="inflate.js",k="deflate.js",z="text/plain",U="message";try{P=0===new Blob([new DataView(new ArrayBuffer(0))]).size}catch(G){}r.prototype.table=function(){var e,t,i,r=[];for(e=0;256>e;e++){for(i=e,t=0;8>t;t++)1&i?i=i>>>1^3988292384:i>>>=1;r[e]=i}return r}(),s.prototype=new a,s.prototype.constructor=s,l.prototype=new a,l.prototype.constructor=l,u.prototype=new a,u.prototype.constructor=u,c.prototype.getData=function(e){e(this.data)},h.prototype=new c,h.prototype.constructor=h,d.prototype=new c,d.prototype.constructor=d,p.prototype=new c,p.prototype.constructor=p,i.zip={Reader:a,Writer:c,BlobReader:u,Data64URIReader:l,TextReader:s,BlobWriter:p,Data64URIWriter:d,TextWriter:h,createReader:function(e,t,i){e.init(function(){t(T(e,i))},i)},createWriter:function(e,t,i,r){e.init(function(){t(A(e,i,r))},i)},useWebWorkers:!0};var W;t(i.zip,{workerScriptsPath:{get:function(){return"undefined"==typeof W&&(W=e("ThirdParty/Workers/")),W}}})}(i),i.zip}),i("DataSources/KmlDataSource",["../Core/BoundingRectangle","../Core/Cartesian2","../Core/Cartesian3","../Core/ClockRange","../Core/ClockStep","../Core/Color","../Core/createGuid","../Core/defaultValue","../Core/defined","../Core/definedNotNull","../Core/defineProperties","../Core/DeveloperError","../Core/Ellipsoid","../Core/Event","../Core/getAbsoluteUri","../Core/getExtensionFromUri","../Core/getFilenameFromUri","../Core/Iso8601","../Core/JulianDate","../Core/loadBlob","../Core/loadXML","../Core/Math","../Core/NearFarScalar","../Core/PinBuilder","../Core/PolygonHierarchy","../Core/Rectangle","../Core/RuntimeError","../Core/TimeInterval","../Core/TimeIntervalCollection","../Scene/HorizontalOrigin","../Scene/LabelStyle","../ThirdParty/Autolinker","../ThirdParty/Uri","../ThirdParty/when","../ThirdParty/zip","./BillboardGraphics","./CompositePositionProperty","./ConstantPositionProperty","./DataSource","./DataSourceClock","./Entity","./EntityCollection","./LabelGraphics","./PathGraphics","./PolygonGraphics","./PolylineGraphics","./PositionPropertyArray","./RectangleGraphics","./ReferenceProperty","./SampledPositionProperty","./ScaledPositionProperty","./TimeIntervalCollectionProperty","./WallGraphics"],function(e,t,i,r,n,o,a,s,l,u,c,h,d,p,m,f,v,g,_,y,C,E,S,w,T,x,b,A,P,I,M,D,R,O,N,L,F,B,V,k,z,U,G,W,H,q,j,Y,X,Z,K,Q,J){ +"use strict";function $(e){var t=e.slice(0,Math.min(4,e.size)),i=O.defer(),r=new FileReader;return r.addEventListener("load",function(){i.resolve(1347093252===new DataView(r.result).getUint32(0,!1))}),r.addEventListener("error",function(){i.reject(r.error)}),r.readAsArrayBuffer(t),i.promise}function ee(e){var t=O.defer(),i=new FileReader;return i.addEventListener("load",function(){t.resolve(i.result)}),i.addEventListener("error",function(){t.reject(i.error)}),i.readAsText(e),t.promise}function te(e,t,i,r){t.getData(new N.TextWriter,function(e){i.kml=rt.parseFromString(e,"application/xml"),r.resolve()})}function ie(e,t,i,r){var n=s(it.detectFromFilename(t.filename),"application/octet-stream");t.getData(new N.Data64URIWriter(n),function(e){i[t.filename]=e,r.resolve()})}function re(e,t,i,r){for(var n=r.keys,o=new R("."),a=e.querySelectorAll(t),s=0;s<a.length;s++){var l=a[s],u=l.getAttribute(i),c=new R(u).resolve(o).toString(),h=n.indexOf(c);if(-1!==h){var d=n[h];l.setAttribute(i,r[d]),"a"===t&&null===l.getAttribute("download")&&l.setAttribute("download",d)}}}function ne(e,t){return l(t)&&new R(e).isAbsolute()&&(e=t.getURL(e)),e}function oe(e,t){var i=ce(e,"id");i=l(i)?i:a();var r=t.getOrCreateEntity(i);return l(r.kml)||(r.addProperty("kml"),r.kml=new tt),r}function ae(e,t){return"absolute"===e||"relativeToGround"===e||"relativeToSeaFloor"===t}function se(e){if(!l(e))return i.fromDegrees(0,0,0);var t=e.match(/[^\s,\n]+/g);if(!u(t))return i.fromDegrees(0,0,0);var r=parseFloat(t[0]),n=parseFloat(t[1]),o=parseFloat(t[2]);return r=isNaN(r)?0:r,n=isNaN(n)?0:n,o=isNaN(o)?0:o,i.fromDegrees(r,n,o)}function le(e){if(l(e)){var t=e.textContent.match(/[^\s\n]+/g);if(u(t)){for(var i=t.length,r=new Array(i),n=0,o=0;i>o;o++)r[n++]=se(t[o]);return r}}}function ue(e,t){if(l(e)){var i=e.getAttribute(t);if(null!==i){var r=parseFloat(i);return isNaN(r)?void 0:r}}}function ce(e,t){if(l(e)){var i=e.getAttribute(t);return null!==i?i:void 0}}function he(e,t,i){if(l(e))for(var r=e.childNodes,n=r.length,o=0;n>o;o++){var a=r[o];if(a.localName===t&&-1!==i.indexOf(a.namespaceURI))return a}}function de(e,t,i){if(l(e)){for(var r=[],n=e.getElementsByTagName(t),o=n.length,a=0;o>a;a++){var s=n[a];s.localName===t&&-1!==i.indexOf(s.namespaceURI)&&r.push(s)}return r}}function pe(e,t,i){if(!l(e))return[];for(var r=[],n=e.childNodes,o=n.length,a=0;o>a;a++){var s=n[a];s.localName===t&&-1!==i.indexOf(s.namespaceURI)&&r.push(s)}return r}function me(e,t,i){var r=he(e,t,i);if(l(r)){var n=parseFloat(r.textContent);return isNaN(n)?void 0:n}}function fe(e,t,i){var r=he(e,t,i);return l(r)?r.textContent.trim():void 0}function ve(e,t,i){var r=he(e,t,i);if(l(r)){var n=r.textContent.trim();return"1"===n||/^true$/i.test(n)}}function ge(e,t,i,r){if(l(e)){var n=!1;if(l(r)){var o=r[e];l(o)&&(n=!0,e=o)}return!n&&l(i)&&(e=m(e,m(i)),e=ne(e,t)),e}}function _e(e,t){if(l(e)){"#"===e[0]&&(e=e.substring(1));var i=parseInt(e.substring(0,2),16)/255,r=parseInt(e.substring(2,4),16)/255,n=parseInt(e.substring(4,6),16)/255,a=parseInt(e.substring(6,8),16)/255;return t?(a>0?ct.maximumRed=a:ct.red=0,n>0?ct.maximumGreen=n:ct.green=0,r>0?ct.maximumBlue=r:ct.blue=0,ct.alpha=i,o.fromRandom(ct)):new o(a,n,r,i)}}function ye(e,t,i){var r=fe(e,t,i);if(l(r))return _e(r,"random"===fe(e,"colorMode",i))}function Ce(e){var t=he(e,"TimeStamp",ut.kmlgx),i=fe(t,"when",ut.kmlgx);if(l(t)&&l(i)&&0!==i.length){var r=_.fromIso8601(i),n=new P;return n.addInterval(new A({start:r,stop:g.MAXIMUM_VALUE})),n}}function Ee(e){var t=he(e,"TimeSpan",ut.kmlgx);if(l(t)){var i,r=he(t,"begin",ut.kmlgx),n=l(r)?_.fromIso8601(r.textContent):void 0,o=he(t,"end",ut.kmlgx),a=l(o)?_.fromIso8601(o.textContent):void 0;if(l(n)&&l(a)){if(_.lessThan(a,n)){var s=n;n=a,a=s}i=new P,i.addInterval(new A({start:n,stop:a}))}else l(n)?(i=new P,i.addInterval(new A({start:n,stop:g.MAXIMUM_VALUE}))):l(a)&&(i=new P,i.addInterval(new A({start:g.MINIMUM_VALUE,stop:a})));return i}}function Se(){var e=new L;return e.width=ot,e.height=ot,e.scaleByDistance=new S(2414016,1,16093e3,.1),e}function we(){var e=new H;return e.outline=!0,e.outlineColor=o.WHITE,e}function Te(){var e=new G;return e.translucencyByDistance=new S(3e6,1,5e6,0),e.pixelOffset=new t(17,0),e.horizontalOrigin=I.LEFT,e.font="16px sans-serif",e.style=M.FILL_AND_OUTLINE,e}function xe(r,n,o,a,u){var c=me(n,"scale",ut.kml),h=me(n,"heading",ut.kml),d=ye(n,"color",ut.kml),p=he(n,"Icon",ut.kml),m=fe(p,"href",ut.kml),f=ge(m,r._proxy,a,u),v=me(p,"x",ut.gx),g=me(p,"y",ut.gx),_=me(p,"w",ut.gx),y=me(p,"h",ut.gx),C=he(n,"hotSpot",ut.kml),S=ue(C,"x"),w=ue(C,"y"),T=ce(C,"xunits"),x=ce(C,"yunits"),b=o.billboard;l(b)||(b=Se(r),o.billboard=b),b.image=f,b.scale=c,b.color=d,(l(v)||l(g)||l(_)||l(y))&&(b.imageSubRegion=new e(v,g,_,y)),l(h)&&0!==h&&(b.rotation=E.toRadians(-h),b.alignedAxis=i.UNIT_Z),c=s(c,1);var A,P;l(S)&&("pixels"===T?A=-S*c:"insetPixels"===T?A=(S-ot)*c:"fraction"===T&&(A=-ot*c*S),A+=.5*ot*c),l(w)&&("pixels"===x?P=w:"insetPixels"===x?P=-w:"fraction"===x&&(P=w*ot),P-=.5*ot*c),(l(A)||l(P))&&(b.pixelOffset=new t(A,P))}function be(e,t,i,r,n){for(var a=0,u=t.childNodes.length;u>a;a++){var c=t.childNodes.item(a);if("IconStyle"===c.localName)xe(e,c,i,r,n);else if("LabelStyle"===c.localName){var h=i.label;l(h)||(h=Te(),i.label=h),h.scale=s(me(c,"scale",ut.kml),h.scale),h.fillColor=s(ye(c,"color",ut.kml),h.fillColor),h.text=i.name}else if("LineStyle"===c.localName){var d=i.polyline;l(d)||(d=new q,i.polyline=d),d.width=me(c,"width",ut.kml),d.material=ye(c,"color",ut.kml)}else if("PolyStyle"===c.localName){var p=i.polygon;l(p)||(p=we(),i.polygon=p),p.material=s(ye(c,"color",ut.kml),p.material),p.fill=s(ve(c,"fill",ut.kml),p.fill),p.outline=s(ve(c,"outline",ut.kml),p.outline)}else if("BalloonStyle"===c.localName){var m=s(_e(fe(c,"bgColor",ut.kml)),o.WHITE),f=s(_e(fe(c,"textColor",ut.kml)),o.BLACK),v=fe(c,"text",ut.kml);i.addProperty("balloonStyle"),i.balloonStyle={bgColor:m,textColor:f,text:v}}}}function Ae(e,t,i,r,n,o){var a=new z,s=pe(i,"Style",ut.kml),u=s.length;u>0&&be(t,s[u-1],a,n,o);var c=fe(i,"styleUrl",ut.kml);if(l(c)){var h=c,d=r.getById(h);l(d)||(d=r.getById("#"+h)),l(d)&&a.merge(d)}return a}function Pe(e,t,i){return O(C(ne(t,e._proxy)),function(r){return Ie(e,r,i,t,!0)})}function Ie(e,t,i,r,n,o){var a,s,u,c,h=de(t,"Style",ut.kml);if(l(h)){var d=h.length;for(a=0;d>a;a++)c=h[a],s=ce(c,"id"),l(s)&&(s="#"+s,n&&l(r)&&(s=r+s),l(i.getById(s))||(u=new z({id:s}),i.add(u),be(e,c,u,r,o)))}var p=de(t,"StyleMap",ut.kml);if(l(p)){var f=p.length;for(a=0;f>a;a++){var v=p[a];if(s=ce(v,"id"),l(s))for(var g=pe(v,"Pair",ut.kml),_=0;_<g.length;_++){var y=g[_];if("normal"===fe(y,"key",ut.kml)){if(s="#"+s,n&&l(r)&&(s=r+s),!l(i.getById(s))){u=i.getOrCreateEntity(s);var C=fe(y,"styleUrl",ut.kml);if(l(C)){var E=i.getOrCreateEntity(C);l(E)&&u.merge(E)}else c=he(y,"Style",ut.kml),be(e,c,u,r,o)}break}}}}var S={},w=[],T=t.getElementsByTagName("styleUrl"),x=T.length;for(a=0;x>a;a++){var b=T[a].textContent;if("#"!==b[0]){var A=b.split("#");if(2===A.length){var P=A[0];l(S[P])||(l(r)&&(P=m(P,m(r))),w.push(Pe(e,P,i,r)))}}}return w}function Me(e,t,i){var r=new X(e._entityCollection,t.id,["position"]),n=new K(t.position);t.polyline=l(i.polyline)?i.polyline.clone():new q,t.polyline.positions=new j([r,n])}function De(e,t,i){return"relativeToSeaFloor"===i||"absolute"===t||"relativeToGround"===t?e:((l(t)&&"clampToGround"!==t||l(i)&&"clampToSeaFloor"!==i)&&console.log("KML - Unknown altitudeMode: "+s(t,i)),new K(e))}function Re(e,t,i){if(l(e)){if("relativeToSeaFloor"===i||"absolute"===t||"relativeToGround"===t)return e;(l(t)&&"clampToGround"!==t||l(i)&&"clampToSeaFloor"!==i)&&console.log("KML - Unknown altitudeMode: "+s(t,i));for(var r=e.length,n=0;r>n;n++){var o=e[n];d.WGS84.scaleToGeodeticSurface(o,o)}return e}}function Oe(e,i,r){var n=i.label;l(n)||(n=l(r.label)?r.label.clone():Te(),i.label=n),n.text=i.name;var a=i.billboard;if(l(a)||(a=l(r.billboard)?r.billboard.clone():Se(),i.billboard=a),l(a.image)||(a.image=e._pinBuilder.fromColor(o.YELLOW,64)),l(a.scale)){var s=a.scale.getValue();0!==s?n.pixelOffset=new t(16*s+1,0):(n.pixelOffset=void 0,n.horizontalOrigin=void 0)}}function Ne(e,t,i){var r=t.path;l(r)||(r=new W,r.leadTime=0,t.path=r);var n=i.polyline;l(n)&&(r.material=n.material,r.width=n.width)}function Le(e,t,i,r){var n=fe(t,"coordinates",ut.kml),o=fe(t,"altitudeMode",ut.kml),a=fe(t,"altitudeMode",ut.gx),s=ve(t,"extrude",ut.kml),l=se(n);i.position=De(new B(l),o,a),Oe(e,i,r),s&&ae(o,a)&&Me(e,i,r)}function Fe(e,t,i,r){var n=he(t,"coordinates",ut.kml),a=fe(t,"altitudeMode",ut.kml),s=fe(t,"altitudeMode",ut.gx),u=ve(t,"extrude",ut.kml),c=ve(t,"tessellate",ut.kml),h=ae(a,s),d=le(n),p=r.polyline;if(h&&u){var m=new J;i.wall=m,m.positions=d;var f=r.polygon;l(f)&&(m.fill=f.fill,m.outline=f.outline,m.material=f.material),l(p)&&(m.outlineColor=l(p.material)?p.material.color:o.WHITE,m.outlineWidth=p.width)}else p=l(p)?p.clone():new q,i.polyline=p,p.positions=Re(d,a,s),(!c||h)&&(p.followSurface=!1)}function Be(e,t,i,r){var n=he(t,"outerBoundaryIs",ut.kml),a=he(n,"LinearRing",ut.kml),s=he(a,"coordinates",ut.kml),u=le(s),c=ve(t,"extrude",ut.kml),h=fe(t,"altitudeMode",ut.kml),d=fe(t,"altitudeMode",ut.gx),p=ae(h,d),m=l(r.polygon)?r.polygon.clone():we(),f=r.polyline;if(l(f)&&(m.outlineColor=l(f.material)?f.material.color:o.WHITE,m.outlineWidth=f.width),i.polygon=m,p&&(m.perPositionHeight=!0,m.extrudedHeight=c?0:void 0),l(u)){for(var v=new T(u),g=pe(t,"innerBoundaryIs",ut.kml),_=0;_<g.length;_++){a=pe(g[_],"LinearRing",ut.kml);for(var y=0;y<a.length;y++)s=he(a[y],"coordinates",ut.kml),u=le(s),l(u)&&v.holes.push(new T(u))}m.hierarchy=v}}function Ve(e,t,i,r){for(var n=fe(t,"altitudeMode",ut.kml),o=fe(t,"altitudeMode",ut.gx),a=pe(t,"coord",ut.gx),s=pe(t,"when",ut.kml),l=ve(t,"extrude",ut.kml),u=ae(n,o),c=Math.min(a.length,s.length),h=[],d=[],p=0;c>p;p++){var m=se(a[p].textContent);h.push(m),d.push(_.fromIso8601(s[p].textContent))}var f=new Z;f.addSamples(d,h),i.position=De(f,n,o),Oe(e,i,r),Ne(e,i,r),i.availability=new P,s.length>0&&i.availability.addInterval(new A({start:d[0],stop:d[d.length-1]})),u&&l&&Me(e,i,r)}function ke(e,t,i,r,n,o,a,s,l){var u=e[0],c=e[e.length-1],h=new Z;h.addSamples(e,t),i.intervals.addInterval(new A({start:u,stop:c,isStartIncluded:l,isStopIncluded:l,data:De(h,a,s)})),r.addInterval(new A({start:u,stop:c,isStartIncluded:l,isStopIncluded:l})),n.intervals.addInterval(new A({start:u,stop:c,isStartIncluded:l,isStopIncluded:l,data:o}))}function ze(e,t,i,r){for(var n,o,a,s=ve(t,"interpolate",ut.gx),u=pe(t,"Track",ut.gx),c=!1,h=new Q,d=new P,p=new F,m=0,f=u.length;f>m;m++){var v=u[m],g=pe(v,"when",ut.kml),y=pe(v,"coord",ut.gx),C=fe(v,"altitudeMode",ut.kml),E=fe(v,"altitudeMode",ut.gx),S=ae(C,E),w=ve(v,"extrude",ut.kml),T=Math.min(y.length,g.length),x=[];n=[];for(var b=0;T>b;b++){var A=se(y[b].textContent);x.push(A),n.push(_.fromIso8601(g[b].textContent))}s&&(l(o)&&ke([o,n[0]],[a,x[0]],p,d,h,!1,"absolute",void 0,!1),o=n[T-1],a=x[x.length-1]),ke(n,x,p,d,h,S&&w,C,E,!0),c=c||S&&w}i.availability=d,i.position=p,Oe(e,i,r),Ne(e,i,r),c&&(Me(e,i,r),i.polyline.show=h)}function Ue(e,t,i,r){for(var n=t.childNodes,o=0,a=n.length;a>o;o++){var s=n.item(o),u=dt[s.localName];if(l(u)){var c=oe(s,e._entityCollection);c.parent=i,c.name=i.name,c.availability=i.availability,c.description=i.description,c.kml=i.kml,u(e,s,c,r)}}}function Ge(e,t){var i=he(e,"ExtendedData",ut.kml);if(l(i)){var r={},n=pe(i,"Data",ut.kml);if(l(n))for(var o=n.length,a=0;o>a;a++){var s=n[a],u=ce(s,"name");l(u)&&(r[u]={displayName:fe(s,"displayName",ut.kml),value:fe(s,"value",ut.kml)})}t.kml.extendedData=r}}function We(e,t,i,r){var n,a,u,c=t.kml,h=c.extendedData,d=fe(e,"description",ut.kml),p=s(t.balloonStyle,i.balloonStyle),m=o.WHITE,f=o.BLACK,v=d;l(p)&&(m=s(p.bgColor,o.WHITE),f=s(p.textColor,o.BLACK),v=s(p.text,d));var g;if(l(v)){if(v=v.replace("$[name]",s(t.name,"")),v=v.replace("$[description]",s(d,"")),v=v.replace("$[address]",s(c.address,"")),v=v.replace("$[Snippet]",s(c.snippet,"")),v=v.replace("$[id]",t.id),v=v.replace("$[geDirections]",""),l(h)){var _=v.match(/\$\[.+?\]/g);if(null!==_)for(n=0;n<_.length;n++){var y=_[n],C=y.substr(2,y.length-3),E=/\/displayName$/.test(C);C=C.replace(/\/displayName$/,""),g=h[C],l(g)&&(g=E?g.displayName:g.value),l(g)&&(v=v.replace(y,s(g,"")))}}}else if(l(h)&&(u=Object.keys(h),u.length>0)){for(v='<table class="cesium-infoBox-defaultTable cesium-infoBox-defaultTable-lighter"><tbody>',n=0;n<u.length;n++)a=u[n],g=h[a],v+="<tr><th>"+s(g.displayName,a)+"</th><td>"+s(g.value,"")+"</td></tr>";v+="</tbody></table>"}if(l(v)){v=nt.link(v),ht.innerHTML=v;var S=ht.querySelectorAll("a");for(n=0;n<S.length;n++)S[n].setAttribute("target","_blank");l(r)&&r.keys.length>1&&(re(ht,"a","href",r),re(ht,"img","src",r));var w='<div class="cesium-infoBox-description-lighter" style="';w+="overflow:auto;",w+="word-wrap:break-word;",w+="background-color:"+m.toCssColorString()+";",w+="color:"+f.toCssColorString()+";",w+='">',w+=ht.innerHTML+"</div>",ht.innerHTML="",t.description=w}}function He(e,t,i,r,n,o,a){var u=oe(i,r),c=u.kml,h=Ae(u,e,i,n,o,a),d=fe(i,"name",ut.kml);u.name=d,u.parent=t;var p=Ee(i);l(p)||(p=Ce(i)),u.availability=p;var m=ve(i,"visibility",ut.kml);u.show=s(m,!0);var f=he(i,"author",ut.atom),v=c.author;v.name=fe(f,"name",ut.atom),v.uri=fe(f,"uri",ut.atom),v.email=fe(f,"email",ut.atom);var g=he(i,"link",ut.atom),_=c.link;return _.href=ce(g,"href"),_.hreflang=ce(g,"hreflang"),_.rel=ce(g,"rel"),_.type=ce(g,"type"),_.title=ce(g,"title"),_.length=ce(g,"length"),c.address=fe(i,"address",ut.kml),c.phoneNumber=fe(i,"phoneNumber",ut.kml),c.snippet=fe(i,"Snippet",ut.kml),Ge(i,u),We(i,u,h,a),{entity:u,styleEntity:h}}function qe(e,t,i,r,n,o,a){for(var s=Object.keys(pt),l=s.length,u=0;l>u;u++)for(var c=s[u],h=pt[c],d=i.childNodes,p=d.length,m=0;p>m;m++){var f=d[m];f.localName===c&&-1!==ut.kml.indexOf(f.namespaceURI)&&h(e,t,f,r,n,o,a)}}function je(e,t,i,r,n,o,a){var s=He(e,t,i,r,n,o,a);qe(e,s.entity,i,r,n,o,a)}function Ye(e,t,i,r,n,o,a){for(var s=He(e,t,i,r,n,o,a),u=s.entity,c=s.styleEntity,h=!1,d=i.childNodes,p=0,m=d.length;m>p&&!h;p++){var f=d.item(p),v=dt[f.localName];l(v)&&(v(e,f,u,c),h=!0)}h||(u.merge(c),Oe(e,u,c))}function Xe(e,t,i,r,n,o,a){var s,u=He(e,t,i,r,n,o,a),c=u.entity,h=!1,d=le(he(i,"LatLonQuad",ut.gx));if(l(d))s=we(),s.hierarchy=new T(d),c.polygon=s,h=!0;else{s=new Y,c.rectangle=s;var p=he(i,"LatLonBox",ut.kml);if(l(p)){var m=me(p,"west",ut.kml),f=me(p,"south",ut.kml),v=me(p,"east",ut.kml),g=me(p,"north",ut.kml);l(m)&&(m=E.negativePiToPi(E.toRadians(m))),l(f)&&(f=E.negativePiToPi(E.toRadians(f))),l(v)&&(v=E.negativePiToPi(E.toRadians(v))),l(g)&&(g=E.negativePiToPi(E.toRadians(g))),s.coordinates=new x(m,f,v,g);var _=me(p,"rotation",ut.kml);l(_)&&(s.rotation=E.toRadians(_))}}var y=he(i,"Icon",ut.kml),C=fe(y,"href",ut.kml);l(C)?(h&&console.log("KML - gx:LatLonQuad Icon does not support texture projection."),s.material=ge(C,e._proxy,o,a)):s.material=ye(i,"color",ut.kml);var S=fe(i,"altitudeMode",ut.kml);l(S)?"absolute"===S?s.height=me(i,"altitude",ut.kml):"clampToGround"!==S&&console.log("KML - Unknown altitudeMode: "+S):(S=fe(i,"altitudeMode",ut.gx),"relativeToSeaFloor"===S?(console.log("KML - altitudeMode relativeToSeaFloor is currently not supported, treating as absolute."),s.height=me(i,"altitude",ut.kml)):"clampToSeaFloor"===S?console.log("KML - altitudeMode clampToSeaFloor is currently not supported, treating as clampToGround."):l(S)&&console.log("KML - Unknown altitudeMode: "+S))}function Ze(e,t,i,r,n,o,a){console.log("KML - Unsupported feature: "+i.localName)}function Ke(e,t,i,r,n,o,a){var s=He(e,t,i,r,n,o,a),u=s.entity,c=he(i,"Link",ut.kml);if(l(c)){var h=fe(c,"href",ut.kml);if(l(h)){h=ge(h,void 0,o,a);var d=new et(e._proxy),p=O(d.load(h),function(){for(var t=d.entities.values,i=0;i<t.length;i++)e._entityCollection.suspendEvents(),t[i].parent=u,e._entityCollection.add(t[i]),e._entityCollection.resumeEvents()});e._promises.push(p)}}}function Qe(e,t,i,r,n,o,a){var s=pt[t.localName];l(s)?s(e,i,t,r,n,o,a):console.log("KML - Unsupported feature node: "+t.localName)}function Je(e,t,i,o){var a=e._entityCollection;e._promises=[],a.removeAll();var s=t.documentElement,u="Document"===s.localName?s:he(s,"Document",ut.kml),c=fe(u,"name",ut.kml);!l(c)&&l(i)&&(c=v(i));var h=new U(e);return O.all(Ie(e,t,h,i,!1,o),function(){var s=t.documentElement;if("kml"===s.localName)for(var u=s.childNodes,d=0;d<u.length;d++){var p=u[d];if(l(pt[p.localName])){s=p;break}}return Qe(e,s,void 0,a,h,i,o),O.all(e._promises,function(){var t,i=a.computeAvailability(),o=i.start,s=i.stop,l=_.equals(o,g.MINIMUM_VALUE),u=_.equals(s,g.MAXIMUM_VALUE);if(!l||!u){var h;l&&(h=new Date,h.setHours(0,0,0,0),o=_.fromDate(h)),u&&(h=new Date,h.setHours(24,0,0,0),s=_.fromDate(h)),t=new k,t.startTime=o,t.stopTime=s,t.currentTime=_.clone(o),t.clockRange=r.LOOP_STOP,t.clockStep=n.SYSTEM_CLOCK_MULTIPLIER,t.multiplier=Math.round(Math.min(Math.max(_.secondsDifference(s,o)/60,1),31556900))}var d=!1;return e._name!==c&&(e._name=c,d=!0),t!==e._clock&&(d=!0,e._clock=t),d&&e._changed.raiseEvent(e),V.setLoading(e,!1),e})})}function $e(e,t,i){var r=O.defer();return N.createReader(new N.BlobReader(t),function(t){t.getEntries(function(n){for(var o=[],a=!1,s={},u=0;u<n.length;u++){var c=n[u];if(!c.directory){var h=O.defer();o.push(h.promise),!a&&/\.kml$/i.test(c.filename)?(a=!0,te(t,c,s,h)):ie(t,c,s,h)}}O.all(o).then(function(){return t.close(),l(s.kml)?(s.keys=Object.keys(s),Je(e,s.kml,i,s)):void r.reject(new b("KMZ file does not contain a KML document."))}).then(r.resolve).otherwise(r.reject)})},function(e){r.reject(e)}),r.promise}function et(e){this._changed=new p,this._error=new p,this._loading=new p,this._clock=void 0,this._entityCollection=new U(this),this._name=void 0,this._isLoading=!1,this._proxy=e,this._pinBuilder=new w,this._promises=[]}function tt(){this.author={name:void 0,uri:void 0,email:void 0},this.link={href:void 0,hreflang:void 0,rel:void 0,type:void 0,title:void 0,length:void 0},this.address=void 0,this.phoneNumber=void 0,this.snippet=void 0,this.extendedData=void 0}if("undefined"==typeof DOMParser)return{};var it={avi:"video/x-msvideo",bmp:"image/bmp",bz2:"application/x-bzip2",chm:"application/vnd.ms-htmlhelp",css:"text/css",csv:"text/csv",doc:"application/msword",dvi:"application/x-dvi",eps:"application/postscript",flv:"video/x-flv",gif:"image/gif",gz:"application/x-gzip",htm:"text/html",html:"text/html",ico:"image/vnd.microsoft.icon",jnlp:"application/x-java-jnlp-file",jpeg:"image/jpeg",jpg:"image/jpeg",m3u:"audio/x-mpegurl",m4v:"video/mp4",mathml:"application/mathml+xml",mid:"audio/midi",midi:"audio/midi",mov:"video/quicktime",mp3:"audio/mpeg",mp4:"video/mp4",mp4v:"video/mp4",mpeg:"video/mpeg",mpg:"video/mpeg",odp:"application/vnd.oasis.opendocument.presentation",ods:"application/vnd.oasis.opendocument.spreadsheet",odt:"application/vnd.oasis.opendocument.text",ogg:"application/ogg",pdf:"application/pdf",png:"image/png",pps:"application/vnd.ms-powerpoint",ppt:"application/vnd.ms-powerpoint",ps:"application/postscript",qt:"video/quicktime",rdf:"application/rdf+xml",rss:"application/rss+xml",rtf:"application/rtf",svg:"image/svg+xml",swf:"application/x-shockwave-flash",text:"text/plain",tif:"image/tiff",tiff:"image/tiff",txt:"text/plain",wav:"audio/x-wav",wma:"audio/x-ms-wma",wmv:"video/x-ms-wmv",xml:"application/xml",zip:"application/zip",detectFromFilename:function(e){var t=e.toLowerCase();return t=f(t),it[t]}},rt=new DOMParser,nt=new D({stripPrefix:!1,twitter:!1,email:!1,replaceFn:function(e,t){return t.protocolUrlMatch?void 0:!1}}),ot=32,at=[null,void 0,"http://www.opengis.net/kml/2.2","http://earth.google.com/kml/2.2","http://earth.google.com/kml/2.1","http://earth.google.com/kml/2.0"],st=["http://www.google.com/kml/ext/2.2"],lt=["http://www.w3.org/2005/Atom"],ut={kml:at,gx:st,atom:lt,kmlgx:at.concat(st)},ct={},ht=document.createElement("div"),dt={Point:Le,LineString:Fe,LinearRing:Fe,Polygon:Be,Track:Ve,MultiTrack:ze,MultiGeometry:Ue},pt={Document:qe,Folder:je,Placemark:Ye,NetworkLink:Ke,GroundOverlay:Xe,PhotoOverlay:Ze,ScreenOverlay:Ze};return et.load=function(e,t){t=s(t,s.EMPTY_OBJECT);var i=new et(t.proxy);return i.load(e,t)},c(et.prototype,{name:{get:function(){return this._name}},clock:{get:function(){return this._clock}},entities:{get:function(){return this._entityCollection}},isLoading:{get:function(){return this._isLoading}},changedEvent:{get:function(){return this._changed}},errorEvent:{get:function(){return this._error}},loadingEvent:{get:function(){return this._loading}}}),et.prototype.load=function(e,t){V.setLoading(this,!0),t=s(t,s.EMPTY_OBJECT);var i=t.sourceUri,r=e;"string"==typeof e&&(r=y(ne(e,this._proxy)),i=s(i,e));var n=this;return O(r,function(e){return e instanceof Blob?$(e).then(function(t){return t?$e(n,e,i):O(ee(e)).then(function(e){var t,r;try{t=rt.parseFromString(e,"application/xml")}catch(o){r=o.toString()}if(l(r)||t.body||"parsererror"===t.documentElement.tagName){var a=l(r)?r:t.documentElement.firstChild.nodeValue;throw a||(a=t.body.innerText),new b(a)}return Je(n,t,i,void 0)})}):O(Je(n,e,i,void 0))}).otherwise(function(e){return V.setLoading(n,!1),n._error.raiseEvent(n,e),console.log(e),O.reject(e)})},et}),i("DataSources/PolylineArrowMaterialProperty",["../Core/Color","../Core/defined","../Core/defineProperties","../Core/DeveloperError","../Core/Event","./ConstantProperty","./createPropertyDescriptor","./Property"],function(e,t,i,r,n,o,a,s){"use strict";function l(e){this._definitionChanged=new n,this._color=void 0,this._colorSubscription=void 0,this.color=e}return i(l.prototype,{isConstant:{get:function(){return s.isConstant(this._color)}},definitionChanged:{get:function(){return this._definitionChanged}},color:a("color")}),l.prototype.getType=function(e){return"PolylineArrow"},l.prototype.getValue=function(i,r){return t(r)||(r={}),r.color=s.getValueOrClonedDefault(this._color,i,e.WHITE,r.color),r},l.prototype.equals=function(e){return this===e||e instanceof l&&s.equals(this._color,e._color)},l}),i("DataSources/PropertyArray",["../Core/defined","../Core/defineProperties","../Core/DeveloperError","../Core/Event","../Core/EventHelper","./Property"],function(e,t,i,r,n,o){"use strict";function a(e){this._value=void 0,this._definitionChanged=new r,this._eventHelper=new n,this.setValue(e)}return t(a.prototype,{isConstant:{get:function(){var t=this._value;if(!e(t))return!0;for(var i=t.length,r=0;i>r;r++)if(!o.isConstant(t[r]))return!1;return!0}},definitionChanged:{get:function(){return this._definitionChanged}}}),a.prototype.getValue=function(t,i){var r=this._value;if(e(r)){var n=r.length;e(i)||(i=new Array(n));for(var o=0,a=0;n>o;){var s=this._value[o],l=s.getValue(t,i[o]);e(l)&&(i[a]=l,a++),o++}return i.length=a,i}},a.prototype.setValue=function(t){var i=this._eventHelper;if(i.removeAll(),e(t)){this._value=t.slice();for(var r=t.length,n=0;r>n;n++){var o=t[n];e(o)&&i.add(o.definitionChanged,a.prototype._raiseDefinitionChanged,this)}}else this._value=void 0;this._definitionChanged.raiseEvent(this)},a.prototype.equals=function(e){return this===e||e instanceof a&&o.arrayEquals(this._value,e._value)},a.prototype._raiseDefinitionChanged=function(){this._definitionChanged.raiseEvent(this)},a}),i("DataSources/VelocityOrientationProperty",["../Core/Cartesian3","../Core/defaultValue","../Core/defined","../Core/defineProperties","../Core/DeveloperError","../Core/Ellipsoid","../Core/Event","../Core/JulianDate","../Core/Matrix3","../Core/Quaternion","../Core/Transforms","./Property"],function(e,t,i,r,n,o,a,s,l,u,c,h){"use strict";function d(e,i){this._position=void 0,this._subscription=void 0,this._ellipsoid=void 0,this._definitionChanged=new a,this.position=e,this.ellipsoid=t(i,o.WGS84)}r(d.prototype,{isConstant:{get:function(){return h.isConstant(this._position)}},definitionChanged:{get:function(){return this._definitionChanged}},position:{get:function(){return this._position},set:function(e){var t=this._position;t!==e&&(i(t)&&this._subscription(),this._position=e,i(e)&&(this._subscription=e._definitionChanged.addEventListener(function(){this._definitionChanged.raiseEvent(this)},this)),this._definitionChanged.raiseEvent(this))}},ellipsoid:{get:function(){return this._ellipsoid},set:function(e){var t=this._ellipsoid;t!==e&&(this._ellipsoid=e,this._definitionChanged.raiseEvent(this))}}});var p=new e,m=new e,f=new e,v=new s,g=new l,_=1/60;return d.prototype.getValue=function(t,r){var n=this._position;if(!h.isConstant(n)){var o=n.getValue(t,p),a=n.getValue(s.addSeconds(t,_,v),m);if(i(o)&&(i(a)||(a=o,o=n.getValue(s.addSeconds(t,-_,v),m),i(o)))&&!e.equals(o,a)){var l=e.subtract(a,o,f);return e.normalize(l,l),c.rotationMatrixFromPositionVelocity(o,l,this._ellipsoid,g),u.fromRotationMatrix(g,r)}}},d.prototype.equals=function(e){return this===e||e instanceof d&&h.equals(this._position,e._position)&&(this._ellipsoid===e._ellipsoid||this._ellipsoid.equals(e._ellipsoid))},d}),i("DataSources/Visualizer",["../Core/DeveloperError"],function(e){"use strict";function t(){e.throwInstantiationError()}return t.prototype.update=e.throwInstantiationError,t.prototype.getBoundingSphere=e.throwInstantiationError,t.prototype.isDestroyed=e.throwInstantiationError,t.prototype.destroy=e.throwInstantiationError,t}),i("Renderer/ClearCommand",["../Core/Color","../Core/defaultValue","../Core/freezeObject"],function(e,t,i){"use strict";function r(e){e=t(e,t.EMPTY_OBJECT),this.color=e.color,this.depth=e.depth,this.stencil=e.stencil,this.renderState=e.renderState,this.framebuffer=e.framebuffer,this.owner=e.owner}return r.ALL=i(new r({color:new e(0,0,0,0),depth:1,stencil:0})),r.prototype.execute=function(e,t){e.clear(this,t)},r}),i("Renderer/ComputeCommand",["../Core/defaultValue","../Core/PrimitiveType","../Scene/Pass"],function(e,t,i){"use strict";function r(t){t=e(t,e.EMPTY_OBJECT),this.vertexArray=t.vertexArray,this.fragmentShaderSource=t.fragmentShaderSource,this.shaderProgram=t.shaderProgram,this.uniformMap=t.uniformMap,this.outputTexture=t.outputTexture,this.preExecute=t.preExecute,this.postExecute=t.postExecute,this.persists=e(t.persists,!1),this.pass=i.COMPUTE,this.owner=t.owner}return r.prototype.execute=function(e){e.execute(this)},r}),i("Shaders/ViewportQuadVS",[],function(){"use strict";return"attribute vec4 position;\nattribute vec2 textureCoordinates;\nvarying vec2 v_textureCoordinates;\nvoid main()\n{\ngl_Position = position;\nv_textureCoordinates = textureCoordinates;\n}\n"}),i("Renderer/ComputeEngine",["../Core/BoundingRectangle","../Core/Color","../Core/ComponentDatatype","../Core/defaultValue","../Core/defined","../Core/defineProperties","../Core/destroyObject","../Core/DeveloperError","../Core/Geometry","../Core/GeometryAttribute","../Core/PrimitiveType","../Shaders/ViewportQuadVS","./BufferUsage","./ClearCommand","./DrawCommand","./Framebuffer","./RenderState","./ShaderProgram"],function(e,t,i,r,n,o,a,s,l,u,c,h,d,p,m,f,v,g){"use strict";function _(e){this._context=e}function y(e,t){return new f({context:e,colorTextures:[t],destroyAttachments:!1})}function C(e,t){return g.fromCache({context:e,vertexShaderSource:h,fragmentShaderSource:t,attributeLocations:{position:0,textureCoordinates:1}})}function E(t,i){return n(S)&&S.viewport.width===t&&S.viewport.height===i||(S=v.fromCache({viewport:new e(0,0,t,i)})),S}var S,w=new m({primitiveType:c.TRIANGLES}),T=new p({color:new t(0,0,0,0)});return _.prototype.execute=function(e){n(e.preExecute)&&e.preExecute(e);var t=e.outputTexture,i=t.width,r=t.height,o=this._context,a=n(e.vertexArray)?e.vertexArray:o.getViewportQuadVertexArray(),s=n(e.shaderProgram)?e.shaderProgram:C(o,e.fragmentShaderSource),l=y(o,t),u=E(i,r),c=e.uniformMap,h=T;h.framebuffer=l,h.renderState=u,h.execute(o);var d=w;d.vertexArray=a,d.renderState=u,d.shaderProgram=s,d.uniformMap=c,d.framebuffer=l,d.execute(o),l.destroy(),e.persists||(s.destroy(),n(e.vertexArray)&&a.destroy()),n(e.postExecute)&&e.postExecute(t)},_.prototype.isDestroyed=function(){return!1},_.prototype.destroy=function(){return a(this)},_}),i("Renderer/PassState",["../Core/BoundingRectangle"],function(e){"use strict";function t(e){this.context=e,this.framebuffer=void 0,this.blendingEnabled=void 0,this.scissorTest=void 0,this.viewport=void 0}return t}),i("Renderer/RenderbufferFormat",["../Core/freezeObject","./WebGLConstants"],function(e,t){"use strict";var i={RGBA4:t.RGBA4,RGB5_A1:t.RGB5_A1,RGB565:t.RGB565,DEPTH_COMPONENT16:t.DEPTH_COMPONENT16,STENCIL_INDEX8:t.STENCIL_INDEX8,DEPTH_STENCIL:t.DEPTH_STENCIL,validate:function(e){return e===i.RGBA4||e===i.RGB5_A1||e===i.RGB565||e===i.DEPTH_COMPONENT16||e===i.STENCIL_INDEX8||e===i.DEPTH_STENCIL}};return e(i)}),i("Renderer/Renderbuffer",["../Core/defaultValue","../Core/defined","../Core/defineProperties","../Core/destroyObject","../Core/DeveloperError","./ContextLimits","./RenderbufferFormat"],function(e,t,i,r,n,o,a){"use strict";function s(i){i=e(i,e.EMPTY_OBJECT);var r=i.context,n=r._gl,s=(o.maximumRenderbufferSize,e(i.format,a.RGBA4)),l=t(i.width)?i.width:n.drawingBufferWidth,u=t(i.height)?i.height:n.drawingBufferHeight;this._gl=n,this._format=s,this._width=l,this._height=u,this._renderbuffer=this._gl.createRenderbuffer(),n.bindRenderbuffer(n.RENDERBUFFER,this._renderbuffer),n.renderbufferStorage(n.RENDERBUFFER,s,l,u),n.bindRenderbuffer(n.RENDERBUFFER,null)}return i(s.prototype,{format:{get:function(){return this._format}},width:{get:function(){return this._width}},height:{get:function(){return this._height}}}),s.prototype._getRenderbuffer=function(){return this._renderbuffer},s.prototype.isDestroyed=function(){return!1},s.prototype.destroy=function(){return this._gl.deleteRenderbuffer(this._renderbuffer),r(this)},s}),i("Renderer/PickFramebuffer",["../Core/BoundingRectangle","../Core/Color","../Core/defaultValue","../Core/defined","../Core/destroyObject","./Framebuffer","./PassState","./Renderbuffer","./RenderbufferFormat","./Texture"],function(e,t,i,r,n,o,a,s,l,u){"use strict";function c(t){var i=new a(t);i.blendingEnabled=!1,i.scissorTest={enabled:!0,rectangle:new e},i.viewport=new e,this._context=t,this._fb=void 0,this._passState=i,this._width=0,this._height=0}c.prototype.begin=function(t){var i=this._context,n=i.drawingBufferWidth,a=i.drawingBufferHeight;return e.clone(t,this._passState.scissorTest.rectangle),r(this._fb)&&this._width===n&&this._height===a||(this._width=n,this._height=a,this._fb=this._fb&&this._fb.destroy(),this._fb=new o({context:i,colorTextures:[new u({context:i,width:n,height:a})],depthStencilRenderbuffer:new s({context:i,format:l.DEPTH_STENCIL})}),this._passState.framebuffer=this._fb),this._passState.viewport.width=n,this._passState.viewport.height=a,this._passState};var h=new t;return c.prototype.end=function(e){for(var n=i(e.width,1),o=i(e.height,1),a=this._context,s=a.readPixels({x:e.x,y:e.y,width:n,height:o,framebuffer:this._fb}),l=Math.max(n,o),u=l*l,c=Math.floor(.5*n),d=Math.floor(.5*o),p=0,m=0,f=0,v=-1,g=0;u>g;++g){if(p>=-c&&c>=p&&m>=-d&&d>=m){var _=4*((d-m)*n+p+c);h.red=t.byteToFloat(s[_]),h.green=t.byteToFloat(s[_+1]),h.blue=t.byteToFloat(s[_+2]),h.alpha=t.byteToFloat(s[_+3]);var y=a.getObjectByPickColor(h);if(r(y))return y}if(p===m||0>p&&-p===m||p>0&&p===1-m){var C=f;f=-v,v=C}p+=f,m+=v}},c.prototype.isDestroyed=function(){return!1},c.prototype.destroy=function(){return this._fb=this._fb&&this._fb.destroy(),n(this)},c}),i("Renderer/ShaderCache",["../Core/defined","../Core/defineProperties","../Core/destroyObject","./ShaderProgram","./ShaderSource"],function(e,t,i,r,n){"use strict";function o(e){this._context=e,this._shaders={},this._numberOfShaders=0,this._shadersToRelease={}}return t(o.prototype,{numberOfShaders:{get:function(){return this._numberOfShaders}}}),o.prototype.replaceShaderProgram=function(t){return e(t.shaderProgram)&&t.shaderProgram.destroy(),this.getShaderProgram(t)},o.prototype.getShaderProgram=function(e){var t=e.vertexShaderSource,i=e.fragmentShaderSource,o=e.attributeLocations;"string"==typeof t&&(t=new n({sources:[t]})),"string"==typeof i&&(i=new n({sources:[i]}));var a,s=t.createCombinedVertexShader(),l=i.createCombinedFragmentShader(),u=s+l+JSON.stringify(o); +if(this._shaders[u])a=this._shaders[u],delete this._shadersToRelease[u];else{var c=this._context,h=new r({gl:c._gl,logShaderCompilation:c.logShaderCompilation,debugShaders:c.debugShaders,vertexShaderSource:t,vertexShaderText:s,fragmentShaderSource:i,fragmentShaderText:l,attributeLocations:o});a={cache:this,shaderProgram:h,keyword:u,count:0},h._cachedShader=a,this._shaders[u]=a,++this._numberOfShaders}return++a.count,a.shaderProgram},o.prototype.destroyReleasedShaderPrograms=function(){var e=this._shadersToRelease;for(var t in e)if(e.hasOwnProperty(t)){var i=e[t];delete this._shaders[i.keyword],i.shaderProgram.finalDestroy(),--this._numberOfShaders}this._shadersToRelease={}},o.prototype.releaseShaderProgram=function(t){if(e(t)){var i=t._cachedShader;i&&0===--i.count&&(this._shadersToRelease[i.keyword]=i)}},o.prototype.isDestroyed=function(){return!1},o.prototype.destroy=function(){var e=this._shaders;for(var t in e)e.hasOwnProperty(t)&&e[t].shaderProgram.finalDestroy();return i(this)},o}),i("Renderer/UniformState",["../Core/BoundingRectangle","../Core/Cartesian2","../Core/Cartesian3","../Core/Cartesian4","../Core/Cartographic","../Core/defined","../Core/defineProperties","../Core/EncodedCartesian3","../Core/Math","../Core/Matrix3","../Core/Matrix4","../Core/Simon1994PlanetaryPositions","../Core/Transforms","../Scene/SceneMode"],function(e,t,i,r,n,o,a,s,l,u,c,h,d,p){"use strict";function m(){this.globeDepthTexture=void 0,this._viewport=new e,this._viewportCartesian4=new r,this._viewportDirty=!1,this._viewportOrthographicMatrix=c.clone(c.IDENTITY),this._viewportTransformation=c.clone(c.IDENTITY),this._model=c.clone(c.IDENTITY),this._view=c.clone(c.IDENTITY),this._inverseView=c.clone(c.IDENTITY),this._projection=c.clone(c.IDENTITY),this._infiniteProjection=c.clone(c.IDENTITY),this._entireFrustum=new t,this._currentFrustum=new t,this._frustumPlanes=new r,this._frameState=void 0,this._temeToPseudoFixed=u.clone(c.IDENTITY),this._view3DDirty=!0,this._view3D=new c,this._inverseView3DDirty=!0,this._inverseView3D=new c,this._inverseModelDirty=!0,this._inverseModel=new c,this._inverseTransposeModelDirty=!0,this._inverseTransposeModel=new u,this._viewRotation=new u,this._inverseViewRotation=new u,this._viewRotation3D=new u,this._inverseViewRotation3D=new u,this._inverseProjectionDirty=!0,this._inverseProjection=new c,this._inverseProjectionOITDirty=!0,this._inverseProjectionOIT=new c,this._modelViewDirty=!0,this._modelView=new c,this._modelView3DDirty=!0,this._modelView3D=new c,this._modelViewRelativeToEyeDirty=!0,this._modelViewRelativeToEye=new c,this._inverseModelViewDirty=!0,this._inverseModelView=new c,this._inverseModelView3DDirty=!0,this._inverseModelView3D=new c,this._viewProjectionDirty=!0,this._viewProjection=new c,this._inverseViewProjectionDirty=!0,this._inverseViewProjection=new c,this._modelViewProjectionDirty=!0,this._modelViewProjection=new c,this._inverseModelViewProjectionDirty=!0,this._inverseModelViewProjection=new c,this._modelViewProjectionRelativeToEyeDirty=!0,this._modelViewProjectionRelativeToEye=new c,this._modelViewInfiniteProjectionDirty=!0,this._modelViewInfiniteProjection=new c,this._normalDirty=!0,this._normal=new u,this._normal3DDirty=!0,this._normal3D=new u,this._inverseNormalDirty=!0,this._inverseNormal=new u,this._inverseNormal3DDirty=!0,this._inverseNormal3D=new u,this._encodedCameraPositionMCDirty=!0,this._encodedCameraPositionMC=new s,this._cameraPosition=new i,this._sunPositionWC=new i,this._sunPositionColumbusView=new i,this._sunDirectionWC=new i,this._sunDirectionEC=new i,this._moonDirectionEC=new i,this._mode=void 0,this._mapProjection=void 0,this._cameraDirection=new i,this._cameraRight=new i,this._cameraUp=new i,this._frustum2DWidth=0,this._eyeHeight2D=new t,this._resolutionScale=1,this._fogDensity=void 0}function f(e,t){c.clone(t,e._view),c.getRotation(t,e._viewRotation),e._view3DDirty=!0,e._inverseView3DDirty=!0,e._modelViewDirty=!0,e._modelView3DDirty=!0,e._modelViewRelativeToEyeDirty=!0,e._inverseModelViewDirty=!0,e._inverseModelView3DDirty=!0,e._viewProjectionDirty=!0,e._modelViewProjectionDirty=!0,e._modelViewProjectionRelativeToEyeDirty=!0,e._modelViewInfiniteProjectionDirty=!0,e._normalDirty=!0,e._inverseNormalDirty=!0,e._normal3DDirty=!0,e._inverseNormal3DDirty=!0}function v(e,t){c.clone(t,e._inverseView),c.getRotation(t,e._inverseViewRotation)}function g(e,t){c.clone(t,e._projection),e._inverseProjectionDirty=!0,e._inverseProjectionOITDirty=!0,e._viewProjectionDirty=!0,e._modelViewProjectionDirty=!0,e._modelViewProjectionRelativeToEyeDirty=!0}function _(e,t){c.clone(t,e._infiniteProjection),e._modelViewInfiniteProjectionDirty=!0}function y(e,t){i.clone(t.positionWC,e._cameraPosition),i.clone(t.directionWC,e._cameraDirection),i.clone(t.rightWC,e._cameraRight),i.clone(t.upWC,e._cameraUp),e._encodedCameraPositionMCDirty=!0}function C(e,t){o(d.computeIcrfToFixedMatrix(t.time,W))||(W=d.computeTemeToPseudoFixedMatrix(t.time,W));var r=h.computeSunPositionInEarthInertialFrame(t.time,e._sunPositionWC);u.multiplyByVector(W,r,r),i.normalize(r,e._sunDirectionWC),r=u.multiplyByVector(e.viewRotation3D,r,e._sunDirectionEC),i.normalize(r,r),r=h.computeMoonPositionInEarthInertialFrame(t.time,e._moonDirectionEC),u.multiplyByVector(W,r,r),u.multiplyByVector(e.viewRotation3D,r,r),i.normalize(r,r);var n=t.mapProjection,a=n.ellipsoid,s=a.cartesianToCartographic(e._sunPositionWC,H);n.project(s,e._sunPositionColumbusView)}function E(e){if(e._viewportDirty){var t=e._viewport;c.computeOrthographicOffCenter(t.x,t.x+t.width,t.y,t.y+t.height,0,1,e._viewportOrthographicMatrix),c.computeViewportTransformation(t,0,1,e._viewportTransformation),e._viewportDirty=!1}}function S(e){e._inverseProjectionDirty&&(e._inverseProjectionDirty=!1,c.inverse(e._projection,e._inverseProjection))}function w(e){e._inverseProjectionOITDirty&&(e._inverseProjectionOITDirty=!1,e._mode!==p.SCENE2D&&e._mode!==p.MORPHING?c.inverse(e._projection,e._inverseProjectionOIT):c.clone(c.IDENTITY,e._inverseProjectionOIT))}function T(e){e._modelViewDirty&&(e._modelViewDirty=!1,c.multiplyTransformation(e._view,e._model,e._modelView))}function x(e){e._modelView3DDirty&&(e._modelView3DDirty=!1,c.multiplyTransformation(e.view3D,e._model,e._modelView3D))}function b(e){e._inverseModelViewDirty&&(e._inverseModelViewDirty=!1,c.inverse(e.modelView,e._inverseModelView))}function A(e){e._inverseModelView3DDirty&&(e._inverseModelView3DDirty=!1,c.inverse(e.modelView3D,e._inverseModelView3D))}function P(e){e._viewProjectionDirty&&(e._viewProjectionDirty=!1,c.multiply(e._projection,e._view,e._viewProjection))}function I(e){e._inverseViewProjectionDirty&&(e._inverseViewProjectionDirty=!1,c.inverse(e.viewProjection,e._inverseViewProjection))}function M(e){e._modelViewProjectionDirty&&(e._modelViewProjectionDirty=!1,c.multiply(e._projection,e.modelView,e._modelViewProjection))}function D(e){if(e._modelViewRelativeToEyeDirty){e._modelViewRelativeToEyeDirty=!1;var t=e.modelView,i=e._modelViewRelativeToEye;i[0]=t[0],i[1]=t[1],i[2]=t[2],i[3]=t[3],i[4]=t[4],i[5]=t[5],i[6]=t[6],i[7]=t[7],i[8]=t[8],i[9]=t[9],i[10]=t[10],i[11]=t[11],i[12]=0,i[13]=0,i[14]=0,i[15]=t[15]}}function R(e){e._inverseModelViewProjectionDirty&&(e._inverseModelViewProjectionDirty=!1,c.inverse(e.modelViewProjection,e._inverseModelViewProjection))}function O(e){e._modelViewProjectionRelativeToEyeDirty&&(e._modelViewProjectionRelativeToEyeDirty=!1,c.multiply(e._projection,e.modelViewRelativeToEye,e._modelViewProjectionRelativeToEye))}function N(e){e._modelViewInfiniteProjectionDirty&&(e._modelViewInfiniteProjectionDirty=!1,c.multiply(e._infiniteProjection,e.modelView,e._modelViewInfiniteProjection))}function L(e){if(e._normalDirty){e._normalDirty=!1;var t=e._normal;c.getRotation(e.inverseModelView,t),u.transpose(t,t)}}function F(e){if(e._normal3DDirty){e._normal3DDirty=!1;var t=e._normal3D;c.getRotation(e.inverseModelView3D,t),u.transpose(t,t)}}function B(e){e._inverseNormalDirty&&(e._inverseNormalDirty=!1,c.getRotation(e.inverseModelView,e._inverseNormal))}function V(e){e._inverseNormal3DDirty&&(e._inverseNormal3DDirty=!1,c.getRotation(e.inverseModelView3D,e._inverseNormal3D))}function k(e){e._encodedCameraPositionMCDirty&&(e._encodedCameraPositionMCDirty=!1,c.multiplyByPoint(e.inverseModel,e._cameraPosition,q),s.fromCartesian(q,e._encodedCameraPositionMC))}function z(e,t,r,n,a,s,u,h){var m=j;m.x=e.y,m.y=e.z,m.z=e.x;var f=Y;f.x=r.y,f.y=r.z,f.z=r.x;var v=X;v.x=n.y,v.y=n.z,v.z=n.x;var g=Z;g.x=t.y,g.y=t.z,g.z=t.x,s===p.SCENE2D&&(m.z=.5*a);var _=u.unproject(m,K);_.longitude=l.clamp(_.longitude,-Math.PI,Math.PI),_.latitude=l.clamp(_.latitude,-l.PI_OVER_TWO,l.PI_OVER_TWO);var y=u.ellipsoid,C=y.cartographicToCartesian(_,Q),E=d.eastNorthUpToFixedFrame(C,y,J);return c.multiplyByPointAsVector(E,f,f),c.multiplyByPointAsVector(E,v,v),c.multiplyByPointAsVector(E,g,g),o(h)||(h=new c),h[0]=f.x,h[1]=v.x,h[2]=-g.x,h[3]=0,h[4]=f.y,h[5]=v.y,h[6]=-g.y,h[7]=0,h[8]=f.z,h[9]=v.z,h[10]=-g.z,h[11]=0,h[12]=-i.dot(f,C),h[13]=-i.dot(v,C),h[14]=i.dot(g,C),h[15]=1,h}function U(e){e._view3DDirty&&(e._mode===p.SCENE3D?c.clone(e._view,e._view3D):z(e._cameraPosition,e._cameraDirection,e._cameraRight,e._cameraUp,e._frustum2DWidth,e._mode,e._mapProjection,e._view3D),c.getRotation(e._view3D,e._viewRotation3D),e._view3DDirty=!1)}function G(e){e._inverseView3DDirty&&(c.inverseTransformation(e.view3D,e._inverseView3D),c.getRotation(e._inverseView3D,e._inverseViewRotation3D),e._inverseView3DDirty=!1)}a(m.prototype,{frameState:{get:function(){return this._frameState}},viewport:{get:function(){return this._viewport},set:function(t){if(!e.equals(t,this._viewport)){e.clone(t,this._viewport);var i=this._viewport,r=this._viewportCartesian4;r.x=i.x,r.y=i.y,r.z=i.width,r.w=i.height,this._viewportDirty=!0}}},viewportCartesian4:{get:function(){return this._viewportCartesian4}},viewportOrthographic:{get:function(){return E(this),this._viewportOrthographicMatrix}},viewportTransformation:{get:function(){return E(this),this._viewportTransformation}},model:{get:function(){return this._model},set:function(e){c.clone(e,this._model),this._modelView3DDirty=!0,this._inverseModelView3DDirty=!0,this._inverseModelDirty=!0,this._inverseTransposeModelDirty=!0,this._modelViewDirty=!0,this._inverseModelViewDirty=!0,this._viewProjectionDirty=!0,this._inverseViewProjectionDirty=!0,this._modelViewRelativeToEyeDirty=!0,this._inverseModelViewDirty=!0,this._modelViewProjectionDirty=!0,this._inverseModelViewProjectionDirty=!0,this._modelViewProjectionRelativeToEyeDirty=!0,this._modelViewInfiniteProjectionDirty=!0,this._normalDirty=!0,this._inverseNormalDirty=!0,this._normal3DDirty=!0,this._inverseNormal3DDirty=!0,this._encodedCameraPositionMCDirty=!0}},inverseModel:{get:function(){return this._inverseModelDirty&&(this._inverseModelDirty=!1,c.inverse(this._model,this._inverseModel)),this._inverseModel}},inverseTranposeModel:{get:function(){var e=this._inverseTransposeModel;return this._inverseTransposeModelDirty&&(this._inverseTransposeModelDirty=!1,c.getRotation(this.inverseModel,e),u.transpose(e,e)),e}},view:{get:function(){return this._view}},view3D:{get:function(){return U(this),this._view3D}},viewRotation:{get:function(){return U(this),this._viewRotation}},viewRotation3D:{get:function(){return U(this),this._viewRotation3D}},inverseView:{get:function(){return this._inverseView}},inverseView3D:{get:function(){return G(this),this._inverseView3D}},inverseViewRotation:{get:function(){return this._inverseViewRotation}},inverseViewRotation3D:{get:function(){return G(this),this._inverseViewRotation3D}},projection:{get:function(){return this._projection}},inverseProjection:{get:function(){return S(this),this._inverseProjection}},inverseProjectionOIT:{get:function(){return w(this),this._inverseProjectionOIT}},infiniteProjection:{get:function(){return this._infiniteProjection}},modelView:{get:function(){return T(this),this._modelView}},modelView3D:{get:function(){return x(this),this._modelView3D}},modelViewRelativeToEye:{get:function(){return D(this),this._modelViewRelativeToEye}},inverseModelView:{get:function(){return b(this),this._inverseModelView}},inverseModelView3D:{get:function(){return A(this),this._inverseModelView3D}},viewProjection:{get:function(){return P(this),this._viewProjection}},inverseViewProjection:{get:function(){return I(this),this._inverseViewProjection}},modelViewProjection:{get:function(){return M(this),this._modelViewProjection}},inverseModelViewProjection:{get:function(){return R(this),this._inverseModelViewProjection}},modelViewProjectionRelativeToEye:{get:function(){return O(this),this._modelViewProjectionRelativeToEye}},modelViewInfiniteProjection:{get:function(){return N(this),this._modelViewInfiniteProjection}},normal:{get:function(){return L(this),this._normal}},normal3D:{get:function(){return F(this),this._normal3D}},inverseNormal:{get:function(){return B(this),this._inverseNormal}},inverseNormal3D:{get:function(){return V(this),this._inverseNormal3D}},entireFrustum:{get:function(){return this._entireFrustum}},currentFrustum:{get:function(){return this._currentFrustum}},frustumPlanes:{get:function(){return this._frustumPlanes}},eyeHeight2D:{get:function(){return this._eyeHeight2D}},sunPositionWC:{get:function(){return this._sunPositionWC}},sunPositionColumbusView:{get:function(){return this._sunPositionColumbusView}},sunDirectionWC:{get:function(){return this._sunDirectionWC}},sunDirectionEC:{get:function(){return this._sunDirectionEC}},moonDirectionEC:{get:function(){return this._moonDirectionEC}},encodedCameraPositionMCHigh:{get:function(){return k(this),this._encodedCameraPositionMC.high}},encodedCameraPositionMCLow:{get:function(){return k(this),this._encodedCameraPositionMC.low}},temeToPseudoFixedMatrix:{get:function(){return this._temeToPseudoFixed}},resolutionScale:{get:function(){return this._resolutionScale}},fogDensity:{get:function(){return this._fogDensity}}});var W=new u,H=new n;m.prototype.updateFrustum=function(e){g(this,e.projectionMatrix),o(e.infiniteProjectionMatrix)&&_(this,e.infiniteProjectionMatrix),this._currentFrustum.x=e.near,this._currentFrustum.y=e.far,o(e.top)||(e=e._offCenterFrustum),this._frustumPlanes.x=e.top,this._frustumPlanes.y=e.bottom,this._frustumPlanes.z=e.left,this._frustumPlanes.w=e.right},m.prototype.update=function(e){this._mode=e.mode,this._mapProjection=e.mapProjection;var t=e.context._canvas;this._resolutionScale=t.width/t.clientWidth;var i=e.camera;f(this,i.viewMatrix),v(this,i.inverseViewMatrix),y(this,i),e.mode===p.SCENE2D?(this._frustum2DWidth=i.frustum.right-i.frustum.left,this._eyeHeight2D.x=.5*this._frustum2DWidth,this._eyeHeight2D.y=this._eyeHeight2D.x*this._eyeHeight2D.x):(this._frustum2DWidth=0,this._eyeHeight2D.x=0,this._eyeHeight2D.y=0),C(this,e),this._entireFrustum.x=i.frustum.near,this._entireFrustum.y=i.frustum.far,this.updateFrustum(i.frustum),this._fogDensity=e.fog.density,this._frameState=e,this._temeToPseudoFixed=d.computeTemeToPseudoFixedMatrix(e.time,this._temeToPseudoFixed)};var q=new i,j=new i,Y=new i,X=new i,Z=new i,K=new n,Q=new i,J=new c;return m}),i("Renderer/Context",["../Core/clone","../Core/Color","../Core/ComponentDatatype","../Core/createGuid","../Core/defaultValue","../Core/defined","../Core/defineProperties","../Core/destroyObject","../Core/DeveloperError","../Core/FeatureDetection","../Core/Geometry","../Core/GeometryAttribute","../Core/Math","../Core/Matrix4","../Core/PrimitiveType","../Core/RuntimeError","../Shaders/ViewportQuadVS","./BufferUsage","./ClearCommand","./ContextLimits","./CubeMap","./DrawCommand","./PassState","./PickFramebuffer","./PixelDatatype","./RenderbufferFormat","./RenderState","./ShaderCache","./ShaderProgram","./Texture","./UniformState","./VertexArray","./WebGLConstants"],function(e,t,i,r,n,o,a,s,l,u,c,h,d,p,m,f,v,g,_,y,C,E,S,w,T,x,b,A,P,I,M,D,R){"use strict";function O(e,t){var i="WebGL Error: ";switch(t){case e.INVALID_ENUM:i+="INVALID_ENUM";break;case e.INVALID_VALUE:i+="INVALID_VALUE";break;case e.INVALID_OPERATION:i+="INVALID_OPERATION";break;case e.OUT_OF_MEMORY:i+="OUT_OF_MEMORY";break;case e.CONTEXT_LOST_WEBGL:i+="CONTEXT_LOST_WEBGL lost";break;default:i+="Unknown ("+t+")"}return i}function N(e,t,i,r){for(var n=O(e,r)+": "+t.name+"(",o=0;o<i.length;++o)0!==o&&(n+=", "),n+=i[o];return n+=");"}function L(e,t,i){var r=e.getError();if(r!==e.NO_ERROR)throw new f(N(e,t,i,r))}function F(e,t,i){return{get:function(){var r=e[t];return i(e,"get: "+t,r),e[t]},set:function(r){e[t]=r,i(e,"set: "+t,r)}}}function B(e,t){function i(i){return function(){var r=i.apply(e,arguments);return t(e,i,arguments),r}}if(!t)return e;var r={};for(var n in e){var o=e[n];"function"==typeof o?r[n]=i(o):Object.defineProperty(r,n,F(e,n,t))}return r}function V(e,t){for(var i=t.length,r=0;i>r;++r){var n=e.getExtension(t[r]);if(n)return n}}function k(i,a){if("undefined"==typeof WebGLRenderingContext)throw new f("The browser does not support WebGL. Visit http://get.webgl.org.");this._canvas=i,a=e(a,!0),a=n(a,{}),a.allowTextureFilterAnisotropic=n(a.allowTextureFilterAnisotropic,!0);var s=n(a.webgl,{});s.alpha=n(s.alpha,!1);var l,u=!1,c="undefined"!=typeof WebGL2RenderingContext,h=!1;if(u&&c&&(l=i.getContext("webgl2",s)||i.getContext("experimental-webgl2",s)||void 0,o(l)&&(h=!0)),o(l)||(l=i.getContext("webgl",s)||i.getContext("experimental-webgl",s)||void 0),!o(l))throw new f("The browser supports WebGL, but initialization failed.");this._originalGLContext=l,this._webgl2=h,this._id=r(),this.validateFramebuffer=!1,this.validateShaderProgram=!1,this.logShaderCompilation=!1,this._throwOnWebGLError=!1,this._shaderCache=new A(this);var d=this._gl=this._originalGLContext;this._redBits=d.getParameter(d.RED_BITS),this._greenBits=d.getParameter(d.GREEN_BITS),this._blueBits=d.getParameter(d.BLUE_BITS),this._alphaBits=d.getParameter(d.ALPHA_BITS),this._depthBits=d.getParameter(d.DEPTH_BITS),this._stencilBits=d.getParameter(d.STENCIL_BITS),y._maximumCombinedTextureImageUnits=d.getParameter(d.MAX_COMBINED_TEXTURE_IMAGE_UNITS),y._maximumCubeMapSize=d.getParameter(d.MAX_CUBE_MAP_TEXTURE_SIZE),y._maximumFragmentUniformVectors=d.getParameter(d.MAX_FRAGMENT_UNIFORM_VECTORS),y._maximumTextureImageUnits=d.getParameter(d.MAX_TEXTURE_IMAGE_UNITS),y._maximumRenderbufferSize=d.getParameter(d.MAX_RENDERBUFFER_SIZE),y._maximumTextureSize=d.getParameter(d.MAX_TEXTURE_SIZE),y._maximumVaryingVectors=d.getParameter(d.MAX_VARYING_VECTORS),y._maximumVertexAttributes=d.getParameter(d.MAX_VERTEX_ATTRIBS),y._maximumVertexTextureImageUnits=d.getParameter(d.MAX_VERTEX_TEXTURE_IMAGE_UNITS),y._maximumVertexUniformVectors=d.getParameter(d.MAX_VERTEX_UNIFORM_VECTORS);var p=d.getParameter(d.ALIASED_LINE_WIDTH_RANGE);y._minimumAliasedLineWidth=p[0],y._maximumAliasedLineWidth=p[1];var m=d.getParameter(d.ALIASED_POINT_SIZE_RANGE);y._minimumAliasedPointSize=m[0],y._maximumAliasedPointSize=m[1];var v=d.getParameter(d.MAX_VIEWPORT_DIMS);y._maximumViewportWidth=v[0],y._maximumViewportHeight=v[1];var g=d.getShaderPrecisionFormat(d.FRAGMENT_SHADER,d.HIGH_FLOAT);y._highpFloatSupported=0!==g.precision;var _=d.getShaderPrecisionFormat(d.FRAGMENT_SHADER,d.HIGH_INT);y._highpIntSupported=0!==_.rangeMax,this._antialias=d.getContextAttributes().antialias,this._standardDerivatives=!!V(d,["OES_standard_derivatives"]),this._elementIndexUint=!!V(d,["OES_element_index_uint"]),this._depthTexture=!!V(d,["WEBGL_depth_texture","WEBKIT_WEBGL_depth_texture"]),this._textureFloat=!!V(d,["OES_texture_float"]),this._fragDepth=!!V(d,["EXT_frag_depth"]),this._debugShaders=V(d,["WEBGL_debug_shaders"]);var C=a.allowTextureFilterAnisotropic?V(d,["EXT_texture_filter_anisotropic","WEBKIT_EXT_texture_filter_anisotropic"]):void 0;this._textureFilterAnisotropic=C,y._maximumTextureFilterAnisotropy=o(C)?d.getParameter(C.MAX_TEXTURE_MAX_ANISOTROPY_EXT):1;var E,w,T,x,P,I,D,O,N,L;if(h){var F=this;E=function(){return F._gl.createVertexArray()},w=function(e){F._gl.bindVertexArray(e)},T=function(e){F._gl.deleteVertexArray(e)},x=function(e,t,i,r,n){d.drawElementsInstanced(e,t,i,r,n)},P=function(e,t,i,r){d.drawArraysInstanced(e,t,i,r)},I=function(e,t){d.vertexAttribDivisor(e,t)},D=function(e){d.drawBuffers(e)}}else O=V(d,["OES_vertex_array_object"]),o(O)&&(E=function(){return O.createVertexArrayOES()},w=function(e){O.bindVertexArrayOES(e)},T=function(e){O.deleteVertexArrayOES(e)}),N=V(d,["ANGLE_instanced_arrays"]),o(N)&&(x=function(e,t,i,r,n){N.drawElementsInstancedANGLE(e,t,i,r,n)},P=function(e,t,i,r){N.drawArraysInstancedANGLE(e,t,i,r)},I=function(e,t){N.vertexAttribDivisorANGLE(e,t)}),L=V(d,["WEBGL_draw_buffers"]),o(L)&&(D=function(e){L.drawBuffersWEBGL(e)});this.glCreateVertexArray=E,this.glBindVertexArray=w,this.glDeleteVertexArray=T,this.glDrawElementsInstanced=x,this.glDrawArraysInstanced=P,this.glVertexAttribDivisor=I,this.glDrawBuffers=D,this._vertexArrayObject=!!O,this._instancedArrays=!!N,this._drawBuffers=!!L,y._maximumDrawBuffers=this.drawBuffers?d.getParameter(R.MAX_DRAW_BUFFERS):1,y._maximumColorAttachments=this.drawBuffers?d.getParameter(R.MAX_COLOR_ATTACHMENTS):1;var B=d.getParameter(d.COLOR_CLEAR_VALUE);this._clearColor=new t(B[0],B[1],B[2],B[3]),this._clearDepth=d.getParameter(d.DEPTH_CLEAR_VALUE),this._clearStencil=d.getParameter(d.STENCIL_CLEAR_VALUE);var k=new M,z=new S(this),U=b.fromCache();this._defaultPassState=z,this._defaultRenderState=U,this._defaultTexture=void 0,this._defaultCubeMap=void 0,this._us=k,this._currentRenderState=U,this._currentPassState=z,this._currentFramebuffer=void 0,this._maxFrameTextureUnitIndex=0,this._vertexAttribDivisors=[],this._previousDrawInstanced=!1;for(var G=0;G<y._maximumVertexAttributes;G++)this._vertexAttribDivisors.push(0);this._pickObjects={},this._nextPickColor=new Uint32Array(1),this.options=a,this.cache={},b.apply(d,U,z)}function z(e,t){if(e.validateFramebuffer){var i=e._gl,r=i.checkFramebufferStatus(i.FRAMEBUFFER);if(r!==i.FRAMEBUFFER_COMPLETE){var n;switch(r){case i.FRAMEBUFFER_INCOMPLETE_ATTACHMENT:n="Framebuffer is not complete. Incomplete attachment: at least one attachment point with a renderbuffer or texture attached has its attached object no longer in existence or has an attached image with a width or height of zero, or the color attachment point has a non-color-renderable image attached, or the depth attachment point has a non-depth-renderable image attached, or the stencil attachment point has a non-stencil-renderable image attached. Color-renderable formats include GL_RGBA4, GL_RGB5_A1, and GL_RGB565. GL_DEPTH_COMPONENT16 is the only depth-renderable format. GL_STENCIL_INDEX8 is the only stencil-renderable format.";break;case i.FRAMEBUFFER_INCOMPLETE_DIMENSIONS:n="Framebuffer is not complete. Incomplete dimensions: not all attached images have the same width and height.";break;case i.FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT:n="Framebuffer is not complete. Missing attachment: no images are attached to the framebuffer.";break;case i.FRAMEBUFFER_UNSUPPORTED:n="Framebuffer is not complete. Unsupported: the combination of internal formats of the attached images violates an implementation-dependent set of restrictions."}throw new l(n)}}}function U(e,t,i,r){var n=e._currentRenderState,o=e._currentPassState;e._currentRenderState=t,e._currentPassState=i,b.partialApply(e._gl,n,t,o,i,r)}function G(e,t){if(t!==e._currentFramebuffer){e._currentFramebuffer=t;var i=Y;if(o(t))t._bind(),z(e,t),i=t._getActiveColorAttachments();else{var r=e._gl;r.bindFramebuffer(r.FRAMEBUFFER,null)}e.drawBuffers&&e.glDrawBuffers(i)}}function W(e,t,i,r,o,a){var s=n(n(o,i.renderState),e._defaultRenderState);G(e,t),U(e,s,r,!1);var l=n(a,i.shaderProgram);l._bind(),e._maxFrameTextureUnitIndex=Math.max(e._maxFrameTextureUnitIndex,l.maximumTextureUnitIndex)}function H(e,t,i){var r=t.primitiveType,a=t.vertexArray,s=t.offset,l=t.count,u=t.instanceCount;e._us.model=n(t.modelMatrix,p.IDENTITY);var c=n(i,t.shaderProgram);c._setUniforms(t.uniformMap,e._us,e.validateShaderProgram),a._bind();var h=a.indexBuffer;o(h)?(s*=h.bytesPerIndex,l=n(l,h.numberOfIndices),0===u?e._gl.drawElements(r,l,h.indexDatatype,s):e.glDrawElementsInstanced(r,l,h.indexDatatype,s,u)):(l=n(l,a.numberOfVertices),0===u?e._gl.drawArrays(r,s,l):e.glDrawArraysInstanced(r,s,l,u)),a._unBind()}function q(e,t,i){this._pickObjects=e,this.key=t,this.color=i}var j={};a(k.prototype,{id:{get:function(){return this._id}},webgl2:{get:function(){return this._webgl2}},canvas:{get:function(){return this._canvas}},shaderCache:{get:function(){return this._shaderCache}},uniformState:{get:function(){return this._us}},redBits:{get:function(){return this._redBits}},greenBits:{get:function(){return this._greenBits}},blueBits:{get:function(){return this._blueBits}},alphaBits:{get:function(){return this._alphaBits}},depthBits:{get:function(){return this._depthBits}},stencilBits:{get:function(){return this._stencilBits}},antialias:{get:function(){return this._antialias}},standardDerivatives:{get:function(){return this._standardDerivatives}},elementIndexUint:{get:function(){return this._elementIndexUint||this._webgl2}},depthTexture:{get:function(){return this._depthTexture}},floatingPointTexture:{get:function(){return this._textureFloat}},textureFilterAnisotropic:{get:function(){return!!this._textureFilterAnisotropic}},vertexArrayObject:{get:function(){return this._vertexArrayObject||this._webgl2}},fragmentDepth:{get:function(){return this._fragDepth}},instancedArrays:{get:function(){return this._instancedArrays||this._webgl2}},drawBuffers:{get:function(){return this._drawBuffers||this._webgl2}},debugShaders:{get:function(){return this._debugShaders}},throwOnWebGLError:{get:function(){return this._throwOnWebGLError},set:function(e){this._throwOnWebGLError=e,this._gl=B(this._originalGLContext,e?L:null)}},defaultTexture:{get:function(){return void 0===this._defaultTexture&&(this._defaultTexture=new I({context:this,source:{width:1,height:1,arrayBufferView:new Uint8Array([255,255,255,255])}})),this._defaultTexture}},defaultCubeMap:{get:function(){if(void 0===this._defaultCubeMap){var e={width:1,height:1,arrayBufferView:new Uint8Array([255,255,255,255])};this._defaultCubeMap=new C({context:this,source:{positiveX:e,negativeX:e,positiveY:e,negativeY:e,positiveZ:e,negativeZ:e}})}return this._defaultCubeMap}},drawingBufferHeight:{get:function(){return this._gl.drawingBufferHeight}},drawingBufferWidth:{get:function(){return this._gl.drawingBufferWidth}},defaultFramebuffer:{get:function(){return j}}});var Y;"undefined"!=typeof WebGLRenderingContext&&(Y=[R.BACK]);var X=new _;k.prototype.clear=function(e,i){e=n(e,X),i=n(i,this._defaultPassState);var r=this._gl,a=0,s=e.color,l=e.depth,u=e.stencil;o(s)&&(t.equals(this._clearColor,s)||(t.clone(s,this._clearColor),r.clearColor(s.red,s.green,s.blue,s.alpha)),a|=r.COLOR_BUFFER_BIT),o(l)&&(l!==this._clearDepth&&(this._clearDepth=l,r.clearDepth(l)),a|=r.DEPTH_BUFFER_BIT),o(u)&&(u!==this._clearStencil&&(this._clearStencil=u,r.clearStencil(u)),a|=r.STENCIL_BUFFER_BIT);var c=n(e.renderState,this._defaultRenderState);U(this,c,i,!0);var h=n(e.framebuffer,i.framebuffer);G(this,h),r.clear(a)},k.prototype.draw=function(e,t,i,r){t=n(t,this._defaultPassState);var o=n(e.framebuffer,t.framebuffer);W(this,o,e,t,i,r),H(this,e,r)},k.prototype.endFrame=function(){var e=this._gl;e.useProgram(null),this._currentFramebuffer=void 0,e.bindFramebuffer(e.FRAMEBUFFER,null);var t=Y;this.drawBuffers&&this.glDrawBuffers(t);var i=this._maxFrameTextureUnitIndex;this._maxFrameTextureUnitIndex=0;for(var r=0;i>r;++r)e.activeTexture(e.TEXTURE0+r),e.bindTexture(e.TEXTURE_2D,null),e.bindTexture(e.TEXTURE_CUBE_MAP,null)},k.prototype.readPixels=function(e){var t=this._gl;e=e||{};var i=Math.max(e.x||0,0),r=Math.max(e.y||0,0),n=e.width||t.drawingBufferWidth,o=e.height||t.drawingBufferHeight,a=e.framebuffer,s=new Uint8Array(4*n*o);return G(this,a),t.readPixels(i,r,n,o,t.RGBA,t.UNSIGNED_BYTE,s),s};var Z={position:0,textureCoordinates:1};return k.prototype.getViewportQuadVertexArray=function(){var e=this.cache.viewportQuad_vertexArray;if(!o(e)){var t=new c({attributes:{position:new h({componentDatatype:i.FLOAT,componentsPerAttribute:2,values:[-1,-1,1,-1,1,1,-1,1]}),textureCoordinates:new h({componentDatatype:i.FLOAT,componentsPerAttribute:2,values:[0,0,1,0,1,1,0,1]})},indices:new Uint16Array([0,1,2,0,2,3]),primitiveType:m.TRIANGLES});e=D.fromGeometry({context:this,geometry:t,attributeLocations:Z,bufferUsage:g.STATIC_DRAW,interleave:!0}),this.cache.viewportQuad_vertexArray=e}return e},k.prototype.createViewportQuadCommand=function(e,t){return t=n(t,n.EMPTY_OBJECT),new E({vertexArray:this.getViewportQuadVertexArray(),primitiveType:m.TRIANGLES,renderState:t.renderState,shaderProgram:P.fromCache({context:this,vertexShaderSource:v,fragmentShaderSource:e,attributeLocations:Z}),uniformMap:t.uniformMap,owner:t.owner,framebuffer:t.framebuffer})},k.prototype.createPickFramebuffer=function(){return new w(this)},k.prototype.getObjectByPickColor=function(e){return this._pickObjects[e.toRgba()]},a(q.prototype,{object:{get:function(){return this._pickObjects[this.key]},set:function(e){this._pickObjects[this.key]=e}}}),q.prototype.destroy=function(){delete this._pickObjects[this.key]},k.prototype.createPickId=function(e){++this._nextPickColor[0];var i=this._nextPickColor[0];if(0===i)throw new f("Out of unique Pick IDs.");return this._pickObjects[i]=e,new q(this._pickObjects,i,t.fromRgba(i))},k.prototype.isDestroyed=function(){return!1},k.prototype.destroy=function(){var e=this.cache;for(var t in e)if(e.hasOwnProperty(t)){var i=e[t];o(i.destroy)&&i.destroy()}return this._shaderCache=this._shaderCache.destroy(),this._defaultTexture=this._defaultTexture&&this._defaultTexture.destroy(),this._defaultCubeMap=this._defaultCubeMap&&this._defaultCubeMap.destroy(),s(this)},k}),i("Renderer/loadCubeMap",["../Core/defined","../Core/DeveloperError","../Core/loadImage","../ThirdParty/when","./CubeMap"],function(e,t,i,r,n){"use strict";function o(e,t,o){var a=[i(t.positiveX,o),i(t.negativeX,o),i(t.positiveY,o),i(t.negativeY,o),i(t.positiveZ,o),i(t.negativeZ,o)];return r.all(a,function(t){return new n({context:e,source:{positiveX:t[0],negativeX:t[1],positiveY:t[2],negativeY:t[3],positiveZ:t[4],negativeZ:t[5]}})})}return o}),i("Scene/DiscardMissingTileImagePolicy",["../Core/defaultValue","../Core/defined","../Core/DeveloperError","../Core/getImagePixels","../Core/loadImageViaBlob","../ThirdParty/when"],function(e,t,i,r,n,o){"use strict";function a(a){function s(e){t(e.blob)&&(u._missingImageByteLength=e.blob.size);var i=r(e);if(a.disableCheckIfAllPixelsAreTransparent){for(var n=!0,o=e.width,s=a.pixelsToCheck,l=0,c=s.length;n&&c>l;++l){var h=s[l],d=4*h.x+h.y*o,p=i[d+3];p>0&&(n=!1)}n&&(i=void 0)}u._missingImagePixels=i,u._isReady=!0}function l(){u._missingImagePixels=void 0,u._isReady=!0}if(a=e(a,e.EMPTY_OBJECT),!t(a.missingImageUrl))throw new i("options.missingImageUrl is required.");if(!t(a.pixelsToCheck))throw new i("options.pixelsToCheck is required.");this._pixelsToCheck=a.pixelsToCheck,this._missingImagePixels=void 0,this._missingImageByteLength=void 0,this._isReady=!1;var u=this;o(n(a.missingImageUrl),s,l)}return a.prototype.isReady=function(){return this._isReady},a.prototype.shouldDiscardImage=function(e){if(!this._isReady)throw new i("shouldDiscardImage must not be called before the discard policy is ready.");var n=this._pixelsToCheck,o=this._missingImagePixels;if(!t(o))return!1;if(t(e.blob)&&e.blob.size!==this._missingImageByteLength)return!1;for(var a=r(e),s=e.width,l=0,u=n.length;u>l;++l)for(var c=n[l],h=4*c.x+c.y*s,d=0;4>d;++d){var p=h+d;if(a[p]!==o[p])return!1}return!0},a}),i("Scene/ImageryLayerFeatureInfo",["../Core/defined"],function(e){"use strict";function t(){this.name=void 0,this.description=void 0,this.position=void 0,this.data=void 0,this.imageryLayer=void 0}return t.prototype.configureNameFromProperties=function(t){var i,r=10;for(var n in t)if(t.hasOwnProperty(n)&&t[n]){var o=n.toLowerCase();r>1&&"name"===o?(r=1,i=n):r>2&&"title"===o?(r=2,i=n):r>3&&/name/i.test(n)?(r=3,i=n):r>4&&/title/i.test(n)&&(r=4, +i=n)}e(i)&&(this.name=t[i])},t.prototype.configureDescriptionFromProperties=function(t){function i(t){var r='<table class="cesium-infoBox-defaultTable">';for(var n in t)if(t.hasOwnProperty(n)){var o=t[n];e(o)&&(r+="object"==typeof o?"<tr><td>"+n+"</td><td>"+i(o)+"</td></tr>":"<tr><td>"+n+"</td><td>"+o+"</td></tr>")}return r+="</table>"}this.description=i(t)},t}),i("Scene/ImageryProvider",["../Core/defined","../Core/defineProperties","../Core/DeveloperError","../Core/loadImage","../Core/loadImageViaBlob","../Core/throttleRequestByServer"],function(e,t,i,r,n,o){"use strict";function a(){this.defaultAlpha=void 0,this.defaultBrightness=void 0,this.defaultContrast=void 0,this.defaultHue=void 0,this.defaultSaturation=void 0,this.defaultGamma=void 0,i.throwInstantiationError()}return t(a.prototype,{ready:{get:i.throwInstantiationError},readyPromise:{get:i.throwInstantiationError},rectangle:{get:i.throwInstantiationError},tileWidth:{get:i.throwInstantiationError},tileHeight:{get:i.throwInstantiationError},maximumLevel:{get:i.throwInstantiationError},minimumLevel:{get:i.throwInstantiationError},tilingScheme:{get:i.throwInstantiationError},tileDiscardPolicy:{get:i.throwInstantiationError},errorEvent:{get:i.throwInstantiationError},credit:{get:i.throwInstantiationError},proxy:{get:i.throwInstantiationError},hasAlphaChannel:{get:i.throwInstantiationError}}),a.prototype.getTileCredits=i.throwInstantiationError,a.prototype.requestImage=i.throwInstantiationError,a.prototype.pickFeatures=i.throwInstantiationError,a.loadImage=function(t,i){return e(t.tileDiscardPolicy)?o(i,n,{headers:t.headers,withCredentials:t.withCredentials}):o(i,r,{headers:t.headers,withCredentials:t.withCredentials})},a}),i("Scene/ArcGisMapServerImageryProvider",["../Core/Cartesian2","../Core/Cartesian3","../Core/Cartographic","../Core/Credit","../Core/defaultValue","../Core/defined","../Core/defineProperties","../Core/DeveloperError","../Core/Event","../Core/GeographicProjection","../Core/GeographicTilingScheme","../Core/loadJson","../Core/loadJsonp","../Core/Math","../Core/Rectangle","../Core/RuntimeError","../Core/TileProviderError","../Core/WebMercatorProjection","../Core/WebMercatorTilingScheme","../ThirdParty/when","./DiscardMissingTileImagePolicy","./ImageryLayerFeatureInfo","./ImageryProvider"],function(e,t,i,r,n,o,a,s,l,u,c,h,d,p,m,f,v,g,_,y,C,E,S){"use strict";function w(t){function i(i){var n=i.tileInfo;if(o(n)){if(h._tileWidth=n.rows,h._tileHeight=n.cols,102100===n.spatialReference.wkid||102113===n.spatialReference.wkid)h._tilingScheme=new _({ellipsoid:t.ellipsoid});else{if(4326!==i.tileInfo.spatialReference.wkid){var a="Tile spatial reference WKID "+i.tileInfo.spatialReference.wkid+" is not supported.";return void(u=v.handleError(u,h,h._errorEvent,a,void 0,void 0,void 0,s))}h._tilingScheme=new c({ellipsoid:t.ellipsoid})}if(h._maximumLevel=i.tileInfo.lods.length-1,o(i.fullExtent)){if(o(i.fullExtent.spatialReference)&&o(i.fullExtent.spatialReference.wkid))if(102100===i.fullExtent.spatialReference.wkid||102113===i.fullExtent.spatialReference.wkid){var l=new g,d=l.unproject(new e(i.fullExtent.xmin,i.fullExtent.ymin)),p=l.unproject(new e(i.fullExtent.xmax,i.fullExtent.ymax));h._rectangle=new m(d.longitude,d.latitude,p.longitude,p.latitude)}else{if(4326!==i.fullExtent.spatialReference.wkid){var f="fullExtent.spatialReference WKID "+i.fullExtent.spatialReference.wkid+" is not supported.";return void(u=v.handleError(u,h,h._errorEvent,f,void 0,void 0,void 0,s))}h._rectangle=m.fromDegrees(i.fullExtent.xmin,i.fullExtent.ymin,i.fullExtent.xmax,i.fullExtent.ymax)}}else h._rectangle=h._tilingScheme.rectangle;o(h._tileDiscardPolicy)||(h._tileDiscardPolicy=new C({missingImageUrl:T(h,0,0,h._maximumLevel),pixelsToCheck:[new e(0,0),new e(200,20),new e(20,200),new e(80,110),new e(160,130)],disableCheckIfAllPixelsAreTransparent:!0})),h._useTiles=!0}else h._useTiles=!1;o(i.copyrightText)&&i.copyrightText.length>0&&(h._credit=new r(i.copyrightText)),h._ready=!0,h._readyPromise.resolve(!0),v.handleSuccess(u)}function a(e){var t="An error occurred while accessing "+h._url+".";u=v.handleError(u,h,h._errorEvent,t,void 0,void 0,void 0,s),h._readyPromise.reject(new f(t))}function s(){var e={f:"json"};o(h._token)&&(e.token=h._token);var t=d(h._url,{parameters:e,proxy:h._proxy});y(t,i,a)}t=n(t,{}),this._url=t.url,this._token=t.token,this._tileDiscardPolicy=t.tileDiscardPolicy,this._proxy=t.proxy,this._tileWidth=n(t.tileWidth,256),this._tileHeight=n(t.tileHeight,256),this._maximumLevel=t.maximumLevel,this._tilingScheme=n(t.tilingScheme,new c({ellipsoid:t.ellipsoid})),this._credit=void 0,this._useTiles=n(t.usePreCachedTilesIfAvailable,!0),this._rectangle=n(t.rectangle,this._tilingScheme.rectangle),this._layers=t.layers,this.enablePickFeatures=n(t.enablePickFeatures,!0),this._errorEvent=new l,this._ready=!1,this._readyPromise=y.defer();var u,h=this;this._useTiles?s():(this._ready=!0,this._readyPromise.resolve(!0))}function T(e,t,i,r){var n;if(e._useTiles)n=e._url+"/tile/"+r+"/"+i+"/"+t;else{var a=e._tilingScheme.tileXYToNativeRectangle(t,i,r),s=a.west+"%2C"+a.south+"%2C"+a.east+"%2C"+a.north;n=e._url+"/export?",n+="bbox="+s,n+=e._tilingScheme instanceof c?"&bboxSR=4326&imageSR=4326":"&bboxSR=3857&imageSR=3857",n+="&size="+e._tileWidth+"%2C"+e._tileHeight,n+="&format=png&transparent=true&f=image",e.layers&&(n+="&layers=show:"+e.layers)}var l=e._token;o(l)&&(-1===n.indexOf("?")&&(n+="?"),"?"!==n[n.length-1]&&(n+="&"),n+="token="+l);var u=e._proxy;return o(u)&&(n=u.getURL(n)),n}return a(w.prototype,{url:{get:function(){return this._url}},token:{get:function(){return this._token}},proxy:{get:function(){return this._proxy}},tileWidth:{get:function(){return this._tileWidth}},tileHeight:{get:function(){return this._tileHeight}},maximumLevel:{get:function(){return this._maximumLevel}},minimumLevel:{get:function(){return 0}},tilingScheme:{get:function(){return this._tilingScheme}},rectangle:{get:function(){return this._rectangle}},tileDiscardPolicy:{get:function(){return this._tileDiscardPolicy}},errorEvent:{get:function(){return this._errorEvent}},ready:{get:function(){return this._ready}},readyPromise:{get:function(){return this._readyPromise.promise}},credit:{get:function(){return this._credit}},usingPrecachedTiles:{get:function(){return this._useTiles}},hasAlphaChannel:{get:function(){return!0}},layers:{get:function(){return this._layers}}}),w.prototype.getTileCredits=function(e,t,i){},w.prototype.requestImage=function(e,t,i){var r=T(this,e,t,i);return S.loadImage(this,r)},w.prototype.pickFeatures=function(e,r,n,a,s){if(this.enablePickFeatures){var l,u,d,m=this._tilingScheme.tileXYToNativeRectangle(e,r,n);if(this._tilingScheme instanceof c)l=p.toDegrees(a),u=p.toDegrees(s),d="4326";else{var f=this._tilingScheme.projection.project(new i(a,s,0));l=f.x,u=f.y,d="3857"}var v=this._url+"/identify?f=json&tolerance=2&geometryType=esriGeometryPoint";return v+="&geometry="+l+","+u,v+="&mapExtent="+m.west+","+m.south+","+m.east+","+m.north,v+="&imageDisplay="+this._tileWidth+","+this._tileHeight+",96",v+="&sr="+d,v+="&layers=visible",o(this._layers)&&(v+=":"+this._layers),o(this._token)&&(v+="&token="+this._token),o(this._proxy)&&(v=this._proxy.getURL(v)),h(v).then(function(e){var r=[],n=e.results;if(!o(n))return r;for(var a=0;a<n.length;++a){var s=n[a],l=new E;if(l.data=s,l.name=s.value,l.properties=s.attributes,l.configureDescriptionFromProperties(s.attributes),"esriGeometryPoint"===s.geometryType&&s.geometry){var u=s.geometry.spatialReference&&s.geometry.spatialReference.wkid?s.geometry.spatialReference.wkid:4326;if(4326===u||4283===u)l.position=i.fromDegrees(s.geometry.x,s.geometry.y,s.geometry.z);else if(102100===u||900913===u||3857===u){var c=new g;l.position=c.unproject(new t(s.geometry.x,s.geometry.y,s.geometry.z))}}r.push(l)}return r})}},w}),i("Scene/BingMapsStyle",["../Core/freezeObject"],function(e){"use strict";var t={AERIAL:"Aerial",AERIAL_WITH_LABELS:"AerialWithLabels",ROAD:"Road",ORDNANCE_SURVEY:"OrdnanceSurvey",COLLINS_BART:"CollinsBart"};return e(t)}),i("Scene/BingMapsImageryProvider",["../Core/BingMapsApi","../Core/Cartesian2","../Core/Credit","../Core/defaultValue","../Core/defined","../Core/defineProperties","../Core/DeveloperError","../Core/Event","../Core/loadJsonp","../Core/Math","../Core/Rectangle","../Core/RuntimeError","../Core/TileProviderError","../Core/WebMercatorTilingScheme","../ThirdParty/when","./BingMapsStyle","./DiscardMissingTileImagePolicy","./ImageryProvider"],function(e,t,i,r,n,o,a,s,l,u,c,h,d,p,m,f,v,g){"use strict";function _(o){function a(e){var r=e.resourceSets[0].resources[0];w._tileWidth=r.imageWidth,w._tileHeight=r.imageHeight,w._maximumLevel=r.zoomMax-1,w._imageUrlSubdomains=r.imageUrlSubdomains,w._imageUrlTemplate=r.imageUrl.replace("{culture}",w._culture);var o=w._tileProtocol;if(!n(o)){var a=document.location.protocol;o=/^http/.test(a)?a:"http:"}w._imageUrlTemplate=w._imageUrlTemplate.replace(/^http:/,o),n(w._tileDiscardPolicy)||(w._tileDiscardPolicy=new v({missingImageUrl:y(w,0,0,w._maximumLevel),pixelsToCheck:[new t(0,0),new t(120,140),new t(130,160),new t(200,50),new t(200,200)],disableCheckIfAllPixelsAreTransparent:!0}));var s=w._attributionList=r.imageryProviders;s||(s=w._attributionList=[]);for(var l=0,h=s.length;h>l;++l){var p=s[l];p.credit=new i(p.attribution);for(var m=p.coverageAreas,f=0,g=p.coverageAreas.length;g>f;++f){var _=m[f],C=_.bbox;_.bbox=new c(u.toRadians(C[1]),u.toRadians(C[0]),u.toRadians(C[3]),u.toRadians(C[2]))}}w._ready=!0,w._readyPromise.resolve(!0),d.handleSuccess(E)}function g(e){var t="An error occurred while accessing "+S+".";E=d.handleError(E,w,w._errorEvent,t,void 0,void 0,void 0,C),w._readyPromise.reject(new h(t))}function C(){var e=l(S,{callbackParameterName:"jsonp",proxy:w._proxy});m(e,a,g)}o=r(o,{}),this._key=e.getKey(o.key),this._url=o.url,this._tileProtocol=o.tileProtocol,this._mapStyle=r(o.mapStyle,f.AERIAL),this._culture=r(o.culture,""),this._tileDiscardPolicy=o.tileDiscardPolicy,this._proxy=o.proxy,this._credit=new i("Bing Imagery",_._logoData,"http://www.bing.com"),this.defaultGamma=1,(this._mapStyle===f.AERIAL||this._mapStyle===f.AERIAL_WITH_LABELS)&&(this.defaultGamma=1.3),this._tilingScheme=new p({numberOfLevelZeroTilesX:2,numberOfLevelZeroTilesY:2,ellipsoid:o.ellipsoid}),this._tileWidth=void 0,this._tileHeight=void 0,this._maximumLevel=void 0,this._imageUrlTemplate=void 0,this._imageUrlSubdomains=void 0,this._errorEvent=new s,this._ready=!1,this._readyPromise=m.defer();var E,S=this._url+"/REST/v1/Imagery/Metadata/"+this._mapStyle+"?incl=ImageryProviders&key="+this._key,w=this;C()}function y(e,t,i,r){var o=e._imageUrlTemplate,a=_.tileXYToQuadKey(t,i,r);o=o.replace("{quadkey}",a);var s=e._imageUrlSubdomains,l=(t+i+r)%s.length;o=o.replace("{subdomain}",s[l]);var u=e._proxy;return n(u)&&(o=u.getURL(o)),o}function C(e,t,i){++t;for(var r=[],o=0,a=e.length;a>o;++o){for(var s=e[o],l=s.coverageAreas,u=!1,h=0,d=s.coverageAreas.length;!u&&d>h;++h){var p=l[h];if(t>=p.zoomMin&&t<=p.zoomMax){var m=c.intersection(i,p.bbox,S);n(m)&&(u=!0)}}u&&r.push(s.credit)}return r}o(_.prototype,{url:{get:function(){return this._url}},proxy:{get:function(){return this._proxy}},key:{get:function(){return this._key}},mapStyle:{get:function(){return this._mapStyle}},culture:{get:function(){return this._culture}},tileWidth:{get:function(){return this._tileWidth}},tileHeight:{get:function(){return this._tileHeight}},maximumLevel:{get:function(){return this._maximumLevel}},minimumLevel:{get:function(){return 0}},tilingScheme:{get:function(){return this._tilingScheme}},rectangle:{get:function(){return this._tilingScheme.rectangle}},tileDiscardPolicy:{get:function(){return this._tileDiscardPolicy}},errorEvent:{get:function(){return this._errorEvent}},ready:{get:function(){return this._ready}},readyPromise:{get:function(){return this._readyPromise.promise}},credit:{get:function(){return this._credit}},hasAlphaChannel:{get:function(){return!1}}});var E=new c;_.prototype.getTileCredits=function(e,t,i){if(!this._ready)throw new a("getTileCredits must not be called before the imagery provider is ready.");var r=this._tilingScheme.tileXYToRectangle(e,t,i,E);return C(this._attributionList,i,r)},_.prototype.requestImage=function(e,t,i){var r=y(this,e,t,i);return g.loadImage(this,r)},_.prototype.pickFeatures=function(){},_._logoData="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAD0AAAAaCAYAAAAEy1RnAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAAB3RJTUUH3gIDEgcPTMnXOQAAClZJREFUWMPdWGtsFNcV/u689uH1+sXaONhlWQzBENtxiUFBpBSLd60IpXHSNig4URtSYQUkRJNSi0igViVVVBJBaBsiAgKRQJSG8AgEHCCWU4iBCprY2MSgXfOI16y9D3s9Mzsztz9yB12WNU2i9Ecy0tHOzN4793zn3POdcy7BnRfJ8I7iB3SRDPeEExswLz8Y0DZIAYDIRGAgLQAm+7Xle31J3L3Anp1MZPY+BUBjorN332vgYhpgV1FRUd6TTz45ubq6OtDV1SXpuu5g//Oept9wNwlMyAi8IXDjyF245TsDTdivDMATCATGNDU1/WbhwoWPTZs2bWx1dXWhx+Oxrl+/PqTrus5t9W8KWEzjinTAYhro/xuBStwiIgBnJBLxKIoy1u/3V/r9/krDMMz3339/Z3t7e38ikUgCMDLEt8W+Q0cAI3McYTDDmZxh7DESG5Ni43jg9Gsa+X+OsxWxPSJTSj3JZFK5ZRVJErOzs8e6XC4fgGwALhbzDgAKU1hK28KEA6PMmTMn56233qpevnz5PQDcbJ7EzVUAuMrLy3MBeABkcWOEDELSyFe4y7iMoHkriZZlKYZh8ASHZDKpJJPJHAC5APIA5APIAeBlCjo5TwlpXnbOmTPHP3fu3KZVq1atZKBcDJQ9x7V48WJfc3Pzhp6enj+tXLnyR8w4MjdG4gyVDk7KICMClzKlLUrpbQMNw5AkScppbGz8cWdn57WjR4/2caw+DEBlYjO8wX1foZQWuN3uKZIklQD4G+fhlG0Yl8uVm5WVVW6app6dne0D0G8vnxbjJntHubCUOK/badZICyWanrJuAaeUknTQpmlKkUhEWbx48U8LCwtHhUKha+fPn+85fPhwV0tLyzUACSZx9jvMFhIByNFoVDEMw/qKB5HPvJfkUqBr9+7deklJyZ/j8bi5ffv2OAslieMLsG+m2DybT2QuzEQOsF5SUqJfvXo1yc2l6Xn6rgSRSCSEc+fOhVeuXLmwoqJixvTp0wcWLFgQ7unpudHR0dF97ty5z/fu3XseQJh5adjeerquy5ZlCalUivh8Pt8HH3ywzOPxyD09PZ81NjZ+2NnZaQEQx40b54vFYqaqquEVK1b4a2tr/WvWrDn18ssv144fP36SqqoD69ev371nz57rDLwAwHHkyJGfjRs3rtowDOv06dOnu7q6rs6bN2/s7Nmz9zIjDKenWoFZKg/AlMLCwl82Nzf/m3LX22+/fXb06NF/ALC8u7u7m6ZdkUhksL29/UpLS0vzunXrVgAoBzAaQBGAiY2NjUui0ei1RCLRFwwG/9PX19cVi8WCqqoOdHd3HysrK6sDMCccDl8IBoOtiqIsOnbs2D+i0eiV3t7ez8Ph8GeRSKRT07TB/v7+i1OnTp0HYBqABzs7O/+paVo0Fot1RyKRi/F4/Gp/f39XIpHoZnoUMn6wU+ZtRDaymwmxZFk2AWjvvvvuJ/F4PMn/n5+fn1VeXu6fOXNmbU1NzUOM4Bz8QqIoyg6HwxuLxfq3bdu2a+vWrW/09/dfKy0tffDVV199BEC20+n0ud3uQgBup9Pp83g8JYqieE+ePPnxxo0bt33xxRen8/Ly7n3hhRcWASh47bXX5pWVldWFw+GuXbt27XjzzTd3BoPBDq/XG1AUZRRHmAKPVfqaoKkgCCkA+oYNG84Eg0FHTU1N5ezZs8eWlJQ4CSF8/LvZYhJPQoQQpFKpwcrKyo1su9HBwUF99erVv588eXINgOOmacIwDEopdaZSKUIpxYkTJz6sr68/BMBav379RcMwZk2aNOl+AP+qq6t7xDTNVEVFxR+j0WgSAJk4ceKlTz/9tNzpdHpZvIvpjVW6pykhhBJCbkvwgiAQQogEQL558ybdtGlTsLm5OWJZdxZmlmWll5OUEEJN0zSGhob6GcOrALSzZ8/2apqWcLlc2axGACNRkRAimqaph0Kh68xIwwB0y7IMSZKcABz5+fkl8Xj8y2g0apOb5na7rYGBgS/JV54Q0qpAAoBKaS0jBWClg1ZVFeFw2AlgVF1dXeDpp5+eWVFRUVpcXOzgvQwAbrcbDJhdudlGpKZpGtx6JCcnRxIEQbQsS2PjbjM+AMvlchnMSBaXkr7ymCCIhmEYfMoVRVESBEHI0CaTTNubssUsQRBuubCtra33pZdeCk6YMCGwZs2aipqaGn9paWmuJEl3JP0bN258eeTIkRMABrm0YomiaImiKGVlZeWxLecAgBkzZvgdDkfWjRs3ggA0bpfpoiiahBCqKEqKAy2yULMA6MlkMp6Xl3cP1x2SWCwmFhQU+CmlFhfHNFOevpX4LcvSJUkyAeDQoUOh119//fpTTz01Zf78+UWBQCBHUZQ7yE/TNGPfvn0n33vvvSP79+//BECMeZsCMGRZNgRBgNPpHHXx4sVVDQ0Nf1+wYMGYJ554YikAevDgwUMA4oIgQJZlSggZdDqdBiGEZGdn6ww0tQlJURTT4/EMHz9+/MCjjz7622AwuHbZsmVbiouLvWvXrm1wOp3ZqVRqaKQTIInf1gAMl8ulU0q1CxcuBGOxmL5u3bryQCDgycrKEjORXGtra8eOHTsOHz169OyVK1cuA+hlRYrGlNRkWR7UNO2mYRiaz+cb3dLS8gYhhOi6Hj116tSOVatWHQNALcsaME0zLghClBDSZ9+zQsZ2SoJS2udwOKLPPffcvsrKyrJAIPDQ/v37txiGofX19V3r7e29UlBQMHqEVpjwnrYA6PF4PK6q6s2qqqqpZWVlitvtljOB7enpiWzbtu3wgQMHTre1tV0E0MeKkkGuIhMAqHv37u30er3Px+NxlyiKygMPPOAnhFiXLl0Kbd68uYPNsXbu3Lk6mUwaqqr2btmyZUdtbe3hd955pwvAEFNcO3jw4K/b2tqiqqpGIpGI4/HHH/9rQ0PDCa/XOyoSidDLly8PNTU1PcZ4QuNK1ju6NYHFRAGASXPnzv1Fa2vrxzTDpapqateuXR/Nnz+/SVGUhwFMBzCBFSLZLF75DsrJGpXRAH4EIABgPIBxAEoBFAPwARjFif1sNzZ25+VlOhaxufcCqAFQC+BhAPVLliz5XSqVUkOhUAuAKWnFyR3dlsw+fg+A+8eMGfPzTZs2bY9GozEb8JkzZ9qXLl36l+Li4l8B+AmAyQDGsGrOzfXNPGPawG2l85jksmcPm+vihH+2W1iF3bvZPN+sWbPuGx4eDrW3t+85fvz41o6OjmZN04Y0TYvV19cvYIbN5QqUjG2mwj5YAqDK4XDMe+aZZ55vbW09+sorr2yuqqpqYFatAuBn3uB7XzJCY297XeaUd2RoGzOJmHb6IjFj5D777LP3DQwMfDw8PBxSVbUvkUj0hEKhj1588cXH2O7zMSPdplumoxveMx5Zlj3jx4/39vb26gMDA4MsvgYZo+p8Pr7LqQX5Ds/U7d0jFxUVZS1atKg4Nzc317Isp67rZldXV6y5ufkmI78hFtcmrx8ZweMit6XsUs4+6kmlgbW+peLf9gyMZNCR374G0y/FxEzX8b/8+bkXEBxKFwAAAABJRU5ErkJggg==",_.tileXYToQuadKey=function(e,t,i){for(var r="",n=i;n>=0;--n){var o=1<<n,a=0;0!==(e&o)&&(a|=1),0!==(t&o)&&(a|=2),r+=a}return r},_.quadKeyToTileXY=function(e){for(var t=0,i=0,r=e.length-1,n=r;n>=0;--n){var o=1<<n,a=+e[r-n];0!==(1&a)&&(t|=o),0!==(2&a)&&(i|=o)}return{x:t,y:i,level:r}};var S=new c;return _}),i("Scene/CullingVolume",["../Core/Cartesian3","../Core/defaultValue","../Core/defined","../Core/DeveloperError","../Core/Intersect","../Core/Plane"],function(e,t,i,r,n,o){"use strict";function a(e){this.planes=t(e,[])}var s=new o(new e,0);return a.prototype.computeVisibility=function(e){for(var t=this.planes,i=!1,r=0,a=t.length;a>r;++r){var l=e.intersectPlane(o.fromCartesian4(t[r],s));if(l===n.OUTSIDE)return n.OUTSIDE;l===n.INTERSECTING&&(i=!0)}return i?n.INTERSECTING:n.INSIDE},a.prototype.computeVisibilityWithPlaneMask=function(e,t){if(t===a.MASK_OUTSIDE||t===a.MASK_INSIDE)return t;for(var i=a.MASK_INSIDE,r=this.planes,l=0,u=r.length;u>l;++l){var c=31>l?1<<l:0;if(!(31>l&&0===(t&c))){var h=e.intersectPlane(o.fromCartesian4(r[l],s));if(h===n.OUTSIDE)return a.MASK_OUTSIDE;h===n.INTERSECTING&&(i|=c)}}return i},a.MASK_OUTSIDE=4294967295,a.MASK_INSIDE=0,a.MASK_INDETERMINATE=2147483647,a}),i("Scene/PerspectiveOffCenterFrustum",["../Core/Cartesian2","../Core/Cartesian3","../Core/Cartesian4","../Core/defaultValue","../Core/defined","../Core/defineProperties","../Core/DeveloperError","../Core/Matrix4","./CullingVolume"],function(e,t,i,r,n,o,a,s,l){"use strict";function u(){this.left=void 0,this._left=void 0,this.right=void 0,this._right=void 0,this.top=void 0,this._top=void 0,this.bottom=void 0,this._bottom=void 0,this.near=1,this._near=this.near,this.far=5e8,this._far=this.far,this._cullingVolume=new l,this._perspectiveMatrix=new s,this._infinitePerspective=new s}function c(e){var t=e.top,i=e.bottom,r=e.right,n=e.left,o=e.near,a=e.far;(t!==e._top||i!==e._bottom||n!==e._left||r!==e._right||o!==e._near||a!==e._far)&&(e._left=n,e._right=r,e._top=t,e._bottom=i,e._near=o,e._far=a,e._perspectiveMatrix=s.computePerspectiveOffCenter(n,r,i,t,o,a,e._perspectiveMatrix),e._infinitePerspective=s.computeInfinitePerspectiveOffCenter(n,r,i,t,o,e._infinitePerspective))}o(u.prototype,{projectionMatrix:{get:function(){return c(this),this._perspectiveMatrix}},infiniteProjectionMatrix:{get:function(){return c(this),this._infinitePerspective}}});var h=new t,d=new t,p=new t,m=new t;return u.prototype.computeCullingVolume=function(e,r,o){var a=this._cullingVolume.planes,s=this.top,l=this.bottom,u=this.right,c=this.left,f=this.near,v=this.far,g=t.cross(r,o,h),_=d;t.multiplyByScalar(r,f,_),t.add(e,_,_);var y=p;t.multiplyByScalar(r,v,y),t.add(e,y,y);var C=m;t.multiplyByScalar(g,c,C),t.add(_,C,C),t.subtract(C,e,C),t.normalize(C,C),t.cross(C,o,C);var E=a[0];return n(E)||(E=a[0]=new i),E.x=C.x,E.y=C.y,E.z=C.z,E.w=-t.dot(C,e),t.multiplyByScalar(g,u,C),t.add(_,C,C),t.subtract(C,e,C),t.normalize(C,C),t.cross(o,C,C),E=a[1],n(E)||(E=a[1]=new i),E.x=C.x,E.y=C.y,E.z=C.z,E.w=-t.dot(C,e),t.multiplyByScalar(o,l,C),t.add(_,C,C),t.subtract(C,e,C),t.normalize(C,C),t.cross(g,C,C),E=a[2],n(E)||(E=a[2]=new i),E.x=C.x,E.y=C.y,E.z=C.z,E.w=-t.dot(C,e),t.multiplyByScalar(o,s,C),t.add(_,C,C),t.subtract(C,e,C),t.normalize(C,C),t.cross(C,g,C),E=a[3],n(E)||(E=a[3]=new i),E.x=C.x,E.y=C.y,E.z=C.z,E.w=-t.dot(C,e),E=a[4],n(E)||(E=a[4]=new i),E.x=r.x,E.y=r.y,E.z=r.z,E.w=-t.dot(r,_),t.negate(r,C),E=a[5],n(E)||(E=a[5]=new i),E.x=C.x,E.y=C.y,E.z=C.z,E.w=-t.dot(C,y),this._cullingVolume},u.prototype.getPixelDimensions=function(e,t,i,r){c(this);var n=1/this.near,o=this.top*n,a=2*i*o/t;o=this.right*n;var s=2*i*o/e;return r.x=s,r.y=a,r},u.prototype.clone=function(e){return n(e)||(e=new u),e.right=this.right,e.left=this.left,e.top=this.top,e.bottom=this.bottom,e.near=this.near,e.far=this.far,e._left=void 0,e._right=void 0,e._top=void 0,e._bottom=void 0,e._near=void 0,e._far=void 0,e},u.prototype.equals=function(e){return n(e)&&this.right===e.right&&this.left===e.left&&this.top===e.top&&this.bottom===e.bottom&&this.near===e.near&&this.far===e.far},u}),i("Scene/PerspectiveFrustum",["../Core/defined","../Core/defineProperties","../Core/DeveloperError","./PerspectiveOffCenterFrustum"],function(e,t,i,r){"use strict";function n(){this._offCenterFrustum=new r,this.fov=void 0,this._fov=void 0,this._fovy=void 0,this._sseDenominator=void 0,this.aspectRatio=void 0,this._aspectRatio=void 0,this.near=1,this._near=this.near,this.far=5e8,this._far=this.far,this.xOffset=0,this._xOffset=this.xOffset,this.yOffset=0,this._yOffset=this.yOffset}function o(e){var t=e._offCenterFrustum;(e.fov!==e._fov||e.aspectRatio!==e._aspectRatio||e.near!==e._near||e.far!==e._far||e.xOffset!==e._xOffset||e.yOffset!==e._yOffset)&&(e._aspectRatio=e.aspectRatio,e._fov=e.fov,e._fovy=e.aspectRatio<=1?e.fov:2*Math.atan(Math.tan(.5*e.fov)/e.aspectRatio),e._near=e.near,e._far=e.far,e._sseDenominator=2*Math.tan(.5*e._fovy),e._xOffset=e.xOffset,e._yOffset=e.yOffset,t.top=e.near*Math.tan(.5*e._fovy),t.bottom=-t.top,t.right=e.aspectRatio*t.top,t.left=-t.right,t.near=e.near,t.far=e.far,t.right+=e.xOffset,t.left+=e.xOffset,t.top+=e.yOffset,t.bottom+=e.yOffset)}return t(n.prototype,{projectionMatrix:{get:function(){return o(this),this._offCenterFrustum.projectionMatrix}},infiniteProjectionMatrix:{get:function(){return o(this),this._offCenterFrustum.infiniteProjectionMatrix}},fovy:{get:function(){return o(this),this._fovy}},sseDenominator:{get:function(){return o(this),this._sseDenominator}}}),n.prototype.computeCullingVolume=function(e,t,i){return o(this),this._offCenterFrustum.computeCullingVolume(e,t,i)},n.prototype.getPixelDimensions=function(e,t,i,r){return o(this),this._offCenterFrustum.getPixelDimensions(e,t,i,r)},n.prototype.clone=function(t){return e(t)||(t=new n),t.aspectRatio=this.aspectRatio,t.fov=this.fov,t.near=this.near,t.far=this.far,t._aspectRatio=void 0,t._fov=void 0,t._near=void 0,t._far=void 0,this._offCenterFrustum.clone(t._offCenterFrustum),t},n.prototype.equals=function(t){return e(t)?(o(this),o(t),this.fov===t.fov&&this.aspectRatio===t.aspectRatio&&this.near===t.near&&this.far===t.far&&this._offCenterFrustum.equals(t._offCenterFrustum)):!1},n}),i("Scene/CameraFlightPath",["../Core/Cartesian2","../Core/Cartesian3","../Core/Cartographic","../Core/defaultValue","../Core/defined","../Core/DeveloperError","../Core/EasingFunction","../Core/Math","./PerspectiveFrustum","./PerspectiveOffCenterFrustum","./SceneMode"],function(e,t,i,r,n,o,a,s,l,u,c){"use strict";function h(e,t,i){var r,n,o;if(e instanceof l){var a=Math.tan(.5*e.fovy);return r=e.near,n=e.near*a,o=e.aspectRatio*n,Math.max(t*r/o,i*r/n)}return e instanceof u?(r=e.near,n=e.top,o=e.right,Math.max(t*r/o,i*r/n)):Math.max(t,i)}function d(e,i,r,o,a){var l,u=a;if(!n(a)){var c=e.position,d=i,p=e.up,m=e.right,f=e.frustum,v=t.subtract(c,d,C),g=t.magnitude(t.multiplyByScalar(p,t.dot(v,p),E)),_=t.magnitude(t.multiplyByScalar(m,t.dot(v,m),E));l=Math.max(r,o),u=Math.min(.2*h(f,g,_),1e9)}if(n(a)&&u>a||u>l){var y=8,S=1e6,w=-Math.pow((u-r)*S,1/y),T=Math.pow((u-o)*S,1/y);return function(e){var t=e*(T-w)+w;return-Math.pow(t,y)/S+u}}return function(e){return s.lerp(r,o,e)}}function p(e,t){return s.equalsEpsilon(e,s.TWO_PI,s.EPSILON11)&&(e=0),t>e+Math.PI?e+=s.TWO_PI:t<e-Math.PI&&(e-=s.TWO_PI),e}function m(i,r,n,o,a,l,u){function c(t){var i=t.time/r;h.setView({orientation:{heading:s.lerp(v,o,i),pitch:s.lerp(f,a,i),roll:s.lerp(g,l,i)}}),e.lerp(m,n,i,h.position),h.position.z=_(i)}var h=i.camera,m=t.clone(h.position,S),f=h.pitch,v=p(h.heading,o),g=p(h.roll,l),_=d(h,n,m.z,n.z,u);return c}function f(e,r,n,o,a,l,u){function c(e){var i=e.time/r,n=t.fromRadians(s.lerp(v.longitude,C.longitude,i),s.lerp(v.latitude,C.latitude,i),S(i));h.setView({destination:n,orientation:{heading:s.lerp(_,o,i),pitch:s.lerp(g,a,i),roll:s.lerp(y,l,i)}})}var h=e.camera,m=e.mapProjection,f=m.ellipsoid,v=i.clone(h.positionCartographic,w),g=h.pitch,_=p(h.heading,o),y=p(h.roll,l),C=f.cartesianToCartographic(n,T);C.height<=0&&(C.height=v.height),v.longitude=s.zeroToTwoPi(v.longitude),C.longitude=s.zeroToTwoPi(C.longitude);var E=v.longitude-C.longitude;E<-s.PI?v.longitude+=s.TWO_PI:E>s.PI&&(C.longitude+=s.TWO_PI);var S=d(h,n,v.height,C.height,u);return c}function v(i,r,n,o,a,l,u){function c(t){var i=t.time/r;h.setView({orientation:{heading:s.lerp(f,o,i)}}),e.lerp(m,n,i,h.position);var a=g(i),l=h.frustum,u=l.top/l.right,c=.5*(a-(l.right-l.left));l.right+=c,l.left-=c,l.top=u*l.right,l.bottom=-l.top}var h=i.camera,m=t.clone(h.position,S),f=p(h.heading,o),v=h.frustum.right-h.frustum.left,g=d(h,n,v,n.z,u);return c}function g(e,t){return{startObject:{},stopObject:{},duration:0,complete:e,cancel:t}}function _(e,t){function i(){"function"==typeof t&&t(),e.enableInputs=!0}return i}var y={},C=new t,E=new t,S=new t,w=new i,T=new i,x=new i,b=new t;return y.createTween=function(i,o){o=r(o,r.EMPTY_OBJECT);var l=o.destination,u=i.mode;if(u===c.MORPHING)return g();var h=r(o.convert,!0),d=i.mapProjection,p=d.ellipsoid,y=o.maximumHeight,C=o.easingFunction;h&&u!==c.SCENE3D&&(p.cartesianToCartographic(l,x),l=d.project(x,b));var E=i.camera,S=o.endTransform;n(S)&&E._setTransform(S);var w=o.duration;n(w)||(w=Math.ceil(t.distance(E.position,l)/1e6)+2,w=Math.min(w,3));var T=r(o.heading,0),A=r(o.pitch,-s.PI_OVER_TWO),P=r(o.roll,0),I=i.screenSpaceCameraController;I.enableInputs=!1;var M=_(I,o.complete),D=_(I,o.cancel),R=E.frustum,O=i.mode===c.SCENE2D;if(O=O&&e.equalsEpsilon(E.position,l,s.EPSILON6),O=O&&s.equalsEpsilon(Math.max(R.right-R.left,R.top-R.bottom),l.z,s.EPSILON6),O=O||i.mode!==c.SCENE2D&&t.equalsEpsilon(l,E.position,s.EPSILON10),O=O&&s.equalsEpsilon(s.negativePiToPi(T),s.negativePiToPi(E.heading),s.EPSILON10)&&s.equalsEpsilon(s.negativePiToPi(A),s.negativePiToPi(E.pitch),s.EPSILON10)&&s.equalsEpsilon(s.negativePiToPi(P),s.negativePiToPi(E.roll),s.EPSILON10))return g(M,D);var N=new Array(4);if(N[c.SCENE2D]=v,N[c.SCENE3D]=f,N[c.COLUMBUS_VIEW]=m,0>=w){var L=function(){var e=N[u](i,1,l,T,A,P,y);e({time:1}),"function"==typeof M&&M()};return g(L,D)}var F=N[u](i,w,l,T,A,P,y);if(!n(C)){var B=E.positionCartographic.height,V=u===c.SCENE3D?p.cartesianToCartographic(l).height:l.z;C=B>V&&B>11500?a.CUBIC_OUT:a.QUINTIC_IN_OUT}return{duration:w,easingFunction:C,startObject:{time:0},stopObject:{time:w},update:F,complete:M,cancel:D}},y}),i("Scene/Camera",["../Core/Cartesian2","../Core/Cartesian3","../Core/Cartesian4","../Core/Cartographic","../Core/defaultValue","../Core/defined","../Core/defineProperties","../Core/DeveloperError","../Core/EasingFunction","../Core/Ellipsoid","../Core/EllipsoidGeodesic","../Core/Event","../Core/HeadingPitchRange","../Core/IntersectionTests","../Core/Math","../Core/Matrix3","../Core/Matrix4","../Core/Quaternion","../Core/Ray","../Core/Rectangle","../Core/Transforms","./CameraFlightPath","./PerspectiveFrustum","./SceneMode"],function(e,t,i,r,n,o,a,s,l,u,c,h,d,p,m,f,v,g,_,y,C,E,S,w){"use strict";function T(e){this._scene=e,this._transform=v.clone(v.IDENTITY),this._invTransform=v.clone(v.IDENTITY),this._actualTransform=v.clone(v.IDENTITY),this._actualInvTransform=v.clone(v.IDENTITY),this._transformChanged=!1,this.position=new t,this._position=new t,this._positionWC=new t,this._positionCartographic=new r,this.direction=new t,this._direction=new t,this._directionWC=new t,this.up=new t,this._up=new t,this._upWC=new t,this.right=new t,this._right=new t,this._rightWC=new t,this.frustum=new S,this.frustum.aspectRatio=e.drawingBufferWidth/e.drawingBufferHeight,this.frustum.fov=m.toRadians(60),this.defaultMoveAmount=1e5,this.defaultLookAmount=Math.PI/60,this.defaultRotateAmount=Math.PI/3600,this.defaultZoomAmount=1e5,this.constrainedAxis=void 0,this.maximumTranslateFactor=1.5,this.maximumZoomFactor=2.5,this._moveStart=new h,this._moveEnd=new h,this._viewMatrix=new v,this._invViewMatrix=new v,x(this),this._mode=w.SCENE3D,this._modeChanged=!0;var i=e.mapProjection;this._projection=i,this._maxCoord=i.project(new r(Math.PI,m.PI_OVER_TWO)),this._max2Dfrustum=void 0,W(this,T.DEFAULT_VIEW_RECTANGLE,this.position,!0);var n=t.magnitude(this.position);n+=n*T.DEFAULT_VIEW_FACTOR,t.normalize(this.position,this.position),t.multiplyByScalar(this.position,n,this.position)}function x(e){var i=e._right,r=e._up,n=e._direction,o=e._position,a=e._viewMatrix;a[0]=i.x,a[1]=r.x,a[2]=-n.x,a[3]=0,a[4]=i.y,a[5]=r.y,a[6]=-n.y,a[7]=0,a[8]=i.z,a[9]=r.z,a[10]=-n.z,a[11]=0,a[12]=-t.dot(i,o),a[13]=-t.dot(r,o),a[14]=t.dot(n,o),a[15]=1,v.multiply(a,e._actualInvTransform,e._viewMatrix),v.inverseTransformation(e._viewMatrix,e._invViewMatrix)}function b(e){var r=e._projection,n=r.ellipsoid,o=v.getColumn(e._transform,3,ae),a=n.cartesianToCartographic(o,re),s=r.project(a,ne),l=se;l.x=s.z,l.y=s.x,l.z=s.y,l.w=1;var u=i.add(v.getColumn(e._transform,0,oe),o,oe);n.cartesianToCartographic(u,a),r.project(a,s);var c=le;c.x=s.z,c.y=s.x,c.z=s.y,c.w=0,t.subtract(c,l,c);var h=i.add(v.getColumn(e._transform,1,oe),o,oe);n.cartesianToCartographic(h,a),r.project(a,s);var d=ue;d.x=s.z,d.y=s.x,d.z=s.y,d.w=0,t.subtract(d,l,d);var p=ce;t.cross(c,d,p),t.normalize(p,p),t.cross(d,p,c),t.normalize(c,c),t.cross(p,c,d),t.normalize(d,d),v.setColumn(e._actualTransform,0,c,e._actualTransform),v.setColumn(e._actualTransform,1,d,e._actualTransform),v.setColumn(e._actualTransform,2,p,e._actualTransform),v.setColumn(e._actualTransform,3,l,e._actualTransform)}function A(e){var r=e._projection,n=r.ellipsoid,o=v.getColumn(e._transform,3,ae),a=n.cartesianToCartographic(o,re),s=r.project(a,ne),l=se;l.x=s.z,l.y=s.x,l.z=s.y,l.w=1;var u=i.clone(i.UNIT_X,ce),c=i.add(v.getColumn(e._transform,0,oe),o,oe);n.cartesianToCartographic(c,a),r.project(a,s);var h=le;h.x=s.z,h.y=s.x,h.z=s.y,h.w=0,t.subtract(h,l,h),h.x=0;var d=ue;if(t.magnitudeSquared(h)>m.EPSILON10)t.cross(u,h,d);else{var p=i.add(v.getColumn(e._transform,1,oe),o,oe);n.cartesianToCartographic(p,a),r.project(a,s),d.x=s.z,d.y=s.x,d.z=s.y,d.w=0,t.subtract(d,l,d),d.x=0,t.magnitudeSquared(d)<m.EPSILON10&&(i.clone(i.UNIT_Y,h),i.clone(i.UNIT_Z,d))}t.cross(d,u,h),t.normalize(h,h),t.cross(u,h,d),t.normalize(d,d),v.setColumn(e._actualTransform,0,h,e._actualTransform),v.setColumn(e._actualTransform,1,d,e._actualTransform),v.setColumn(e._actualTransform,2,u,e._actualTransform),v.setColumn(e._actualTransform,3,l,e._actualTransform)}function P(e){var i=e._mode,r=!1,n=0;i===w.SCENE2D&&(n=e.frustum.right-e.frustum.left,r=n!==e._positionCartographic.height);var o=e._position,a=!t.equals(o,e.position)||r;a&&(o=t.clone(e.position,e._position));var s=e._direction,l=!t.equals(s,e.direction);l&&(s=t.clone(e.direction,e._direction));var u=e._up,c=!t.equals(u,e.up);c&&(u=t.clone(e.up,e._up));var h=e._right,d=!t.equals(h,e.right);d&&(h=t.clone(e.right,e._right));var p=e._transformChanged||e._modeChanged;e._transformChanged=!1,p&&(v.inverseTransformation(e._transform,e._invTransform),e._mode===w.COLUMBUS_VIEW||e._mode===w.SCENE2D?v.equals(v.IDENTITY,e._transform)?v.clone(T.TRANSFORM_2D,e._actualTransform):e._mode===w.COLUMBUS_VIEW?b(e):A(e):v.clone(e._transform,e._actualTransform),v.inverseTransformation(e._actualTransform,e._actualInvTransform),e._modeChanged=!1);var f=e._actualTransform;if(a||p)if(e._positionWC=v.multiplyByPoint(f,o,e._positionWC),i===w.SCENE3D||i===w.MORPHING)e._positionCartographic=e._projection.ellipsoid.cartesianToCartographic(e._positionWC,e._positionCartographic);else{var g=he;g.x=e._positionWC.y,g.y=e._positionWC.z,g.z=e._positionWC.x,i===w.SCENE2D&&(g.z=n),e._projection.unproject(g,e._positionCartographic)}if(l||c||d){var _=t.dot(s,t.cross(u,h,he));if(Math.abs(1-_)>m.EPSILON2){s=t.normalize(s,e._direction),t.clone(s,e.direction);var y=1/t.magnitudeSquared(u),C=t.dot(u,s)*y,E=t.multiplyByScalar(s,C,he);u=t.normalize(t.subtract(u,E,e._up),e._up),t.clone(u,e.up),h=t.cross(s,u,e._right),t.clone(h,e.right)}}(l||p)&&(e._directionWC=v.multiplyByPointAsVector(f,s,e._directionWC)),(c||p)&&(e._upWC=v.multiplyByPointAsVector(f,u,e._upWC)),(d||p)&&(e._rightWC=v.multiplyByPointAsVector(f,h,e._rightWC)),(a||l||c||d||p)&&x(e)}function I(e,t){ +var i;return i=m.equalsEpsilon(Math.abs(e.z),1,m.EPSILON3)?Math.atan2(t.y,t.x)-m.PI_OVER_TWO:Math.atan2(e.y,e.x)-m.PI_OVER_TWO,m.TWO_PI-m.zeroToTwoPi(i)}function M(e){return m.PI_OVER_TWO-m.acosClamped(e.z)}function D(e,t,i){var r=0;return m.equalsEpsilon(Math.abs(e.z),1,m.EPSILON3)||(r=Math.atan2(-i.z,t.z),r=m.zeroToTwoPi(r+m.TWO_PI)),r}function R(e,i,r,n,o){var a=v.clone(e.transform,_e),s=C.eastNorthUpToFixedFrame(i,e._projection.ellipsoid,ye);e._setTransform(s),t.clone(t.ZERO,e.position);var l=g.fromHeadingPitchRoll(r-m.PI_OVER_TWO,n,o,Ce),u=f.fromQuaternion(l,Ee);f.getColumn(u,0,e.direction),f.getColumn(u,2,e.up),t.cross(e.direction,e.up,e.right),e._setTransform(a)}function O(e,i,r,n,o,a){var s=v.clone(e.transform,_e);if(e._setTransform(v.IDENTITY),!t.equals(i,e.positionWC)){if(a){var l=e._projection,u=l.ellipsoid.cartesianToCartographic(i,Se);i=l.project(u,ge)}t.clone(i,e.position)}var c=g.fromHeadingPitchRoll(r-m.PI_OVER_TWO,n,o,Ce),h=f.fromQuaternion(c,Ee);f.getColumn(h,0,e.direction),f.getColumn(h,2,e.up),t.cross(e.direction,e.up,e.right),e._setTransform(s)}function N(i,r,n,o){var a=-m.PI_OVER_TWO,s=0,l=v.clone(i.transform,_e);if(i._setTransform(v.IDENTITY),!t.equals(r,i.positionWC)){if(o){var u=i._projection,c=u.ellipsoid.cartesianToCartographic(r,Se);r=u.project(c,ge)}e.clone(r,i.position);var h=.5*-r.z,d=-h,p=i.frustum;if(d>h){var _=p.top/p.right;p.right=d,p.left=h,p.top=p.right*_,p.bottom=-p.top}}var y=g.fromHeadingPitchRoll(n-m.PI_OVER_TWO,a,s,Ce),C=f.fromQuaternion(y,Ee);f.getColumn(C,2,i.up),t.cross(i.direction,i.up,i.right),i._setTransform(l)}function L(e,i,r,n){var o=t.clone(r.direction,we),a=t.clone(r.up,Te);if(e._scene.mode===w.SCENE3D){var s=e._projection.ellipsoid,l=C.eastNorthUpToFixedFrame(i,s,de),u=v.inverseTransformation(l,pe);v.multiplyByPointAsVector(u,o,o),v.multiplyByPointAsVector(u,a,a)}var c=t.cross(o,a,xe);return n.heading=I(o,a),n.pitch=M(o),n.roll=D(o,a,c),n}function F(e,t){var i=e._maxCoord.x*e.maximumTranslateFactor;t.x>i&&(t.x=i),t.x<-i&&(t.x=-i);var r=e._maxCoord.y*e.maximumTranslateFactor;t.y>r&&(t.y=r),t.y<-r&&(t.y=-r)}function B(e,i){var r=e.position,n=t.normalize(r,Re);if(o(e.constrainedAxis)){var a=t.equalsEpsilon(n,e.constrainedAxis,m.EPSILON2),s=t.equalsEpsilon(n,t.negate(e.constrainedAxis,Le),m.EPSILON2);if(a||s)(a&&0>i||s&&i>0)&&e.rotate(e.right,i);else{var l=t.normalize(e.constrainedAxis,Oe),u=t.dot(n,l),c=m.acosClamped(u);i>0&&i>c&&(i=c-m.EPSILON4),u=t.dot(n,t.negate(l,Le)),c=m.acosClamped(u),0>i&&-i>c&&(i=-c+m.EPSILON4);var h=t.cross(l,n,Ne);e.rotate(h,i)}}else e.rotate(e.right,i)}function V(e,t){o(e.constrainedAxis)?e.rotate(e.constrainedAxis,t):e.rotate(e.up,t)}function k(e,t){var i=e.frustum;t=.5*t;var r=i.right-t,n=i.left+t,o=e._maxCoord.x*e.maximumZoomFactor;r>o&&(r=o,n=-o),n>=r&&(r=1,n=-1);var a=i.top/i.right;i.right=r,i.left=n,i.top=i.right*a,i.bottom=-i.top}function z(e,t){e.move(e.direction,t)}function U(e,i,r){i=m.clamp(i,-m.PI_OVER_TWO,m.PI_OVER_TWO),e=m.zeroToTwoPi(e)-m.PI_OVER_TWO;var n=g.fromAxisAngle(t.UNIT_Y,-i,Ve),o=g.fromAxisAngle(t.UNIT_Z,-e,ke),a=g.multiply(o,n,o),s=f.fromQuaternion(a,ze),l=t.clone(t.UNIT_X,Be);return f.multiplyByVector(s,l,l),t.negate(l,l),t.multiplyByScalar(l,r,l),l}function G(e,i,r,n){var o=Math.abs(t.dot(i,r));return o/n-t.dot(e,r)}function W(e,i,r,n){var a=e._projection.ellipsoid,s=n?e:Je,l=i.north,u=i.south,h=i.east,d=i.west;d>h&&(h+=m.TWO_PI);var p,f=.5*(d+h);if(u<-m.PI_OVER_TWO+m.RADIANS_PER_DEGREE&&l>m.PI_OVER_TWO-m.RADIANS_PER_DEGREE)p=0;else{var v=Ge;v.longitude=f,v.latitude=l,v.height=0;var g=We;g.longitude=f,g.latitude=u,g.height=0;var _=Ue;o(_)&&_.ellipsoid===a||(Ue=_=new c(void 0,void 0,a)),_.setEndPoints(v,g),p=_.interpolateUsingFraction(.5,Ge).latitude}var y=Ge;y.longitude=f,y.latitude=p,y.height=0;var C=a.cartographicToCartesian(y,Ke),E=Ge;E.longitude=h,E.latitude=l;var S=a.cartographicToCartesian(E,He);E.longitude=d;var w=a.cartographicToCartesian(E,je);E.longitude=f;var T=a.cartographicToCartesian(E,Xe);E.latitude=u;var x=a.cartographicToCartesian(E,Ze);E.longitude=h;var b=a.cartographicToCartesian(E,Ye);E.longitude=d;var A=a.cartographicToCartesian(E,qe);t.subtract(w,C,w),t.subtract(b,C,b),t.subtract(S,C,S),t.subtract(A,C,A),t.subtract(T,C,T),t.subtract(x,C,x);var P=a.geodeticSurfaceNormal(C,s.direction);t.negate(P,P);var I=t.cross(P,t.UNIT_Z,s.right);t.normalize(I,I);var M=t.cross(I,P,s.up),D=Math.tan(.5*e.frustum.fovy),R=e.frustum.aspectRatio*D,O=Math.max(G(P,M,w,D),G(P,M,b,D),G(P,M,S,D),G(P,M,A,D),G(P,M,T,D),G(P,M,x,D),G(P,I,w,R),G(P,I,b,R),G(P,I,S,R),G(P,I,A,R),G(P,I,T,R),G(P,I,x,R));if(0>u&&l>0){var N=Ge;N.longitude=d,N.latitude=0,N.height=0;var L=a.cartographicToCartesian(N,Qe);t.subtract(L,C,L),O=Math.max(O,G(P,M,L,D),G(P,I,L,R)),N.longitude=h,L=a.cartographicToCartesian(N,Qe),t.subtract(L,C,L),O=Math.max(O,G(P,M,L,D),G(P,I,L,R))}return t.add(C,t.multiplyByScalar(P,-O,Qe),r)}function H(e,t,i){var r=e._projection;t.west>t.east&&(t=y.MAX_VALUE);var n=e._actualTransform,o=e._actualInvTransform,a=$e;a.longitude=t.east,a.latitude=t.north;var s=r.project(a,et);v.multiplyByPoint(n,s,s),v.multiplyByPoint(o,s,s),a.longitude=t.west,a.latitude=t.south;var l=r.project(a,tt);v.multiplyByPoint(n,l,l),v.multiplyByPoint(o,l,l);var u=Math.tan(.5*e.frustum.fovy),c=e.frustum.aspectRatio*u;return i.x=.5*(s.x-l.x)+l.x,i.y=.5*(s.y-l.y)+l.y,i.z=.5*Math.max((s.x-l.x)/c,(s.y-l.y)/u),i}function q(e,t,i){var r=e._projection;t.west>t.east&&(t=y.MAX_VALUE);var n=it;n.longitude=t.east,n.latitude=t.north;var o=r.project(n,rt);n.longitude=t.west,n.latitude=t.south;var a,s,l=r.project(n,nt),u=.5*Math.abs(o.x-l.x),c=.5*Math.abs(o.y-l.y),h=e.frustum.right/e.frustum.top,d=c*h;return u>d?(a=u,s=a/h):(s=c,a=d),c=Math.max(2*a,2*s),i.x=.5*(o.x-l.x)+l.x,i.y=.5*(o.y-l.y)+l.y,n=r.unproject(i,n),n.height=c,i=r.project(n,i)}function j(e,t,i,r){i=n(i,u.WGS84);var o=e.getPickRay(t,ot),a=p.rayEllipsoid(o,i);if(a){var s=a.start>0?a.start:a.stop;return _.getPoint(o,s,r)}}function Y(e,t,i,r){var n=e.getPickRay(t,at),o=n.origin;o.z=0;var a=i.unproject(o);return a.latitude<-m.PI_OVER_TWO||a.latitude>m.PI_OVER_TWO||a.longitude<-Math.PI||a.longitude>Math.PI?void 0:i.ellipsoid.cartographicToCartesian(a,r)}function X(e,i,r,n){var o=e.getPickRay(i,st),a=-o.origin.x/o.direction.x;_.getPoint(o,a,n);var s=r.unproject(new t(n.y,n.z,0));return s.latitude<-m.PI_OVER_TWO||s.latitude>m.PI_OVER_TWO||s.longitude<-Math.PI||s.longitude>Math.PI?void 0:r.ellipsoid.cartographicToCartesian(s,n)}function Z(e,i,r){var n=e._scene.canvas,o=n.clientWidth,a=n.clientHeight,s=Math.tan(.5*e.frustum.fovy),l=e.frustum.aspectRatio*s,u=e.frustum.near,c=2/o*i.x-1,h=2/a*(a-i.y)-1,d=e.positionWC;t.clone(d,r.origin);var p=t.multiplyByScalar(e.directionWC,u,lt);t.add(d,p,p);var m=t.multiplyByScalar(e.rightWC,c*u*l,ut),f=t.multiplyByScalar(e.upWC,h*u*s,ct),v=t.add(p,m,r.direction);return t.add(v,f,v),t.subtract(v,d,v),t.normalize(v,v),r}function K(e,i,r){var n=e._scene.canvas,o=n.clientWidth,a=n.clientHeight,s=2/o*i.x-1;s*=.5*(e.frustum.right-e.frustum.left);var l=2/a*(a-i.y)-1;l*=.5*(e.frustum.top-e.frustum.bottom);var u=r.origin;return t.clone(e.position,u),t.multiplyByScalar(e.right,s,ht),t.add(ht,u,u),t.multiplyByScalar(e.up,l,ht),t.add(ht,u,u),t.clone(e.directionWC,r.direction),r}function Q(e,i){var r=e.position,n=r.x<-e._maxCoord.x||r.x>e._maxCoord.x,o=r.y<-e._maxCoord.y||r.y>e._maxCoord.y,a=n||o,s=e.frustum,u=s.top,c=s.bottom,h=s.right,d=s.left,p=e._max2Dfrustum,f=h>e._max2Dfrustum.right;if(a||f){var v=t.clone(r);v.x>e._maxCoord.x?v.x=e._maxCoord.x:v.x<-e._maxCoord.x&&(v.x=-e._maxCoord.x),v.y>e._maxCoord.y?v.y=e._maxCoord.y:v.y<-e._maxCoord.y&&(v.y=-e._maxCoord.y);var g=function(i){a&&(e.position=t.lerp(r,v,i.time,e.position)),f&&(e.frustum.top=m.lerp(u,p.top,i.time),e.frustum.bottom=m.lerp(c,p.bottom,i.time),e.frustum.right=m.lerp(h,p.right,i.time),e.frustum.left=m.lerp(d,p.left,i.time))};return{easingFunction:l.EXPONENTIAL_OUT,startObject:{time:0},stopObject:{time:1},duration:i,update:g}}}function J(e,i,r,n,o,a){function s(r){var n=t.lerp(i,u,r.time,new t);e.worldToCameraCoordinatesPoint(n,e.position)}var u=t.clone(i);return r.y>n?u.y-=r.y-n:r.y<-n&&(u.y+=-n-r.y),r.z>o?u.z-=r.z-o:r.z<-o&&(u.z+=-o-r.z),{easingFunction:l.EXPONENTIAL_OUT,startObject:{time:0},stopObject:{time:1},duration:a,update:s}}function $(e,i){var r=e.position,n=e.direction,o=e.worldToCameraCoordinatesVector(t.UNIT_X,ft),a=-t.dot(o,r)/t.dot(o,n),s=t.add(r,t.multiplyByScalar(n,a,vt),vt);e.cameraToWorldCoordinatesPoint(s,s),r=e.cameraToWorldCoordinatesPoint(e.position,gt);var l=Math.tan(.5*e.frustum.fovy),u=e.frustum.aspectRatio*l,c=t.magnitude(t.subtract(r,s,_t)),h=u*c,d=l*c,p=e._maxCoord.x,m=e._maxCoord.y,f=Math.max(h-p,p),v=Math.max(d-m,m);if(r.z<-f||r.z>f||r.y<-v||r.y>v){var g=s.y<-f||s.y>f,_=s.z<-v||s.z>v;if(g||_)return J(e,r,s,f,v,i)}}function ee(e,t){var i=e.frustum,r=Math.tan(.5*i.fovy),n=i.aspectRatio*r;return Math.max(t/n,t/r)}function te(e,t){var i,r,n=e.frustum,o=n.right/n.top,a=t*o;return t>a?(i=t,r=i/o):(r=t,i=a),1.5*Math.max(i,r)}function ie(e,t,i){o(i)||(i=d.clone(Et));var r=i.range;if(!o(r)||0===r){var n=t.radius;0===n?i.range=St:i.range=e._mode===w.SCENE2D?te(e,n):ee(e,n)}return i}T.TRANSFORM_2D=new v(0,0,1,0,1,0,0,0,0,1,0,0,0,0,0,1),T.TRANSFORM_2D_INVERSE=v.inverseTransformation(T.TRANSFORM_2D,new v),T.DEFAULT_VIEW_RECTANGLE=y.fromDegrees(-95,-20,-70,90),T.DEFAULT_VIEW_FACTOR=.5;var re=new r,ne=new t,oe=new t,ae=new i,se=new i,le=new i,ue=new i,ce=new i,he=new t,de=new v,pe=new v;a(T.prototype,{transform:{get:function(){return this._transform}},inverseTransform:{get:function(){return P(this),this._invTransform}},viewMatrix:{get:function(){return P(this),this._viewMatrix}},inverseViewMatrix:{get:function(){return P(this),this._invViewMatrix}},positionCartographic:{get:function(){return P(this),this._positionCartographic}},positionWC:{get:function(){return P(this),this._positionWC}},directionWC:{get:function(){return P(this),this._directionWC}},upWC:{get:function(){return P(this),this._upWC}},rightWC:{get:function(){return P(this),this._rightWC}},heading:{get:function(){if(this._mode!==w.MORPHING){var e=this._projection.ellipsoid,t=v.clone(this._transform,de),i=C.eastNorthUpToFixedFrame(this.positionWC,e,pe);this._setTransform(i);var r=I(this.direction,this.up);return this._setTransform(t),r}}},pitch:{get:function(){if(this._mode!==w.MORPHING){var e=this._projection.ellipsoid,t=v.clone(this._transform,de),i=C.eastNorthUpToFixedFrame(this.positionWC,e,pe);this._setTransform(i);var r=M(this.direction);return this._setTransform(t),r}}},roll:{get:function(){if(this._mode!==w.MORPHING){var e=this._projection.ellipsoid,t=v.clone(this._transform,de),i=C.eastNorthUpToFixedFrame(this.positionWC,e,pe);this._setTransform(i);var r=D(this.direction,this.up,this.right);return this._setTransform(t),r}}},moveStart:{get:function(){return this._moveStart}},moveEnd:{get:function(){return this._moveEnd}}}),T.prototype.update=function(e){var t=!1;if(e!==this._mode&&(this._mode=e,this._modeChanged=e!==w.MORPHING,t=this._mode===w.SCENE2D),t){var i=this._max2Dfrustum=this.frustum.clone(),r=2,n=i.top/i.right;i.right=this._maxCoord.x*r,i.left=-i.right,i.top=n*i.right,i.bottom=-i.top}};var me=new t,fe=new t,ve=new t;T.prototype._setTransform=function(e){var i=t.clone(this.positionWC,me),r=t.clone(this.upWC,fe),n=t.clone(this.directionWC,ve);v.clone(e,this._transform),this._transformChanged=!0,P(this);var o=this._actualInvTransform;v.multiplyByPoint(o,i,this.position),v.multiplyByPointAsVector(o,n,this.direction),v.multiplyByPointAsVector(o,r,this.up),t.cross(this.direction,this.up,this.right),P(this)};var ge=new t,_e=new v,ye=new v,Ce=new g,Ee=new f,Se=new r,we=new t,Te=new t,xe=new t,be={destination:void 0,orientation:{direction:void 0,up:void 0,heading:void 0,pitch:void 0,roll:void 0},endTransform:void 0};T.prototype.setView=function(e){e=n(e,n.EMPTY_OBJECT);var i=n(e.orientation,n.EMPTY_OBJECT),r=this._mode;if(r!==w.MORPHING){o(e.endTransform)&&this._setTransform(e.endTransform);var a=!0,s=n(e.destination,t.clone(this.positionWC,ge));o(s)&&o(s.west)&&(s=this.getRectangleCameraCoordinates(s,ge),a=!1),o(i.direction)&&(i=L(this,s,i,be.orientation));var l=n(i.heading,0),u=n(i.pitch,-m.PI_OVER_TWO),c=n(i.roll,0);r===w.SCENE3D?R(this,s,l,u,c):r===w.SCENE2D?N(this,s,l,a):O(this,s,l,u,c,a)}},T.prototype.worldToCameraCoordinates=function(e,t){return o(t)||(t=new i),P(this),v.multiplyByVector(this._actualInvTransform,e,t)},T.prototype.worldToCameraCoordinatesPoint=function(e,i){return o(i)||(i=new t),P(this),v.multiplyByPoint(this._actualInvTransform,e,i)},T.prototype.worldToCameraCoordinatesVector=function(e,i){return o(i)||(i=new t),P(this),v.multiplyByPointAsVector(this._actualInvTransform,e,i)},T.prototype.cameraToWorldCoordinates=function(e,t){return o(t)||(t=new i),P(this),v.multiplyByVector(this._actualTransform,e,t)},T.prototype.cameraToWorldCoordinatesPoint=function(e,i){return o(i)||(i=new t),P(this),v.multiplyByPoint(this._actualTransform,e,i)},T.prototype.cameraToWorldCoordinatesVector=function(e,i){return o(i)||(i=new t),P(this),v.multiplyByPointAsVector(this._actualTransform,e,i)};var Ae=new t;T.prototype.move=function(e,i){var r=this.position;t.multiplyByScalar(e,i,Ae),t.add(r,Ae,r),this._mode===w.SCENE2D&&F(this,r)},T.prototype.moveForward=function(e){e=n(e,this.defaultMoveAmount),this.move(this.direction,e)},T.prototype.moveBackward=function(e){e=n(e,this.defaultMoveAmount),this.move(this.direction,-e)},T.prototype.moveUp=function(e){e=n(e,this.defaultMoveAmount),this.move(this.up,e)},T.prototype.moveDown=function(e){e=n(e,this.defaultMoveAmount),this.move(this.up,-e)},T.prototype.moveRight=function(e){e=n(e,this.defaultMoveAmount),this.move(this.right,e)},T.prototype.moveLeft=function(e){e=n(e,this.defaultMoveAmount),this.move(this.right,-e)},T.prototype.lookLeft=function(e){e=n(e,this.defaultLookAmount),this.look(this.up,-e)},T.prototype.lookRight=function(e){e=n(e,this.defaultLookAmount),this.look(this.up,e)},T.prototype.lookUp=function(e){e=n(e,this.defaultLookAmount),this.look(this.right,-e)},T.prototype.lookDown=function(e){e=n(e,this.defaultLookAmount),this.look(this.right,e)};var Pe=new g,Ie=new f;T.prototype.look=function(e,t){var i=n(t,this.defaultLookAmount),r=g.fromAxisAngle(e,-i,Pe),o=f.fromQuaternion(r,Ie),a=this.direction,s=this.up,l=this.right;f.multiplyByVector(o,a,a),f.multiplyByVector(o,s,s),f.multiplyByVector(o,l,l)},T.prototype.twistLeft=function(e){e=n(e,this.defaultLookAmount),this.look(this.direction,e)},T.prototype.twistRight=function(e){e=n(e,this.defaultLookAmount),this.look(this.direction,-e)};var Me=new g,De=new f;T.prototype.rotate=function(e,i){var r=n(i,this.defaultRotateAmount),o=g.fromAxisAngle(e,-r,Me),a=f.fromQuaternion(o,De);f.multiplyByVector(a,this.position,this.position),f.multiplyByVector(a,this.direction,this.direction),f.multiplyByVector(a,this.up,this.up),t.cross(this.direction,this.up,this.right),t.cross(this.right,this.direction,this.up)},T.prototype.rotateDown=function(e){e=n(e,this.defaultRotateAmount),B(this,e)},T.prototype.rotateUp=function(e){e=n(e,this.defaultRotateAmount),B(this,-e)};var Re=new t,Oe=new t,Ne=new t,Le=new t;T.prototype.rotateRight=function(e){e=n(e,this.defaultRotateAmount),V(this,-e)},T.prototype.rotateLeft=function(e){e=n(e,this.defaultRotateAmount),V(this,e)},T.prototype.zoomIn=function(e){e=n(e,this.defaultZoomAmount),this._mode===w.SCENE2D?k(this,e):z(this,e)},T.prototype.zoomOut=function(e){e=n(e,this.defaultZoomAmount),this._mode===w.SCENE2D?k(this,-e):z(this,-e)},T.prototype.getMagnitude=function(){return this._mode===w.SCENE3D?t.magnitude(this.position):this._mode===w.COLUMBUS_VIEW?Math.abs(this.position.z):this._mode===w.SCENE2D?Math.max(this.frustum.right-this.frustum.left,this.frustum.top-this.frustum.bottom):void 0};var Fe=new v;T.prototype.lookAt=function(e,t){var i=C.eastNorthUpToFixedFrame(e,u.WGS84,Fe);this.lookAtTransform(i,t)};var Be=new t,Ve=new g,ke=new g,ze=new f;T.prototype.lookAtTransform=function(i,r){if(this._setTransform(i),o(r)){var n;if(n=o(r.heading)?U(r.heading,r.pitch,r.range):r,this._mode===w.SCENE2D){e.clone(e.ZERO,this.position),t.negate(n,this.up),this.up.z=0,t.magnitudeSquared(this.up)<m.EPSILON10&&t.clone(t.UNIT_Y,this.up),t.normalize(this.up,this.up),this._setTransform(v.IDENTITY),t.negate(t.UNIT_Z,this.direction),t.cross(this.direction,this.up,this.right),t.normalize(this.right,this.right);var a=this.frustum,s=a.top/a.right;return a.right=.5*t.magnitude(n),a.left=-a.right,a.top=s*a.right,a.bottom=-a.top,void this._setTransform(i)}t.clone(n,this.position),t.negate(this.position,this.direction),t.normalize(this.direction,this.direction),t.cross(this.direction,t.UNIT_Z,this.right),t.magnitudeSquared(this.right)<m.EPSILON10&&t.clone(t.UNIT_X,this.right),t.normalize(this.right,this.right),t.cross(this.right,this.direction,this.up),t.normalize(this.up,this.up)}};var Ue,Ge=new r,We=new r,He=new t,qe=new t,je=new t,Ye=new t,Xe=new t,Ze=new t,Ke=new t,Qe=new t,Je={direction:new t,right:new t,up:new t},$e=new r,et=new t,tt=new t,it=new r,rt=new t,nt=new t;T.prototype.getRectangleCameraCoordinates=function(e,i){var r=this._mode;return o(i)||(i=new t),r===w.SCENE3D?W(this,e,i):r===w.COLUMBUS_VIEW?H(this,e,i):r===w.SCENE2D?q(this,e,i):void 0};var ot=new _,at=new _,st=new _;T.prototype.pickEllipsoid=function(e,i,r){if(o(r)||(r=new t),i=n(i,u.WGS84),this._mode===w.SCENE3D)r=j(this,e,i,r);else if(this._mode===w.SCENE2D)r=Y(this,e,this._projection,r);else{if(this._mode!==w.COLUMBUS_VIEW)return;r=X(this,e,this._projection,r)}return r};var lt=new t,ut=new t,ct=new t,ht=new t;T.prototype.getPickRay=function(e,t){o(t)||(t=new _);var i=this.frustum;return o(i.aspectRatio)&&o(i.fov)&&o(i.near)?Z(this,e,t):K(this,e,t)};var dt=new t,pt=new t;T.prototype.distanceToBoundingSphere=function(e){var i=t.subtract(this.positionWC,e.center,dt),r=t.multiplyByScalar(this.directionWC,t.dot(i,this.directionWC),pt);return Math.max(0,t.magnitude(r)-e.radius)};var mt=new e;T.prototype.getPixelSize=function(e,t,i){var r=this.distanceToBoundingSphere(e),n=this.frustum.getPixelDimensions(t,i,r,mt);return Math.max(n.x,n.y)};var ft=new t,vt=new t,gt=new t,_t=new t;T.prototype.createCorrectPositionTween=function(e){return this._mode===w.SCENE2D?Q(this,e):this._mode===w.COLUMBUS_VIEW?$(this,e):void 0};var yt=new t,Ct={destination:void 0,heading:void 0,pitch:void 0,roll:void 0,duration:void 0,complete:void 0,cancel:void 0,endTransform:void 0,maximumHeight:void 0,easingFunction:void 0};T.prototype.flyTo=function(e){e=n(e,n.EMPTY_OBJECT);var t=e.destination,i=this._mode;if(i!==w.MORPHING){var r=n(e.orientation,n.EMPTY_OBJECT);if(o(r.direction)&&(r=L(this,t,r,be.orientation)),o(e.duration)&&e.duration<=0){var a=be;return a.destination=e.destination,a.orientation.heading=r.heading,a.orientation.pitch=r.pitch,a.orientation.roll=r.roll,a.endTransform=e.endTransform,this.setView(a),void("function"==typeof e.complete&&e.complete())}var s=o(t.west);s&&(t=this.getRectangleCameraCoordinates(t,yt)),Ct.destination=t,Ct.heading=r.heading,Ct.pitch=r.pitch,Ct.roll=r.roll,Ct.duration=e.duration,Ct.complete=e.complete,Ct.cancel=e.cancel,Ct.endTransform=e.endTransform,Ct.convert=s?!1:e.convert,Ct.maximumHeight=e.maximumHeight,Ct.easingFunction=e.easingFunction;var l=this._scene;l.tweens.add(E.createTween(l,Ct))}};var Et=new d(0,-m.PI_OVER_FOUR,0),St=100;T.prototype.viewBoundingSphere=function(e,t){if(this._mode===w.MORPHING)throw new s("viewBoundingSphere is not supported while morphing.");t=ie(this,e,t),this.lookAt(e.center,t)};var wt=new v,Tt=new t,xt=new t,bt=new t,At=new t,Pt=new i,It=new g,Mt=new f;return T.prototype.flyToBoundingSphere=function(e,i){i=n(i,n.EMPTY_OBJECT);var r=this._mode===w.SCENE2D||this._mode===w.COLUMBUS_VIEW;this._setTransform(v.IDENTITY);var o,a=ie(this,e,i.offset);o=r?t.multiplyByScalar(t.UNIT_Z,a.range,Tt):U(a.heading,a.pitch,a.range);var s=C.eastNorthUpToFixedFrame(e.center,u.WGS84,wt);v.multiplyByPoint(s,o,o);var l,c;if(!r){if(l=t.subtract(e.center,o,xt),t.normalize(l,l),c=v.multiplyByPointAsVector(s,t.UNIT_Z,bt),1-Math.abs(t.dot(l,c))<m.EPSILON6){var h=g.fromAxisAngle(l,a.heading,It),d=f.fromQuaternion(h,Mt);t.fromCartesian4(v.getColumn(s,1,Pt),c),f.multiplyByVector(d,c,c)}var p=t.cross(l,c,At);t.cross(p,l,c),t.normalize(c,c)}this.flyTo({destination:o,orientation:{direction:l,up:c},duration:i.duration,complete:i.complete,cancel:i.cancel,endTransform:i.endTransform,maximumHeight:i.maximumHeight,easingFunction:i.easingFunction})},T.clone=function(e,i){return o(i)||(i=new T(e._scene)),t.clone(e.position,i.position),t.clone(e.direction,i.direction),t.clone(e.up,i.up),t.clone(e.right,i.right),v.clone(e._transform,i.transform),i},T}),i("Scene/CameraEventType",["../Core/freezeObject"],function(e){"use strict";var t={LEFT_DRAG:0,RIGHT_DRAG:1,MIDDLE_DRAG:2,WHEEL:3,PINCH:4};return e(t)}),i("Scene/CameraEventAggregator",["../Core/Cartesian2","../Core/defined","../Core/defineProperties","../Core/destroyObject","../Core/DeveloperError","../Core/KeyboardEventModifier","../Core/Math","../Core/ScreenSpaceEventHandler","../Core/ScreenSpaceEventType","./CameraEventType"],function(e,t,i,r,n,o,a,s,l,u){"use strict";function c(e,i){var r=e;return t(i)&&(r+="+"+i),r}function h(t,i){e.clone(t.distance.startPosition,i.distance.startPosition),e.clone(t.distance.endPosition,i.distance.endPosition),e.clone(t.angleAndHeight.startPosition,i.angleAndHeight.startPosition),e.clone(t.angleAndHeight.endPosition,i.angleAndHeight.endPosition)}function d(i,r,n){var o=c(u.PINCH,r),a=i._update,s=i._isDown,d=i._eventStartPosition,p=i._pressTime,m=i._releaseTime;a[o]=!0,s[o]=!1,d[o]=new e;var f=i._movement[o];t(f)||(f=i._movement[o]={}),f.distance={startPosition:new e,endPosition:new e},f.angleAndHeight={startPosition:new e,endPosition:new e},f.prevAngle=0,i._eventHandler.setInputAction(function(e){i._buttonsDown++,s[o]=!0,p[o]=new Date},l.PINCH_START,r),i._eventHandler.setInputAction(function(){i._buttonsDown=Math.max(i._buttonsDown-1,0),s[o]=!1,m[o]=new Date},l.PINCH_END,r),i._eventHandler.setInputAction(function(t){if(s[o]&&n.clientWidth>0&&n.clientHeight>0){a[o]?(h(t,f),a[o]=!1,f.prevAngle=f.angleAndHeight.startPosition.x):(e.clone(t.distance.endPosition,f.distance.endPosition),e.clone(t.angleAndHeight.endPosition,f.angleAndHeight.endPosition));for(var i=f.angleAndHeight.endPosition.x,r=f.prevAngle,l=2*Math.PI;i>=r+Math.PI;)i-=l;for(;i<r-Math.PI;)i+=l;f.angleAndHeight.endPosition.x=-i*n.clientWidth/12,f.angleAndHeight.startPosition.x=-r*n.clientWidth/12}},l.PINCH_MOVE,r)}function p(i,r){var n=c(u.WHEEL,r),o=i._update;o[n]=!0;var s=i._movement[n];t(s)||(s=i._movement[n]={}),s.startPosition=new e,s.endPosition=new e,i._eventHandler.setInputAction(function(t){var i=15*a.toRadians(t);o[n]?(e.clone(e.ZERO,s.startPosition),s.endPosition.x=0,s.endPosition.y=i,o[n]=!1):s.endPosition.y=s.endPosition.y+i},l.WHEEL,r)}function m(i,r,n){var o=c(n,r),a=i._isDown,s=i._eventStartPosition,h=i._pressTime,d=i._releaseTime;a[o]=!1,s[o]=new e;var p=i._lastMovement[o];t(p)||(p=i._lastMovement[o]={startPosition:new e,endPosition:new e,valid:!1});var m,f;n===u.LEFT_DRAG?(m=l.LEFT_DOWN,f=l.LEFT_UP):n===u.RIGHT_DRAG?(m=l.RIGHT_DOWN,f=l.RIGHT_UP):n===u.MIDDLE_DRAG&&(m=l.MIDDLE_DOWN,f=l.MIDDLE_UP),i._eventHandler.setInputAction(function(t){i._buttonsDown++,p.valid=!1,a[o]=!0,h[o]=new Date,e.clone(t.position,s[o])},m,r),i._eventHandler.setInputAction(function(){i._buttonsDown=Math.max(i._buttonsDown-1,0),a[o]=!1,d[o]=new Date},f,r)}function f(t,i){e.clone(t.startPosition,i.startPosition),e.clone(t.endPosition,i.endPosition)}function v(i,r){var n=i._update,o=i._movement,a=i._lastMovement,s=i._isDown;for(var h in u)if(u.hasOwnProperty(h)){var d=u[h];if(t(d)){var p=c(d,r);n[p]=!0,t(i._lastMovement[p])||(i._lastMovement[p]={startPosition:new e,endPosition:new e,valid:!1}),t(i._movement[p])||(i._movement[p]={startPosition:new e,endPosition:new e})}}i._eventHandler.setInputAction(function(l){for(var h in u)if(u.hasOwnProperty(h)){var d=u[h];if(t(d)){var p=c(d,r);s[p]&&(n[p]?(f(o[p],a[p]),a[p].valid=!0,f(l,o[p]),n[p]=!1):e.clone(l.endPosition,o[p].endPosition))}}e.clone(l.endPosition,i._currentMousePosition)},l.MOUSE_MOVE,r)}function g(i){this._eventHandler=new s(i,!0),this._update={},this._movement={},this._lastMovement={},this._isDown={},this._eventStartPosition={},this._pressTime={},this._releaseTime={},this._buttonsDown=0,this._currentMousePosition=new e,p(this,void 0),d(this,void 0,i),m(this,void 0,u.LEFT_DRAG),m(this,void 0,u.RIGHT_DRAG),m(this,void 0,u.MIDDLE_DRAG),v(this,void 0);for(var r in o)if(o.hasOwnProperty(r)){var n=o[r];t(n)&&(p(this,n),d(this,n,i),m(this,n,u.LEFT_DRAG),m(this,n,u.RIGHT_DRAG),m(this,n,u.MIDDLE_DRAG),v(this,n))}}return i(g.prototype,{currentMousePosition:{get:function(){return this._currentMousePosition}},anyButtonDown:{get:function(){var e=!(this._update[c(u.WHEEL)]&&this._update[c(u.WHEEL,o.SHIFT)]&&this._update[c(u.WHEEL,o.CTRL)]&&this._update[c(u.WHEEL,o.ALT)]);return this._buttonsDown>0||e}}}),g.prototype.isMoving=function(e,t){var i=c(e,t);return!this._update[i]},g.prototype.getMovement=function(e,t){var i=c(e,t),r=this._movement[i];return r},g.prototype.getLastMovement=function(e,t){var i=c(e,t),r=this._lastMovement[i];return r.valid?r:void 0},g.prototype.isButtonDown=function(e,t){var i=c(e,t);return this._isDown[i]},g.prototype.getStartMousePosition=function(e,t){if(e===u.WHEEL||e===u.PINCH)return this._currentMousePosition;var i=c(e,t);return this._eventStartPosition[i]},g.prototype.getButtonPressTime=function(e,t){var i=c(e,t);return this._pressTime[i]},g.prototype.getButtonReleaseTime=function(e,t){var i=c(e,t);return this._releaseTime[i]},g.prototype.reset=function(){for(var e in this._update)this._update.hasOwnProperty(e)&&(this._update[e]=!0)},g.prototype.isDestroyed=function(){return!1},g.prototype.destroy=function(){return this._eventHandler=this._eventHandler&&this._eventHandler.destroy(),r(this)},g}),i("Scene/UrlTemplateImageryProvider",["../Core/Cartesian2","../Core/Cartesian3","../Core/Cartographic","../Core/combine","../Core/Credit","../Core/defaultValue","../Core/defined","../Core/defineProperties","../Core/DeveloperError","../Core/Event","../Core/freezeObject","../Core/GeographicTilingScheme","../Core/loadJson","../Core/loadText","../Core/loadWithXhr","../Core/loadXML","../Core/Math","../Core/Rectangle","../Core/TileProviderError","../Core/WebMercatorTilingScheme","../ThirdParty/when","./ImageryProvider"],function(e,t,i,r,n,o,a,s,l,u,c,h,d,p,m,f,v,g,_,y,C,E){"use strict";function S(e){this._errorEvent=new u,this._url=void 0,this._pickFeaturesUrl=void 0,this._proxy=void 0,this._tileWidth=void 0,this._tileHeight=void 0,this._maximumLevel=void 0,this._minimumLevel=void 0,this._tilingScheme=void 0,this._rectangle=void 0,this._tileDiscardPolicy=void 0,this._credit=void 0,this._hasAlphaChannel=void 0,this._readyPromise=void 0,this._withCredentials=o(e.withCredentials,void 0),this._headers=o(e.headers,void 0),this.enablePickFeatures=!0,this.reinitialize(e)}function w(e,t,i,r){return re=!1,oe=!1,x(e,e._urlParts,function(n){return n(e,t,i,r)})}function T(e,t,i,r,n,o,a){return re=!1,oe=!1,se=!1,ce=!1,x(e,e._pickFeaturesUrlParts,function(s){return s(e,t,i,r,n,o,a)})}function x(e,t,i){for(var r="",n=0;n<t.length;++n){var o=t[n];r+="string"==typeof o?o:encodeURIComponent(i(o))}var s=e._proxy;return a(s)&&(r=s.getURL(r)),r}function b(e,t){if(a(e)){for(var i,r,n=[],o=0,s=Object.keys(t);o<e.length;){i=Number.MAX_VALUE,r=void 0;for(var l=0;l<s.length;++l){var u=e.indexOf(s[l],o);u>=0&&i>u&&(i=u,r=s[l])}a(r)?(i>o&&n.push(e.substring(o,i)),n.push(t[r]),o=i+r.length):(n.push(e.substring(o)),o=e.length)}return n}}function A(e,t,i,r){return t}function P(e,t,i,r){return e.tilingScheme.getNumberOfXTilesAtLevel(r)-t-1}function I(e,t,i,r){return i}function M(e,t,i,r){return e.tilingScheme.getNumberOfYTilesAtLevel(r)-i-1}function D(e,t,i,r){var n=e.maximumLevel;return a(n)&&n>r?n-r-1:r}function R(e,t,i,r){return r}function O(e,t,i,r){var n=(t+i+r)%e._subdomains.length;return e._subdomains[n]}function N(e,t,i,r){re||(e.tilingScheme.tileXYToRectangle(t,i,r,ne),ne.west=v.toDegrees(ne.west),ne.south=v.toDegrees(ne.south),ne.east=v.toDegrees(ne.east),ne.north=v.toDegrees(ne.north),re=!0)}function L(e,t,i,r){return N(e,t,i,r),ne.west}function F(e,t,i,r){return N(e,t,i,r),ne.south}function B(e,t,i,r){return N(e,t,i,r),ne.east}function V(e,t,i,r){return N(e,t,i,r),ne.north}function k(e,t,i,r){oe||(e.tilingScheme.tileXYToNativeRectangle(t,i,r,ae),oe=!0)}function z(e,t,i,r){return k(e,t,i,r),ae.west}function U(e,t,i,r){return k(e,t,i,r),ae.south}function G(e,t,i,r){return k(e,t,i,r),ae.east}function W(e,t,i,r){return k(e,t,i,r),ae.north}function H(e,t,i,r){return e.tileWidth}function q(e,t,i,r){return e.tileHeight}function j(e,t,i,r,n,o,a){return K(e,t,i,r,n,o),le.x}function Y(e,t,i,r,n,o,a){return K(e,t,i,r,n,o),le.y}function X(e,t,i,r,n,o,a){return K(e,t,i,r,n,o),e.tileWidth-le.x-1}function Z(e,t,i,r,n,o,a){return K(e,t,i,r,n,o),e.tileHeight-le.y-1}function K(e,t,i,r,n,o,a){if(!se){te(e,t,i,r,n,o);var s=he,l=e.tilingScheme.tileXYToNativeRectangle(t,i,r,ue);le.x=e.tileWidth*(s.x-l.west)/l.width|0,le.y=e.tileHeight*(l.north-s.y)/l.height|0,se=!0}}function Q(e,t,i,r,n,o,a){return v.toDegrees(n)}function J(e,t,i,r,n,o,a){return v.toDegrees(o)}function $(e,t,i,r,n,o,a){return te(e,t,i,r,n,o),he.x}function ee(e,t,i,r,n,o,a){return te(e,t,i,r,n,o),he.y}function te(e,t,i,r,n,o,a){if(!ce){var s;if(e.tilingScheme instanceof h)he.x=v.toDegrees(n),he.y=v.toDegrees(o);else{var l=de;l.longitude=n,l.latitude=o,s=e.tilingScheme.projection.project(l,he)}ce=!0}}function ie(e,t,i,r,n,o,a){return a}s(S.prototype,{url:{get:function(){return this._url}},pickFeaturesUrl:{get:function(){return this._pickFeaturesUrl}},proxy:{get:function(){return this._proxy}},tileWidth:{get:function(){return this._tileWidth}},tileHeight:{get:function(){return this._tileHeight}},maximumLevel:{get:function(){return this._maximumLevel}},minimumLevel:{get:function(){return this._minimumLevel}},tilingScheme:{get:function(){return this._tilingScheme}},rectangle:{get:function(){return this._rectangle}},tileDiscardPolicy:{get:function(){return this._tileDiscardPolicy}},errorEvent:{get:function(){return this._errorEvent}},ready:{get:function(){return a(this._urlParts)}},readyPromise:{get:function(){return this._readyPromise}},credit:{get:function(){return this._credit}},hasAlphaChannel:{get:function(){return this._hasAlphaChannel}},headers:{get:function(){return this._headers}},withCredentials:{get:function(){return this._withCredentials}}}),S.prototype.reinitialize=function(e){var t=this;t._readyPromise=C(e).then(function(e){t.enablePickFeatures=o(e.enablePickFeatures,t.enablePickFeatures),t._url=e.url,t._pickFeaturesUrl=e.pickFeaturesUrl,t._proxy=e.proxy,t._tileDiscardPolicy=e.tileDiscardPolicy,t._getFeatureInfoFormats=e.getFeatureInfoFormats,t._subdomains=e.subdomains,Array.isArray(t._subdomains)?t._subdomains=t._subdomains.slice():a(t._subdomains)&&t._subdomains.length>0?t._subdomains=t._subdomains.split(""):t._subdomains=["a","b","c"],t._tileWidth=o(e.tileWidth,256),t._tileHeight=o(e.tileHeight,256),t._minimumLevel=o(e.minimumLevel,0),t._maximumLevel=e.maximumLevel,t._tilingScheme=o(e.tilingScheme,new y({ellipsoid:e.ellipsoid})),t._rectangle=o(e.rectangle,t._tilingScheme.rectangle),t._rectangle=g.intersection(t._rectangle,t._tilingScheme.rectangle),t._hasAlphaChannel=o(e.hasAlphaChannel,!0),t._withCredentials=o(e.withCredentials,void 0),t._headers=o(e.headers,void 0);var i=e.credit;return"string"==typeof i&&(i=new n(i)),t._credit=i,t._urlParts=b(t._url,pe),t._pickFeaturesUrlParts=b(t._pickFeaturesUrl,me),!0})},S.prototype.getTileCredits=function(e,t,i){},S.prototype.requestImage=function(e,t,i){var r=w(this,e,t,i);return E.loadImage(this,r)},S.prototype.pickFeatures=function(e,t,i,r,n){function o(e,t){return e.callback(t)}function s(){if(l>=u._getFeatureInfoFormats.length)return C([]);var a=u._getFeatureInfoFormats[l],c=T(u,e,t,i,r,n,a.format),h={ +headers:u.headers,withCredentials:u.withCredentials};return++l,"json"===a.type?d(c,h).then(a.callback).otherwise(s):"xml"===a.type?f(c,h).then(a.callback).otherwise(s):"text"===a.type||"html"===a.type?p(c,h).then(a.callback).otherwise(s):m({url:c,headers:u.headers,withCredentials:u.withCredentials,responseType:a.format}).then(o.bind(void 0,a)).otherwise(s)}if(this.enablePickFeatures&&a(this._pickFeaturesUrl)&&0!==this._getFeatureInfoFormats.length){var l=0,u=this;return s()}};var re=!1,ne=new g,oe=!1,ae=new g,se=!1,le=new e,ue=new g,ce=!1,he=new t,de=new i,pe={"{x}":A,"{y}":I,"{z}":R,"{s}":O,"{reverseX}":P,"{-x}":P,"{reverseY}":M,"{-y}":M,"{reverseZ}":D,"{-z}":D,"{westDegrees}":L,"{southDegrees}":F,"{eastDegrees}":B,"{northDegrees}":V,"{westProjected}":z,"{southProjected}":U,"{eastProjected}":G,"{northProjected}":W,"{width}":H,"{height}":q},me=r(pe,{"{i}":j,"{j}":Y,"{reverseI}":X,"{reverseJ}":Z,"{-i}":X,"{-j}":Z,"{longitudeDegrees}":Q,"{latitudeDegrees}":J,"{longitudeProjected}":$,"{latitudeProjected}":ee,"{format}":ie});return S}),i("Scene/createOpenStreetMapImageryProvider",["../Core/Credit","../Core/defaultValue","../Core/DeveloperError","../Core/Rectangle","../Core/WebMercatorTilingScheme","./UrlTemplateImageryProvider"],function(e,t,i,r,n,o){"use strict";function a(a){a=t(a,{});var u=t(a.url,"//a.tile.openstreetmap.org/");s.test(u)||(u+="/");var c=t(a.fileExtension,"png"),h=new n({ellipsoid:a.ellipsoid}),d=256,p=256,m=t(a.minimumLevel,0),f=a.maximumLevel,v=t(a.rectangle,h.rectangle),g=h.positionToTileXY(r.southwest(v),m),_=h.positionToTileXY(r.northeast(v),m),y=(Math.abs(_.x-g.x)+1)*(Math.abs(_.y-g.y)+1);if(y>4)throw new i("The rectangle and minimumLevel indicate that there are "+y+" tiles at the minimum level. Imagery providers with more than four tiles at the minimum level are not supported.");var C=t(a.credit,l);"string"==typeof C&&(C=new e(C));var E=u+"{z}/{x}/{y}."+c;return new o({url:E,proxy:a.proxy,credit:C,tilingScheme:h,tileWidth:d,tileHeight:p,minimumLevel:m,maximumLevel:f,rectangle:v})}var s=/\/$/,l=new e("MapQuest, Open Street Map and contributors, CC-BY-SA");return a}),i("Scene/createTangentSpaceDebugPrimitive",["../Core/ColorGeometryInstanceAttribute","../Core/defaultValue","../Core/defined","../Core/DeveloperError","../Core/GeometryInstance","../Core/GeometryPipeline","../Core/Matrix4","./PerInstanceColorAppearance","./Primitive"],function(e,t,i,r,n,o,a,s,l){"use strict";function u(r){r=t(r,t.EMPTY_OBJECT);var u=[],c=r.geometry;i(c.attributes)&&i(c.primitiveType)||(c=c.constructor.createGeometry(c));var h=c.attributes,d=a.clone(t(r.modelMatrix,a.IDENTITY)),p=t(r.length,1e4);return i(h.normal)&&u.push(new n({geometry:o.createLineSegmentsForVectors(c,"normal",p),attributes:{color:new e(1,0,0,1)},modelMatrix:d})),i(h.binormal)&&u.push(new n({geometry:o.createLineSegmentsForVectors(c,"binormal",p),attributes:{color:new e(0,1,0,1)},modelMatrix:d})),i(h.tangent)&&u.push(new n({geometry:o.createLineSegmentsForVectors(c,"tangent",p),attributes:{color:new e(0,0,1,1)},modelMatrix:d})),u.length>0?new l({asynchronous:!1,geometryInstances:u,appearance:new s({flat:!0,translucent:!1})}):void 0}return u}),i("Scene/createTileMapServiceImageryProvider",["../Core/Cartesian2","../Core/Cartographic","../Core/Credit","../Core/defaultValue","../Core/defined","../Core/defineProperties","../Core/DeveloperError","../Core/Event","../Core/GeographicTilingScheme","../Core/joinUrls","../Core/loadXML","../Core/Rectangle","../Core/RuntimeError","../Core/TileProviderError","../Core/WebMercatorTilingScheme","../ThirdParty/when","./UrlTemplateImageryProvider"],function(e,t,i,r,n,o,a,s,l,u,c,h,d,p,m,f,v){"use strict";function g(i){function o(o){for(var a,c,f,v,E=/tileformat/i,S=/tileset/i,w=/tilesets/i,T=/boundingbox/i,x=/srs/i,b=[],A=o.childNodes[0].childNodes,P=0;P<A.length;P++)if(E.test(A.item(P).nodeName))a=A.item(P);else if(w.test(A.item(P).nodeName)){f=A.item(P);for(var I=A.item(P).childNodes,M=0;M<I.length;M++)S.test(I.item(M).nodeName)&&b.push(I.item(M))}else T.test(A.item(P).nodeName)?c=A.item(P):x.test(A.item(P).nodeName)&&(v=A.item(P).textContent);var D=r(i.fileExtension,a.getAttribute("extension")),R=r(i.tileSchema,"{z}/{x}/{reverseY}"),O=r(i.tileWidth,parseInt(a.getAttribute("width"),10)),N=r(i.tileHeight,parseInt(a.getAttribute("height"),10)),L=r(i.minimumLevel,parseInt(b[0].getAttribute("order"),10)),F=r(i.maximumLevel,parseInt(b[b.length-1].getAttribute("order"),10)),B=f.getAttribute("profile"),V=!1;("geodetic"===B||"mercator"===B)&&(V=!0);var k=i.tilingScheme;if(!n(k))if("geodetic"===B||"global-geodetic"===B)k=new l({ellipsoid:i.ellipsoid});else{if("mercator"!==B&&"global-mercator"!==B){var z=u(_,"tilemapresource.xml")+"specifies an unsupported profile attribute, "+B+".";return g=p.handleError(g,C,C.errorEvent,z,void 0,void 0,void 0,s),void(g.retry||y.reject(new d(z)))}k=new m({ellipsoid:i.ellipsoid})}var U=h.clone(i.rectangle);if(!n(U)){var G,W,H,q;if(V)G=new e(parseFloat(c.getAttribute("miny")),parseFloat(c.getAttribute("minx"))),W=new e(parseFloat(c.getAttribute("maxy")),parseFloat(c.getAttribute("maxx"))),H=t.fromDegrees(G.x,G.y),q=t.fromDegrees(W.x,W.y);else if(G=new e(parseFloat(c.getAttribute("minx")),parseFloat(c.getAttribute("miny"))),W=new e(parseFloat(c.getAttribute("maxx")),parseFloat(c.getAttribute("maxy"))),k instanceof l)H=t.fromDegrees(G.x,G.y),q=t.fromDegrees(W.x,W.y);else{var j=k.projection;H=j.unproject(G),q=j.unproject(W)}U=new h(H.longitude,H.latitude,q.longitude,q.latitude)}U.west<k.rectangle.west&&(U.west=k.rectangle.west),U.east>k.rectangle.east&&(U.east=k.rectangle.east),U.south<k.rectangle.south&&(U.south=k.rectangle.south),U.north>k.rectangle.north&&(U.north=k.rectangle.north);var Y=k.positionToTileXY(h.southwest(U),L),X=k.positionToTileXY(h.northeast(U),L),Z=(Math.abs(X.x-Y.x)+1)*(Math.abs(X.y-Y.y)+1);Z>4&&(L=0);var K=u(_,R);D.length&&(K=u(K,"."+D)),y.resolve({url:K,tilingScheme:k,rectangle:U,tileWidth:O,tileHeight:N,minimumLevel:L,maximumLevel:F,proxy:i.proxy,tileDiscardPolicy:i.tileDiscardPolicy,credit:i.credit,pickFeaturesUrl:i.pickFeaturesUrl,withCredentials:i.withCredentials,getFeatureInfoFormats:i.getFeatureInfoFormats})}function a(e){var t=r(i.fileExtension,"png"),o=r(i.tileSchema,"{z}/{x}/{reverseY}"),a=r(i.tileWidth,256),s=r(i.tileHeight,256),l=r(i.minimumLevel,0),c=i.maximumLevel,h=n(i.tilingScheme)?i.tilingScheme:new m({ellipsoid:i.ellipsoid}),d=r(i.rectangle,h.rectangle),p=u(_,o);t.length&&(p=u(p,"."+t)),y.resolve({url:p,tilingScheme:h,rectangle:d,tileWidth:a,tileHeight:s,minimumLevel:l,maximumLevel:c,proxy:i.proxy,tileDiscardPolicy:i.tileDiscardPolicy,credit:i.credit,withCredentials:i.withCredentials,pickFeaturesUrl:i.pickFeaturesUrl,getFeatureInfoFormats:i.getFeatureInfoFormats})}function s(){var e=u(_,"tilemapresource.xml"),t=i.proxy;n(t)&&(e=t.getURL(e)),f(c(e),o,a)}i=r(i,{});var g,_=i.url,y=f.defer(),C=new v(y.promise);return s(),C}return g}),i("Scene/CreditDisplay",["../Core/Credit","../Core/defaultValue","../Core/defined","../Core/destroyObject","../Core/DeveloperError"],function(e,t,i,r,n){"use strict";function o(e,t,r){if(!i(e.element)){var n=e.text,o=e.link,a=document.createElement("span");if(e.hasLink()){var s=document.createElement("a");s.textContent=n,s.href=o,s.target="_blank",a.appendChild(s)}else a.textContent=n;a.className="cesium-credit-text",e.element=a}if(t.hasChildNodes()){var l=document.createElement("span");l.textContent=r,l.className="cesium-credit-delimiter",t.appendChild(l)}t.appendChild(e.element)}function a(e,t){if(!i(e.element)){var r=e.text,n=e.link,o=document.createElement("span"),a=document.createElement("img");if(a.src=e.imageUrl,a.style["vertical-align"]="bottom",i(r)&&(a.alt=r,a.title=r),e.hasLink()){var s=document.createElement("a");s.appendChild(a),s.href=n,s.target="_blank",o.appendChild(s)}else o.appendChild(a);o.className="cesium-credit-image",e.element=o}t.appendChild(e.element)}function s(t,i){for(var r=t.length,n=0;r>n;n++){var o=t[n];if(e.equals(o,i))return!0}return!1}function l(e){var t=e.element;if(i(t)){var r=t.parentNode;if(!e.hasImage()){var n=t.previousSibling;null===n&&(n=t.nextSibling),null!==n&&r.removeChild(n)}r.removeChild(t)}}function u(e,t){var r,n,a,s=e._displayedCredits.textCredits;for(r=0;r<t.length;r++)a=t[r],i(a)&&(n=s.indexOf(a),-1===n?o(a,e._textContainer,e._delimiter):s.splice(n,1));for(r=0;r<s.length;r++)a=s[r],i(a)&&l(a)}function c(e,t){var r,n,o,s=e._displayedCredits.imageCredits;for(r=0;r<t.length;r++)o=t[r],i(o)&&(n=s.indexOf(o),-1===n?a(o,e._imageContainer):s.splice(n,1));for(r=0;r<s.length;r++)o=s[r],i(o)&&l(o)}function h(e,i){var r=document.createElement("span");r.className="cesium-credit-imageContainer";var n=document.createElement("span");n.className="cesium-credit-textContainer",e.appendChild(r),e.appendChild(n),this._delimiter=t(i," • "),this._textContainer=n,this._imageContainer=r,this._defaultImageCredits=[],this._defaultTextCredits=[],this._displayedCredits={imageCredits:[],textCredits:[]},this._currentFrameCredits={imageCredits:[],textCredits:[]},this.container=e}return h.prototype.addCredit=function(e){if(e.hasImage()){var t=this._currentFrameCredits.imageCredits;s(this._defaultImageCredits,e)||(t[e.id]=e)}else{var i=this._currentFrameCredits.textCredits;s(this._defaultTextCredits,e)||(i[e.id]=e)}},h.prototype.addDefaultCredit=function(e){if(e.hasImage()){var t=this._defaultImageCredits;s(t,e)||t.push(e)}else{var i=this._defaultTextCredits;s(i,e)||i.push(e)}},h.prototype.removeDefaultCredit=function(e){var t;e.hasImage()?(t=this._defaultImageCredits.indexOf(e),-1!==t&&this._defaultImageCredits.splice(t,1)):(t=this._defaultTextCredits.indexOf(e),-1!==t&&this._defaultTextCredits.splice(t,1))},h.prototype.beginFrame=function(){this._currentFrameCredits.imageCredits.length=0,this._currentFrameCredits.textCredits.length=0},h.prototype.endFrame=function(){var e=this._defaultTextCredits.concat(this._currentFrameCredits.textCredits),t=this._defaultImageCredits.concat(this._currentFrameCredits.imageCredits);u(this,e),c(this,t),this._displayedCredits.textCredits=e,this._displayedCredits.imageCredits=t},h.prototype.destroy=function(){return this.container.removeChild(this._textContainer),this.container.removeChild(this._imageContainer),r(this)},h.prototype.isDestroyed=function(){return!1},h}),i("Scene/DebugAppearance",["../Core/defaultValue","../Core/defined","../Core/defineProperties","../Core/DeveloperError","./Appearance"],function(e,t,i,r,n){"use strict";function o(t){t=e(t,e.EMPTY_OBJECT);var i,o=t.attributeName,a=e(t.glslDatatype,"vec3"),s="v_"+o;if("normal"===o||"binormal"===o|"tangent"===o)i="vec4 getColor() { return vec4(("+s+" + vec3(1.0)) * 0.5, 1.0); }\n";else switch("st"===o&&(a="vec2"),a){case"float":i="vec4 getColor() { return vec4(vec3("+s+"), 1.0); }\n";break;case"vec2":i="vec4 getColor() { return vec4("+s+", 0.0, 1.0); }\n";break;case"vec3":i="vec4 getColor() { return vec4("+s+", 1.0); }\n";break;case"vec4":i="vec4 getColor() { return "+s+"; }\n";break;default:throw new r("options.glslDatatype must be float, vec2, vec3, or vec4.")}var l="attribute vec3 position3DHigh;\nattribute vec3 position3DLow;\nattribute "+a+" "+o+";\nvarying "+a+" "+s+";\nvoid main()\n{\nvec4 p = czm_translateRelativeToEye(position3DHigh, position3DLow);\n"+s+" = "+o+";\ngl_Position = czm_modelViewProjectionRelativeToEye * p;\n}",u="varying "+a+" "+s+";\n"+i+"\nvoid main()\n{\ngl_FragColor = getColor();\n}";this.material=void 0,this.translucent=e(t.translucent,!1),this._vertexShaderSource=e(t.vertexShaderSource,l),this._fragmentShaderSource=e(t.fragmentShaderSource,u),this._renderState=n.getDefaultRenderState(!1,!1,t.renderState),this._closed=e(t.closed,!1),this._attributeName=o,this._glslDatatype=a}return i(o.prototype,{vertexShaderSource:{get:function(){return this._vertexShaderSource}},fragmentShaderSource:{get:function(){return this._fragmentShaderSource}},renderState:{get:function(){return this._renderState}},closed:{get:function(){return this._closed}},attributeName:{get:function(){return this._attributeName}},glslDatatype:{get:function(){return this._glslDatatype}}}),o.prototype.getFragmentShaderSource=n.prototype.getFragmentShaderSource,o.prototype.isTranslucent=n.prototype.isTranslucent,o.prototype.getRenderState=n.prototype.getRenderState,o}),i("Scene/DebugModelMatrixPrimitive",["../Core/Cartesian3","../Core/Color","../Core/defaultValue","../Core/defined","../Core/destroyObject","../Core/GeometryInstance","../Core/Matrix4","../Core/PolylineGeometry","./PolylineColorAppearance","./Primitive"],function(e,t,i,r,n,o,a,s,l,u){"use strict";function c(e){e=i(e,i.EMPTY_OBJECT),this.length=i(e.length,1e7),this._length=void 0,this.width=i(e.width,2),this._width=void 0,this.show=i(e.show,!0),this.modelMatrix=a.clone(i(e.modelMatrix,a.IDENTITY)),this._modelMatrix=new a,this.id=e.id,this._id=void 0,this._primitive=void 0}return c.prototype.update=function(i){if(this.show){if(!r(this._primitive)||!a.equals(this._modelMatrix,this.modelMatrix)||this._length!==this.length||this._width!==this.width||this._id!==this.id){this._modelMatrix=a.clone(this.modelMatrix,this._modelMatrix),this._length=this.length,this._width=this.width,this._id=this.id,r(this._primitive)&&this._primitive.destroy(),0===this.modelMatrix[12]&&0===this.modelMatrix[13]&&0===this.modelMatrix[14]&&(this.modelMatrix[14]=.01);var n=new o({geometry:new s({positions:[e.ZERO,e.UNIT_X],width:this.width,vertexFormat:l.VERTEX_FORMAT,colors:[t.RED,t.RED],followSurface:!1}),modelMatrix:a.multiplyByUniformScale(this.modelMatrix,this.length,new a),id:this.id,pickPrimitive:this}),c=new o({geometry:new s({positions:[e.ZERO,e.UNIT_Y],width:this.width,vertexFormat:l.VERTEX_FORMAT,colors:[t.GREEN,t.GREEN],followSurface:!1}),modelMatrix:a.multiplyByUniformScale(this.modelMatrix,this.length,new a),id:this.id,pickPrimitive:this}),h=new o({geometry:new s({positions:[e.ZERO,e.UNIT_Z],width:this.width,vertexFormat:l.VERTEX_FORMAT,colors:[t.BLUE,t.BLUE],followSurface:!1}),modelMatrix:a.multiplyByUniformScale(this.modelMatrix,this.length,new a),id:this.id,pickPrimitive:this});this._primitive=new u({geometryInstances:[n,c,h],appearance:new l,asynchronous:!1})}this._primitive.update(i)}},c.prototype.isDestroyed=function(){return!1},c.prototype.destroy=function(){return this._primitive=this._primitive&&this._primitive.destroy(),n(this)},c}),i("Scene/DepthFunction",["../Core/freezeObject","../Renderer/WebGLConstants"],function(e,t){"use strict";var i={NEVER:t.NEVER,LESS:t.LESS,EQUAL:t.EQUAL,LESS_OR_EQUAL:t.LEQUAL,GREATER:t.GREATER,NOT_EQUAL:t.NOTEQUAL,GREATER_OR_EQUAL:t.GEQUAL,ALWAYS:t.ALWAYS};return e(i)}),i("Shaders/DepthPlaneFS",[],function(){"use strict";return"varying vec4 positionEC;\nvoid main()\n{\nczm_ellipsoid ellipsoid = czm_getWgs84EllipsoidEC();\nvec3 direction = normalize(positionEC.xyz);\nczm_ray ray = czm_ray(vec3(0.0), direction);\nczm_raySegment intersection = czm_rayEllipsoidIntersectionInterval(ray, ellipsoid);\nif (!czm_isEmpty(intersection))\n{\ngl_FragColor = vec4(1.0, 1.0, 0.0, 1.0);\n}\nelse\n{\ndiscard;\n}\n}\n"}),i("Shaders/DepthPlaneVS",[],function(){"use strict";return"attribute vec4 position;\nvarying vec4 positionEC;\nvoid main()\n{\npositionEC = czm_modelView * position;\ngl_Position = czm_projection * positionEC;\n}\n"}),i("Scene/DepthPlane",["../Core/BoundingSphere","../Core/Cartesian3","../Core/ComponentDatatype","../Core/defined","../Core/FeatureDetection","../Core/Geometry","../Core/GeometryAttribute","../Core/PrimitiveType","../Renderer/BufferUsage","../Renderer/DrawCommand","../Renderer/RenderState","../Renderer/ShaderProgram","../Renderer/VertexArray","../Shaders/DepthPlaneFS","../Shaders/DepthPlaneVS","./DepthFunction","./Pass","./SceneMode"],function(e,t,i,r,n,o,a,s,l,u,c,h,d,p,m,f,v,g){"use strict";function _(){this._rs=void 0,this._sp=void 0,this._va=void 0,this._command=void 0,this._mode=void 0}function y(e,i){var r=e.radii,n=i.camera.positionWC,o=t.multiplyComponents(e.oneOverRadii,n,E),a=t.magnitude(o),s=t.normalize(o,S),l=t.normalize(t.cross(t.UNIT_Z,o,w),w),u=t.normalize(t.cross(s,l,T),T),c=Math.sqrt(t.magnitudeSquared(o)-1),h=t.multiplyByScalar(s,1/a,E),d=c/a,p=t.multiplyByScalar(l,d,S),m=t.multiplyByScalar(u,d,w),f=t.add(h,m,T);t.subtract(f,p,f),t.multiplyComponents(r,f,f),t.pack(f,C,0);var v=t.subtract(h,m,T);t.subtract(v,p,v),t.multiplyComponents(r,v,v),t.pack(v,C,3);var g=t.add(h,m,T);t.add(g,p,g),t.multiplyComponents(r,g,g),t.pack(g,C,6);var _=t.subtract(h,m,T);return t.add(_,p,_),t.multiplyComponents(r,_,_),t.pack(_,C,9),C}var C=n.supportsTypedArrays()?new Float32Array(12):[],E=new t,S=new t,w=new t,T=new t;return _.prototype.update=function(n){if(this._mode=n.mode,n.mode===g.SCENE3D){var _=n.context,C=n.mapProjection.ellipsoid;r(this._command)||(this._rs=c.fromCache({cull:{enabled:!0},depthTest:{enabled:!0,func:f.ALWAYS},colorMask:{red:!1,green:!1,blue:!1,alpha:!1}}),this._sp=h.fromCache({context:_,vertexShaderSource:m,fragmentShaderSource:p,attributeLocations:{position:0}}),this._command=new u({renderState:this._rs,shaderProgram:this._sp,boundingVolume:new e(t.ZERO,C.maximumRadius),pass:v.OPAQUE,owner:this}));var E=y(C,n);if(r(this._va))this._va.getAttribute(0).vertexBuffer.copyFromArrayView(E);else{var S=new o({attributes:{position:new a({componentDatatype:i.FLOAT,componentsPerAttribute:3,values:E})},indices:[0,1,2,2,1,3],primitiveType:s.TRIANGLES});this._va=d.fromGeometry({context:_,geometry:S,attributeLocations:{position:0},bufferUsage:l.DYNAMIC_DRAW}),this._command.vertexArray=this._va}}},_.prototype.execute=function(e,t){this._mode===g.SCENE3D&&this._command.execute(e,t)},_.prototype.isDestroyed=function(){return!1},_.prototype.destroy=function(){this._sp=this._sp&&this._sp.destroy(),this._va=this._va&&this._va.destroy()},_}),i("Scene/DeviceOrientationCameraController",["../Core/defaultValue","../Core/defined","../Core/destroyObject","../Core/DeveloperError","../Core/Math","../Core/Matrix3","../Core/Quaternion"],function(e,t,i,r,n,o,a){"use strict";function s(t){function i(t){r._alpha=n.toRadians(e(t.alpha,0)),r._beta=n.toRadians(e(t.beta,0)),r._gamma=n.toRadians(e(t.gamma,0))}this._scene=t,this._lastAlpha=void 0,this._lastBeta=void 0,this._lastGamma=void 0,this._alpha=void 0,this._beta=void 0,this._gamma=void 0;var r=this;window.addEventListener("deviceorientation",i,!1),this._removeListener=function(){window.removeEventListener("deviceorientation",i,!1)}}function l(e,t,i,r){var n=e.direction,s=e.right,l=e.up,d=a.fromAxisAngle(n,i,c),p=a.fromAxisAngle(s,r,u),m=a.multiply(p,d,p),f=a.fromAxisAngle(l,t,c);a.multiply(f,m,m);var v=o.fromQuaternion(m,h);o.multiplyByVector(v,s,s),o.multiplyByVector(v,l,l),o.multiplyByVector(v,n,n)}var u=new a,c=new a,h=new o;return s.prototype.update=function(){if(t(this._alpha)){t(this._lastAlpha)||(this._lastAlpha=this._alpha,this._lastBeta=this._beta,this._lastGamma=this._gamma);var e=this._lastAlpha-this._alpha,i=this._lastBeta-this._beta,r=this._lastGamma-this._gamma;l(this._scene.camera,-e,i,r),this._lastAlpha=this._alpha,this._lastBeta=this._beta,this._lastGamma=this._gamma}},s.prototype.isDestroyed=function(){return!1},s.prototype.destroy=function(){return this._removeListener(),i(this)},s}),i("Shaders/EllipsoidFS",[],function(){"use strict";return"#ifdef WRITE_DEPTH\n#ifdef GL_EXT_frag_depth\n#extension GL_EXT_frag_depth : enable\n#endif\n#endif\nuniform vec3 u_radii;\nuniform vec3 u_oneOverEllipsoidRadiiSquared;\nvarying vec3 v_positionEC;\nvec4 computeEllipsoidColor(czm_ray ray, float intersection, float side)\n{\nvec3 positionEC = czm_pointAlongRay(ray, intersection);\nvec3 positionMC = (czm_inverseModelView * vec4(positionEC, 1.0)).xyz;\nvec3 geodeticNormal = normalize(czm_geodeticSurfaceNormal(positionMC, vec3(0.0), u_oneOverEllipsoidRadiiSquared));\nvec3 sphericalNormal = normalize(positionMC / u_radii);\nvec3 normalMC = geodeticNormal * side;\nvec3 normalEC = normalize(czm_normal * normalMC);\nvec2 st = czm_ellipsoidWgs84TextureCoordinates(sphericalNormal);\nvec3 positionToEyeEC = -positionEC;\nczm_materialInput materialInput;\nmaterialInput.s = st.s;\nmaterialInput.st = st;\nmaterialInput.str = (positionMC + u_radii) / u_radii;\nmaterialInput.normalEC = normalEC;\nmaterialInput.tangentToEyeMatrix = czm_eastNorthUpToEyeCoordinates(positionMC, normalEC);\nmaterialInput.positionToEyeEC = positionToEyeEC;\nczm_material material = czm_getMaterial(materialInput);\n#ifdef ONLY_SUN_LIGHTING\nreturn czm_private_phong(normalize(positionToEyeEC), material);\n#else\nreturn czm_phong(normalize(positionToEyeEC), material);\n#endif\n}\nvoid main()\n{\nfloat maxRadius = max(u_radii.x, max(u_radii.y, u_radii.z)) * 1.5;\nvec3 direction = normalize(v_positionEC);\nvec3 ellipsoidCenter = czm_modelView[3].xyz;\nfloat t1 = -1.0;\nfloat t2 = -1.0;\nfloat b = -2.0 * dot(direction, ellipsoidCenter);\nfloat c = dot(ellipsoidCenter, ellipsoidCenter) - maxRadius * maxRadius;\nfloat discriminant = b * b - 4.0 * c;\nif (discriminant >= 0.0) {\nt1 = (-b - sqrt(discriminant)) * 0.5;\nt2 = (-b + sqrt(discriminant)) * 0.5;\n}\nif (t1 < 0.0 && t2 < 0.0) {\ndiscard;\n}\nfloat t = min(t1, t2);\nif (t < 0.0) {\nt = 0.0;\n}\nczm_ellipsoid ellipsoid = czm_ellipsoidNew(ellipsoidCenter, u_radii);\nczm_ray ray = czm_ray(t * direction, direction);\nczm_raySegment intersection = czm_rayEllipsoidIntersectionInterval(ray, ellipsoid);\nif (czm_isEmpty(intersection))\n{\ndiscard;\n}\nvec4 outsideFaceColor = (intersection.start != 0.0) ? computeEllipsoidColor(ray, intersection.start, 1.0) : vec4(0.0);\nvec4 insideFaceColor = (outsideFaceColor.a < 1.0) ? computeEllipsoidColor(ray, intersection.stop, -1.0) : vec4(0.0);\ngl_FragColor = mix(insideFaceColor, outsideFaceColor, outsideFaceColor.a);\ngl_FragColor.a = 1.0 - (1.0 - insideFaceColor.a) * (1.0 - outsideFaceColor.a);\n#ifdef WRITE_DEPTH\n#ifdef GL_EXT_frag_depth\nt = (intersection.start != 0.0) ? intersection.start : intersection.stop;\nvec3 positionEC = czm_pointAlongRay(ray, t);\nvec4 positionCC = czm_projection * vec4(positionEC, 1.0);\nfloat z = positionCC.z / positionCC.w;\nfloat n = czm_depthRange.near;\nfloat f = czm_depthRange.far;\ngl_FragDepthEXT = (z * (f - n) + f + n) * 0.5;\n#endif\n#endif\n}\n"}),i("Shaders/EllipsoidVS",[],function(){"use strict";return"attribute vec3 position;\nuniform vec3 u_radii;\nvarying vec3 v_positionEC;\nvoid main()\n{\nvec4 p = vec4(u_radii * position, 1.0);\nv_positionEC = (czm_modelView * p).xyz;\ngl_Position = czm_modelViewProjection * p;\ngl_Position.z = clamp(gl_Position.z, czm_depthRange.near, czm_depthRange.far);\n}\n"}),i("Scene/EllipsoidPrimitive",["../Core/BoundingSphere","../Core/BoxGeometry","../Core/Cartesian3","../Core/combine","../Core/defaultValue","../Core/defined","../Core/destroyObject","../Core/DeveloperError","../Core/Matrix4","../Core/VertexFormat","../Renderer/BufferUsage","../Renderer/DrawCommand","../Renderer/RenderState","../Renderer/ShaderProgram","../Renderer/ShaderSource","../Renderer/VertexArray","../Shaders/EllipsoidFS","../Shaders/EllipsoidVS","./BlendingState","./CullFace","./Material","./Pass","./SceneMode"],function(e,t,i,r,n,o,a,s,l,u,c,h,d,p,m,f,v,g,_,y,C,E,S){"use strict";function w(t){t=n(t,n.EMPTY_OBJECT),this.center=i.clone(n(t.center,i.ZERO)),this._center=new i,this.radii=i.clone(t.radii),this._radii=new i,this._oneOverEllipsoidRadiiSquared=new i,this._boundingSphere=new e,this.modelMatrix=l.clone(n(t.modelMatrix,l.IDENTITY)),this._modelMatrix=new l,this._computedModelMatrix=new l,this.show=n(t.show,!0),this.material=n(t.material,C.fromType(C.ColorType)),this._material=void 0,this._translucent=void 0,this.id=t.id,this._id=void 0,this.debugShowBoundingVolume=n(t.debugShowBoundingVolume,!1),this.onlySunLighting=n(t.onlySunLighting,!1),this._onlySunLighting=!1,this._depthTestEnabled=n(t.depthTestEnabled,!0),this._sp=void 0,this._rs=void 0,this._va=void 0,this._pickSP=void 0,this._pickId=void 0,this._colorCommand=new h({owner:n(t._owner,this)}),this._pickCommand=new h({owner:n(t._owner,this)});var r=this;this._uniforms={u_radii:function(){return r.radii},u_oneOverEllipsoidRadiiSquared:function(){return r._oneOverEllipsoidRadiiSquared}},this._pickUniforms={czm_pickColor:function(){return r._pickId.color}}}function T(e){var r=e.cache.ellipsoidPrimitive_vertexArray;if(o(r))return r;var n=t.createGeometry(t.fromDimensions({dimensions:new i(2,2,2),vertexFormat:u.POSITION_ONLY}));return r=f.fromGeometry({context:e,geometry:n,attributeLocations:x,bufferUsage:c.STATIC_DRAW,interleave:!0}),e.cache.ellipsoidPrimitive_vertexArray=r,r}var x={position:0};return w.prototype.update=function(t){if(this.show&&t.mode===S.SCENE3D&&o(this.center)&&o(this.radii)){var n=t.context,a=this.material.isTranslucent(),s=this._translucent!==a;(!o(this._rs)||s)&&(this._translucent=a,this._rs=d.fromCache({cull:{enabled:!0,face:y.FRONT},depthTest:{enabled:this._depthTestEnabled},depthMask:!a&&n.fragmentDepth,blending:a?_.ALPHA_BLEND:void 0})),o(this._va)||(this._va=T(n));var u=!1,c=this.radii;if(!i.equals(this._radii,c)){i.clone(c,this._radii);var h=this._oneOverEllipsoidRadiiSquared;h.x=1/(c.x*c.x),h.y=1/(c.y*c.y),h.z=1/(c.z*c.z),u=!0}l.equals(this.modelMatrix,this._modelMatrix)&&i.equals(this.center,this._center)||(l.clone(this.modelMatrix,this._modelMatrix),i.clone(this.center,this._center),l.multiplyByTranslation(this.modelMatrix,this.center,this._computedModelMatrix),u=!0),u&&(i.clone(i.ZERO,this._boundingSphere.center),this._boundingSphere.radius=i.maximumComponent(c),e.transform(this._boundingSphere,this._computedModelMatrix,this._boundingSphere));var f=this._material!==this.material;this._material=this.material,this._material.update(n);var C=this.onlySunLighting!==this._onlySunLighting;this._onlySunLighting=this.onlySunLighting;var w,b=this._colorCommand;(f||C||s)&&(w=new m({sources:[this.material.shaderSource,v]}),this.onlySunLighting&&w.defines.push("ONLY_SUN_LIGHTING"),!a&&n.fragmentDepth&&w.defines.push("WRITE_DEPTH"),this._sp=p.replaceCache({context:n,shaderProgram:this._sp,vertexShaderSource:g,fragmentShaderSource:w,attributeLocations:x}),b.vertexArray=this._va,b.renderState=this._rs,b.shaderProgram=this._sp,b.uniformMap=r(this._uniforms,this.material._uniforms),b.executeInClosestFrustum=a);var A=t.commandList,P=t.passes;if(P.render&&(b.boundingVolume=this._boundingSphere,b.debugShowBoundingVolume=this.debugShowBoundingVolume,b.modelMatrix=this._computedModelMatrix,b.pass=a?E.TRANSLUCENT:E.OPAQUE,A.push(b)),P.pick){var I=this._pickCommand;o(this._pickId)&&this._id===this.id||(this._id=this.id,this._pickId=this._pickId&&this._pickId.destroy(),this._pickId=n.createPickId({primitive:this,id:this.id})),(f||C||!o(this._pickSP))&&(w=new m({sources:[this.material.shaderSource,v],pickColorQualifier:"uniform"}),this.onlySunLighting&&w.defines.push("ONLY_SUN_LIGHTING"),!a&&n.fragmentDepth&&w.defines.push("WRITE_DEPTH"),this._pickSP=p.replaceCache({context:n,shaderProgram:this._pickSP,vertexShaderSource:g,fragmentShaderSource:w,attributeLocations:x}),I.vertexArray=this._va,I.renderState=this._rs,I.shaderProgram=this._pickSP,I.uniformMap=r(r(this._uniforms,this._pickUniforms),this.material._uniforms),I.executeInClosestFrustum=a),I.boundingVolume=this._boundingSphere,I.modelMatrix=this._computedModelMatrix,I.pass=a?E.TRANSLUCENT:E.OPAQUE,A.push(I)}}},w.prototype.isDestroyed=function(){return!1},w.prototype.destroy=function(){return this._sp=this._sp&&this._sp.destroy(),this._pickSP=this._pickSP&&this._pickSP.destroy(),this._pickId=this._pickId&&this._pickId.destroy(),a(this)},w}),i("Shaders/Appearances/EllipsoidSurfaceAppearanceFS",[],function(){"use strict";return"varying vec3 v_positionMC;\nvarying vec3 v_positionEC;\nvarying vec2 v_st;\nvoid main()\n{\nczm_materialInput materialInput;\nvec3 normalEC = normalize(czm_normal3D * czm_geodeticSurfaceNormal(v_positionMC, vec3(0.0), vec3(1.0)));\n#ifdef FACE_FORWARD\nnormalEC = faceforward(normalEC, vec3(0.0, 0.0, 1.0), -normalEC);\n#endif\nmaterialInput.s = v_st.s;\nmaterialInput.st = v_st;\nmaterialInput.str = vec3(v_st, 0.0);\nmaterialInput.normalEC = normalEC;\nmaterialInput.tangentToEyeMatrix = czm_eastNorthUpToEyeCoordinates(v_positionMC, materialInput.normalEC);\nvec3 positionToEyeEC = -v_positionEC;\nmaterialInput.positionToEyeEC = positionToEyeEC;\nczm_material material = czm_getMaterial(materialInput);\n#ifdef FLAT\ngl_FragColor = vec4(material.diffuse + material.emission, material.alpha);\n#else\ngl_FragColor = czm_phong(normalize(positionToEyeEC), material);\n#endif\n}\n"}),i("Shaders/Appearances/EllipsoidSurfaceAppearanceVS",[],function(){"use strict";return"attribute vec3 position3DHigh;\nattribute vec3 position3DLow;\nattribute vec2 st;\nvarying vec3 v_positionMC;\nvarying vec3 v_positionEC;\nvarying vec2 v_st;\nvoid main()\n{\nvec4 p = czm_computePosition();\nv_positionMC = position3DHigh + position3DLow;\nv_positionEC = (czm_modelViewRelativeToEye * p).xyz;\nv_st = st;\ngl_Position = czm_modelViewProjectionRelativeToEye * p;\n}\n"}),i("Scene/EllipsoidSurfaceAppearance",["../Core/defaultValue","../Core/defined","../Core/defineProperties","../Core/VertexFormat","../Shaders/Appearances/EllipsoidSurfaceAppearanceFS","../Shaders/Appearances/EllipsoidSurfaceAppearanceVS","./Appearance","./Material"],function(e,t,i,r,n,o,a,s){"use strict";function l(i){i=e(i,e.EMPTY_OBJECT);var r=e(i.translucent,!0),l=e(i.aboveGround,!1);this.material=t(i.material)?i.material:s.fromType(s.ColorType),this.translucent=e(i.translucent,!0),this._vertexShaderSource=e(i.vertexShaderSource,o),this._fragmentShaderSource=e(i.fragmentShaderSource,n),this._renderState=a.getDefaultRenderState(r,!l,i.renderState),this._closed=!1,this._flat=e(i.flat,!1),this._faceForward=e(i.faceForward,l),this._aboveGround=l}return i(l.prototype,{vertexShaderSource:{get:function(){return this._vertexShaderSource}},fragmentShaderSource:{get:function(){return this._fragmentShaderSource}},renderState:{get:function(){return this._renderState}},closed:{get:function(){return this._closed}},vertexFormat:{get:function(){return l.VERTEX_FORMAT}},flat:{get:function(){return this._flat}},faceForward:{get:function(){return this._faceForward}},aboveGround:{get:function(){return this._aboveGround}}}),l.VERTEX_FORMAT=r.POSITION_AND_ST,l.prototype.getFragmentShaderSource=a.prototype.getFragmentShaderSource,l.prototype.isTranslucent=a.prototype.isTranslucent,l.prototype.getRenderState=a.prototype.getRenderState,l}),i("Scene/Fog",["../Core/Cartesian3","../Core/defined","../Core/Math","./SceneMode"],function(e,t,i,r){"use strict";function n(){this.enabled=!0,this.density=2e-4,this.screenSpaceErrorFactor=2}function o(e){var t=a,i=t.length;if(e<t[0])return d=0;if(e>t[i-1])return d=i-2;if(e>=t[d]){if(i>d+1&&e<t[d+1])return d;if(i>d+2&&e<t[d+2])return++d,d}else if(d-1>=0&&e>=t[d-1])return--d,d;var r;for(r=0;i-2>r&&!(e>=t[r]&&e<t[r+1]);++r);return d=r}for(var a=[359.393,800.749,1275.6501,2151.1192,3141.7763,4777.5198,6281.2493,12364.307,15900.765,49889.0549,78026.8259,99260.7344,120036.3873,151011.0158,156091.1953,203849.3112,274866.9803,319916.3149,493552.0528,628733.5874],s=[2e-5,2e-4,1e-4,7e-5,5e-5,4e-5,3e-5,19e-6,1e-5,85e-7,62e-7,58e-7,53e-7,52e-7,51e-7,42e-7,4e-6,34e-7,26e-7,22e-7],l=0;l<s.length;++l)s[l]*=1e6;for(var u=s[1],c=s[s.length-1],h=0;h<s.length;++h)s[h]=(s[h]-c)/(u-c);var d=0,p=new e;return n.prototype.update=function(n){var l=n.fog.enabled=this.enabled;if(l){var h=n.camera,d=h.positionCartographic;if(!t(d)||d.height>8e5||n.mode!==r.SCENE3D)return void(n.fog.enabled=!1);var m=d.height,f=o(m),v=i.clamp((m-a[f])/(a[f+1]-a[f]),0,1),g=i.lerp(s[f],s[f+1],v),_=1e6*this.density,y=_/u*c;g=g*(_-y)*1e-6;var C=e.normalize(h.positionWC,p),E=i.clamp(e.dot(h.directionWC,C),0,1);g*=1-E,n.fog.density=g,n.fog.sse=this.screenSpaceErrorFactor}},n}),i("Scene/FrameRateMonitor",["../Core/defaultValue","../Core/defined","../Core/defineProperties","../Core/destroyObject","../Core/DeveloperError","../Core/Event","../Core/getTimestamp","../Core/TimeConstants"],function(e,t,i,r,n,o,a,s){"use strict";function l(i){function r(){ +c(n)}this._scene=i.scene,this.samplingWindow=e(i.samplingWindow,l.defaultSettings.samplingWindow),this.quietPeriod=e(i.quietPeriod,l.defaultSettings.quietPeriod),this.warmupPeriod=e(i.warmupPeriod,l.defaultSettings.warmupPeriod),this.minimumFrameRateDuringWarmup=e(i.minimumFrameRateDuringWarmup,l.defaultSettings.minimumFrameRateDuringWarmup),this.minimumFrameRateAfterWarmup=e(i.minimumFrameRateAfterWarmup,l.defaultSettings.minimumFrameRateAfterWarmup),this._lowFrameRate=new o,this._nominalFrameRate=new o,this._frameTimes=[],this._needsQuietPeriod=!0,this._quietPeriodEndTime=0,this._warmupPeriodEndTime=0,this._frameRateIsLow=!1,this._lastFramesPerSecond=void 0,this._pauseCount=0;var n=this;this._preRenderRemoveListener=this._scene.preRender.addEventListener(function(e,t){u(n,t)}),this._hiddenPropertyName=t(document.hidden)?"hidden":t(document.mozHidden)?"mozHidden":t(document.msHidden)?"msHidden":t(document.webkitHidden)?"webkitHidden":void 0;var a=t(document.hidden)?"visibilitychange":t(document.mozHidden)?"mozvisibilitychange":t(document.msHidden)?"msvisibilitychange":t(document.webkitHidden)?"webkitvisibilitychange":void 0;this._visibilityChangeRemoveListener=void 0,t(a)&&(document.addEventListener(a,r,!1),this._visibilityChangeRemoveListener=function(){document.removeEventListener(a,r,!1)})}function u(e,t){if(!(e._pauseCount>0)){var i=a();if(e._needsQuietPeriod)e._needsQuietPeriod=!1,e._frameTimes.length=0,e._quietPeriodEndTime=i+e.quietPeriod/s.SECONDS_PER_MILLISECOND,e._warmupPeriodEndTime=e._quietPeriodEndTime+(e.warmupPeriod+e.samplingWindow)/s.SECONDS_PER_MILLISECOND;else if(i>=e._quietPeriodEndTime){e._frameTimes.push(i);var r=i-e.samplingWindow/s.SECONDS_PER_MILLISECOND;if(e._frameTimes.length>=2&&e._frameTimes[0]<=r){for(;e._frameTimes.length>=2&&e._frameTimes[1]<r;)e._frameTimes.shift();var n=(i-e._frameTimes[0])/(e._frameTimes.length-1);e._lastFramesPerSecond=1e3/n;var o=1e3/(i>e._warmupPeriodEndTime?e.minimumFrameRateAfterWarmup:e.minimumFrameRateDuringWarmup);n>o?e._frameRateIsLow||(e._frameRateIsLow=!0,e._needsQuietPeriod=!0,e.lowFrameRate.raiseEvent(e.scene,e._lastFramesPerSecond)):e._frameRateIsLow&&(e._frameRateIsLow=!1,e._needsQuietPeriod=!0,e.nominalFrameRate.raiseEvent(e.scene,e._lastFramesPerSecond))}}}}function c(e){document[e._hiddenPropertyName]?e.pause():e.unpause()}return l.defaultSettings={samplingWindow:5,quietPeriod:2,warmupPeriod:5,minimumFrameRateDuringWarmup:4,minimumFrameRateAfterWarmup:8},l.fromScene=function(e){return(!t(e._frameRateMonitor)||e._frameRateMonitor.isDestroyed())&&(e._frameRateMonitor=new l({scene:e})),e._frameRateMonitor},i(l.prototype,{scene:{get:function(){return this._scene}},lowFrameRate:{get:function(){return this._lowFrameRate}},nominalFrameRate:{get:function(){return this._nominalFrameRate}},lastFramesPerSecond:{get:function(){return this._lastFramesPerSecond}}}),l.prototype.pause=function(){++this._pauseCount,1===this._pauseCount&&(this._frameTimes.length=0,this._lastFramesPerSecond=void 0)},l.prototype.unpause=function(){--this._pauseCount,this._pauseCount<=0&&(this._pauseCount=0,this._needsQuietPeriod=!0)},l.prototype.isDestroyed=function(){return!1},l.prototype.destroy=function(){return this._preRenderRemoveListener(),t(this._visibilityChangeRemoveListener)&&this._visibilityChangeRemoveListener(),r(this)},l}),i("Scene/FrameState",["./SceneMode"],function(e){"use strict";function t(t,i){this.context=t,this.commandList=[],this.mode=e.SCENE3D,this.morphTime=e.getMorphTime(e.SCENE3D),this.frameNumber=0,this.time=void 0,this.mapProjection=void 0,this.camera=void 0,this.cullingVolume=void 0,this.occluder=void 0,this.passes={render:!1,pick:!1},this.creditDisplay=i,this.afterRender=[],this.scene3DOnly=!1,this.fog={enabled:!1,density:void 0,sse:void 0},this.terrainExaggeration=1}return t}),i("Scene/FrustumCommands",["../Core/defaultValue","./Pass"],function(e,t){"use strict";function i(i,r){this.near=e(i,0),this.far=e(r,0);for(var n=t.NUMBER_OF_PASSES,o=new Array(n),a=new Array(n),s=0;n>s;++s)o[s]=[],a[s]=0;this.commands=o,this.indices=a}return i}),i("Shaders/PostProcessFilters/FXAA",[],function(){"use strict";return"#ifndef FXAA_PRESET\n#define FXAA_PRESET 3\n#endif\n#if (FXAA_PRESET == 3)\n#define FXAA_EDGE_THRESHOLD (1.0/8.0)\n#define FXAA_EDGE_THRESHOLD_MIN (1.0/24.0)\n#define FXAA_SEARCH_STEPS 16\n#define FXAA_SEARCH_THRESHOLD (1.0/4.0)\n#define FXAA_SUBPIX_CAP (3.0/4.0)\n#define FXAA_SUBPIX_TRIM (1.0/4.0)\n#endif\n#if (FXAA_PRESET == 4)\n#define FXAA_EDGE_THRESHOLD (1.0/8.0)\n#define FXAA_EDGE_THRESHOLD_MIN (1.0/24.0)\n#define FXAA_SEARCH_STEPS 24\n#define FXAA_SEARCH_THRESHOLD (1.0/4.0)\n#define FXAA_SUBPIX_CAP (3.0/4.0)\n#define FXAA_SUBPIX_TRIM (1.0/4.0)\n#endif\n#if (FXAA_PRESET == 5)\n#define FXAA_EDGE_THRESHOLD (1.0/8.0)\n#define FXAA_EDGE_THRESHOLD_MIN (1.0/24.0)\n#define FXAA_SEARCH_STEPS 32\n#define FXAA_SEARCH_THRESHOLD (1.0/4.0)\n#define FXAA_SUBPIX_CAP (3.0/4.0)\n#define FXAA_SUBPIX_TRIM (1.0/4.0)\n#endif\n#define FXAA_SUBPIX_TRIM_SCALE (1.0/(1.0 - FXAA_SUBPIX_TRIM))\nfloat FxaaLuma(vec3 rgb) {\nreturn rgb.y * (0.587/0.299) + rgb.x;\n}\nvec3 FxaaLerp3(vec3 a, vec3 b, float amountOfA) {\nreturn (vec3(-amountOfA) * b) + ((a * vec3(amountOfA)) + b);\n}\nvec4 FxaaTexOff(sampler2D tex, vec2 pos, ivec2 off, vec2 rcpFrame) {\nfloat x = pos.x + float(off.x) * rcpFrame.x;\nfloat y = pos.y + float(off.y) * rcpFrame.y;\nreturn texture2D(tex, vec2(x, y));\n}\nvec3 FxaaPixelShader(vec2 pos, sampler2D tex, vec2 rcpFrame)\n{\nvec3 rgbN = FxaaTexOff(tex, pos.xy, ivec2( 0,-1), rcpFrame).xyz;\nvec3 rgbW = FxaaTexOff(tex, pos.xy, ivec2(-1, 0), rcpFrame).xyz;\nvec3 rgbM = FxaaTexOff(tex, pos.xy, ivec2( 0, 0), rcpFrame).xyz;\nvec3 rgbE = FxaaTexOff(tex, pos.xy, ivec2( 1, 0), rcpFrame).xyz;\nvec3 rgbS = FxaaTexOff(tex, pos.xy, ivec2( 0, 1), rcpFrame).xyz;\nfloat lumaN = FxaaLuma(rgbN);\nfloat lumaW = FxaaLuma(rgbW);\nfloat lumaM = FxaaLuma(rgbM);\nfloat lumaE = FxaaLuma(rgbE);\nfloat lumaS = FxaaLuma(rgbS);\nfloat rangeMin = min(lumaM, min(min(lumaN, lumaW), min(lumaS, lumaE)));\nfloat rangeMax = max(lumaM, max(max(lumaN, lumaW), max(lumaS, lumaE)));\nfloat range = rangeMax - rangeMin;\nif(range < max(FXAA_EDGE_THRESHOLD_MIN, rangeMax * FXAA_EDGE_THRESHOLD))\n{\nreturn rgbM;\n}\nvec3 rgbL = rgbN + rgbW + rgbM + rgbE + rgbS;\nfloat lumaL = (lumaN + lumaW + lumaE + lumaS) * 0.25;\nfloat rangeL = abs(lumaL - lumaM);\nfloat blendL = max(0.0, (rangeL / range) - FXAA_SUBPIX_TRIM) * FXAA_SUBPIX_TRIM_SCALE;\nblendL = min(FXAA_SUBPIX_CAP, blendL);\nvec3 rgbNW = FxaaTexOff(tex, pos.xy, ivec2(-1,-1), rcpFrame).xyz;\nvec3 rgbNE = FxaaTexOff(tex, pos.xy, ivec2( 1,-1), rcpFrame).xyz;\nvec3 rgbSW = FxaaTexOff(tex, pos.xy, ivec2(-1, 1), rcpFrame).xyz;\nvec3 rgbSE = FxaaTexOff(tex, pos.xy, ivec2( 1, 1), rcpFrame).xyz;\nrgbL += (rgbNW + rgbNE + rgbSW + rgbSE);\nrgbL *= vec3(1.0/9.0);\nfloat lumaNW = FxaaLuma(rgbNW);\nfloat lumaNE = FxaaLuma(rgbNE);\nfloat lumaSW = FxaaLuma(rgbSW);\nfloat lumaSE = FxaaLuma(rgbSE);\nfloat edgeVert =\nabs((0.25 * lumaNW) + (-0.5 * lumaN) + (0.25 * lumaNE)) +\nabs((0.50 * lumaW ) + (-1.0 * lumaM) + (0.50 * lumaE )) +\nabs((0.25 * lumaSW) + (-0.5 * lumaS) + (0.25 * lumaSE));\nfloat edgeHorz =\nabs((0.25 * lumaNW) + (-0.5 * lumaW) + (0.25 * lumaSW)) +\nabs((0.50 * lumaN ) + (-1.0 * lumaM) + (0.50 * lumaS )) +\nabs((0.25 * lumaNE) + (-0.5 * lumaE) + (0.25 * lumaSE));\nbool horzSpan = edgeHorz >= edgeVert;\nfloat lengthSign = horzSpan ? -rcpFrame.y : -rcpFrame.x;\nif(!horzSpan)\n{\nlumaN = lumaW;\nlumaS = lumaE;\n}\nfloat gradientN = abs(lumaN - lumaM);\nfloat gradientS = abs(lumaS - lumaM);\nlumaN = (lumaN + lumaM) * 0.5;\nlumaS = (lumaS + lumaM) * 0.5;\nif (gradientN < gradientS)\n{\nlumaN = lumaS;\nlumaN = lumaS;\ngradientN = gradientS;\nlengthSign *= -1.0;\n}\nvec2 posN;\nposN.x = pos.x + (horzSpan ? 0.0 : lengthSign * 0.5);\nposN.y = pos.y + (horzSpan ? lengthSign * 0.5 : 0.0);\ngradientN *= FXAA_SEARCH_THRESHOLD;\nvec2 posP = posN;\nvec2 offNP = horzSpan ? vec2(rcpFrame.x, 0.0) : vec2(0.0, rcpFrame.y);\nfloat lumaEndN = lumaN;\nfloat lumaEndP = lumaN;\nbool doneN = false;\nbool doneP = false;\nposN += offNP * vec2(-1.0, -1.0);\nposP += offNP * vec2( 1.0, 1.0);\nfor(int i = 0; i < FXAA_SEARCH_STEPS; i++) {\nif(!doneN)\n{\nlumaEndN = FxaaLuma(texture2D(tex, posN.xy).xyz);\n}\nif(!doneP)\n{\nlumaEndP = FxaaLuma(texture2D(tex, posP.xy).xyz);\n}\ndoneN = doneN || (abs(lumaEndN - lumaN) >= gradientN);\ndoneP = doneP || (abs(lumaEndP - lumaN) >= gradientN);\nif(doneN && doneP)\n{\nbreak;\n}\nif(!doneN)\n{\nposN -= offNP;\n}\nif(!doneP)\n{\nposP += offNP;\n}\n}\nfloat dstN = horzSpan ? pos.x - posN.x : pos.y - posN.y;\nfloat dstP = horzSpan ? posP.x - pos.x : posP.y - pos.y;\nbool directionN = dstN < dstP;\nlumaEndN = directionN ? lumaEndN : lumaEndP;\nif(((lumaM - lumaN) < 0.0) == ((lumaEndN - lumaN) < 0.0))\n{\nlengthSign = 0.0;\n}\nfloat spanLength = (dstP + dstN);\ndstN = directionN ? dstN : dstP;\nfloat subPixelOffset = (0.5 + (dstN * (-1.0/spanLength))) * lengthSign;\nvec3 rgbF = texture2D(tex, vec2(\npos.x + (horzSpan ? 0.0 : subPixelOffset),\npos.y + (horzSpan ? subPixelOffset : 0.0))).xyz;\nreturn FxaaLerp3(rgbL, rgbF, blendL);\n}\nuniform sampler2D u_texture;\nuniform vec2 u_step;\nvarying vec2 v_textureCoordinates;\nvoid main()\n{\ngl_FragColor = vec4(FxaaPixelShader(v_textureCoordinates, u_texture, u_step), 1.0);\n}\n"}),i("Scene/FXAA",["../Core/BoundingRectangle","../Core/Cartesian2","../Core/Color","../Core/defined","../Core/destroyObject","../Core/PixelFormat","../Renderer/ClearCommand","../Renderer/Framebuffer","../Renderer/PixelDatatype","../Renderer/Renderbuffer","../Renderer/RenderbufferFormat","../Renderer/RenderState","../Renderer/Texture","../Shaders/PostProcessFilters/FXAA"],function(e,t,i,r,n,o,a,s,l,u,c,h,d,p){"use strict";function m(t){this._texture=void 0,this._depthTexture=void 0,this._depthRenderbuffer=void 0,this._fbo=void 0,this._command=void 0,this._viewport=new e,this._rs=void 0;var r=new a({color:new i(0,0,0,0),depth:1,owner:this});this._clearCommand=r}function f(e){e._fbo=e._fbo&&e._fbo.destroy(),e._texture=e._texture&&e._texture.destroy(),e._depthTexture=e._depthTexture&&e._depthTexture.destroy(),e._depthRenderbuffer=e._depthRenderbuffer&&e._depthRenderbuffer.destroy(),e._fbo=void 0,e._texture=void 0,e._depthTexture=void 0,e._depthRenderbuffer=void 0,r(e._command)&&(e._command.shaderProgram=e._command.shaderProgram&&e._command.shaderProgram.destroy(),e._command=void 0)}return m.prototype.update=function(i){var n=i.drawingBufferWidth,a=i.drawingBufferHeight,m=this._texture,f=!r(m)||m.width!==n||m.height!==a;if(f&&(this._texture=this._texture&&this._texture.destroy(),this._depthTexture=this._depthTexture&&this._depthTexture.destroy(),this._depthRenderbuffer=this._depthRenderbuffer&&this._depthRenderbuffer.destroy(),this._texture=new d({context:i,width:n,height:a,pixelFormat:o.RGBA,pixelDatatype:l.UNSIGNED_BYTE}),i.depthTexture?this._depthTexture=new d({context:i,width:n,height:a,pixelFormat:o.DEPTH_COMPONENT,pixelDatatype:l.UNSIGNED_SHORT}):this._depthRenderbuffer=new u({context:i,width:n,height:a,format:c.DEPTH_COMPONENT16})),(!r(this._fbo)||f)&&(this._fbo=this._fbo&&this._fbo.destroy(),this._fbo=new s({context:i,colorTextures:[this._texture],depthTexture:this._depthTexture,depthRenderbuffer:this._depthRenderbuffer,destroyAttachments:!1})),r(this._command)||(this._command=i.createViewportQuadCommand(p,{owner:this})),this._viewport.width=n,this._viewport.height=a,r(this._rs)&&e.equals(this._rs.viewport,this._viewport)||(this._rs=h.fromCache({viewport:this._viewport})),this._command.renderState=this._rs,f){var v=this,g=new t(1/this._texture.width,1/this._texture.height);this._command.uniformMap={u_texture:function(){return v._texture},u_step:function(){return g}}}},m.prototype.execute=function(e,t){this._command.execute(e,t)},m.prototype.clear=function(e,t,r){var n=t.framebuffer;t.framebuffer=this._fbo,i.clone(r,this._clearCommand.color),this._clearCommand.execute(e,t),t.framebuffer=n},m.prototype.getColorFramebuffer=function(){return this._fbo},m.prototype.isDestroyed=function(){return!1},m.prototype.destroy=function(){return f(this),n(this)},m}),i("Scene/GetFeatureInfoFormat",["../Core/Cartographic","../Core/defaultValue","../Core/defined","../Core/definedNotNull","../Core/DeveloperError","../Core/RuntimeError","./ImageryLayerFeatureInfo"],function(e,t,i,r,n,o,a){"use strict";function s(e,t,r){this.type=e,i(t)||("json"===e?t="application/json":"xml"===e?t="text/xml":"html"===e?t="text/html":"text"===e&&(t="text/plain")),this.format=t,i(r)||("json"===e?r=l:"xml"===e?r=u:"html"===e?r=g:"text"===e&&(r=g)),this.callback=r}function l(t){for(var i=[],n=t.features,o=0;o<n.length;++o){var s=n[o],l=new a;if(l.data=s,l.properties=s.properties,l.configureNameFromProperties(s.properties),l.configureDescriptionFromProperties(s.properties),r(s.geometry)&&"Point"===s.geometry.type){var u=s.geometry.coordinates[0],c=s.geometry.coordinates[1];l.position=e.fromDegrees(u,c)}i.push(l)}return i}function u(e){var t=e.documentElement;if("MultiFeatureCollection"===t.localName&&t.namespaceURI===_)return c(e);if("FeatureInfoResponse"===t.localName&&t.namespaceURI===y)return h(e);if("FeatureCollection"===t.localName&&t.namespaceURI===C)return d(e);if("ServiceExceptionReport"===t.localName)throw new o((new XMLSerializer).serializeToString(t));return"msGMLOutput"===t.localName?p(e):v(e)}function c(e){for(var t=[],i=e.documentElement,r=i.getElementsByTagNameNS(_,"Feature"),n=0;n<r.length;++n){for(var o=r[n],s={},l=o.getElementsByTagNameNS(_,"Val"),u=0;u<l.length;++u){var c=l[u];if(c.hasAttribute("ref")){var h=c.getAttribute("ref"),d=c.textContent.trim();s[h]=d}}var p=new a;p.data=o,p.properties=s,p.configureNameFromProperties(s),p.configureDescriptionFromProperties(s),t.push(p)}return t}function h(e){var t,i=e.documentElement,r=[],n=i.getElementsByTagNameNS("*","FIELDS");if(n.length>0)for(var o=0;o<n.length;++o){var a=n[o];t={};for(var s=a.attributes,l=0;l<s.length;++l){var u=s[l];t[u.name]=u.value}r.push(f(a,t))}else for(var c=i.getElementsByTagNameNS("*","FeatureInfo"),h=0;h<c.length;++h){var d=c[h];t={};for(var p=d.childNodes,m=0;m<p.length;++m){var v=p[m];v.nodeType===Node.ELEMENT_NODE&&(t[v.localName]=v.textContent)}r.push(f(d,t))}return r}function d(e){for(var t=[],i=e.documentElement,r=i.getElementsByTagNameNS(E,"featureMember"),n=0;n<r.length;++n){var o=r[n],a={};m(o,a),t.push(f(o,a))}return t}function p(e){for(var t,i=[],r=e.documentElement.childNodes,n=0;n<r.length;n++)if(r[n].nodeType===Node.ELEMENT_NODE){t=r[n];break}for(var o=t.childNodes,a=0;a<o.length;++a){var s=o[a];if(s.nodeType===Node.ELEMENT_NODE){var l={};m(s,l),i.push(f(s,l))}}return i}function m(e,t){for(var i=!0,r=0;r<e.childNodes.length;++r){var n=e.childNodes[r];n.nodeType===Node.ELEMENT_NODE&&(i=!1),"Point"!==n.localName&&"LineString"!==n.localName&&"Polygon"!==n.localName&&"boundedBy"!==n.localName&&n.hasChildNodes()&&m(n,t)&&(t[n.localName]=n.textContent)}return i}function f(e,t){var i=new a;return i.data=e,i.properties=t,i.configureNameFromProperties(t),i.configureDescriptionFromProperties(t),i}function v(e){var t=(new XMLSerializer).serializeToString(e),i=document.createElement("div"),r=document.createElement("pre");r.textContent=t,i.appendChild(r);var n=new a;return n.data=e,n.description=i.innerHTML,[n]}function g(e){if(!S.test(e)&&!w.test(e)){var t,i=T.exec(e);i&&i.length>1&&(t=i[1]);var r=new a;return r.name=t,r.description=e,r.data=e,[r]}}var _="http://www.mapinfo.com/mxp",y="http://www.esri.com/wms",C="http://www.opengis.net/wfs",E="http://www.opengis.net/gml",S=/<body>\s*<\/body>/im,w=/<ServiceExceptionReport([\s\S]*)<\/ServiceExceptionReport>/im,T=/<title>([\s\S]*)<\/title>/im;return s}),i("Shaders/GlobeFS",[],function(){"use strict";return"uniform vec4 u_initialColor;\n#if TEXTURE_UNITS > 0\nuniform sampler2D u_dayTextures[TEXTURE_UNITS];\nuniform vec4 u_dayTextureTranslationAndScale[TEXTURE_UNITS];\n#ifdef APPLY_ALPHA\nuniform float u_dayTextureAlpha[TEXTURE_UNITS];\n#endif\n#ifdef APPLY_BRIGHTNESS\nuniform float u_dayTextureBrightness[TEXTURE_UNITS];\n#endif\n#ifdef APPLY_CONTRAST\nuniform float u_dayTextureContrast[TEXTURE_UNITS];\n#endif\n#ifdef APPLY_HUE\nuniform float u_dayTextureHue[TEXTURE_UNITS];\n#endif\n#ifdef APPLY_SATURATION\nuniform float u_dayTextureSaturation[TEXTURE_UNITS];\n#endif\n#ifdef APPLY_GAMMA\nuniform float u_dayTextureOneOverGamma[TEXTURE_UNITS];\n#endif\nuniform vec4 u_dayTextureTexCoordsRectangle[TEXTURE_UNITS];\n#endif\n#ifdef SHOW_REFLECTIVE_OCEAN\nuniform sampler2D u_waterMask;\nuniform vec4 u_waterMaskTranslationAndScale;\nuniform float u_zoomedOutOceanSpecularIntensity;\n#endif\n#ifdef SHOW_OCEAN_WAVES\nuniform sampler2D u_oceanNormalMap;\n#endif\n#ifdef ENABLE_DAYNIGHT_SHADING\nuniform vec2 u_lightingFadeDistance;\n#endif\nvarying vec3 v_positionMC;\nvarying vec3 v_positionEC;\nvarying vec2 v_textureCoordinates;\nvarying vec3 v_normalMC;\nvarying vec3 v_normalEC;\n#ifdef FOG\nvarying float v_distance;\nvarying vec3 v_rayleighColor;\nvarying vec3 v_mieColor;\n#endif\nvec4 sampleAndBlend(\nvec4 previousColor,\nsampler2D texture,\nvec2 tileTextureCoordinates,\nvec4 textureCoordinateRectangle,\nvec4 textureCoordinateTranslationAndScale,\nfloat textureAlpha,\nfloat textureBrightness,\nfloat textureContrast,\nfloat textureHue,\nfloat textureSaturation,\nfloat textureOneOverGamma)\n{\nvec2 alphaMultiplier = step(textureCoordinateRectangle.st, tileTextureCoordinates);\ntextureAlpha = textureAlpha * alphaMultiplier.x * alphaMultiplier.y;\nalphaMultiplier = step(vec2(0.0), textureCoordinateRectangle.pq - tileTextureCoordinates);\ntextureAlpha = textureAlpha * alphaMultiplier.x * alphaMultiplier.y;\nvec2 translation = textureCoordinateTranslationAndScale.xy;\nvec2 scale = textureCoordinateTranslationAndScale.zw;\nvec2 textureCoordinates = tileTextureCoordinates * scale + translation;\nvec4 value = texture2D(texture, textureCoordinates);\nvec3 color = value.rgb;\nfloat alpha = value.a;\n#ifdef APPLY_BRIGHTNESS\ncolor = mix(vec3(0.0), color, textureBrightness);\n#endif\n#ifdef APPLY_CONTRAST\ncolor = mix(vec3(0.5), color, textureContrast);\n#endif\n#ifdef APPLY_HUE\ncolor = czm_hue(color, textureHue);\n#endif\n#ifdef APPLY_SATURATION\ncolor = czm_saturation(color, textureSaturation);\n#endif\n#ifdef APPLY_GAMMA\ncolor = pow(color, vec3(textureOneOverGamma));\n#endif\nfloat sourceAlpha = alpha * textureAlpha;\nfloat outAlpha = mix(previousColor.a, 1.0, sourceAlpha);\nvec3 outColor = mix(previousColor.rgb * previousColor.a, color, sourceAlpha) / outAlpha;\nreturn vec4(outColor, outAlpha);\n}\nvec4 computeDayColor(vec4 initialColor, vec2 textureCoordinates);\nvec4 computeWaterColor(vec3 positionEyeCoordinates, vec2 textureCoordinates, mat3 enuToEye, vec4 imageryColor, float specularMapValue);\nvoid main()\n{\nvec4 color = computeDayColor(u_initialColor, clamp(v_textureCoordinates, 0.0, 1.0));\n#ifdef SHOW_TILE_BOUNDARIES\nif (v_textureCoordinates.x < (1.0/256.0) || v_textureCoordinates.x > (255.0/256.0) ||\nv_textureCoordinates.y < (1.0/256.0) || v_textureCoordinates.y > (255.0/256.0))\n{\ncolor = vec4(1.0, 0.0, 0.0, 1.0);\n}\n#endif\n#if defined(SHOW_REFLECTIVE_OCEAN) || defined(ENABLE_DAYNIGHT_SHADING)\nvec3 normalMC = normalize(czm_geodeticSurfaceNormal(v_positionMC, vec3(0.0), vec3(1.0)));\nvec3 normalEC = normalize(czm_normal3D * normalMC);\n#endif\n#ifdef SHOW_REFLECTIVE_OCEAN\nvec2 waterMaskTranslation = u_waterMaskTranslationAndScale.xy;\nvec2 waterMaskScale = u_waterMaskTranslationAndScale.zw;\nvec2 waterMaskTextureCoordinates = v_textureCoordinates * waterMaskScale + waterMaskTranslation;\nfloat mask = texture2D(u_waterMask, waterMaskTextureCoordinates).r;\nif (mask > 0.0)\n{\nmat3 enuToEye = czm_eastNorthUpToEyeCoordinates(v_positionMC, normalEC);\nvec2 ellipsoidTextureCoordinates = czm_ellipsoidWgs84TextureCoordinates(normalMC);\nvec2 ellipsoidFlippedTextureCoordinates = czm_ellipsoidWgs84TextureCoordinates(normalMC.zyx);\nvec2 textureCoordinates = mix(ellipsoidTextureCoordinates, ellipsoidFlippedTextureCoordinates, czm_morphTime * smoothstep(0.9, 0.95, normalMC.z));\ncolor = computeWaterColor(v_positionEC, textureCoordinates, enuToEye, color, mask);\n}\n#endif\n#ifdef ENABLE_VERTEX_LIGHTING\nfloat diffuseIntensity = clamp(czm_getLambertDiffuse(czm_sunDirectionEC, normalize(v_normalEC)) * 0.9 + 0.3, 0.0, 1.0);\nvec4 finalColor = vec4(color.rgb * diffuseIntensity, color.a);\n#elif defined(ENABLE_DAYNIGHT_SHADING)\nfloat diffuseIntensity = clamp(czm_getLambertDiffuse(czm_sunDirectionEC, normalEC) * 5.0 + 0.3, 0.0, 1.0);\nfloat cameraDist = length(czm_view[3]);\nfloat fadeOutDist = u_lightingFadeDistance.x;\nfloat fadeInDist = u_lightingFadeDistance.y;\nfloat t = clamp((cameraDist - fadeOutDist) / (fadeInDist - fadeOutDist), 0.0, 1.0);\ndiffuseIntensity = mix(1.0, diffuseIntensity, t);\nvec4 finalColor = vec4(color.rgb * diffuseIntensity, color.a);\n#else\nvec4 finalColor = color;\n#endif\n#ifdef FOG\nconst float fExposure = 2.0;\nvec3 fogColor = v_mieColor + finalColor.rgb * v_rayleighColor;\nfogColor = vec3(1.0) - exp(-fExposure * fogColor);\ngl_FragColor = vec4(czm_fog(v_distance, finalColor.rgb, fogColor), finalColor.a);\n#else\ngl_FragColor = finalColor;\n#endif\n}\n#ifdef SHOW_REFLECTIVE_OCEAN\nfloat waveFade(float edge0, float edge1, float x)\n{\nfloat y = clamp((x - edge0) / (edge1 - edge0), 0.0, 1.0);\nreturn pow(1.0 - y, 5.0);\n}\nfloat linearFade(float edge0, float edge1, float x)\n{\nreturn clamp((x - edge0) / (edge1 - edge0), 0.0, 1.0);\n}\nconst float oceanFrequencyLowAltitude = 825000.0;\nconst float oceanAnimationSpeedLowAltitude = 0.004;\nconst float oceanOneOverAmplitudeLowAltitude = 1.0 / 2.0;\nconst float oceanSpecularIntensity = 0.5;\nconst float oceanFrequencyHighAltitude = 125000.0;\nconst float oceanAnimationSpeedHighAltitude = 0.008;\nconst float oceanOneOverAmplitudeHighAltitude = 1.0 / 2.0;\nvec4 computeWaterColor(vec3 positionEyeCoordinates, vec2 textureCoordinates, mat3 enuToEye, vec4 imageryColor, float maskValue)\n{\nvec3 positionToEyeEC = -positionEyeCoordinates;\nfloat positionToEyeECLength = length(positionToEyeEC);\nvec3 normalizedpositionToEyeEC = normalize(normalize(positionToEyeEC));\nfloat waveIntensity = waveFade(70000.0, 1000000.0, positionToEyeECLength);\n#ifdef SHOW_OCEAN_WAVES\nfloat time = czm_frameNumber * oceanAnimationSpeedHighAltitude;\nvec4 noise = czm_getWaterNoise(u_oceanNormalMap, textureCoordinates * oceanFrequencyHighAltitude, time, 0.0);\nvec3 normalTangentSpaceHighAltitude = vec3(noise.xy, noise.z * oceanOneOverAmplitudeHighAltitude);\ntime = czm_frameNumber * oceanAnimationSpeedLowAltitude;\nnoise = czm_getWaterNoise(u_oceanNormalMap, textureCoordinates * oceanFrequencyLowAltitude, time, 0.0);\nvec3 normalTangentSpaceLowAltitude = vec3(noise.xy, noise.z * oceanOneOverAmplitudeLowAltitude);\nfloat highAltitudeFade = linearFade(0.0, 60000.0, positionToEyeECLength);\nfloat lowAltitudeFade = 1.0 - linearFade(20000.0, 60000.0, positionToEyeECLength);\nvec3 normalTangentSpace =\n(highAltitudeFade * normalTangentSpaceHighAltitude) +\n(lowAltitudeFade * normalTangentSpaceLowAltitude);\nnormalTangentSpace = normalize(normalTangentSpace);\nnormalTangentSpace.xy *= waveIntensity;\nnormalTangentSpace = normalize(normalTangentSpace);\n#else\nvec3 normalTangentSpace = vec3(0.0, 0.0, 1.0);\n#endif\nvec3 normalEC = enuToEye * normalTangentSpace;\nconst vec3 waveHighlightColor = vec3(0.3, 0.45, 0.6);\nfloat diffuseIntensity = czm_getLambertDiffuse(czm_sunDirectionEC, normalEC) * maskValue;\nvec3 diffuseHighlight = waveHighlightColor * diffuseIntensity;\n#ifdef SHOW_OCEAN_WAVES\nfloat tsPerturbationRatio = normalTangentSpace.z;\nvec3 nonDiffuseHighlight = mix(waveHighlightColor * 5.0 * (1.0 - tsPerturbationRatio), vec3(0.0), diffuseIntensity);\n#else\nvec3 nonDiffuseHighlight = vec3(0.0);\n#endif\nfloat specularIntensity = czm_getSpecular(czm_sunDirectionEC, normalizedpositionToEyeEC, normalEC, 10.0) + 0.25 * czm_getSpecular(czm_moonDirectionEC, normalizedpositionToEyeEC, normalEC, 10.0);\nfloat surfaceReflectance = mix(0.0, mix(u_zoomedOutOceanSpecularIntensity, oceanSpecularIntensity, waveIntensity), maskValue);\nfloat specular = specularIntensity * surfaceReflectance;\nreturn vec4(imageryColor.rgb + diffuseHighlight + nonDiffuseHighlight + specular, imageryColor.a);\n}\n#endif\n"}),i("Shaders/GlobeVS",[],function(){"use strict";return"#ifdef QUANTIZATION_BITS12\nattribute vec4 compressed;\n#else\nattribute vec4 position3DAndHeight;\nattribute vec3 textureCoordAndEncodedNormals;\n#endif\nuniform vec3 u_center3D;\nuniform mat4 u_modifiedModelView;\nuniform vec4 u_tileRectangle;\nuniform vec2 u_southAndNorthLatitude;\nuniform vec2 u_southMercatorYAndOneOverHeight;\nvarying vec3 v_positionMC;\nvarying vec3 v_positionEC;\nvarying vec2 v_textureCoordinates;\nvarying vec3 v_normalMC;\nvarying vec3 v_normalEC;\n#ifdef FOG\nvarying float v_distance;\nvarying vec3 v_mieColor;\nvarying vec3 v_rayleighColor;\n#endif\nvec4 getPosition(vec3 position, float height, vec2 textureCoordinates);\nfloat get2DYPositionFraction(vec2 textureCoordinates);\nvec4 getPosition3DMode(vec3 position, float height, vec2 textureCoordinates)\n{\nreturn czm_projection * (u_modifiedModelView * vec4(position, 1.0));\n}\nfloat get2DMercatorYPositionFraction(vec2 textureCoordinates)\n{\nconst float maxTileWidth = 0.003068;\nfloat positionFraction = textureCoordinates.y;\nfloat southLatitude = u_southAndNorthLatitude.x;\nfloat northLatitude = u_southAndNorthLatitude.y;\nif (northLatitude - southLatitude > maxTileWidth)\n{\nfloat southMercatorY = u_southMercatorYAndOneOverHeight.x;\nfloat oneOverMercatorHeight = u_southMercatorYAndOneOverHeight.y;\nfloat currentLatitude = mix(southLatitude, northLatitude, textureCoordinates.y);\ncurrentLatitude = clamp(currentLatitude, -czm_webMercatorMaxLatitude, czm_webMercatorMaxLatitude);\npositionFraction = czm_latitudeToWebMercatorFraction(currentLatitude, southMercatorY, oneOverMercatorHeight);\n}\nreturn positionFraction;\n}\nfloat get2DGeographicYPositionFraction(vec2 textureCoordinates)\n{\nreturn textureCoordinates.y;\n}\nvec4 getPositionPlanarEarth(vec3 position, float height, vec2 textureCoordinates)\n{\nfloat yPositionFraction = get2DYPositionFraction(textureCoordinates);\nvec4 rtcPosition2D = vec4(height, mix(u_tileRectangle.st, u_tileRectangle.pq, vec2(textureCoordinates.x, yPositionFraction)), 1.0);\nreturn czm_projection * (u_modifiedModelView * rtcPosition2D);\n}\nvec4 getPosition2DMode(vec3 position, float height, vec2 textureCoordinates)\n{\nreturn getPositionPlanarEarth(position, 0.0, textureCoordinates);\n}\nvec4 getPositionColumbusViewMode(vec3 position, float height, vec2 textureCoordinates)\n{\nreturn getPositionPlanarEarth(position, height, textureCoordinates);\n}\nvec4 getPositionMorphingMode(vec3 position, float height, vec2 textureCoordinates)\n{\nvec3 position3DWC = position + u_center3D;\nfloat yPositionFraction = get2DYPositionFraction(textureCoordinates);\nvec4 position2DWC = vec4(0.0, mix(u_tileRectangle.st, u_tileRectangle.pq, vec2(textureCoordinates.x, yPositionFraction)), 1.0);\nvec4 morphPosition = czm_columbusViewMorph(position2DWC, vec4(position3DWC, 1.0), czm_morphTime);\nreturn czm_modelViewProjection * morphPosition;\n}\n#ifdef QUANTIZATION_BITS12\nuniform vec2 u_minMaxHeight;\nuniform mat4 u_scaleAndBias;\n#endif\nvoid main()\n{\n#ifdef QUANTIZATION_BITS12\nvec2 xy = czm_decompressTextureCoordinates(compressed.x);\nvec2 zh = czm_decompressTextureCoordinates(compressed.y);\nvec3 position = vec3(xy, zh.x);\nfloat height = zh.y;\nvec2 textureCoordinates = czm_decompressTextureCoordinates(compressed.z);\nfloat encodedNormal = compressed.w;\nheight = height * (u_minMaxHeight.y - u_minMaxHeight.x) + u_minMaxHeight.x;\nposition = (u_scaleAndBias * vec4(position, 1.0)).xyz;\n#else\nvec3 position = position3DAndHeight.xyz;\nfloat height = position3DAndHeight.w;\nvec2 textureCoordinates = textureCoordAndEncodedNormals.xy;\nfloat encodedNormal = textureCoordAndEncodedNormals.z;\n#endif\nvec3 position3DWC = position + u_center3D;\ngl_Position = getPosition(position, height, textureCoordinates);\nv_textureCoordinates = textureCoordinates;\n#if defined(ENABLE_VERTEX_LIGHTING)\nv_positionEC = (czm_modelView3D * vec4(position3DWC, 1.0)).xyz;\nv_positionMC = position3DWC;\nv_normalMC = czm_octDecode(encodedNormal);\nv_normalEC = czm_normal3D * v_normalMC;\n#elif defined(SHOW_REFLECTIVE_OCEAN) || defined(ENABLE_DAYNIGHT_SHADING)\nv_positionEC = (czm_modelView3D * vec4(position3DWC, 1.0)).xyz;\nv_positionMC = position3DWC;\n#endif\n#ifdef FOG\nAtmosphereColor atmosColor = computeGroundAtmosphereFromSpace(position3DWC);\nv_mieColor = atmosColor.mie;\nv_rayleighColor = atmosColor.rayleigh;\nv_distance = length((czm_modelView3D * vec4(position3DWC, 1.0)).xyz);\n#endif\n}\n"}),i("Shaders/GroundAtmosphere",[],function(){"use strict";return"const float fInnerRadius = 6378137.0;\nconst float fOuterRadius = 6378137.0 * 1.025;\nconst float fOuterRadius2 = fOuterRadius * fOuterRadius;\nconst float Kr = 0.0025;\nconst float Km = 0.0015;\nconst float ESun = 15.0;\nconst float fKrESun = Kr * ESun;\nconst float fKmESun = Km * ESun;\nconst float fKr4PI = Kr * 4.0 * czm_pi;\nconst float fKm4PI = Km * 4.0 * czm_pi;\nconst float fScale = 1.0 / (fOuterRadius - fInnerRadius);\nconst float fScaleDepth = 0.25;\nconst float fScaleOverScaleDepth = fScale / fScaleDepth;\nstruct AtmosphereColor\n{\nvec3 mie;\nvec3 rayleigh;\n};\nconst int nSamples = 2;\nconst float fSamples = 2.0;\nfloat scale(float fCos)\n{\nfloat x = 1.0 - fCos;\nreturn fScaleDepth * exp(-0.00287 + x*(0.459 + x*(3.83 + x*(-6.80 + x*5.25))));\n}\nAtmosphereColor computeGroundAtmosphereFromSpace(vec3 v3Pos)\n{\nvec3 v3InvWavelength = vec3(1.0 / pow(0.650, 4.0), 1.0 / pow(0.570, 4.0), 1.0 / pow(0.475, 4.0));\nvec3 v3Ray = v3Pos - czm_viewerPositionWC;\nfloat fFar = length(v3Ray);\nv3Ray /= fFar;\nfloat fCameraHeight = length(czm_viewerPositionWC);\nfloat fCameraHeight2 = fCameraHeight * fCameraHeight;\nfloat B = 2.0 * length(czm_viewerPositionWC) * dot(normalize(czm_viewerPositionWC), v3Ray);\nfloat C = fCameraHeight2 - fOuterRadius2;\nfloat fDet = max(0.0, B*B - 4.0 * C);\nfloat fNear = 0.5 * (-B - sqrt(fDet));\nvec3 v3Start = czm_viewerPositionWC + v3Ray * fNear;\nfFar -= fNear;\nfloat fDepth = exp((fInnerRadius - fOuterRadius) / fScaleDepth);\nfloat fLightAngle = 1.0;\nfloat fCameraAngle = dot(-v3Ray, v3Pos) / length(v3Pos);\nfloat fCameraScale = scale(fCameraAngle);\nfloat fLightScale = scale(fLightAngle);\nfloat fCameraOffset = fDepth*fCameraScale;\nfloat fTemp = (fLightScale + fCameraScale);\nfloat fSampleLength = fFar / fSamples;\nfloat fScaledLength = fSampleLength * fScale;\nvec3 v3SampleRay = v3Ray * fSampleLength;\nvec3 v3SamplePoint = v3Start + v3SampleRay * 0.5;\nvec3 v3FrontColor = vec3(0.0);\nvec3 v3Attenuate = vec3(0.0);\nfor(int i=0; i<nSamples; i++)\n{\nfloat fHeight = length(v3SamplePoint);\nfloat fDepth = exp(fScaleOverScaleDepth * (fInnerRadius - fHeight));\nfloat fScatter = fDepth*fTemp - fCameraOffset;\nv3Attenuate = exp(-fScatter * (v3InvWavelength * fKr4PI + fKm4PI));\nv3FrontColor += v3Attenuate * (fDepth * fScaledLength);\nv3SamplePoint += v3SampleRay;\n}\nAtmosphereColor color;\ncolor.mie = v3FrontColor * (v3InvWavelength * fKrESun + fKmESun);\ncolor.rayleigh = v3Attenuate;\nreturn color;\n}\n"}),i("Scene/GlobeSurfaceShaderSet",["../Core/defined","../Core/destroyObject","../Core/TerrainQuantization","../Renderer/ShaderProgram","../Scene/SceneMode"],function(e,t,i,r,n){"use strict";function o(e,t,i){this.numberOfDayTextures=e,this.flags=t,this.shaderProgram=i}function a(){this.baseVertexShaderSource=void 0,this.baseFragmentShaderSource=void 0,this._shadersByTexturesFlags=[],this._pickShaderPrograms=[]}function s(e){var t,i="vec4 getPosition(vec3 position, float height, vec2 textureCoordinates) { return getPosition3DMode(position, height, textureCoordinates); }",r="vec4 getPosition(vec3 position, float height, vec2 textureCoordinates) { return getPosition2DMode(position, height, textureCoordinates); }",o="vec4 getPosition(vec3 position, float height, vec2 textureCoordinates) { return getPositionColumbusViewMode(position, height, textureCoordinates); }",a="vec4 getPosition(vec3 position, float height, vec2 textureCoordinates) { return getPositionMorphingMode(position, height, textureCoordinates); }"; +switch(e){case n.SCENE3D:t=i;break;case n.SCENE2D:t=r;break;case n.COLUMBUS_VIEW:t=o;break;case n.MORPHING:t=a}return t}function l(e){var t="float get2DYPositionFraction(vec2 textureCoordinates) { return get2DGeographicYPositionFraction(textureCoordinates); }",i="float get2DYPositionFraction(vec2 textureCoordinates) { return get2DMercatorYPositionFraction(textureCoordinates); }";return e?i:t}return a.prototype.getShaderProgram=function(t,n,a,u,c,h,d,p,m,f,v,g,_,y,C){var E=0,S="",w=n.pickTerrain.mesh.encoding,T=w.quantization;T===i.BITS12&&(E=1,S="QUANTIZATION_BITS12");var x=t.mode,b=x|u<<2|c<<3|h<<4|d<<5|p<<6|m<<7|f<<8|v<<9|g<<10|_<<11|y<<12|C<<13|E<<14,A=n.surfaceShader;if(e(A)&&A.numberOfDayTextures===a&&A.flags===b)return A.shaderProgram;var P=this._shadersByTexturesFlags[a];if(e(P)||(P=this._shadersByTexturesFlags[a]=[]),A=P[b],!e(A)){var I=this.baseVertexShaderSource.clone(),M=this.baseFragmentShaderSource.clone();I.defines.push(S),M.defines.push("TEXTURE_UNITS "+a),u&&M.defines.push("APPLY_BRIGHTNESS"),c&&M.defines.push("APPLY_CONTRAST"),h&&M.defines.push("APPLY_HUE"),d&&M.defines.push("APPLY_SATURATION"),p&&M.defines.push("APPLY_GAMMA"),m&&M.defines.push("APPLY_ALPHA"),f&&(M.defines.push("SHOW_REFLECTIVE_OCEAN"),I.defines.push("SHOW_REFLECTIVE_OCEAN")),v&&M.defines.push("SHOW_OCEAN_WAVES"),g&&(_?(I.defines.push("ENABLE_VERTEX_LIGHTING"),M.defines.push("ENABLE_VERTEX_LIGHTING")):(I.defines.push("ENABLE_DAYNIGHT_SHADING"),M.defines.push("ENABLE_DAYNIGHT_SHADING"))),C&&(I.defines.push("FOG"),M.defines.push("FOG"));for(var D=" vec4 computeDayColor(vec4 initialColor, vec2 textureCoordinates)\n {\n vec4 color = initialColor;\n",R=0;a>R;++R)D+=" color = sampleAndBlend(\n color,\n u_dayTextures["+R+"],\n textureCoordinates,\n u_dayTextureTexCoordsRectangle["+R+"],\n u_dayTextureTranslationAndScale["+R+"],\n "+(m?"u_dayTextureAlpha["+R+"]":"1.0")+",\n "+(u?"u_dayTextureBrightness["+R+"]":"0.0")+",\n "+(c?"u_dayTextureContrast["+R+"]":"0.0")+",\n "+(h?"u_dayTextureHue["+R+"]":"0.0")+",\n "+(d?"u_dayTextureSaturation["+R+"]":"0.0")+",\n "+(p?"u_dayTextureOneOverGamma["+R+"]":"0.0")+"\n );\n";D+=" return color;\n }",M.sources.push(D),I.sources.push(s(x)),I.sources.push(l(y));var O=r.fromCache({context:t.context,vertexShaderSource:I,fragmentShaderSource:M,attributeLocations:w.getAttributeLocations()});A=P[b]=new o(a,b,O)}return n.surfaceShader=A,A.shaderProgram},a.prototype.getPickShaderProgram=function(t,n,o){var a=0,u="",c=n.pickTerrain.mesh.encoding,h=c.quantization;h===i.BITS12&&(a=1,u="QUANTIZATION_BITS12");var d=t.mode,p=d|o<<2|a<<3,m=this._pickShaderPrograms[p];if(!e(m)){var f=this.baseVertexShaderSource.clone();f.defines.push(u),f.sources.push(s(d)),f.sources.push(l(o));var v="void main()\n{\n gl_FragColor = vec4(1.0, 1.0, 0.0, 1.0);\n}\n";m=this._pickShaderPrograms[p]=r.fromCache({context:t.context,vertexShaderSource:f,fragmentShaderSource:v,attributeLocations:c.getAttributeLocations()})}return m},a.prototype.destroy=function(){var i=this._shadersByTexturesFlags;for(var r in i)if(i.hasOwnProperty(r)){var n=i[r];if(!e(n))continue;for(var o in n)if(n.hasOwnProperty(o)){var a=n[o];e(a)&&a.shaderProgram.destroy()}}return t(this)},a}),i("Scene/ImageryState",["../Core/freezeObject"],function(e){"use strict";var t={UNLOADED:0,TRANSITIONING:1,RECEIVED:2,TEXTURE_LOADED:3,READY:4,FAILED:5,INVALID:6,PLACEHOLDER:7};return e(t)}),i("Scene/QuadtreeTileLoadState",["../Core/freezeObject"],function(e){"use strict";var t={START:0,LOADING:1,DONE:2,FAILED:3};return e(t)}),i("Scene/TerrainState",["../Core/freezeObject"],function(e){"use strict";var t={FAILED:0,UNLOADED:1,RECEIVING:2,RECEIVED:3,TRANSFORMING:4,TRANSFORMED:5,READY:6};return e(t)}),i("Scene/TileBoundingBox",["../Core/Cartesian3","../Core/Cartographic","../Core/defaultValue","../Core/defined","../Core/DeveloperError","../Core/Ellipsoid","../Core/Rectangle","./SceneMode"],function(e,t,i,r,n,o,a,s){"use strict";function l(t,i,r){r.cartographicToCartesian(a.southwest(i),t.southwestCornerCartesian),r.cartographicToCartesian(a.northeast(i),t.northeastCornerCartesian),m.longitude=i.west,m.latitude=.5*(i.south+i.north),m.height=0;var n=r.cartographicToCartesian(m,d),o=e.cross(n,e.UNIT_Z,c);e.normalize(o,t.westNormal),m.longitude=i.east;var s=r.cartographicToCartesian(m,p),l=e.cross(e.UNIT_Z,s,c);e.normalize(l,t.eastNormal);var u=r.geodeticSurfaceNormalCartographic(a.southeast(i),h),f=e.subtract(n,s,c),v=e.cross(u,f,h);e.normalize(v,t.southNormal);var g=r.geodeticSurfaceNormalCartographic(a.northwest(i),h),_=e.cross(f,g,h);e.normalize(_,t.northNormal)}var u=function(t){t=i(t,i.EMPTY_OBJECT),this.rectangle=a.clone(t.rectangle),this.minimumHeight=i(t.minimumHeight,0),this.maximumHeight=i(t.maximumHeight,0),this.southwestCornerCartesian=new e,this.northeastCornerCartesian=new e,this.westNormal=new e,this.southNormal=new e,this.eastNormal=new e,this.northNormal=new e;var r=i(t.ellipsoid,o.WGS84);l(this,t.rectangle,r)},c=new e,h=new e,d=new e,p=new e,m=new t,f=new e,v=new e,g=new e(0,-1,0),_=new e(0,0,-1),y=new e;return u.prototype.distanceToCamera=function(t){var i=t.camera,r=i.positionWC,n=i.positionCartographic,o=0;if(!a.contains(this.rectangle,n)){var l=this.southwestCornerCartesian,u=this.northeastCornerCartesian,c=this.westNormal,h=this.southNormal,d=this.eastNormal,p=this.northNormal;t.mode!==s.SCENE3D&&(l=t.mapProjection.project(a.southwest(this.rectangle),f),l.z=l.y,l.y=l.x,l.x=0,u=t.mapProjection.project(a.northeast(this.rectangle),v),u.z=u.y,u.y=u.x,u.x=0,c=g,d=e.UNIT_Y,h=_,p=e.UNIT_Z);var m=e.subtract(r,l,y),C=e.dot(m,c),E=e.dot(m,h),S=e.subtract(r,u,y),w=e.dot(S,d),T=e.dot(S,p);C>0?o+=C*C:w>0&&(o+=w*w),E>0?o+=E*E:T>0&&(o+=T*T)}var x;x=t.mode===s.SCENE3D?n.height:r.x;var b=t.mode===s.SCENE3D?this.maximumHeight:0,A=x-b;return A>0&&(o+=A*A),Math.sqrt(o)},u}),i("Scene/TileTerrain",["../Core/BoundingSphere","../Core/Cartesian3","../Core/ComponentDatatype","../Core/defined","../Core/DeveloperError","../Core/IndexDatatype","../Core/OrientedBoundingBox","../Core/TileProviderError","../Renderer/Buffer","../Renderer/BufferUsage","../Renderer/VertexArray","../ThirdParty/when","./TerrainState","./TileBoundingBox"],function(e,t,i,r,n,o,a,s,l,u,c,h,d,p){"use strict";function m(e){this.state=d.UNLOADED,this.data=void 0,this.mesh=void 0,this.vertexArray=void 0,this.upsampleDetails=e}function f(e,t,i,n,o){function a(t){e.data=t,e.state=d.RECEIVED}function l(){e.state=d.FAILED;var r="Failed to obtain terrain tile X: "+i+" Y: "+n+" Level: "+o+".";t._requestError=s.handleError(t._requestError,t,t.errorEvent,r,i,n,o,u)}function u(){e.data=t.requestTileGeometry(i,n,o),r(e.data)?(e.state=d.RECEIVING,h(e.data,a,l)):e.state=d.UNLOADED}u()}function v(e,t,i,n,o,a){var s=i.tilingScheme,l=e.data,u=l.createMesh(s,n,o,a,t.terrainExaggeration);r(u)&&(e.state=d.TRANSFORMING,h(u,function(t){e.mesh=t,e.state=d.TRANSFORMED},function(){e.state=d.FAILED}))}function g(e,t,i,n,a,s){var h=e.mesh.vertices,p=l.createVertexBuffer({context:t,typedArray:h,usage:u.STATIC_DRAW}),m=e.mesh.encoding.getAttributes(p),f=e.mesh.indices.indexBuffers||{},v=f[t.id];if(!r(v)||v.isDestroyed()){var g=e.mesh.indices,_=2===g.BYTES_PER_ELEMENT?o.UNSIGNED_SHORT:o.UNSIGNED_INT;v=l.createIndexBuffer({context:t,typedArray:g,usage:u.STATIC_DRAW,indexDatatype:_}),v.vertexArrayDestroyable=!1,v.referenceCount=1,f[t.id]=v,e.mesh.indices.indexBuffers=f}else++v.referenceCount;e.vertexArray=new c({context:t,attributes:m,indexBuffer:v}),e.state=d.READY}return m.prototype.freeResources=function(){if(this.state=d.UNLOADED,this.data=void 0,this.mesh=void 0,r(this.vertexArray)){var e=this.vertexArray.indexBuffer;this.vertexArray.destroy(),this.vertexArray=void 0,!e.isDestroyed()&&r(e.referenceCount)&&(--e.referenceCount,0===e.referenceCount&&e.destroy())}},m.prototype.publishToTile=function(i){var r=i.data,n=this.mesh;t.clone(n.center,r.center),r.minimumHeight=n.minimumHeight,r.maximumHeight=n.maximumHeight,r.boundingSphere3D=e.clone(n.boundingSphere3D,r.boundingSphere3D),r.orientedBoundingBox=a.clone(n.orientedBoundingBox,r.orientedBoundingBox),r.tileBoundingBox=new p({rectangle:i.rectangle,minimumHeight:n.minimumHeight,maximumHeight:n.maximumHeight,ellipsoid:i.tilingScheme.ellipsoid}),i.data.occludeePointInScaledSpace=t.clone(n.occludeePointInScaledSpace,r.occludeePointInScaledSpace),r.freeVertexArray(),r.vertexArray=this.vertexArray,this.vertexArray=void 0},m.prototype.processLoadStateMachine=function(e,t,i,r,n){this.state===d.UNLOADED&&f(this,t,i,r,n),this.state===d.RECEIVED&&v(this,e,t,i,r,n),this.state===d.TRANSFORMED&&g(this,e.context,t,i,r,n)},m.prototype.processUpsampleStateMachine=function(e,t,i,n,o){if(this.state===d.UNLOADED){var a=this.upsampleDetails,s=a.data,l=a.x,u=a.y,c=a.level;if(this.data=s.upsample(t.tilingScheme,l,u,c,i,n,o),!r(this.data))return;this.state=d.RECEIVING;var p=this;h(this.data,function(e){p.data=e,p.state=d.RECEIVED},function(){p.state=d.FAILED})}this.state===d.RECEIVED&&v(this,e,t,i,n,o),this.state===d.TRANSFORMED&&g(this,e.context,t,i,n,o)},m}),i("Scene/GlobeSurfaceTile",["../Core/BoundingSphere","../Core/Cartesian3","../Core/Cartesian4","../Core/Cartographic","../Core/defaultValue","../Core/defined","../Core/defineProperties","../Core/IntersectionTests","../Core/PixelFormat","../Core/Rectangle","../Renderer/PixelDatatype","../Renderer/Sampler","../Renderer/Texture","../Renderer/TextureMagnificationFilter","../Renderer/TextureMinificationFilter","../Renderer/TextureWrap","./ImageryState","./QuadtreeTileLoadState","./SceneMode","./TerrainState","./TileBoundingBox","./TileTerrain"],function(e,t,i,r,n,o,a,s,l,u,c,h,d,p,m,f,v,g,_,y,C,E){"use strict";function S(){this.imagery=[],this.waterMaskTexture=void 0,this.waterMaskTranslationAndScale=new i(0,0,1,1),this.terrainData=void 0,this.center=new t,this.vertexArray=void 0,this.minimumHeight=0,this.maximumHeight=0,this.boundingSphere3D=new e,this.boundingSphere2D=new e,this.orientedBoundingBox=void 0,this.tileBoundingBox=void 0,this.occludeePointInScaledSpace=new t,this.loadedTerrain=void 0,this.upsampledTerrain=void 0,this.pickBoundingSphere=new e,this.pickTerrain=void 0,this.surfaceShader=void 0}function w(e,i,r,n,a,s){if(e.decodePosition(n,a,s),o(i)&&i!==_.SCENE3D){var l=r.ellipsoid,u=l.cartesianToCartographic(s);r.project(u,s),t.fromElements(s.z,s.x,s.y,s)}return s}function T(e,t,i){var r=e.data,n=b(e);o(n)&&(r.upsampledTerrain=new E(n)),I(e,t)&&(r.loadedTerrain=new E);for(var a=0,s=i.length;s>a;++a){var l=i.get(a);l.show&&l._createTileImagerySkeletons(e,t)}}function x(e,t,i){var r=e.data,a=r.loadedTerrain,s=r.upsampledTerrain,l=!1;o(a)&&(a.processLoadStateMachine(t,i,e.x,e.y,e.level),a.state>=y.RECEIVED&&(r.terrainData!==a.data&&(r.terrainData=a.data,D(t.context,r),P(e)),l=!0),a.state===y.READY?(a.publishToTile(e),r.pickTerrain=n(r.loadedTerrain,r.upsampledTerrain),r.loadedTerrain=void 0,r.upsampledTerrain=void 0):a.state===y.FAILED&&(r.loadedTerrain=void 0)),!l&&o(s)&&(s.processUpsampleStateMachine(t,i,e.x,e.y,e.level),s.state>=y.RECEIVED&&r.terrainData!==s.data&&(r.terrainData=s.data,i.hasWaterMask&&R(e),A(e)),s.state===y.READY?(s.publishToTile(e),r.pickTerrain=r.upsampledTerrain,r.upsampledTerrain=void 0):s.state===y.FAILED&&(r.upsampledTerrain=void 0))}function b(e){for(var t=e.parent;o(t)&&o(t.data)&&!o(t.data.terrainData);)t=t.parent;return o(t)&&o(t.data)?{data:t.data.terrainData,x:t.x,y:t.y,level:t.level}:void 0}function A(e){var t=e.data;if(o(e._children))for(var i=0;4>i;++i){var r=e._children[i];if(r.state!==g.START){var n=r.data;if(o(n.terrainData)&&!n.terrainData.wasCreatedByUpsampling())continue;o(n.upsampledTerrain)&&n.upsampledTerrain.freeResources(),n.upsampledTerrain=new E({data:t.terrainData,x:e.x,y:e.y,level:e.level}),r.state=g.LOADING}}}function P(e){var t=e.data;if(o(e.children))for(var i=0;4>i;++i){var r=e.children[i];if(r.state!==g.START){var n=r.data;if(o(n.terrainData)&&!n.terrainData.wasCreatedByUpsampling())continue;o(n.upsampledTerrain)&&n.upsampledTerrain.freeResources(),n.upsampledTerrain=new E({data:t.terrainData,x:e.x,y:e.y,level:e.level}),t.terrainData.isChildAvailable(e.x,e.y,r.x,r.y)&&(o(n.loadedTerrain)||(n.loadedTerrain=new E)),r.state=g.LOADING}}}function I(e,t){var i=t.getTileDataAvailable(e.x,e.y,e.level);if(o(i))return i;var r=e.parent;return o(r)?o(r.data)&&o(r.data.terrainData)?r.data.terrainData.isChildAvailable(r.x,r.y,e.x,e.y):!1:!0}function M(e){var t=e.cache.tile_waterMaskData;if(!o(t)){var i=new d({context:e,pixelFormat:l.LUMINANCE,pixelDatatype:c.UNSIGNED_BYTE,source:{arrayBufferView:new Uint8Array([255]),width:1,height:1}});i.referenceCount=1;var r=new h({wrapS:f.CLAMP_TO_EDGE,wrapT:f.CLAMP_TO_EDGE,minificationFilter:m.LINEAR,magnificationFilter:p.LINEAR});t={allWaterTexture:i,sampler:r,destroy:function(){this.allWaterTexture.destroy()}},e.cache.tile_waterMaskData=t}return t}function D(e,t){var r=t.waterMaskTexture;o(r)&&(--r.referenceCount,0===r.referenceCount&&r.destroy(),t.waterMaskTexture=void 0);var n=t.terrainData.waterMask;if(o(n)){var a,s=M(e),u=n.length;if(1===u){if(0===n[0])return;a=s.allWaterTexture}else{var h=Math.sqrt(u);a=new d({context:e,pixelFormat:l.LUMINANCE,pixelDatatype:c.UNSIGNED_BYTE,source:{width:h,height:h,arrayBufferView:n},sampler:s.sampler}),a.referenceCount=0}++a.referenceCount,t.waterMaskTexture=a,i.fromElements(0,0,1,1,t.waterMaskTranslationAndScale)}}function R(e){for(var t=e.data,i=e.parent;o(i)&&!o(i.data.terrainData)||i.data.terrainData.wasCreatedByUpsampling();)i=i.parent;if(o(i)&&o(i.data.waterMaskTexture)){t.waterMaskTexture=i.data.waterMaskTexture,++t.waterMaskTexture.referenceCount;var r=i.rectangle,n=e.rectangle,a=n.width,s=n.height,l=a/r.width,u=s/r.height;t.waterMaskTranslationAndScale.x=l*(n.west-r.west)/a,t.waterMaskTranslationAndScale.y=u*(n.south-r.south)/s,t.waterMaskTranslationAndScale.z=l,t.waterMaskTranslationAndScale.w=u}}a(S.prototype,{eligibleForUnloading:{get:function(){for(var e=this.loadedTerrain,t=o(e)&&(e.state===y.RECEIVING||e.state===y.TRANSFORMING),i=this.upsampledTerrain,r=o(i)&&(i.state===y.RECEIVING||i.state===y.TRANSFORMING),n=!t&&!r,a=this.imagery,s=0,l=a.length;n&&l>s;++s){var u=a[s];n=!o(u.loadingImagery)||u.loadingImagery.state!==v.TRANSITIONING}return n}}});var O=new t,N=new t,L=new t,F=new t;return S.prototype.pick=function(e,i,r,n,a){var l=this.pickTerrain;if(o(l)){var u=l.mesh;if(o(u))for(var c=u.vertices,h=u.indices,d=u.encoding,p=h.length,m=0;p>m;m+=3){var f=h[m],v=h[m+1],g=h[m+2],_=w(d,i,r,c,f,O),y=w(d,i,r,c,v,N),C=w(d,i,r,c,g,L),E=s.rayTriangle(e,_,y,C,n,F);if(o(E))return t.clone(E,a)}}},S.prototype.freeResources=function(){o(this.waterMaskTexture)&&(--this.waterMaskTexture.referenceCount,0===this.waterMaskTexture.referenceCount&&this.waterMaskTexture.destroy(),this.waterMaskTexture=void 0),this.terrainData=void 0,o(this.loadedTerrain)&&(this.loadedTerrain.freeResources(),this.loadedTerrain=void 0),o(this.upsampledTerrain)&&(this.upsampledTerrain.freeResources(),this.upsampledTerrain=void 0),o(this.pickTerrain)&&(this.pickTerrain.freeResources(),this.pickTerrain=void 0);var e,t,i=this.imagery;for(e=0,t=i.length;t>e;++e)i[e].freeResources();this.imagery.length=0,this.freeVertexArray()},S.prototype.freeVertexArray=function(){var e;o(this.vertexArray)&&(e=this.vertexArray.indexBuffer,this.vertexArray=this.vertexArray.destroy(),!e.isDestroyed()&&o(e.referenceCount)&&(--e.referenceCount,0===e.referenceCount&&e.destroy())),o(this.wireframeVertexArray)&&(e=this.wireframeVertexArray.indexBuffer,this.wireframeVertexArray=this.wireframeVertexArray.destroy(),!e.isDestroyed()&&o(e.referenceCount)&&(--e.referenceCount,0===e.referenceCount&&e.destroy()))},S.processStateMachine=function(e,t,i,r){var n=e.data;o(n)||(n=e.data=new S),e.state===g.START&&(T(e,i,r),e.state=g.LOADING),e.state===g.LOADING&&x(e,t,i);for(var a=o(n.vertexArray),s=!o(n.loadedTerrain)&&!o(n.upsampledTerrain),l=o(n.terrainData)&&n.terrainData.wasCreatedByUpsampling(),u=n.imagery,c=0,h=u.length;h>c;++c){var d=u[c];if(o(d.loadingImagery)){if(d.loadingImagery.state===v.PLACEHOLDER){var p=d.loadingImagery.imageryLayer;if(p.imageryProvider.ready){d.freeResources(),u.splice(c,1),p._createTileImagerySkeletons(e,i,c),--c,h=u.length;continue}l=!1}var m=d.processStateMachine(e,t);s=s&&m,a=a&&(m||o(d.readyImagery)),l=l&&o(d.loadingImagery)&&(d.loadingImagery.state===v.FAILED||d.loadingImagery.state===v.INVALID)}else l=!1}e.upsampledFromParent=l,c===h&&(a&&(e.renderable=!0),s&&(e.state=g.DONE))},S}),i("Shaders/ReprojectWebMercatorFS",[],function(){"use strict";return"uniform sampler2D u_texture;\nvarying vec2 v_textureCoordinates;\nvoid main()\n{\ngl_FragColor = texture2D(u_texture, v_textureCoordinates);\n}\n"}),i("Shaders/ReprojectWebMercatorVS",[],function(){"use strict";return"attribute vec4 position;\nattribute float webMercatorT;\nuniform vec2 u_textureDimensions;\nvarying vec2 v_textureCoordinates;\nvoid main()\n{\nv_textureCoordinates = vec2(position.x, webMercatorT);\ngl_Position = czm_viewportOrthographic * (position * vec4(u_textureDimensions, 1.0, 1.0));\n}\n"}),i("Scene/Imagery",["../Core/defined","../Core/destroyObject","./ImageryState"],function(e,t,i){"use strict";function r(t,r,n,o,a){if(this.imageryLayer=t,this.x=r,this.y=n,this.level=o,0!==o){var s=r/2|0,l=n/2|0,u=o-1;this.parent=t.getImageryFromCache(s,l,u)}if(this.state=i.UNLOADED,this.imageUrl=void 0,this.image=void 0,this.texture=void 0,this.credits=void 0,this.referenceCount=0,!e(a)&&t.imageryProvider.ready){var c=t.imageryProvider.tilingScheme;a=c.tileXYToRectangle(r,n,o)}this.rectangle=a}return r.createPlaceholder=function(e){var t=new r(e,0,0,0);return t.addReference(),t.state=i.PLACEHOLDER,t},r.prototype.addReference=function(){++this.referenceCount},r.prototype.releaseReference=function(){return--this.referenceCount,0===this.referenceCount?(this.imageryLayer.removeImageryFromCache(this),e(this.parent)&&this.parent.releaseReference(),e(this.image)&&e(this.image.destroy)&&this.image.destroy(),e(this.texture)&&this.texture.destroy(),t(this),0):this.referenceCount},r.prototype.processStateMachine=function(e){this.state===i.UNLOADED&&(this.state=i.TRANSITIONING,this.imageryLayer._requestImagery(this)),this.state===i.RECEIVED&&(this.state=i.TRANSITIONING,this.imageryLayer._createTexture(e.context,this)),this.state===i.TEXTURE_LOADED&&(this.state=i.TRANSITIONING,this.imageryLayer._reprojectTexture(e,this))},r}),i("Scene/TileImagery",["../Core/defined","./ImageryState"],function(e,t){"use strict";function i(e,t){this.readyImagery=void 0,this.loadingImagery=e,this.textureCoordinateRectangle=t,this.textureTranslationAndScale=void 0}return i.prototype.freeResources=function(){e(this.readyImagery)&&this.readyImagery.releaseReference(),e(this.loadingImagery)&&this.loadingImagery.releaseReference()},i.prototype.processStateMachine=function(i,r){var n=this.loadingImagery,o=n.imageryLayer;if(n.processStateMachine(r),n.state===t.READY)return e(this.readyImagery)&&this.readyImagery.releaseReference(),this.readyImagery=this.loadingImagery,this.loadingImagery=void 0,this.textureTranslationAndScale=o._calculateTextureTranslationAndScale(i,this),!0;for(var a,s=n.parent;e(s)&&s.state!==t.READY;)s.state!==t.FAILED&&s.state!==t.INVALID&&(a=a||s),s=s.parent;return this.readyImagery!==s&&(e(this.readyImagery)&&this.readyImagery.releaseReference(),this.readyImagery=s,e(s)&&(s.addReference(),this.textureTranslationAndScale=o._calculateTextureTranslationAndScale(i,this))),n.state===t.FAILED||n.state===t.INVALID?e(a)?(a.processStateMachine(r),!1):!0:!1},i}),i("Scene/ImageryLayer",["../Core/BoundingRectangle","../Core/Cartesian2","../Core/Cartesian4","../Core/Color","../Core/ComponentDatatype","../Core/defaultValue","../Core/defined","../Core/defineProperties","../Core/destroyObject","../Core/FeatureDetection","../Core/GeographicTilingScheme","../Core/IndexDatatype","../Core/Math","../Core/PixelFormat","../Core/PrimitiveType","../Core/Rectangle","../Core/TerrainProvider","../Core/TileProviderError","../Renderer/Buffer","../Renderer/BufferUsage","../Renderer/ClearCommand","../Renderer/ComputeCommand","../Renderer/ContextLimits","../Renderer/DrawCommand","../Renderer/Framebuffer","../Renderer/MipmapHint","../Renderer/RenderState","../Renderer/Sampler","../Renderer/ShaderProgram","../Renderer/ShaderSource","../Renderer/Texture","../Renderer/TextureMagnificationFilter","../Renderer/TextureMinificationFilter","../Renderer/TextureWrap","../Renderer/VertexArray","../Shaders/ReprojectWebMercatorFS","../Shaders/ReprojectWebMercatorVS","../ThirdParty/when","./Imagery","./ImageryState","./TileImagery"],function(e,t,i,r,n,o,a,s,l,u,c,h,d,p,m,f,v,g,_,y,C,E,S,w,T,x,b,A,P,I,M,D,R,O,N,L,F,B,V,k,z){"use strict";function U(e,t){this._imageryProvider=e,t=o(t,{}),this.alpha=o(t.alpha,o(e.defaultAlpha,1)),this.brightness=o(t.brightness,o(e.defaultBrightness,U.DEFAULT_BRIGHTNESS)),this.contrast=o(t.contrast,o(e.defaultContrast,U.DEFAULT_CONTRAST)),this.hue=o(t.hue,o(e.defaultHue,U.DEFAULT_HUE)),this.saturation=o(t.saturation,o(e.defaultSaturation,U.DEFAULT_SATURATION)),this.gamma=o(t.gamma,o(e.defaultGamma,U.DEFAULT_GAMMA)),this.show=o(t.show,!0),this._minimumTerrainLevel=t.minimumTerrainLevel,this._maximumTerrainLevel=t.maximumTerrainLevel,this._rectangle=o(t.rectangle,f.MAX_VALUE),this._maximumAnisotropy=t.maximumAnisotropy,this._imageryCache={},this._skeletonPlaceholder=new z(V.createPlaceholder(this)),this._show=!0,this._layerIndex=-1,this._isBaseLayer=!1,this._requestImageError=void 0}function G(e,t,i,r){if(d.isPowerOfTwo(r.width)&&d.isPowerOfTwo(r.height)){var n=t.cache.imageryLayer_mipmapSampler;if(!a(n)){var s=S.maximumTextureFilterAnisotropy;n=t.cache.imageryLayer_mipmapSampler=new A({wrapS:O.CLAMP_TO_EDGE,wrapT:O.CLAMP_TO_EDGE,minificationFilter:R.LINEAR_MIPMAP_LINEAR,magnificationFilter:D.LINEAR,maximumAnisotropy:Math.min(s,o(e._maximumAnisotropy,s))})}r.generateMipmap(x.NICEST),r.sampler=n}else{var l=t.cache.imageryLayer_nonMipmapSampler;a(l)||(l=t.cache.imageryLayer_nonMipmapSampler=new A({wrapS:O.CLAMP_TO_EDGE,wrapT:O.CLAMP_TO_EDGE,minificationFilter:R.LINEAR,magnificationFilter:D.LINEAR})),r.sampler=l}i.state=k.READY}function W(e,t,i){return JSON.stringify([e,t,i])}function H(e,t,i,r){var n=t.cache.imageryLayer_reproject;if(!a(n)){n=t.cache.imageryLayer_reproject={vertexArray:void 0,shaderProgram:void 0,sampler:void 0,destroy:function(){a(this.framebuffer)&&this.framebuffer.destroy(),a(this.vertexArray)&&this.vertexArray.destroy(),a(this.shaderProgram)&&this.shaderProgram.destroy()}};for(var o=new Float32Array(256),s=0,l=0;64>l;++l){var u=l/63;o[s++]=0,o[s++]=u,o[s++]=1,o[s++]=u}var c={position:0,webMercatorT:1},p=v.getRegularGridIndices(2,64),m=_.createIndexBuffer({context:t,typedArray:p,usage:y.STATIC_DRAW,indexDatatype:h.UNSIGNED_SHORT});n.vertexArray=new N({context:t,attributes:[{index:c.position,vertexBuffer:_.createVertexBuffer({context:t,typedArray:o,usage:y.STATIC_DRAW}),componentsPerAttribute:2},{index:c.webMercatorT,vertexBuffer:_.createVertexBuffer({context:t,sizeInBytes:512,usage:y.STREAM_DRAW}),componentsPerAttribute:1}],indexBuffer:m});var f=new I({sources:[F]});n.shaderProgram=P.fromCache({context:t,vertexShaderSource:f,fragmentShaderSource:L,attributeLocations:c}),n.sampler=new A({wrapS:O.CLAMP_TO_EDGE,wrapT:O.CLAMP_TO_EDGE,minificationFilter:R.LINEAR,magnificationFilter:D.LINEAR})}i.sampler=n.sampler;var g=i.width,C=i.height;Z.textureDimensions.x=g,Z.textureDimensions.y=C,Z.texture=i;var E=Math.sin(r.south),S=.5*Math.log((1+E)/(1-E));E=Math.sin(r.north);var w=.5*Math.log((1+E)/(1-E)),T=1/(w-S),b=new M({context:t,width:g,height:C,pixelFormat:i.pixelFormat,pixelDatatype:i.pixelDatatype,preMultiplyAlpha:i.preMultiplyAlpha});d.isPowerOfTwo(g)&&d.isPowerOfTwo(C)&&b.generateMipmap(x.NICEST);for(var B=r.south,V=r.north,k=K,z=0,U=0;64>U;++U){var G=U/63,W=d.lerp(B,V,G);E=Math.sin(W);var H=.5*Math.log((1+E)/(1-E)),q=(H-S)*T;k[z++]=q,k[z++]=q}n.vertexArray.getAttribute(1).vertexBuffer.copyFromArrayView(k),e.shaderProgram=n.shaderProgram,e.outputTexture=b,e.uniformMap=Z,e.vertexArray=n.vertexArray}function q(e,t,i){var r=e._imageryProvider,n=r.tilingScheme,o=n.ellipsoid,a=e._imageryProvider.tilingScheme instanceof c?1:Math.cos(i),s=n.rectangle,l=o.maximumRadius*s.width*a/(r.tileWidth*n.getNumberOfXTilesAtLevel(0)),u=l/t,h=Math.log(u)/Math.log(2),d=Math.round(h);return 0|d}s(U.prototype,{imageryProvider:{get:function(){return this._imageryProvider}},rectangle:{get:function(){return this._rectangle}}}),U.DEFAULT_BRIGHTNESS=1,U.DEFAULT_CONTRAST=1,U.DEFAULT_HUE=0,U.DEFAULT_SATURATION=1,U.DEFAULT_GAMMA=1,U.prototype.isBaseLayer=function(){return this._isBaseLayer},U.prototype.isDestroyed=function(){return!1},U.prototype.destroy=function(){return l(this)};var j=new f,Y=new f,X=new f;U.prototype.getViewableRectangle=function(){var e=this._imageryProvider,t=this._rectangle;return e.readyPromise.then(function(){return f.intersection(e.rectangle,t)})},U.prototype._createTileImagerySkeletons=function(e,t,r){var n=e.data;if(a(this._minimumTerrainLevel)&&e.level<this._minimumTerrainLevel)return!1;if(a(this._maximumTerrainLevel)&&e.level>this._maximumTerrainLevel)return!1;var o=this._imageryProvider;if(a(r)||(r=n.imagery.length),!o.ready)return this._skeletonPlaceholder.loadingImagery.addReference(),n.imagery.splice(r,0,this._skeletonPlaceholder),!0;var s=f.intersection(o.rectangle,this._rectangle,j),l=f.intersection(e.rectangle,s,Y);if(!a(l)){if(!this.isBaseLayer())return!1;var u=s,c=e.rectangle;l=Y,c.south>=u.north?l.north=l.south=u.north:c.north<=u.south?l.north=l.south=u.south:(l.south=Math.max(c.south,u.south),l.north=Math.min(c.north,u.north)),c.west>=u.east?l.west=l.east=u.east:c.east<=u.west?l.west=l.east=u.west:(l.west=Math.max(c.west,u.west),l.east=Math.min(c.east,u.east))}var h=0;l.south>0?h=l.south:l.north<0&&(h=l.north);var d=1,p=d*t.getLevelMaximumGeometricError(e.level),m=q(this,p,h);m=Math.max(0,m);var v=o.maximumLevel;if(m>v&&(m=v),a(o.minimumLevel)){var g=o.minimumLevel;g>m&&(m=g)}var _=o.tilingScheme,y=_.positionToTileXY(f.northwest(l),m),C=_.positionToTileXY(f.southeast(l),m),E=e.rectangle.height/512,S=e.rectangle.width/512,w=_.tileXYToRectangle(y.x,y.y,m);Math.abs(w.south-e.rectangle.north)<S&&y.y<C.y&&++y.y,Math.abs(w.east-e.rectangle.west)<E&&y.x<C.x&&++y.x;var T=_.tileXYToRectangle(C.x,C.y,m);Math.abs(T.north-e.rectangle.south)<S&&C.y>y.y&&--C.y,Math.abs(T.west-e.rectangle.east)<E&&C.x>y.x&&--C.x;var x,b,A=e.rectangle,P=_.tileXYToRectangle(y.x,y.y,m),I=f.intersection(P,s,X),M=0,D=1;!this.isBaseLayer()&&Math.abs(I.west-e.rectangle.west)>=E&&(M=Math.min(1,(I.west-A.west)/A.width)),!this.isBaseLayer()&&Math.abs(I.north-e.rectangle.north)>=S&&(D=Math.max(0,(I.north-A.south)/A.height));for(var R=D,O=y.x;O<=C.x;O++){x=M,P=_.tileXYToRectangle(O,y.y,m),I=f.intersection(P,s,X),M=Math.min(1,(I.east-A.west)/A.width),O===C.x&&(this.isBaseLayer()||Math.abs(I.east-e.rectangle.east)<E)&&(M=1),D=R;for(var N=y.y;N<=C.y;N++){b=D,P=_.tileXYToRectangle(O,N,m),I=f.intersection(P,s,X),D=Math.max(0,(I.south-A.south)/A.height),N===C.y&&(this.isBaseLayer()||Math.abs(I.south-e.rectangle.south)<S)&&(D=0);var L=new i(x,D,M,b),F=this.getImageryFromCache(O,N,m,P);n.imagery.splice(r,0,new z(F,L)),++r}}return!0},U.prototype._calculateTextureTranslationAndScale=function(e,t){var r=t.readyImagery.rectangle,n=e.rectangle,o=n.width,a=n.height,s=o/r.width,l=a/r.height;return new i(s*(n.west-r.west)/o,l*(n.south-r.south)/a,s,l)},U.prototype._requestImagery=function(e){function t(t){return a(t)?(e.image=t,e.state=k.RECEIVED,void g.handleSuccess(o._requestImageError)):i()}function i(t){e.state=k.FAILED;var i="Failed to obtain image tile X: "+e.x+" Y: "+e.y+" Level: "+e.level+".";o._requestImageError=g.handleError(o._requestImageError,n,n.errorEvent,i,e.x,e.y,e.level,r,t)}function r(){e.state=k.TRANSITIONING;var r=n.requestImage(e.x,e.y,e.level);return a(r)?(a(n.getTileCredits)&&(e.credits=n.getTileCredits(e.x,e.y,e.level)),void B(r,t,i)):void(e.state=k.UNLOADED)}var n=this._imageryProvider,o=this;r()},U.prototype._createTexture=function(e,t){var i=this._imageryProvider;if(a(i.tileDiscardPolicy)){var r=i.tileDiscardPolicy;if(a(r)){if(!r.isReady())return void(t.state=k.RECEIVED);if(r.shouldDiscardImage(t.image))return void(t.state=k.INVALID)}}var n=new M({context:e,source:t.image,pixelFormat:i.hasAlphaChannel?p.RGBA:p.RGB});t.texture=n,t.image=void 0,t.state=k.TEXTURE_LOADED},U.prototype._reprojectTexture=function(e,t){var i=t.texture,r=t.rectangle,n=e.context;if(!(this._imageryProvider.tilingScheme instanceof c)&&r.width/i.width>1e-5){var o=this,a=new E({persists:!0,owner:this,preExecute:function(e){H(e,n,i,t.rectangle)},postExecute:function(e){i.destroy(),t.texture=e,G(o,n,t,e)}});e.commandList.push(a)}else G(this,n,t,i)},U.prototype.getImageryFromCache=function(e,t,i,r){var n=W(e,t,i),o=this._imageryCache[n];return a(o)||(o=new V(this,e,t,i,r),this._imageryCache[n]=o),o.addReference(),o},U.prototype.removeImageryFromCache=function(e){var t=W(e.x,e.y,e.level);delete this._imageryCache[t]};var Z={u_textureDimensions:function(){return this.textureDimensions},u_texture:function(){return this.texture},textureDimensions:new t,texture:void 0},K=u.supportsTypedArrays()?new Float32Array(128):void 0;return U}),i("Scene/GlobeSurfaceTileProvider",["../Core/BoundingSphere","../Core/BoxOutlineGeometry","../Core/Cartesian2","../Core/Cartesian3","../Core/Cartesian4","../Core/Color","../Core/ColorGeometryInstanceAttribute","../Core/defaultValue","../Core/defined","../Core/defineProperties","../Core/destroyObject","../Core/DeveloperError","../Core/Event","../Core/FeatureDetection","../Core/GeometryInstance","../Core/GeometryPipeline","../Core/IndexDatatype","../Core/Intersect","../Core/Math","../Core/Matrix4","../Core/OrientedBoundingBox","../Core/PrimitiveType","../Core/Rectangle","../Core/SphereOutlineGeometry","../Core/TerrainQuantization","../Core/Visibility","../Core/WebMercatorProjection","../Renderer/Buffer","../Renderer/BufferUsage","../Renderer/ContextLimits","../Renderer/DrawCommand","../Renderer/RenderState","../Renderer/VertexArray","../Scene/BlendingState","../Scene/DepthFunction","../Scene/Pass","../Scene/PerInstanceColorAppearance","../Scene/Primitive","../ThirdParty/when","./GlobeSurfaceTile","./ImageryLayer","./ImageryState","./QuadtreeTileLoadState","./SceneMode"],function(e,t,i,r,n,o,a,s,l,u,c,h,d,p,m,f,v,g,_,y,C,E,S,w,T,x,b,A,P,I,M,D,R,O,N,L,F,B,V,k,z,U,G,W){"use strict";function H(e){this.lightingFadeOutDistance=65e5,this.lightingFadeInDistance=9e6,this.hasWaterMask=!1,this.oceanNormalMap=void 0,this.zoomedOutOceanSpecularIntensity=.5,this.enableLighting=!1,this._quadtree=void 0,this._terrainProvider=e.terrainProvider,this._imageryLayers=e.imageryLayers,this._surfaceShaderSet=e.surfaceShaderSet,this._renderState=void 0,this._blendRenderState=void 0,this._pickRenderState=void 0,this._errorEvent=new d,this._imageryLayers.layerAdded.addEventListener(H.prototype._onLayerAdded,this),this._imageryLayers.layerRemoved.addEventListener(H.prototype._onLayerRemoved,this),this._imageryLayers.layerMoved.addEventListener(H.prototype._onLayerMoved,this),this._imageryLayers.layerShownOrHidden.addEventListener(H.prototype._onLayerShownOrHidden,this),this._layerOrderChanged=!1,this._tilesToRenderByTextureCount=[],this._drawCommands=[],this._uniformMaps=[],this._pickCommands=[],this._usedDrawCommands=0,this._usedPickCommands=0,this._debug={wireframe:!1,boundingSphereTile:void 0},this._baseColor=void 0,this._firstPassInitialColor=void 0,this.baseColor=new o(0,0,.5,1)}function q(e,t){var i=e.loadingImagery;l(i)||(i=e.readyImagery);var r=t.loadingImagery;return l(r)||(r=t.readyImagery),i.imageryLayer._layerIndex-r.imageryLayer._layerIndex}function j(){var e={u_initialColor:function(){return this.initialColor},u_zoomedOutOceanSpecularIntensity:function(){return this.zoomedOutOceanSpecularIntensity},u_oceanNormalMap:function(){return this.oceanNormalMap},u_lightingFadeDistance:function(){ +return this.lightingFadeDistance},u_center3D:function(){return this.center3D},u_tileRectangle:function(){return this.tileRectangle},u_modifiedModelView:function(){return this.modifiedModelView},u_dayTextures:function(){return this.dayTextures},u_dayTextureTranslationAndScale:function(){return this.dayTextureTranslationAndScale},u_dayTextureTexCoordsRectangle:function(){return this.dayTextureTexCoordsRectangle},u_dayTextureAlpha:function(){return this.dayTextureAlpha},u_dayTextureBrightness:function(){return this.dayTextureBrightness},u_dayTextureContrast:function(){return this.dayTextureContrast},u_dayTextureHue:function(){return this.dayTextureHue},u_dayTextureSaturation:function(){return this.dayTextureSaturation},u_dayTextureOneOverGamma:function(){return this.dayTextureOneOverGamma},u_dayIntensity:function(){return this.dayIntensity},u_southAndNorthLatitude:function(){return this.southAndNorthLatitude},u_southMercatorYAndOneOverHeight:function(){return this.southMercatorYAndOneOverHeight},u_waterMask:function(){return this.waterMask},u_waterMaskTranslationAndScale:function(){return this.waterMaskTranslationAndScale},u_minMaxHeight:function(){return this.minMaxHeight},u_scaleAndBias:function(){return this.scaleAndBias},initialColor:new n(0,0,.5,1),zoomedOutOceanSpecularIntensity:.5,oceanNormalMap:void 0,lightingFadeDistance:new i(65e5,9e6),center3D:void 0,modifiedModelView:new y,tileRectangle:new n,dayTextures:[],dayTextureTranslationAndScale:[],dayTextureTexCoordsRectangle:[],dayTextureAlpha:[],dayTextureBrightness:[],dayTextureContrast:[],dayTextureHue:[],dayTextureSaturation:[],dayTextureOneOverGamma:[],dayIntensity:0,southAndNorthLatitude:new i,southMercatorYAndOneOverHeight:new i,waterMask:void 0,waterMaskTranslationAndScale:new n,minMaxHeight:new i,scaleAndBias:new y};return e}function Y(e,t,i){var r=i.data;l(r.wireframeVertexArray)||l(r.terrainData)&&l(r.terrainData._mesh)&&(r.wireframeVertexArray=X(e,r.vertexArray,r.terrainData._mesh))}function X(e,t,i){var r={indices:i.indices,primitiveType:E.TRIANGLES};f.toWireframe(r);var n=r.indices,o=A.createIndexBuffer({context:e,typedArray:n,usage:P.STATIC_DRAW,indexDatatype:v.UNSIGNED_SHORT});return new R({context:e,attributes:t._attributes,indexBuffer:o})}function Z(t,i,a){var s=i.data,u=a.camera.viewMatrix,c=I.maximumTextureImageUnits,h=s.waterMaskTexture,d=t.hasWaterMask&&l(h),p=t.oceanNormalMap,m=d&&l(p),f=t.terrainProvider.ready&&t.terrainProvider.hasVertexNormals,v=a.fog.enabled;d&&--c,m&&--c;var g=s.center,w=s.pickTerrain.mesh.encoding,x=$,A=0,P=0,D=0,R=0,O=!1;if(a.mode!==W.SCENE3D){var N=a.mapProjection,F=N.project(S.southwest(i.rectangle),ie),B=N.project(S.northeast(i.rectangle),re);if(x.x=F.x,x.y=F.y,x.z=B.x,x.w=B.y,a.mode!==W.MORPHING&&(g=ee,g.x=0,g.y=.5*(x.z+x.x),g.z=.5*(x.w+x.y),x.x-=g.y,x.y-=g.z,x.z-=g.y,x.w-=g.z),a.mode===W.SCENE2D&&w.quantization===T.BITS12){var V=1/(Math.pow(2,12)-1)*.5,k=(x.z-x.x)*V,G=(x.w-x.y)*V;x.x-=k,x.y-=G,x.z+=k,x.w+=G}N instanceof b&&(A=i.rectangle.south,P=i.rectangle.north,D=b.geodeticLatitudeToMercatorAngle(A),R=1/(b.geodeticLatitudeToMercatorAngle(P)-D),O=!0)}var H=y.multiplyByPoint(u,g,te);y.setTranslation(u,H,J);var q=s.imagery,X=0,Z=q.length,K=t._renderState,Q=t._blendRenderState,le=K,ue=t._firstPassInitialColor,ce=a.context;l(t._debug.boundingSphereTile)||ae();do{var he,de,pe=0;t._drawCommands.length<=t._usedDrawCommands?(he=new M,he.owner=i,he.cull=!1,he.boundingVolume=new e,he.orientedBoundingBox=void 0,de=j(),t._drawCommands.push(he),t._uniformMaps.push(de)):(he=t._drawCommands[t._usedDrawCommands],de=t._uniformMaps[t._usedDrawCommands]),he.owner=i,++t._usedDrawCommands,i===t._debug.boundingSphereTile&&(l(s.orientedBoundingBox)?ne(s.orientedBoundingBox,o.RED).update(a):l(s.boundingSphere3D)&&oe(s.boundingSphere3D,o.RED).update(a)),n.clone(ue,de.initialColor),de.oceanNormalMap=p,de.lightingFadeDistance.x=t.lightingFadeOutDistance,de.lightingFadeDistance.y=t.lightingFadeInDistance,de.zoomedOutOceanSpecularIntensity=t.zoomedOutOceanSpecularIntensity,de.center3D=s.center,n.clone(x,de.tileRectangle),de.southAndNorthLatitude.x=A,de.southAndNorthLatitude.y=P,de.southMercatorYAndOneOverHeight.x=D,de.southMercatorYAndOneOverHeight.y=R,y.clone(J,de.modifiedModelView);for(var me=v&&_.fog(i._distance,a.fog.density)>_.EPSILON3,fe=!1,ve=!1,ge=!1,_e=!1,ye=!1,Ce=!1;c>pe&&Z>X;){var Ee=q[X],Se=Ee.readyImagery;if(++X,l(Se)&&Se.state===U.READY&&0!==Se.imageryLayer.alpha){var we=Se.imageryLayer;if(l(Ee.textureTranslationAndScale)||(Ee.textureTranslationAndScale=we._calculateTextureTranslationAndScale(i,Ee)),de.dayTextures[pe]=Se.texture,de.dayTextureTranslationAndScale[pe]=Ee.textureTranslationAndScale,de.dayTextureTexCoordsRectangle[pe]=Ee.textureCoordinateRectangle,de.dayTextureAlpha[pe]=we.alpha,Ce=Ce||1!==de.dayTextureAlpha[pe],de.dayTextureBrightness[pe]=we.brightness,fe=fe||de.dayTextureBrightness[pe]!==z.DEFAULT_BRIGHTNESS,de.dayTextureContrast[pe]=we.contrast,ve=ve||de.dayTextureContrast[pe]!==z.DEFAULT_CONTRAST,de.dayTextureHue[pe]=we.hue,ge=ge||de.dayTextureHue[pe]!==z.DEFAULT_HUE,de.dayTextureSaturation[pe]=we.saturation,_e=_e||de.dayTextureSaturation[pe]!==z.DEFAULT_SATURATION,de.dayTextureOneOverGamma[pe]=1/we.gamma,ye=ye||de.dayTextureOneOverGamma[pe]!==1/z.DEFAULT_GAMMA,l(Se.credits))for(var Te=a.creditDisplay,xe=Se.credits,be=0,Ae=xe.length;Ae>be;++be)Te.addCredit(xe[be]);++pe}}de.dayTextures.length=pe,de.waterMask=h,n.clone(s.waterMaskTranslationAndScale,de.waterMaskTranslationAndScale),de.minMaxHeight.x=w.minimumHeight,de.minMaxHeight.y=w.maximumHeight,y.clone(w.matrix,de.scaleAndBias),he.shaderProgram=t._surfaceShaderSet.getShaderProgram(a,s,pe,fe,ve,ge,_e,ye,Ce,d,m,t.enableLighting,f,O,me),he.renderState=le,he.primitiveType=E.TRIANGLES,he.vertexArray=s.vertexArray,he.uniformMap=de,he.pass=L.GLOBE,t._debug.wireframe&&(Y(ce,t,i),l(s.wireframeVertexArray)&&(he.vertexArray=s.wireframeVertexArray,he.primitiveType=E.LINES));var Pe=he.boundingVolume,Ie=he.orientedBoundingBox;a.mode!==W.SCENE3D?(e.fromRectangleWithHeights2D(i.rectangle,a.mapProjection,s.minimumHeight,s.maximumHeight,Pe),r.fromElements(Pe.center.z,Pe.center.x,Pe.center.y,Pe.center),a.mode===W.MORPHING&&(Pe=e.union(s.boundingSphere3D,Pe,Pe))):(he.boundingVolume=e.clone(s.boundingSphere3D,Pe),he.orientedBoundingBox=C.clone(s.orientedBoundingBox,Ie)),a.commandList.push(he),le=Q,ue=se}while(Z>X)}function K(e,t,i){var r;e._pickCommands.length<=e._usedPickCommands?(r=new M,r.cull=!1,e._pickCommands.push(r)):r=e._pickCommands[e._usedPickCommands],++e._usedPickCommands;var n=t.owner.data,o=i.projection instanceof b;r.shaderProgram=e._surfaceShaderSet.getPickShaderProgram(i,n,o),r.renderState=e._pickRenderState,r.owner=t.owner,r.primitiveType=t.primitiveType,r.vertexArray=t.vertexArray,r.uniformMap=t.uniformMap,r.boundingVolume=t.boundingVolume,r.orientedBoundingBox=r.orientedBoundingBox,r.pass=t.pass,i.commandList.push(r)}u(H.prototype,{baseColor:{get:function(){return this._baseColor},set:function(e){this._baseColor=e,this._firstPassInitialColor=n.fromColor(e,this._firstPassInitialColor)}},quadtree:{get:function(){return this._quadtree},set:function(e){this._quadtree=e}},ready:{get:function(){return this._terrainProvider.ready&&(0===this._imageryLayers.length||this._imageryLayers.get(0).imageryProvider.ready)}},tilingScheme:{get:function(){return this._terrainProvider.tilingScheme}},errorEvent:{get:function(){return this._errorEvent}},terrainProvider:{get:function(){return this._terrainProvider},set:function(e){this._terrainProvider!==e&&(this._terrainProvider=e,l(this._quadtree)&&this._quadtree.invalidateAllTiles())}}}),H.prototype.beginUpdate=function(e){this._imageryLayers._update(),this._layerOrderChanged&&(this._layerOrderChanged=!1,this._quadtree.forEachLoadedTile(function(e){e.data.imagery.sort(q)}));var t,i,r=this._tilesToRenderByTextureCount;for(t=0,i=r.length;i>t;++t){var n=r[t];l(n)&&(n.length=0)}this._usedDrawCommands=0;var o=e.creditDisplay;this._terrainProvider.ready&&l(this._terrainProvider.credit)&&o.addCredit(this._terrainProvider.credit);var a=this._imageryLayers;for(t=0,i=a.length;i>t;++t){var s=a.get(t).imageryProvider;s.ready&&l(s.credit)&&o.addCredit(s.credit)}},H.prototype.endUpdate=function(e){l(this._renderState)||(this._renderState=D.fromCache({cull:{enabled:!0},depthTest:{enabled:!0,func:N.LESS}}),this._blendRenderState=D.fromCache({cull:{enabled:!0},depthTest:{enabled:!0,func:N.LESS_OR_EQUAL},blending:O.ALPHA_BLEND}));for(var t=this._tilesToRenderByTextureCount,i=0,r=t.length;r>i;++i){var n=t[i];if(l(n))for(var o=0,a=n.length;a>o;++o)Z(this,n[o],e)}},H.prototype.updateForPick=function(e){l(this._pickRenderState)||(this._pickRenderState=D.fromCache({colorMask:{red:!1,green:!1,blue:!1,alpha:!1},depthTest:{enabled:!0}})),this._usedPickCommands=0;for(var t=this._drawCommands,i=0,r=this._usedDrawCommands;r>i;++i)K(this,t[i],e)},H.prototype.getLevelMaximumGeometricError=function(e){return this._terrainProvider.getLevelMaximumGeometricError(e)},H.prototype.loadTile=function(e,t){k.processStateMachine(t,e,this._terrainProvider,this._imageryLayers)};var Q=new e;H.prototype.computeTileVisibility=function(t,i,n){var o=this.computeDistanceToTile(t,i);if(t._distance=o,i.fog.enabled&&_.fog(o,i.fog.density)>=1)return x.NONE;var a=t.data,u=i.cullingVolume,c=s(a.orientedBoundingBox,a.boundingSphere3D);i.mode!==W.SCENE3D&&(c=Q,e.fromRectangleWithHeights2D(t.rectangle,i.mapProjection,a.minimumHeight,a.maximumHeight,c),r.fromElements(c.center.z,c.center.x,c.center.y,c.center),i.mode===W.MORPHING&&(c=e.union(a.boundingSphere3D,c,c)));var h=u.computeVisibility(c);if(h===g.OUTSIDE)return x.NONE;if(i.mode===W.SCENE3D){var d=a.occludeePointInScaledSpace;return l(d)?n.ellipsoid.isScaledSpacePointVisible(d)?h:x.NONE:h}return h};var J=new y,$=new n,ee=new r,te=new r,ie=new r,re=new r;H.prototype.showTileThisFrame=function(e,t){for(var i=0,r=e.data.imagery,n=0,o=r.length;o>n;++n){var a=r[n];l(a.readyImagery)&&0!==a.readyImagery.imageryLayer.alpha&&++i}var s=this._tilesToRenderByTextureCount[i];l(s)||(s=[],this._tilesToRenderByTextureCount[i]=s),s.push(e);var u=this._debug;++u.tilesRendered,u.texturesRendered+=i},H.prototype.computeDistanceToTile=function(e,t){var i=e.data,r=i.tileBoundingBox;return r.distanceToCamera(t)},H.prototype.isDestroyed=function(){return!1},H.prototype.destroy=function(){return this._tileProvider=this._tileProvider&&this._tileProvider.destroy(),c(this)},H.prototype._onLayerAdded=function(e,t){if(e.show){var i=this._terrainProvider;this._quadtree.forEachLoadedTile(function(t){e._createTileImagerySkeletons(t,i)&&(t.state=G.LOADING)}),this._layerOrderChanged=!0}},H.prototype._onLayerRemoved=function(e,t){this._quadtree.forEachLoadedTile(function(t){for(var i=t.data.imagery,r=-1,n=0,o=0,a=i.length;a>o;++o){var s=i[o],u=s.loadingImagery;if(l(u)||(u=s.readyImagery),u.imageryLayer===e)-1===r&&(r=o),s.freeResources(),++n;else if(-1!==r)break}-1!==r&&i.splice(r,n)})},H.prototype._onLayerMoved=function(e,t,i){this._layerOrderChanged=!0},H.prototype._onLayerShownOrHidden=function(e,t,i){i?this._onLayerAdded(e,t):this._onLayerRemoved(e,t)};var ne,oe,ae;!function(){function e(e){return new B({geometryInstances:e,appearance:new F({translucent:!1,flat:!0}),asynchronous:!1})}var i,n,o=new m({geometry:t.fromDimensions({dimensions:new r(2,2,2)})}),s=new m({geometry:new w({radius:1})}),u=new y;ne=function(t,r){return t===i?n:(ae(),i=t,u=y.fromRotationTranslation(t.halfAxes,t.center,u),o.modelMatrix=u,o.attributes.color=a.fromColor(r),n=e(o))},oe=function(t,r){return t===i?n:(ae(),i=t,u=y.fromTranslation(t.center,u),u=y.multiplyByUniformScale(u,t.radius,u),s.modelMatrix=u,s.attributes.color=a.fromColor(r),n=e(s))},ae=function(){l(n)&&(n.destroy(),n=void 0,i=void 0)}}();var se=new n(0,0,0,0);return H}),i("Scene/ImageryLayerCollection",["../Core/defaultValue","../Core/defined","../Core/defineProperties","../Core/destroyObject","../Core/DeveloperError","../Core/Event","../Core/Math","../Core/Rectangle","../ThirdParty/when","./ImageryLayer"],function(e,t,i,r,n,o,a,s,l,u){"use strict";function c(){this._layers=[],this.layerAdded=new o,this.layerRemoved=new o,this.layerMoved=new o,this.layerShownOrHidden=new o}function h(e,t){var i=e.indexOf(t);return i}function d(e,t,i){var r=e._layers;if(t=a.clamp(t,0,r.length-1),i=a.clamp(i,0,r.length-1),t!==i){var n=r[t];r[t]=r[i],r[i]=n,e._update(),e.layerMoved.raiseEvent(n,i,t)}}i(c.prototype,{length:{get:function(){return this._layers.length}}}),c.prototype.add=function(e,i){var r=t(i);r?this._layers.splice(i,0,e):(i=this._layers.length,this._layers.push(e)),this._update(),this.layerAdded.raiseEvent(e,i)},c.prototype.addImageryProvider=function(e,t){var i=new u(e);return this.add(i,t),i},c.prototype.remove=function(t,i){i=e(i,!0);var r=this._layers.indexOf(t);return-1!==r?(this._layers.splice(r,1),this._update(),this.layerRemoved.raiseEvent(t,r),i&&t.destroy(),!0):!1},c.prototype.removeAll=function(t){t=e(t,!0);for(var i=this._layers,r=0,n=i.length;n>r;r++){var o=i[r];this.layerRemoved.raiseEvent(o,r),t&&o.destroy()}this._layers=[]},c.prototype.contains=function(e){return-1!==this.indexOf(e)},c.prototype.indexOf=function(e){return this._layers.indexOf(e)},c.prototype.get=function(e){return this._layers[e]},c.prototype.raise=function(e){var t=h(this._layers,e);d(this,t,t+1)},c.prototype.lower=function(e){var t=h(this._layers,e);d(this,t,t-1)},c.prototype.raiseToTop=function(e){var t=h(this._layers,e);t!==this._layers.length-1&&(this._layers.splice(t,1),this._layers.push(e),this._update(),this.layerMoved.raiseEvent(e,this._layers.length-1,t))},c.prototype.lowerToBottom=function(e){var t=h(this._layers,e);0!==t&&(this._layers.splice(t,1),this._layers.splice(0,0,e),this._update(),this.layerMoved.raiseEvent(e,0,t))};var p=new s;return c.prototype.pickImageryLayerFeatures=function(e,i){var r=i.globe.pick(e,i);if(t(r)){for(var n,o=i.globe.ellipsoid.cartesianToCartographic(r),u=i.globe._surface._tilesToRender,c=0;!t(n)&&c<u.length;++c){var h=u[c];s.contains(h.rectangle,o)&&(n=h)}if(t(n)){for(var d=n.data.imagery,m=[],f=[],v=d.length-1;v>=0;--v){var g=d[v],_=g.readyImagery;if(t(_)){var y=_.imageryLayer.imageryProvider;if(t(y.pickFeatures)&&s.contains(_.rectangle,o)){var C=p,E=1/1024;if(C.west=a.lerp(n.rectangle.west,n.rectangle.east,g.textureCoordinateRectangle.x-E),C.east=a.lerp(n.rectangle.west,n.rectangle.east,g.textureCoordinateRectangle.z+E),C.south=a.lerp(n.rectangle.south,n.rectangle.north,g.textureCoordinateRectangle.y-E),C.north=a.lerp(n.rectangle.south,n.rectangle.north,g.textureCoordinateRectangle.w+E),s.contains(C,o)){var S=y.pickFeatures(_.x,_.y,_.level,o.longitude,o.latitude);t(S)&&(m.push(S),f.push(_.imageryLayer))}}}}if(0!==m.length)return l.all(m,function(e){for(var i=[],r=0;r<e.length;++r){var n=e[r],a=f[r];if(t(n)&&n.length>0)for(var s=0;s<n.length;++s){var l=n[s];l.imageryLayer=a,t(l.position)||(l.position=o),i.push(l)}}return i})}}},c.prototype.isDestroyed=function(){return!1},c.prototype.destroy=function(){return this.removeAll(!0),r(this)},c.prototype._update=function(){for(var e,i,r=!0,n=this._layers,o=0,a=n.length;a>o;++o)i=n[o],i._layerIndex=o,i.show?(i._isBaseLayer=r,r=!1):i._isBaseLayer=!1,i.show!==i._show&&(t(i._show)&&(t(e)||(e=[]),e.push(i)),i._show=i.show);if(t(e))for(o=0,a=e.length;a>o;++o)i=e[o],this.layerShownOrHidden.raiseEvent(i,i._layerIndex,i.show)},c}),i("Scene/QuadtreeOccluders",["../Core/Cartesian3","../Core/defineProperties","../Core/EllipsoidalOccluder"],function(e,t,i){"use strict";function r(t){this._ellipsoid=new i(t.ellipsoid,e.ZERO)}return t(r.prototype,{ellipsoid:{get:function(){return this._ellipsoid}}}),r}),i("Scene/QuadtreeTile",["../Core/defined","../Core/defineProperties","../Core/DeveloperError","../Core/Rectangle","./QuadtreeTileLoadState"],function(e,t,i,r,n){"use strict";function o(e){this._tilingScheme=e.tilingScheme,this._x=e.x,this._y=e.y,this._level=e.level,this._parent=e.parent,this._rectangle=this._tilingScheme.tileXYToRectangle(this._x,this._y,this._level),this._children=void 0,this._replacementPrevious=void 0,this._replacementNext=void 0,this._distance=0,this._customData=[],this._frameUpdated=void 0,this._frameRendered=void 0,this.state=n.START,this.renderable=!1,this.upsampledFromParent=!1,this.data=void 0}return o.createLevelZeroTiles=function(t){if(!e(t))throw new i("tilingScheme is required.");for(var r=t.getNumberOfXTilesAtLevel(0),n=t.getNumberOfYTilesAtLevel(0),a=new Array(r*n),s=0,l=0;n>l;++l)for(var u=0;r>u;++u)a[s++]=new o({tilingScheme:t,x:u,y:l,level:0});return a},o.prototype._updateCustomData=function(t,i,n){var o,a,s,l=this.customData;if(e(i)&&e(n)){for(o=0;o<n.length;++o){a=n[o];for(var u=0;u<l.length;++u)if(l[u]===a){l.splice(u,1);break}}for(s=this._rectangle,o=0;o<i.length;++o)a=i[o],r.contains(s,a.positionCartographic)&&l.push(a);this._frameUpdated=t}else{var c=this._parent;if(e(c)&&this._frameUpdated!==c._frameUpdated){l.length=0,s=this._rectangle;var h=c.customData;for(o=0;o<h.length;++o)a=h[o],r.contains(s,a.positionCartographic)&&l.push(a);this._frameUpdated=c._frameUpdated}}},t(o.prototype,{tilingScheme:{get:function(){return this._tilingScheme}},x:{get:function(){return this._x}},y:{get:function(){return this._y}},level:{get:function(){return this._level}},parent:{get:function(){return this._parent}},rectangle:{get:function(){return this._rectangle}},children:{get:function(){if(!e(this._children)){var t=this.tilingScheme,i=this.level+1,r=2*this.x,n=2*this.y;this._children=[new o({tilingScheme:t,x:r,y:n,level:i,parent:this}),new o({tilingScheme:t,x:r+1,y:n,level:i,parent:this}),new o({tilingScheme:t,x:r,y:n+1,level:i,parent:this}),new o({tilingScheme:t,x:r+1,y:n+1,level:i,parent:this})]}return this._children}},customData:{get:function(){return this._customData}},needsLoading:{get:function(){return this.state<n.DONE}},eligibleForUnloading:{get:function(){var t=!0;return e(this.data)&&(t=this.data.eligibleForUnloading,e(t)||(t=!0)),t}}}),o.prototype.freeResources=function(){if(this.state=n.START,this.renderable=!1,this.upsampledFromParent=!1,e(this.data)&&e(this.data.freeResources)&&(this.data.freeResources(),this.data=void 0),e(this._children)){for(var t=0,i=this._children.length;i>t;++t)this._children[t].freeResources();this._children=void 0}},o}),i("Scene/TileReplacementQueue",["../Core/defined"],function(e){"use strict";function t(){this.head=void 0,this.tail=void 0,this.count=0,this._lastBeforeStartOfFrame=void 0}function i(e,t){var i=t.replacementPrevious,r=t.replacementNext;t===e._lastBeforeStartOfFrame&&(e._lastBeforeStartOfFrame=r),t===e.head?e.head=r:i.replacementNext=r,t===e.tail?e.tail=i:r.replacementPrevious=i,t.replacementPrevious=void 0,t.replacementNext=void 0,--e.count}return t.prototype.markStartOfRenderFrame=function(){this._lastBeforeStartOfFrame=this.head},t.prototype.trimTiles=function(t){for(var r=this.tail,n=!0;n&&e(this._lastBeforeStartOfFrame)&&this.count>t&&e(r);){n=r!==this._lastBeforeStartOfFrame;var o=r.replacementPrevious;r.eligibleForUnloading&&(r.freeResources(),i(this,r)),r=o}},t.prototype.markTileRendered=function(t){var r=this.head;return r===t?void(t===this._lastBeforeStartOfFrame&&(this._lastBeforeStartOfFrame=t.replacementNext)):(++this.count,e(r)?((e(t.replacementPrevious)||e(t.replacementNext))&&i(this,t),t.replacementPrevious=void 0,t.replacementNext=r,r.replacementPrevious=t,void(this.head=t)):(t.replacementPrevious=void 0,t.replacementNext=void 0,this.head=t,void(this.tail=t)))},t}),i("Scene/QuadtreePrimitive",["../Core/Cartesian3","../Core/Cartographic","../Core/defaultValue","../Core/defined","../Core/defineProperties","../Core/DeveloperError","../Core/Event","../Core/getTimestamp","../Core/Math","../Core/Queue","../Core/Ray","../Core/Rectangle","../Core/Visibility","./QuadtreeOccluders","./QuadtreeTile","./QuadtreeTileLoadState","./SceneMode","./TileReplacementQueue"],function(e,t,i,r,n,o,a,s,l,u,c,h,d,p,m,f,v,g){"use strict";function _(e){this._tileProvider=e.tileProvider,this._tileProvider.quadtree=this,this._debug={enableDebugOutput:!1,maxDepth:0,tilesVisited:0,tilesCulled:0,tilesRendered:0,tilesWaitingForChildren:0,lastMaxDepth:-1,lastTilesVisited:-1,lastTilesCulled:-1,lastTilesRendered:-1,lastTilesWaitingForChildren:-1,suspendLodUpdate:!1};var t=this._tileProvider.tilingScheme,r=t.ellipsoid;this._tilesToRender=[],this._tileTraversalQueue=new u,this._tileLoadQueue=[],this._tileReplacementQueue=new g,this._levelZeroTiles=void 0,this._levelZeroTilesReady=!1,this._loadQueueTimeSlice=5,this._addHeightCallbacks=[],this._removeHeightCallbacks=[],this._tileToUpdateHeights=[],this._lastTileIndex=0,this._updateHeightsTimeSlice=2,this.maximumScreenSpaceError=i(e.maximumScreenSpaceError,2),this.tileCacheSize=i(e.tileCacheSize,100),this._occluders=new p({ellipsoid:r}),this._tileLoadProgressEvent=new a,this._lastTileLoadQueueLength=0}function y(e,t){var i=e._debug;if(!i.suspendLodUpdate){var n,o,a=e._tilesToRender;a.length=0;var s=e._tileTraversalQueue;if(s.clear(),i.maxDepth=0,i.tilesVisited=0,i.tilesCulled=0,i.tilesRendered=0,i.tilesWaitingForChildren=0,e._tileLoadQueue.length=0,e._tileReplacementQueue.markStartOfRenderFrame(),!r(e._levelZeroTiles)){if(!e._tileProvider.ready)return;var l=e._tileProvider.tilingScheme;e._levelZeroTiles=m.createLevelZeroTiles(l)}e._occluders.ellipsoid.cameraPosition=t.camera.positionWC;var u,c=e._tileProvider,h=e._occluders,p=e._levelZeroTiles,f=e._addHeightCallbacks,v=e._removeHeightCallbacks,g=t.frameNumber;if(f.length>0||v.length>0){for(n=0,o=p.length;o>n;++n)u=p[n],u._updateCustomData(g,f,v);f.length=0,v.length=0}for(n=0,o=p.length;o>n;++n)u=p[n],e._tileReplacementQueue.markTileRendered(u),u.needsLoading&&x(e,u),u.renderable&&c.computeTileVisibility(u,t,h)!==d.NONE?s.enqueue(u):(++i.tilesCulled,u.renderable||++i.tilesWaitingForChildren);for(;r(u=s.dequeue());)if(++i.tilesVisited,e._tileReplacementQueue.markTileRendered(u),u._updateCustomData(g),u.level>i.maxDepth&&(i.maxDepth=u.level),E(e,t,u)<e.maximumScreenSpaceError)w(e,u);else if(T(e,u)){var _=u.children;for(n=0,o=_.length;o>n;++n)c.computeTileVisibility(_[n],t,h)!==d.NONE?s.enqueue(_[n]):++i.tilesCulled}else w(e,u);C(e),i.enableDebugOutput&&(i.tilesVisited!==i.lastTilesVisited||i.tilesRendered!==i.lastTilesRendered||i.tilesCulled!==i.lastTilesCulled||i.maxDepth!==i.lastMaxDepth||i.tilesWaitingForChildren!==i.lastTilesWaitingForChildren)&&(console.log("Visited "+i.tilesVisited+", Rendered: "+i.tilesRendered+", Culled: "+i.tilesCulled+", Max Depth: "+i.maxDepth+", Waiting for children: "+i.tilesWaitingForChildren),i.lastTilesVisited=i.tilesVisited,i.lastTilesRendered=i.tilesRendered,i.lastTilesCulled=i.tilesCulled,i.lastMaxDepth=i.maxDepth,i.lastTilesWaitingForChildren=i.tilesWaitingForChildren)}}function C(e){var t=e._tileLoadQueue.length;t!==e._lastTileLoadQueueLength&&(e._tileLoadProgressEvent.raiseEvent(t),e._lastTileLoadQueueLength=t)}function E(e,t,i){if(t.mode===v.SCENE2D)return S(e,t,i);var r=e._tileProvider.getLevelMaximumGeometricError(i.level),n=i._distance,o=t.context.drawingBufferHeight,a=t.camera.frustum.sseDenominator,s=r*o/(n*a);return t.fog.enabled&&(s-=l.fog(n,t.fog.density)*t.fog.sse),s}function S(e,t,i){var r=t.camera,n=r.frustum,o=t.context,a=o.drawingBufferWidth,s=o.drawingBufferHeight,l=e._tileProvider.getLevelMaximumGeometricError(i.level),u=Math.max(n.top-n.bottom,n.right-n.left)/Math.max(a,s);return l/u}function w(e,t){e._tilesToRender.push(t),++e._debug.tilesRendered}function T(e,t){for(var i=!0,r=!0,n=t.children,o=0,a=n.length;a>o;++o){var s=n[o];e._tileReplacementQueue.markTileRendered(s),r=r&&s.upsampledFromParent,i=i&&s.renderable,s.needsLoading&&x(e,s)}return i||++e._debug.tilesWaitingForChildren,i&&!r}function x(e,t){e._tileLoadQueue.push(t)}function b(e,t){var i=e._tileLoadQueue,r=e._tileProvider;if(0!==i.length){e._tileReplacementQueue.trimTiles(e.tileCacheSize);for(var n=s(),o=e._loadQueueTimeSlice,a=n+o,l=i.length-1;l>=0;--l){var u=i[l];if(e._tileReplacementQueue.markTileRendered(u),r.loadTile(t,u),s()>=a)break}}}function A(i,n){for(var o=i._tileToUpdateHeights,a=i._tileProvider.terrainProvider,l=s(),u=i._updateHeightsTimeSlice,c=l+u,d=n.mode,p=n.mapProjection,m=p.ellipsoid;o.length>0;){var f=o[o.length-1];f!==i._lastTileUpdated&&(i._lastTileIndex=0);for(var g=f.customData,_=g.length,y=!1,C=i._lastTileIndex;_>C;++C){var E=g[C];if(f.level>E.level){r(E.position)||(E.position=m.cartographicToCartesian(E.positionCartographic)),d===v.SCENE3D?(e.clone(e.ZERO,M.origin),e.normalize(E.position,M.direction)):(t.clone(E.positionCartographic,D),D.height=-11500,p.project(D,R),e.fromElements(R.z,R.x,R.y,R),e.clone(R,M.origin),e.clone(e.UNIT_X,M.direction));var S=f.data.pick(M,d,p,!1,R);r(S)&&E.callback(S),E.level=f.level}else if(f.level===E.level){for(var w,T=f.children,x=T.length,b=0;x>b&&(w=T[b],!h.contains(w.rectangle,E.positionCartographic));++b);var A=a.getTileDataAvailable(w.x,w.y,w.level);(r(A)&&!A||r(parent)&&r(parent.data)&&r(parent.data.terrainData)&&!parent.data.terrainData.isChildAvailable(parent.x,parent.y,w.x,w.y))&&E.removeFunc()}if(s()>=c){y=!0;break}}if(y){i._lastTileUpdated=f,i._lastTileIndex=C;break}o.pop()}}function P(e,t){return e._distance-t._distance}function I(e,t){var i=e._tileProvider,r=e._tilesToRender,n=e._tileToUpdateHeights;r.sort(P);for(var o=0,a=r.length;a>o;++o){var s=r[o];i.showTileThisFrame(s,t),s._frameRendered!==t.frameNumber-1&&n.push(s),s._frameRendered=t.frameNumber}A(e,t)}n(_.prototype,{tileProvider:{get:function(){return this._tileProvider}},tileLoadProgressEvent:{get:function(){return this._tileLoadProgressEvent}}}),_.prototype.invalidateAllTiles=function(){var e=this._tileReplacementQueue;e.head=void 0,e.tail=void 0,e.count=0;var t=this._levelZeroTiles;if(r(t))for(var i=0;i<t.length;++i){for(var n=t[i],o=n.customData,a=o.length,s=0;a>s;++s){var l=o[s];l.level=0,this._addHeightCallbacks.push(l)}t[i].freeResources()}this._levelZeroTiles=void 0},_.prototype.forEachLoadedTile=function(e){for(var t=this._tileReplacementQueue.head;r(t);)t.state!==f.START&&e(t),t=t.replacementNext},_.prototype.forEachRenderedTile=function(e){for(var t=this._tilesToRender,i=0,r=t.length;r>i;++i)e(t[i])},_.prototype.updateHeight=function(e,t){var i=this,r={position:void 0,positionCartographic:e,level:-1,callback:t};return r.removeFunc=function(){i._removeHeightCallbacks.push(r)},i._addHeightCallbacks.push(r),r.removeFunc},_.prototype.update=function(e){var t=e.passes;t.render&&(this._tileProvider.beginUpdate(e),y(this,e),b(this,e),I(this,e),this._tileProvider.endUpdate(e)),t.pick&&this._tilesToRender.length>0&&this._tileProvider.updateForPick(e)},_.prototype.isDestroyed=function(){return!1},_.prototype.destroy=function(){this._tileProvider=this._tileProvider&&this._tileProvider.destroy()};var M=new c,D=new t,R=new e;return _}),i("Scene/Globe",["../Core/BoundingSphere","../Core/buildModuleUrl","../Core/Cartesian3","../Core/Cartographic","../Core/defaultValue","../Core/defined","../Core/defineProperties","../Core/destroyObject","../Core/DeveloperError","../Core/Ellipsoid","../Core/EllipsoidTerrainProvider","../Core/GeographicProjection","../Core/IntersectionTests","../Core/loadImage","../Core/Ray","../Core/Rectangle","../Renderer/ShaderSource","../Renderer/Texture","../Shaders/GlobeFS","../Shaders/GlobeVS","../Shaders/GroundAtmosphere","../ThirdParty/when","./GlobeSurfaceShaderSet","./GlobeSurfaceTileProvider","./ImageryLayerCollection","./QuadtreePrimitive","./SceneMode"],function(e,t,i,r,n,o,a,s,l,u,c,h,d,p,m,f,v,g,_,y,C,E,S,w,T,x,b){"use strict";function A(e){e=n(e,u.WGS84);var i=new c({ellipsoid:e}),r=new T;this._ellipsoid=e,this._imageryLayerCollection=r,this._surfaceShaderSet=new S,this._surfaceShaderSet.baseVertexShaderSource=new v({sources:[C,y]}),this._surfaceShaderSet.baseFragmentShaderSource=new v({sources:[_]}),this._surface=new x({tileProvider:new w({terrainProvider:i,imageryLayers:r,surfaceShaderSet:this._surfaceShaderSet})}),this.terrainProvider=i,this.show=!0,this.oceanNormalMapUrl=t("Assets/Textures/waterNormalsSmall.jpg"),this._oceanNormalMapUrl=void 0,this.maximumScreenSpaceError=2,this.tileCacheSize=100,this.enableLighting=!1,this.lightingFadeOutDistance=65e5,this.lightingFadeInDistance=9e6,this.showWaterEffect=!0,this.depthTestAgainstTerrain=!1,this._oceanNormalMap=void 0,this._zoomedOutOceanSpecularIntensity=.5}function P(t){return function(i,r){var n=e.distanceSquaredTo(i.pickBoundingSphere,t),o=e.distanceSquaredTo(r.pickBoundingSphere,t);return n-o}}a(A.prototype,{ellipsoid:{get:function(){return this._ellipsoid}},imageryLayers:{get:function(){return this._imageryLayerCollection}},baseColor:{get:function(){return this._surface.tileProvider.baseColor},set:function(e){this._surface.tileProvider.baseColor=e}},tileLoadProgressEvent:{get:function(){return this._surface.tileLoadProgressEvent}}});var I=[],M={start:0,stop:0};A.prototype.pick=function(t,r,n){var a=r.mode,s=r.mapProjection,l=I;l.length=0;var u,c,h=this._surface._tilesToRender,p=h.length;for(c=0;p>c;++c){u=h[c];var m=u.data;if(o(m)){var f=m.pickBoundingSphere;a!==b.SCENE3D?(e.fromRectangleWithHeights2D(u.rectangle,s,m.minimumHeight,m.maximumHeight,f),i.fromElements(f.center.z,f.center.x,f.center.y,f.center)):e.clone(m.boundingSphere3D,f);var v=d.raySphere(t,f,M);o(v)&&l.push(m)}}l.sort(P(t.origin));var g;for(p=l.length,c=0;p>c&&(g=l[c].pick(t,r.mode,r.mapProjection,!0,n),!o(g));++c);return g};var D=new i,R=new i,O=new r,N=new m;return A.prototype.getHeight=function(e){var t=this._surface._levelZeroTiles;if(o(t)){var r,n,a=t.length;for(n=0;a>n&&(r=t[n],!f.contains(r.rectangle,e));++n);if(o(r)&&f.contains(r.rectangle,e)){for(;r.renderable;){var s=r.children;for(a=s.length,n=0;a>n&&(r=s[n],!f.contains(r.rectangle,e));++n);}for(;o(r)&&(!o(r.data)||!o(r.data.pickTerrain));)r=r.parent;if(o(r)){var l=this._surface._tileProvider.tilingScheme.ellipsoid,u=l.cartographicToCartesian(e,D),c=N;i.normalize(u,c.direction);var h=r.data.pick(c,void 0,void 0,!1,R);if(o(h))return l.cartesianToCartographic(h,O).height}}}},A.prototype.update=function(e){if(this.show){var t=e.context,i=t.drawingBufferWidth,r=t.drawingBufferHeight;if(0!==i&&0!==r){var n=this._surface,a=n.tileProvider,s=this.terrainProvider,l=this.showWaterEffect&&s.ready&&s.hasWaterMask;if(l&&this.oceanNormalMapUrl!==this._oceanNormalMapUrl){var u=this.oceanNormalMapUrl;if(this._oceanNormalMapUrl=u,o(u)){var c=this;E(p(u),function(e){u===c.oceanNormalMapUrl&&(c._oceanNormalMap=c._oceanNormalMap&&c._oceanNormalMap.destroy(),c._oceanNormalMap=new g({context:t,source:e}))})}else this._oceanNormalMap=this._oceanNormalMap&&this._oceanNormalMap.destroy()}var h=e.mode,d=e.passes;d.render&&(h===b.SCENE3D?this._zoomedOutOceanSpecularIntensity=.5:this._zoomedOutOceanSpecularIntensity=0,n.maximumScreenSpaceError=this.maximumScreenSpaceError,n.tileCacheSize=this.tileCacheSize,a.terrainProvider=this.terrainProvider,a.lightingFadeOutDistance=this.lightingFadeOutDistance,a.lightingFadeInDistance=this.lightingFadeInDistance,a.zoomedOutOceanSpecularIntensity=this._zoomedOutOceanSpecularIntensity,a.hasWaterMask=l,a.oceanNormalMap=this._oceanNormalMap,a.enableLighting=this.enableLighting,n.update(e)),d.pick&&n.update(e)}}},A.prototype.isDestroyed=function(){return!1},A.prototype.destroy=function(){return this._surfaceShaderSet=this._surfaceShaderSet&&this._surfaceShaderSet.destroy(),this._surface=this._surface&&this._surface.destroy(),this._oceanNormalMap=this._oceanNormalMap&&this._oceanNormalMap.destroy(),s(this)},A}),i("Shaders/PostProcessFilters/PassThrough",[],function(){"use strict";return"uniform sampler2D u_texture;\nvarying vec2 v_textureCoordinates;\nvoid main()\n{\ngl_FragColor = texture2D(u_texture, v_textureCoordinates);\n}\n"}),i("Scene/GlobeDepth",["../Core/BoundingRectangle","../Core/Color","../Core/defined","../Core/defineProperties","../Core/destroyObject","../Core/PixelFormat","../Renderer/ClearCommand","../Renderer/Framebuffer","../Renderer/PixelDatatype","../Renderer/RenderState","../Renderer/Texture","../Shaders/PostProcessFilters/PassThrough"],function(e,t,i,r,n,o,a,s,l,u,c,h){ "use strict";function d(){this._colorTexture=void 0,this._depthStencilTexture=void 0,this._globeDepthTexture=void 0,this.framebuffer=void 0,this._copyDepthFramebuffer=void 0,this._clearColorCommand=void 0,this._copyColorCommand=void 0,this._copyDepthCommand=void 0,this._viewport=new e,this._rs=void 0,this._debugGlobeDepthViewportCommand=void 0}function p(e,t,r){if(!i(e._debugGlobeDepthViewportCommand)){var n="uniform sampler2D u_texture;\nvarying vec2 v_textureCoordinates;\nvoid main()\n{\n float z_window = czm_unpackDepth(texture2D(u_texture, v_textureCoordinates));\n float n_range = czm_depthRange.near;\n float f_range = czm_depthRange.far;\n float z_ndc = (2.0 * z_window - n_range - f_range) / (f_range - n_range);\n float scale = pow(z_ndc * 0.5 + 0.5, 8.0);\n gl_FragColor = vec4(mix(vec3(0.0), vec3(1.0), scale), 1.0);\n}\n";e._debugGlobeDepthViewportCommand=t.createViewportQuadCommand(n,{uniformMap:{u_texture:function(){return e._globeDepthTexture}},owner:e})}e._debugGlobeDepthViewportCommand.execute(t,r)}function m(e){e._colorTexture=e._colorTexture&&!e._colorTexture.isDestroyed()&&e._colorTexture.destroy(),e._depthStencilTexture=e._depthStencilTexture&&!e._depthStencilTexture.isDestroyed()&&e._depthStencilTexture.destroy(),e._globeDepthTexture=e._globeDepthTexture&&!e._globeDepthTexture.isDestroyed()&&e._globeDepthTexture.destroy()}function f(e){e.framebuffer=e.framebuffer&&!e.framebuffer.isDestroyed()&&e.framebuffer.destroy(),e._copyDepthFramebuffer=e._copyDepthFramebuffer&&!e._copyDepthFramebuffer.isDestroyed()&&e._copyDepthFramebuffer.destroy()}function v(e,t,i,r){e._colorTexture=new c({context:t,width:i,height:r,pixelFormat:o.RGBA,pixelDatatype:l.UNSIGNED_BYTE}),e._depthStencilTexture=new c({context:t,width:i,height:r,pixelFormat:o.DEPTH_STENCIL,pixelDatatype:l.UNSIGNED_INT_24_8}),e._globeDepthTexture=new c({context:t,width:i,height:r,pixelFormat:o.RGBA,pixelDatatype:l.UNSIGNED_BYTE})}function g(e,t,i,r){m(e),f(e),v(e,t,i,r),e.framebuffer=new s({context:t,colorTextures:[e._colorTexture],depthStencilTexture:e._depthStencilTexture,destroyAttachments:!1}),e._copyDepthFramebuffer=new s({context:t,colorTextures:[e._globeDepthTexture],destroyAttachments:!1})}function _(e,t,r,n){var o=e._colorTexture,a=!i(o)||o.width!==r||o.height!==n;(!i(e.framebuffer)||a)&&g(e,t,r,n)}function y(r,n,o,s){if(r._viewport.width=o,r._viewport.height=s,i(r._rs)&&e.equals(r._viewport,r._rs.viewport)||(r._rs=u.fromCache({viewport:r._viewport})),!i(r._copyDepthCommand)){var l="uniform sampler2D u_texture;\nvarying vec2 v_textureCoordinates;\nvoid main()\n{\n gl_FragColor = czm_packDepth(texture2D(u_texture, v_textureCoordinates).r);\n}\n";r._copyDepthCommand=n.createViewportQuadCommand(l,{uniformMap:{u_texture:function(){return r._depthStencilTexture}},owner:r})}r._copyDepthCommand.framebuffer=r._copyDepthFramebuffer,i(r._copyColorCommand)||(r._copyColorCommand=n.createViewportQuadCommand(h,{uniformMap:{u_texture:function(){return r._colorTexture}},owner:r})),r._copyDepthCommand.renderState=r._rs,r._copyColorCommand.renderState=r._rs,i(r._clearColorCommand)||(r._clearColorCommand=new a({color:new t(0,0,0,0),stencil:0,owner:r})),r._clearColorCommand.framebuffer=r.framebuffer}return d.prototype.executeDebugGlobeDepth=function(e,t){p(this,e,t)},d.prototype.update=function(e){var t=e.drawingBufferWidth,i=e.drawingBufferHeight;_(this,e,t,i),y(this,e,t,i),e.uniformState.globeDepthTexture=void 0},d.prototype.executeCopyDepth=function(e,t){i(this._copyDepthCommand)&&(this._copyDepthCommand.execute(e,t),e.uniformState.globeDepthTexture=this._globeDepthTexture)},d.prototype.executeCopyColor=function(e,t){i(this._copyColorCommand)&&this._copyColorCommand.execute(e,t)},d.prototype.clear=function(e,r,n){var o=this._clearColorCommand;i(o)&&(t.clone(n,o.color),o.execute(e,r))},d.prototype.isDestroyed=function(){return!1},d.prototype.destroy=function(){m(this),f(this),i(this._copyColorCommand)&&(this._copyColorCommand.shaderProgram=this._copyColorCommand.shaderProgram.destroy()),i(this._copyDepthCommand)&&(this._copyDepthCommand.shaderProgram=this._copyDepthCommand.shaderProgram.destroy());var e=this._debugGlobeDepthViewportCommand;return i(e)&&(e.shaderProgram=e.shaderProgram.destroy()),n(this)},d}),i("Scene/GoogleEarthImageryProvider",["../Core/Credit","../Core/defaultValue","../Core/defined","../Core/defineProperties","../Core/DeveloperError","../Core/Event","../Core/GeographicTilingScheme","../Core/loadText","../Core/Rectangle","../Core/RuntimeError","../Core/TileProviderError","../Core/WebMercatorTilingScheme","../ThirdParty/when","./ImageryProvider"],function(e,t,i,r,n,o,a,s,l,u,c,h,d,p){"use strict";function m(r){function n(e){var t;try{t=JSON.parse(e)}catch(n){t=JSON.parse(e.replace(/([\[\{,])[\n\r ]*([A-Za-z0-9]+)[\n\r ]*:/g,'$1"$2":'))}for(var o,s=0;s<t.layers.length;s++)if(t.layers[s].id===_._channel){o=t.layers[s];break}var d;if(!i(o))throw d="Could not find layer with channel (id) of "+_._channel+".",v=c.handleError(v,_,_._errorEvent,d,void 0,void 0,void 0,f),new u(d);if(!i(o.version))throw d="Could not find a version in channel (id) "+_._channel+".",v=c.handleError(v,_,_._errorEvent,d,void 0,void 0,void 0,f),new u(d);if(_._version=o.version,i(t.projection)&&"flat"===t.projection)_._tilingScheme=new a({numberOfLevelZeroTilesX:2,numberOfLevelZeroTilesY:2,rectangle:new l(-Math.PI,-Math.PI,Math.PI,Math.PI),ellipsoid:r.ellipsoid});else{if(i(t.projection)&&"mercator"!==t.projection)throw d="Unsupported projection "+t.projection+".",v=c.handleError(v,_,_._errorEvent,d,void 0,void 0,void 0,f),new u(d);_._tilingScheme=new h({numberOfLevelZeroTilesX:2,numberOfLevelZeroTilesY:2,ellipsoid:r.ellipsoid})}_._imageUrlTemplate=_._imageUrlTemplate.replace("{request}",_._requestType).replace("{channel}",_._channel).replace("{version}",_._version),_._ready=!0,_._readyPromise.resolve(!0),c.handleSuccess(v)}function p(e){var t="An error occurred while accessing "+g+".";v=c.handleError(v,_,_._errorEvent,t,void 0,void 0,void 0,f),_._readyPromise.reject(new u(t))}function f(){var e=i(_._proxy)?_._proxy.getURL(g):g,t=s(e);d(t,n,p)}r=t(r,{}),this._url=r.url,this._path=t(r.path,"/default_map"),this._tileDiscardPolicy=r.tileDiscardPolicy,this._proxy=r.proxy,this._channel=r.channel,this._requestType="ImageryMaps",this._credit=new e("Google Imagery",m._logoData,"http://www.google.com/enterprise/mapsearth/products/earthenterprise.html"),this.defaultGamma=1.9,this._tilingScheme=void 0,this._version=void 0,this._tileWidth=256,this._tileHeight=256,this._maximumLevel=r.maximumLevel,this._imageUrlTemplate=this._url+this._path+"/query?request={request}&channel={channel}&version={version}&x={x}&y={y}&z={zoom}",this._errorEvent=new o,this._ready=!1,this._readyPromise=d.defer();var v,g=this._url+this._path+"/query?request=Json&vars=geeServerDefs&is2d=t",_=this;f()}function f(e,t,r,n){var o=e._imageUrlTemplate;o=o.replace("{x}",t),o=o.replace("{y}",r),o=o.replace("{zoom}",n+1);var a=e._proxy;return i(a)&&(o=a.getURL(o)),o}return r(m.prototype,{url:{get:function(){return this._url}},path:{get:function(){return this._path}},proxy:{get:function(){return this._proxy}},channel:{get:function(){return this._channel}},tileWidth:{get:function(){return this._tileWidth}},tileHeight:{get:function(){return this._tileHeight}},maximumLevel:{get:function(){return this._maximumLevel}},minimumLevel:{get:function(){return 0}},tilingScheme:{get:function(){return this._tilingScheme}},version:{get:function(){return this._version}},requestType:{get:function(){return this._requestType}},rectangle:{get:function(){return this._tilingScheme.rectangle}},tileDiscardPolicy:{get:function(){return this._tileDiscardPolicy}},errorEvent:{get:function(){return this._errorEvent}},ready:{get:function(){return this._ready}},readyPromise:{get:function(){return this._readyPromise.promise}},credit:{get:function(){return this._credit}},hasAlphaChannel:{get:function(){return!0}}}),m.prototype.getTileCredits=function(e,t,i){},m.prototype.requestImage=function(e,t,i){var r=f(this,e,t,i);return p.loadImage(this,r)},m.prototype.pickFeatures=function(){},m._logoData="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAALQAAAAnCAYAAACmP2LfAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsIAAA7CARUoSoAAAAAHdElNRQfcDB4TJDr1mp5kAAAAGnRFWHRTb2Z0d2FyZQBQYWludC5ORVQgdjMuNS4xMDD0cqEAAB1zSURBVHhe7ZwHeFTFFsf/u+l9N70npOxuSAKEFFIhCSH0qhEQUHkgKCgWUFGBB6IoCAoo0ntooaRvEkIIBBBpoYSa3nvvfd+5u4sQUigPfMX8v2/Y3Tkzs3fv/d0z58zcgF69Ql1SY+MM1wQJem44ZeiJk8beEOqPwG6uC7ZqyElb9eo/JZEIkH2nRQkBIlNMauuPCS3uGN/kjkmNDghoskBAgzrZ2NLmf1+JwIKQpYsoxdmIV9+N07onCegzBPM9bOdmYKnazF6g/1N6UySPqSJzvCaaiLHtP8G/Phq+FRfgU5ogKWUXMLT6Mvzqr2BE40mMadqO8c3zMabBC6PqDDC8SlY60t9HByCLVTKu+ERmHr5TWI9wjVxEaOZivWo1pil8D1tZeWnLXv1l8iZ3PF2kjymiWRgvCoJv5U243IyAXcQq8A9Mg9W+4bDe6wv+kVGwCZkL+4Sf4ZR+BZ5VGQR3EkbWn8Hopm3wq54Lz2JD6ah/P21XGopQ9Qoc16jGSqVyTJWbQbUsibFXf42mihTwZpsvAtp3k0dOhFOSEH1+ngaDefrgjFCgFkxY8fCisCBvKgODzxRh9qslBFGfYmDGLbiV5mBwRRo8KtPhVBgPu8teMP7u73chD6kMRYRGBY5xqrFKqQwz5SdTbS/Qf5mmUYw8rf01CjHC4VP7AHZxO6E3qy9ZZCQNnio2rE/4o9/tkxiQUYp+KRXgx8XC5FsXcLz/hkCrDUU4pxLHuDVYpdwL9F+qqSJZKlPwenskfOoI5tN7YPCJGVme7wKYr5EBXzgYfW+mwTI0Gjrznaj2WW+I/y8dVPdDGLcKRzXrsEqlHO8oTKHaXqAZWe9hQXCi63NhHWYI3ilfWIW/YLjqL2JRiOFBJRz+LffhcPs09D+0J8vzn3zXdBnYnp8Mi6NboTWzH9X8fVc+DhDQodxqAroe36lU9AJNWr4cEAjNwI8OAC9cT1rbUfzwGeCfKiL7dGnNc+q1NiO80b4BY1oT4V6WDcsdc6j2xbyq4wMWrA9rQmeWFn36ey/jBaoPQ4hmLYI0G/AtAf22fC/QDols8ITrIYi/Bl6knbS2o3gRbxHQxQQ0k0S/gCa2v4OJovPwacqAQ1ICjL40klr+UrWoQbFBETo18jCpZsOoFODkvuCNJYoHW3QKXFEM7ETRcKfiQe8d6NVIFImXvg4skhY40mxnQYVRIIeA1qrHEc1GrFSpxFtP99AiFbDbNKDZpAzzGkVYVcvBuBJQEo/9/6C+dyjPitwLwak74D8V6Bfw0P5VShjXFoTR7TfhUZkL29M/wfATJan1lauWC3aDOgyaVDCuTgbf1bFkfmtkye1ogsK2asivLYfCglIoD8qCknI2NHuG4QSVGMgQyMbt0fioRYh9VYcRU7QX55uDcaHtFOJEsThMtmWtQgxsDodsWaC0c3ea3MzGBJEqxrfbYmzr6xjfPAeTmt5HQPO7eK1xDibUz8eY+k8xtHYJPCtXwvHOu7AXMrMTsF/TH8HajTis1YwVqpWY0TXQDKy1OpBr5EJA52Fukxx+bmKxtjWx2DuaWawNlZD5qhzyo9KhpHAbKpJO/6t65UCPbPHA2PYrGNacgkElabCJJDev/MpDhUKKnuq44LRoYEK1IiswkS1zYCfk5y+F0qjvoTwqBOof34dGeAnUL1ZCLboEnJ9zoe0QD/Nuj00UBVXRabzVLETM3S0ICfwA8yc7Y6C3ANYbZsA7aQ1W1xzEfZEQ6dT2BkG9pP4ouo7jGE1u42JS20QMrzkCr4xwuN4+AM+cYII3EaNar2J86zmMrP8DHulCON4NhU3YWuhOYy6SZENpH9cfx7WacFC7BSvUqjBDsRPQIiugURvazeqYVaqAw6dYrJ9WQy7gayj4nYDy3HtQOVQGpYRqKEWXQf2HdGha/AFdae9Xr4czz0ubISRA75ECbSut7agegO75OLxpahze8j5GtifBpzEDLiV30Dd2mNT6StWiCbVmLt5rUkBQCEt2zWzIMSA8HgrIBkLD+Sp0jhHISYXQ/KMYukfvQ3fQxq68XCTBHId/tMTg7LV1CFs4BszJ6hBarBgHlcRv8H7tbuSKQpFPYGe0BmND+nZ0npECaPKf0r4UIxsuoF/IMpitsAVnrA4s15uh3x8fwLXkLobUZGJIXTqcUzbDaJE5FAVq0t4S7dEcjqMEc6B2K5arVWN6Z6AbdOmm5mJelQKOHWSxF44Cy4CqxW0s6RwchCovFRohdGNfLgX3WiZ0N4aD++y7jfwYJUrAPCle/ZjKV+BFTSegrGAZIm3QjXhBytTWB3zhByzryMUU986jz16wD+96ijCNUIAgmkc3tS6G7GERjCbgR82B4OTbEESqIiCIcqsIYzoGGyrBEMSmgh8xBoIIAR2fAHZhj8Z9DOhl9FHeKkSDvn809fuc+iyCddRYaiOZBTvIt1YJfs0b4N+WDO+GHPLQN2Ab7S61vjJV60C9SRPvNSqzTpxlyQfS1dGUmjppK7gW16B/LhN6abnQu5cDwzO3YNhhqqK4WJY887sEdGzWFpxfOxmDpKZOOvgWFB8sx9L6nShvP4FyUQjKGg5gScpGKEqbUE7RxiGYv6QQ4zIG/r4D2m88sjEy/EIW/a6+TQ4gHe5VhXCvy4JL7gLYnesI2i6t4Tii04r92u1YKt767gB0ozrkGzmY26zEOh7Hkt+kAKhLTX9qOVVdg9aoNOjcToR+wUVKLYKgN0Zq7l7884wn9CKgr4AfWw/B6SwqKQRKOdXVghe9CpbherASSjtIpGpxRIHFjwygNreoXy0lb+lU7lHJBP9kPcGXQnBNghUB/Lh44fbUp5JA+5Hs71LbPPLCVRDEJZDNGIJgeQI6mG6KegKzldq1U7tGKjQmHR8vwl86kgRoAQN0xBw6ztn0nQ/ocxEdQ7L4d/BjG6g+m8aZTL/xsXPuW82Fb8t+DG1Ox5D6XAwqvQ67OA+p9ZWoUQPsei78mjSwNU9GLmEzVGZJTd3qFPTn3YZhXgYMMjNhlHsDxms/hNWfoUdrNPgEc2h7BG5d/Bo7Blt0BuNxXf4MVmXrkdRyEHWiY6hr2oc7mevRX2wc18gioEeI1+N9a+/CNnImVAZ0mhEoNOPAJT8MHjUF8KTiWhqHgbfMpVaJdhLQh3XasU9bJAZ6ekeg6zQwgEKuLSWysmd3QGmatLqD8qDNug3dCX/AIPk4jGr2wDB/JXTmkan70IvmZTY/rB9BdZlKLkG0lG0d5klAObKsw1+jzyFiWPnRawiaDrMYwTyMwMwh220WP2IWFVfqN4CKO8E3n0C6R/ZUej9Y2kUiMdDRFTRePH3nA3q/m7xpAEtAXl0QrkTwscnmS/3eptdzNEYevZLnZ5booqk8tuYs9tAny+n1LL1mghezlcULH0VtHamOZhvhIvoNOXQsd2EZIbluYnlWaMO75TCFG9kYXJ8H14o76H/10Z3yClSrCm6jGtbWK7LC7kIlYRfUmY2XHnUa+mbXYRSfCuNCptyE6b1jMBD/EPKwchQPLxGdxOWWI8iKXYBPqLozgI8pfA5YBWvxbfMeNLUfRmPTLjRnr8YKsdGvRQ5j2zZTSSRQ78H+7GhxfScFAINypsG9ukDspZ0LKKE+O0pqlGi71ggcIqD3dga6RhFKjSqYT+VEFkvu/E9Q+HNWKaE2VVDgVkPFqwAaay5CN3En9M59BM2vfKDs7AvljjPGE5LlharQdL+LoCmhOHU0rIUyD+NgVTOa+q2iVQiIcAKpHtbhXuJOjPqeVCRYThNE6VTvKNs3hM3cHGIxntxKyCbP7Erj1lHZJbVIJAG6iiCroZCAPGukvOyASJbvCgoaAoKoAQ1kHcGC7nmZDkmhBR2PfSQLtkcl4zCSAE2eO6qExYuYxrE4KqdvelBiM4+ncYQy1IY8d0wbhUSLJAZGbsUceNYdwJCGPAyuy4NbZToG3JoO1Qk9AvHvqF4ejo0KCKlisyl04Jw+AE1ma71HRUJP+QqM1t2HcVEyTEoSYVYQCuN3HenCt4XDhGA+KorAnYZ9KIj5ELOl3XpU/k/wrt+OmraDaG7cjpacbxFvYAAZDG5Vw/DWCxjRdp+ATsWAS6+D69H1+XDNsoVb1T06b0VwzCmBIOYdqUWibTojcFBH1CXQctBtUcA6Oh/RmVC4sBmKA5j6erC1qqE4sRpqG25A43QIOHuXgvOmP5R4ZH6m5UY2L9SSLjZ5sKjjsI/o8olH8ngjCZoSgmw9DMIl3t42Up0g+pq89/sEjLK47knZhSkSuDepJP4JOyNJyEFAR8VQKMOR1nbWM69yxNJYwh+VLE90ffPyxLE3EwL9Jq0huWQqwL1iA7zq8+FVl0+epgBO6T+gb2TH+OglqgastxtZrNNlkLt8E5oJx6HZdab7mFZBk3UZRjMewCT7HkzLfodZxREYr5sBjiIBPYiAPt8ehvSGPSg5vwjzpd16VNkmmDTswp22QDTXbkJrxhJkzHGDFoUQmvBpvo2hrZl0TnLhlLIYfUO7nt7dSg3hURcP1/JiDEgphuXBqVKLRFsfA3oJAf3mI6Cr2OjTwGYdqWGzzmZD6WoYVCfehdqsZKjuuwS1oB1Q+5piHac3oaxBzZ9vLZ4nHEeesoXg6niDPSYWP9yUgD5PHu48eKE64krHcErchHIEuRysTpAXjObQWIYEHiV4EQYEojp5aEoyY+IIpOQugKYYOnIdJXrdJ63PtWwXMQM6m6SVT4gfZkbHV0XHsVtaQ3K8yoJr0YfwoHDDq5ZiQSqDik/B4Q9taYtn18gyNia1qGJsmTrGlUjK2FJ1jCjRwOASDnkxDvN95ZD/og5yl0qgfCMJ2leDoeksHaFHXYOJVyrMkm/DrPwMzGr2wmjnLGipthyHL0W7t9pDkduwF2U3lmGFtvbTdyirt0OreT+iWwPRUrUBbSkLkT/fCUZwKVYikBMwpDlPXNzLwuAQ2rWX8KzUh2dDDJyLSmB7/S5Mf3WRWiR6CPSezkCXQs6qBnLCKsheyoXqnTCoL9oOFd9/Qtl9KJT6UJMX3/zhCz8iuCjhiviSYtMx3ZTJBN8lCE7eIRgF0p6krRRaRBDskTTGySBKws5SuUjJHYUiMQdpzCUE0Q3y5MnSDhJJQg5JUvjSgO5hHZofaioGmvc40IycMgbRtJktjgOZ5Ma9irzSg46xYHcaVEZevkgBHqUWGFK+FENKQ+BdGAq/wiMYWbwHI6h4FwTDOes0BMKFMHxPNg9qn1dANakYanfuQSs5FJoTpaP1qBswsSGgb9+EeUU0Af0LDH4dBhXlmv3wajuOpPYQFDcEojxtNQ6sn9ZzUsiofjfUWg/iYOt+tJatRtvN95DqZgxNuKTKwLV4Jdyqc8Wz1uCGTLjmDIVDQqewQ8anwpJi6GsYkF4Ey2O/QvsfXKlJIgboAwT07s5AZ0G1TylUIsuhdKMI6vcuQ3PVAqg+9UZ8JvGEywiuNoIwD4IzaV2X+HSa1otgE3+NwJImVkycG0kx8snfyUZJW+QFApeSu+hN9BpIn6n+ZBp9bqDv+C8Fum+8IpzzJNOmR3UhTaGFcC07iAHXmamuZw28C/S/aIt+CcthF7+ToN0EQdhqOFzcBu/Sm/ApvAGX3DzYXIiF9jtWTJf74L6ZC83UfGg8SId2xnloSZKxp+gWjC0J6KSrMK8KhmnlSugtInpkCzaBV78Hl5oPoaLpECrLt+Bi4jfgS7t1q+YDUGsPwj5KDFsLlqD97JuIpmpZmP+TftM1ezjlxsOllM4H3eReDWHwKrOBW84jqMeK5OBTv4Bu6HxxgqU1s/N3MkAHSoH+ioCe+gjoJHB0s8ENLID6/UJo3E+GVlwoNEwY278tXhR50RhmeexzgmM8JXjdF36MHwEoiXn70Csv6gxBm8PiRc6gJFD1HDzFpq1cP0omo5QJZAfqQzH0f6uHZjQgeR4cC/IJZCnUtSkYVPAWBiX2/CdU/S7Ql+9TgtFCTaiP0qAEXA2yRsqwuzECziWZcM4tgv2DSljF7ID+l+JNh9+hY38HuvcYmLOhk5EEnVPfQOmpW+33YGaXhj53E2BWuxvGebOh5cPUX/sWSgXrsa9mB2qaDqCK4C7I2IA3jn8u7tat2g6D034MIbWb0fZgHlr2DscXUhNNuYdkYRPrg/7JiXDMLYBrZS6GNEZgVJM/JjWY4I16G4xr/BCDq2nKjjoAvY+Zpwo7eXBskQK9Swr0lEdAn4a2wk3o/DMNWmn54KYUQIuZsebGQuXFQ42H4kfNk4QckSOkNZ1lGkGAUoInOKkAm2jJsVtH+om9Nj9ytZxNcNdhljXByo+JJXj/i4G2u2xM02YInPJLxFB7VudTPH0ZHkWu0hbPpwHpfnAszoFDVgVsb1fDMmoL9L8S7wTFQE/1AvR33oB+QSp0czKgl34B2iO9uwJCKib5SGaZjbqLPlkhMG1YDr1gQyioSs24vQTDitagsnIL6loCUVu9C2EJK9FjYtsWBNP2Q7hb9A155zdwY5mTeGexo0w32hEcy2F7JQaOqZfgk38KY6rDMKFBiGHNt+iGPgCNYd0/s/sbAb2fgN5JQC9Wq8bkR0AzioOOx3Xo30mGbnY+tNMKoJOQCm03qfnFxRf6E1yUFAqZJcyuZRWuQmB+TWHJcgJfkjPxImcSSIUsXviMx/O9DvqfALrPDjb6nhuBAWkZ5JFKKTYuIqhz4FUdAo9CGwzO7Ra2LjUg0w9OxdlwyKxAXzHQm8lDi4HeAT1WMPSHnYXR7aswKE6Gfl4K9PdfgZ6+uG8XSmMbKyXD/LsEmFduglH2NHA7rA3Hvg+Ve1/gYO4KNFRvQUPLQVRU7MG4yn1dJ4eiULAo3JhW9xsa77+Hml8GY8FQ425uAM5wRRivNoPlTjs4XhoH35oLGFZ/S/wglyDkbWmrrsUAvY+A3kHlSwJ6ihKzCvLnuQyElmIs9LdfhmHxA+jn5kI3jcrRFOjxU6DTbTx9DybsOBh0f034EeYEVyaFD0IYhnQ9y1pTIsiPvU5AnKYkUBL78yKmQhDLgDRPSWtPp/HFkFtHqFCfRBr73wX67qsD+qFsEubCnqKBAZllcCkkT12RjSHVMfApH0bJXfcH+aQGZg6FU1EWeeoK2NwgoMM3Q++zP/fq/Smf2g392ZEwzk2Acfl9GBHURmuSYPyn132oHBizH8B8wjX0SadQI2cWtOZZQbHTdEgRn8XN93EiczFayn5GU3Mg7lJMPab5SEeoCWZZ0TF4Ne/A/ZSPUbXdDz9Qdddrrk/KtcwR7jX34VXDzGCFGFT0GzyLu922x069kdiv145tOu34jlOHBWoz4arUAZQt0LYOhmFcHJ2H6zAsYnZDc2FwKhv60+m9UQrLUJ4hSYQAVhpM1O6jj30EDD33Q6frZyoY8cMVaWZZR560kuB5V9H6iVUas+Py5L1/IHsT2ZldR4nEkMdkUd8Y8tYd43mLIMhYhenDWvgjQSQiGFOkiEv0rEAzK2u8yG10M2WwBWFdb6q9NKDNd6rCOuYD9L2VI/57QMfcEniU5cCnJgG+lR9haAnz4MzT5ZjmA4e8HBqnGtYXamF+nK7bpx0uwHxoqGyE3sKD5HHjYVJ1C6Z5qTD5Ph2G1hnQEV/0LBhxU2E+4yYsbgTCJGsuNBfYQrnjA0CPxDo2CRYJ0xGesgD1ZWvQ3LQbKeSJ54uC0UcUDVVRGExFR/FB2y7cSf4C+Zv9sXSUeQ9P2z2pQdnmBHQsPKqKqFCyWJsM75o1GMw8O/iEhFZs/KK9CD9wRfhCTYTP1dqwnBOHrQYz8IuuH5ZxxI/MLQZH5kfoeu6D4cVQGNecgXHFbRgXZsD4Xg5MjqfDeE0KTBbRDLXsLiwOR8HkxCJoOs+Eavdr08ZBBGdYP7rYzAZILsH3LYUYtgSsAXlYRwLqW0r8Ksl2id4/Onaz47IE+kayUfwddYhsgwkqXRrLgOpHEuyhVF9B7ytoTAL//qNjeFagGfGEi5nvYPEifqOx/ek4p1J/8aKBWC8N6Icy2+oL6zOhECTmw46SuoHZpXBn/pK7/DK8K1bCp3Q0vAv7wqfIBD55OuS9teFVYASPfAFccseThw+E4Ho5LOMqYB6ZCeOdK6H1bleJH2sOOPZradqlC3otDqY5F2GafQmmCZdgFnMBZteEML2yCnprh0CZWVp66gbDuD5Q2uSLUacm43jSB0gq+h55JeuRX7wRqUUbkJL8DS4GTcPqCdZgduZ6XiZjgvcp9fIY3aAH/yY+3KvcMDBjLSXQBXDML4VbaQG8a9PgUxcOzyIneKY/Or6FHDO8q7INY+RiMFJaJijE4i2VeEylej/FDs99TAPH8Dvofv8bDK/vhVHxMRhX0W+vOgXTijiY5UXANGkNnYeRUGN2VrsPNx6XVaQNgRNM03sBgUjeOKJJ/Cr+LNzFsg61YB5/elyKtic0qM031CaZAG0gqJnVEuYBIoI49gy9D6DXrQR3GoU2j3YE+WE2FI9TGBG1FLywnhNbPt1Y/OhY+o5iGqsGNmdLaVxfqZUB+g0Iztwi2AOkNZ3FCzOm30bHeHK9tKYHKfPZMFhlAtM9c2EpjALv93zY3qlE/8xyOOUVUTiSBrfy83CvDIdbRZC4uJSGwzHzd0qgkmEVfRnGW/dC79vPobtkFLRmm0HDpVt43MnrzoOm/dfQeeOf0P3wB+guJogXrIDuhHfAsdOFbKdQ5GkaYQbNNYNht2c8/AOnYNKB6Ri//Q14zRwIuohdPC76pCbWKGFCkx9GNC7B0NZD8CiJh8Odi7A59zud7EuwvU4hVUYZBhUXwqsqA56V0RiUM1Dam36UoiyFuprQhc6fRZuKKhV5+rcLKD2hrPQ+NPsvgNb0j6C9eCG0v/kU2l9/BK0ZM8EdRJQ833noG8Qib6lDkA0lYD6i8GIJlffZ/IhhbJtQjW4TP164EiWWztTnH9T+a4L/MxpjAn02hWWYDAQnefSZzm7Io7zDOpiSzGh3grwPwd3zDccPZdH4phBEkXcWBrD4wlE07qObw5pmBUGsK43T/YPfgmAFWEe5U2EeCXhGcV5nQ3u2KrTf6w+jdTNhtud7mB/ZC4vg43QAwbAMDYLF0e3os+8HGP80D7oLx0F9dD+oj9AGZ4Y85K0Yj/Vs3kQiFgeybFPIySiDzdwAz9O3JzHjPNtYk8gjv948FOOatlGodR0Dk07Bau9n0F8wFBp+luBO1CXeuDD51Q3830PRP7UIzgUlcC0vhHPRSdic6eI53ecT3W0sKyjI2EFRxhzyz3sOO8voBkEUTclYhAyshCwr642PR79diwlbBOEs8vLMFjgbbuelhpeoz5rEDxsNNl/+9ON5RWJOLsXCysQdh5IhWWbzhUmoel6v/l/RxGpZTKgbh3EtEZQMp5AX2ASd2f3AVu7695ky/7nOuc2U/BZSCFIGp+I82F/rfprsVa/+Mk0sZ2F0tTvGNZ+gRO8B7C/HQ92beWine+/IDWDBbJUmbBN/hUNOGRyyStH34vfQeP3ZV4R61atXIu9Kefg1rIB/XRJciwso9nymLXmxbP+wxcCsVAxIKwfv1AZoDH96jN6rXr1SuVeowKsuFINrs+BSXATbc59JLU/XwCwdDMw7B/vUEpgHfQYZ7v9HCNar/2E55ynDpSwYrhXF4uKUeQiY0/Oy3kM555nCITcJgmvp0F30Yo8L9KpXL1X9E2XhkPoVBuYWwbmolKDOhmv+WHiXyGNkgbTRE1pOublXkRycCz+AfUoRzPdsgKJN1w/19KpXf7n6xlnCPikE/SkWdswrozDkNoZUfIWhFTYYWaPy4a6NkgSR2XAZXSOLIWUWcCv7FP1T7sH8wFZwp7ycxz971auXIm4AG+b77MFLEKLv7ULJMy0FefCsPAOv0t0YUrIMg0s+gVfxYrgVbIJLUSzsrl2F2ZZl4L7J/Pdp/956ca969UrEna0O41/HwSJ4F3in42Fz5Trsbt5Bv3u30e9uImyvnoV15GGY/LIA6kOZP1966pZ8r3r1n5eqhwZ0F/aB4ToHGK9zh/FPHjD60RE6H1tDaaA2cdy7mvFfI+BffksPNrEksu0AAAAASUVORK5CYII=",m}),i("Scene/GridImageryProvider",["../Core/Color","../Core/defaultValue","../Core/defined","../Core/defineProperties","../Core/Event","../Core/GeographicTilingScheme","../ThirdParty/when"],function(e,t,i,r,n,o,a){"use strict";function s(e){e=t(e,t.EMPTY_OBJECT),this._tilingScheme=i(e.tilingScheme)?e.tilingScheme:new o({ellipsoid:e.ellipsoid}),this._cells=t(e.cells,8),this._color=t(e.color,l),this._glowColor=t(e.glowColor,u),this._glowWidth=t(e.glowWidth,6),this._backgroundColor=t(e.backgroundColor,c),this._errorEvent=new n,this._tileWidth=t(e.tileWidth,256),this._tileHeight=t(e.tileHeight,256),this._canvasSize=t(e.canvasSize,256),this._canvas=this._createGridCanvas(),this._readyPromise=a.resolve(!0)}var l=new e(1,1,1,.4),u=new e(0,1,0,.05),c=new e(0,.5,0,.2);return r(s.prototype,{proxy:{get:function(){}},tileWidth:{get:function(){return this._tileWidth}},tileHeight:{get:function(){return this._tileHeight}},maximumLevel:{get:function(){}},minimumLevel:{get:function(){}},tilingScheme:{get:function(){return this._tilingScheme}},rectangle:{get:function(){return this._tilingScheme.rectangle}},tileDiscardPolicy:{get:function(){}},errorEvent:{get:function(){return this._errorEvent}},ready:{get:function(){return!0}},readyPromise:{get:function(){return this._readyPromise}},credit:{get:function(){}},hasAlphaChannel:{get:function(){return!0}}}),s.prototype._drawGrid=function(e){for(var t=0,i=this._canvasSize,r=0;r<=this._cells;++r){var n=r/this._cells,o=1+n*(i-1);e.moveTo(o,t),e.lineTo(o,i),e.moveTo(t,o),e.lineTo(i,o)}e.stroke()},s.prototype._createGridCanvas=function(){var e=document.createElement("canvas");e.width=this._canvasSize,e.height=this._canvasSize;var t=0,i=this._canvasSize,r=e.getContext("2d"),n=this._backgroundColor.toCssColorString();r.fillStyle=n,r.fillRect(t,t,i,i);var o=this._glowColor.toCssColorString();r.strokeStyle=o,r.lineWidth=this._glowWidth,r.strokeRect(t,t,i,i),this._drawGrid(r),r.lineWidth=.5*this._glowWidth,r.strokeRect(t,t,i,i),this._drawGrid(r);var a=this._color.toCssColorString();return r.strokeStyle=a,r.lineWidth=2,r.strokeRect(t,t,i,i),r.lineWidth=1,this._drawGrid(r),e},s.prototype.getTileCredits=function(e,t,i){},s.prototype.requestImage=function(e,t,i){return this._canvas},s.prototype.pickFeatures=function(){},s}),i("Shaders/ShadowVolumeFS",[],function(){"use strict";return"#extension GL_EXT_frag_depth : enable\nvarying float v_WindowZ;\nvarying vec4 v_color;\nvoid writeDepthClampedToFarPlane()\n{\ngl_FragDepthEXT = min(v_WindowZ * gl_FragCoord.w, 1.0);\n}\nvoid main(void)\n{\ngl_FragColor = v_color;\nwriteDepthClampedToFarPlane();\n}\n"}),i("Shaders/ShadowVolumeVS",[],function(){"use strict";return"attribute vec3 position3DHigh;\nattribute vec3 position3DLow;\nattribute vec4 color;\nvarying float v_WindowZ;\nvarying vec4 v_color;\nvec4 depthClampFarPlane(vec4 vertexInClipCoordinates)\n{\nv_WindowZ = (0.5 * (vertexInClipCoordinates.z / vertexInClipCoordinates.w) + 0.5) * vertexInClipCoordinates.w;\nvertexInClipCoordinates.z = min(vertexInClipCoordinates.z, vertexInClipCoordinates.w);\nreturn vertexInClipCoordinates;\n}\nvoid main()\n{\nv_color = color;\nvec4 position = czm_computePosition();\ngl_Position = depthClampFarPlane(czm_modelViewProjectionRelativeToEye * position);\n}\n"}),i("Scene/StencilFunction",["../Core/freezeObject","../Renderer/WebGLConstants"],function(e,t){"use strict";var i={NEVER:t.NEVER,LESS:t.LESS,EQUAL:t.EQUAL,LESS_OR_EQUAL:t.LEQUAL,GREATER:t.GREATER,NOT_EQUAL:t.NOTEQUAL,GREATER_OR_EQUAL:t.GEQUAL,ALWAYS:t.ALWAYS};return e(i)}),i("Scene/StencilOperation",["../Core/freezeObject","../Renderer/WebGLConstants"],function(e,t){"use strict";var i={ZERO:t.ZERO,KEEP:t.KEEP,REPLACE:t.REPLACE,INCREMENT:t.INCR,DECREMENT:t.DECR,INVERT:t.INVERT,INCREMENT_WRAP:t.INCR_WRAP,DECREMENT_WRAP:t.DECR_WRAP};return e(i)}),i("Scene/GroundPrimitive",["../Core/BoundingSphere","../Core/Cartesian3","../Core/Cartographic","../Core/ColorGeometryInstanceAttribute","../Core/defaultValue","../Core/defined","../Core/defineProperties","../Core/deprecationWarning","../Core/destroyObject","../Core/DeveloperError","../Core/GeometryInstance","../Core/isArray","../Core/Math","../Core/Matrix3","../Core/Matrix4","../Core/OrientedBoundingBox","../Core/Rectangle","../Renderer/DrawCommand","../Renderer/RenderState","../Renderer/ShaderProgram","../Renderer/ShaderSource","../Shaders/ShadowVolumeFS","../Shaders/ShadowVolumeVS","../ThirdParty/when","./BlendingState","./DepthFunction","./Pass","./PerInstanceColorAppearance","./Primitive","./SceneMode","./StencilFunction","./StencilOperation"],function(e,t,i,r,n,o,a,s,l,u,c,h,d,p,m,f,v,g,_,y,C,E,S,w,T,x,b,A,P,I,M,D){"use strict";function R(e){e=n(e,n.EMPTY_OBJECT),o(e.geometryInstance)&&s("GroundPrimitive.geometryInstance","GroundPrimitive.geometryInstance is deprecated in version 1.18 and will be removed in version 1.20. Please use GroundPrimitive.geometryInstances."),this.geometryInstance=e.geometryInstance,this.geometryInstances=e.geometryInstances,this.show=n(e.show,!0),this.debugShowBoundingVolume=n(e.debugShowBoundingVolume,!1),this._sp=void 0,this._spPick=void 0,this._rsStencilPreloadPass=void 0,this._rsStencilDepthPass=void 0,this._rsColorPass=void 0,this._rsPickPass=void 0,this._uniformMap={},this._boundingVolumes=[],this._boundingVolumes2D=[],this._ready=!1,this._readyPromise=w.defer(),this._primitive=void 0;var t,i=new A({flat:!0});o(this.geometryInstances)&&h(this.geometryInstances)&&this.geometryInstances.length>1&&(t=G),this._primitiveOptions={geometryInstances:void 0,appearance:i,vertexCacheOptimize:n(e.vertexCacheOptimize,!1),interleave:n(e.interleave,!1),releaseGeometryInstances:n(e.releaseGeometryInstances,!0),allowPicking:n(e.allowPicking,!0),asynchronous:n(e.asynchronous,!0),compressVertices:n(e.compressVertices,!0),_readOnlyInstanceAttributes:t,_createRenderStatesFunction:void 0,_createShaderProgramFunction:void 0,_createCommandsFunction:void 0,_createPickOffsets:!0}}function O(e,t){var i=t.maximumRadius,r=i/Math.cos(.5*e)-i;return R._maxHeight+r}function N(e,t){return R._minHeight}function L(i,r,n){for(var o=n.attributes.position3DHigh.values,a=n.attributes.position3DLow.values,s=o.length,l=r.mapProjection.ellipsoid,u=Number.POSITIVE_INFINITY,c=Number.POSITIVE_INFINITY,h=Number.NEGATIVE_INFINITY,p=Number.NEGATIVE_INFINITY,m=0;s>m;m+=3){var v=t.unpack(o,m,Y),g=t.unpack(a,m,X),_=t.add(v,g,Z),y=l.cartesianToCartographic(_,K),C=y.latitude,E=y.longitude;u=Math.min(u,C),c=Math.min(c,E),h=Math.max(h,C),p=Math.max(p,E)}var S=Q;if(S.north=h,S.south=u,S.east=p,S.west=c,S.width<d.PI){var w=f.fromRectangle(S,R._maxHeight,R._minOBBHeight,l);i._boundingVolumes.push(w)}else i._boundingVolumes.push(e.fromEncodedCartesianVertices(o,a));if(!r.scene3DOnly){var T=r.mapProjection,x=e.fromRectangleWithHeights2D(S,T,R._maxHeight,R._minOBBHeight);t.fromElements(x.center.z,x.center.x,x.center.y,x.center),i._boundingVolumes2D.push(x)}}function F(e,t,i,r){o(e._rsStencilPreloadPass)||(e._rsStencilPreloadPass=_.fromCache(W),e._rsStencilDepthPass=_.fromCache(H),e._rsColorPass=_.fromCache(q),e._rsPickPass=_.fromCache(j))}function B(e,t,i){if(!o(e._sp)){var r=t.context,n=S;n=P._modifyShaderPosition(e,n,t.scene3DOnly),n=P._appendShowToShader(e._primitive,n);var a=E,s=e._primitive._attributeLocations;if(e._sp=y.replaceCache({context:r,shaderProgram:e._sp,vertexShaderSource:n,fragmentShaderSource:a,attributeLocations:s}),e._primitive.allowPicking){var l=new C({sources:[a],pickColorQualifier:"varying"});e._spPick=y.replaceCache({context:r,shaderProgram:e._spPick,vertexShaderSource:C.createPickVertexShaderSource(n),fragmentShaderSource:l,attributeLocations:s})}else e._spPick=y.fromCache({context:r,vertexShaderSource:n,fragmentShaderSource:a,attributeLocations:s})}}function V(e,t){var i=e._primitive,r=3*i._va.length;t.length=r;for(var n=0,a=0;r>a;a+=3){var s=i._va[n++],l=t[a];o(l)||(l=t[a]=new g({owner:e,primitiveType:i._primitiveType})),l.vertexArray=s,l.renderState=e._rsStencilPreloadPass,l.shaderProgram=e._sp,l.uniformMap=e._uniformMap,l.pass=b.GROUND,l=t[a+1],o(l)||(l=t[a+1]=new g({owner:e,primitiveType:i._primitiveType})),l.vertexArray=s,l.renderState=e._rsStencilDepthPass,l.shaderProgram=e._sp,l.uniformMap=e._uniformMap,l.pass=b.GROUND,l=t[a+2],o(l)||(l=t[a+2]=new g({owner:e,primitiveType:i._primitiveType})),l.vertexArray=s,l.renderState=e._rsColorPass,l.shaderProgram=e._sp,l.uniformMap=e._uniformMap,l.pass=b.GROUND}}function k(e,t){var i=e._primitive,r=i._pickOffsets,n=3*r.length;t.length=n;for(var a=0,s=0;n>s;s+=3){var l=r[a++],u=l.offset,c=l.count,h=i._va[l.index],d=t[s];o(d)||(d=t[s]=new g({owner:e,primitiveType:i._primitiveType})),d.vertexArray=h,d.offset=u,d.count=c,d.renderState=e._rsStencilPreloadPass,d.shaderProgram=e._sp,d.uniformMap=e._uniformMap,d.pass=b.GROUND,d=t[s+1],o(d)||(d=t[s+1]=new g({owner:e,primitiveType:i._primitiveType})),d.vertexArray=h,d.offset=u,d.count=c,d.renderState=e._rsStencilDepthPass,d.shaderProgram=e._sp,d.uniformMap=e._uniformMap,d.pass=b.GROUND,d=t[s+2],o(d)||(d=t[s+2]=new g({owner:e,primitiveType:i._primitiveType})),d.vertexArray=h,d.offset=u,d.count=c,d.renderState=e._rsPickPass,d.shaderProgram=e._spPick,d.uniformMap=e._uniformMap,d.pass=b.GROUND}}function z(e,t,i,r,n,o,a){V(e,o),k(e,a)}function U(e,t,i,r,n,a,s,l){var u;t.mode===I.SCENE3D?u=e._boundingVolumes:t.mode!==I.SCENE3D&&o(e._boundingVolumes2D)&&(u=e._boundingVolumes2D);var c=t.commandList,h=t.passes;if(h.render)for(var d=i.length,p=0;d>p;++p)i[p].modelMatrix=n,i[p].boundingVolume=u[Math.floor(p/3)],i[p].cull=a,i[p].debugShowBoundingVolume=s,c.push(i[p]);if(h.pick){var m=e._primitive,f=m._pickOffsets,v=3*f.length;r.length=v;for(var g=0,_=0;v>_;_+=3){var y=f[g++],C=u[y.index];r[_].modelMatrix=n,r[_].boundingVolume=C,r[_].cull=a,r[_+1].modelMatrix=n,r[_+1].boundingVolume=C,r[_+1].cull=a,r[_+2].modelMatrix=n,r[_+2].boundingVolume=C,r[_+2].cull=a,c.push(r[_],r[_+1],r[_+2])}}}var G=["color"];a(R.prototype,{vertexCacheOptimize:{get:function(){return this._primitiveOptions.vertexCacheOptimize}},interleave:{get:function(){return this._primitiveOptions.interleave}},releaseGeometryInstances:{get:function(){return this._primitiveOptions.releaseGeometryInstances}},allowPicking:{get:function(){return this._primitiveOptions.allowPicking}},asynchronous:{get:function(){return this._primitiveOptions.asynchronous}},compressVertices:{get:function(){return this._primitiveOptions.compressVertices}},ready:{get:function(){return this._ready}},readyPromise:{get:function(){return this._readyPromise.promise}}}),R.isSupported=function(e){return e.context.fragmentDepth},R._maxHeight=void 0,R._minHeight=void 0,R._minOBBHeight=void 0,R._maxTerrainHeight=9e3,R._minTerrainHeight=-1e5,R._minOBBTerrainHeight=-11500;var W={colorMask:{red:!1,green:!1,blue:!1,alpha:!1},stencilTest:{enabled:!0,frontFunction:M.ALWAYS,frontOperation:{fail:D.KEEP,zFail:D.DECREMENT_WRAP,zPass:D.DECREMENT_WRAP},backFunction:M.ALWAYS,backOperation:{fail:D.KEEP,zFail:D.INCREMENT_WRAP,zPass:D.INCREMENT_WRAP},reference:0,mask:-1},depthTest:{enabled:!1},depthMask:!1},H={colorMask:{red:!1,green:!1,blue:!1,alpha:!1},stencilTest:{enabled:!0,frontFunction:M.ALWAYS,frontOperation:{fail:D.KEEP,zFail:D.KEEP,zPass:D.INCREMENT_WRAP},backFunction:M.ALWAYS,backOperation:{fail:D.KEEP,zFail:D.KEEP,zPass:D.DECREMENT_WRAP},reference:0,mask:-1},depthTest:{enabled:!0,func:x.LESS_OR_EQUAL},depthMask:!1},q={stencilTest:{enabled:!0,frontFunction:M.NOT_EQUAL,frontOperation:{fail:D.KEEP,zFail:D.KEEP,zPass:D.DECREMENT_WRAP},backFunction:M.NOT_EQUAL,backOperation:{fail:D.KEEP,zFail:D.KEEP,zPass:D.DECREMENT_WRAP},reference:0,mask:-1},depthTest:{enabled:!1},depthMask:!1,blending:T.ALPHA_BLEND},j={stencilTest:{enabled:!0,frontFunction:M.NOT_EQUAL,frontOperation:{fail:D.KEEP,zFail:D.KEEP,zPass:D.DECREMENT_WRAP},backFunction:M.NOT_EQUAL,backOperation:{fail:D.KEEP,zFail:D.KEEP,zPass:D.DECREMENT_WRAP},reference:0,mask:-1},depthTest:{enabled:!1},depthMask:!1},Y=new t,X=new t,Z=new t,K=new i,Q=new v;return R.prototype.update=function(e){var t=e.context;if(t.fragmentDepth&&this.show&&(o(this._primitive)||o(this.geometryInstance)||o(this.geometryInstances))){if(!o(R._maxHeight)){var i=e.terrainExaggeration;R._maxHeight=R._maxTerrainHeight*i,R._minHeight=R._minTerrainHeight*i,R._minOBBHeight=R._minOBBTerrainHeight*i}if(!o(this._primitive)){var r,n,a,s=this._primitiveOptions;if(o(this.geometryInstance))r=this.geometryInstance,n=r.geometry,a=n.constructor,o(a)&&o(a.createShadowVolume)&&(r=new c({geometry:a.createShadowVolume(n,N,O),attributes:r.attributes,id:r.id,pickPrimitive:this})),s.geometryInstances=r;else{for(var l=h(this.geometryInstances)?this.geometryInstances:[this.geometryInstances],u=l.length,d=new Array(u),p=0;u>p;++p)if(r=l[p],n=r.geometry,a=n.constructor,o(a)&&o(a.createShadowVolume)){var m=r.attributes;d[p]=new c({geometry:a.createShadowVolume(n,N,O),attributes:m,id:r.id,pickPrimitive:this})}s.geometryInstances=d}var f=this;s._createBoundingVolumeFunction=function(e,t){L(f,e,t)},s._createRenderStatesFunction=function(e,t,i,r){F(f,t)},s._createShaderProgramFunction=function(e,t,i){B(f,t)},s._createCommandsFunction=function(e,t,i,r,n,o,a){z(f,void 0,void 0,!0,!1,o,a)},s._updateAndQueueCommandsFunction=function(e,t,i,r,n,o,a,s){U(f,t,i,r,n,o,a,s)},this._primitive=new P(s),this._primitive.readyPromise.then(function(e){f._ready=!0,f.releaseGeometryInstances&&(f.geometryInstance=void 0,f.geometryInstances=void 0);var t=e._error;o(t)?f._readyPromise.reject(t):f._readyPromise.resolve(f)})}this._primitive.debugShowBoundingVolume=this.debugShowBoundingVolume,this._primitive.update(e); }},R.prototype.getGeometryInstanceAttributes=function(e){return this._primitive.getGeometryInstanceAttributes(e)},R.prototype.isDestroyed=function(){return!1},R.prototype.destroy=function(){return this._primitive=this._primitive&&this._primitive.destroy(),this._sp=this._sp&&this._sp.destroy(),this._spPick=this._spPick&&this._spPick.destroy(),l(this)},R}),i("Scene/MapboxImageryProvider",["../Core/Credit","../Core/defaultValue","../Core/defined","../Core/defineProperties","../Core/DeveloperError","../Core/MapboxApi","./UrlTemplateImageryProvider"],function(e,t,i,r,n,o,a){"use strict";function s(r){r=t(r,t.EMPTY_OBJECT);var n=r.mapId,s=t(r.url,"//api.mapbox.com/v4/");this._url=s,this._mapId=n,this._accessToken=o.getAccessToken(r.accessToken);var h=t(r.format,"png");this._format=h.replace(".","");var d=s;if(l.test(s)||(d+="/"),d+=n+"/{z}/{x}/{y}."+this._format,i(this._accessToken)&&(d+="?access_token="+this._accessToken),i(r.credit)){var p=r.credit;"string"==typeof p&&(p=new e(p)),u=p,c.length=0}this._imageryProvider=new a({url:d,proxy:r.proxy,credit:u,ellipsoid:r.ellipsoid,minimumLevel:r.minimumLevel,maximumLevel:r.maximumLevel,rectangle:r.rectangle})}var l=/\/$/,u=new e("© Mapbox © OpenStreetMap",void 0,"https://www.mapbox.com/about/maps/"),c=[new e("Improve this map",void 0,"https://www.mapbox.com/map-feedback/")];return r(s.prototype,{url:{get:function(){return this._url}},ready:{get:function(){return this._imageryProvider.ready}},readyPromise:{get:function(){return this._imageryProvider.readyPromise}},rectangle:{get:function(){return this._imageryProvider.rectangle}},tileWidth:{get:function(){return this._imageryProvider.tileWidth}},tileHeight:{get:function(){return this._imageryProvider.tileHeight}},maximumLevel:{get:function(){return this._imageryProvider.maximumLevel}},minimumLevel:{get:function(){return this._imageryProvider.minimumLevel}},tilingScheme:{get:function(){return this._imageryProvider.tilingScheme}},tileDiscardPolicy:{get:function(){return this._imageryProvider.tileDiscardPolicy}},errorEvent:{get:function(){return this._imageryProvider.errorEvent}},credit:{get:function(){return this._imageryProvider.credit}},proxy:{get:function(){return this._imageryProvider.proxy}},hasAlphaChannel:{get:function(){return this._imageryProvider.hasAlphaChannel}}}),s.prototype.getTileCredits=function(e,t,i){return c},s.prototype.requestImage=function(e,t,i){return this._imageryProvider.requestImage(e,t,i)},s.prototype.pickFeatures=function(e,t,i,r,n){return this._imageryProvider.pickFeatures(e,t,i,r,n)},s}),i("Scene/Moon",["../Core/buildModuleUrl","../Core/Cartesian3","../Core/defaultValue","../Core/defined","../Core/defineProperties","../Core/destroyObject","../Core/Ellipsoid","../Core/IauOrientationAxes","../Core/Matrix3","../Core/Matrix4","../Core/Simon1994PlanetaryPositions","../Core/Transforms","./EllipsoidPrimitive","./Material"],function(e,t,i,r,n,o,a,s,l,u,c,h,d,p){"use strict";function m(t){t=i(t,i.EMPTY_OBJECT);var n=t.textureUrl;r(n)||(n=e("Assets/Textures/moonSmall.jpg")),this.show=i(t.show,!0),this.textureUrl=n,this._ellipsoid=i(t.ellipsoid,a.MOON),this.onlySunLighting=i(t.onlySunLighting,!0),this._ellipsoidPrimitive=new d({radii:this.ellipsoid.radii,material:p.fromType(p.ImageType),depthTestEnabled:!1,_owner:this}),this._ellipsoidPrimitive.material.translucent=!1,this._axes=new s}n(m.prototype,{ellipsoid:{get:function(){return this._ellipsoid}}});var f=new l,v=new l,g=new t,_=[];return m.prototype.update=function(e){if(this.show){var t=this._ellipsoidPrimitive;t.material.uniforms.image=this.textureUrl,t.onlySunLighting=this.onlySunLighting;var i=e.time;r(h.computeIcrfToFixedMatrix(i,f))||h.computeTemeToPseudoFixedMatrix(i,f);var n=this._axes.evaluate(i,v);l.transpose(n,n),l.multiply(f,n,n);var o=c.computeMoonPositionInEarthInertialFrame(i,g);l.multiplyByVector(f,o,o),u.fromRotationTranslation(n,o,t.modelMatrix);var a=e.commandList;return e.commandList=_,_.length=0,t.update(e),e.commandList=a,1===_.length?_[0]:void 0}},m.prototype.isDestroyed=function(){return!1},m.prototype.destroy=function(){return this._ellipsoidPrimitive=this._ellipsoidPrimitive&&this._ellipsoidPrimitive.destroy(),o(this)},m}),i("Scene/NeverTileDiscardPolicy",[],function(){"use strict";function e(e){}return e.prototype.isReady=function(){return!0},e.prototype.shouldDiscardImage=function(e){return!1},e}),i("Shaders/AdjustTranslucentFS",[],function(){"use strict";return"#ifdef MRT\n#extension GL_EXT_draw_buffers : enable\n#endif\nuniform vec4 u_bgColor;\nuniform sampler2D u_depthTexture;\nvarying vec2 v_textureCoordinates;\nvoid main()\n{\nif (texture2D(u_depthTexture, v_textureCoordinates).r < 1.0)\n{\n#ifdef MRT\ngl_FragData[0] = u_bgColor;\ngl_FragData[1] = vec4(u_bgColor.a);\n#else\ngl_FragColor = u_bgColor;\n#endif\nreturn;\n}\ndiscard;\n}\n"}),i("Shaders/CompositeOITFS",[],function(){"use strict";return"uniform sampler2D u_opaque;\nuniform sampler2D u_accumulation;\nuniform sampler2D u_revealage;\nvarying vec2 v_textureCoordinates;\nvoid main()\n{\nvec4 opaque = texture2D(u_opaque, v_textureCoordinates);\nvec4 accum = texture2D(u_accumulation, v_textureCoordinates);\nfloat r = texture2D(u_revealage, v_textureCoordinates).r;\n#ifdef MRT\nvec4 transparent = vec4(accum.rgb / clamp(r, 1e-4, 5e4), accum.a);\n#else\nvec4 transparent = vec4(accum.rgb / clamp(accum.a, 1e-4, 5e4), r);\n#endif\ngl_FragColor = (1.0 - transparent.a) * transparent + transparent.a * opaque;\n}\n"}),i("Scene/OIT",["../Core/BoundingRectangle","../Core/Color","../Core/defined","../Core/destroyObject","../Core/PixelFormat","../Renderer/ClearCommand","../Renderer/Framebuffer","../Renderer/PixelDatatype","../Renderer/RenderState","../Renderer/ShaderProgram","../Renderer/ShaderSource","../Renderer/Texture","../Renderer/WebGLConstants","../Shaders/AdjustTranslucentFS","../Shaders/CompositeOITFS","./BlendEquation","./BlendFunction"],function(e,t,i,r,n,o,a,s,l,u,c,h,d,p,m,f,v){"use strict";function g(i){this._translucentMultipassSupport=!1,this._translucentMRTSupport=!1;var r=i.floatingPointTexture&&i.depthTexture;this._translucentMRTSupport=i.drawBuffers&&r,this._translucentMultipassSupport=!this._translucentMRTSupport&&r,this._opaqueFBO=void 0,this._opaqueTexture=void 0,this._depthStencilTexture=void 0,this._accumulationTexture=void 0,this._translucentFBO=void 0,this._alphaFBO=void 0,this._adjustTranslucentFBO=void 0,this._adjustAlphaFBO=void 0,this._opaqueClearCommand=new o({color:new t(0,0,0,0),owner:this}),this._translucentMRTClearCommand=new o({color:new t(0,0,0,1),owner:this}),this._translucentMultipassClearCommand=new o({color:new t(0,0,0,0),owner:this}),this._alphaClearCommand=new o({color:new t(1,1,1,1),owner:this}),this._translucentRenderStateCache={},this._alphaRenderStateCache={},this._translucentShaderCache={},this._alphaShaderCache={},this._compositeCommand=void 0,this._adjustTranslucentCommand=void 0,this._adjustAlphaCommand=void 0,this._viewport=new e,this._rs=void 0}function _(e){e._accumulationTexture=e._accumulationTexture&&!e._accumulationTexture.isDestroyed()&&e._accumulationTexture.destroy(),e._revealageTexture=e._revealageTexture&&!e._revealageTexture.isDestroyed()&&e._revealageTexture.destroy()}function y(e){e._translucentFBO=e._translucentFBO&&!e._translucentFBO.isDestroyed()&&e._translucentFBO.destroy(),e._alphaFBO=e._alphaFBO&&!e._alphaFBO.isDestroyed()&&e._alphaFBO.destroy(),e._adjustTranslucentFBO=e._adjustTranslucentFBO&&!e._adjustTranslucentFBO.isDestroyed()&&e._adjustTranslucentFBO.destroy(),e._adjustAlphaFBO=e._adjustAlphaFBO&&!e._adjustAlphaFBO.isDestroyed()&&e._adjustAlphaFBO.destroy()}function C(e){_(e),y(e)}function E(e,t,i,r){_(e),e._accumulationTexture=new h({context:t,width:i,height:r,pixelFormat:n.RGBA,pixelDatatype:s.FLOAT}),e._revealageTexture=new h({context:t,width:i,height:r,pixelFormat:n.RGBA,pixelDatatype:s.FLOAT})}function S(e,t){y(e);var i=d.FRAMEBUFFER_COMPLETE,r=!0;if(e._translucentMRTSupport&&(e._translucentFBO=new a({context:t,colorTextures:[e._accumulationTexture,e._revealageTexture],depthStencilTexture:e._depthStencilTexture,destroyAttachments:!1}),e._adjustTranslucentFBO=new a({context:t,colorTextures:[e._accumulationTexture,e._revealageTexture],destroyAttachments:!1}),(e._translucentFBO.status!==i||e._adjustTranslucentFBO.status!==i)&&(y(e),e._translucentMRTSupport=!1)),!e._translucentMRTSupport){e._translucentFBO=new a({context:t,colorTextures:[e._accumulationTexture],depthStencilTexture:e._depthStencilTexture,destroyAttachments:!1}),e._alphaFBO=new a({context:t,colorTextures:[e._revealageTexture],depthStencilTexture:e._depthStencilTexture,destroyAttachments:!1}),e._adjustTranslucentFBO=new a({context:t,colorTextures:[e._accumulationTexture],destroyAttachments:!1}),e._adjustAlphaFBO=new a({context:t,colorTextures:[e._revealageTexture],destroyAttachments:!1});var n=e._translucentFBO.status===i,o=e._alphaFBO.status===i,s=e._adjustTranslucentFBO.status===i,l=e._adjustAlphaFBO.status===i;n&&o&&s&&l||(C(e),e._translucentMultipassSupport=!1,r=!1)}return r}function w(e,t,r,n){var o=r[n.id];if(!i(o)){var a=l.getState(n);a.depthMask=!1,a.blending=t,o=l.fromCache(a),r[n.id]=o}return o}function T(e,t,i){return w(t,O,e._translucentRenderStateCache,i)}function x(e,t,i){return w(t,N,e._translucentRenderStateCache,i)}function b(e,t,i){return w(t,L,e._alphaRenderStateCache,i)}function A(e,t,r,n){var o=t.id,a=r[o];if(!i(a)){var s=t._attributeLocations,l=t.fragmentShaderSource.clone();l.sources=l.sources.map(function(e){return e=c.replaceMain(e,"czm_translucent_main"),e=e.replace(/gl_FragColor/g,"czm_gl_FragColor"),e=e.replace(/\bdiscard\b/g,"czm_discard = true"),e=e.replace(/czm_phong/g,"czm_translucentPhong")}),l.sources.splice(0,0,(-1!==n.indexOf("gl_FragData")?"#extension GL_EXT_draw_buffers : enable \n":"")+"vec4 czm_gl_FragColor;\nbool czm_discard = false;\n"),l.sources.push("void main()\n{\n czm_translucent_main();\n if (czm_discard)\n {\n discard;\n }\n"+n+"}\n"),a=u.fromCache({context:e,vertexShaderSource:t.vertexShaderSource,fragmentShaderSource:l,attributeLocations:s}),r[o]=a}return a}function P(e,t,i){return A(t,i,e._translucentShaderCache,F)}function I(e,t,i){return A(t,i,e._translucentShaderCache,B)}function M(e,t,i){return A(t,i,e._alphaShaderCache,V)}function D(e,t,r,n,o){var a,s,l,u,c=t.context,h=n.framebuffer,d=o.length;n.framebuffer=e._adjustTranslucentFBO,e._adjustTranslucentCommand.execute(c,n),n.framebuffer=e._adjustAlphaFBO,e._adjustAlphaCommand.execute(c,n);var p=e._opaqueFBO;for(n.framebuffer=e._translucentFBO,u=0;d>u;++u)a=o[u],i(a.oit)&&a.shaderProgram.id===a.oit.shaderProgramId||(a.oit={colorRenderState:x(e,c,a.renderState),alphaRenderState:b(e,c,a.renderState),colorShaderProgram:I(e,c,a.shaderProgram),alphaShaderProgram:M(e,c,a.shaderProgram),shaderProgramId:a.shaderProgram.id}),s=a.oit.colorRenderState,l=a.oit.colorShaderProgram,r(a,t,c,n,s,l,p);for(n.framebuffer=e._alphaFBO,u=0;d>u;++u)a=o[u],s=a.oit.alphaRenderState,l=a.oit.alphaShaderProgram,r(a,t,c,n,s,l,p);n.framebuffer=h}function R(e,t,r,n,o){var a=t.context,s=n.framebuffer,l=o.length;n.framebuffer=e._adjustTranslucentFBO,e._adjustTranslucentCommand.execute(a,n);var u=e._opaqueFBO;n.framebuffer=e._translucentFBO;for(var c=0;l>c;++c){var h=o[c];i(h.oit)&&h.shaderProgram.id===h.oit.shaderProgramId||(h.oit={translucentRenderState:T(e,a,h.renderState),translucentShaderProgram:P(e,a,h.shaderProgram),shaderProgramId:h.shaderProgram.id});var d=h.oit.translucentRenderState,p=h.oit.translucentShaderProgram;r(h,t,a,n,d,p,u)}n.framebuffer=s}g.prototype.update=function(t,r){if(this.isSupported()){this._opaqueFBO=r,this._opaqueTexture=r.getColorTexture(0),this._depthStencilTexture=r.depthStencilTexture;var n=this._opaqueTexture.width,o=this._opaqueTexture.height,a=this._accumulationTexture,s=!i(a)||a.width!==n||a.height!==o;if(s&&E(this,t,n,o),i(this._translucentFBO)&&!s||S(this,t)){var u,h,d=this;i(this._compositeCommand)||(u=new c({sources:[m]}),this._translucentMRTSupport&&u.defines.push("MRT"),h={u_opaque:function(){return d._opaqueTexture},u_accumulation:function(){return d._accumulationTexture},u_revealage:function(){return d._revealageTexture}},this._compositeCommand=t.createViewportQuadCommand(u,{uniformMap:h,owner:this})),i(this._adjustTranslucentCommand)||(this._translucentMRTSupport?(u=new c({defines:["MRT"],sources:[p]}),h={u_bgColor:function(){return d._translucentMRTClearCommand.color},u_depthTexture:function(){return d._depthStencilTexture}},this._adjustTranslucentCommand=t.createViewportQuadCommand(u,{uniformMap:h,owner:this})):this._translucentMultipassSupport&&(u=new c({sources:[p]}),h={u_bgColor:function(){return d._translucentMultipassClearCommand.color},u_depthTexture:function(){return d._depthStencilTexture}},this._adjustTranslucentCommand=t.createViewportQuadCommand(u,{uniformMap:h,owner:this}),h={u_bgColor:function(){return d._alphaClearCommand.color},u_depthTexture:function(){return d._depthStencilTexture}},this._adjustAlphaCommand=t.createViewportQuadCommand(u,{uniformMap:h,owner:this}))),this._viewport.width=n,this._viewport.height=o,i(this._rs)&&e.equals(this._viewport,this._rs.viewport)||(this._rs=l.fromCache({viewport:this._viewport})),i(this._compositeCommand)&&(this._compositeCommand.renderState=this._rs),this._adjustTranslucentCommand&&(this._adjustTranslucentCommand.renderstate=this._rs),i(this._adjustAlphaCommand)&&(this._adjustAlphaCommand.renderState=this._rs)}}};var O={enabled:!0,color:new t(0,0,0,0),equationRgb:f.ADD,equationAlpha:f.ADD,functionSourceRgb:v.ONE,functionDestinationRgb:v.ONE,functionSourceAlpha:v.ZERO,functionDestinationAlpha:v.ONE_MINUS_SOURCE_ALPHA},N={enabled:!0,color:new t(0,0,0,0),equationRgb:f.ADD,equationAlpha:f.ADD,functionSourceRgb:v.ONE,functionDestinationRgb:v.ONE,functionSourceAlpha:v.ONE,functionDestinationAlpha:v.ONE},L={enabled:!0,color:new t(0,0,0,0),equationRgb:f.ADD,equationAlpha:f.ADD,functionSourceRgb:v.ZERO,functionDestinationRgb:v.ONE_MINUS_SOURCE_ALPHA,functionSourceAlpha:v.ZERO,functionDestinationAlpha:v.ONE_MINUS_SOURCE_ALPHA},F=" vec3 Ci = czm_gl_FragColor.rgb * czm_gl_FragColor.a;\n float ai = czm_gl_FragColor.a;\n float wzi = czm_alphaWeight(ai);\n gl_FragData[0] = vec4(Ci * wzi, ai);\n gl_FragData[1] = vec4(ai * wzi);\n",B=" vec3 Ci = czm_gl_FragColor.rgb * czm_gl_FragColor.a;\n float ai = czm_gl_FragColor.a;\n float wzi = czm_alphaWeight(ai);\n gl_FragColor = vec4(Ci, ai) * wzi;\n",V=" float ai = czm_gl_FragColor.a;\n gl_FragColor = vec4(ai);\n";return g.prototype.executeCommands=function(e,t,i,r){return this._translucentMRTSupport?void R(this,e,t,i,r):void D(this,e,t,i,r)},g.prototype.execute=function(e,t){this._compositeCommand.execute(e,t)},g.prototype.clear=function(e,i,r){var n=i.framebuffer;i.framebuffer=this._opaqueFBO,t.clone(r,this._opaqueClearCommand.color),this._opaqueClearCommand.execute(e,i),i.framebuffer=this._translucentFBO;var o=this._translucentMRTSupport?this._translucentMRTClearCommand:this._translucentMultipassClearCommand;o.execute(e,i),this._translucentMultipassSupport&&(i.framebuffer=this._alphaFBO,this._alphaClearCommand.execute(e,i)),i.framebuffer=n},g.prototype.isSupported=function(){return this._translucentMRTSupport||this._translucentMultipassSupport},g.prototype.isDestroyed=function(){return!1},g.prototype.destroy=function(){C(this),i(this._compositeCommand)&&(this._compositeCommand.shaderProgram=this._compositeCommand.shaderProgram&&this._compositeCommand.shaderProgram.destroy()),i(this._adjustTranslucentCommand)&&(this._adjustTranslucentCommand.shaderProgram=this._adjustTranslucentCommand.shaderProgram&&this._adjustTranslucentCommand.shaderProgram.destroy()),i(this._adjustAlphaCommand)&&(this._adjustAlphaCommand.shaderProgram=this._adjustAlphaCommand.shaderProgram&&this._adjustAlphaCommand.shaderProgram.destroy());var e,t=this._translucentShaderCache;for(e in t)t.hasOwnProperty(e)&&i(t[e])&&t[e].destroy();this._translucentShaderCache={},t=this._alphaShaderCache;for(e in t)t.hasOwnProperty(e)&&i(t[e])&&t[e].destroy();return this._alphaShaderCache={},r(this)},g}),i("Scene/OpenStreetMapImageryProvider",["../Core/Credit","../Core/defaultValue","../Core/defined","../Core/defineProperties","../Core/deprecationWarning","../Core/DeveloperError","../Core/Event","../Core/Rectangle","../Core/WebMercatorTilingScheme","../ThirdParty/when","./ImageryProvider"],function(e,t,i,r,n,o,a,s,l,u,c){"use strict";function h(i){n("OpenStreetMapImageryProvider","OpenStreetMapImageryProvider is deprecated. It will be removed in Cesium 1.18. Use createOpenStreetMapImageryProvider instead."),i=t(i,{});var r=t(i.url,"//a.tile.openstreetmap.org/");p.test(r)||(r+="/"),this._url=r,this._fileExtension=t(i.fileExtension,"png"),this._proxy=i.proxy,this._tileDiscardPolicy=i.tileDiscardPolicy,this._tilingScheme=new l({ellipsoid:i.ellipsoid}),this._tileWidth=256,this._tileHeight=256,this._minimumLevel=t(i.minimumLevel,0),this._maximumLevel=i.maximumLevel,this._rectangle=t(i.rectangle,this._tilingScheme.rectangle);var c=this._tilingScheme.positionToTileXY(s.southwest(this._rectangle),this._minimumLevel),h=this._tilingScheme.positionToTileXY(s.northeast(this._rectangle),this._minimumLevel),d=(Math.abs(h.x-c.x)+1)*(Math.abs(h.y-c.y)+1);if(d>4)throw new o("The imagery provider's rectangle and minimumLevel indicate that there are "+d+" tiles at the minimum level. Imagery providers with more than four tiles at the minimum level are not supported.");this._errorEvent=new a,this._ready=!0,this._readyPromise=u.resolve(!0);var f=t(i.credit,m);"string"==typeof f&&(f=new e(f)),this._credit=f}function d(e,t,r,n){var o=e._url+n+"/"+t+"/"+r+"."+e._fileExtension,a=e._proxy;return i(a)&&(o=a.getURL(o)),o}var p=/\/$/,m=new e("MapQuest, Open Street Map and contributors, CC-BY-SA");return r(h.prototype,{url:{get:function(){return this._url}},proxy:{get:function(){return this._proxy}},tileWidth:{get:function(){return this._tileWidth}},tileHeight:{get:function(){return this._tileHeight}},maximumLevel:{get:function(){return this._maximumLevel}},minimumLevel:{get:function(){return this._minimumLevel}},tilingScheme:{get:function(){return this._tilingScheme}},rectangle:{get:function(){return this._rectangle}},tileDiscardPolicy:{get:function(){return this._tileDiscardPolicy}},errorEvent:{get:function(){return this._errorEvent}},ready:{get:function(){return this._ready}},readyPromise:{get:function(){return this._readyPromise}},credit:{get:function(){return this._credit}},hasAlphaChannel:{get:function(){return!0}}}),h.prototype.getTileCredits=function(e,t,i){},h.prototype.requestImage=function(e,t,i){var r=d(this,e,t,i);return c.loadImage(this,r)},h.prototype.pickFeatures=function(){},h}),i("Scene/OrthographicFrustum",["../Core/Cartesian2","../Core/Cartesian3","../Core/Cartesian4","../Core/defined","../Core/defineProperties","../Core/DeveloperError","../Core/Matrix4","./CullingVolume"],function(e,t,i,r,n,o,a,s){"use strict";function l(){this.left=void 0,this._left=void 0,this.right=void 0,this._right=void 0,this.top=void 0,this._top=void 0,this.bottom=void 0,this._bottom=void 0,this.near=1,this._near=this.near,this.far=5e8,this._far=this.far,this._cullingVolume=new s,this._orthographicMatrix=new a}function u(e){(e.top!==e._top||e.bottom!==e._bottom||e.left!==e._left||e.right!==e._right||e.near!==e._near||e.far!==e._far)&&(e._left=e.left,e._right=e.right,e._top=e.top,e._bottom=e.bottom,e._near=e.near,e._far=e.far,e._orthographicMatrix=a.computeOrthographicOffCenter(e.left,e.right,e.bottom,e.top,e.near,e.far,e._orthographicMatrix))}n(l.prototype,{projectionMatrix:{get:function(){return u(this),this._orthographicMatrix}}});var c=new t,h=new t,d=new t,p=new t;return l.prototype.computeCullingVolume=function(e,n,o){var a=this._cullingVolume.planes,s=this.top,l=this.bottom,u=this.right,m=this.left,f=this.near,v=this.far,g=t.cross(n,o,c),_=h;t.multiplyByScalar(n,f,_),t.add(e,_,_);var y=d;t.multiplyByScalar(g,m,y),t.add(_,y,y);var C=a[0];return r(C)||(C=a[0]=new i),C.x=g.x,C.y=g.y,C.z=g.z,C.w=-t.dot(g,y),t.multiplyByScalar(g,u,y),t.add(_,y,y),C=a[1],r(C)||(C=a[1]=new i),C.x=-g.x,C.y=-g.y,C.z=-g.z,C.w=-t.dot(t.negate(g,p),y),t.multiplyByScalar(o,l,y),t.add(_,y,y),C=a[2],r(C)||(C=a[2]=new i),C.x=o.x,C.y=o.y,C.z=o.z,C.w=-t.dot(o,y),t.multiplyByScalar(o,s,y),t.add(_,y,y),C=a[3],r(C)||(C=a[3]=new i),C.x=-o.x,C.y=-o.y,C.z=-o.z,C.w=-t.dot(t.negate(o,p),y),C=a[4],r(C)||(C=a[4]=new i),C.x=n.x,C.y=n.y,C.z=n.z,C.w=-t.dot(n,_),t.multiplyByScalar(n,v,y),t.add(e,y,y),C=a[5],r(C)||(C=a[5]=new i),C.x=-n.x,C.y=-n.y,C.z=-n.z,C.w=-t.dot(t.negate(n,p),y),this._cullingVolume},l.prototype.getPixelDimensions=function(e,t,i,r){u(this);var n=this.right-this.left,o=this.top-this.bottom,a=n/e,s=o/t;return r.x=a,r.y=s,r},l.prototype.clone=function(e){return r(e)||(e=new l),e.left=this.left,e.right=this.right,e.top=this.top,e.bottom=this.bottom,e.near=this.near,e.far=this.far,e._left=void 0,e._right=void 0,e._top=void 0,e._bottom=void 0,e._near=void 0,e._far=void 0,e},l.prototype.equals=function(e){return r(e)&&this.right===e.right&&this.left===e.left&&this.top===e.top&&this.bottom===e.bottom&&this.near===e.near&&this.far===e.far},l}),i("Widgets/getElement",["../Core/DeveloperError"],function(e){"use strict";function t(e){if("string"==typeof e){var t=document.getElementById(e);e=t}return e}return t}),i("Scene/PerformanceDisplay",["../Core/Color","../Core/defaultValue","../Core/defined","../Core/destroyObject","../Core/DeveloperError","../Core/getTimestamp","../Widgets/getElement"],function(e,t,i,r,n,o,a){"use strict";function s(e){e=t(e,t.EMPTY_OBJECT);var r=a(e.container);if(!i(r))throw new n("container is required");this._container=r;var o=document.createElement("div");o.className="cesium-performanceDisplay";var s=document.createElement("div");s.className="cesium-performanceDisplay-fps",this._fpsText=document.createTextNode(""),s.appendChild(this._fpsText);var l=document.createElement("div");l.className="cesium-performanceDisplay-ms",this._msText=document.createTextNode(""),l.appendChild(this._msText),o.appendChild(l),o.appendChild(s),this._container.appendChild(o),this._lastFpsSampleTime=void 0,this._frameCount=0,this._time=void 0,this._fps=0,this._frameTime=0}return s.prototype.update=function(){if(!i(this._time))return this._lastFpsSampleTime=o(),void(this._time=o());var e=this._time,t=o();this._time=t;var r=t-e;this._frameCount++;var n=this._fps,a=t-this._lastFpsSampleTime;a>1e3&&(n=1e3*this._frameCount/a|0,this._lastFpsSampleTime=t,this._frameCount=0),n!==this._fps&&(this._fpsText.nodeValue=n+" FPS",this._fps=n),r!==this._frameTime&&(this._msText.nodeValue=r.toFixed(2)+" MS",this._frameTime=r)},s.prototype.destroy=function(){return r(this)},s}),i("Scene/PickDepth",["../Core/defined","../Core/defineProperties","../Core/destroyObject","../Core/PixelFormat","../Renderer/Framebuffer","../Renderer/PixelDatatype","../Renderer/RenderState","../Renderer/Texture","../Shaders/PostProcessFilters/PassThrough"],function(e,t,i,r,n,o,a,s,l){"use strict";function u(){this.framebuffer=void 0,this._depthTexture=void 0,this._textureToCopy=void 0,this._copyDepthCommand=void 0,this._debugPickDepthViewportCommand=void 0}function c(t,i,r){if(!e(t._debugPickDepthViewportCommand)){var n="uniform sampler2D u_texture;\nvarying vec2 v_textureCoordinates;\nvoid main()\n{\n float z_window = czm_unpackDepth(texture2D(u_texture, v_textureCoordinates));\n float n_range = czm_depthRange.near;\n float f_range = czm_depthRange.far;\n float z_ndc = (2.0 * z_window - n_range - f_range) / (f_range - n_range);\n float scale = pow(z_ndc * 0.5 + 0.5, 8.0);\n gl_FragColor = vec4(mix(vec3(0.0), vec3(1.0), scale), 1.0);\n}\n";t._debugPickDepthViewportCommand=i.createViewportQuadCommand(n,{uniformMap:{u_texture:function(){return t._depthTexture}},owner:t})}t._debugPickDepthViewportCommand.execute(i,r)}function h(e){e._depthTexture=e._depthTexture&&!e._depthTexture.isDestroyed()&&e._depthTexture.destroy()}function d(e){e.framebuffer=e.framebuffer&&!e.framebuffer.isDestroyed()&&e.framebuffer.destroy()}function p(e,t,i,n){e._depthTexture=new s({context:t,width:i,height:n,pixelFormat:r.RGBA,pixelDatatype:o.UNSIGNED_BYTE})}function m(e,t,i,r){h(e),d(e),p(e,t,i,r),e.framebuffer=new n({context:t,colorTextures:[e._depthTexture],destroyAttachments:!1})}function f(t,i,r){var n=r.width,o=r.height,a=t._depthTexture,s=!e(a)||a.width!==n||a.height!==o;(!e(t.framebuffer)||s)&&m(t,i,n,o)}function v(t,i,r){if(!e(t._copyDepthCommand)){var n="uniform sampler2D u_texture;\nvarying vec2 v_textureCoordinates;\nvoid main()\n{\n gl_FragColor = czm_packDepth(texture2D(u_texture, v_textureCoordinates).r);\n}\n";t._copyDepthCommand=i.createViewportQuadCommand(n,{renderState:a.fromCache(),uniformMap:{u_texture:function(){return t._textureToCopy}},owner:t})}t._textureToCopy=r,t._copyDepthCommand.framebuffer=t.framebuffer}return u.prototype.executeDebugPickDepth=function(e,t){c(this,e,t)},u.prototype.update=function(e,t){f(this,e,t),v(this,e,t)},u.prototype.executeCopyDepth=function(e,t){this._copyDepthCommand.execute(e,t)},u.prototype.isDestroyed=function(){return!1},u.prototype.destroy=function(){return h(this),d(this),this._copyDepthCommand.shaderProgram=e(this._copyDepthCommand.shaderProgram)&&this._copyDepthCommand.shaderProgram.destroy(),i(this)},u}),i("Shaders/Appearances/PointAppearanceFS",[],function(){"use strict";return"uniform vec4 highlightColor;\nvarying vec3 v_color;\nvoid main()\n{\ngl_FragColor = vec4(v_color * highlightColor.rgb, highlightColor.a);\n}\n"}),i("Shaders/Appearances/PointAppearanceVS",[],function(){"use strict";return"attribute vec3 position3DHigh;\nattribute vec3 position3DLow;\nattribute vec3 color;\nuniform float pointSize;\nvarying vec3 v_positionEC;\nvarying vec3 v_color;\nvoid main()\n{\nv_color = color;\ngl_Position = czm_modelViewProjectionRelativeToEye * czm_computePosition();\ngl_PointSize = pointSize;\n}\n"}),i("Scene/PointAppearance",["../Core/clone","../Core/Color","../Core/combine","../Core/defaultValue","../Core/defined","../Core/defineProperties","../Core/VertexFormat","../Shaders/Appearances/PointAppearanceFS","../Shaders/Appearances/PointAppearanceVS","./Appearance"],function(e,t,i,r,n,o,a,s,l,u){"use strict";function c(e){e=r(e,r.EMPTY_OBJECT),this._vertexShaderSource=r(e.vertexShaderSource,l),this._fragmentShaderSource=r(e.fragmentShaderSource,s),this._renderState=u.getDefaultRenderState(!1,!1,e.renderState),this._pointSize=r(e.pointSize,2),this._highlightColor=n(e.highlightColor)?e.highlightColor:new t,this.material=void 0,this.translucent=r(e.translucent,!1),this.uniforms={highlightColor:this._highlightColor,pointSize:this._pointSize};var o=e.uniforms;this.uniforms=i(this.uniforms,o,!0)}return o(c.prototype,{vertexShaderSource:{get:function(){return this._vertexShaderSource}},fragmentShaderSource:{get:function(){return this._fragmentShaderSource}},renderState:{get:function(){return this._renderState}},closed:{get:function(){return!1}},vertexFormat:{get:function(){return c.VERTEX_FORMAT}},pixelSize:{get:function(){return this._pointSize}}}),c.VERTEX_FORMAT=a.POSITION_AND_COLOR,c.prototype.getFragmentShaderSource=u.prototype.getFragmentShaderSource,c.prototype.isTranslucent=u.prototype.isTranslucent,c.prototype.getRenderState=u.prototype.getRenderState,c}),i("Scene/PrimitiveCollection",["../Core/createGuid","../Core/defaultValue","../Core/defined","../Core/defineProperties","../Core/destroyObject","../Core/DeveloperError"],function(e,t,i,r,n,o){"use strict";function a(i){i=t(i,t.EMPTY_OBJECT),this._primitives=[],this._guid=e(),this.show=t(i.show,!0),this.destroyPrimitives=t(i.destroyPrimitives,!0)}function s(e,t){return e._primitives.indexOf(t)}return r(a.prototype,{length:{get:function(){return this._primitives.length}}}),a.prototype.add=function(e){var t=e._external=e._external||{},i=t._composites=t._composites||{};return i[this._guid]={collection:this},this._primitives.push(e),e},a.prototype.remove=function(e){if(this.contains(e)){var t=this._primitives.indexOf(e);if(-1!==t)return this._primitives.splice(t,1),delete e._external._composites[this._guid],this.destroyPrimitives&&e.destroy(),!0}return!1},a.prototype.removeAndDestroy=function(e){var t=this.remove(e);return t&&!this.destroyPrimitives&&e.destroy(),t},a.prototype.removeAll=function(){if(this.destroyPrimitives)for(var e=this._primitives,t=e.length,i=0;t>i;++i)e[i].destroy();this._primitives=[]},a.prototype.contains=function(e){return!!(i(e)&&e._external&&e._external._composites&&e._external._composites[this._guid])},a.prototype.raise=function(e){if(i(e)){var t=s(this,e),r=this._primitives;if(t!==r.length-1){var n=r[t];r[t]=r[t+1],r[t+1]=n}}},a.prototype.raiseToTop=function(e){if(i(e)){var t=s(this,e),r=this._primitives;t!==r.length-1&&(r.splice(t,1),r.push(e))}},a.prototype.lower=function(e){if(i(e)){var t=s(this,e),r=this._primitives;if(0!==t){var n=r[t];r[t]=r[t-1],r[t-1]=n}}},a.prototype.lowerToBottom=function(e){if(i(e)){var t=s(this,e),r=this._primitives;0!==t&&(r.splice(t,1),r.unshift(e))}},a.prototype.get=function(e){return this._primitives[e]},a.prototype.update=function(e){if(this.show)for(var t=this._primitives,i=0;i<t.length;++i)t[i].update(e)},a.prototype.isDestroyed=function(){return!1},a.prototype.destroy=function(){return this.removeAll(),n(this)},a}),i("Scene/QuadtreeTileProvider",["../Core/defineProperties","../Core/DeveloperError"],function(e,t){"use strict";function i(){t.throwInstantiationError()}return i.computeDefaultLevelZeroMaximumGeometricError=function(e){return 2*e.ellipsoid.maximumRadius*Math.PI*.25/(65*e.getNumberOfXTilesAtLevel(0))},e(i.prototype,{quadtree:{get:t.throwInstantiationError,set:t.throwInstantiationError},ready:{get:t.throwInstantiationError},tilingScheme:{get:t.throwInstantiationError},errorEvent:{get:t.throwInstantiationError}}),i.prototype.beginUpdate=t.throwInstantiationError,i.prototype.endUpdate=t.throwInstantiationError,i.prototype.getLevelMaximumGeometricError=t.throwInstantiationError,i.prototype.loadTile=t.throwInstantiationError,i.prototype.computeTileVisibility=t.throwInstantiationError,i.prototype.showTileThisFrame=t.throwInstantiationError,i.prototype.computeDistanceToTile=t.throwInstantiationError,i.prototype.isDestroyed=t.throwInstantiationError,i.prototype.destroy=t.throwInstantiationError,i}),i("Scene/SceneTransitioner",["../Core/Cartesian3","../Core/defaultValue","../Core/defined","../Core/destroyObject","../Core/DeveloperError","../Core/EasingFunction","../Core/Ellipsoid","../Core/Math","../Core/Matrix4","../Core/ScreenSpaceEventHandler","../Core/ScreenSpaceEventType","./Camera","./OrthographicFrustum","./PerspectiveFrustum","./SceneMode"],function(e,t,i,r,n,o,a,s,l,u,c,h,d,p,m){"use strict";function f(i,r){this._scene=i,r=t(r,a.WGS84);var n=r.maximumRadius,o=new e(0,0,2*n),u=new e;u=e.normalize(e.negate(o,u),u);var c=e.clone(e.UNIT_Y),m=l.multiplyByPoint(h.TRANSFORM_2D,o,new e),f=l.multiplyByPointAsVector(h.TRANSFORM_2D,u,new e),v=l.multiplyByPointAsVector(h.TRANSFORM_2D,c,new e),g=new d;g.right=n*Math.PI,g.left=-g.right,g.top=g.right*(i.drawingBufferHeight/i.drawingBufferWidth),g.bottom=-g.top,this._camera2D={position:o,direction:u,up:c,position2D:m,direction2D:f,up2D:v,frustum:g},o=new e(0,-1,1),o=e.multiplyByScalar(e.normalize(o,o),5*n,o),u=new e,u=e.normalize(e.subtract(e.ZERO,o,u),u);var _=new e;_=e.normalize(e.cross(u,e.UNIT_Z,_),_),c=new e,c=e.normalize(e.cross(_,u,c),c),m=l.multiplyByPoint(h.TRANSFORM_2D,o,new e),f=l.multiplyByPointAsVector(h.TRANSFORM_2D,u,new e);var y=l.multiplyByPointAsVector(h.TRANSFORM_2D,_,new e);v=new e,v=e.normalize(e.cross(y,f,v),v),g=new p,g.aspectRatio=i.drawingBufferWidth/i.drawingBufferHeight,g.fov=s.toRadians(60),this._cameraCV={position:o,direction:u,up:c,position2D:m,direction2D:f,up2D:v,frustum:g},o=new e,o=e.multiplyByScalar(e.normalize(new e(0,-2,1),o),2*n,o),u=new e,u=e.normalize(e.subtract(e.ZERO,o,u),u),_=new e,_=e.normalize(e.cross(u,e.UNIT_Z,_),_),c=new e,c=e.normalize(e.cross(_,u,c),c),this._camera3D={ position:o,direction:u,up:c,frustum:g},this._currentTweens=[],this._morphHandler=void 0,this._morphCancelled=!1,this._completeMorph=void 0}function v(e,t){if(e._scene.completeMorphOnUserInput){e._morphHandler=new u(e._scene.canvas,!1);var i=function(){e._morphCancelled=!0,t(e)};e._completeMorph=i,e._morphHandler.setInputAction(i,c.LEFT_DOWN),e._morphHandler.setInputAction(i,c.MIDDLE_DOWN),e._morphHandler.setInputAction(i,c.RIGHT_DOWN),e._morphHandler.setInputAction(i,c.WHEEL)}}function g(e){for(var t=e._currentTweens,i=0;i<t.length;++i)t[i].cancelTween();e._currentTweens.length=0,e._morphHandler=e._morphHandler&&e._morphHandler.destroy()}function _(t,i,r,n){function a(t){u.position=C(c,p,t.time),u.direction=C(h,m,t.time),u.up=C(d,f,t.time),u.right=e.cross(u.direction,u.up,u.right),e.normalize(u.right,u.right)}var s=t._scene,u=s.camera;u._setTransform(l.IDENTITY);var c=u.position,h=u.direction,d=u.up,p=e.clone(t._camera2D.position),m=e.clone(t._camera2D.direction),f=e.clone(t._camera2D.up),v=s.tweens.add({duration:i,easingFunction:o.QUARTIC_OUT,startObject:{time:0},stopObject:{time:1},update:a});t._currentTweens.push(v),A(t,s,0,1,i,n)}function y(e,t,i,r){t*=.5;var n=e._scene.camera;n._setTransform(l.IDENTITY),T(e,t,i,function(){n.frustum=e._cameraCV.frustum.clone(),_(e,t,i,r)})}function C(t,i,r){return e.lerp(t,i,r,new e)}function E(t,i,r){function n(t){l.frustum.fov=s.lerp(c,h,t.time);var i=d/Math.tan(.5*l.frustum.fov),r=new e;l.position=e.multiplyByScalar(e.normalize(l.position,r),i,r)}var a=t._scene,l=a.camera,u=l.position,c=l.frustum.fov,h=.5*s.RADIANS_PER_DEGREE,d=e.magnitude(u)*Math.tan(.5*c);l.frustum.far=d/Math.tan(.5*h)+1e7;var p=a.tweens.add({duration:i,easingFunction:o.QUARTIC_OUT,startObject:{time:0},stopObject:{time:1},update:n,complete:function(){l.frustum=t._camera2D.frustum.clone(),r(t)}});t._currentTweens.push(p)}function S(t,i,r,n){function a(t){u.position=C(h,g,t.time),u.direction=C(d,_,t.time),u.up=C(p,y,t.time),u.right=e.cross(u.direction,u.up,u.right),e.normalize(u.right,u.right)}var s=t._scene,u=s.camera;u._setTransform(l.IDENTITY);var c=r.maximumRadius,h=e.clone(u.position),d=e.clone(u.direction),p=e.clone(u.up),m=Math.tan(.5*t._cameraCV.frustum.fovy),f=t._cameraCV.frustum.aspectRatio*m,v=c*Math.PI/f,g=new e;g=e.multiplyByScalar(e.normalize(t._camera2D.position,g),v,g);var _=e.clone(t._camera2D.direction),y=e.clone(t._camera2D.up);i*=.5;var S=s.tweens.add({duration:i,easingFunction:o.QUARTIC_OUT,startObject:{time:0},stopObject:{time:1},update:a,complete:function(){E(t,i,n)}});t._currentTweens.push(S)}function w(t,i,r,n){function o(){E(t,i,n)}i*=.5;var a=r.maximumRadius,s=Math.tan(.5*t._camera3D.frustum.fovy),l=t._camera3D.frustum.aspectRatio*s,u=a*Math.PI/l,c={},h=new e;c.position2D=e.multiplyByScalar(e.normalize(t._camera2D.position2D,h),u,h),c.direction2D=e.clone(t._camera2D.direction2D),c.up2D=e.clone(t._camera2D.up2D),b(t,i,c,o)}function T(t,i,r,n){function a(e){u.position=C(S,m,e.time),u.frustum.top=s.lerp(f,y.top,e.time),u.frustum.bottom=s.lerp(v,y.bottom,e.time),u.frustum.right=s.lerp(g,y.right,e.time),u.frustum.left=s.lerp(_,y.left,e.time)}var l=t._scene,u=l.camera,c=r.maximumRadius,h=Math.tan(.5*t._cameraCV.frustum.fovy),d=t._cameraCV.frustum.aspectRatio*h,p=c*Math.PI/d,m=new e;m=e.multiplyByScalar(e.normalize(t._camera2D.position,m),p,m);var f=u.frustum.top,v=u.frustum.bottom,g=u.frustum.right,_=u.frustum.left,y=t._camera2D.frustum,E=t._cameraCV.frustum,S=e.clone(u.position),w=(g-_)/(2*c*Math.PI),T=1;w>T&&(w=0);var x=(T-w)*i;if(x<s.EPSILON6){if(e.equalsEpsilon(S,m,s.EPSILON6))return u.position=m,u.frustum=E.clone(),void n(t);x=i,w=0,T=1}var b=l.tweens.add({easingFunction:o.QUARTIC_OUT,duration:x,startObject:{time:w},stopObject:{time:T},update:a,complete:function(){u.frustum=E.clone(),n(t)}});t._currentTweens.push(b)}function x(t,i,r,n){function a(){function r(t){u.position=C(a,h,t.time),u.direction=C(l,d,t.time),u.up=C(c,p,t.time),u.right=e.cross(u.direction,u.up,u.right),e.normalize(u.right,u.right)}var a=e.clone(u.position),l=e.clone(u.direction),c=e.clone(u.up),h=e.clone(t._cameraCV.position),d=e.clone(t._cameraCV.direction),p=e.clone(t._cameraCV.up),m=s.tweens.add({duration:i,easingFunction:o.QUARTIC_OUT,startObject:{time:0},stopObject:{time:1},update:r,complete:function(){n(t)}});t._currentTweens.push(m)}var s=t._scene,u=s.camera;u._setTransform(l.IDENTITY),i*=.5,T(t,i,r,a)}function b(t,i,r,n){function a(t){u.position=C(c,p,t.time),u.direction=C(h,m,t.time),u.up=C(d,f,t.time),u.right=e.cross(u.direction,u.up,u.right),e.normalize(u.right,u.right)}var s=t._scene,u=s.camera;u._setTransform(l.IDENTITY);var c=e.clone(u.position),h=e.clone(u.direction),d=e.clone(u.up),p=e.clone(r.position2D),m=e.clone(r.direction2D),f=e.clone(r.up2D),v=s.tweens.add({duration:i,easingFunction:o.QUARTIC_OUT,startObject:{time:0},stopObject:{time:1},update:a,complete:function(){u.position=p,u.direction=m,u.up=f,u.right=e.cross(m,f,u.right),e.normalize(u.right,u.right)}});t._currentTweens.push(v),A(t,s,1,0,i,n)}function A(e,t,r,n,a,s){var l={object:t,property:"morphTime",startValue:r,stopValue:n,duration:a,easingFunction:o.QUARTIC_OUT};i(s)&&(l.complete=function(){s(e)});var u=t.tweens.addProperty(l);e._currentTweens.push(u)}function P(e){var t=e._scene,i=t.drawingBufferHeight/t.drawingBufferWidth,r=e._camera2D.frustum;r.top=r.right*i,r.bottom=-r.top,i=1/i,r=e._cameraCV.frustum,r.aspectRatio=i,r=e._camera3D.frustum,r.aspectRatio=i;var n=t.camera;switch(t.mode){case m.SCENE3D:n.frustum=e._camera3D.frustum.clone();break;case m.COLUMBUS_VIEW:n.frustum=e._cameraCV.frustum.clone();break;case m.SCENE2D:n.frustum=e._camera2D.frustum.clone()}}function I(t){var r=t._scene;if(r._mode=m.SCENE3D,r.morphTime=m.getMorphTime(m.SCENE3D),g(t),P(t),t._previousMode!==m.MORPHING||t._morphCancelled){t._morphCancelled=!1;var n=r.camera;n.position=e.clone(t._camera3D.position),n.direction=e.clone(t._camera3D.direction),n.up=e.clone(t._camera3D.up),n.right=e.cross(n.direction,n.up,n.right),e.normalize(n.right,n.right)}var o=i(t._completeMorph);t._completeMorph=void 0,r.camera.update(r.mode),t._scene.morphComplete.raiseEvent(t,t._previousMode,m.SCENE3D,o)}function M(t){var r=t._scene;r._mode=m.SCENE2D,r.morphTime=m.getMorphTime(m.SCENE2D),g(t),P(t);var n=r.camera;e.clone(t._camera2D.position,n.position),e.clone(t._camera2D.direction,n.direction),e.clone(t._camera2D.up,n.up),e.cross(n.direction,n.up,n.right),e.normalize(n.right,n.right);var o=i(t._completeMorph);t._completeMorph=void 0,r.camera.update(r.mode),t._scene.morphComplete.raiseEvent(t,t._previousMode,m.SCENE2D,o)}function D(t){var r=t._scene;if(r._mode=m.COLUMBUS_VIEW,r.morphTime=m.getMorphTime(m.COLUMBUS_VIEW),g(t),P(t),t._previousModeMode!==m.MORPHING||t._morphCancelled){t._morphCancelled=!1;var n=r.camera;e.clone(t._cameraCV.position,n.position),e.clone(t._cameraCV.direction,n.direction),e.clone(t._cameraCV.up,n.up),e.cross(n.direction,n.up,n.right),e.normalize(n.right,n.right)}var o=i(t._completeMorph);t._completeMorph=void 0,r.camera.update(r.mode),t._scene.morphComplete.raiseEvent(t,t._previousMode,m.COLUMBUS_VIEW,o)}return f.prototype.completeMorph=function(){i(this._completeMorph)&&this._completeMorph()},f.prototype.morphTo2D=function(e,t){i(this._completeMorph)&&this._completeMorph();var r=this._scene;this._previousMode=r.mode,this._previousMode!==m.SCENE2D&&this._previousMode!==m.MORPHING&&(this._scene.morphStart.raiseEvent(this,this._previousMode,m.SCENE2D,!0),P(this),r._mode=m.MORPHING,v(this,M),this._previousMode===m.COLUMBUS_VIEW?S(this,e,t,M):w(this,e,t,M),0===e&&i(this._completeMorph)&&this._completeMorph())},f.prototype.morphToColumbusView=function(e,t){i(this._completeMorph)&&this._completeMorph();var r=this._scene;this._previousMode=r.mode,this._previousMode!==m.COLUMBUS_VIEW&&this._previousMode!==m.MORPHING&&(this._scene.morphStart.raiseEvent(this,this._previousMode,m.COLUMBUS_VIEW,!0),P(this),r._mode=m.MORPHING,v(this,D),this._previousMode===m.SCENE2D?x(this,e,t,D):b(this,e,this._cameraCV,D),0===e&&i(this._completeMorph)&&this._completeMorph())},f.prototype.morphTo3D=function(e,t){i(this._completeMorph)&&this._completeMorph();var r=this._scene;this._previousMode=r.mode,this._previousMode!==m.SCENE3D&&this._previousMode!==m.MORPHING&&(this._scene.morphStart.raiseEvent(this,this._previousMode,m.SCENE3D,!0),P(this),r._mode=m.MORPHING,v(this,I),this._previousMode===m.SCENE2D?y(this,e,t,I):_(this,e,t,I),0===e&&i(this._completeMorph)&&this._completeMorph())},f.prototype.isDestroyed=function(){return!1},f.prototype.destroy=function(){return g(this),r(this)},f}),i("Scene/TweenCollection",["../Core/clone","../Core/defaultValue","../Core/defined","../Core/defineProperties","../Core/DeveloperError","../Core/EasingFunction","../Core/getTimestamp","../Core/TimeConstants","../ThirdParty/Tween"],function(e,t,i,r,n,o,a,s,l){"use strict";function u(t,i,r,n,o,a,s,l,u,c){this._tweens=t,this._tweenjs=i,this._startObject=e(r),this._stopObject=e(n),this._duration=o,this._delay=a,this._easingFunction=s,this._update=l,this._complete=u,this.cancel=c,this.needsStart=!0}function c(){this._tweens=[]}return r(u.prototype,{startObject:{get:function(){return this._startObject}},stopObject:{get:function(){return this._stopObject}},duration:{get:function(){return this._duration}},delay:{get:function(){return this._delay}},easingFunction:{get:function(){return this._easingFunction}},update:{get:function(){return this._update}},complete:{get:function(){return this._complete}},tweenjs:{get:function(){return this._tweenjs}}}),u.prototype.cancelTween=function(){this._tweens.remove(this)},r(c.prototype,{length:{get:function(){return this._tweens.length}}}),c.prototype.add=function(r){if(r=t(r,t.EMPTY_OBJECT),0===r.duration)return i(r.complete)&&r.complete(),new u(this);var n=r.duration/s.SECONDS_PER_MILLISECOND,a=t(r.delay,0),c=a/s.SECONDS_PER_MILLISECOND,h=t(r.easingFunction,o.LINEAR_NONE),d=r.startObject,p=new l.Tween(d);p.to(e(r.stopObject),n),p.delay(c),p.easing(h),i(r.update)&&p.onUpdate(function(){r.update(d)}),p.onComplete(t(r.complete,null)),p.repeat(t(r._repeat,0));var m=new u(this,p,r.startObject,r.stopObject,r.duration,a,h,r.update,r.complete,r.cancel);return this._tweens.push(m),m},c.prototype.addProperty=function(e){function i(e){r[n]=e.value}e=t(e,t.EMPTY_OBJECT);var r=e.object,n=e.property,o=e.startValue,a=e.stopValue;return this.add({startObject:{value:o},stopObject:{value:a},duration:t(e.duration,3),delay:e.delay,easingFunction:e.easingFunction,update:i,complete:e.complete,cancel:e.cancel,_repeat:e._repeat})},c.prototype.addAlpha=function(e){function r(e){for(var t=o.length,i=0;t>i;++i)n.uniforms[o[i]].alpha=e.alpha}e=t(e,t.EMPTY_OBJECT);var n=e.material,o=[];for(var a in n.uniforms)n.uniforms.hasOwnProperty(a)&&i(n.uniforms[a])&&i(n.uniforms[a].alpha)&&o.push(a);return this.add({startObject:{alpha:t(e.startValue,0)},stopObject:{alpha:t(e.stopValue,1)},duration:t(e.duration,3),delay:e.delay,easingFunction:e.easingFunction,update:r,complete:e.complete,cancel:e.cancel})},c.prototype.addOffsetIncrement=function(e){e=t(e,t.EMPTY_OBJECT);var i=e.material,r=i.uniforms;return this.addProperty({object:r,property:"offset",startValue:r.offset,stopValue:r.offset+1,duration:e.duration,delay:e.delay,easingFunction:e.easingFunction,update:e.update,cancel:e.cancel,_repeat:1/0})},c.prototype.remove=function(e){if(!i(e))return!1;var t=this._tweens.indexOf(e);return-1!==t?(e.tweenjs.stop(),i(e.cancel)&&e.cancel(),this._tweens.splice(t,1),!0):!1},c.prototype.removeAll=function(){for(var e=this._tweens,t=0;t<e.length;++t){var r=e[t];r.tweenjs.stop(),i(r.cancel)&&r.cancel()}e.length=0},c.prototype.contains=function(e){return i(e)&&-1!==this._tweens.indexOf(e)},c.prototype.get=function(e){return this._tweens[e]},c.prototype.update=function(e){var t=this._tweens,r=0;for(e=i(e)?e/s.SECONDS_PER_MILLISECOND:a();r<t.length;){var n=t[r],o=n.tweenjs;n.needsStart?(n.needsStart=!1,o.start(e)):o.update(e)?r++:(o.stop(),t.splice(r,1))}},c}),i("Scene/ScreenSpaceCameraController",["../Core/Cartesian2","../Core/Cartesian3","../Core/Cartesian4","../Core/Cartographic","../Core/defaultValue","../Core/defined","../Core/destroyObject","../Core/DeveloperError","../Core/Ellipsoid","../Core/IntersectionTests","../Core/isArray","../Core/KeyboardEventModifier","../Core/Math","../Core/Matrix3","../Core/Matrix4","../Core/Plane","../Core/Quaternion","../Core/Ray","../Core/Transforms","./CameraEventAggregator","./CameraEventType","./SceneMode","./SceneTransforms","./TweenCollection"],function(e,t,i,r,n,o,a,s,l,u,c,h,d,p,m,f,v,g,_,y,C,E,S,w){"use strict";function T(i){this.enableInputs=!0,this.enableTranslate=!0,this.enableZoom=!0,this.enableRotate=!0,this.enableTilt=!0,this.enableLook=!0,this.inertiaSpin=.9,this.inertiaTranslate=.9,this.inertiaZoom=.8,this.maximumMovementRatio=.1,this.bounceAnimationTime=3,this.minimumZoomDistance=1,this.maximumZoomDistance=Number.POSITIVE_INFINITY,this.translateEventTypes=C.LEFT_DRAG,this.zoomEventTypes=[C.RIGHT_DRAG,C.WHEEL,C.PINCH],this.rotateEventTypes=C.LEFT_DRAG,this.tiltEventTypes=[C.MIDDLE_DRAG,C.PINCH,{eventType:C.LEFT_DRAG,modifier:h.CTRL},{eventType:C.RIGHT_DRAG,modifier:h.CTRL}],this.lookEventTypes={eventType:C.LEFT_DRAG,modifier:h.SHIFT},this.minimumPickingTerrainHeight=15e4,this._minimumPickingTerrainHeight=this.minimumPickingTerrainHeight,this.minimumCollisionTerrainHeight=15e3,this._minimumCollisionTerrainHeight=this.minimumCollisionTerrainHeight,this.minimumTrackBallHeight=75e5,this._minimumTrackBallHeight=this.minimumTrackBallHeight,this.enableCollisionDetection=!0,this._scene=i,this._globe=void 0,this._ellipsoid=void 0,this._aggregator=new y(i.canvas),this._lastInertiaSpinMovement=void 0,this._lastInertiaZoomMovement=void 0,this._lastInertiaTranslateMovement=void 0,this._lastInertiaTiltMovement=void 0,this._tweens=new w,this._tween=void 0,this._horizontalRotationAxis=void 0,this._tiltCenterMousePosition=new e(-1,-1),this._tiltCenter=new t,this._rotateMousePosition=new e(-1,-1),this._rotateStartPosition=new t,this._strafeStartPosition=new t,this._zoomMouseStart=new e,this._zoomWorldPosition=new t,this._tiltCVOffMap=!1,this._looking=!1,this._rotating=!1,this._strafing=!1,this._zoomingOnVector=!1,this._rotatingZoom=!1;var n=i.mapProjection;this._maxCoord=n.project(new r(Math.PI,d.PI_OVER_TWO)),this._zoomFactor=5,this._rotateFactor=void 0,this._rotateRateRangeAdjustment=void 0,this._maximumRotateRate=1.77,this._minimumRotateRate=2e-4,this._minimumZoomRate=20,this._maximumZoomRate=5906376272e3}function x(e,t){if(0>e)return 0;var i=25*(1-t);return Math.exp(-i*e)}function b(t){return e.equalsEpsilon(t.startPosition,t.endPosition,d.EPSILON14)}function A(t,i,r,n,a,s,l){var u=s[l];o(u)||(u=s[l]={startPosition:new e,endPosition:new e,motion:new e,active:!1});var c=t.getButtonPressTime(i,r),h=t.getButtonReleaseTime(i,r),d=c&&h&&(h.getTime()-c.getTime())/1e3,p=new Date,m=h&&(p.getTime()-h.getTime())/1e3;if(c&&h&&$>d){var f=x(m,n);if(u.active)u.startPosition=e.clone(u.endPosition,u.startPosition),u.endPosition=e.multiplyByScalar(u.motion,f,u.endPosition),u.endPosition=e.add(u.startPosition,u.endPosition,u.endPosition),u.motion=e.clone(e.ZERO,u.motion);else{var v=t.getLastMovement(i,r);if(!o(v)||b(v))return;u.motion.x=.5*(v.endPosition.x-v.startPosition.x),u.motion.y=.5*(v.endPosition.y-v.startPosition.y),u.startPosition=e.clone(v.startPosition,u.startPosition),u.endPosition=e.multiplyByScalar(u.motion,f,u.endPosition),u.endPosition=e.add(u.startPosition,u.endPosition,u.endPosition),u.active=!0}if(isNaN(u.endPosition.x)||isNaN(u.endPosition.y)||e.distance(u.startPosition,u.endPosition)<.5)return void(u.active=!1);if(!t.isButtonDown(i,r)){var g=t.getStartMousePosition(i,r);a(s,g,u)}}else u.active=!1}function P(e,t,i,r,n,a){if(o(i)){var s=e._aggregator;c(i)||(ee[0]=i,i=ee);for(var l=i.length,u=0;l>u;++u){var h=i[u],d=o(h.eventType)?h.eventType:h,p=h.modifier,m=s.isMoving(d,p)&&s.getMovement(d,p),f=s.getStartMousePosition(d,p);e.enableInputs&&t&&(m?r(e,f,m):1>n&&A(s,d,p,n,r,e,a))}}}function I(i,r,n,a,s,l){var u=1;o(l)&&(u=d.clamp(Math.abs(l),.25,1));var c=i.minimumZoomDistance*u,h=i.maximumZoomDistance,p=s-c,m=a*p;m=d.clamp(m,i._minimumZoomRate,i._maximumZoomRate);var f=n.endPosition.y-n.startPosition.y,v=f/i._scene.canvas.clientHeight;v=Math.min(v,i.maximumMovementRatio);var g=m*v;if(!(g>0&&Math.abs(s-c)<1||0>g&&Math.abs(s-h)<1)){c>s-g?g=s-c-1:s-g>h&&(g=s-h);var _,y=i._scene,C=y.camera,w=y.mode;if(o(i._globe)&&(_=w!==E.SCENE2D?L(i,r,ie):C.getPickRay(r,te).origin),!o(_))return void C.zoomIn(g);var T=e.equals(r,i._zoomMouseStart),x=i._zoomingOnVector,b=i._rotatingZoom;T||(i._zoomMouseStart=e.clone(r,i._zoomMouseStart),i._zoomWorldPosition=t.clone(_,i._zoomWorldPosition),x=i._zoomingOnVector=!1,b=i._rotatingZoom=!1);var A=w===E.COLUMBUS_VIEW;if(!T||b){if(w===E.SCENE2D){var P=i._zoomWorldPosition,I=C.position;if(!t.equals(P,I)){var M=t.subtract(P,I,ne);t.normalize(M,M);var D=t.distance(P,I)*g/(.5*C.getMagnitude());C.move(M,.5*D)}}else if(w===E.SCENE3D){var R=t.normalize(C.position,ce);if(C.positionCartographic.height<3e3&&Math.abs(t.dot(C.direction,R))<.6)A=!0;else{var O=y.canvas,N=oe;N.x=O.clientWidth/2,N.y=O.clientHeight/2;var F=L(i,N,ae);if(o(F)){var B=t.normalize(F,se),V=t.normalize(i._zoomWorldPosition,le),k=t.dot(V,B);if(k>0){var z=d.acosClamped(k),U=t.cross(V,B,ue),G=Math.abs(z)>d.toRadians(20)?.75*C.positionCartographic.height:C.positionCartographic.height-g,W=g/G;C.rotate(U,z*W)}}else A=!0}}i._rotatingZoom=!A}if(!T&&A||x){var H,q=S.wgs84ToWindowCoordinates(y,i._zoomWorldPosition,re);H=w!==E.COLUMBUS_VIEW&&e.equals(r,i._zoomMouseStart)&&o(q)?C.getPickRay(q,te):C.getPickRay(r,te);var j=H.direction;w===E.COLUMBUS_VIEW&&t.fromElements(j.y,j.z,j.x,j),C.move(j,g),i._zoomingOnVector=!0}else C.zoomIn(g)}}function M(e,i,r){var n=e._scene,o=n.camera,a=o.getPickRay(r.startPosition,he).origin,s=o.getPickRay(r.endPosition,de).origin,l=t.subtract(a,s,pe),u=t.magnitude(l);u>0&&(t.normalize(l,l),o.move(l,u))}function D(e,t,i){o(i.distance)&&(i=i.distance);var r=e._scene,n=r.camera;I(e,t,i,e._zoomFactor,n.getMagnitude())}function R(t,i,r){if(o(r.angleAndHeight))return void O(t,i,r.angleAndHeight);var n=t._scene,a=n.camera,s=n.canvas,l=s.clientWidth,u=s.clientHeight,c=me;c.x=2/l*r.startPosition.x-1,c.y=2/u*(u-r.startPosition.y)-1,c=e.normalize(c,c);var h=fe;h.x=2/l*r.endPosition.x-1,h.y=2/u*(u-r.endPosition.y)-1,h=e.normalize(h,h);var p=d.acosClamped(c.x);c.y<0&&(p=d.TWO_PI-p);var m=d.acosClamped(h.x);h.y<0&&(m=d.TWO_PI-m);var f=m-p;a.twistRight(f)}function O(e,t,i){var r=e._rotateFactor*e._rotateRateRangeAdjustment;r>e._maximumRotateRate&&(r=e._maximumRotateRate),r<e._minimumRotateRate&&(r=e._minimumRotateRate);var n=e._scene,o=n.camera,a=n.canvas,s=(i.endPosition.x-i.startPosition.x)/a.clientWidth;s=Math.min(s,e.maximumMovementRatio);var l=r*s*Math.PI*4;o.twistRight(l)}function N(e){var t=e._tweens;e._aggregator.anyButtonDown&&t.removeAll();var i=e._scene,r=i.camera;if(t.contains(e._tween)||(m.equals(m.IDENTITY,r.transform)?(P(e,e.enableTranslate,e.translateEventTypes,M,e.inertiaTranslate,"_lastInertiaTranslateMovement"),P(e,e.enableZoom,e.zoomEventTypes,D,e.inertiaZoom,"_lastInertiaZoomMovement"),P(e,e.enableRotate,e.tiltEventTypes,R,e.inertiaSpin,"_lastInertiaTiltMovement")):(P(e,e.enableRotate,e.translateEventTypes,R,e.inertiaSpin,"_lastInertiaSpinMovement"),P(e,e.enableZoom,e.zoomEventTypes,D,e.inertiaZoom,"_lastInertiaZoomMovement"))),!(e._aggregator.anyButtonDown||o(e._lastInertiaZoomMovement)&&e._lastInertiaZoomMovement.active||o(e._lastInertiaTranslateMovement)&&e._lastInertiaTranslateMovement.active||t.contains(e._tween))){var n=r.createCorrectPositionTween(e.bounceAnimationTime);o(n)&&(e._tween=t.add(n))}t.update()}function L(e,i,r){var n=e._scene,a=e._globe,s=n.camera;if(o(a)){var l;n.pickPositionSupported&&(l=n.pickPosition(i,ge));var u=s.getPickRay(i,ve),c=a.pick(u,n,_e),h=o(l)?t.distance(l,s.positionWC):Number.POSITIVE_INFINITY,d=o(c)?t.distance(c,s.positionWC):Number.POSITIVE_INFINITY;return d>h?t.clone(l,r):t.clone(c,r)}}function F(i,r,n){if(t.equals(r,i._translateMousePosition)||(i._looking=!1),t.equals(r,i._strafeMousePosition)||(i._strafing=!1),i._looking)return void K(i,r,n);if(i._strafing)return void G(i,r,n);var a,s=i._scene,l=s.camera,c=e.clone(n.startPosition,be),h=e.clone(n.endPosition,Ae),p=l.getPickRay(c,ye),m=t.clone(t.ZERO,Te),v=t.UNIT_X;if(l.position.z<i._minimumPickingTerrainHeight&&(a=L(i,c,Ee),o(a)&&(m.x=a.x)),m.x>l.position.z&&o(a))return t.clone(a,i._strafeStartPosition),i._strafing=!0,G(i,r,n),void(i._strafeMousePosition=e.clone(r,i._strafeMousePosition));var g=f.fromPointNormal(m,v,xe);p=l.getPickRay(c,ye);var _=u.rayPlane(p,g,Ee),y=l.getPickRay(h,Ce),C=u.rayPlane(y,g,Se);if(!o(_)||!o(C))return i._looking=!0,K(i,r,n),void e.clone(r,i._translateMousePosition);var E=t.subtract(_,C,we),S=E.x;E.x=E.y,E.y=E.z,E.z=S;var w=t.magnitude(E);w>d.EPSILON6&&(t.normalize(E,E),l.move(E,w))}function B(t,i,r){if(o(r.angleAndHeight)&&(r=r.angleAndHeight),e.equals(i,t._tiltCenterMousePosition)||(t._tiltCVOffMap=!1,t._looking=!1),t._looking)return void K(t,i,r);var n=t._scene,a=n.camera,s=t._maxCoord,l=Math.abs(a.position.x)-s.x<0&&Math.abs(a.position.y)-s.y<0;t._tiltCVOffMap||!l||a.position.z>t._minimumPickingTerrainHeight?(t._tiltCVOffMap=!0,V(t,i,r)):k(t,i,r)}function V(i,r,n){var a=i._scene,s=a.camera,u=a.canvas,c=Pe;c.x=u.clientWidth/2,c.y=u.clientHeight/2;var h,p=s.getPickRay(c,Ie),f=t.UNIT_X,v=p.origin,g=p.direction,y=t.dot(f,g);if(Math.abs(y)>d.EPSILON6&&(h=-t.dot(f,v)/y),!o(h)||0>=h)return i._looking=!0,K(i,r,n),void e.clone(r,i._tiltCenterMousePosition);var C=t.multiplyByScalar(g,h,Me);t.add(v,C,C);var E=a.mapProjection,S=E.ellipsoid;t.fromElements(C.y,C.z,C.x,C);var w=E.unproject(C,Be);S.cartographicToCartesian(w,C);var T=_.eastNorthUpToFixedFrame(C,S,Re),x=i._globe,b=i._ellipsoid;i._globe=void 0,i._ellipsoid=l.UNIT_SPHERE,i._rotateFactor=1,i._rotateRateRangeAdjustment=1;var A=m.clone(s.transform,Ve);s._setTransform(T),H(i,r,n,t.UNIT_Z),s._setTransform(A),i._globe=x,i._ellipsoid=b;var P=b.maximumRadius;i._rotateFactor=1/P,i._rotateRateRangeAdjustment=P}function k(i,r,n){var a,s,c=i._ellipsoid,h=i._scene,g=h.camera,y=t.UNIT_X;if(e.equals(r,i._tiltCenterMousePosition))a=t.clone(i._tiltCenter,Me);else{if(g.position.z<i._minimumPickingTerrainHeight&&(a=L(i,r,Me)),!o(a)){s=g.getPickRay(r,Ie);var C,E=s.origin,S=s.direction,w=t.dot(y,S);if(Math.abs(w)>d.EPSILON6&&(C=-t.dot(y,E)/w),!o(C)||0>=C)return i._looking=!0,K(i,r,n),void e.clone(r,i._tiltCenterMousePosition);a=t.multiplyByScalar(S,C,Me),t.add(E,a,a)}e.clone(r,i._tiltCenterMousePosition),t.clone(a,i._tiltCenter)}var T=h.canvas,x=Pe;x.x=T.clientWidth/2,x.y=i._tiltCenterMousePosition.y,s=g.getPickRay(x,Ie);var b=t.clone(t.ZERO,Ne);b.x=a.x;var A=f.fromPointNormal(b,y,Le),P=u.rayPlane(s,A,De),I=g._projection;c=I.ellipsoid,t.fromElements(a.y,a.z,a.x,a);var M=I.unproject(a,Be);c.cartographicToCartesian(M,a);var D,R=_.eastNorthUpToFixedFrame(a,c,Re);o(P)?(t.fromElements(P.y,P.z,P.x,P),M=I.unproject(P,Be),c.cartographicToCartesian(M,P),D=_.eastNorthUpToFixedFrame(P,c,Oe)):D=R;var O=i._globe,N=i._ellipsoid;i._globe=void 0,i._ellipsoid=l.UNIT_SPHERE,i._rotateFactor=1,i._rotateRateRangeAdjustment=1;var F=t.UNIT_Z,B=m.clone(g.transform,Ve);g._setTransform(R);var V=t.cross(t.UNIT_Z,t.normalize(g.position,Fe),Fe),k=t.dot(g.right,V);if(H(i,r,n,F,!1,!0),g._setTransform(D),0>k){n.startPosition.y>n.endPosition.y&&(F=void 0);var z=g.constrainedAxis;g.constrainedAxis=void 0,H(i,r,n,F,!0,!1),g.constrainedAxis=z}else H(i,r,n,F,!0,!1);if(o(g.constrainedAxis)){var U=t.cross(g.direction,g.constrainedAxis,vt);t.equalsEpsilon(U,t.ZERO,d.EPSILON6)||(t.dot(U,g.right)<0&&t.negate(U,U),t.cross(U,g.direction,g.up),t.cross(g.direction,g.up,g.right),t.normalize(g.up,g.up),t.normalize(g.right,g.right))}g._setTransform(B),i._globe=O,i._ellipsoid=N;var G=N.maximumRadius;i._rotateFactor=1/G,i._rotateRateRangeAdjustment=G;var W=t.clone(g.positionWC,Fe);if(J(i),!t.equals(g.positionWC,W)){g._setTransform(D),g.worldToCameraCoordinatesPoint(W,W);var q=t.magnitudeSquared(W);t.magnitudeSquared(g.position)>q&&(t.normalize(g.position,g.position),t.multiplyByScalar(g.position,Math.sqrt(q),g.position));var j=t.angleBetween(W,g.position),Y=t.cross(W,g.position,W);t.normalize(Y,Y);var X=v.fromAxisAngle(Y,j,ke),Z=p.fromQuaternion(X,ze);p.multiplyByVector(Z,g.direction,g.direction),p.multiplyByVector(Z,g.up,g.up),t.cross(g.direction,g.up,g.right),t.cross(g.right,g.direction,g.up),g._setTransform(B)}}function z(e,i,r){o(r.distance)&&(r=r.distance);var n=e._scene,a=n.camera,s=n.canvas,l=Ue;l.x=s.clientWidth/2,l.y=s.clientHeight/2;var u,c=a.getPickRay(l,Ge);a.position.z<e._minimumPickingTerrainHeight&&(u=L(e,l,We));var h;if(o(u))h=t.distance(c.origin,u);else{var d=t.UNIT_X,p=c.origin,m=c.direction;h=-t.dot(d,p)/t.dot(d,m)}I(e,i,r,e._zoomFactor,h)}function U(e){var t=e._scene,i=t.camera;if(m.equals(m.IDENTITY,i.transform)){var r=e._tweens;if(e._aggregator.anyButtonDown&&r.removeAll(),P(e,e.enableTilt,e.tiltEventTypes,B,e.inertiaSpin,"_lastInertiaTiltMovement"),P(e,e.enableTranslate,e.translateEventTypes,F,e.inertiaTranslate,"_lastInertiaTranslateMovement"),P(e,e.enableZoom,e.zoomEventTypes,z,e.inertiaZoom,"_lastInertiaZoomMovement"),P(e,e.enableLook,e.lookEventTypes,K),!(e._aggregator.anyButtonDown||o(e._lastInertiaZoomMovement)&&e._lastInertiaZoomMovement.active||o(e._lastInertiaTranslateMovement)&&e._lastInertiaTranslateMovement.active||r.contains(e._tween))){var n=i.createCorrectPositionTween(e.bounceAnimationTime);o(n)&&(e._tween=r.add(n))}r.update()}else P(e,e.enableRotate,e.rotateEventTypes,H,e.inertiaSpin,"_lastInertiaSpinMovement"),P(e,e.enableZoom,e.zoomEventTypes,j,e.inertiaZoom,"_lastInertiaZoomMovement")}function G(e,i,r){var n=e._scene,a=n.camera,s=L(e,r.startPosition,Ke);if(o(s)){var l=r.endPosition,c=a.getPickRay(l,He),h=t.clone(a.direction,Ye);n.mode===E.COLUMBUS_VIEW&&t.fromElements(h.z,h.x,h.y,h);var d=f.fromPointNormal(s,h,qe),p=u.rayPlane(c,d,je);o(p)&&(h=t.subtract(s,p,h),n.mode===E.COLUMBUS_VIEW&&t.fromElements(h.y,h.z,h.x,h),t.add(a.position,h,a.position))}}function W(i,r,n){var a=i._scene,s=a.camera;if(!m.equals(s.transform,m.IDENTITY))return void H(i,r,n);var u,c,h,d,p=i._ellipsoid.geodeticSurfaceNormal(s.position,$e),f=i._ellipsoid.cartesianToCartographic(s.positionWC,Ze).height,v=i._globe,g=!1;if(o(v)&&f<i._minimumPickingTerrainHeight&&(d=L(i,n.startPosition,Ke),o(d))){var _=s.getPickRay(n.startPosition,ve),y=i._ellipsoid.geodeticSurfaceNormal(d);g=Math.abs(t.dot(_.direction,y))<.05,g&&!i._looking&&(i._rotating=!1,i._strafing=!0)}return e.equals(r,i._rotateMousePosition)?void(i._looking?K(i,r,n,p):i._rotating?H(i,r,n):i._strafing?(t.clone(d,i._strafeStartPosition),G(i,r,n)):(u=t.magnitude(i._rotateStartPosition),c=Qe,c.x=c.y=c.z=u,h=l.fromCartesian3(c,Je),q(i,r,n,h))):(i._looking=!1,i._rotating=!1,i._strafing=!1,o(v)&&f<i._minimumPickingTerrainHeight?o(d)?t.magnitude(s.position)<t.magnitude(d)?(t.clone(d,i._strafeStartPosition),i._strafing=!0,G(i,r,n)):(u=t.magnitude(d),c=Qe,c.x=c.y=c.z=u,h=l.fromCartesian3(c,Je),q(i,r,n,h),t.clone(d,i._rotateStartPosition)):(i._looking=!0,K(i,r,n,p)):o(s.pickEllipsoid(n.startPosition,i._ellipsoid,Xe))?(q(i,r,n,i._ellipsoid),t.clone(Xe,i._rotateStartPosition)):f>i._minimumTrackBallHeight?(i._rotating=!0,H(i,r,n)):(i._looking=!0,K(i,r,n,p)),void e.clone(r,i._rotateMousePosition))}function H(e,i,r,a,s,l){s=n(s,!1),l=n(l,!1);var u=e._scene,c=u.camera,h=u.canvas,d=c.constrainedAxis;o(a)&&(c.constrainedAxis=a);var p=t.magnitude(c.position),m=e._rotateFactor*(p-e._rotateRateRangeAdjustment);m>e._maximumRotateRate&&(m=e._maximumRotateRate),m<e._minimumRotateRate&&(m=e._minimumRotateRate);var f=(r.startPosition.x-r.endPosition.x)/h.clientWidth,v=(r.startPosition.y-r.endPosition.y)/h.clientHeight;f=Math.min(f,e.maximumMovementRatio),v=Math.min(v,e.maximumMovementRatio);var g=m*f*Math.PI*2,_=m*v*Math.PI;s||c.rotateRight(g),l||c.rotateUp(_),c.constrainedAxis=d}function q(i,r,n,a){var s=i._scene,l=s.camera,u=e.clone(n.startPosition,at),c=e.clone(n.endPosition,st),h=l.pickEllipsoid(u,a,et),p=l.pickEllipsoid(c,a,tt);if(!o(h)||!o(p))return i._rotating=!0,void H(i,r,n);if(h=l.worldToCameraCoordinates(h,h),p=l.worldToCameraCoordinates(p,p),o(l.constrainedAxis)){var m=l.constrainedAxis,f=t.mostOrthogonalAxis(m,it);t.cross(f,m,f),t.normalize(f,f);var v=t.cross(m,f,rt),g=t.magnitude(h),_=t.dot(m,h),y=Math.acos(_/g),C=t.multiplyByScalar(m,_,nt);t.subtract(h,C,C),t.normalize(C,C);var E=t.magnitude(p),S=t.dot(m,p),w=Math.acos(S/E),T=t.multiplyByScalar(m,S,ot);t.subtract(p,T,T),t.normalize(T,T);var x=Math.acos(t.dot(C,f));t.dot(C,v)<0&&(x=d.TWO_PI-x);var b=Math.acos(t.dot(T,f));t.dot(T,v)<0&&(b=d.TWO_PI-b);var A,P=x-b;A=t.equalsEpsilon(m,l.position,d.EPSILON2)?l.right:t.cross(m,l.position,it);var I,M=t.cross(m,A,it),D=t.dot(M,t.subtract(h,m,rt)),R=t.dot(M,t.subtract(p,m,rt));I=D>0&&R>0?w-y:D>0&&0>=R?t.dot(l.position,m)>0?-y-w:y+w:y-w,l.rotateRight(P),l.rotateUp(I)}else{t.normalize(h,h),t.normalize(p,p);var O=t.dot(h,p),N=t.cross(h,p,it);if(1>O&&!t.equalsEpsilon(N,t.ZERO,d.EPSILON14)){var L=Math.acos(O);l.rotate(N,L)}}}function j(e,i,r){o(r.distance)&&(r=r.distance);var n=e._ellipsoid,a=e._scene,s=a.camera,l=a.canvas,u=Ue;u.x=l.clientWidth/2,u.y=l.clientHeight/2;var c,h=s.getPickRay(u,Ge),d=n.cartesianToCartographic(s.position,ut).height;d<e._minimumPickingTerrainHeight&&(c=L(e,u,We));var p;p=o(c)?t.distance(h.origin,c):d;var m=t.normalize(s.position,lt);I(e,i,r,e._zoomFactor,p,t.dot(m,s.direction))}function Y(t,i,r){var n=t._scene,a=n.camera;if(m.equals(a.transform,m.IDENTITY)){if(o(r.angleAndHeight)&&(r=r.angleAndHeight),e.equals(i,t._tiltCenterMousePosition)||(t._tiltOnEllipsoid=!1,t._looking=!1),t._looking){var s=t._ellipsoid.geodeticSurfaceNormal(a.position,Et);return void K(t,i,r,s)}var l=t._ellipsoid,u=l.cartesianToCartographic(a.position,Ct);t._tiltOnEllipsoid||u.height>t._minimumCollisionTerrainHeight?(t._tiltOnEllipsoid=!0,X(t,i,r)):Z(t,i,r)}}function X(i,r,n){var a=i._ellipsoid,s=i._scene,c=s.camera,h=.25*i.minimumZoomDistance,p=a.cartesianToCartographic(c.positionWC,St).height;if(!(p-h-1<d.EPSILON3&&n.endPosition.y-n.startPosition.y<0)){var f=s.canvas,v=ct;v.x=f.clientWidth/2,v.y=f.clientHeight/2;var y,C=c.getPickRay(v,ht),E=u.rayEllipsoid(C,a);if(o(E))y=g.getPoint(C,E.start,dt);else{if(!(p>i._minimumTrackBallHeight)){i._looking=!0;var S=i._ellipsoid.geodeticSurfaceNormal(c.position,Et);return K(i,r,n,S),void e.clone(r,i._tiltCenterMousePosition)}var w=u.grazingAltitudeLocation(C,a);if(!o(w))return;var T=a.cartesianToCartographic(w,Ct);T.height=0,y=a.cartographicToCartesian(T,dt)}var x=_.eastNorthUpToFixedFrame(y,a,mt),b=i._globe,A=i._ellipsoid;i._globe=void 0,i._ellipsoid=l.UNIT_SPHERE,i._rotateFactor=1,i._rotateRateRangeAdjustment=1;var P=m.clone(c.transform,gt);c._setTransform(x),H(i,r,n,t.UNIT_Z),c._setTransform(P),i._globe=b,i._ellipsoid=A;var I=A.maximumRadius;i._rotateFactor=1/I,i._rotateRateRangeAdjustment=I}}function Z(i,r,n){var a,s,c,h=i._ellipsoid,f=i._scene,y=f.camera;if(e.equals(r,i._tiltCenterMousePosition))a=t.clone(i._tiltCenter,dt);else{if(a=L(i,r,dt),!o(a)){if(s=y.getPickRay(r,ht),c=u.rayEllipsoid(s,h),!o(c)){var C=h.cartesianToCartographic(y.position,Ct);if(C.height<=i._minimumTrackBallHeight){i._looking=!0;var E=i._ellipsoid.geodeticSurfaceNormal(y.position,Et);K(i,r,n,E),e.clone(r,i._tiltCenterMousePosition)}return}a=g.getPoint(s,c.start,dt)}e.clone(r,i._tiltCenterMousePosition),t.clone(a,i._tiltCenter)}var S=f.canvas,w=ct;w.x=S.clientWidth/2,w.y=i._tiltCenterMousePosition.y,s=y.getPickRay(w,ht);var T=t.magnitude(a),x=t.fromElements(T,T,T,Qe),b=l.fromCartesian3(x,Je);if(c=u.rayEllipsoid(s,b),o(c)){var A=t.magnitude(s.origin)>T?c.start:c.stop,P=g.getPoint(s,A,pt),I=_.eastNorthUpToFixedFrame(a,h,mt),M=_.eastNorthUpToFixedFrame(P,b,ft),D=i._globe,R=i._ellipsoid;i._globe=void 0,i._ellipsoid=l.UNIT_SPHERE,i._rotateFactor=1,i._rotateRateRangeAdjustment=1;var O=t.UNIT_Z,N=m.clone(y.transform,gt); diff --git a/bower.json b/bower.json index fa5113b..0d99981 100644 --- a/bower.json +++ b/bower.json @@ -1,6 +1,6 @@ { "name": "cesium-bower", - "version": "1.18.1-beta5", + "version": "1.18.2", "description": "Cesium JS", "ignore": [ ]